1 |
// |
// |
2 |
// Check the calorimter calibrations - Emiliano Mocchiutti |
// Check the calorimter calibrations - Emiliano Mocchiutti |
3 |
// |
// |
4 |
// FCaloCHKCALIB.c version 1.07 (2006-05-29) |
// FCaloCHKCALIB.c version 1.14 (2007-07-18) |
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.12 - 1.14 (2007-07-18): 05953 bug fixed (infinite loop). |
11 |
|
// |
12 |
|
// 1.12 - 1.13 (2006-09-22): Set upper limit in calvar plot. |
13 |
|
// |
14 |
|
// 1.07 - 1.12 (2006-08-04): bugs fixed. |
15 |
|
// |
16 |
|
// 1.07 - 1.11 (2006-07-17): Adapted to flight conditions. |
17 |
|
// |
18 |
// 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). |
// 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). |
19 |
// |
// |
20 |
// 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! |
48 |
#include <TPaveLabel.h> |
#include <TPaveLabel.h> |
49 |
#include <TStyle.h> |
#include <TStyle.h> |
50 |
#include <TSystem.h> |
#include <TSystem.h> |
51 |
|
#include <TApplication.h> |
52 |
// |
// |
53 |
#include <CalibCalPedEvent.h> |
#include <CalibCalPedEvent.h> |
54 |
|
#include <PamelaRun.h> |
55 |
// |
// |
56 |
using namespace std; |
using namespace std; |
57 |
// |
// |
58 |
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){ |
59 |
if ( to == 0 ){ |
if ( to == 0 ){ |
60 |
Int_t t2length = s2.Length(); |
Int_t t2length = s2.Length(); |
61 |
s1 = ""; |
s1 = ""; |
62 |
to = t2length; |
to = t2length; |
63 |
}; |
}; |
64 |
for (Int_t i = from; i<to; i++){ |
for (Int_t i = from; i<to; i++){ |
65 |
s1.Append(s2[i],1); |
s1.Append(s2[i],1); |
66 |
}; |
}; |
67 |
} |
} |
68 |
void stringappend(TString& s1, const TString& s2){ |
void stringappend(TString& s1, const TString& s2){ |
69 |
Int_t t2length = s2.Length(); |
Int_t t2length = s2.Length(); |
70 |
for (Int_t i = 0; i<t2length; i++){ |
for (Int_t i = 0; i<t2length; i++){ |
71 |
s1.Append(s2[i],1); |
s1.Append(s2[i],1); |
72 |
}; |
}; |
73 |
} |
} |
74 |
|
|
|
// 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; |
|
|
// TString file2; |
|
|
// stringcopy(file2,filename,posiz,posiz2); |
|
|
// TString pdat(".dat"); |
|
|
// stringappend(file2,pdat); |
|
|
// return file2; |
|
|
// } |
|
75 |
TString getFilename(const TString filename){ |
TString getFilename(const TString filename){ |
76 |
// |
// |
77 |
const string fil = gSystem->BaseName(filename.Data()); |
const string fil = gSystem->BaseName(filename.Data()); |
90 |
} |
} |
91 |
|
|
92 |
typedef struct Calib { |
typedef struct Calib { |
93 |
Int_t iev; |
Int_t iev; |
94 |
Int_t cstwerr[4]; |
Int_t cstwerr[4];//per l'header contenente lo stato del calorimetro |
95 |
Float_t cperror[4]; |
Float_t cperror[4]; |
96 |
Float_t mip[2][22][96]; |
Float_t mip[2][22][96];//(xy,piano,strip) |
97 |
Float_t calped[2][22][96]; |
Float_t calped[2][22][96]; |
98 |
Float_t calgood[2][22][96]; |
Float_t calgood[2][22][96]; |
99 |
Float_t calthr[2][22][6]; |
Float_t calthr[2][22][6]; |
100 |
Float_t calrms[2][22][96]; |
Float_t calrms[2][22][96]; |
101 |
Float_t calbase[2][22][6]; |
Float_t calbase[2][22][6]; |
102 |
Float_t calvar[2][22][6]; |
Float_t calvar[2][22][6]; |
103 |
Float_t calpuls[2][22][96]; |
Float_t calpuls[2][22][96]; |
104 |
} calib; |
} calib; |
105 |
|
|
106 |
void FCaloCHKCALIB(TString filename, Long64_t calibnumber = 0, TString outDir = "", Int_t figmatra = 0, TString saveas = "ps"){ |
|
107 |
gStyle->SetPaperSize(19.,25.); |
|
108 |
// |
//main |
109 |
Float_t ccalrmsthr=0.99; |
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){ |
110 |
Float_t ccalpedthr=0.99; |
|
111 |
Float_t ccalbadthr=0.03;// 0.005 |
gStyle->SetPaperSize(19.,25.); |
112 |
Float_t ccalthrthr=0.98; |
// |
113 |
Float_t ccalvarthr=0.99; |
TApplication *app = 0; //crea un ambiente root (app) |
114 |
Float_t ccalbasthr=0.99; |
if ( iactive ) app = new TApplication("app",0,0);//verifica se deve essere interattivo |
115 |
// |
// |
116 |
Float_t ccalrms; |
//definizione delle soglie per valutare problemi nell calibrazione |
117 |
Float_t ccalped; |
Float_t ccalrmsthr=0.95;// numero di strip con rms entro i limiti (99%) |
118 |
Float_t ccalbad; |
Float_t ccalpedthr=0.95;// numero di strip con piedistallo entro i limiti(99%) |
119 |
Float_t ccalthr; |
Float_t ccalbadthr=0.03;// 0.005 numero massimo di strip non utilizzate (3%) per calibrare |
120 |
Float_t ccalvar; |
Float_t ccalthrthr=0.95; |
121 |
Float_t ccalbas; |
Float_t ccalvarthr=0.95; |
122 |
// |
Float_t ccalbasthr=0.95; |
123 |
struct Calib calib; |
// |
124 |
stringstream titolo; |
Float_t ccalrms = 0.; |
125 |
stringstream xviewev; |
Float_t ccalped = 0.; |
126 |
stringstream yviewev; |
Float_t ccalbad = 0.; |
127 |
const char* startingdir = gSystem->WorkingDirectory(); |
Float_t ccalthr = 0.; |
128 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
Float_t ccalvar = 0.; |
129 |
TString fififile = getFilename(filename); |
Float_t ccalbas = 0.; |
130 |
const char *file; |
// |
131 |
file = fififile; |
struct Calib calib; |
132 |
// |
stringstream titolo, sottotitolo; |
133 |
ifstream myfile; |
stringstream xviewev; |
134 |
myfile.open(filename.Data()); |
stringstream yviewev; |
135 |
if ( !myfile ){ |
|
136 |
printf(" %s :no such file, exiting...\n\n",filename.Data()); |
//directory di lavoro |
137 |
|
const char* startingdir = gSystem->WorkingDirectory(); |
138 |
|
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
139 |
|
|
140 |
|
//nome del file |
141 |
|
TString fififile = getFilename(filename); |
142 |
|
const char *file; |
143 |
|
file = fififile; |
144 |
|
|
145 |
|
//verifica se esiste il file |
146 |
|
ifstream myfile; |
147 |
|
myfile.open(filename.Data()); |
148 |
|
if ( !myfile ){ |
149 |
|
printf(" %s :no such file, exiting...\n\n",filename.Data()); |
150 |
|
return; |
151 |
|
}; |
152 |
|
myfile.close(); |
153 |
|
// |
154 |
|
|
155 |
|
//apre il file in 'File' |
156 |
|
TFile *File = new TFile(filename.Data()); |
157 |
|
|
158 |
|
//crea struttura tree (tr) con il tree "CalibCalPed" in File |
159 |
|
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
160 |
|
//definisco struttura tree per caricare gli header cpu |
161 |
|
TTree *cpuhe = (TTree*)File->Get("CalibHeader"); |
162 |
|
|
163 |
|
if ( !tr ) { |
164 |
|
printf(" CalibCalPed : no such tree in %s \n",filename.Data()); |
165 |
|
printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); |
166 |
|
return; |
167 |
|
}; |
168 |
|
|
169 |
|
pamela::CalibCalPedEvent *ce = 0; |
170 |
|
pamela::EventHeader *eh = 0;//definisco variabili di tipo header |
171 |
|
pamela::EventHeader *ch =0;//definisco la variabile per header cpu |
172 |
|
// pamela::PscuHeader *ph = 0; //definisco variabile di tipo pscu |
173 |
|
|
174 |
|
// |
175 |
|
//UInt_t found; |
176 |
|
UInt_t cpuobt=0, obt=0, obt0=0, obt1=0, obt2=0, obt3=0; |
177 |
|
|
178 |
|
// tr->SetBranchStatus("*",0,&found); //disable all branches |
179 |
|
// |
180 |
|
// found = 0; |
181 |
|
// tr->SetBranchStatus("iev*",1,&found); |
182 |
|
// found = 0; |
183 |
|
// tr->SetBranchStatus("cstwerr*",1,&found); |
184 |
|
// // printf("enabled %i branches \n",found); |
185 |
|
// found = 0; |
186 |
|
// tr->SetBranchStatus("cperror*",1,&found); |
187 |
|
// //printf("enabled %i branches \n",found); |
188 |
|
// found = 0; |
189 |
|
// tr->SetBranchStatus("cal*",1,&found); |
190 |
|
// //printf("enabled %i branches \n",found); |
191 |
|
// found = 0; |
192 |
|
// tr->SetBranchStatus("CalibCalPed*",1,&found); |
193 |
|
//printf("enabled %i branches \n",found); |
194 |
|
// |
195 |
|
tr->SetBranchAddress("CalibCalPed", &ce);//dichiaro in che ramo trovare quello che voglio puntare con ce |
196 |
|
tr->SetBranchAddress("Header", &eh);//dichiaro dove trovare quello che voglio in he |
197 |
|
// |
198 |
|
cpuhe->SetBranchAddress("Header",&ch); |
199 |
|
// |
200 |
|
Long64_t ncalibs = tr->GetEntries();//cerca il ramo Entries (calibrazioni) |
201 |
|
if ( ncalibs == 0 || cpuhe->GetEntries() == 0){ |
202 |
|
printf(" No calibrations in this files! \n Exiting... \n"); |
203 |
|
return; |
204 |
|
}; |
205 |
|
// |
206 |
|
UInt_t cpuhead[1000]; |
207 |
|
memset(cpuhead, 0, 1000*sizeof(UInt_t)); |
208 |
|
for (Int_t i=0; i<cpuhe->GetEntries(); i++){ |
209 |
|
cpuhe->GetEntry(i); |
210 |
|
if ( i < 1000 ) cpuhead[i]=ch->GetPscuHeader()->GetOrbitalTime(); |
211 |
|
if ( i > 1000 ){ |
212 |
|
printf(" ERROR: too many calibrations in this file, cannot handle it \n Exiting... \n"); |
213 |
return; |
return; |
214 |
}; |
}; |
215 |
myfile.close(); |
}; |
216 |
// |
// |
217 |
TFile *File = new TFile(filename.Data()); |
printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4); |
218 |
// |
Long64_t minev = 0; |
219 |
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
Long64_t maxev = ncalibs; |
220 |
if ( !tr ) { |
if ( calibnumber ){//calibnumber e' in ingresso nel main |
221 |
printf(" CalibCalPed : no such tree in %s \n",filename.Data()); |
minev = (calibnumber - 1)* 4; |
222 |
printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); |
maxev = minev + 4; |
223 |
return; |
}; |
224 |
|
TCanvas *figura1;//finestra grafica che posso suddividere in piu' aree (pads) |
225 |
|
TCanvas *figura2 = 0; |
226 |
|
TCanvas *figura3; |
227 |
|
TCanvas *rapporto = 0; |
228 |
|
Int_t cmask = 127 ;//maschera per selezionare i Byte di errore dall'header |
229 |
|
Int_t cestw = 0; //variabile per contenere i Byte di errore del calorimetro estratti dall'header |
230 |
|
Int_t ver[4][23]; //variabile per riportare gli errori(22) su ogni sezione (4) |
231 |
|
|
232 |
|
//azzera ver |
233 |
|
for (Int_t k = 0; k < 4; k++ ){ |
234 |
|
for (Int_t m = 0; m < 23 ; m++ ){ |
235 |
|
ver[k][m] = 0 ; |
236 |
}; |
}; |
237 |
pamela::CalibCalPedEvent *ce = 0; |
}; |
238 |
|
// |
239 |
|
// |
240 |
|
const string fil = gSystem->BaseName(filename.Data()); |
241 |
|
Int_t posiz = fil.find(".root"); |
242 |
|
// |
243 |
|
TString file2; |
244 |
|
if ( posiz == -1 ){ |
245 |
|
file2 = gSystem->BaseName(filename.Data()); |
246 |
|
} else { |
247 |
|
Int_t posiz2 = 0; |
248 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
249 |
|
}; |
250 |
|
const char *figrec = file2; |
251 |
|
// |
252 |
|
const char *outdir = outDir; |
253 |
|
const char *format = saveas; |
254 |
|
stringstream figsave; //definisco stringhe i/o |
255 |
|
stringstream figsave1; |
256 |
|
stringstream figsave2; |
257 |
|
if ( !strcmp(format,"ps") ) { |
258 |
|
figsave.str(""); |
259 |
|
figsave << outdir << "/" ; |
260 |
|
figsave << figrec << "_CaloCHKCALIB."; |
261 |
|
figsave << format; |
262 |
|
figsave << "("; |
263 |
|
}; |
264 |
|
// |
265 |
|
|
266 |
|
//-----------------inizio CHECK per ricerca errori dal calorimetro------------------- |
267 |
|
// to check or not to check? this is the problem... |
268 |
|
|
269 |
|
Bool_t check = false;//azzera flag presenza errori |
270 |
|
|
271 |
|
// |
272 |
|
Int_t hi = (minev/4)-1; |
273 |
|
//inizio loop su tutti gli header degli eventi di calibrazione |
274 |
|
// for (Int_t ci = minev; ci < maxev ; ci+=4){ |
275 |
|
Int_t ci = minev; |
276 |
|
while ( ci < maxev ){ |
277 |
|
//scorre i pacchetti di 4 in 4 (cioe scorre le calibrazioni) |
278 |
|
Int_t incalrms = 0; |
279 |
|
Int_t outcalrms = 0; |
280 |
|
Int_t totcalbad = 0; |
281 |
|
Int_t incalped = 0; |
282 |
|
Int_t outcalped = 0; |
283 |
|
Int_t incalthr = 0; |
284 |
|
Int_t outcalthr = 0; |
285 |
|
Int_t incalvar = 0; |
286 |
|
Int_t outcalvar = 0; |
287 |
|
Int_t incalbas = 0; |
288 |
|
Int_t outcalbas = 0; |
289 |
|
//dall'albero calibheader, cerco obt dell cpu |
290 |
|
// cpuhe->GetEntry(ci/4); |
291 |
|
hi++; |
292 |
|
// cpuobt=ch->GetPscuHeader()->GetOrbitalTime(); |
293 |
|
cpuobt=cpuhead[hi]; |
294 |
|
obt0=0; |
295 |
|
obt1=0; |
296 |
|
obt2=0; |
297 |
|
obt3=0; |
298 |
// |
// |
299 |
UInt_t found; |
calib.iev=0; |
300 |
tr->SetBranchStatus("*",0,&found); //disable all branches |
memset(calib.cstwerr,0,4*sizeof(Int_t)); |
301 |
|
memset(calib.cperror,0,4*sizeof(Float_t)); |
302 |
|
memset(calib.calped,0,2*22*96*sizeof(Float_t)); |
303 |
|
memset(calib.calgood,0,2*22*96*sizeof(Float_t)); |
304 |
|
memset(calib.calrms,0,2*22*96*sizeof(Float_t)); |
305 |
|
memset(calib.calpuls,0,2*22*96*sizeof(Float_t)); |
306 |
|
memset(calib.calthr,0,2*22*6*sizeof(Float_t)); |
307 |
|
memset(calib.calvar,0,2*22*6*sizeof(Float_t)); |
308 |
|
memset(calib.calbase,0,2*22*6*sizeof(Float_t)); |
309 |
// |
// |
310 |
found = 0; |
//inizio loop su i 4 pacchetti per ogni calibrazione (scorre 4 successivi) |
311 |
tr->SetBranchStatus("iev*",1,&found); |
// for ( Int_t s=0 ; s<4 ;s++ ){ |
312 |
found = 0; |
Int_t s = 0; |
313 |
tr->SetBranchStatus("cstwerr*",1,&found); |
obt = cpuhead[hi]; |
314 |
// printf("enabled %i branches \n",found); |
// printf(" qui cpu header : %i hi %i entry %i \n",obt,hi,ci); |
315 |
found = 0; |
if ( !obt ) break; |
316 |
tr->SetBranchStatus("cperror*",1,&found); |
while ( (labs((Int_t)(obt-cpuhead[hi])) < 100000 && ci < maxev) || !cpuobt ){ |
317 |
//printf("enabled %i branches \n",found); |
|
318 |
found = 0; |
tr->GetEntry(ci);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture |
319 |
tr->SetBranchStatus("cal*",1,&found); |
// tr->GetEntry(ci+s);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture |
320 |
//printf("enabled %i branches \n",found); |
|
321 |
found = 0; |
//trovo l'OBT della entry (pacchetto) |
322 |
tr->SetBranchStatus("CalibCalPed*",1,&found); |
obt=eh->GetPscuHeader()->GetOrbitalTime();//cerca orbitaltime all'interno di Pscu |
323 |
//printf("enabled %i branches \n",found); |
// |
324 |
// |
//printf(" qui pkt header : %i \n",obt); |
325 |
tr->SetBranchAddress("CalibCalPed", &ce); |
|
326 |
// |
ci++; |
327 |
Long64_t ncalibs = tr->GetEntries(); |
|
328 |
if ( ncalibs == 0 ){ |
if ( labs((Int_t)(obt-cpuhead[hi])) < 100000 ){ |
329 |
printf(" No calibrations in this files! \n Exiting... \n"); |
|
330 |
return; |
// s++; |
331 |
}; |
if ( ce->cstwerr[0] ) s = 0; |
332 |
printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4); |
if ( ce->cstwerr[1] ) s = 1; |
333 |
Long64_t minev = 0; |
if ( ce->cstwerr[2] ) s = 2; |
334 |
Long64_t maxev = ncalibs; |
if ( ce->cstwerr[3] ) s = 3; |
335 |
if ( calibnumber ){ |
//printf(" qua pkt header : %i s = %i hi %i \n",obt,s,hi); |
336 |
minev = (calibnumber - 1)* 4; |
// |
337 |
maxev = minev + 4; |
calib.iev = ce->iev; |
338 |
}; |
cestw = 0; |
339 |
TCanvas *figura1; |
//cstwerr e' tutto l'header della sezione, mi interessano gli ultimi 2 Byte(errori del calorimetro) |
340 |
TCanvas *figura2 = 0; |
if ( ce->cstwerr[s] ){ |
341 |
TCanvas *figura3; |
cestw = ce->cstwerr[s] & cmask ; //confronto con la maschera per tenere solo gli |
342 |
TCanvas *rapporto = 0; |
ver[s][16]++;// ultimi 2 Byte (assegnati a cestw) |
|
Int_t cmask = 127 ; |
|
|
Int_t cestw = 0; |
|
|
Int_t ver[4][23]; |
|
|
// |
|
|
for (Int_t k = 0; k < 4; k++ ){ |
|
|
for (Int_t m = 0; m < 23 ; m++ ){ |
|
|
ver[k][m] = 0 ; |
|
343 |
}; |
}; |
344 |
}; |
if ( cestw ){//errori dal calorimetro |
345 |
|
if ( cestw & (1 << 0) ) ver[s][6]++ ;//spostati di uno e confronto se diverso 0 |
346 |
|
if ( cestw & (1 << 1) ) ver[s][5]++ ; |
347 |
|
if ( cestw & (1 << 2) ) ver[s][4]++ ; |
348 |
|
if ( cestw & (1 << 3) ) ver[s][3]++ ; |
349 |
|
if ( cestw & (1 << 4) ) ver[s][2]++ ; |
350 |
|
if ( cestw & (1 << 5) ) ver[s][1]++ ; |
351 |
|
if ( cestw & (1 << 6) ) ver[s][0]++ ; |
352 |
|
}; |
353 |
|
if ( ce->cperror[s] != 0. ){//errori dallo spacchettamento |
354 |
|
if (ce->cperror[s] == 128) ver[s][7]++ ; |
355 |
|
if (ce->cperror[s] == 129) ver[s][8]++ ; |
356 |
|
if (ce->cperror[s] == 130) { |
357 |
|
ver[s][9]++ ; |
358 |
|
ver[s][16]--; |
359 |
|
}; |
360 |
|
if (ce->cperror[s] == 132) ver[s][11]++ ; |
361 |
|
if (ce->cperror[s] == 140) ver[s][19]++ ; |
362 |
|
if (ce->cperror[s] == 141) ver[s][20]++ ; |
363 |
|
if (ce->cperror[s] == 142) ver[s][22]++ ; |
364 |
|
}; |
365 |
|
//lato oscuro :p |
366 |
|
for ( Int_t d=0 ; d<11 ;d++ ){ |
367 |
|
Int_t pre = -1; |
368 |
|
for ( Int_t j=0; j<96 ;j++){ |
369 |
|
if ( j%16 == 0 ) pre++; |
370 |
|
if ( s == 2 ){ |
371 |
|
//aggiungo obt del pacchetto che sta leggendo(obt) |
372 |
|
obt2=obt; |
373 |
|
calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; |
374 |
|
calib.cstwerr[3] = ce->cstwerr[3]; |
375 |
|
calib.cperror[3] = ce->cperror[3]; |
376 |
|
calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j]; |
377 |
|
calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre]; |
378 |
|
calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j]; |
379 |
|
calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre]; |
380 |
|
calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre]; |
381 |
|
}; |
382 |
|
if ( s == 3 ){ |
383 |
|
obt3=obt; |
384 |
|
calib.calped[0][2*d][j] = ce->calped[1][d][j]; |
385 |
|
calib.cstwerr[1] = ce->cstwerr[1]; |
386 |
|
calib.cperror[1] = ce->cperror[1]; |
387 |
|
calib.calgood[0][2*d][j] = ce->calgood[1][d][j]; |
388 |
|
calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre]; |
389 |
|
calib.calrms[0][2*d][j] = ce->calrms[1][d][j]; |
390 |
|
calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre]; |
391 |
|
calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre]; |
392 |
|
}; |
393 |
|
if ( s == 0 ){ |
394 |
|
obt0=obt; |
395 |
|
calib.calped[1][2*d][j] = ce->calped[0][d][j]; |
396 |
|
calib.cstwerr[0] = ce->cstwerr[0]; |
397 |
|
calib.cperror[0] = ce->cperror[0]; |
398 |
|
calib.calgood[1][2*d][j] = ce->calgood[0][d][j]; |
399 |
|
calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre]; |
400 |
|
calib.calrms[1][2*d][j] = ce->calrms[0][d][j]; |
401 |
|
calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre]; |
402 |
|
calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre]; |
403 |
|
}; |
404 |
|
if ( s == 1 ){ |
405 |
|
obt1=obt; |
406 |
|
calib.calped[1][2*d+1][j] = ce->calped[2][d][j]; |
407 |
|
calib.cstwerr[2] = ce->cstwerr[2]; |
408 |
|
calib.cperror[2] = ce->cperror[2]; |
409 |
|
calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j]; |
410 |
|
calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre]; |
411 |
|
calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j]; |
412 |
|
calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre]; |
413 |
|
calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre]; |
414 |
|
}; |
415 |
|
|
416 |
|
}; |
417 |
|
};//chiuso for su si(sezioni) |
418 |
|
} else { |
419 |
|
ci--; |
420 |
|
}; |
421 |
|
};//chiuso for su ci(eventi) |
422 |
// |
// |
423 |
// // |
//fine CHECK |
424 |
// const string fil = (const char*)filename; |
|
425 |
// Int_t posiz = fil.find("dw_"); |
// |
426 |
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
// Book the histograms: |
427 |
// Int_t posiz2 = posiz+13; |
// Int_t i = (ci-minev)/4; |
428 |
// TString file2; |
Int_t i = hi; |
429 |
// stringcopy(file2,filename,posiz,posiz2); |
xviewev.str(""); |
430 |
// // |
xviewev << "x-view event " << (i+1); |
431 |
// const char *figrec = file2; |
yviewev.str(""); |
432 |
// |
yviewev << "y-view event " << (i+1); |
433 |
const string fil = gSystem->BaseName(filename.Data()); |
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
434 |
Int_t posiz = fil.find(".root"); |
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
435 |
// |
|
436 |
TString file2; |
|
437 |
if ( posiz == -1 ){ |
|
438 |
file2 = gSystem->BaseName(filename.Data()); |
//prepara gli istogrammi figures: |
439 |
} else { |
gDirectory->Delete("C14"); |
440 |
Int_t posiz2 = 0; |
gDirectory->Delete("C15"); |
441 |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
gDirectory->Delete("C16"); |
442 |
}; |
//TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); |
443 |
const char *figrec = file2; |
// TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); |
444 |
|
TH1F *calped = new TH1F("C14","C14 calped",2112,-3.5,4227.5); //istogramma unidimensionale con valori float |
445 |
|
// TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.); |
446 |
|
TH1F *calrms = new TH1F("C15","C15 calrms",2112,-3.5,4228.5); |
447 |
|
TH1F *calbad = new TH1F("C16","C16 calgood",4230,-3.5,4228.5); |
448 |
// |
// |
449 |
const char *outdir = outDir; |
gDirectory->Delete("C17"); |
450 |
const char *format = saveas; |
gDirectory->Delete("C18"); |
451 |
stringstream figsave; |
gDirectory->Delete("C19"); |
452 |
stringstream figsave1; |
TH1F *calthr = new TH1F("C17","C17 calthr",271,-4.5,268.5); |
453 |
stringstream figsave2; |
TH1F *calvar = new TH1F("C18","C18 calvar",271,-4.5,268.5); |
454 |
|
TH1F *calbase = new TH1F("C19","C19 calbase",271,-4.5,268.5); |
455 |
// |
// |
456 |
// to check or not to check? this is the problem... |
Int_t bgcolor = 10; |
457 |
|
TPad *pd1 = 0; |
458 |
|
TPad *pd2 = 0; |
459 |
|
TPad *palette = 0; |
460 |
|
TLatex *t=new TLatex(); |
461 |
|
|
462 |
// |
// |
463 |
Bool_t check = false; |
//pagina visualizzata solo se ci sono problemi |
464 |
|
if ( figmatra ){//figmatra e' variabile in ingresso in main |
465 |
|
figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); |
466 |
|
figura2->SetFillColor(10); |
467 |
|
figura2->Range(0,0,100,100); |
468 |
|
bgcolor = 10; |
469 |
|
pd1 = new TPad("pd1","This is pad1",0.02,0.05,0.88,0.49,bgcolor); |
470 |
|
pd2 = new TPad("pd2","This is pad2",0.02,0.51,0.88,0.95,bgcolor); |
471 |
|
palette = new TPad("palette","This is palette",0.90,0.05,0.98,0.90,bgcolor); |
472 |
|
figura2->cd(); |
473 |
|
gStyle->SetOptStat(""); |
474 |
|
t=new TLatex(); |
475 |
|
t->SetTextFont(32); |
476 |
|
t->SetTextColor(1); |
477 |
|
t->SetTextSize(0.03); |
478 |
|
t->SetTextAlign(12); |
479 |
|
t->DrawLatex(90.,92.5,"ADC ch."); |
480 |
|
pd1->Range(0,0,100,100); |
481 |
|
pd2->Range(0,0,100,100); |
482 |
|
palette->Range(0,0,100,100); |
483 |
|
pd1->SetTicks(); |
484 |
|
pd2->SetTicks(); |
485 |
|
pd1->Draw(); |
486 |
|
pd2->Draw(); |
487 |
|
palette->Draw(); |
488 |
|
palette->cd(); |
489 |
|
// palette |
490 |
|
TPaveLabel *box1 = new TPaveLabel(2,2,98,14,"OFF",""); |
491 |
|
box1->SetTextFont(32); |
492 |
|
box1->SetTextColor(1); |
493 |
|
box1->SetTextSize(0.25); |
494 |
|
box1->SetFillColor(10); |
495 |
|
box1->Draw(); |
496 |
|
TPaveLabel *box2 = new TPaveLabel(2,16,98,28,"0-1.5",""); |
497 |
|
box2->SetTextFont(32); |
498 |
|
box2->SetTextColor(1); |
499 |
|
box2->SetTextSize(0.25); |
500 |
|
box2->SetFillColor(38); |
501 |
|
box2->Draw(); |
502 |
|
TPaveLabel *box3 = new TPaveLabel(2,30,98,42,"1.5-4",""); |
503 |
|
box3->SetTextFont(32); |
504 |
|
box3->SetTextColor(1); |
505 |
|
box3->SetTextSize(0.25); |
506 |
|
box3->SetFillColor(4); |
507 |
|
box3->Draw(); |
508 |
|
TPaveLabel *box4 = new TPaveLabel(2,44,98,56,"4-6.5",""); |
509 |
|
box4->SetTextFont(32); |
510 |
|
box4->SetTextColor(1); |
511 |
|
box4->SetTextSize(0.25); |
512 |
|
box4->SetFillColor(3); |
513 |
|
box4->Draw(); |
514 |
|
TPaveLabel *box5 = new TPaveLabel(2,58,98,70,"6.5-11.5",""); |
515 |
|
box5->SetTextFont(32); |
516 |
|
box5->SetTextColor(1); |
517 |
|
box5->SetTextSize(0.25); |
518 |
|
box5->SetFillColor(2); |
519 |
|
box5->Draw(); |
520 |
|
TPaveLabel *box6 = new TPaveLabel(2,72,98,84,">11.5",""); |
521 |
|
box6->SetTextFont(32); |
522 |
|
box6->SetTextColor(1); |
523 |
|
box6->SetTextSize(0.25); |
524 |
|
box6->SetFillColor(6); |
525 |
|
box6->Draw(); |
526 |
|
TPaveLabel *box7 = new TPaveLabel(2,86,98,98,"BAD",""); |
527 |
|
box7->SetTextFont(32); |
528 |
|
box7->SetTextColor(10); |
529 |
|
box7->SetTextSize(0.25); |
530 |
|
box7->SetFillColor(1); |
531 |
|
box7->Draw(); |
532 |
|
// |
533 |
|
pd1->cd(); |
534 |
|
gStyle->SetOptStat(""); |
535 |
|
Xview->SetXTitle("strip"); |
536 |
|
Xview->SetYTitle("X - plane"); |
537 |
|
Xview->GetYaxis()->SetTitleOffset(0.5); |
538 |
|
Xview->SetFillColor(bgcolor); |
539 |
|
Xview->Fill(1.,1.,1.); |
540 |
|
Xview->Draw("box"); |
541 |
|
pd1->Update(); |
542 |
|
pd2->cd(); |
543 |
|
gStyle->SetOptStat(""); |
544 |
|
Yview->SetXTitle("strip"); |
545 |
|
Yview->SetYTitle("Y - plane"); |
546 |
|
Yview->GetYaxis()->SetTitleOffset(0.5); |
547 |
|
Yview->SetFillColor(bgcolor); |
548 |
|
Yview->Fill(1.,1.,1.); |
549 |
|
Yview->Draw("box"); |
550 |
|
pd2->Update(); |
551 |
|
}; |
552 |
// |
// |
553 |
for (Int_t ci = minev; ci < maxev ; ci+=4){ |
// run over views and planes |
554 |
// |
//verifica quali strip sono state utilizzate per la calibrazione |
555 |
Int_t incalrms = 0; |
Int_t j = 0; |
556 |
Int_t outcalrms = 0; |
Int_t g = 0; |
557 |
Int_t totcalbad = 0; |
gStyle->SetOptStat(""); |
558 |
Int_t incalped = 0; |
for (Int_t m = 0; m < 22; m++){//loop sui piani |
559 |
Int_t outcalped = 0; |
for (Int_t l = 0; l < 2; l++){//loop x y |
560 |
Int_t incalthr = 0; |
for (Int_t n = 0; n < 96; n++){ //loop sulle strip |
561 |
Int_t outcalthr = 0; |
//controlla quante strip hanno piedistallo fuori dai limiti (escludendo quelle difettose) |
562 |
Int_t incalvar = 0; |
calped->Fill((float)j,calib.calped[l][m][n]); |
563 |
Int_t outcalvar = 0; |
if ( (calib.calped[l][m][n] > 700. || calib.calped[l][m][n] < -700.) && (j < 4032 || j > 4048) ){ |
564 |
Int_t incalbas = 0; |
outcalped++; |
565 |
Int_t outcalbas = 0; |
} else { |
566 |
// |
incalped++; |
567 |
for ( Int_t s=0 ; s<4 ;s++ ){ |
}; |
568 |
tr->GetEntry(ci+s); |
//controlla quali strip hanno rms fuori dai limiti (ponendo un limite diverso(piu' alto) per quelle difettose |
569 |
calib.iev = ce->iev; |
calrms->Fill((float)j,(calib.calrms[l][m][n]/4.)); |
570 |
// |
if ( (((calib.calrms[l][m][n]/4.) > 10. || (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.)) ){ |
571 |
// |
outcalrms++; |
572 |
// |
} else { |
573 |
cestw = 0; |
incalrms++; |
574 |
if ( ce->cstwerr[s] ){ |
};//controlla (conta) quali strip sono state escluse dalla calibrazione |
575 |
cestw = ce->cstwerr[s] & cmask ; |
calbad->Fill((float)j,(float)calib.calgood[l][m][n]); |
576 |
ver[s][16]++; |
if ( calib.calgood[l][m][n] ) totcalbad++;//strip(orientazione(l),piano(m),numero(n))e' nulla, aumenta il |
577 |
}; |
// |
578 |
if ( cestw ){ |
//preamplificatori(soglia max di calvar portata a 9, prima era 8) |
579 |
if ( cestw & (1 << 0) ) ver[s][6]++ ; |
if ( n < 6 ){ |
580 |
if ( cestw & (1 << 1) ) ver[s][5]++ ; |
calthr->Fill((float)g,(float)calib.calthr[l][m][n]);//controlla quali strip hanno soglia al difuori del limite(esclude) |
581 |
if ( cestw & (1 << 2) ) ver[s][4]++ ; |
//(quelle difettose) |
582 |
if ( cestw & (1 << 3) ) ver[s][3]++ ; |
if ( (calib.calthr[l][m][n] > 25. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){ |
583 |
if ( cestw & (1 << 4) ) ver[s][2]++ ; |
outcalthr++; |
584 |
if ( cestw & (1 << 5) ) ver[s][1]++ ; |
} else { |
585 |
if ( cestw & (1 << 6) ) ver[s][0]++ ; |
incalthr++; |
586 |
}; |
}; |
587 |
if ( ce->cperror[s] != 0. ){ |
calvar->Fill((float)g,(float)calib.calvar[l][m][n]);//controlla la varianza (esclude le difettose) |
588 |
if (ce->cperror[s] == 128) ver[s][7]++ ; |
if ( (calib.calvar[l][m][n] > 9. || calib.calvar[l][m][n] < 1. ) && (g < 215 || g > 221) ){ |
589 |
if (ce->cperror[s] == 129) ver[s][8]++ ; |
outcalvar++; |
590 |
if (ce->cperror[s] == 130) { |
} else { |
591 |
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]++ ; |
|
592 |
}; |
}; |
593 |
// |
calbase->Fill((float)g,(float)calib.calbase[l][m][n]);//controlla baseline |
594 |
for ( Int_t d=0 ; d<11 ;d++ ){ |
if ( calib.calbase[l][m][n] > 5500. || calib.calbase[l][m][n] < 2000. ){ |
595 |
Int_t pre = -1; |
outcalbas++; |
596 |
for ( Int_t j=0; j<96 ;j++){ |
} else { |
597 |
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]; |
|
|
}; |
|
|
}; |
|
598 |
}; |
}; |
599 |
}; |
g++;//contatore preamplificatoripassa alla strip successiva (0-286) |
600 |
// |
}; |
601 |
// Book the histograms: |
// |
602 |
// |
j++;//contatore strip |
603 |
// |
|
604 |
Int_t i = (ci-minev)/4; |
//istogrammi (solo se ci sono stati problemi) |
605 |
xviewev.str(""); |
if ( figmatra ){ |
|
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); |
|
606 |
figura2->cd(); |
figura2->cd(); |
607 |
gStyle->SetOptStat(""); |
xviewev.str(""); |
608 |
t=new TLatex(); |
xviewev << "x-view " << i; |
609 |
t->SetTextFont(32); |
xviewev << " event " << n; |
610 |
t->SetTextColor(1); |
xviewev << " " << m; |
611 |
t->SetTextSize(0.03); |
xviewev << " " << l; |
612 |
t->SetTextAlign(12); |
yviewev.str(""); |
613 |
t->DrawLatex(90.,92.5,"ADC ch."); |
yviewev << "y-view " << i; |
614 |
pd1->Range(0,0,100,100); |
yviewev << " event " << n; |
615 |
pd2->Range(0,0,100,100); |
yviewev << " " << m; |
616 |
palette->Range(0,0,100,100); |
yviewev << " " << l; |
617 |
pd1->SetTicks(); |
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);//istogramma 2d |
618 |
pd2->SetTicks(); |
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
619 |
pd1->Draw(); |
if ( calib.calrms[l][m][n] > 0 ){ |
620 |
pd2->Draw(); |
Xview->SetFillColor(38); |
621 |
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"); |
|
|
}; |
|
|
}; |
|
|
}; |
|
622 |
}; |
}; |
623 |
}; |
if ( calib.calrms[l][m][n] > 6 ){ |
624 |
if ( figmatra ){ |
Xview->SetFillColor(4); |
625 |
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; |
|
|
}; |
|
|
}; |
|
|
}; |
|
626 |
}; |
}; |
627 |
rapporto->cd(); |
if ( calib.calrms[l][m][n] > 16 ){ |
628 |
t->SetTextFont(32); |
Xview->SetFillColor(3); |
629 |
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 << "_CaloCHKCALIB."; |
|
|
figsave << format; |
|
|
figsave << "("; |
|
|
}; |
|
|
if ( figmatra ) { |
|
|
figura2->Print(figsave.str().c_str(),"Portrait"); |
|
|
if ( ci == minev ) { |
|
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_CaloCHKCALIB."; |
|
|
figsave << format; |
|
|
}; |
|
630 |
}; |
}; |
631 |
// |
if ( calib.calrms[l][m][n] > 26 ){ |
632 |
figura1->Print(figsave.str().c_str(),"Portrait"); |
Xview->SetFillColor(2); |
633 |
if ( ci == minev ) { |
Yview->SetFillColor(2); |
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_CaloCHKCALIB."; |
|
|
figsave << format; |
|
634 |
}; |
}; |
635 |
// |
if ( calib.calrms[l][m][n] > 46 ){ |
636 |
figura3->Print(figsave.str().c_str(),"Portrait"); |
Xview->SetFillColor(6); |
637 |
// |
Yview->SetFillColor(6); |
|
if ( ci == maxev-4 ) { |
|
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_CaloCHKCALIB."; |
|
|
figsave << format; |
|
|
figsave << ")"; |
|
|
rapporto->Print(figsave.str().c_str(),"Portrait"); |
|
|
}; |
|
|
} else { |
|
|
if ( figmatra ) { |
|
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_CaloCHKCALIB1_"; |
|
|
figsave << (i+1) << "."; |
|
|
figsave << format; |
|
|
figura2->SaveAs(figsave.str().c_str()); |
|
638 |
}; |
}; |
639 |
// |
if ( calib.calrms[l][m][n] <= 0 || calib.calrms[l][m][n] >30000 || calib.calped[l][m][n]>25000){ |
640 |
figsave1.str(""); |
Xview->SetFillColor(10); |
641 |
figsave1 << outdir << "/" ; |
Yview->SetFillColor(10); |
642 |
figsave1 << figrec << "_CaloCHKCALIB2_"; |
}; |
643 |
figsave1 << (i+1) << "."; |
if ( calib.calgood[l][m][n] != 0 ){ |
644 |
figsave1 << format; |
Xview->SetFillColor(1); |
645 |
figura1->SaveAs(figsave1.str().c_str()); |
Yview->SetFillColor(1); |
646 |
// |
}; |
647 |
figsave2.str(""); |
if ( l == 0 ) { |
648 |
figsave2 << outdir << "/" ; |
Xview->Fill(n,m,1.); |
649 |
figsave2 << figrec << "_CaloCHKCALIB3_"; |
pd1->cd(); |
650 |
figsave2 << (i+1) << "."; |
Xview->Draw("box same"); |
651 |
figsave2 << format; |
}; |
652 |
figura3->SaveAs(figsave2.str().c_str()); |
if ( l == 1 ) { |
653 |
// |
Yview->Fill(n,m,1.); |
654 |
if ( ci == maxev-4 ) { |
pd2->cd(); |
655 |
figsave.str(""); |
Yview->Draw("box same"); |
656 |
figsave << outdir << "/" ; |
}; |
657 |
figsave << figrec << "_CaloCHKCALIB_report."; |
};//fine istogrammi |
658 |
figsave << format; |
};//fine loop strip per piano |
659 |
rapporto->SaveAs(figsave.str().c_str()); |
};//fine loop x y |
660 |
}; |
};//fine loop piani |
661 |
|
|
662 |
|
//disega la figura |
663 |
|
if ( figmatra ){ |
664 |
|
figura2->cd(); |
665 |
|
gStyle->SetOptStat(""); |
666 |
|
gStyle->SetOptDate(0); |
667 |
|
t=new TLatex(); |
668 |
|
t->SetTextFont(32); |
669 |
|
t->SetTextColor(1); |
670 |
|
t->SetTextSize(0.03); |
671 |
|
t->SetTextAlign(12); |
672 |
|
titolo.str(""); |
673 |
|
titolo << "C13 - Calorimeter: strip RMS - file "; |
674 |
|
titolo << file; |
675 |
|
titolo << " - calibration number "; |
676 |
|
titolo << (i+1); |
677 |
|
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
678 |
|
pd1->Update(); |
679 |
|
pd2->Update(); |
680 |
|
figura2->Update(); |
681 |
|
}; |
682 |
|
//fine pagina visualizzata solo se ci sono problemi |
683 |
|
// |
684 |
|
|
685 |
|
//Prepara le finestre |
686 |
|
//finestra con figure C14,C15,C16 |
687 |
|
figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950);//nuova finestra |
688 |
|
figura1->SetFillColor(10); |
689 |
|
figura1->Range(0,0,100,100); |
690 |
|
// |
691 |
|
ccalped = (float)incalped/((float)outcalped + (float)incalped); |
692 |
|
Int_t f1pd1col = 10;//costante=10 |
693 |
|
if ( ccalped < ccalpedthr ) { //se % strip con piedistallo buono < numero minimo segna soglia |
694 |
|
check = true; //flag per segnalare errori |
695 |
|
f1pd1col = 45; // (se ci sono problemi, cambia colore) |
696 |
|
}; |
697 |
|
// |
698 |
|
ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); |
699 |
|
Int_t f1pd2col = 10; |
700 |
|
if ( ccalrms < ccalrmsthr ) { //se % strip con rms buono< numero minimo segna errore |
701 |
|
check = true; |
702 |
|
f1pd2col = 45; |
703 |
|
}; |
704 |
|
// |
705 |
|
ccalbad = (float)totcalbad/4224.; |
706 |
|
Int_t f1pd3col = 10; |
707 |
|
if ( ccalbad > ccalbadthr ) { //se il numero di strip escluse dalla calibrazione e' troppo alto segna errore |
708 |
|
check = true; |
709 |
|
f1pd3col = 45; |
710 |
|
}; |
711 |
|
// |
712 |
|
TPad *f1pd1 = new TPad("f1pd1","This is f1pad1",0.02,0.684,0.98,0.95,f1pd1col);//prepara le pad di figura1 |
713 |
|
TPad *f1pd2 = new TPad("f1pd2","This is f1pad2",0.02,0.367,0.98,0.634,f1pd2col); |
714 |
|
TPad *f1pd3 = new TPad("f1pd3","This is f1pad3",0.02,0.05,0.98,0.317,f1pd3col); |
715 |
|
figura1->Clear(); |
716 |
|
figura1->cd(); |
717 |
|
f1pd1->SetTicks(); |
718 |
|
f1pd2->SetTicks(); |
719 |
|
f1pd3->SetTicks(); |
720 |
|
f1pd1->Draw(); |
721 |
|
f1pd2->Draw(); |
722 |
|
f1pd3->Draw(); |
723 |
|
figura1->Draw(); |
724 |
|
|
725 |
|
//finestra con figure C17,C18,C19 |
726 |
|
figura3 = new TCanvas("Calorimeter_calthr_calvar_calbase", "Calorimeter_calthr_calvar_calbase", 750, 950); |
727 |
|
figura3->SetFillColor(10); |
728 |
|
figura3->Range(0,0,100,100); |
729 |
|
// |
730 |
|
ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); |
731 |
|
Int_t f3pd1col = 10; |
732 |
|
if ( ccalthr < ccalthrthr ) { //controlla % strip fuori soglia |
733 |
|
check = true; |
734 |
|
f3pd1col = 45; |
735 |
|
}; |
736 |
|
// |
737 |
|
ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); |
738 |
|
Int_t f3pd2col = 10; |
739 |
|
if ( ccalvar < ccalvarthr ) { //controlla strip con varianza fuori dai limiti |
740 |
|
check = true; |
741 |
|
f3pd2col = 45; |
742 |
|
}; |
743 |
|
// |
744 |
|
ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); |
745 |
|
Int_t f3pd3col = 10; |
746 |
|
if ( ccalbas < ccalbasthr ) { //controlla strip con baseline fuori dai limiti |
747 |
|
check = true; |
748 |
|
f3pd3col = 45; |
749 |
|
}; |
750 |
|
// |
751 |
|
TPad *f3pd1 = new TPad("f3pd1","This is f3pad1",0.02,0.684,0.98,0.95,f3pd1col);//prepara le pad di figura 3 |
752 |
|
TPad *f3pd2 = new TPad("f3pd2","This is f3pad2",0.02,0.367,0.98,0.634,f3pd2col); |
753 |
|
TPad *f3pd3 = new TPad("f3pd3","This is f3pad3",0.02,0.05,0.98,0.317,f3pd3col); |
754 |
|
figura3->Clear();//cancella tutto in figura 3 |
755 |
|
figura3->cd(); |
756 |
|
f3pd1->SetTicks(); |
757 |
|
f3pd2->SetTicks(); |
758 |
|
f3pd3->SetTicks(); |
759 |
|
f3pd1->Draw(); |
760 |
|
f3pd2->Draw(); |
761 |
|
f3pd3->Draw(); |
762 |
|
figura3->Draw(); |
763 |
|
|
764 |
|
|
765 |
|
//mette i titoli nella figura 1 |
766 |
|
gStyle->SetOptStat("N"); |
767 |
|
figura1->cd(); |
768 |
|
gStyle->SetNdivisions(322,"x"); |
769 |
|
t=new TLatex(); |
770 |
|
t->SetTextFont(32); |
771 |
|
t->SetTextColor(1); |
772 |
|
t->SetTextSize(0.025); |
773 |
|
t->SetTextAlign(12); |
774 |
|
titolo.str(""); |
775 |
|
titolo << "EXPERT - Calorimeter: calped/calrms/calgood - file "; |
776 |
|
titolo << file; |
777 |
|
titolo << " - calibration number "; |
778 |
|
titolo << (i+1); |
779 |
|
sottotitolo.str(""); |
780 |
|
sottotitolo << "CPU OBT:" <<cpuobt; |
781 |
|
sottotitolo << " | OBT pk1:" <<obt0; |
782 |
|
sottotitolo << " - OBT pk2:"<<obt1; |
783 |
|
sottotitolo << " - OBT pk3:"<<obt2; |
784 |
|
sottotitolo << " - OBT pk4:"<<obt3; |
785 |
|
t->DrawLatex(0.5,98.,titolo.str().c_str()); |
786 |
|
t->SetTextSize(0.02); |
787 |
|
t->DrawLatex(0.5,96.,sottotitolo.str().c_str()); |
788 |
|
t->SetTextSize(0.03); |
789 |
|
// |
790 |
|
f1pd1->cd(); |
791 |
|
//titoli al grafico calped |
792 |
|
calped->GetXaxis()->SetNdivisions(322); |
793 |
|
calped->SetXTitle("strip"); |
794 |
|
calped->SetYTitle("ADC channels"); |
795 |
|
calped->SetMaximum(3000.); |
796 |
|
calped->SetMinimum(-3000.); |
797 |
|
//disegna istogramma calped |
798 |
|
calped->Draw(); |
799 |
|
//disegna la banda di accettazione |
800 |
|
TPolyLine *banda1; |
801 |
|
Double_t xc[4] = {0.,4224.,4224.,0.}; |
802 |
|
Double_t yc[4] = {-700.,-700.,700.,700.}; |
803 |
|
banda1 = new TPolyLine(4,xc,yc); |
804 |
|
banda1->SetLineColor(5); |
805 |
|
banda1->SetFillColor(5); |
806 |
|
banda1->SetLineWidth(1); |
807 |
|
banda1->Draw("fSAME"); |
808 |
|
//banda per le strip difettose |
809 |
|
TPolyLine *banda2; |
810 |
|
Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; |
811 |
|
// Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; |
812 |
|
Double_t yc2[4] = {-3000.,-3000.,3000.,3000.}; |
813 |
|
banda2 = new TPolyLine(4,xc2,yc2); |
814 |
|
banda2->SetLineColor(5); |
815 |
|
banda2->SetFillColor(5); |
816 |
|
banda2->SetLineWidth(1); |
817 |
|
banda2->Draw("fSAME"); |
818 |
|
|
819 |
|
calped->Draw("SAME"); |
820 |
|
// |
821 |
|
f1pd2->cd(); |
822 |
|
//prepara grafico calrms |
823 |
|
f1pd2->SetLogy(); |
824 |
|
calrms->GetXaxis()->SetNdivisions(322); |
825 |
|
//disegna istogramma calrms |
826 |
|
calrms->Draw(); |
827 |
|
//banda di accettazione |
828 |
|
Double_t xd[4] = {0.,4224.,4224.,0.}; |
829 |
|
Double_t yd[4] = {1.,1.,10.,10.}; |
830 |
|
banda1 = new TPolyLine(4,xd,yd); |
831 |
|
banda1->SetLineColor(5); |
832 |
|
banda1->SetFillColor(5); |
833 |
|
banda1->SetLineWidth(1); |
834 |
|
banda1->Draw("fSAME"); |
835 |
|
|
836 |
|
Float_t minrm = calrms->GetMinimum(); |
837 |
|
Float_t maxrm = calrms->GetMaximum(); |
838 |
|
Double_t xrm2[4] = {3449.,3551.,3551.,3449.}; |
839 |
|
Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm}; |
840 |
|
//banda per strip difettose |
841 |
|
banda2 = new TPolyLine(4,xrm2,yrm2); |
842 |
|
banda2->SetLineColor(5); |
843 |
|
banda2->SetFillColor(5); |
844 |
|
banda2->SetLineWidth(1); |
845 |
|
banda2->Draw("fSAME"); |
846 |
|
|
847 |
|
calrms->SetXTitle("strip"); |
848 |
|
calrms->SetYTitle("ADC channels"); |
849 |
|
|
850 |
|
calrms->Draw("SAME"); |
851 |
|
//prepara grafico calbad |
852 |
|
f1pd3->cd(); |
853 |
|
gStyle->SetNdivisions(344,"x"); |
854 |
|
calbad->GetXaxis()->SetNdivisions(322); |
855 |
|
//disegna calbad |
856 |
|
calbad->Draw(); |
857 |
|
calbad->SetXTitle("strip"); |
858 |
|
calbad->SetYTitle("0=good 255=bad"); |
859 |
|
// |
860 |
|
f1pd1->Update(); |
861 |
|
f1pd2->Update(); |
862 |
|
f1pd3->Update(); |
863 |
|
figura1->Update(); |
864 |
|
// |
865 |
|
|
866 |
|
|
867 |
|
//pagina con figure C17,C18,C19 |
868 |
|
figura3->cd(); |
869 |
|
gStyle->SetNdivisions(644,"x"); |
870 |
|
t=new TLatex(); |
871 |
|
t->SetTextFont(32); |
872 |
|
t->SetTextColor(1); |
873 |
|
t->SetTextSize(0.025); |
874 |
|
t->SetTextAlign(12); |
875 |
|
titolo.str(""); |
876 |
|
titolo << "EXPERT - Calorimeter: calthr/calvar/calbase - file "; |
877 |
|
titolo << file; |
878 |
|
titolo << " - calibration number "; |
879 |
|
titolo << (i+1); |
880 |
|
t->DrawLatex(0.5,98.,titolo.str().c_str()); |
881 |
|
t->SetTextSize(0.02); |
882 |
|
t->DrawLatex(0.5,96.,sottotitolo.str().c_str()); |
883 |
|
t->SetTextSize(0.03); |
884 |
|
// |
885 |
|
f3pd1->cd(); |
886 |
|
calthr->GetXaxis()->SetNdivisions(644); |
887 |
|
calthr->SetXTitle("pre-amplifier"); |
888 |
|
calthr->SetYTitle("ADC channels"); |
889 |
|
calthr->Draw(); |
890 |
|
Double_t xe[4] = {0.,264.,264.,0.}; |
891 |
|
Double_t ye[4] = {12.,12.,25.,25.}; |
892 |
|
banda1 = new TPolyLine(4,xe,ye); |
893 |
|
banda1->SetLineColor(5); |
894 |
|
banda1->SetFillColor(5); |
895 |
|
banda1->SetLineWidth(1); |
896 |
|
banda1->Draw("fSAME"); |
897 |
|
|
898 |
|
minrm = calthr->GetMinimum(); |
899 |
|
maxrm = 1.05*calthr->GetMaximum(); |
900 |
|
Double_t xth2[4] = {215.,221.,221.,215.}; |
901 |
|
Double_t yth2[4] = {minrm,minrm,maxrm,maxrm}; |
902 |
|
banda2 = new TPolyLine(4,xth2,yth2); |
903 |
|
banda2->SetLineColor(5); |
904 |
|
banda2->SetFillColor(5); |
905 |
|
banda2->SetLineWidth(1); |
906 |
|
banda2->Draw("fSAME"); |
907 |
|
// |
908 |
|
calthr->Draw("SAME"); |
909 |
|
|
910 |
|
|
911 |
|
f3pd2->cd(); |
912 |
|
// gPad->SetLogy(); |
913 |
|
//banda di soglia per calvar portata a 9, prima era a 8) |
914 |
|
calvar->SetMaximum(25.); |
915 |
|
calvar->GetXaxis()->SetNdivisions(644); |
916 |
|
calvar->SetXTitle("pre-amplifier"); |
917 |
|
calvar->SetYTitle("ADC channels"); |
918 |
|
calvar->Draw(); |
919 |
|
Double_t xt[4] = {0.,264.,264.,0.}; |
920 |
|
Double_t yt[4] = {1.,1.,9.,9.}; |
921 |
|
banda1 = new TPolyLine(4,xt,yt); |
922 |
|
banda1->SetLineColor(5); |
923 |
|
banda1->SetFillColor(5); |
924 |
|
banda1->SetLineWidth(1); |
925 |
|
banda1->Draw("fSAME"); |
926 |
|
|
927 |
|
minrm = calvar->GetMinimum(); |
928 |
|
maxrm = 1.05*calvar->GetMaximum(); |
929 |
|
Double_t xva2[4] = {215.,221.,221.,215.}; |
930 |
|
Double_t yva2[4] = {minrm,minrm,maxrm,maxrm}; |
931 |
|
banda2 = new TPolyLine(4,xva2,yva2); |
932 |
|
banda2->SetLineColor(5); |
933 |
|
banda2->SetFillColor(5); |
934 |
|
banda2->SetLineWidth(1); |
935 |
|
banda2->Draw("fSAME"); |
936 |
|
// |
937 |
|
calvar->Draw("SAME"); |
938 |
|
|
939 |
|
|
940 |
|
f3pd3->cd(); |
941 |
|
calbase->GetXaxis()->SetNdivisions(644); |
942 |
|
calbase->SetXTitle("pre-amplifier"); |
943 |
|
calbase->SetYTitle("ADC channels"); |
944 |
|
calbase->Draw(); |
945 |
|
Double_t xg[4] = {0.,264.,264.,0.}; |
946 |
|
Double_t yg[4] = {2000.,2000.,5500.,5500.}; |
947 |
|
banda1 = new TPolyLine(4,xg,yg); |
948 |
|
banda1->SetLineColor(5); |
949 |
|
banda1->SetFillColor(5); |
950 |
|
banda1->SetLineWidth(1); |
951 |
|
banda1->Draw("fSAME"); |
952 |
|
calbase->Draw("SAME"); |
953 |
|
// |
954 |
|
f3pd1->Update(); |
955 |
|
f3pd2->Update(); |
956 |
|
f3pd3->Update(); |
957 |
|
figura3->Update(); |
958 |
|
// |
959 |
|
//file output |
960 |
|
if ( !strcmp(format,"ps") ) { |
961 |
|
if ( figmatra ) { |
962 |
|
figura2->Print(figsave.str().c_str(),"Portrait"); |
963 |
|
if ( ci == minev ) { |
964 |
|
figsave.str(""); |
965 |
|
figsave << outdir << "/" ; |
966 |
|
figsave << figrec << "_CaloCHKCALIB."; |
967 |
|
figsave << format; |
968 |
}; |
}; |
969 |
|
}; |
970 |
|
// |
971 |
|
figura1->Print(figsave.str().c_str(),"Portrait"); |
972 |
|
if ( ci == minev ) { |
973 |
|
figsave.str(""); |
974 |
|
figsave << outdir << "/" ; |
975 |
|
figsave << figrec << "_CaloCHKCALIB."; |
976 |
|
figsave << format; |
977 |
|
}; |
978 |
|
// |
979 |
|
figura3->Print(figsave.str().c_str(),"Portrait"); |
980 |
|
// |
981 |
|
} else { |
982 |
|
if ( figmatra ) { |
983 |
|
figsave.str(""); |
984 |
|
figsave << outdir << "/" ; |
985 |
|
figsave << figrec << "_CaloCHKCALIB1_"; |
986 |
|
figsave << (i+1) << "."; |
987 |
|
figsave << format; |
988 |
|
figura2->SaveAs(figsave.str().c_str()); |
989 |
|
}; |
990 |
|
// |
991 |
|
figsave1.str(""); |
992 |
|
figsave1 << outdir << "/" ; |
993 |
|
figsave1 << figrec << "_CaloCHKCALIB2_"; |
994 |
|
figsave1 << (i+1) << "."; |
995 |
|
figsave1 << format; |
996 |
|
figura1->SaveAs(figsave1.str().c_str()); |
997 |
|
// |
998 |
|
figsave2.str(""); |
999 |
|
figsave2 << outdir << "/" ; |
1000 |
|
figsave2 << figrec << "_CaloCHKCALIB3_"; |
1001 |
|
figsave2 << (i+1) << "."; |
1002 |
|
figsave2 << format; |
1003 |
|
figura3->SaveAs(figsave2.str().c_str()); |
1004 |
|
// |
1005 |
|
}; |
1006 |
|
if ( iactive && w4i ){ |
1007 |
|
while ( gROOT->GetListOfCanvases()->FindObject(figura2) || gROOT->GetListOfCanvases()->FindObject(figura1) || gROOT->GetListOfCanvases()->FindObject(figura3) ){ |
1008 |
|
gSystem->ProcessEvents(); |
1009 |
|
gSystem->Sleep(10); |
1010 |
|
}; |
1011 |
}; |
}; |
1012 |
printf("\n"); |
};//fine del loop sulle calibrazioni |
1013 |
return; |
// |
1014 |
|
// |
1015 |
|
// |
1016 |
|
// |
1017 |
|
// report sheet: |
1018 |
|
// |
1019 |
|
stringstream errore; |
1020 |
|
rapporto= new TCanvas("Calorimeter calibration report", "Calorimeter calibration report", 750, 950); |
1021 |
|
rapporto->cd(); |
1022 |
|
rapporto->SetFillColor(10); |
1023 |
|
rapporto->Range(0,0,100,100); |
1024 |
|
TLatex *t=new TLatex(); |
1025 |
|
t->SetTextFont(32); |
1026 |
|
t->SetTextColor(1); |
1027 |
|
t->SetTextSize(0.035); |
1028 |
|
t->SetTextAlign(12); |
1029 |
|
errore.str(""); |
1030 |
|
errore << "BASIC - C20 - Calibrations in file: " << file; |
1031 |
|
errore << " "; |
1032 |
|
t->SetTextSize(0.02); |
1033 |
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
1034 |
|
// |
1035 |
|
TPad *pad1; |
1036 |
|
TPad *pad2; |
1037 |
|
TPad *pad3; |
1038 |
|
TPad *pad4; |
1039 |
|
pad1 = new TPad("pad1","This is pad1",0.02,0.47,0.49,0.90,19); |
1040 |
|
pad2 = new TPad("pad2","This is pad2",0.51,0.47,0.98,0.90,19); |
1041 |
|
pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.49,0.45,19); |
1042 |
|
pad4 = new TPad("pad4","This is pad4",0.51,0.02,0.98,0.45,19); |
1043 |
|
pad1->Range(0,0,100,100); |
1044 |
|
pad2->Range(0,0,100,100); |
1045 |
|
pad3->Range(0,0,100,100); |
1046 |
|
pad4->Range(0,0,100,100); |
1047 |
|
// |
1048 |
|
pad1->Draw(); |
1049 |
|
pad2->Draw(); |
1050 |
|
pad3->Draw(); |
1051 |
|
pad4->Draw(); |
1052 |
|
// |
1053 |
|
char *sezione = 0; |
1054 |
|
for (Int_t si = 0; si < 4; si++){ |
1055 |
|
if (si == 2) |
1056 |
|
{ |
1057 |
|
pad1->cd() ; |
1058 |
|
sezione = "** Section YE (x even) **"; |
1059 |
|
} |
1060 |
|
if (si == 3) |
1061 |
|
{ |
1062 |
|
pad2->cd(); |
1063 |
|
sezione = "** Section YO (x odd) **"; |
1064 |
|
} |
1065 |
|
if (si == 0) |
1066 |
|
{ |
1067 |
|
pad3->cd(); |
1068 |
|
sezione = "** Section XE (y odd) **"; |
1069 |
|
} |
1070 |
|
if (si == 1) |
1071 |
|
{ |
1072 |
|
pad4->cd(); |
1073 |
|
sezione = "** Section XO (y even) **"; |
1074 |
|
} |
1075 |
|
t->SetTextFont(32); |
1076 |
|
t->SetTextColor(1); |
1077 |
|
t->SetTextSize(0.05); |
1078 |
|
t->SetTextAlign(12); |
1079 |
|
t->DrawLatex(33.,97.,sezione); |
1080 |
|
t->SetTextSize(0.05); |
1081 |
|
|
1082 |
|
//scorre ver cercando il j tipo di errore: 'si'=sezione |
1083 |
|
for (Int_t j = 0; j < 23; j++){ |
1084 |
|
if ( ver[si][j] ) {//controlla se le sezioni di ver[si][j] sonoe diverse da zero. |
1085 |
|
t->SetTextColor(50); //controlla quali sono !=0 e assegna il rispettivo errore |
1086 |
|
if (j == 0) {//del calorimetro |
1087 |
|
errore.str(""); |
1088 |
|
errore << "* DSP ack error: " << ver[si][j]; |
1089 |
|
errore << " time(s)"; |
1090 |
|
t->DrawLatex(2.,30.,errore.str().c_str()); |
1091 |
|
check = true; |
1092 |
|
} |
1093 |
|
if (j == 1) {//calorimetro |
1094 |
|
errore.str(""); |
1095 |
|
errore << "* Temperature alarm: " << ver[si][j]; |
1096 |
|
errore << " time(s)"; |
1097 |
|
t->DrawLatex(2.,74.,errore.str().c_str()); |
1098 |
|
check = true; |
1099 |
|
} |
1100 |
|
if (j == 2) {//calorimetro |
1101 |
|
errore.str(""); |
1102 |
|
errore << "* Latch up alarm: " << ver[si][j]; |
1103 |
|
errore << " time(s)."; |
1104 |
|
t->DrawLatex(2.,65.,errore.str().c_str()); |
1105 |
|
check = true; |
1106 |
|
} |
1107 |
|
if (j == 3) {//calorimetro |
1108 |
|
errore.str(""); |
1109 |
|
errore << "RAW mode: " << ver[si][j]; |
1110 |
|
errore << " time(s)"; |
1111 |
|
t->SetTextColor(38); |
1112 |
|
t->DrawLatex(2.,90.,errore.str().c_str()); |
1113 |
|
} |
1114 |
|
if (j == 4) {//calorimetro |
1115 |
|
errore.str(""); |
1116 |
|
errore << "* CMD length error: " << ver[si][j]; |
1117 |
|
errore << " time(s)"; |
1118 |
|
t->DrawLatex(2.,66.,errore.str().c_str()); |
1119 |
|
check = true; |
1120 |
|
} |
1121 |
|
if (j == 5) {//calorimetro |
1122 |
|
errore.str(""); |
1123 |
|
errore << "* Execution error: " << ver[si][j]; |
1124 |
|
errore << " time(s)"; |
1125 |
|
t->DrawLatex(2.,62.,errore.str().c_str()); |
1126 |
|
check = true; |
1127 |
|
} |
1128 |
|
if (j == 6) {//calorimetro |
1129 |
|
errore.str(""); |
1130 |
|
errore << "* CRC error (st. word): " << ver[si][j]; |
1131 |
|
errore << " time(s)"; |
1132 |
|
t->DrawLatex(2.,58.,errore.str().c_str()); |
1133 |
|
check = true; |
1134 |
|
} |
1135 |
|
if (j == 7) { |
1136 |
|
errore.str(""); |
1137 |
|
errore << "View or command not recognized: " << ver[si][j]; |
1138 |
|
errore << " time(s)"; |
1139 |
|
t->DrawLatex(2.,54.,errore.str().c_str()); |
1140 |
|
check = true; |
1141 |
|
} |
1142 |
|
// |
1143 |
|
if (j == 8) { |
1144 |
|
errore.str(""); |
1145 |
|
errore << "Missing section: " << ver[si][j]; |
1146 |
|
errore << " time(s)"; |
1147 |
|
t->DrawLatex(2.,50.,errore.str().c_str()); |
1148 |
|
check = true; |
1149 |
|
} |
1150 |
|
if (j == 9) { |
1151 |
|
errore.str(""); |
1152 |
|
errore << "RAW MODE COMMAND: " << ver[si][j]; |
1153 |
|
errore << " time(s)"; |
1154 |
|
t->DrawLatex(2.,42.,errore.str().c_str()); |
1155 |
|
} |
1156 |
|
if (j == 11) { |
1157 |
|
errore.str(""); |
1158 |
|
errore << "CRC error (data): " << ver[si][j]; |
1159 |
|
errore << " time(s)"; |
1160 |
|
t->DrawLatex(2.,38.,errore.str().c_str()); |
1161 |
|
check = true; |
1162 |
|
} |
1163 |
|
if (j == 16) { |
1164 |
|
errore.str(""); |
1165 |
|
errore << "Number of calibrations: " << ver[si][j]; |
1166 |
|
t->SetTextColor(38); |
1167 |
|
t->DrawLatex(2.,86.,errore.str().c_str()); |
1168 |
|
} |
1169 |
|
if (j == 19) { |
1170 |
|
errore.str(""); |
1171 |
|
errore << "Pedestal checksum wrong: " << ver[si][j]; |
1172 |
|
errore << " time(s)"; |
1173 |
|
t->DrawLatex(2.,14.,errore.str().c_str()); |
1174 |
|
check = true; |
1175 |
|
} |
1176 |
|
if (j == 20) { |
1177 |
|
errore.str(""); |
1178 |
|
errore << "Thresholds checksum wrong: " << ver[si][j]; |
1179 |
|
errore << " time(s)"; |
1180 |
|
t->DrawLatex(2.,10.,errore.str().c_str()); |
1181 |
|
check = true; |
1182 |
|
} |
1183 |
|
if (j == 22) { |
1184 |
|
errore.str(""); |
1185 |
|
errore << "Packet length is zero (YODA input error), skipped: " << ver[si][j]; |
1186 |
|
errore << " time(s)"; |
1187 |
|
t->DrawLatex(2.,3.,errore.str().c_str()); |
1188 |
|
check = true; |
1189 |
|
}; |
1190 |
|
}; |
1191 |
|
}; |
1192 |
|
}; |
1193 |
|
rapporto->cd(); |
1194 |
|
t->SetTextFont(32); |
1195 |
|
t->SetTextColor(1); |
1196 |
|
t->SetTextSize(0.035); |
1197 |
|
t->SetTextAlign(12); |
1198 |
|
t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); |
1199 |
|
printf(" ccalped %f ccalrms %f ccalbad %f ccalthr %f ccalvar %f ccalbas %f \n",ccalped,ccalrms,ccalbad,ccalthr,ccalvar,ccalbas); |
1200 |
|
|
1201 |
|
|
1202 |
|
if ( check ) { |
1203 |
|
t->SetTextColor(50); |
1204 |
|
t->DrawLatex(65.,95.,"WARNING, CHECK!"); |
1205 |
|
t->SetTextColor(1); |
1206 |
|
} else { |
1207 |
|
t->SetTextColor(38); |
1208 |
|
t->DrawLatex(65.,95.,"OK!"); |
1209 |
|
t->SetTextColor(1); |
1210 |
|
}; |
1211 |
|
rapporto->Update(); |
1212 |
|
// |
1213 |
|
if ( !strcmp(format,"ps") ) { |
1214 |
|
figsave.str(""); |
1215 |
|
figsave << outdir << "/" ; |
1216 |
|
figsave << figrec << "_CaloCHKCALIB."; |
1217 |
|
figsave << format; |
1218 |
|
figsave << ")"; |
1219 |
|
rapporto->Print(figsave.str().c_str(),"Portrait"); |
1220 |
|
} else { |
1221 |
|
figsave.str(""); |
1222 |
|
figsave << outdir << "/" ; |
1223 |
|
figsave << figrec << "_CaloCHKCALIB_report."; |
1224 |
|
figsave << format; |
1225 |
|
rapporto->SaveAs(figsave.str().c_str()); |
1226 |
|
}; |
1227 |
|
if ( iactive && w4i ){ |
1228 |
|
while ( gROOT->GetListOfCanvases()->FindObject(rapporto) ){ |
1229 |
|
gSystem->ProcessEvents(); |
1230 |
|
gSystem->Sleep(10); |
1231 |
|
}; |
1232 |
|
}; |
1233 |
|
printf("\n"); |
1234 |
|
return; |
1235 |
} |
} |
1236 |
|
|