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