/[PAMELA software]/calo/flight/FQLOOK/macros/FCaloCHKCALIB.cxx
ViewVC logotype

Contents of /calo/flight/FQLOOK/macros/FCaloCHKCALIB.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (show annotations) (download)
Mon Sep 22 20:12:27 2008 UTC (16 years, 2 months ago) by mocchiut
Branch: MAIN
Changes since 1.15: +1 -0 lines
Added -m32 flag for cross compilation on 64bit machines

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

  ViewVC Help
Powered by ViewVC 1.1.23