/[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.13 - (show annotations) (download)
Mon Feb 26 08:50:59 2007 UTC (17 years, 9 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r20
Changes since 1.12: +144 -96 lines
Missing calibration screw up bug fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23