--- calo/flight/FQLOOK/macros/FCaloQLOOK.cxx 2006/05/23 13:28:22 1.8 +++ calo/flight/FQLOOK/macros/FCaloQLOOK.cxx 2006/05/29 12:08:13 1.10 @@ -1,12 +1,14 @@ // // Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti // -// FCaloQLOOK.c version 1.07 (2006-05-23) +// FCaloQLOOK.c version 1.08 (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.07 - 1.08 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. +// // 1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the // case of latchup alarm. // @@ -65,21 +67,27 @@ } 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; + // + const string fil = gSystem->BaseName(filename.Data()); + Int_t posiz = fil.find(".root"); + // TString file2; - stringcopy(file2,filename,posiz,posiz2); - TString pdat(".dat"); - stringappend(file2,pdat); + 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; } void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){ gStyle->SetPaperSize(19.,25.); const char* startingdir = gSystem->WorkingDirectory(); + // printf(" basename is %s \n",gSystem->BaseName(filename.Data())); + // printf(" getfilename is %s \n",getFilename(filename).Data()); if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; // // @@ -1059,28 +1067,51 @@ pd7->Draw(); pd8->Draw(); pd1->cd(); - lup[0]->SetAxisRange((Double_t)minobt[0]*0.9,(Double_t)maxobt[0]*1.1,"X"); + lup[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); + lup[0]->SetXTitle("OBT"); + lup[0]->SetYTitle("Number of events"); lup[0]->Draw(); pd5->cd(); - lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X"); + lupstw[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); + // lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X"); + lupstw[0]->SetXTitle("OBT"); + lupstw[0]->SetYTitle("Number of events"); lupstw[0]->Draw(); pd2->cd(); - lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X"); + lup[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); + // lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X"); + lup[1]->SetXTitle("OBT"); + lup[1]->SetYTitle("Number of events"); lup[1]->Draw(); pd6->cd(); - lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X"); + lupstw[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); + // lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X"); + lupstw[1]->SetXTitle("OBT"); + lupstw[1]->SetYTitle("Number of events"); lupstw[1]->Draw(); pd3->cd(); - lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X"); + lup[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); + // lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X"); + lup[2]->SetXTitle("OBT"); + lup[2]->SetYTitle("Number of events"); lup[2]->Draw(); pd7->cd(); - lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X"); + lupstw[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); + // lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X"); + lupstw[2]->SetXTitle("OBT"); + lupstw[2]->SetYTitle("Number of events"); lupstw[2]->Draw(); pd4->cd(); - lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X"); + lup[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); + // lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X"); + lup[3]->SetXTitle("OBT"); + lup[3]->SetYTitle("Number of events"); lup[3]->Draw(); pd8->cd(); - lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X"); + lupstw[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); + // lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X"); + lupstw[3]->SetXTitle("OBT"); + lupstw[3]->SetYTitle("Number of events"); lupstw[3]->Draw(); }; // @@ -1364,14 +1395,25 @@ t->DrawLatex(60.,95.," OK! "); }; // - 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 = (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; stringstream figsave; stringstream figsave1; @@ -1380,23 +1422,23 @@ if ( !strcmp(format,"ps") ) { figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_qlook."; + figsave << figrec << "_CaloQLOOK."; figsave << format << "("; rapporto->Print(figsave.str().c_str(),"Landscape"); figsave1.str(""); figsave1 << outdir << "/" ; - figsave1 << figrec << "_qlook."; + figsave1 << figrec << "_CaloQLOOK."; figsave1 << format; figura->Print(figsave1.str().c_str(),"Landscape"); figsave2.str(""); figsave2 << outdir << "/" ; - figsave2 << figrec << "_qlook."; + figsave2 << figrec << "_CaloQLOOK."; if ( printfigure3 ){ figsave2 << format; figura2->Print(figsave2.str().c_str(),"Landscape"); figsave2.str(""); figsave2 << outdir << "/" ; - figsave2 << figrec << "_qlook."; + figsave2 << figrec << "_CaloQLOOK."; figsave2 << format << ")"; figura3->Print(figsave2.str().c_str(),"Landscape"); } else { @@ -1406,24 +1448,24 @@ } else { figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_qlook1."; + figsave << figrec << "_CaloQLOOK1."; figsave << format; figura->SaveAs(figsave.str().c_str()); figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_qlook2."; + figsave << figrec << "_CaloQLOOK2."; figsave << format; figura2->SaveAs(figsave.str().c_str()); if ( printfigure3 ){ figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_qlook2bis."; + figsave << figrec << "_CaloQLOOK2bis."; figsave << format; figura3->SaveAs(figsave.str().c_str()); }; figsave.str(""); figsave << outdir << "/" ; - figsave << figrec << "_qlook3."; + figsave << figrec << "_CaloQLOOK3."; figsave << format; rapporto->SaveAs(figsave.str().c_str()); };