--- eventviewer/flight/macros/FEventViewer.cxx 2006/03/20 10:36:48 1.1.1.1 +++ eventviewer/flight/macros/FEventViewer.cxx 2006/03/22 15:05:27 1.2 @@ -1,6 +1,6 @@ //------------------------------------------------------------------------------------------------------------------------------------------------------- // -// FEventViewer.c version 1.00 (2006-03-09) +// FEventViewer.c version 1.02 (2006-03-22) // // Shows PAMELA events - Emiliano Mocchiutti // @@ -23,6 +23,8 @@ // // Changelog: // +// 1.01 - 1.02 (2006-03-22): Read calorimeter ADC2MIP flight conversion file. Do not install FEventviewer.cxx! +// // 1.00 - 1.01 (2006-03-09): Flight version, read unique YODA file. Many capabilities disabled at the moment (reads only LEVEL0 data). // // 0.00 - 1.00 (2006-03-09): Clone of EventViewer.c v9r01. @@ -5703,7 +5705,7 @@ const char *pam_calib = pathtocalibration(); stringstream calfile; calfile.str(""); - calfile << pam_calib << "/CaloADC2MIP.root"; + calfile << pam_calib << "/FCaloADC2MIP.dat"; // Int_t selection = 0; Bool_t firsttime = true; @@ -5803,12 +5805,6 @@ Float_t mip[2][22][96]; Int_t okcalo = 0; // - TFile *chfile = 0; - TTree *ctree = 0; - CalorimeterCalibration *ccalo = 0; - // TFile *chfile = new TFile; - //TTree *ctree = new TTree; - //CalorimeterCalibration *ccalo = new CalorimeterCalibration(); Long64_t cnevents = 0ULL; // var.goon = false; @@ -6356,52 +6352,28 @@ // if ( !var.refresh ){ if ( !CALOLEV && var.CALO ){ - // if ( !existfile((TString)calfile.str().c_str()) ){ - if ( true ){ - printf(" WARNING: no calorimeter calibration file! \n Using 26 as conversion factor for all strips. \n"); - okcalo = 0; + printf(" ADC to MIP conversion file: \n %s \n",calfile.str().c_str()); + FILE *f; + f = fopen(calfile.str().c_str(),"rb"); + if ( !f ){ + printf(" WARNING: no calorimeter ADC to MIP file! \n Using 26 as conversion factor for all strips. \n"); } else { - // chfile = new TFile(calfile.str().c_str(),"READ","Calorimeter CALIBRATION data"); - chfile = new TFile(calfile.str().c_str(),"READ"); 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); - }; }; // - if ( okcalo ) { - for (Int_t m = 0; m < 2 ; m++ ){ - for (Int_t k = 0; k < 22; k++ ){ - for (Int_t l = 0; l < 96; l++ ){ - if ( (ccalo->fp[1][m][k][l] > 20. && ccalo->fp[1][m][k][l] < 32.) || ccalo->mask[m][k][l] == 1. ) { - if ( ccalo->mip[m][k][l] != 0. ){ - mip[m][k][l] = ccalo->mip[m][k][l]; - } else { - mip[m][k][l] = 26. ; - }; - } else { - mip[m][k][l] = 26. ; - }; - }; + for (Int_t m = 0; m < 2 ; m++ ){ + for (Int_t k = 0; k < 22; k++ ){ + for (Int_t l = 0; l < 96; l++ ){ + if ( okcalo ) { + fread(&mip[m][k][l],sizeof(mip[m][k][l]),1,f); + } else { + mip[m][k][l] = 26. ; + }; + }; }; - 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. ; - }; - }; - }; }; + if ( okcalo ) fclose(f); }; }; //