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.12 (2006-08-04) |
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.12 (2006-08-04): bugs fixed. |
11 |
|
// |
12 |
|
// 1.07 - 1.11 (2006-07-17): Adapted to flight conditions. |
13 |
|
// |
14 |
|
// 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). |
15 |
|
// |
16 |
// 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! |
17 |
// |
// |
18 |
// 1.04 - 1.05 (2006-03-22): Corrected wrong .C files. |
// 1.04 - 1.05 (2006-03-22): Corrected wrong .C files. |
44 |
#include <TPaveLabel.h> |
#include <TPaveLabel.h> |
45 |
#include <TStyle.h> |
#include <TStyle.h> |
46 |
#include <TSystem.h> |
#include <TSystem.h> |
47 |
|
#include <TApplication.h> |
48 |
// |
// |
49 |
#include <CalibCalPedEvent.h> |
#include <CalibCalPedEvent.h> |
50 |
// |
// |
51 |
using namespace std; |
using namespace std; |
52 |
// |
// |
53 |
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
54 |
if ( to == 0 ){ |
if ( to == 0 ){ |
55 |
Int_t t2length = s2.Length(); |
Int_t t2length = s2.Length(); |
56 |
s1 = ""; |
s1 = ""; |
57 |
to = t2length; |
to = t2length; |
58 |
}; |
}; |
59 |
for (Int_t i = from; i<to; i++){ |
for (Int_t i = from; i<to; i++){ |
60 |
s1.Append(s2[i],1); |
s1.Append(s2[i],1); |
61 |
}; |
}; |
62 |
} |
} |
63 |
void stringappend(TString& s1, const TString& s2){ |
void stringappend(TString& s1, const TString& s2){ |
64 |
Int_t t2length = s2.Length(); |
Int_t t2length = s2.Length(); |
65 |
for (Int_t i = 0; i<t2length; i++){ |
for (Int_t i = 0; i<t2length; i++){ |
66 |
s1.Append(s2[i],1); |
s1.Append(s2[i],1); |
67 |
}; |
}; |
68 |
} |
} |
69 |
|
|
70 |
TString getFilename(const TString filename){ |
TString getFilename(const TString filename){ |
71 |
const string fil = (const char*)filename; |
// |
72 |
Int_t posiz = fil.find("dw_"); |
const string fil = gSystem->BaseName(filename.Data()); |
73 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
Int_t posiz = fil.find(".root"); |
74 |
if ( posiz == -1 ) return 0; |
// |
75 |
Int_t posiz2 = posiz+13; |
TString file2; |
76 |
TString file2; |
if ( posiz == -1 ){ |
77 |
stringcopy(file2,filename,posiz,posiz2); |
file2 = gSystem->BaseName(filename.Data()); |
78 |
|
} else { |
79 |
|
Int_t posiz2 = 0; |
80 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
81 |
TString pdat(".dat"); |
TString pdat(".dat"); |
82 |
stringappend(file2,pdat); |
stringappend(file2,pdat); |
83 |
return file2; |
}; |
84 |
|
return file2; |
85 |
} |
} |
86 |
|
|
87 |
typedef struct Calib { |
typedef struct Calib { |
88 |
Int_t iev; |
Int_t iev; |
89 |
Int_t cstwerr[4]; |
Int_t cstwerr[4]; |
90 |
Float_t cperror[4]; |
Float_t cperror[4]; |
91 |
Float_t mip[2][22][96]; |
Float_t mip[2][22][96]; |
92 |
Float_t calped[2][22][96]; |
Float_t calped[2][22][96]; |
93 |
Float_t calgood[2][22][96]; |
Float_t calgood[2][22][96]; |
94 |
Float_t calthr[2][22][6]; |
Float_t calthr[2][22][6]; |
95 |
Float_t calrms[2][22][96]; |
Float_t calrms[2][22][96]; |
96 |
Float_t calbase[2][22][6]; |
Float_t calbase[2][22][6]; |
97 |
Float_t calvar[2][22][6]; |
Float_t calvar[2][22][6]; |
98 |
Float_t calpuls[2][22][96]; |
Float_t calpuls[2][22][96]; |
99 |
} calib; |
} calib; |
100 |
|
|
101 |
void FCaloCHKCALIB(TString filename, Long64_t calibnumber = 0, TString outDir = "", Int_t figmatra = 0, TString saveas = "ps"){ |
void FCaloCHKCALIB(TString filename, Long64_t calibnumber = 0, TString outDir = "", Int_t figmatra = 0, TString saveas = "png", Bool_t iactive =false, Bool_t w4i=false){ |
102 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
103 |
|
// |
104 |
|
TApplication *app = 0; |
105 |
|
if ( iactive ) app = new TApplication("app",0,0); |
106 |
|
Float_t ccalrmsthr=0.99; |
107 |
|
Float_t ccalpedthr=0.99; |
108 |
|
Float_t ccalbadthr=0.03;// 0.005 |
109 |
|
Float_t ccalthrthr=0.98; |
110 |
|
Float_t ccalvarthr=0.99; |
111 |
|
Float_t ccalbasthr=0.99; |
112 |
|
// |
113 |
|
Float_t ccalrms; |
114 |
|
Float_t ccalped; |
115 |
|
Float_t ccalbad; |
116 |
|
Float_t ccalthr; |
117 |
|
Float_t ccalvar; |
118 |
|
Float_t ccalbas; |
119 |
|
// |
120 |
|
struct Calib calib; |
121 |
|
stringstream titolo; |
122 |
|
stringstream xviewev; |
123 |
|
stringstream yviewev; |
124 |
|
const char* startingdir = gSystem->WorkingDirectory(); |
125 |
|
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
126 |
|
TString fififile = getFilename(filename); |
127 |
|
const char *file; |
128 |
|
file = fififile; |
129 |
|
// |
130 |
|
ifstream myfile; |
131 |
|
myfile.open(filename.Data()); |
132 |
|
if ( !myfile ){ |
133 |
|
printf(" %s :no such file, exiting...\n\n",filename.Data()); |
134 |
|
return; |
135 |
|
}; |
136 |
|
myfile.close(); |
137 |
|
// |
138 |
|
TFile *File = new TFile(filename.Data()); |
139 |
|
// |
140 |
|
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
141 |
|
if ( !tr ) { |
142 |
|
printf(" CalibCalPed : no such tree in %s \n",filename.Data()); |
143 |
|
printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); |
144 |
|
return; |
145 |
|
}; |
146 |
|
pamela::CalibCalPedEvent *ce = 0; |
147 |
|
// |
148 |
|
UInt_t found; |
149 |
|
tr->SetBranchStatus("*",0,&found); //disable all branches |
150 |
|
// |
151 |
|
found = 0; |
152 |
|
tr->SetBranchStatus("iev*",1,&found); |
153 |
|
found = 0; |
154 |
|
tr->SetBranchStatus("cstwerr*",1,&found); |
155 |
|
// printf("enabled %i branches \n",found); |
156 |
|
found = 0; |
157 |
|
tr->SetBranchStatus("cperror*",1,&found); |
158 |
|
//printf("enabled %i branches \n",found); |
159 |
|
found = 0; |
160 |
|
tr->SetBranchStatus("cal*",1,&found); |
161 |
|
//printf("enabled %i branches \n",found); |
162 |
|
found = 0; |
163 |
|
tr->SetBranchStatus("CalibCalPed*",1,&found); |
164 |
|
//printf("enabled %i branches \n",found); |
165 |
|
// |
166 |
|
tr->SetBranchAddress("CalibCalPed", &ce); |
167 |
|
// |
168 |
|
Long64_t ncalibs = tr->GetEntries(); |
169 |
|
if ( ncalibs == 0 ){ |
170 |
|
printf(" No calibrations in this files! \n Exiting... \n"); |
171 |
|
return; |
172 |
|
}; |
173 |
|
printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4); |
174 |
|
Long64_t minev = 0; |
175 |
|
Long64_t maxev = ncalibs; |
176 |
|
if ( calibnumber ){ |
177 |
|
minev = (calibnumber - 1)* 4; |
178 |
|
maxev = minev + 4; |
179 |
|
}; |
180 |
|
TCanvas *figura1; |
181 |
|
TCanvas *figura2 = 0; |
182 |
|
TCanvas *figura3; |
183 |
|
TCanvas *rapporto = 0; |
184 |
|
Int_t cmask = 127 ; |
185 |
|
Int_t cestw = 0; |
186 |
|
Int_t ver[4][23]; |
187 |
|
// |
188 |
|
for (Int_t k = 0; k < 4; k++ ){ |
189 |
|
for (Int_t m = 0; m < 23 ; m++ ){ |
190 |
|
ver[k][m] = 0 ; |
191 |
|
}; |
192 |
|
}; |
193 |
|
// |
194 |
|
// |
195 |
|
const string fil = gSystem->BaseName(filename.Data()); |
196 |
|
Int_t posiz = fil.find(".root"); |
197 |
|
// |
198 |
|
TString file2; |
199 |
|
if ( posiz == -1 ){ |
200 |
|
file2 = gSystem->BaseName(filename.Data()); |
201 |
|
} else { |
202 |
|
Int_t posiz2 = 0; |
203 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
204 |
|
}; |
205 |
|
const char *figrec = file2; |
206 |
|
// |
207 |
|
const char *outdir = outDir; |
208 |
|
const char *format = saveas; |
209 |
|
stringstream figsave; |
210 |
|
stringstream figsave1; |
211 |
|
stringstream figsave2; |
212 |
|
// |
213 |
|
// to check or not to check? this is the problem... |
214 |
|
// |
215 |
|
Bool_t check = false; |
216 |
|
// |
217 |
|
for (Int_t ci = minev; ci < maxev ; ci+=4){ |
218 |
// |
// |
219 |
Float_t ccalrmsthr=0.99; |
Int_t incalrms = 0; |
220 |
Float_t ccalpedthr=0.99; |
Int_t outcalrms = 0; |
221 |
Float_t ccalbadthr=0.005; |
Int_t totcalbad = 0; |
222 |
Float_t ccalthrthr=0.98; |
Int_t incalped = 0; |
223 |
Float_t ccalvarthr=0.99; |
Int_t outcalped = 0; |
224 |
Float_t ccalbasthr=0.99; |
Int_t incalthr = 0; |
225 |
// |
Int_t outcalthr = 0; |
226 |
Float_t ccalrms; |
Int_t incalvar = 0; |
227 |
Float_t ccalped; |
Int_t outcalvar = 0; |
228 |
Float_t ccalbad; |
Int_t incalbas = 0; |
229 |
Float_t ccalthr; |
Int_t outcalbas = 0; |
230 |
Float_t ccalvar; |
// |
231 |
Float_t ccalbas; |
for ( Int_t s=0 ; s<4 ;s++ ){ |
232 |
// |
tr->GetEntry(ci+s); |
233 |
struct Calib calib; |
calib.iev = ce->iev; |
234 |
stringstream titolo; |
// |
235 |
stringstream xviewev; |
// |
236 |
stringstream yviewev; |
// |
237 |
const char* startingdir = gSystem->WorkingDirectory(); |
cestw = 0; |
238 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( ce->cstwerr[s] ){ |
239 |
TString fififile = getFilename(filename); |
cestw = ce->cstwerr[s] & cmask ; |
240 |
const char *file; |
ver[s][16]++; |
241 |
file = fififile; |
}; |
242 |
// |
if ( cestw ){ |
243 |
ifstream myfile; |
if ( cestw & (1 << 0) ) ver[s][6]++ ; |
244 |
myfile.open(filename.Data()); |
if ( cestw & (1 << 1) ) ver[s][5]++ ; |
245 |
if ( !myfile ){ |
if ( cestw & (1 << 2) ) ver[s][4]++ ; |
246 |
printf(" %s :no such file, exiting...\n\n",filename.Data()); |
if ( cestw & (1 << 3) ) ver[s][3]++ ; |
247 |
return; |
if ( cestw & (1 << 4) ) ver[s][2]++ ; |
248 |
}; |
if ( cestw & (1 << 5) ) ver[s][1]++ ; |
249 |
myfile.close(); |
if ( cestw & (1 << 6) ) ver[s][0]++ ; |
250 |
// |
}; |
251 |
TFile *File = new TFile(filename.Data()); |
if ( ce->cperror[s] != 0. ){ |
252 |
// |
if (ce->cperror[s] == 128) ver[s][7]++ ; |
253 |
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
if (ce->cperror[s] == 129) ver[s][8]++ ; |
254 |
if ( !tr ) { |
if (ce->cperror[s] == 130) { |
255 |
printf(" CalibCalPed : no such tree in %s \n",filename.Data()); |
ver[s][9]++ ; |
256 |
printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); |
ver[s][16]--; |
257 |
return; |
}; |
258 |
}; |
if (ce->cperror[s] == 132) ver[s][11]++ ; |
259 |
pamela::CalibCalPedEvent *ce = 0; |
if (ce->cperror[s] == 140) ver[s][19]++ ; |
260 |
// |
if (ce->cperror[s] == 141) ver[s][20]++ ; |
261 |
UInt_t found; |
if (ce->cperror[s] == 142) ver[s][22]++ ; |
262 |
tr->SetBranchStatus("*",0,&found); //disable all branches |
}; |
263 |
// |
// |
264 |
found = 0; |
for ( Int_t d=0 ; d<11 ;d++ ){ |
265 |
tr->SetBranchStatus("iev*",1,&found); |
Int_t pre = -1; |
266 |
found = 0; |
for ( Int_t j=0; j<96 ;j++){ |
267 |
tr->SetBranchStatus("cstwerr*",1,&found); |
if ( j%16 == 0 ) pre++; |
268 |
// printf("enabled %i branches \n",found); |
if ( s == 2 ){ |
269 |
found = 0; |
calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; |
270 |
tr->SetBranchStatus("cperror*",1,&found); |
calib.cstwerr[3] = ce->cstwerr[3]; |
271 |
//printf("enabled %i branches \n",found); |
calib.cperror[3] = ce->cperror[3]; |
272 |
found = 0; |
calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j]; |
273 |
tr->SetBranchStatus("cal*",1,&found); |
calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre]; |
274 |
//printf("enabled %i branches \n",found); |
calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j]; |
275 |
found = 0; |
calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre]; |
276 |
tr->SetBranchStatus("CalibCalPed*",1,&found); |
calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre]; |
277 |
//printf("enabled %i branches \n",found); |
}; |
278 |
// |
if ( s == 3 ){ |
279 |
tr->SetBranchAddress("CalibCalPed", &ce); |
calib.calped[0][2*d][j] = ce->calped[1][d][j]; |
280 |
// |
calib.cstwerr[1] = ce->cstwerr[1]; |
281 |
Long64_t ncalibs = tr->GetEntries(); |
calib.cperror[1] = ce->cperror[1]; |
282 |
if ( ncalibs == 0 ){ |
calib.calgood[0][2*d][j] = ce->calgood[1][d][j]; |
283 |
printf(" No calibrations in this files! \n Exiting... \n"); |
calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre]; |
284 |
return; |
calib.calrms[0][2*d][j] = ce->calrms[1][d][j]; |
285 |
}; |
calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre]; |
286 |
printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4); |
calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre]; |
287 |
Long64_t minev = 0; |
}; |
288 |
Long64_t maxev = ncalibs; |
if ( s == 0 ){ |
289 |
if ( calibnumber ){ |
calib.calped[1][2*d][j] = ce->calped[0][d][j]; |
290 |
minev = (calibnumber - 1)* 4; |
calib.cstwerr[0] = ce->cstwerr[0]; |
291 |
maxev = minev + 4; |
calib.cperror[0] = ce->cperror[0]; |
292 |
}; |
calib.calgood[1][2*d][j] = ce->calgood[0][d][j]; |
293 |
TCanvas *figura1; |
calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre]; |
294 |
TCanvas *figura2 = 0; |
calib.calrms[1][2*d][j] = ce->calrms[0][d][j]; |
295 |
TCanvas *figura3; |
calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre]; |
296 |
TCanvas *rapporto = 0; |
calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre]; |
297 |
Int_t cmask = 127 ; |
}; |
298 |
Int_t cestw = 0; |
if ( s == 1 ){ |
299 |
Int_t ver[4][23]; |
calib.calped[1][2*d+1][j] = ce->calped[2][d][j]; |
300 |
// |
calib.cstwerr[2] = ce->cstwerr[2]; |
301 |
for (Int_t k = 0; k < 4; k++ ){ |
calib.cperror[2] = ce->cperror[2]; |
302 |
for (Int_t m = 0; m < 23 ; m++ ){ |
calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j]; |
303 |
ver[k][m] = 0 ; |
calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre]; |
304 |
|
calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j]; |
305 |
|
calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre]; |
306 |
|
calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre]; |
307 |
|
}; |
308 |
}; |
}; |
309 |
|
}; |
310 |
}; |
}; |
311 |
// |
// |
312 |
|
// Book the histograms: |
313 |
// |
// |
|
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 char *outdir = outDir; |
|
|
const char *format = saveas; |
|
|
stringstream figsave; |
|
|
stringstream figsave1; |
|
|
stringstream figsave2; |
|
314 |
// |
// |
315 |
// to check or not to check? this is the problem... |
Int_t i = (ci-minev)/4; |
316 |
|
xviewev.str(""); |
317 |
|
xviewev << "x-view event " << (i+1); |
318 |
|
yviewev.str(""); |
319 |
|
yviewev << "y-view event " << (i+1); |
320 |
|
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
321 |
|
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
322 |
// |
// |
323 |
Bool_t check = false; |
// figures: |
324 |
// |
// |
325 |
for (Int_t ci = minev; ci < maxev ; ci+=4){ |
gDirectory->Delete("C14"); |
326 |
// |
gDirectory->Delete("C15"); |
327 |
Int_t incalrms = 0; |
gDirectory->Delete("C16"); |
328 |
Int_t outcalrms = 0; |
//TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); |
329 |
Int_t totcalbad = 0; |
// TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); |
330 |
Int_t incalped = 0; |
TH1F *calped = new TH1F("C14","calped",2112,-3.5,4227.5); |
331 |
Int_t outcalped = 0; |
// TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.); |
332 |
Int_t incalthr = 0; |
TH1F *calrms = new TH1F("C15","calrms",2112,-3.5,4228.5); |
333 |
Int_t outcalthr = 0; |
TH1F *calbad = new TH1F("C16","calgood",4230,-3.5,4228.5); |
334 |
Int_t incalvar = 0; |
// |
335 |
Int_t outcalvar = 0; |
gDirectory->Delete("C17"); |
336 |
Int_t incalbas = 0; |
gDirectory->Delete("C18"); |
337 |
Int_t outcalbas = 0; |
gDirectory->Delete("C19"); |
338 |
// |
TH1F *calthr = new TH1F("C17","calthr",271,-4.5,268.5); |
339 |
for ( Int_t s=0 ; s<4 ;s++ ){ |
TH1F *calvar = new TH1F("C18","calvar",271,-4.5,268.5); |
340 |
tr->GetEntry(ci+s); |
TH1F *calbase = new TH1F("C19","calbase",271,-4.5,268.5); |
341 |
calib.iev = ce->iev; |
// |
342 |
// |
Int_t bgcolor = 10; |
343 |
// |
TPad *pd1 = 0; |
344 |
// |
TPad *pd2 = 0; |
345 |
cestw = 0; |
TPad *palette = 0; |
346 |
if ( ce->cstwerr[s] ){ |
TLatex *t=new TLatex(); |
347 |
cestw = ce->cstwerr[s] & cmask ; |
if ( figmatra ){ |
348 |
ver[s][16]++; |
figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); |
349 |
}; |
figura2->SetFillColor(10); |
350 |
if ( cestw ){ |
figura2->Range(0,0,100,100); |
351 |
if ( cestw & (1 << 0) ) ver[s][6]++ ; |
bgcolor = 10; |
352 |
if ( cestw & (1 << 1) ) ver[s][5]++ ; |
pd1 = new TPad("pd1","This is pad1",0.02,0.05,0.88,0.49,bgcolor); |
353 |
if ( cestw & (1 << 2) ) ver[s][4]++ ; |
pd2 = new TPad("pd2","This is pad2",0.02,0.51,0.88,0.95,bgcolor); |
354 |
if ( cestw & (1 << 3) ) ver[s][3]++ ; |
palette = new TPad("palette","This is palette",0.90,0.05,0.98,0.90,bgcolor); |
355 |
if ( cestw & (1 << 4) ) ver[s][2]++ ; |
figura2->cd(); |
356 |
if ( cestw & (1 << 5) ) ver[s][1]++ ; |
gStyle->SetOptStat(""); |
357 |
if ( cestw & (1 << 6) ) ver[s][0]++ ; |
t=new TLatex(); |
358 |
|
t->SetTextFont(32); |
359 |
|
t->SetTextColor(1); |
360 |
|
t->SetTextSize(0.03); |
361 |
|
t->SetTextAlign(12); |
362 |
|
t->DrawLatex(90.,92.5,"ADC ch."); |
363 |
|
pd1->Range(0,0,100,100); |
364 |
|
pd2->Range(0,0,100,100); |
365 |
|
palette->Range(0,0,100,100); |
366 |
|
pd1->SetTicks(); |
367 |
|
pd2->SetTicks(); |
368 |
|
pd1->Draw(); |
369 |
|
pd2->Draw(); |
370 |
|
palette->Draw(); |
371 |
|
palette->cd(); |
372 |
|
// palette |
373 |
|
TPaveLabel *box1 = new TPaveLabel(2,2,98,14,"OFF",""); |
374 |
|
box1->SetTextFont(32); |
375 |
|
box1->SetTextColor(1); |
376 |
|
box1->SetTextSize(0.25); |
377 |
|
box1->SetFillColor(10); |
378 |
|
box1->Draw(); |
379 |
|
TPaveLabel *box2 = new TPaveLabel(2,16,98,28,"0-1.5",""); |
380 |
|
box2->SetTextFont(32); |
381 |
|
box2->SetTextColor(1); |
382 |
|
box2->SetTextSize(0.25); |
383 |
|
box2->SetFillColor(38); |
384 |
|
box2->Draw(); |
385 |
|
TPaveLabel *box3 = new TPaveLabel(2,30,98,42,"1.5-4",""); |
386 |
|
box3->SetTextFont(32); |
387 |
|
box3->SetTextColor(1); |
388 |
|
box3->SetTextSize(0.25); |
389 |
|
box3->SetFillColor(4); |
390 |
|
box3->Draw(); |
391 |
|
TPaveLabel *box4 = new TPaveLabel(2,44,98,56,"4-6.5",""); |
392 |
|
box4->SetTextFont(32); |
393 |
|
box4->SetTextColor(1); |
394 |
|
box4->SetTextSize(0.25); |
395 |
|
box4->SetFillColor(3); |
396 |
|
box4->Draw(); |
397 |
|
TPaveLabel *box5 = new TPaveLabel(2,58,98,70,"6.5-11.5",""); |
398 |
|
box5->SetTextFont(32); |
399 |
|
box5->SetTextColor(1); |
400 |
|
box5->SetTextSize(0.25); |
401 |
|
box5->SetFillColor(2); |
402 |
|
box5->Draw(); |
403 |
|
TPaveLabel *box6 = new TPaveLabel(2,72,98,84,">11.5",""); |
404 |
|
box6->SetTextFont(32); |
405 |
|
box6->SetTextColor(1); |
406 |
|
box6->SetTextSize(0.25); |
407 |
|
box6->SetFillColor(6); |
408 |
|
box6->Draw(); |
409 |
|
TPaveLabel *box7 = new TPaveLabel(2,86,98,98,"BAD",""); |
410 |
|
box7->SetTextFont(32); |
411 |
|
box7->SetTextColor(10); |
412 |
|
box7->SetTextSize(0.25); |
413 |
|
box7->SetFillColor(1); |
414 |
|
box7->Draw(); |
415 |
|
// |
416 |
|
pd1->cd(); |
417 |
|
gStyle->SetOptStat(""); |
418 |
|
Xview->SetXTitle("strip"); |
419 |
|
Xview->SetYTitle("X - plane"); |
420 |
|
Xview->GetYaxis()->SetTitleOffset(0.5); |
421 |
|
Xview->SetFillColor(bgcolor); |
422 |
|
Xview->Fill(1.,1.,1.); |
423 |
|
Xview->Draw("box"); |
424 |
|
pd1->Update(); |
425 |
|
pd2->cd(); |
426 |
|
gStyle->SetOptStat(""); |
427 |
|
Yview->SetXTitle("strip"); |
428 |
|
Yview->SetYTitle("Y - plane"); |
429 |
|
Yview->GetYaxis()->SetTitleOffset(0.5); |
430 |
|
Yview->SetFillColor(bgcolor); |
431 |
|
Yview->Fill(1.,1.,1.); |
432 |
|
Yview->Draw("box"); |
433 |
|
pd2->Update(); |
434 |
|
}; |
435 |
|
// |
436 |
|
// run over views and planes |
437 |
|
// |
438 |
|
Int_t j = 0; |
439 |
|
Int_t g = 0; |
440 |
|
gStyle->SetOptStat(""); |
441 |
|
for (Int_t m = 0; m < 22; m++){ |
442 |
|
for (Int_t l = 0; l < 2; l++){ |
443 |
|
for (Int_t n = 0; n < 96; n++){ |
444 |
|
// |
445 |
|
calped->Fill((float)j,calib.calped[l][m][n]); |
446 |
|
if ( (calib.calped[l][m][n] > 700. || calib.calped[l][m][n] < -700.) && (j < 4032 || j > 4048) ){ |
447 |
|
outcalped++; |
448 |
|
} else { |
449 |
|
incalped++; |
450 |
|
}; |
451 |
|
calrms->Fill((float)j,(calib.calrms[l][m][n]/4.)); |
452 |
|
if ( (((calib.calrms[l][m][n]/4.) > 7. || (calib.calrms[l][m][n]/4.) < 1.) && (j < 3440 || j > 3550)) || ( (j > 3439 && j < 3551) && ((calib.calrms[l][m][n]/4.) > 150. || (calib.calrms[l][m][n]/4.) < 1.)) ){ |
453 |
|
outcalrms++; |
454 |
|
} else { |
455 |
|
incalrms++; |
456 |
|
}; |
457 |
|
calbad->Fill((float)j,(float)calib.calgood[l][m][n]); |
458 |
|
if ( calib.calgood[l][m][n] ) totcalbad++; |
459 |
|
// |
460 |
|
if ( n < 6 ){ |
461 |
|
calthr->Fill((float)g,(float)calib.calthr[l][m][n]); |
462 |
|
if ( (calib.calthr[l][m][n] > 21. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){ |
463 |
|
outcalthr++; |
464 |
|
} else { |
465 |
|
incalthr++; |
466 |
}; |
}; |
467 |
if ( ce->cperror[s] != 0. ){ |
calvar->Fill((float)g,(float)calib.calvar[l][m][n]); |
468 |
if (ce->cperror[s] == 128) ver[s][7]++ ; |
if ( (calib.calvar[l][m][n] > 8. || calib.calvar[l][m][n] < 1. ) && (g < 215 || g > 221) ){ |
469 |
if (ce->cperror[s] == 129) ver[s][8]++ ; |
outcalvar++; |
470 |
if (ce->cperror[s] == 130) { |
} else { |
471 |
ver[s][9]++ ; |
incalvar++; |
|
ver[s][16]--; |
|
|
}; |
|
|
if (ce->cperror[s] == 132) ver[s][11]++ ; |
|
|
if (ce->cperror[s] == 140) ver[s][19]++ ; |
|
|
if (ce->cperror[s] == 141) ver[s][20]++ ; |
|
|
if (ce->cperror[s] == 142) ver[s][22]++ ; |
|
472 |
}; |
}; |
473 |
// |
calbase->Fill((float)g,(float)calib.calbase[l][m][n]); |
474 |
for ( Int_t d=0 ; d<11 ;d++ ){ |
if ( calib.calbase[l][m][n] > 4500. || calib.calbase[l][m][n] < 2000. ){ |
475 |
Int_t pre = -1; |
outcalbas++; |
476 |
for ( Int_t j=0; j<96 ;j++){ |
} else { |
477 |
if ( j%16 == 0 ) pre++; |
incalbas++; |
|
if ( s == 2 ){ |
|
|
calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; |
|
|
calib.cstwerr[3] = ce->cstwerr[3]; |
|
|
calib.cperror[3] = ce->cperror[3]; |
|
|
calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j]; |
|
|
calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre]; |
|
|
calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j]; |
|
|
calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre]; |
|
|
calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre]; |
|
|
}; |
|
|
if ( s == 3 ){ |
|
|
calib.calped[0][2*d][j] = ce->calped[1][d][j]; |
|
|
calib.cstwerr[1] = ce->cstwerr[1]; |
|
|
calib.cperror[1] = ce->cperror[1]; |
|
|
calib.calgood[0][2*d][j] = ce->calgood[1][d][j]; |
|
|
calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre]; |
|
|
calib.calrms[0][2*d][j] = ce->calrms[1][d][j]; |
|
|
calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre]; |
|
|
calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre]; |
|
|
}; |
|
|
if ( s == 0 ){ |
|
|
calib.calped[1][2*d][j] = ce->calped[0][d][j]; |
|
|
calib.cstwerr[0] = ce->cstwerr[0]; |
|
|
calib.cperror[0] = ce->cperror[0]; |
|
|
calib.calgood[1][2*d][j] = ce->calgood[0][d][j]; |
|
|
calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre]; |
|
|
calib.calrms[1][2*d][j] = ce->calrms[0][d][j]; |
|
|
calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre]; |
|
|
calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre]; |
|
|
}; |
|
|
if ( s == 1 ){ |
|
|
calib.calped[1][2*d+1][j] = ce->calped[2][d][j]; |
|
|
calib.cstwerr[2] = ce->cstwerr[2]; |
|
|
calib.cperror[2] = ce->cperror[2]; |
|
|
calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j]; |
|
|
calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre]; |
|
|
calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j]; |
|
|
calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre]; |
|
|
calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre]; |
|
|
}; |
|
|
}; |
|
478 |
}; |
}; |
479 |
}; |
g++; |
480 |
// |
}; |
481 |
// Book the histograms: |
// |
482 |
// |
j++; |
483 |
// |
// |
484 |
Int_t i = (ci-minev)/4; |
if ( figmatra ){ |
|
xviewev.str(""); |
|
|
xviewev << "x-view event " << (i+1); |
|
|
yviewev.str(""); |
|
|
yviewev << "y-view event " << (i+1); |
|
|
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
|
|
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
|
|
// |
|
|
// figures: |
|
|
// |
|
|
gDirectory->Delete("C14"); |
|
|
gDirectory->Delete("C15"); |
|
|
gDirectory->Delete("C16"); |
|
|
TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); |
|
|
TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); |
|
|
TH1F *calbad = new TH1F("C16","calgood",4230,-3.5,4228.5); |
|
|
// |
|
|
gDirectory->Delete("C17"); |
|
|
gDirectory->Delete("C18"); |
|
|
gDirectory->Delete("C19"); |
|
|
TH1F *calthr = new TH1F("C17","calthr",271,-4.5,268.5); |
|
|
TH1F *calvar = new TH1F("C18","calvar",271,-4.5,268.5); |
|
|
TH1F *calbase = new TH1F("C19","calbase",271,-4.5,268.5); |
|
|
// |
|
|
Int_t bgcolor = 10; |
|
|
TPad *pd1 = 0; |
|
|
TPad *pd2 = 0; |
|
|
TPad *palette = 0; |
|
|
TLatex *t=new TLatex(); |
|
|
if ( figmatra ){ |
|
|
figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); |
|
|
figura2->SetFillColor(10); |
|
|
figura2->Range(0,0,100,100); |
|
|
bgcolor = 10; |
|
|
pd1 = new TPad("pd1","This is pad1",0.02,0.05,0.88,0.49,bgcolor); |
|
|
pd2 = new TPad("pd2","This is pad2",0.02,0.51,0.88,0.95,bgcolor); |
|
|
palette = new TPad("palette","This is palette",0.90,0.05,0.98,0.90,bgcolor); |
|
485 |
figura2->cd(); |
figura2->cd(); |
486 |
gStyle->SetOptStat(""); |
xviewev.str(""); |
487 |
t=new TLatex(); |
xviewev << "x-view " << i; |
488 |
t->SetTextFont(32); |
xviewev << " event " << n; |
489 |
t->SetTextColor(1); |
xviewev << " " << m; |
490 |
t->SetTextSize(0.03); |
xviewev << " " << l; |
491 |
t->SetTextAlign(12); |
yviewev.str(""); |
492 |
t->DrawLatex(90.,92.5,"ADC ch."); |
yviewev << "y-view " << i; |
493 |
pd1->Range(0,0,100,100); |
yviewev << " event " << n; |
494 |
pd2->Range(0,0,100,100); |
yviewev << " " << m; |
495 |
palette->Range(0,0,100,100); |
yviewev << " " << l; |
496 |
pd1->SetTicks(); |
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
497 |
pd2->SetTicks(); |
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
498 |
pd1->Draw(); |
if ( calib.calrms[l][m][n] > 0 ){ |
499 |
pd2->Draw(); |
Xview->SetFillColor(38); |
500 |
palette->Draw(); |
Yview->SetFillColor(38); |
|
palette->cd(); |
|
|
// palette |
|
|
TPaveLabel *box1 = new TPaveLabel(2,2,98,14,"OFF",""); |
|
|
box1->SetTextFont(32); |
|
|
box1->SetTextColor(1); |
|
|
box1->SetTextSize(0.25); |
|
|
box1->SetFillColor(10); |
|
|
box1->Draw(); |
|
|
TPaveLabel *box2 = new TPaveLabel(2,16,98,28,"0-1.5",""); |
|
|
box2->SetTextFont(32); |
|
|
box2->SetTextColor(1); |
|
|
box2->SetTextSize(0.25); |
|
|
box2->SetFillColor(38); |
|
|
box2->Draw(); |
|
|
TPaveLabel *box3 = new TPaveLabel(2,30,98,42,"1.5-4",""); |
|
|
box3->SetTextFont(32); |
|
|
box3->SetTextColor(1); |
|
|
box3->SetTextSize(0.25); |
|
|
box3->SetFillColor(4); |
|
|
box3->Draw(); |
|
|
TPaveLabel *box4 = new TPaveLabel(2,44,98,56,"4-6.5",""); |
|
|
box4->SetTextFont(32); |
|
|
box4->SetTextColor(1); |
|
|
box4->SetTextSize(0.25); |
|
|
box4->SetFillColor(3); |
|
|
box4->Draw(); |
|
|
TPaveLabel *box5 = new TPaveLabel(2,58,98,70,"6.5-11.5",""); |
|
|
box5->SetTextFont(32); |
|
|
box5->SetTextColor(1); |
|
|
box5->SetTextSize(0.25); |
|
|
box5->SetFillColor(2); |
|
|
box5->Draw(); |
|
|
TPaveLabel *box6 = new TPaveLabel(2,72,98,84,">11.5",""); |
|
|
box6->SetTextFont(32); |
|
|
box6->SetTextColor(1); |
|
|
box6->SetTextSize(0.25); |
|
|
box6->SetFillColor(6); |
|
|
box6->Draw(); |
|
|
TPaveLabel *box7 = new TPaveLabel(2,86,98,98,"BAD",""); |
|
|
box7->SetTextFont(32); |
|
|
box7->SetTextColor(10); |
|
|
box7->SetTextSize(0.25); |
|
|
box7->SetFillColor(1); |
|
|
box7->Draw(); |
|
|
// |
|
|
pd1->cd(); |
|
|
gStyle->SetOptStat(""); |
|
|
Xview->SetXTitle("strip"); |
|
|
Xview->SetYTitle("X - plane"); |
|
|
Xview->GetYaxis()->SetTitleOffset(0.5); |
|
|
Xview->SetFillColor(bgcolor); |
|
|
Xview->Fill(1.,1.,1.); |
|
|
Xview->Draw("box"); |
|
|
pd1->Update(); |
|
|
pd2->cd(); |
|
|
gStyle->SetOptStat(""); |
|
|
Yview->SetXTitle("strip"); |
|
|
Yview->SetYTitle("Y - plane"); |
|
|
Yview->GetYaxis()->SetTitleOffset(0.5); |
|
|
Yview->SetFillColor(bgcolor); |
|
|
Yview->Fill(1.,1.,1.); |
|
|
Yview->Draw("box"); |
|
|
pd2->Update(); |
|
|
}; |
|
|
// |
|
|
// run over views and planes |
|
|
// |
|
|
Int_t j = 0; |
|
|
Int_t g = 0; |
|
|
gStyle->SetOptStat(""); |
|
|
for (Int_t m = 0; m < 22; m++){ |
|
|
for (Int_t l = 0; l < 2; l++){ |
|
|
for (Int_t n = 0; n < 96; n++){ |
|
|
// |
|
|
calped->Fill((float)j,calib.calped[l][m][n]); |
|
|
if ( (calib.calped[l][m][n] > 700. || calib.calped[l][m][n] < -700.) && (j < 4032 || j > 4048) ){ |
|
|
outcalped++; |
|
|
} else { |
|
|
incalped++; |
|
|
}; |
|
|
calrms->Fill((float)j,(calib.calrms[l][m][n]/4.)); |
|
|
if ( (calib.calrms[l][m][n]/4.) > 7. || (calib.calrms[l][m][n]/4.) < 1. ){ |
|
|
outcalrms++; |
|
|
} else { |
|
|
incalrms++; |
|
|
}; |
|
|
calbad->Fill((float)j,(float)calib.calgood[l][m][n]); |
|
|
if ( calib.calgood[l][m][n] ) totcalbad++; |
|
|
// |
|
|
if ( n < 6 ){ |
|
|
calthr->Fill((float)g,(float)calib.calthr[l][m][n]); |
|
|
if ( calib.calthr[l][m][n] > 21. || calib.calthr[l][m][n] < 12. ){ |
|
|
outcalthr++; |
|
|
} else { |
|
|
incalthr++; |
|
|
}; |
|
|
calvar->Fill((float)g,(float)calib.calvar[l][m][n]); |
|
|
if ( calib.calvar[l][m][n] > 8. || calib.calvar[l][m][n] < 1. ){ |
|
|
outcalvar++; |
|
|
} else { |
|
|
incalvar++; |
|
|
}; |
|
|
calbase->Fill((float)g,(float)calib.calbase[l][m][n]); |
|
|
if ( calib.calbase[l][m][n] > 4500. || calib.calbase[l][m][n] < 2000. ){ |
|
|
outcalbas++; |
|
|
} else { |
|
|
incalbas++; |
|
|
}; |
|
|
g++; |
|
|
}; |
|
|
// |
|
|
j++; |
|
|
// |
|
|
if ( figmatra ){ |
|
|
figura2->cd(); |
|
|
xviewev.str(""); |
|
|
xviewev << "x-view " << i; |
|
|
xviewev << " event " << n; |
|
|
xviewev << " " << m; |
|
|
xviewev << " " << l; |
|
|
yviewev.str(""); |
|
|
yviewev << "y-view " << i; |
|
|
yviewev << " event " << n; |
|
|
yviewev << " " << m; |
|
|
yviewev << " " << l; |
|
|
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
|
|
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
|
|
if ( calib.calrms[l][m][n] > 0 ){ |
|
|
Xview->SetFillColor(38); |
|
|
Yview->SetFillColor(38); |
|
|
}; |
|
|
if ( calib.calrms[l][m][n] > 6 ){ |
|
|
Xview->SetFillColor(4); |
|
|
Yview->SetFillColor(4); |
|
|
}; |
|
|
if ( calib.calrms[l][m][n] > 16 ){ |
|
|
Xview->SetFillColor(3); |
|
|
Yview->SetFillColor(3); |
|
|
}; |
|
|
if ( calib.calrms[l][m][n] > 26 ){ |
|
|
Xview->SetFillColor(2); |
|
|
Yview->SetFillColor(2); |
|
|
}; |
|
|
if ( calib.calrms[l][m][n] > 46 ){ |
|
|
Xview->SetFillColor(6); |
|
|
Yview->SetFillColor(6); |
|
|
}; |
|
|
if ( calib.calrms[l][m][n] <= 0 || calib.calrms[l][m][n] >30000 || calib.calped[l][m][n]>25000){ |
|
|
Xview->SetFillColor(10); |
|
|
Yview->SetFillColor(10); |
|
|
}; |
|
|
if ( calib.calgood[l][m][n] != 0 ){ |
|
|
Xview->SetFillColor(1); |
|
|
Yview->SetFillColor(1); |
|
|
}; |
|
|
if ( l == 0 ) { |
|
|
Xview->Fill(n,m,1.); |
|
|
pd1->cd(); |
|
|
Xview->Draw("box same"); |
|
|
}; |
|
|
if ( l == 1 ) { |
|
|
Yview->Fill(n,m,1.); |
|
|
pd2->cd(); |
|
|
Yview->Draw("box same"); |
|
|
}; |
|
|
}; |
|
|
}; |
|
501 |
}; |
}; |
502 |
}; |
if ( calib.calrms[l][m][n] > 6 ){ |
503 |
if ( figmatra ){ |
Xview->SetFillColor(4); |
504 |
figura2->cd(); |
Yview->SetFillColor(4); |
|
gStyle->SetOptStat(""); |
|
|
gStyle->SetOptDate(0); |
|
|
t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextSize(0.03); |
|
|
t->SetTextAlign(12); |
|
|
titolo.str(""); |
|
|
titolo << "C13 - Calorimeter: strip RMS - file "; |
|
|
titolo << file; |
|
|
titolo << " - calibration number "; |
|
|
titolo << (i+1); |
|
|
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
|
|
pd1->Update(); |
|
|
pd2->Update(); |
|
|
figura2->Update(); |
|
|
}; |
|
|
// |
|
|
figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950); |
|
|
figura1->SetFillColor(10); |
|
|
figura1->Range(0,0,100,100); |
|
|
// |
|
|
ccalped = (float)incalped/((float)outcalped + (float)incalped); |
|
|
Int_t f1pd1col = 10; |
|
|
if ( ccalped < ccalpedthr ) { |
|
|
check = true; |
|
|
f1pd1col = 45; |
|
|
}; |
|
|
// |
|
|
ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); |
|
|
Int_t f1pd2col = 10; |
|
|
if ( ccalrms < ccalrmsthr ) { |
|
|
check = true; |
|
|
f1pd2col = 45; |
|
|
}; |
|
|
// |
|
|
ccalbad = (float)totcalbad/4224.; |
|
|
Int_t f1pd3col = 10; |
|
|
if ( ccalbad > ccalbadthr ) { |
|
|
check = true; |
|
|
f1pd3col = 45; |
|
|
}; |
|
|
// |
|
|
TPad *f1pd1 = new TPad("f1pd1","This is f1pad1",0.02,0.684,0.98,0.95,f1pd1col); |
|
|
TPad *f1pd2 = new TPad("f1pd2","This is f1pad2",0.02,0.367,0.98,0.634,f1pd2col); |
|
|
TPad *f1pd3 = new TPad("f1pd3","This is f1pad3",0.02,0.05,0.98,0.317,f1pd3col); |
|
|
figura1->Clear(); |
|
|
figura1->cd(); |
|
|
f1pd1->SetTicks(); |
|
|
f1pd2->SetTicks(); |
|
|
f1pd3->SetTicks(); |
|
|
f1pd1->Draw(); |
|
|
f1pd2->Draw(); |
|
|
f1pd3->Draw(); |
|
|
figura1->Draw(); |
|
|
figura3 = new TCanvas("Calorimeter_calthr_calvar_calbase", "Calorimeter_calthr_calvar_calbase", 750, 950); |
|
|
figura3->SetFillColor(10); |
|
|
figura3->Range(0,0,100,100); |
|
|
// |
|
|
ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); |
|
|
Int_t f3pd1col = 10; |
|
|
if ( ccalthr < ccalthrthr ) { |
|
|
check = true; |
|
|
f3pd1col = 45; |
|
|
}; |
|
|
// |
|
|
ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); |
|
|
Int_t f3pd2col = 10; |
|
|
if ( ccalvar < ccalvarthr ) { |
|
|
check = true; |
|
|
f3pd2col = 45; |
|
|
}; |
|
|
// |
|
|
ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); |
|
|
Int_t f3pd3col = 10; |
|
|
if ( ccalbas < ccalbasthr ) { |
|
|
check = true; |
|
|
f3pd3col = 45; |
|
|
}; |
|
|
// |
|
|
TPad *f3pd1 = new TPad("f3pd1","This is f3pad1",0.02,0.684,0.98,0.95,f3pd1col); |
|
|
TPad *f3pd2 = new TPad("f3pd2","This is f3pad2",0.02,0.367,0.98,0.634,f3pd2col); |
|
|
TPad *f3pd3 = new TPad("f3pd3","This is f3pad3",0.02,0.05,0.98,0.317,f3pd3col); |
|
|
figura3->Clear(); |
|
|
figura3->cd(); |
|
|
f3pd1->SetTicks(); |
|
|
f3pd2->SetTicks(); |
|
|
f3pd3->SetTicks(); |
|
|
f3pd1->Draw(); |
|
|
f3pd2->Draw(); |
|
|
f3pd3->Draw(); |
|
|
figura3->Draw(); |
|
|
// |
|
|
gStyle->SetOptStat("N"); |
|
|
figura1->cd(); |
|
|
gStyle->SetNdivisions(322,"x"); |
|
|
t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextSize(0.025); |
|
|
t->SetTextAlign(12); |
|
|
titolo.str(""); |
|
|
titolo << "EXPERT - Calorimeter: calped/calrms/calgood - file "; |
|
|
titolo << file; |
|
|
titolo << " - calibration number "; |
|
|
titolo << (i+1); |
|
|
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
|
|
t->SetTextSize(0.03); |
|
|
f1pd1->cd(); |
|
|
// |
|
|
calped->GetXaxis()->SetNdivisions(322); |
|
|
calped->SetXTitle("strip"); |
|
|
calped->SetYTitle("ADC channels"); |
|
|
calped->Draw(); |
|
|
TPolyLine *banda1; |
|
|
Double_t xc[4] = {0.,4224.,4224.,0.}; |
|
|
Double_t yc[4] = {-700.,-700.,700.,700.}; |
|
|
banda1 = new TPolyLine(4,xc,yc); |
|
|
banda1->SetLineColor(5); |
|
|
banda1->SetFillColor(5); |
|
|
banda1->SetLineWidth(1); |
|
|
banda1->Draw("fSAME"); |
|
|
TPolyLine *banda2; |
|
|
Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; |
|
|
Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; |
|
|
banda2 = new TPolyLine(4,xc2,yc2); |
|
|
banda2->SetLineColor(5); |
|
|
banda2->SetFillColor(5); |
|
|
banda2->SetLineWidth(1); |
|
|
banda2->Draw("fSAME"); |
|
|
calped->Draw("SAME"); |
|
|
f1pd2->cd(); |
|
|
f1pd2->SetLogy(); |
|
|
calrms->GetXaxis()->SetNdivisions(322); |
|
|
calrms->Draw(); |
|
|
Double_t xd[4] = {0.,4224.,4224.,0.}; |
|
|
Double_t yd[4] = {1.,1.,7.,7.}; |
|
|
banda1 = new TPolyLine(4,xd,yd); |
|
|
banda1->SetLineColor(5); |
|
|
banda1->SetFillColor(5); |
|
|
banda1->SetLineWidth(1); |
|
|
banda1->Draw("fSAME"); |
|
|
calrms->SetXTitle("strip"); |
|
|
calrms->SetYTitle("ADC channels"); |
|
|
calrms->Draw("SAME"); |
|
|
f1pd3->cd(); |
|
|
gStyle->SetNdivisions(344,"x"); |
|
|
calbad->GetXaxis()->SetNdivisions(322); |
|
|
calbad->Draw(); |
|
|
calbad->SetXTitle("strip"); |
|
|
calbad->SetYTitle("0=good 255=bad"); |
|
|
f1pd1->Update(); |
|
|
f1pd2->Update(); |
|
|
f1pd3->Update(); |
|
|
figura1->Update(); |
|
|
// |
|
|
figura3->cd(); |
|
|
gStyle->SetNdivisions(644,"x"); |
|
|
t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextSize(0.025); |
|
|
t->SetTextAlign(12); |
|
|
titolo.str(""); |
|
|
titolo << "EXPERT - Calorimeter: calthr/calvar/calbase - file "; |
|
|
titolo << file; |
|
|
titolo << " - calibration number "; |
|
|
titolo << (i+1); |
|
|
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
|
|
t->SetTextSize(0.03); |
|
|
// |
|
|
f3pd1->cd(); |
|
|
calthr->GetXaxis()->SetNdivisions(644); |
|
|
calthr->SetXTitle("pre-amplifier"); |
|
|
calthr->SetYTitle("ADC channels"); |
|
|
calthr->Draw(); |
|
|
Double_t xe[4] = {0.,264.,264.,0.}; |
|
|
Double_t ye[4] = {12.,12.,21.,21.}; |
|
|
banda1 = new TPolyLine(4,xe,ye); |
|
|
banda1->SetLineColor(5); |
|
|
banda1->SetFillColor(5); |
|
|
banda1->SetLineWidth(1); |
|
|
banda1->Draw("fSAME"); |
|
|
calthr->Draw("SAME"); |
|
|
f3pd2->cd(); |
|
|
calvar->GetXaxis()->SetNdivisions(644); |
|
|
calvar->SetXTitle("pre-amplifier"); |
|
|
calvar->SetYTitle("ADC channels"); |
|
|
calvar->Draw(); |
|
|
Double_t xt[4] = {0.,264.,264.,0.}; |
|
|
Double_t yt[4] = {1.,1.,8.,8.}; |
|
|
banda1 = new TPolyLine(4,xt,yt); |
|
|
banda1->SetLineColor(5); |
|
|
banda1->SetFillColor(5); |
|
|
banda1->SetLineWidth(1); |
|
|
banda1->Draw("fSAME"); |
|
|
calvar->Draw("SAME"); |
|
|
f3pd3->cd(); |
|
|
calbase->GetXaxis()->SetNdivisions(644); |
|
|
calbase->SetXTitle("pre-amplifier"); |
|
|
calbase->SetYTitle("ADC channels"); |
|
|
calbase->Draw(); |
|
|
Double_t xg[4] = {0.,264.,264.,0.}; |
|
|
Double_t yg[4] = {2000.,2000.,4500.,4500.}; |
|
|
banda1 = new TPolyLine(4,xg,yg); |
|
|
banda1->SetLineColor(5); |
|
|
banda1->SetFillColor(5); |
|
|
banda1->SetLineWidth(1); |
|
|
banda1->Draw("fSAME"); |
|
|
calbase->Draw("SAME"); |
|
|
f3pd1->Update(); |
|
|
f3pd2->Update(); |
|
|
f3pd3->Update(); |
|
|
figura3->Update(); |
|
|
// |
|
|
// |
|
|
// |
|
|
if ( ci == maxev-4 ) { |
|
|
// |
|
|
// report sheet: |
|
|
// |
|
|
stringstream errore; |
|
|
rapporto= new TCanvas("Calorimeter calibration report", "Calorimeter calibration report", 750, 950); |
|
|
rapporto->cd(); |
|
|
rapporto->SetFillColor(10); |
|
|
rapporto->Range(0,0,100,100); |
|
|
t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextSize(0.035); |
|
|
t->SetTextAlign(12); |
|
|
errore.str(""); |
|
|
errore << "BASIC - C20 - Calibrations in file: " << file; |
|
|
errore << " "; |
|
|
t->SetTextSize(0.02); |
|
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
|
|
// |
|
|
TPad *pad1; |
|
|
TPad *pad2; |
|
|
TPad *pad3; |
|
|
TPad *pad4; |
|
|
pad1 = new TPad("pad1","This is pad1",0.02,0.47,0.49,0.90,19); |
|
|
pad2 = new TPad("pad2","This is pad2",0.51,0.47,0.98,0.90,19); |
|
|
pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.49,0.45,19); |
|
|
pad4 = new TPad("pad4","This is pad4",0.51,0.02,0.98,0.45,19); |
|
|
pad1->Range(0,0,100,100); |
|
|
pad2->Range(0,0,100,100); |
|
|
pad3->Range(0,0,100,100); |
|
|
pad4->Range(0,0,100,100); |
|
|
// |
|
|
pad1->Draw(); |
|
|
pad2->Draw(); |
|
|
pad3->Draw(); |
|
|
pad4->Draw(); |
|
|
// |
|
|
char *sezione = 0; |
|
|
for (Int_t si = 0; si < 4; si++){ |
|
|
if (si == 2) |
|
|
{ |
|
|
pad1->cd() ; |
|
|
sezione = "** Section YE (x even) **"; |
|
|
} |
|
|
if (si == 3) |
|
|
{ |
|
|
pad2->cd(); |
|
|
sezione = "** Section YO (x odd) **"; |
|
|
} |
|
|
if (si == 0) |
|
|
{ |
|
|
pad3->cd(); |
|
|
sezione = "** Section XE (y odd) **"; |
|
|
} |
|
|
if (si == 1) |
|
|
{ |
|
|
pad4->cd(); |
|
|
sezione = "** Section XO (y even) **"; |
|
|
} |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextSize(0.05); |
|
|
t->SetTextAlign(12); |
|
|
t->DrawLatex(33.,97.,sezione); |
|
|
t->SetTextSize(0.05); |
|
|
for (Int_t j = 0; j < 23; j++){ |
|
|
if ( ver[si][j] ) { |
|
|
t->SetTextColor(50); |
|
|
if (j == 0) { |
|
|
errore.str(""); |
|
|
errore << "* DSP ack error: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,30.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 1) { |
|
|
errore.str(""); |
|
|
errore << "* Temperature alarm: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,74.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 2) { |
|
|
errore.str(""); |
|
|
errore << "* Latch up alarm: " << ver[si][j]; |
|
|
errore << " time(s)."; |
|
|
t->DrawLatex(2.,65.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 3) { |
|
|
errore.str(""); |
|
|
errore << "RAW mode: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->SetTextColor(38); |
|
|
t->DrawLatex(2.,90.,errore.str().c_str()); |
|
|
} |
|
|
if (j == 4) { |
|
|
errore.str(""); |
|
|
errore << "* CMD length error: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,66.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 5) { |
|
|
errore.str(""); |
|
|
errore << "* Execution error: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,62.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 6) { |
|
|
errore.str(""); |
|
|
errore << "* CRC error (st. word): " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,58.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 7) { |
|
|
errore.str(""); |
|
|
errore << "View or command not recognized: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,54.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
// |
|
|
if (j == 8) { |
|
|
errore.str(""); |
|
|
errore << "Missing section: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,50.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 9) { |
|
|
errore.str(""); |
|
|
errore << "RAW MODE COMMAND: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,42.,errore.str().c_str()); |
|
|
} |
|
|
if (j == 11) { |
|
|
errore.str(""); |
|
|
errore << "CRC error (data): " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,38.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 16) { |
|
|
errore.str(""); |
|
|
errore << "Number of calibrations: " << ver[si][j]; |
|
|
t->SetTextColor(38); |
|
|
t->DrawLatex(2.,86.,errore.str().c_str()); |
|
|
} |
|
|
if (j == 19) { |
|
|
errore.str(""); |
|
|
errore << "Pedestal checksum wrong: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,14.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 20) { |
|
|
errore.str(""); |
|
|
errore << "Thresholds checksum wrong: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,10.,errore.str().c_str()); |
|
|
check = true; |
|
|
} |
|
|
if (j == 22) { |
|
|
errore.str(""); |
|
|
errore << "Packet length is zero (YODA input error), skipped: " << ver[si][j]; |
|
|
errore << " time(s)"; |
|
|
t->DrawLatex(2.,3.,errore.str().c_str()); |
|
|
check = true; |
|
|
}; |
|
|
}; |
|
|
}; |
|
505 |
}; |
}; |
506 |
rapporto->cd(); |
if ( calib.calrms[l][m][n] > 16 ){ |
507 |
t->SetTextFont(32); |
Xview->SetFillColor(3); |
508 |
t->SetTextColor(1); |
Yview->SetFillColor(3); |
|
t->SetTextSize(0.035); |
|
|
t->SetTextAlign(12); |
|
|
t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); |
|
|
//printf("vediamo: ccalped %f ccalrms %f ccalbad %f ccalthr %f ccalvar %f ccalbas %f \n",ccalped,ccalrms,ccalbad,ccalthr,ccalvar,ccalbas); |
|
|
if ( check ) { |
|
|
t->SetTextColor(50); |
|
|
t->DrawLatex(65.,95.,"WARNING, CHECK!"); |
|
|
t->SetTextColor(1); |
|
|
} else { |
|
|
t->SetTextColor(38); |
|
|
t->DrawLatex(65.,95.,"OK!"); |
|
|
t->SetTextColor(1); |
|
|
}; |
|
|
rapporto->Update(); |
|
|
}; |
|
|
// |
|
|
if ( !strcmp(format,"ps") ) { |
|
|
if ( ci == minev ) { |
|
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_chkcalib."; |
|
|
figsave << format; |
|
|
figsave << "("; |
|
|
}; |
|
|
if ( figmatra ) { |
|
|
figura2->Print(figsave.str().c_str(),"Portrait"); |
|
|
if ( ci == minev ) { |
|
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_chkcalib."; |
|
|
figsave << format; |
|
|
}; |
|
509 |
}; |
}; |
510 |
// |
if ( calib.calrms[l][m][n] > 26 ){ |
511 |
figura1->Print(figsave.str().c_str(),"Portrait"); |
Xview->SetFillColor(2); |
512 |
if ( ci == minev ) { |
Yview->SetFillColor(2); |
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_chkcalib."; |
|
|
figsave << format; |
|
513 |
}; |
}; |
514 |
// |
if ( calib.calrms[l][m][n] > 46 ){ |
515 |
figura3->Print(figsave.str().c_str(),"Portrait"); |
Xview->SetFillColor(6); |
516 |
// |
Yview->SetFillColor(6); |
|
if ( ci == maxev-4 ) { |
|
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_chkcalib."; |
|
|
figsave << format; |
|
|
figsave << ")"; |
|
|
rapporto->Print(figsave.str().c_str(),"Portrait"); |
|
|
}; |
|
|
} else { |
|
|
if ( figmatra ) { |
|
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_chkcalib1_"; |
|
|
figsave << (i+1) << "."; |
|
|
figsave << format; |
|
|
figura2->SaveAs(figsave.str().c_str()); |
|
517 |
}; |
}; |
518 |
// |
if ( calib.calrms[l][m][n] <= 0 || calib.calrms[l][m][n] >30000 || calib.calped[l][m][n]>25000){ |
519 |
figsave1.str(""); |
Xview->SetFillColor(10); |
520 |
figsave1 << outdir << "/" ; |
Yview->SetFillColor(10); |
521 |
figsave1 << figrec << "_chkcalib2_"; |
}; |
522 |
figsave1 << (i+1) << "."; |
if ( calib.calgood[l][m][n] != 0 ){ |
523 |
figsave1 << format; |
Xview->SetFillColor(1); |
524 |
figura1->SaveAs(figsave1.str().c_str()); |
Yview->SetFillColor(1); |
525 |
// |
}; |
526 |
figsave2.str(""); |
if ( l == 0 ) { |
527 |
figsave2 << outdir << "/" ; |
Xview->Fill(n,m,1.); |
528 |
figsave2 << figrec << "_chkcalib3_"; |
pd1->cd(); |
529 |
figsave2 << (i+1) << "."; |
Xview->Draw("box same"); |
530 |
figsave2 << format; |
}; |
531 |
figura3->SaveAs(figsave2.str().c_str()); |
if ( l == 1 ) { |
532 |
// |
Yview->Fill(n,m,1.); |
533 |
if ( ci == maxev-4 ) { |
pd2->cd(); |
534 |
figsave.str(""); |
Yview->Draw("box same"); |
535 |
figsave << outdir << "/" ; |
}; |
536 |
figsave << figrec << "_chkcalib_report."; |
}; |
|
figsave << format; |
|
|
rapporto->SaveAs(figsave.str().c_str()); |
|
|
}; |
|
537 |
}; |
}; |
538 |
|
}; |
539 |
}; |
}; |
540 |
printf("\n"); |
if ( figmatra ){ |
541 |
return; |
figura2->cd(); |
542 |
|
gStyle->SetOptStat(""); |
543 |
|
gStyle->SetOptDate(0); |
544 |
|
t=new TLatex(); |
545 |
|
t->SetTextFont(32); |
546 |
|
t->SetTextColor(1); |
547 |
|
t->SetTextSize(0.03); |
548 |
|
t->SetTextAlign(12); |
549 |
|
titolo.str(""); |
550 |
|
titolo << "C13 - Calorimeter: strip RMS - file "; |
551 |
|
titolo << file; |
552 |
|
titolo << " - calibration number "; |
553 |
|
titolo << (i+1); |
554 |
|
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
555 |
|
pd1->Update(); |
556 |
|
pd2->Update(); |
557 |
|
figura2->Update(); |
558 |
|
}; |
559 |
|
// |
560 |
|
figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950); |
561 |
|
figura1->SetFillColor(10); |
562 |
|
figura1->Range(0,0,100,100); |
563 |
|
// |
564 |
|
ccalped = (float)incalped/((float)outcalped + (float)incalped); |
565 |
|
Int_t f1pd1col = 10; |
566 |
|
if ( ccalped < ccalpedthr ) { |
567 |
|
check = true; |
568 |
|
f1pd1col = 45; |
569 |
|
}; |
570 |
|
// |
571 |
|
ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); |
572 |
|
Int_t f1pd2col = 10; |
573 |
|
if ( ccalrms < ccalrmsthr ) { |
574 |
|
check = true; |
575 |
|
f1pd2col = 45; |
576 |
|
}; |
577 |
|
// |
578 |
|
ccalbad = (float)totcalbad/4224.; |
579 |
|
Int_t f1pd3col = 10; |
580 |
|
if ( ccalbad > ccalbadthr ) { |
581 |
|
check = true; |
582 |
|
f1pd3col = 45; |
583 |
|
}; |
584 |
|
// |
585 |
|
TPad *f1pd1 = new TPad("f1pd1","This is f1pad1",0.02,0.684,0.98,0.95,f1pd1col); |
586 |
|
TPad *f1pd2 = new TPad("f1pd2","This is f1pad2",0.02,0.367,0.98,0.634,f1pd2col); |
587 |
|
TPad *f1pd3 = new TPad("f1pd3","This is f1pad3",0.02,0.05,0.98,0.317,f1pd3col); |
588 |
|
figura1->Clear(); |
589 |
|
figura1->cd(); |
590 |
|
f1pd1->SetTicks(); |
591 |
|
f1pd2->SetTicks(); |
592 |
|
f1pd3->SetTicks(); |
593 |
|
f1pd1->Draw(); |
594 |
|
f1pd2->Draw(); |
595 |
|
f1pd3->Draw(); |
596 |
|
figura1->Draw(); |
597 |
|
figura3 = new TCanvas("Calorimeter_calthr_calvar_calbase", "Calorimeter_calthr_calvar_calbase", 750, 950); |
598 |
|
figura3->SetFillColor(10); |
599 |
|
figura3->Range(0,0,100,100); |
600 |
|
// |
601 |
|
ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); |
602 |
|
Int_t f3pd1col = 10; |
603 |
|
if ( ccalthr < ccalthrthr ) { |
604 |
|
check = true; |
605 |
|
f3pd1col = 45; |
606 |
|
}; |
607 |
|
// |
608 |
|
ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); |
609 |
|
Int_t f3pd2col = 10; |
610 |
|
if ( ccalvar < ccalvarthr ) { |
611 |
|
check = true; |
612 |
|
f3pd2col = 45; |
613 |
|
}; |
614 |
|
// |
615 |
|
ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); |
616 |
|
Int_t f3pd3col = 10; |
617 |
|
if ( ccalbas < ccalbasthr ) { |
618 |
|
check = true; |
619 |
|
f3pd3col = 45; |
620 |
|
}; |
621 |
|
// |
622 |
|
TPad *f3pd1 = new TPad("f3pd1","This is f3pad1",0.02,0.684,0.98,0.95,f3pd1col); |
623 |
|
TPad *f3pd2 = new TPad("f3pd2","This is f3pad2",0.02,0.367,0.98,0.634,f3pd2col); |
624 |
|
TPad *f3pd3 = new TPad("f3pd3","This is f3pad3",0.02,0.05,0.98,0.317,f3pd3col); |
625 |
|
figura3->Clear(); |
626 |
|
figura3->cd(); |
627 |
|
f3pd1->SetTicks(); |
628 |
|
f3pd2->SetTicks(); |
629 |
|
f3pd3->SetTicks(); |
630 |
|
f3pd1->Draw(); |
631 |
|
f3pd2->Draw(); |
632 |
|
f3pd3->Draw(); |
633 |
|
figura3->Draw(); |
634 |
|
// |
635 |
|
gStyle->SetOptStat("N"); |
636 |
|
figura1->cd(); |
637 |
|
gStyle->SetNdivisions(322,"x"); |
638 |
|
t=new TLatex(); |
639 |
|
t->SetTextFont(32); |
640 |
|
t->SetTextColor(1); |
641 |
|
t->SetTextSize(0.025); |
642 |
|
t->SetTextAlign(12); |
643 |
|
titolo.str(""); |
644 |
|
titolo << "EXPERT - Calorimeter: calped/calrms/calgood - file "; |
645 |
|
titolo << file; |
646 |
|
titolo << " - calibration number "; |
647 |
|
titolo << (i+1); |
648 |
|
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
649 |
|
t->SetTextSize(0.03); |
650 |
|
f1pd1->cd(); |
651 |
|
// |
652 |
|
calped->GetXaxis()->SetNdivisions(322); |
653 |
|
calped->SetXTitle("strip"); |
654 |
|
calped->SetYTitle("ADC channels"); |
655 |
|
calped->SetMaximum(3000.); |
656 |
|
calped->SetMinimum(-3000.); |
657 |
|
calped->Draw(); |
658 |
|
TPolyLine *banda1; |
659 |
|
Double_t xc[4] = {0.,4224.,4224.,0.}; |
660 |
|
Double_t yc[4] = {-700.,-700.,700.,700.}; |
661 |
|
banda1 = new TPolyLine(4,xc,yc); |
662 |
|
banda1->SetLineColor(5); |
663 |
|
banda1->SetFillColor(5); |
664 |
|
banda1->SetLineWidth(1); |
665 |
|
banda1->Draw("fSAME"); |
666 |
|
TPolyLine *banda2; |
667 |
|
Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; |
668 |
|
// Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; |
669 |
|
Double_t yc2[4] = {-3000.,-3000.,3000.,3000.}; |
670 |
|
banda2 = new TPolyLine(4,xc2,yc2); |
671 |
|
banda2->SetLineColor(5); |
672 |
|
banda2->SetFillColor(5); |
673 |
|
banda2->SetLineWidth(1); |
674 |
|
banda2->Draw("fSAME"); |
675 |
|
calped->Draw("SAME"); |
676 |
|
f1pd2->cd(); |
677 |
|
f1pd2->SetLogy(); |
678 |
|
calrms->GetXaxis()->SetNdivisions(322); |
679 |
|
calrms->Draw(); |
680 |
|
Double_t xd[4] = {0.,4224.,4224.,0.}; |
681 |
|
Double_t yd[4] = {1.,1.,7.,7.}; |
682 |
|
banda1 = new TPolyLine(4,xd,yd); |
683 |
|
banda1->SetLineColor(5); |
684 |
|
banda1->SetFillColor(5); |
685 |
|
banda1->SetLineWidth(1); |
686 |
|
banda1->Draw("fSAME"); |
687 |
|
Float_t minrm = calrms->GetMinimum(); |
688 |
|
Float_t maxrm = calrms->GetMaximum(); |
689 |
|
Double_t xrm2[4] = {3449.,3551.,3551.,3449.}; |
690 |
|
Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm}; |
691 |
|
banda2 = new TPolyLine(4,xrm2,yrm2); |
692 |
|
banda2->SetLineColor(5); |
693 |
|
banda2->SetFillColor(5); |
694 |
|
banda2->SetLineWidth(1); |
695 |
|
banda2->Draw("fSAME"); |
696 |
|
calrms->SetXTitle("strip"); |
697 |
|
calrms->SetYTitle("ADC channels"); |
698 |
|
calrms->Draw("SAME"); |
699 |
|
f1pd3->cd(); |
700 |
|
gStyle->SetNdivisions(344,"x"); |
701 |
|
calbad->GetXaxis()->SetNdivisions(322); |
702 |
|
calbad->Draw(); |
703 |
|
calbad->SetXTitle("strip"); |
704 |
|
calbad->SetYTitle("0=good 255=bad"); |
705 |
|
f1pd1->Update(); |
706 |
|
f1pd2->Update(); |
707 |
|
f1pd3->Update(); |
708 |
|
figura1->Update(); |
709 |
|
// |
710 |
|
figura3->cd(); |
711 |
|
gStyle->SetNdivisions(644,"x"); |
712 |
|
t=new TLatex(); |
713 |
|
t->SetTextFont(32); |
714 |
|
t->SetTextColor(1); |
715 |
|
t->SetTextSize(0.025); |
716 |
|
t->SetTextAlign(12); |
717 |
|
titolo.str(""); |
718 |
|
titolo << "EXPERT - Calorimeter: calthr/calvar/calbase - file "; |
719 |
|
titolo << file; |
720 |
|
titolo << " - calibration number "; |
721 |
|
titolo << (i+1); |
722 |
|
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
723 |
|
t->SetTextSize(0.03); |
724 |
|
// |
725 |
|
f3pd1->cd(); |
726 |
|
calthr->GetXaxis()->SetNdivisions(644); |
727 |
|
calthr->SetXTitle("pre-amplifier"); |
728 |
|
calthr->SetYTitle("ADC channels"); |
729 |
|
calthr->Draw(); |
730 |
|
Double_t xe[4] = {0.,264.,264.,0.}; |
731 |
|
Double_t ye[4] = {12.,12.,21.,21.}; |
732 |
|
banda1 = new TPolyLine(4,xe,ye); |
733 |
|
banda1->SetLineColor(5); |
734 |
|
banda1->SetFillColor(5); |
735 |
|
banda1->SetLineWidth(1); |
736 |
|
banda1->Draw("fSAME"); |
737 |
|
// |
738 |
|
minrm = calthr->GetMinimum(); |
739 |
|
maxrm = 1.05*calthr->GetMaximum(); |
740 |
|
Double_t xth2[4] = {215.,221.,221.,215.}; |
741 |
|
Double_t yth2[4] = {minrm,minrm,maxrm,maxrm}; |
742 |
|
banda2 = new TPolyLine(4,xth2,yth2); |
743 |
|
banda2->SetLineColor(5); |
744 |
|
banda2->SetFillColor(5); |
745 |
|
banda2->SetLineWidth(1); |
746 |
|
banda2->Draw("fSAME"); |
747 |
|
// |
748 |
|
calthr->Draw("SAME"); |
749 |
|
f3pd2->cd(); |
750 |
|
// gPad->SetLogy(); |
751 |
|
calvar->GetXaxis()->SetNdivisions(644); |
752 |
|
calvar->SetXTitle("pre-amplifier"); |
753 |
|
calvar->SetYTitle("ADC channels"); |
754 |
|
calvar->Draw(); |
755 |
|
Double_t xt[4] = {0.,264.,264.,0.}; |
756 |
|
Double_t yt[4] = {1.,1.,8.,8.}; |
757 |
|
banda1 = new TPolyLine(4,xt,yt); |
758 |
|
banda1->SetLineColor(5); |
759 |
|
banda1->SetFillColor(5); |
760 |
|
banda1->SetLineWidth(1); |
761 |
|
banda1->Draw("fSAME"); |
762 |
|
// |
763 |
|
minrm = calvar->GetMinimum(); |
764 |
|
maxrm = 1.05*calvar->GetMaximum(); |
765 |
|
Double_t xva2[4] = {215.,221.,221.,215.}; |
766 |
|
Double_t yva2[4] = {minrm,minrm,maxrm,maxrm}; |
767 |
|
banda2 = new TPolyLine(4,xva2,yva2); |
768 |
|
banda2->SetLineColor(5); |
769 |
|
banda2->SetFillColor(5); |
770 |
|
banda2->SetLineWidth(1); |
771 |
|
banda2->Draw("fSAME"); |
772 |
|
// |
773 |
|
calvar->Draw("SAME"); |
774 |
|
f3pd3->cd(); |
775 |
|
calbase->GetXaxis()->SetNdivisions(644); |
776 |
|
calbase->SetXTitle("pre-amplifier"); |
777 |
|
calbase->SetYTitle("ADC channels"); |
778 |
|
calbase->Draw(); |
779 |
|
Double_t xg[4] = {0.,264.,264.,0.}; |
780 |
|
Double_t yg[4] = {2000.,2000.,4500.,4500.}; |
781 |
|
banda1 = new TPolyLine(4,xg,yg); |
782 |
|
banda1->SetLineColor(5); |
783 |
|
banda1->SetFillColor(5); |
784 |
|
banda1->SetLineWidth(1); |
785 |
|
banda1->Draw("fSAME"); |
786 |
|
calbase->Draw("SAME"); |
787 |
|
f3pd1->Update(); |
788 |
|
f3pd2->Update(); |
789 |
|
f3pd3->Update(); |
790 |
|
figura3->Update(); |
791 |
|
// |
792 |
|
if ( !strcmp(format,"ps") ) { |
793 |
|
if ( ci == minev ) { |
794 |
|
figsave.str(""); |
795 |
|
figsave << outdir << "/" ; |
796 |
|
figsave << figrec << "_CaloCHKCALIB."; |
797 |
|
figsave << format; |
798 |
|
figsave << "("; |
799 |
|
}; |
800 |
|
if ( figmatra ) { |
801 |
|
figura2->Print(figsave.str().c_str(),"Portrait"); |
802 |
|
if ( ci == minev ) { |
803 |
|
figsave.str(""); |
804 |
|
figsave << outdir << "/" ; |
805 |
|
figsave << figrec << "_CaloCHKCALIB."; |
806 |
|
figsave << format; |
807 |
|
}; |
808 |
|
}; |
809 |
|
// |
810 |
|
figura1->Print(figsave.str().c_str(),"Portrait"); |
811 |
|
if ( ci == minev ) { |
812 |
|
figsave.str(""); |
813 |
|
figsave << outdir << "/" ; |
814 |
|
figsave << figrec << "_CaloCHKCALIB."; |
815 |
|
figsave << format; |
816 |
|
}; |
817 |
|
// |
818 |
|
figura3->Print(figsave.str().c_str(),"Portrait"); |
819 |
|
// |
820 |
|
} else { |
821 |
|
if ( figmatra ) { |
822 |
|
figsave.str(""); |
823 |
|
figsave << outdir << "/" ; |
824 |
|
figsave << figrec << "_CaloCHKCALIB1_"; |
825 |
|
figsave << (i+1) << "."; |
826 |
|
figsave << format; |
827 |
|
figura2->SaveAs(figsave.str().c_str()); |
828 |
|
}; |
829 |
|
// |
830 |
|
figsave1.str(""); |
831 |
|
figsave1 << outdir << "/" ; |
832 |
|
figsave1 << figrec << "_CaloCHKCALIB2_"; |
833 |
|
figsave1 << (i+1) << "."; |
834 |
|
figsave1 << format; |
835 |
|
figura1->SaveAs(figsave1.str().c_str()); |
836 |
|
// |
837 |
|
figsave2.str(""); |
838 |
|
figsave2 << outdir << "/" ; |
839 |
|
figsave2 << figrec << "_CaloCHKCALIB3_"; |
840 |
|
figsave2 << (i+1) << "."; |
841 |
|
figsave2 << format; |
842 |
|
figura3->SaveAs(figsave2.str().c_str()); |
843 |
|
// |
844 |
|
}; |
845 |
|
if ( iactive && w4i ){ |
846 |
|
while ( gROOT->GetListOfCanvases()->FindObject(figura2) || gROOT->GetListOfCanvases()->FindObject(figura1) || gROOT->GetListOfCanvases()->FindObject(figura3) ){ |
847 |
|
gSystem->ProcessEvents(); |
848 |
|
gSystem->Sleep(10); |
849 |
|
}; |
850 |
|
}; |
851 |
|
}; |
852 |
|
// |
853 |
|
// |
854 |
|
// |
855 |
|
// |
856 |
|
// report sheet: |
857 |
|
// |
858 |
|
stringstream errore; |
859 |
|
rapporto= new TCanvas("Calorimeter calibration report", "Calorimeter calibration report", 750, 950); |
860 |
|
rapporto->cd(); |
861 |
|
rapporto->SetFillColor(10); |
862 |
|
rapporto->Range(0,0,100,100); |
863 |
|
TLatex *t=new TLatex(); |
864 |
|
t->SetTextFont(32); |
865 |
|
t->SetTextColor(1); |
866 |
|
t->SetTextSize(0.035); |
867 |
|
t->SetTextAlign(12); |
868 |
|
errore.str(""); |
869 |
|
errore << "BASIC - C20 - Calibrations in file: " << file; |
870 |
|
errore << " "; |
871 |
|
t->SetTextSize(0.02); |
872 |
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
873 |
|
// |
874 |
|
TPad *pad1; |
875 |
|
TPad *pad2; |
876 |
|
TPad *pad3; |
877 |
|
TPad *pad4; |
878 |
|
pad1 = new TPad("pad1","This is pad1",0.02,0.47,0.49,0.90,19); |
879 |
|
pad2 = new TPad("pad2","This is pad2",0.51,0.47,0.98,0.90,19); |
880 |
|
pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.49,0.45,19); |
881 |
|
pad4 = new TPad("pad4","This is pad4",0.51,0.02,0.98,0.45,19); |
882 |
|
pad1->Range(0,0,100,100); |
883 |
|
pad2->Range(0,0,100,100); |
884 |
|
pad3->Range(0,0,100,100); |
885 |
|
pad4->Range(0,0,100,100); |
886 |
|
// |
887 |
|
pad1->Draw(); |
888 |
|
pad2->Draw(); |
889 |
|
pad3->Draw(); |
890 |
|
pad4->Draw(); |
891 |
|
// |
892 |
|
char *sezione = 0; |
893 |
|
for (Int_t si = 0; si < 4; si++){ |
894 |
|
if (si == 2) |
895 |
|
{ |
896 |
|
pad1->cd() ; |
897 |
|
sezione = "** Section YE (x even) **"; |
898 |
|
} |
899 |
|
if (si == 3) |
900 |
|
{ |
901 |
|
pad2->cd(); |
902 |
|
sezione = "** Section YO (x odd) **"; |
903 |
|
} |
904 |
|
if (si == 0) |
905 |
|
{ |
906 |
|
pad3->cd(); |
907 |
|
sezione = "** Section XE (y odd) **"; |
908 |
|
} |
909 |
|
if (si == 1) |
910 |
|
{ |
911 |
|
pad4->cd(); |
912 |
|
sezione = "** Section XO (y even) **"; |
913 |
|
} |
914 |
|
t->SetTextFont(32); |
915 |
|
t->SetTextColor(1); |
916 |
|
t->SetTextSize(0.05); |
917 |
|
t->SetTextAlign(12); |
918 |
|
t->DrawLatex(33.,97.,sezione); |
919 |
|
t->SetTextSize(0.05); |
920 |
|
for (Int_t j = 0; j < 23; j++){ |
921 |
|
if ( ver[si][j] ) { |
922 |
|
t->SetTextColor(50); |
923 |
|
if (j == 0) { |
924 |
|
errore.str(""); |
925 |
|
errore << "* DSP ack error: " << ver[si][j]; |
926 |
|
errore << " time(s)"; |
927 |
|
t->DrawLatex(2.,30.,errore.str().c_str()); |
928 |
|
check = true; |
929 |
|
} |
930 |
|
if (j == 1) { |
931 |
|
errore.str(""); |
932 |
|
errore << "* Temperature alarm: " << ver[si][j]; |
933 |
|
errore << " time(s)"; |
934 |
|
t->DrawLatex(2.,74.,errore.str().c_str()); |
935 |
|
check = true; |
936 |
|
} |
937 |
|
if (j == 2) { |
938 |
|
errore.str(""); |
939 |
|
errore << "* Latch up alarm: " << ver[si][j]; |
940 |
|
errore << " time(s)."; |
941 |
|
t->DrawLatex(2.,65.,errore.str().c_str()); |
942 |
|
check = true; |
943 |
|
} |
944 |
|
if (j == 3) { |
945 |
|
errore.str(""); |
946 |
|
errore << "RAW mode: " << ver[si][j]; |
947 |
|
errore << " time(s)"; |
948 |
|
t->SetTextColor(38); |
949 |
|
t->DrawLatex(2.,90.,errore.str().c_str()); |
950 |
|
} |
951 |
|
if (j == 4) { |
952 |
|
errore.str(""); |
953 |
|
errore << "* CMD length error: " << ver[si][j]; |
954 |
|
errore << " time(s)"; |
955 |
|
t->DrawLatex(2.,66.,errore.str().c_str()); |
956 |
|
check = true; |
957 |
|
} |
958 |
|
if (j == 5) { |
959 |
|
errore.str(""); |
960 |
|
errore << "* Execution error: " << ver[si][j]; |
961 |
|
errore << " time(s)"; |
962 |
|
t->DrawLatex(2.,62.,errore.str().c_str()); |
963 |
|
check = true; |
964 |
|
} |
965 |
|
if (j == 6) { |
966 |
|
errore.str(""); |
967 |
|
errore << "* CRC error (st. word): " << ver[si][j]; |
968 |
|
errore << " time(s)"; |
969 |
|
t->DrawLatex(2.,58.,errore.str().c_str()); |
970 |
|
check = true; |
971 |
|
} |
972 |
|
if (j == 7) { |
973 |
|
errore.str(""); |
974 |
|
errore << "View or command not recognized: " << ver[si][j]; |
975 |
|
errore << " time(s)"; |
976 |
|
t->DrawLatex(2.,54.,errore.str().c_str()); |
977 |
|
check = true; |
978 |
|
} |
979 |
|
// |
980 |
|
if (j == 8) { |
981 |
|
errore.str(""); |
982 |
|
errore << "Missing section: " << ver[si][j]; |
983 |
|
errore << " time(s)"; |
984 |
|
t->DrawLatex(2.,50.,errore.str().c_str()); |
985 |
|
check = true; |
986 |
|
} |
987 |
|
if (j == 9) { |
988 |
|
errore.str(""); |
989 |
|
errore << "RAW MODE COMMAND: " << ver[si][j]; |
990 |
|
errore << " time(s)"; |
991 |
|
t->DrawLatex(2.,42.,errore.str().c_str()); |
992 |
|
} |
993 |
|
if (j == 11) { |
994 |
|
errore.str(""); |
995 |
|
errore << "CRC error (data): " << ver[si][j]; |
996 |
|
errore << " time(s)"; |
997 |
|
t->DrawLatex(2.,38.,errore.str().c_str()); |
998 |
|
check = true; |
999 |
|
} |
1000 |
|
if (j == 16) { |
1001 |
|
errore.str(""); |
1002 |
|
errore << "Number of calibrations: " << ver[si][j]; |
1003 |
|
t->SetTextColor(38); |
1004 |
|
t->DrawLatex(2.,86.,errore.str().c_str()); |
1005 |
|
} |
1006 |
|
if (j == 19) { |
1007 |
|
errore.str(""); |
1008 |
|
errore << "Pedestal checksum wrong: " << ver[si][j]; |
1009 |
|
errore << " time(s)"; |
1010 |
|
t->DrawLatex(2.,14.,errore.str().c_str()); |
1011 |
|
check = true; |
1012 |
|
} |
1013 |
|
if (j == 20) { |
1014 |
|
errore.str(""); |
1015 |
|
errore << "Thresholds checksum wrong: " << ver[si][j]; |
1016 |
|
errore << " time(s)"; |
1017 |
|
t->DrawLatex(2.,10.,errore.str().c_str()); |
1018 |
|
check = true; |
1019 |
|
} |
1020 |
|
if (j == 22) { |
1021 |
|
errore.str(""); |
1022 |
|
errore << "Packet length is zero (YODA input error), skipped: " << ver[si][j]; |
1023 |
|
errore << " time(s)"; |
1024 |
|
t->DrawLatex(2.,3.,errore.str().c_str()); |
1025 |
|
check = true; |
1026 |
|
}; |
1027 |
|
}; |
1028 |
|
}; |
1029 |
|
}; |
1030 |
|
rapporto->cd(); |
1031 |
|
t->SetTextFont(32); |
1032 |
|
t->SetTextColor(1); |
1033 |
|
t->SetTextSize(0.035); |
1034 |
|
t->SetTextAlign(12); |
1035 |
|
t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); |
1036 |
|
//printf("vediamo: ccalped %f ccalrms %f ccalbad %f ccalthr %f ccalvar %f ccalbas %f \n",ccalped,ccalrms,ccalbad,ccalthr,ccalvar,ccalbas); |
1037 |
|
if ( check ) { |
1038 |
|
t->SetTextColor(50); |
1039 |
|
t->DrawLatex(65.,95.,"WARNING, CHECK!"); |
1040 |
|
t->SetTextColor(1); |
1041 |
|
} else { |
1042 |
|
t->SetTextColor(38); |
1043 |
|
t->DrawLatex(65.,95.,"OK!"); |
1044 |
|
t->SetTextColor(1); |
1045 |
|
}; |
1046 |
|
rapporto->Update(); |
1047 |
|
// |
1048 |
|
if ( !strcmp(format,"ps") ) { |
1049 |
|
figsave.str(""); |
1050 |
|
figsave << outdir << "/" ; |
1051 |
|
figsave << figrec << "_CaloCHKCALIB."; |
1052 |
|
figsave << format; |
1053 |
|
figsave << ")"; |
1054 |
|
rapporto->Print(figsave.str().c_str(),"Portrait"); |
1055 |
|
} else { |
1056 |
|
figsave.str(""); |
1057 |
|
figsave << outdir << "/" ; |
1058 |
|
figsave << figrec << "_CaloCHKCALIB_report."; |
1059 |
|
figsave << format; |
1060 |
|
rapporto->SaveAs(figsave.str().c_str()); |
1061 |
|
}; |
1062 |
|
if ( iactive && w4i ){ |
1063 |
|
while ( gROOT->GetListOfCanvases()->FindObject(rapporto) ){ |
1064 |
|
gSystem->ProcessEvents(); |
1065 |
|
gSystem->Sleep(10); |
1066 |
|
}; |
1067 |
|
}; |
1068 |
|
printf("\n"); |
1069 |
|
return; |
1070 |
} |
} |