1 |
//------------------------------------------------------------------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------------------------------------------------------------------- |
2 |
// |
// |
3 |
// FEventViewer.c version 1.00 (2006-03-09) |
// FEventViewer.c version 1.02 (2006-03-22) |
4 |
// |
// |
5 |
// Shows PAMELA events - Emiliano Mocchiutti |
// Shows PAMELA events - Emiliano Mocchiutti |
6 |
// |
// |
23 |
// |
// |
24 |
// Changelog: |
// Changelog: |
25 |
// |
// |
26 |
|
// 1.01 - 1.02 (2006-03-22): Read calorimeter ADC2MIP flight conversion file. Do not install FEventviewer.cxx! |
27 |
|
// |
28 |
// 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). |
29 |
// |
// |
30 |
// 0.00 - 1.00 (2006-03-09): Clone of EventViewer.c v9r01. |
// 0.00 - 1.00 (2006-03-09): Clone of EventViewer.c v9r01. |
5705 |
const char *pam_calib = pathtocalibration(); |
const char *pam_calib = pathtocalibration(); |
5706 |
stringstream calfile; |
stringstream calfile; |
5707 |
calfile.str(""); |
calfile.str(""); |
5708 |
calfile << pam_calib << "/CaloADC2MIP.root"; |
calfile << pam_calib << "/FCaloADC2MIP.dat"; |
5709 |
// |
// |
5710 |
Int_t selection = 0; |
Int_t selection = 0; |
5711 |
Bool_t firsttime = true; |
Bool_t firsttime = true; |
5805 |
Float_t mip[2][22][96]; |
Float_t mip[2][22][96]; |
5806 |
Int_t okcalo = 0; |
Int_t okcalo = 0; |
5807 |
// |
// |
|
TFile *chfile = 0; |
|
|
TTree *ctree = 0; |
|
|
CalorimeterCalibration *ccalo = 0; |
|
|
// TFile *chfile = new TFile; |
|
|
//TTree *ctree = new TTree; |
|
|
//CalorimeterCalibration *ccalo = new CalorimeterCalibration(); |
|
5808 |
Long64_t cnevents = 0ULL; |
Long64_t cnevents = 0ULL; |
5809 |
// |
// |
5810 |
var.goon = false; |
var.goon = false; |
6352 |
// |
// |
6353 |
if ( !var.refresh ){ |
if ( !var.refresh ){ |
6354 |
if ( !CALOLEV && var.CALO ){ |
if ( !CALOLEV && var.CALO ){ |
6355 |
// if ( !existfile((TString)calfile.str().c_str()) ){ |
printf(" ADC to MIP conversion file: \n %s \n",calfile.str().c_str()); |
6356 |
if ( true ){ |
FILE *f; |
6357 |
printf(" WARNING: no calorimeter calibration file! \n Using 26 as conversion factor for all strips. \n"); |
f = fopen(calfile.str().c_str(),"rb"); |
6358 |
okcalo = 0; |
if ( !f ){ |
6359 |
|
printf(" WARNING: no calorimeter ADC to MIP file! \n Using 26 as conversion factor for all strips. \n"); |
6360 |
} else { |
} else { |
|
// chfile = new TFile(calfile.str().c_str(),"READ","Calorimeter CALIBRATION data"); |
|
|
chfile = new TFile(calfile.str().c_str(),"READ"); |
|
6361 |
okcalo = 1; |
okcalo = 1; |
|
ctree = (TTree*)chfile->Get("CaloADC"); |
|
|
if ( !ctree ){ |
|
|
okcalo = 0; |
|
|
chfile->Close(); |
|
|
} else { |
|
|
ctree->SetBranchAddress("Event", &ccalo); |
|
|
// |
|
|
cnevents = ctree->GetEntries(); |
|
|
ctree->GetEntry(cnevents-1); |
|
|
}; |
|
6362 |
}; |
}; |
6363 |
// |
// |
6364 |
if ( okcalo ) { |
for (Int_t m = 0; m < 2 ; m++ ){ |
6365 |
for (Int_t m = 0; m < 2 ; m++ ){ |
for (Int_t k = 0; k < 22; k++ ){ |
6366 |
for (Int_t k = 0; k < 22; k++ ){ |
for (Int_t l = 0; l < 96; l++ ){ |
6367 |
for (Int_t l = 0; l < 96; l++ ){ |
if ( okcalo ) { |
6368 |
if ( (ccalo->fp[1][m][k][l] > 20. && ccalo->fp[1][m][k][l] < 32.) || ccalo->mask[m][k][l] == 1. ) { |
fread(&mip[m][k][l],sizeof(mip[m][k][l]),1,f); |
6369 |
if ( ccalo->mip[m][k][l] != 0. ){ |
} else { |
6370 |
mip[m][k][l] = ccalo->mip[m][k][l]; |
mip[m][k][l] = 26. ; |
6371 |
} else { |
}; |
6372 |
mip[m][k][l] = 26. ; |
|
|
}; |
|
|
} else { |
|
|
mip[m][k][l] = 26. ; |
|
|
}; |
|
|
}; |
|
6373 |
}; |
}; |
6374 |
}; |
}; |
|
chfile->Close(); |
|
|
} else { |
|
|
for (Int_t m = 0; m < 2 ; m++ ){ |
|
|
for (Int_t k = 0; k < 22; k++ ){ |
|
|
for (Int_t l = 0; l < 96; l++ ){ |
|
|
mip[m][k][l] = 26. ; |
|
|
}; |
|
|
}; |
|
|
}; |
|
6375 |
}; |
}; |
6376 |
|
if ( okcalo ) fclose(f); |
6377 |
}; |
}; |
6378 |
}; |
}; |
6379 |
// |
// |