1 |
// |
// |
2 |
// Check the calorimter calibrations - Emiliano Mocchiutti |
// Check the calorimter calibrations - Emiliano Mocchiutti |
3 |
// |
// |
4 |
// FCaloCHKCALIB.c version 1.06 (2006-03-22) |
// FCaloCHKCALIB.c version 1.07 (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.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). |
11 |
|
// |
12 |
// 1.05 - 1.06 (2006-03-22): Add optimize flag in compiling the script! |
// 1.05 - 1.06 (2006-03-22): Add optimize flag in compiling the script! |
13 |
// |
// |
14 |
// 1.04 - 1.05 (2006-03-22): Corrected wrong .C files. |
// 1.04 - 1.05 (2006-03-22): Corrected wrong .C files. |
62 |
}; |
}; |
63 |
} |
} |
64 |
|
|
65 |
|
// TString getFilename(const TString filename){ |
66 |
|
// const string fil = (const char*)filename; |
67 |
|
// Int_t posiz = fil.find("dw_"); |
68 |
|
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
69 |
|
// if ( posiz == -1 ) return 0; |
70 |
|
// Int_t posiz2 = posiz+13; |
71 |
|
// TString file2; |
72 |
|
// stringcopy(file2,filename,posiz,posiz2); |
73 |
|
// TString pdat(".dat"); |
74 |
|
// stringappend(file2,pdat); |
75 |
|
// return file2; |
76 |
|
// } |
77 |
TString getFilename(const TString filename){ |
TString getFilename(const TString filename){ |
78 |
const string fil = (const char*)filename; |
// |
79 |
Int_t posiz = fil.find("dw_"); |
const string fil = gSystem->BaseName(filename.Data()); |
80 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
Int_t posiz = fil.find(".root"); |
81 |
if ( posiz == -1 ) return 0; |
// |
82 |
Int_t posiz2 = posiz+13; |
TString file2; |
83 |
TString file2; |
if ( posiz == -1 ){ |
84 |
stringcopy(file2,filename,posiz,posiz2); |
file2 = gSystem->BaseName(filename.Data()); |
85 |
|
} else { |
86 |
|
Int_t posiz2 = 0; |
87 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
88 |
TString pdat(".dat"); |
TString pdat(".dat"); |
89 |
stringappend(file2,pdat); |
stringappend(file2,pdat); |
90 |
return file2; |
}; |
91 |
|
return file2; |
92 |
} |
} |
93 |
|
|
94 |
typedef struct Calib { |
typedef struct Calib { |
110 |
// |
// |
111 |
Float_t ccalrmsthr=0.99; |
Float_t ccalrmsthr=0.99; |
112 |
Float_t ccalpedthr=0.99; |
Float_t ccalpedthr=0.99; |
113 |
Float_t ccalbadthr=0.005; |
Float_t ccalbadthr=0.03;// 0.005 |
114 |
Float_t ccalthrthr=0.98; |
Float_t ccalthrthr=0.98; |
115 |
Float_t ccalvarthr=0.99; |
Float_t ccalvarthr=0.99; |
116 |
Float_t ccalbasthr=0.99; |
Float_t ccalbasthr=0.99; |
196 |
}; |
}; |
197 |
}; |
}; |
198 |
// |
// |
199 |
|
// // |
200 |
|
// const string fil = (const char*)filename; |
201 |
|
// Int_t posiz = fil.find("dw_"); |
202 |
|
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
203 |
|
// Int_t posiz2 = posiz+13; |
204 |
|
// TString file2; |
205 |
|
// stringcopy(file2,filename,posiz,posiz2); |
206 |
|
// // |
207 |
|
// const char *figrec = file2; |
208 |
// |
// |
209 |
const string fil = (const char*)filename; |
const string fil = gSystem->BaseName(filename.Data()); |
210 |
Int_t posiz = fil.find("dw_"); |
Int_t posiz = fil.find(".root"); |
|
if ( posiz == -1 ) posiz = fil.find("DW_"); |
|
|
Int_t posiz2 = posiz+13; |
|
|
TString file2; |
|
|
stringcopy(file2,filename,posiz,posiz2); |
|
211 |
// |
// |
212 |
|
TString file2; |
213 |
|
if ( posiz == -1 ){ |
214 |
|
file2 = gSystem->BaseName(filename.Data()); |
215 |
|
} else { |
216 |
|
Int_t posiz2 = 0; |
217 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
218 |
|
}; |
219 |
const char *figrec = file2; |
const char *figrec = file2; |
220 |
|
// |
221 |
const char *outdir = outDir; |
const char *outdir = outDir; |
222 |
const char *format = saveas; |
const char *format = saveas; |
223 |
stringstream figsave; |
stringstream figsave; |
966 |
if ( ci == minev ) { |
if ( ci == minev ) { |
967 |
figsave.str(""); |
figsave.str(""); |
968 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
969 |
figsave << figrec << "_chkcalib."; |
figsave << figrec << "_CaloCHKCALIB."; |
970 |
figsave << format; |
figsave << format; |
971 |
figsave << "("; |
figsave << "("; |
972 |
}; |
}; |
975 |
if ( ci == minev ) { |
if ( ci == minev ) { |
976 |
figsave.str(""); |
figsave.str(""); |
977 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
978 |
figsave << figrec << "_chkcalib."; |
figsave << figrec << "_CaloCHKCALIB."; |
979 |
figsave << format; |
figsave << format; |
980 |
}; |
}; |
981 |
}; |
}; |
984 |
if ( ci == minev ) { |
if ( ci == minev ) { |
985 |
figsave.str(""); |
figsave.str(""); |
986 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
987 |
figsave << figrec << "_chkcalib."; |
figsave << figrec << "_CaloCHKCALIB."; |
988 |
figsave << format; |
figsave << format; |
989 |
}; |
}; |
990 |
// |
// |
993 |
if ( ci == maxev-4 ) { |
if ( ci == maxev-4 ) { |
994 |
figsave.str(""); |
figsave.str(""); |
995 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
996 |
figsave << figrec << "_chkcalib."; |
figsave << figrec << "_CaloCHKCALIB."; |
997 |
figsave << format; |
figsave << format; |
998 |
figsave << ")"; |
figsave << ")"; |
999 |
rapporto->Print(figsave.str().c_str(),"Portrait"); |
rapporto->Print(figsave.str().c_str(),"Portrait"); |
1002 |
if ( figmatra ) { |
if ( figmatra ) { |
1003 |
figsave.str(""); |
figsave.str(""); |
1004 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1005 |
figsave << figrec << "_chkcalib1_"; |
figsave << figrec << "_CaloCHKCALIB1_"; |
1006 |
figsave << (i+1) << "."; |
figsave << (i+1) << "."; |
1007 |
figsave << format; |
figsave << format; |
1008 |
figura2->SaveAs(figsave.str().c_str()); |
figura2->SaveAs(figsave.str().c_str()); |
1010 |
// |
// |
1011 |
figsave1.str(""); |
figsave1.str(""); |
1012 |
figsave1 << outdir << "/" ; |
figsave1 << outdir << "/" ; |
1013 |
figsave1 << figrec << "_chkcalib2_"; |
figsave1 << figrec << "_CaloCHKCALIB2_"; |
1014 |
figsave1 << (i+1) << "."; |
figsave1 << (i+1) << "."; |
1015 |
figsave1 << format; |
figsave1 << format; |
1016 |
figura1->SaveAs(figsave1.str().c_str()); |
figura1->SaveAs(figsave1.str().c_str()); |
1017 |
// |
// |
1018 |
figsave2.str(""); |
figsave2.str(""); |
1019 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1020 |
figsave2 << figrec << "_chkcalib3_"; |
figsave2 << figrec << "_CaloCHKCALIB3_"; |
1021 |
figsave2 << (i+1) << "."; |
figsave2 << (i+1) << "."; |
1022 |
figsave2 << format; |
figsave2 << format; |
1023 |
figura3->SaveAs(figsave2.str().c_str()); |
figura3->SaveAs(figsave2.str().c_str()); |
1025 |
if ( ci == maxev-4 ) { |
if ( ci == maxev-4 ) { |
1026 |
figsave.str(""); |
figsave.str(""); |
1027 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1028 |
figsave << figrec << "_chkcalib_report."; |
figsave << figrec << "_CaloCHKCALIB_report."; |
1029 |
figsave << format; |
figsave << format; |
1030 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1031 |
}; |
}; |