--- calo/flight/FQLOOK/macros/FCaloCHKCALIB.cxx 2006/03/22 15:04:11 1.7 +++ calo/flight/FQLOOK/macros/FCaloCHKCALIB.cxx 2006/05/29 09:38:26 1.8 @@ -1,12 +1,14 @@ // // Check the calorimter calibrations - Emiliano Mocchiutti // -// FCaloCHKCALIB.c version 1.06 (2006-03-22) +// FCaloCHKCALIB.c version 1.07 (2006-05-29) // // The only input needed is the path to the directory created by YODA for the data file you want to analyze. // // Changelog: // +// 1.06 - 1.07 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. Changed threshold for bad strip warning (from 0.005 to 0.03). +// // 1.05 - 1.06 (2006-03-22): Add optimize flag in compiling the script! // // 1.04 - 1.05 (2006-03-22): Corrected wrong .C files. @@ -60,17 +62,33 @@ }; } +// TString getFilename(const TString filename){ +// const string fil = (const char*)filename; +// Int_t posiz = fil.find("dw_"); +// if ( posiz == -1 ) posiz = fil.find("DW_"); +// if ( posiz == -1 ) return 0; +// Int_t posiz2 = posiz+13; +// TString file2; +// stringcopy(file2,filename,posiz,posiz2); +// TString pdat(".dat"); +// stringappend(file2,pdat); +// return file2; +// } TString getFilename(const TString filename){ - const string fil = (const char*)filename; - Int_t posiz = fil.find("dw_"); - if ( posiz == -1 ) posiz = fil.find("DW_"); - if ( posiz == -1 ) return 0; - Int_t posiz2 = posiz+13; - TString file2; - stringcopy(file2,filename,posiz,posiz2); + // + const string fil = gSystem->BaseName(filename.Data()); + Int_t posiz = fil.find(".root"); + // + TString file2; + if ( posiz == -1 ){ + file2 = gSystem->BaseName(filename.Data()); + } else { + Int_t posiz2 = 0; + stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); TString pdat(".dat"); - stringappend(file2,pdat); - return file2; + stringappend(file2,pdat); + }; + return file2; } typedef struct Calib { @@ -92,7 +110,7 @@ // Float_t ccalrmsthr=0.99; Float_t ccalpedthr=0.99; - Float_t ccalbadthr=0.005; + Float_t ccalbadthr=0.03;// 0.005 Float_t ccalthrthr=0.98; Float_t ccalvarthr=0.99; Float_t ccalbasthr=0.99; @@ -178,15 +196,28 @@ }; }; // +// // +// const string fil = (const char*)filename; +// Int_t posiz = fil.find("dw_"); +// if ( posiz == -1 ) posiz = fil.find("DW_"); +// Int_t posiz2 = posiz+13; +// TString file2; +// stringcopy(file2,filename,posiz,posiz2); +// // +// const char *figrec = file2; // - const string fil = (const char*)filename; - Int_t posiz = fil.find("dw_"); - if ( posiz == -1 ) posiz = fil.find("DW_"); - Int_t posiz2 = posiz+13; - TString file2; - stringcopy(file2,filename,posiz,posiz2); + const string fil = gSystem->BaseName(filename.Data()); + Int_t posiz = fil.find(".root"); // + TString file2; + if ( posiz == -1 ){ + file2 = gSystem->BaseName(filename.Data()); + } else { + Int_t posiz2 = 0; + stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); + }; const char *figrec = file2; + // const char *outdir = outDir; const char *format = saveas; stringstream figsave; @@ -935,7 +966,7 @@ if ( ci == minev ) { figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_chkcalib."; + figsave << figrec << "_CaloCHKCALIB."; figsave << format; figsave << "("; }; @@ -944,7 +975,7 @@ if ( ci == minev ) { figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_chkcalib."; + figsave << figrec << "_CaloCHKCALIB."; figsave << format; }; }; @@ -953,7 +984,7 @@ if ( ci == minev ) { figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_chkcalib."; + figsave << figrec << "_CaloCHKCALIB."; figsave << format; }; // @@ -962,7 +993,7 @@ if ( ci == maxev-4 ) { figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_chkcalib."; + figsave << figrec << "_CaloCHKCALIB."; figsave << format; figsave << ")"; rapporto->Print(figsave.str().c_str(),"Portrait"); @@ -971,7 +1002,7 @@ if ( figmatra ) { figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_chkcalib1_"; + figsave << figrec << "_CaloCHKCALIB1_"; figsave << (i+1) << "."; figsave << format; figura2->SaveAs(figsave.str().c_str()); @@ -979,14 +1010,14 @@ // figsave1.str(""); figsave1 << outdir << "/" ; - figsave1 << figrec << "_chkcalib2_"; + figsave1 << figrec << "_CaloCHKCALIB2_"; figsave1 << (i+1) << "."; figsave1 << format; figura1->SaveAs(figsave1.str().c_str()); // figsave2.str(""); figsave2 << outdir << "/" ; - figsave2 << figrec << "_chkcalib3_"; + figsave2 << figrec << "_CaloCHKCALIB3_"; figsave2 << (i+1) << "."; figsave2 << format; figura3->SaveAs(figsave2.str().c_str()); @@ -994,7 +1025,7 @@ if ( ci == maxev-4 ) { figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_chkcalib_report."; + figsave << figrec << "_CaloCHKCALIB_report."; figsave << format; rapporto->SaveAs(figsave.str().c_str()); };