| 1 |
//------------------------------------------------------------------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 2 |
// |
// |
| 3 |
// FEventViewer.c version 1.02 (2006-03-22) |
// FEventViewer.c version 1.03 (2006-04-04) |
| 4 |
// |
// |
| 5 |
// Shows PAMELA events - Emiliano Mocchiutti |
// Shows PAMELA events - Emiliano Mocchiutti |
| 6 |
// |
// |
| 23 |
// |
// |
| 24 |
// Changelog: |
// Changelog: |
| 25 |
// |
// |
| 26 |
|
// 1.02 - 1.03 (2006-04-04): Make it possible to select events with the calorimeter also when generating level1 from level0. |
| 27 |
|
// |
| 28 |
// 1.01 - 1.02 (2006-03-22): Read calorimeter ADC2MIP flight conversion file. Do not install FEventviewer.cxx! |
// 1.01 - 1.02 (2006-03-22): Read calorimeter ADC2MIP flight conversion file. Do not install FEventviewer.cxx! |
| 29 |
// |
// |
| 30 |
// 1.00 - 1.01 (2006-03-09): Flight version, read unique YODA file. Many capabilities disabled at the moment (reads only LEVEL0 data). |
// 1.00 - 1.01 (2006-03-09): Flight version, read unique YODA file. Many capabilities disabled at the moment (reads only LEVEL0 data). |
| 5118 |
// OTHER SUBROUTINES ** |
// OTHER SUBROUTINES ** |
| 5119 |
//********************************************************************************** |
//********************************************************************************** |
| 5120 |
|
|
| 5121 |
void ShowCaloL0(TString filename, Int_t i, Calib & calib, Int_t b[4], Float_t mip[2][22][96], TTree *otr, Variables & var){ |
void ShowCaloL0(TString filename, Int_t i, Calib & calib, Int_t b[4], Float_t mip[2][22][96], TTree *otr, Variables & var, Bool_t upd){ |
| 5122 |
struct Evento evento; |
struct Evento evento; |
| 5123 |
Int_t tot0 = 0; |
Int_t tot0 = 0; |
| 5124 |
Int_t tot1 = 0; |
Int_t tot1 = 0; |
| 5158 |
Int_t bgcolor = 10; |
Int_t bgcolor = 10; |
| 5159 |
TPad *pd1 = new TPad("calox","This is pad1",var.xxvc-0.154*var.sfx,var.yxvc-0.3645*var.sfy,var.xxvc+0.154*var.sfx,var.yxvc-0.1200*var.sfy,bgcolor); |
TPad *pd1 = new TPad("calox","This is pad1",var.xxvc-0.154*var.sfx,var.yxvc-0.3645*var.sfy,var.xxvc+0.154*var.sfx,var.yxvc-0.1200*var.sfy,bgcolor); |
| 5160 |
TPad *pd2 = new TPad("caloy","This is pad2",var.xyvc-0.154*var.sfx,var.yyvc-0.3645*var.sfy,var.xyvc+0.154*var.sfx,var.yyvc-0.1200*var.sfy,bgcolor); |
TPad *pd2 = new TPad("caloy","This is pad2",var.xyvc-0.154*var.sfx,var.yyvc-0.3645*var.sfy,var.xyvc+0.154*var.sfx,var.yyvc-0.1200*var.sfy,bgcolor); |
| 5161 |
|
if ( upd ){ |
| 5162 |
|
|
| 5163 |
pd1->SetFillStyle(4000); |
pd1->SetFillStyle(4000); |
| 5164 |
pd1->SetFillColor(0); |
pd1->SetFillColor(0); |
| 5193 |
Yview->Fill(1.,1.,1.); |
Yview->Fill(1.,1.,1.); |
| 5194 |
Yview->Draw("box"); |
Yview->Draw("box"); |
| 5195 |
pd2->Update(); |
pd2->Update(); |
| 5196 |
|
}; |
| 5197 |
// |
// |
| 5198 |
// for each event check that the calibration we are using are still within calibration limits, if not call the next calibration |
// for each event check that the calibration we are using are still within calibration limits, if not call the next calibration |
| 5199 |
// |
// |
| 5315 |
// |
// |
| 5316 |
// OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course) |
// OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course) |
| 5317 |
// |
// |
| 5318 |
|
if ( upd ){ |
| 5319 |
xve.str(""); |
xve.str(""); |
| 5320 |
yve.str(""); |
yve.str(""); |
| 5321 |
xve << "x-view event " << n; |
xve << "x-view event " << n; |
| 5348 |
pd2->cd(); |
pd2->cd(); |
| 5349 |
Yview->Draw("box same"); |
Yview->Draw("box same"); |
| 5350 |
}; |
}; |
| 5351 |
}; |
}; |
| 5352 |
|
}; |
| 5353 |
if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] != 0 ) badstrip++; |
if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] != 0 ) badstrip++; |
| 5354 |
if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] == 0 ) { |
if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] == 0 ) { |
| 5355 |
qtot += estrip[l][m][n]; |
qtot += estrip[l][m][n]; |
| 5360 |
}; |
}; |
| 5361 |
}; |
}; |
| 5362 |
}; |
}; |
| 5363 |
|
if ( upd ){ |
| 5364 |
pd1->Update(); |
pd1->Update(); |
| 5365 |
pd2->Update(); |
pd2->Update(); |
| 5366 |
|
}; |
| 5367 |
var.qtot=(int)qtot; |
var.qtot=(int)qtot; |
| 5368 |
var.nstrip=nstrip; |
var.nstrip=nstrip; |
| 5369 |
} |
} |
| 6483 |
isOK = 1; |
isOK = 1; |
| 6484 |
seldone = 1; |
seldone = 1; |
| 6485 |
} else { |
} else { |
| 6486 |
|
if ( CALOLEV == 0 ) ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var,false); |
| 6487 |
isOK = 0; |
isOK = 0; |
| 6488 |
stringstream cintcom; |
stringstream cintcom; |
| 6489 |
cintcom.str(""); |
cintcom.str(""); |
| 6503 |
cintcom << "struct Levels &level = (struct Levels &)0x" << hex; |
cintcom << "struct Levels &level = (struct Levels &)0x" << hex; |
| 6504 |
cintcom << &level; |
cintcom << &level; |
| 6505 |
gROOT->ProcessLine(cintcom.str().c_str()); |
gROOT->ProcessLine(cintcom.str().c_str()); |
| 6506 |
isOK = gApplication->ProcessLine("filter((Int_t)a,(TTree *)otr,(TTree *)ttr,(Levels &)level);"); |
cintcom.str(""); |
| 6507 |
|
cintcom << "struct Variables &var = (struct Variables &)0x" << hex; |
| 6508 |
|
cintcom << &var; |
| 6509 |
|
gROOT->ProcessLine(cintcom.str().c_str()); |
| 6510 |
|
isOK = gApplication->ProcessLine("filter((Int_t)a,(TTree *)otr,(TTree *)ttr,(Levels &)level,(Variables &)var);"); |
| 6511 |
seldone = 1; |
seldone = 1; |
| 6512 |
printf("Scanning data: %d%c done",100*(i-minevent)/(maxevent-minevent),37); |
printf("Scanning data: %d%c done",100*(i-minevent)/(maxevent-minevent),37); |
| 6513 |
fflush(stdout); |
fflush(stdout); |
| 6711 |
// |
// |
| 6712 |
if ( CALOLEV == 0 ) { |
if ( CALOLEV == 0 ) { |
| 6713 |
if ( !thefirst ) { |
if ( !thefirst ) { |
| 6714 |
ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var); |
ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var,true); |
| 6715 |
} else { |
} else { |
| 6716 |
printf("\n\n CALORIMETER: looking for calibration data...\n"); |
printf("\n\n CALORIMETER: looking for calibration data...\n"); |
| 6717 |
thefirst = 0; |
thefirst = 0; |
| 6740 |
printf(" No calorimeter calibrations! Switching to raw mode visualitation \n Only COMPRESS and FULL mode acquisition are supported \n\n"); |
printf(" No calorimeter calibrations! Switching to raw mode visualitation \n Only COMPRESS and FULL mode acquisition are supported \n\n"); |
| 6741 |
CALOLEV = -1; |
CALOLEV = -1; |
| 6742 |
} else { |
} else { |
| 6743 |
ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var); |
ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var,true); |
| 6744 |
}; |
}; |
| 6745 |
}; |
}; |
| 6746 |
}; |
}; |