1 |
// |
// |
2 |
// Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti |
// Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti |
3 |
// |
// |
4 |
// FCaloQLOOK.c version 1.07 (2006-05-23) |
// FCaloQLOOK.c version 1.08 (2006-05-29) |
5 |
// |
// |
6 |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
7 |
// |
// |
8 |
// Changelog: |
// Changelog: |
9 |
// |
// |
10 |
|
// 1.07 - 1.08 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. |
11 |
|
// |
12 |
// 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 |
// 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 |
13 |
// case of latchup alarm. |
// case of latchup alarm. |
14 |
// |
// |
67 |
} |
} |
68 |
|
|
69 |
TString getFilename(const TString filename){ |
TString getFilename(const TString filename){ |
70 |
const string fil = (const char*)filename; |
// |
71 |
Int_t posiz = fil.find("dw_"); |
const string fil = gSystem->BaseName(filename.Data()); |
72 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
Int_t posiz = fil.find(".root"); |
73 |
if ( posiz == -1 ) return 0; |
// |
|
Int_t posiz2 = posiz+13; |
|
74 |
TString file2; |
TString file2; |
75 |
stringcopy(file2,filename,posiz,posiz2); |
if ( posiz == -1 ){ |
76 |
TString pdat(".dat"); |
file2 = gSystem->BaseName(filename.Data()); |
77 |
stringappend(file2,pdat); |
} else { |
78 |
|
Int_t posiz2 = 0; |
79 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
80 |
|
TString pdat(".dat"); |
81 |
|
stringappend(file2,pdat); |
82 |
|
}; |
83 |
return file2; |
return file2; |
84 |
} |
} |
85 |
|
|
86 |
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){ |
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){ |
87 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
88 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
89 |
|
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
90 |
|
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
91 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
92 |
// |
// |
93 |
// |
// |
1067 |
pd7->Draw(); |
pd7->Draw(); |
1068 |
pd8->Draw(); |
pd8->Draw(); |
1069 |
pd1->cd(); |
pd1->cd(); |
1070 |
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"); |
1071 |
|
lup[0]->SetXTitle("OBT"); |
1072 |
|
lup[0]->SetYTitle("Number of events"); |
1073 |
lup[0]->Draw(); |
lup[0]->Draw(); |
1074 |
pd5->cd(); |
pd5->cd(); |
1075 |
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"); |
1076 |
|
// lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X"); |
1077 |
|
lupstw[0]->SetXTitle("OBT"); |
1078 |
|
lupstw[0]->SetYTitle("Number of events"); |
1079 |
lupstw[0]->Draw(); |
lupstw[0]->Draw(); |
1080 |
pd2->cd(); |
pd2->cd(); |
1081 |
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"); |
1082 |
|
// lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X"); |
1083 |
|
lup[1]->SetXTitle("OBT"); |
1084 |
|
lup[1]->SetYTitle("Number of events"); |
1085 |
lup[1]->Draw(); |
lup[1]->Draw(); |
1086 |
pd6->cd(); |
pd6->cd(); |
1087 |
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"); |
1088 |
|
// lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X"); |
1089 |
|
lupstw[1]->SetXTitle("OBT"); |
1090 |
|
lupstw[1]->SetYTitle("Number of events"); |
1091 |
lupstw[1]->Draw(); |
lupstw[1]->Draw(); |
1092 |
pd3->cd(); |
pd3->cd(); |
1093 |
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"); |
1094 |
|
// lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X"); |
1095 |
|
lup[2]->SetXTitle("OBT"); |
1096 |
|
lup[2]->SetYTitle("Number of events"); |
1097 |
lup[2]->Draw(); |
lup[2]->Draw(); |
1098 |
pd7->cd(); |
pd7->cd(); |
1099 |
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"); |
1100 |
|
// lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X"); |
1101 |
|
lupstw[2]->SetXTitle("OBT"); |
1102 |
|
lupstw[2]->SetYTitle("Number of events"); |
1103 |
lupstw[2]->Draw(); |
lupstw[2]->Draw(); |
1104 |
pd4->cd(); |
pd4->cd(); |
1105 |
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"); |
1106 |
|
// lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X"); |
1107 |
|
lup[3]->SetXTitle("OBT"); |
1108 |
|
lup[3]->SetYTitle("Number of events"); |
1109 |
lup[3]->Draw(); |
lup[3]->Draw(); |
1110 |
pd8->cd(); |
pd8->cd(); |
1111 |
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"); |
1112 |
|
// lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X"); |
1113 |
|
lupstw[3]->SetXTitle("OBT"); |
1114 |
|
lupstw[3]->SetYTitle("Number of events"); |
1115 |
lupstw[3]->Draw(); |
lupstw[3]->Draw(); |
1116 |
}; |
}; |
1117 |
// |
// |
1395 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1396 |
}; |
}; |
1397 |
// |
// |
1398 |
const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1399 |
Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1400 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
1401 |
Int_t posiz2 = posiz+13; |
// Int_t posiz2 = posiz+13; |
1402 |
TString file2; |
// TString file2; |
1403 |
stringcopy(file2,filename,posiz,posiz2); |
// stringcopy(file2,filename,posiz,posiz2); |
1404 |
// |
// |
1405 |
|
const string fil = gSystem->BaseName(filename.Data()); |
1406 |
|
Int_t posiz = fil.find(".root"); |
1407 |
|
// |
1408 |
|
TString file2; |
1409 |
|
if ( posiz == -1 ){ |
1410 |
|
file2 = gSystem->BaseName(filename.Data()); |
1411 |
|
} else { |
1412 |
|
Int_t posiz2 = 0; |
1413 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
1414 |
|
}; |
1415 |
const char *figrec = file2; |
const char *figrec = file2; |
1416 |
|
// |
1417 |
const char *outdir = outDir; |
const char *outdir = outDir; |
1418 |
stringstream figsave; |
stringstream figsave; |
1419 |
stringstream figsave1; |
stringstream figsave1; |
1422 |
if ( !strcmp(format,"ps") ) { |
if ( !strcmp(format,"ps") ) { |
1423 |
figsave.str(""); |
figsave.str(""); |
1424 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1425 |
figsave << figrec << "_qlook."; |
figsave << figrec << "_CaloQLOOK."; |
1426 |
figsave << format << "("; |
figsave << format << "("; |
1427 |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
1428 |
figsave1.str(""); |
figsave1.str(""); |
1429 |
figsave1 << outdir << "/" ; |
figsave1 << outdir << "/" ; |
1430 |
figsave1 << figrec << "_qlook."; |
figsave1 << figrec << "_CaloQLOOK."; |
1431 |
figsave1 << format; |
figsave1 << format; |
1432 |
figura->Print(figsave1.str().c_str(),"Landscape"); |
figura->Print(figsave1.str().c_str(),"Landscape"); |
1433 |
figsave2.str(""); |
figsave2.str(""); |
1434 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1435 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1436 |
if ( printfigure3 ){ |
if ( printfigure3 ){ |
1437 |
figsave2 << format; |
figsave2 << format; |
1438 |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1439 |
figsave2.str(""); |
figsave2.str(""); |
1440 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1441 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1442 |
figsave2 << format << ")"; |
figsave2 << format << ")"; |
1443 |
figura3->Print(figsave2.str().c_str(),"Landscape"); |
figura3->Print(figsave2.str().c_str(),"Landscape"); |
1444 |
} else { |
} else { |
1448 |
} else { |
} else { |
1449 |
figsave.str(""); |
figsave.str(""); |
1450 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1451 |
figsave << figrec << "_qlook1."; |
figsave << figrec << "_CaloQLOOK1."; |
1452 |
figsave << format; |
figsave << format; |
1453 |
figura->SaveAs(figsave.str().c_str()); |
figura->SaveAs(figsave.str().c_str()); |
1454 |
figsave.str(""); |
figsave.str(""); |
1455 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1456 |
figsave << figrec << "_qlook2."; |
figsave << figrec << "_CaloQLOOK2."; |
1457 |
figsave << format; |
figsave << format; |
1458 |
figura2->SaveAs(figsave.str().c_str()); |
figura2->SaveAs(figsave.str().c_str()); |
1459 |
if ( printfigure3 ){ |
if ( printfigure3 ){ |
1460 |
figsave.str(""); |
figsave.str(""); |
1461 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1462 |
figsave << figrec << "_qlook2bis."; |
figsave << figrec << "_CaloQLOOK2bis."; |
1463 |
figsave << format; |
figsave << format; |
1464 |
figura3->SaveAs(figsave.str().c_str()); |
figura3->SaveAs(figsave.str().c_str()); |
1465 |
}; |
}; |
1466 |
figsave.str(""); |
figsave.str(""); |
1467 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1468 |
figsave << figrec << "_qlook3."; |
figsave << figrec << "_CaloQLOOK3."; |
1469 |
figsave << format; |
figsave << format; |
1470 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1471 |
}; |
}; |