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 |
// |
// |
1372 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1373 |
}; |
}; |
1374 |
// |
// |
1375 |
const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1376 |
Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1377 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
1378 |
Int_t posiz2 = posiz+13; |
// Int_t posiz2 = posiz+13; |
1379 |
TString file2; |
// TString file2; |
1380 |
stringcopy(file2,filename,posiz,posiz2); |
// stringcopy(file2,filename,posiz,posiz2); |
1381 |
// |
// |
1382 |
|
const string fil = gSystem->BaseName(filename.Data()); |
1383 |
|
Int_t posiz = fil.find(".root"); |
1384 |
|
// |
1385 |
|
TString file2; |
1386 |
|
if ( posiz == -1 ){ |
1387 |
|
file2 = gSystem->BaseName(filename.Data()); |
1388 |
|
} else { |
1389 |
|
Int_t posiz2 = 0; |
1390 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
1391 |
|
}; |
1392 |
const char *figrec = file2; |
const char *figrec = file2; |
1393 |
|
// |
1394 |
const char *outdir = outDir; |
const char *outdir = outDir; |
1395 |
stringstream figsave; |
stringstream figsave; |
1396 |
stringstream figsave1; |
stringstream figsave1; |
1399 |
if ( !strcmp(format,"ps") ) { |
if ( !strcmp(format,"ps") ) { |
1400 |
figsave.str(""); |
figsave.str(""); |
1401 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1402 |
figsave << figrec << "_qlook."; |
figsave << figrec << "_CaloQLOOK."; |
1403 |
figsave << format << "("; |
figsave << format << "("; |
1404 |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
1405 |
figsave1.str(""); |
figsave1.str(""); |
1406 |
figsave1 << outdir << "/" ; |
figsave1 << outdir << "/" ; |
1407 |
figsave1 << figrec << "_qlook."; |
figsave1 << figrec << "_CaloQLOOK."; |
1408 |
figsave1 << format; |
figsave1 << format; |
1409 |
figura->Print(figsave1.str().c_str(),"Landscape"); |
figura->Print(figsave1.str().c_str(),"Landscape"); |
1410 |
figsave2.str(""); |
figsave2.str(""); |
1411 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1412 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1413 |
if ( printfigure3 ){ |
if ( printfigure3 ){ |
1414 |
figsave2 << format; |
figsave2 << format; |
1415 |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1416 |
figsave2.str(""); |
figsave2.str(""); |
1417 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1418 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1419 |
figsave2 << format << ")"; |
figsave2 << format << ")"; |
1420 |
figura3->Print(figsave2.str().c_str(),"Landscape"); |
figura3->Print(figsave2.str().c_str(),"Landscape"); |
1421 |
} else { |
} else { |
1425 |
} else { |
} else { |
1426 |
figsave.str(""); |
figsave.str(""); |
1427 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1428 |
figsave << figrec << "_qlook1."; |
figsave << figrec << "_CaloQLOOK1."; |
1429 |
figsave << format; |
figsave << format; |
1430 |
figura->SaveAs(figsave.str().c_str()); |
figura->SaveAs(figsave.str().c_str()); |
1431 |
figsave.str(""); |
figsave.str(""); |
1432 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1433 |
figsave << figrec << "_qlook2."; |
figsave << figrec << "_CaloQLOOK2."; |
1434 |
figsave << format; |
figsave << format; |
1435 |
figura2->SaveAs(figsave.str().c_str()); |
figura2->SaveAs(figsave.str().c_str()); |
1436 |
if ( printfigure3 ){ |
if ( printfigure3 ){ |
1437 |
figsave.str(""); |
figsave.str(""); |
1438 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1439 |
figsave << figrec << "_qlook2bis."; |
figsave << figrec << "_CaloQLOOK2bis."; |
1440 |
figsave << format; |
figsave << format; |
1441 |
figura3->SaveAs(figsave.str().c_str()); |
figura3->SaveAs(figsave.str().c_str()); |
1442 |
}; |
}; |
1443 |
figsave.str(""); |
figsave.str(""); |
1444 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1445 |
figsave << figrec << "_qlook3."; |
figsave << figrec << "_CaloQLOOK3."; |
1446 |
figsave << format; |
figsave << format; |
1447 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1448 |
}; |
}; |