/[PAMELA software]/quicklook/calo/FQLOOK/macros/FCaloQLOOK.cxx
ViewVC logotype

Contents of /quicklook/calo/FQLOOK/macros/FCaloQLOOK.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Mon May 29 09:38:26 2006 UTC (18 years, 6 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r08
Changes since 1.8: +42 -23 lines
Fixed bug in output filename and changed threshold for bad strip warning

1 //
2 // Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti
3 //
4 // FCaloQLOOK.c version 1.08 (2006-05-29)
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.07 - 1.08 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN.
11 //
12 // 1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the
13 // case of latchup alarm.
14 //
15 // 1.05 - 1.06 (2006-03-22): Add optimize flag in compiling the script!
16 //
17 // 1.04 - 1.05 (2006-03-22): Corrected wrong .C files.
18 //
19 // 1.03 - 1.04 (2006-03-20): Documentation updated.
20 //
21 // 1.02 - 1.03 (2006-03-20): Changed name of shared libraries (from FCaloQLOOK_cxx.so to libFCaloQLOOK.so).
22 //
23 // 1.01 - 1.02 (2006-03-13): Include files from YODA without "event" directory.
24 //
25 // 1.00 - 1.01 (2006-02-28): Works on YODA v6 output (single file), does not require anymore calocommon package.
26 //
27 // 0.00 - 1.00 (2006-02-28): Clone of CaloQLOOK.c (ground software).
28 //
29 #include <iostream>
30 #include <fstream>
31 //
32 #include <TObject.h>
33 #include <TString.h>
34 #include <TFile.h>
35 #include <TCanvas.h>
36 #include <TH1.h>
37 #include <TH1F.h>
38 #include <TH2D.h>
39 #include <TLatex.h>
40 #include <TPad.h>
41 #include <TPolyLine.h>
42 #include <TStyle.h>
43 #include <TSystem.h>
44 //
45 #include <PamelaRun.h>
46 #include <physics/calorimeter/CalorimeterEvent.h>
47 //
48 #include <FCaloQLOOKfun.h>
49 //
50 using namespace std;
51 //
52 void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){
53 if ( to == 0 ){
54 Int_t t2length = s2.Length();
55 s1 = "";
56 to = t2length;
57 };
58 for (Int_t i = from; i<to; i++){
59 s1.Append(s2[i],1);
60 };
61 }
62 void stringappend(TString& s1, const TString& s2){
63 Int_t t2length = s2.Length();
64 for (Int_t i = 0; i<t2length; i++){
65 s1.Append(s2[i],1);
66 };
67 }
68
69 TString getFilename(const TString filename){
70 //
71 const string fil = gSystem->BaseName(filename.Data());
72 Int_t posiz = fil.find(".root");
73 //
74 TString file2;
75 if ( posiz == -1 ){
76 file2 = gSystem->BaseName(filename.Data());
77 } else {
78 Int_t posiz2 = 0;
79 stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz);
80 TString pdat(".dat");
81 stringappend(file2,pdat);
82 };
83 return file2;
84 }
85
86 void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){
87 gStyle->SetPaperSize(19.,25.);
88 const char* startingdir = gSystem->WorkingDirectory();
89 // printf(" basename is %s \n",gSystem->BaseName(filename.Data()));
90 // printf(" getfilename is %s \n",getFilename(filename).Data());
91 if ( !strcmp(outDir.Data(),"") ) outDir = startingdir;
92 //
93 //
94 ifstream myfile;
95 myfile.open(filename.Data());
96 if ( !myfile ){
97 printf(" %s :no such file, exiting...\n\n",filename.Data());
98 return;
99 };
100 myfile.close();
101 //
102 TFile *File = new TFile(filename.Data());
103 TTree *tr = (TTree*)File->Get("Physics");
104 if ( !tr ) {
105 printf(" Physics : no such tree in %s \n",filename.Data());
106 printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n");
107 return;
108 };
109 //
110 // Define variables
111 //
112 Float_t ctshitthr = 0.65;
113 Float_t cbasethr = 0.95;
114 Float_t cdexythr = 0.995;
115 Float_t cdexycthr = 0.95;
116 //
117 pamela::calorimeter::CalorimeterEvent *ce = 0;
118 pamela::EventHeader *eh = 0;
119 pamela::PscuHeader *ph = 0;
120 //
121 UInt_t found;
122 tr->SetBranchStatus("*",0,&found); //disable all branches
123 //
124 found = 0;
125 tr->SetBranchStatus("iev*",1,&found);
126 // printf("enabled %i branches \n",found);
127 found = 0;
128 tr->SetBranchStatus("dexy*",1,&found);
129 // printf("enabled %i branches \n",found);
130 found = 0;
131 tr->SetBranchStatus("stwerr*",1,&found);
132 // printf("enabled %i branches \n",found);
133 found = 0;
134 tr->SetBranchStatus("perror*",1,&found);
135 // printf("enabled %i branches \n",found);
136 found = 0;
137 tr->SetBranchStatus("cal*",1,&found);
138 // printf("enabled %i branches \n",found);
139 found = 0;
140 tr->SetBranchStatus("base*",1,&found);
141 //printf("enabled %i branches \n",found);
142 found = 0;
143 tr->SetBranchStatus("Pscu*",1,&found);
144 //printf("enabled %i branches \n",found);
145 found = 0;
146 tr->SetBranchStatus("Calorimeter*",1,&found);
147 //printf("calo enabled %i branches \n",found);
148 found = 0;
149 tr->SetBranchStatus("Header*",1,&found);
150 //printf("head enabled %i branches \n",found);
151 //
152 tr->SetBranchAddress("Calorimeter", &ce);
153 tr->SetBranchAddress("Header", &eh);
154 //
155 Long64_t nevents = tr->GetEntries();
156 if ( nevents < 1 ) {
157 printf("The file is empty!\n");
158 return;
159 };
160 Int_t const size = nevents;
161 Double_t iev2[size+1];
162 Int_t ver[4][23], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4];
163 se = 0;
164 pl = 0;
165 Float_t allbase = 0.;
166 Int_t tshit, trshit, compdata,rawdata, errorfull, calevn1, calevn2, calevn3, calevn4, pshit[4][11];
167 tshit = 0;
168 trshit = 0;
169 char *sezione;
170 Bool_t check = false;
171 sezione = "";
172 stringstream errore;
173 errore.str("");
174 //
175 TString fififile = getFilename(filename);
176 const char *file = fififile;
177 //
178 // book histograms
179 //
180 TH1F *h1;
181 TH1F *h1r;
182 TH1F *hdiff;
183 TH1F *Baseline;
184 TH1F *Dexy;
185 TH1F *Dexyc;
186 TH1F *Calstriphit;
187 TH1F *calev01;
188 TH1F *calev23;
189 TH1F *calev03;
190 TH1F *lupstw[4];
191 TH1F *lup[4];
192 TH2D *calev2;
193
194 h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.);
195 h1r = new TH1F("C8","Strips hit, raw mode",100,-1,1);
196 h1r->SetBit(TH1F::kCanRebin);
197 hdiff = new TH1F("C6","Differences in full mode",100,-3,3);
198 hdiff->SetBit(TH1F::kCanRebin);
199 Baseline = new TH1F("C9","baselines",100,0,3);
200 Baseline->SetBit(TH1F::kCanRebin);
201 Dexy = new TH1F("C12","dexy",100,0.,37000.);
202 Dexyc = new TH1F("C10","dexyc",100,0,3);
203 Dexyc->SetBit(TH1F::kCanRebin);
204 Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.);
205
206 calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1);
207 calev01->SetBit(TH1F::kCanRebin);
208 calev23 = new TH1F("C4","|calevnum(3)-calevnum(4)|",100,0,1);
209 calev23->SetBit(TH1F::kCanRebin);
210 calev03 = new TH1F("C5","|calevnum(1)-calevnum(4)|",100,0,1);
211 calev03->SetBit(TH1F::kCanRebin);
212 calev2 = new TH2D("C2","calevnum(2)%iev",3000,0.,2.,100,0.,2.);
213 calev2->SetBit(TH2D::kCanRebin);
214
215 stringstream oss;
216 stringstream noss;
217 for ( Int_t i=0; i<4; i++){
218 oss.str("");
219 oss << "OBT stw latch up section " << i;
220 noss.str("");
221 noss << "C" << 21+i;
222 lupstw[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1);
223 lupstw[i]->SetBit(TH1F::kCanRebin);
224 oss.str("");
225 oss << "OBT no stw latch up section " << i;
226 noss.str("");
227 noss << "C" << 25+i;
228 lup[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1);
229 lup[i]->SetBit(TH1F::kCanRebin);
230 };
231
232 //
233 // run over each event and take out some variables
234 //
235 if ( fromevent > toevent && toevent ){
236 printf("It must be fromevent < toevent \n");
237 return;
238 };
239
240
241 if ( fromevent > nevents+1 || fromevent < 0 ) {
242 printf("You can choose fromevent between 0 (all) and %i \n",(int)nevents+1);
243 return;
244 };
245
246 if ( toevent > nevents+1 || toevent < 0 ) {
247 printf("You can choose toevent between 0 (all) and %i \n",(int)nevents+1);
248 return;
249 };
250 Int_t minevent = 0;
251 Int_t maxevent = 0;
252 if ( fromevent == 0 ) {
253 minevent = 0;
254 maxevent = nevents -1;
255 } else {
256 minevent = fromevent - 1;
257 if ( toevent > 0 ){
258 maxevent = toevent - 1;
259 } else {
260 maxevent = fromevent - 1;
261 };
262 };
263
264 for (Int_t k = 0; k < 4; k++ ){
265 for (Int_t m = 0; m < 23 ; m++ ){
266 ver[k][m] = 0 ;
267 lver[k][m] = 0 ;
268 cpre[k]=0;
269 if ( m < 11 ) {
270 pshit[k][m] = 0;
271 nullsh[k][m] = 0;
272 };
273 lalarm[k] = 0;
274 };
275 };
276 Int_t pdone, bdone;
277 pdone = 0;
278 bdone = 0;
279 bool isCOMP = 0;
280 bool isFULL = 0;
281 bool isRAW = 0;
282 Int_t alldexy=0;
283 Int_t alldexy2=0;
284 Int_t stri=0;
285 Int_t fcheck = 0;
286 Int_t cestw=0;
287 Int_t cmask = 127 ;
288 compdata = 0;
289 rawdata = 0;
290 errorfull = 0;
291 calevn1 = 0;
292 calevn2 = 0;
293 calevn3 = 0;
294 calevn4 = 0;
295 fulldiff[0] = 0;
296 fulldiff[1] = 0;
297 fulldiff[2] = 0;
298 fulldiff[3] = 0;
299 printf("\n Processed events: \n\n");
300 unsigned short int calev0=0;
301 unsigned short int oldcalev0;
302 unsigned short int calev1=0;
303 unsigned short int oldcalev1;
304 unsigned short int calevv2=0;
305 unsigned short int oldcalev2;
306 unsigned short int calev3=0;
307 unsigned short int oldcalev3;
308 Int_t i = minevent;
309 Float_t headc = 0.;
310 Float_t headco = 0.;
311 Bool_t h1rcheck = false;
312 Int_t intshit = 0;
313 Int_t outtshit = 0;
314 Int_t incshit = 0;
315 Int_t outcshit = 0;
316 Int_t inbase = 0;
317 Int_t outbase = 0;
318 Int_t indexy = 0;
319 Int_t outdexy = 0;
320 Int_t indexyc = 0;
321 Int_t outdexyc = 0;
322 Int_t obt = 0;
323 Int_t minobt[4];
324 Int_t maxobt[4];
325 Int_t swminobt[4];
326 Int_t swmaxobt[4];
327 Bool_t firstobt[4];
328 Bool_t swfirstobt[4];
329 for ( Int_t i = 0; i<4; i++){
330 minobt[i] = 0;
331 maxobt[i] = 0;
332 swminobt[i] = 0;
333 swmaxobt[i] = 0;
334 firstobt[i] = true;
335 swfirstobt[i] = true;
336 };
337 while ( i < maxevent+1){
338 tshit = 0;
339 trshit = 0;
340 tr->GetEntry(i);
341 iev2[i] = ce->iev;
342 //
343 ph = eh->GetPscuHeader();
344 headco = headc;
345 headc = ph->GetCounter();
346 obt = ph->GetOrbitalTime();
347 calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1]));
348 calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3]));
349 calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3]));
350 calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1])));
351 calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3])));
352 calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3])));
353 unsigned short calvnm2 = (unsigned short)ce->calevnum[2];
354 calev2->Fill(ce->iev,calvnm2);
355 calevn4 += (int)ce->calevnum[2];
356 oldcalev0 = calev0;
357 calev0 = (int)ce->calevnum[0];
358 oldcalev1 = calev1;
359 calev1 = (int)ce->calevnum[1];
360 oldcalev2 = calevv2;
361 calevv2 = (int)ce->calevnum[2];
362 oldcalev3 = calev3;
363 calev3 = (int)ce->calevnum[3];
364 goto jumpprintout;
365 if ( (headc - headco -1.) == 0. && ((calev0 - oldcalev0 - 1) > 0 || (calev1 - oldcalev1 - 1) > 0 || (calevv2 - oldcalev2 - 1) > 0 || (calev3 - oldcalev3 - 1) > 0) ){
366 if ( i != minevent ) {
367 printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0);
368 printf(" %f 0 Event %i: %i\n",headc,i+1,calev0);
369 printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1);
370 printf(" %f 1 Event %i: %i\n",headc,i+1,calev1);
371 printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2);
372 printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2);
373 printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3);
374 printf(" %f 3 Event %i: %i\n",headc,i+1,calev3);
375 isRAW = 0;
376 if ( ce->stwerr[0] & (1 << 3)) isRAW = 1;
377 if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) {
378 ver[0][10]++;
379 };
380 isRAW = 0;
381 if ( ce->stwerr[0] & (1 << 3)) isRAW = 1;
382 if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){
383 ver[1][10]++;
384 };
385 isRAW = 0;
386 if ( ce->stwerr[0] & (1 << 3)) isRAW = 1;
387 if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){
388 ver[2][10]++;
389 };
390 isRAW = 0;
391 if ( ce->stwerr[0] & (1 << 3)) isRAW = 1;
392 if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){
393 ver[3][10]++;
394 };
395 }
396 };
397 jumpprintout:
398 memcpy(shit, nullsh, sizeof(nullsh));
399 memcpy(rshit, nullsh, sizeof(nullsh));
400 for (Int_t l = 0; l < 2; l++ ){
401 for (Int_t ii = 0; ii < 22; ii++){
402 if (l == 0 && ii%2 == 0){
403 se = 3;
404 pl = ii/2;
405 pdone = 0;
406 };
407 if (l == 0 && ii%2 != 0){
408 se = 2;
409 pl = (ii-1)/2;
410 pdone = 0;
411 };
412 if (l == 1 && ii%2 == 0){
413 se = 0;
414 pl = ii/2;
415 pdone = 0;
416 };
417 if (l == 1 && ii%2 != 0){
418 se = 1;
419 pl = (ii-1)/2;
420 pdone = 0;
421 };
422
423 isCOMP = 0;
424 isFULL = 0;
425 isRAW = 0;
426 if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1;
427 if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1;
428 if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1;
429 bl = -1;
430 for (Int_t kk = 0; kk < 96 ; kk++ ){
431 if ( kk%16 == 0 ){
432 bdone = 0;
433 bl++;
434 allbase = ce->base[l][ii][bl];
435 alldexy=0;
436 alldexy2=0;
437 stri=0;
438 for (Int_t e = 0; e < 16 ; e++ ){
439 stri = e + 16 * bl;
440 alldexy += (int)ce->dexyc[l][ii][stri];
441 alldexy2 += (int)ce->dexy[l][ii][stri];
442 };
443 };
444 if ( !isRAW ) {
445 //
446 if ( !pdone ){
447 if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) {
448 pdone = 1;
449 pshit[se][pl]++ ;
450 if ( (ce->stwerr[se] & (1 << 4)) == 0 ) {
451 lalarm[se]++;
452 lup[se]->Fill(obt);
453 if ( firstobt[se] ) minobt[se] = obt;
454 if ( obt > maxobt[se] ) maxobt[se] = obt;
455 };
456 lver[se][2]++ ;
457 };
458 }
459 //
460 if ( !bdone ){
461 Baseline->Fill(ce->base[l][ii][bl]);
462 if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 4500. ){
463 inbase++;
464 } else {
465 outbase++;
466 };
467 bdone = 1;
468 };
469 //
470 if (ce->dexyc[l][ii][kk] > 0 ) {
471 shit[se][pl]++ ;
472 compdata = 1;
473 };
474 //
475 if ( isFULL ) {
476 if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) {
477 rshit[se][pl]++ ;
478 rawdata = 1;
479 };
480 Dexy->Fill(ce->dexy[l][ii][kk]);
481 if ( ce->dexy[l][ii][kk] < 2000. || ce->dexy[l][ii][kk] > 5000. ) {
482 outdexy++;
483 } else {
484 indexy++;
485 };
486 if ( ce->dexyc[l][ii][kk]>0 && (ce->dexy[l][ii][kk]-ce->dexyc[l][ii][kk]) != 0 && ce->perror[se] != 132 && (ce->base[l][ii][bl] == 0 || ce->base[l][ii][bl] >32000) ){
487 hdiff->Fill(ce->dexyc[l][ii][kk]-ce->dexy[l][ii][kk]);
488 fulldiff[se]++;
489 errorfull = 1;
490 };
491 };
492 //
493 Dexyc->Fill(ce->dexyc[l][ii][kk]);
494 if ( ce->dexyc[l][ii][kk] != 0. && ( ce->dexyc[l][ii][kk] < 2000. || ce->dexyc[l][ii][kk] > 5000. ) ) {
495 outdexyc++;
496 } else {
497 indexyc++;
498 };
499 //
500 if (ce->dexyc[l][ii][kk] < 0 ) ver[se][21]++ ;
501 //
502 if ( allbase == 0. || allbase > 32000.) {
503 fcheck = 0;
504 for (Int_t nn = bl*16; nn < (bl+1)*16 ; nn++){
505 if ( ce->dexyc[l][ii][nn] > 0. && ce->dexyc[l][ii][nn] < 32000. ) fcheck++;
506 };
507 if ( fcheck ) {
508 cpre[se]++;
509 allbase = 1.;
510 };
511 };
512 //
513 } else {
514 if ( !pdone ){
515 if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) {
516 pdone = 1;
517 pshit[se][pl]++ ;
518 if ( (ce->stwerr[se] & (1 << 4)) == 0 ){
519 lalarm[se]++;
520 lup[se]->Fill(obt);
521 if ( firstobt[se] ) minobt[se] = obt;
522 if ( obt > maxobt[se] ) maxobt[se] = obt;
523 };
524 lver[se][2]++ ;
525 };
526 };
527 if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) {
528 rshit[se][pl]++ ;
529 rawdata = 1;
530 };
531 Dexy->Fill(ce->dexy[l][ii][kk]);
532 if ( ce->dexy[l][ii][kk] < 2000. || ce->dexy[l][ii][kk] > 5000. ) {
533 outdexy++;
534 } else {
535 indexy++;
536 };
537 };
538 };
539 };
540 };
541 cshit = 0;
542 for (Int_t k = 0; k < 4 ; k++ ){
543 isCOMP = 0;
544 isFULL = 0;
545 if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1;
546 if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1;
547 if ( isCOMP ) ver[k][16]++;
548 if ( isFULL ) ver[k][17]++;
549 cshit += (int)ce->calstriphit[k];
550 cestw=0;
551 if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ;
552 if ( cestw ){
553 if ( cestw & (1 << 0) ) ver[k][6]++ ;
554 if ( cestw & (1 << 1) ) ver[k][5]++ ;
555 if ( cestw & (1 << 2) ) ver[k][4]++ ;
556 if ( cestw & (1 << 3) ) ver[k][3]++ ;
557 if ( cestw & (1 << 4) ){
558 ver[k][2]++ ;
559 lupstw[k]->Fill(obt);
560 if ( swfirstobt[k] ) swminobt[k] = obt;
561 if ( obt > swmaxobt[k] ) swmaxobt[k] = obt;
562 };
563 if ( cestw & (1 << 5) ) ver[k][1]++ ;
564 if ( cestw & (1 << 6) ) ver[k][0]++ ;
565 };
566 if ( ce->perror[k] != 0. ){
567 if (ce->perror[k] == 128) ver[k][7]++ ;
568 if (ce->perror[k] == 129) ver[k][8]++ ;
569 if (ce->perror[k] == 132) ver[k][11]++ ;
570 if (ce->perror[k] == 133) ver[k][12]++ ;
571 if (ce->perror[k] == 134) ver[k][13]++ ;
572 if (ce->perror[k] == 135) ver[k][14]++ ;
573 if (ce->perror[k] == 136) ver[k][15]++ ;
574 if (ce->perror[k] == 139) ver[k][18]++ ;
575 if (ce->perror[k] == 140) ver[k][19]++ ;
576 if (ce->perror[k] == 141) ver[k][20]++ ;
577 if (ce->perror[k] == 142) ver[k][22]++ ;
578 };
579 for (Int_t kk = 0; kk < 11 ; kk++ ){
580 tshit += shit[k][kk];
581 trshit += rshit[k][kk];
582 };
583 };
584 Calstriphit->Fill(cshit);
585 if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){
586 incshit++;
587 } else {
588 outcshit++;
589 };
590 if ( tshit>0 ) h1->Fill(tshit);
591 if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){
592 intshit++;
593 } else {
594 outtshit++;
595 };
596 if ( trshit>0 ) {
597 h1r->Fill(trshit);
598 if ( trshit < 4210 ){
599 h1rcheck = true;
600 // printf("ma come... trshit %i \n",trshit);
601 };
602 };
603 if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000);
604 i++;
605 };
606 printf("\n");
607
608 //
609 // output figures, first sheet:
610 //
611 gStyle->SetOptDate(0);
612 gStyle->SetOptStat(1111);
613 TCanvas *figura = new TCanvas("Calorimeter_Detector_Report_1/3", "Calorimeter_Detector_Report_1/3", 1100, 900);
614 figura->SetFillColor(10);
615 figura->Range(0,0,100,100);
616 errore.str("");
617 errore << "EXPERT -- File: " << file;
618 errore << " ";
619 TLatex *t=new TLatex();
620 t->SetTextFont(32);
621 t->SetTextColor(1);
622 t->SetTextAlign(12);
623 t->SetTextSize(0.015);
624 t->DrawLatex(2.,99.,errore.str().c_str());
625 TPad *pd5;
626 TPad *pd6;
627 TPad *pd7;
628 TPad *pd8;
629 TPad *pad1;
630 TPad *pad2;
631 TPad *pad3;
632 TPad *pad4;
633 TPad *pd1;
634 TPad *pd2;
635 TPad *pd3;
636 TPad *pd4;
637 //
638 Double_t h1max;
639 TPolyLine *banda1;
640 TPolyLine *banda2;
641 Float_t ctshit = 0;
642 Float_t ccshit = 0;
643 Float_t cbase = 0;
644 Float_t cdexy = 0;
645 Float_t cdexyc = 0;
646 //
647 if ( compdata && rawdata ){
648 ctshit = (float)intshit/((float)outtshit + (float)intshit);
649 Int_t pd5col = 10;
650 Int_t pd6col = 10;
651 if ( ctshit < ctshitthr ) {
652 check = true;
653 pd5col = 45;
654 };
655 if ( h1rcheck ) {
656 check = true;
657 pd6col = 45;
658 };
659 pd5 = new TPad("pd5","This is pad5",0.51,0.51,0.98,0.98,pd5col);
660 pd6 = new TPad("pd6","This is pad6",0.51,0.02,0.98,0.49,pd6col);
661 pd5->SetTicks();
662 pd6->SetTicks();
663 pd5->Range(0,0,100,100);
664 pd6->Range(0,0,100,100);
665 figura->cd();
666 pd5->Draw();
667 pd5->cd();
668 h1->SetXTitle("Number of hit (dexyc>0)");
669 h1->SetYTitle("Number of events");
670 h1->Draw();
671 //
672 h1max = h1->GetMaximum()*1.05;
673 Double_t xc[4] = {0.,25.,25.,0.};
674 Double_t yc[4] = {0.,0.,h1max,h1max};
675 banda1 = new TPolyLine(4,xc,yc);
676 banda1->SetLineColor(5);
677 banda1->SetFillColor(5);
678 banda1->SetLineWidth(1);
679 banda1->Draw("fSAME");
680 Double_t xd[4] = {40.,80.,80.,40.};
681 Double_t yd[4] = {0.,0.,h1max,h1max};
682 banda2 = new TPolyLine(4,xd,yd);
683 banda2->SetLineColor(5);
684 banda2->SetFillColor(5);
685 banda2->SetLineWidth(1);
686 banda2->Draw("fSAME");
687 h1->Draw("SAME");
688 //
689 figura->cd();
690 pd6->Draw();
691 pd6->cd();
692 gPad->SetLogy();
693 h1r->SetXTitle("Number of hit (dexy>0)");
694 h1r->SetYTitle("Number of events");
695 h1r->Draw();
696 h1max = h1r->GetMaximum()*2.05;
697 Double_t xg[4] = {4220.,4230.,4230.,4220.};
698 Double_t yg[4] = {0.,0.,h1max,h1max};
699 banda1 = new TPolyLine(4,xg,yg);
700 banda1->SetLineColor(5);
701 banda1->SetFillColor(5);
702 banda1->SetLineWidth(1);
703 banda1->Draw("fSAME");
704 h1r->Draw("SAME");
705 };
706 if ( (compdata && !rawdata) || (!compdata && rawdata) ){
707 if ( tshit !=0 ) {
708 ctshit = (float)intshit/((float)outtshit + (float)intshit);
709 Int_t pd5col = 10;
710 if ( ctshit < ctshitthr ) {
711 check = true;
712 pd5col = 45;
713 };
714 pd5 = new TPad("pd5","This is pad5",0.51,0.02,0.98,0.98,pd5col);
715 pd5->Range(0,0,100,100);
716 pd5->SetTicks();
717 pd5->Draw();
718 pd5->cd();
719 h1->SetXTitle("Number of hit (dexyc>0)");
720 h1->SetYTitle("Number of events");
721 h1->Draw();
722 h1max = h1->GetMaximum()*1.05;
723 Double_t xe[4] = {0.,25.,25.,0.};
724 Double_t ye[4] = {0.,0.,h1max,h1max};
725 banda1 = new TPolyLine(4,xe,ye);
726 banda1->SetLineColor(5);
727 banda1->SetFillColor(5);
728 banda1->SetLineWidth(1);
729 banda1->Draw("fSAME");
730 Double_t xf[4] = {40.,80.,80.,40.};
731 Double_t yf[4] = {0.,0.,h1max,h1max};
732 banda2 = new TPolyLine(4,xf,yf);
733 banda2->SetLineColor(5);
734 banda2->SetFillColor(5);
735 banda2->SetLineWidth(1);
736 banda2->Draw("fSAME");
737 h1->Draw("SAME");
738 };
739 if ( trshit !=0 ) {
740 Int_t pd5col = 10;
741 if ( h1rcheck ) {
742 check = true;
743 pd5col = 45;
744 };
745 pd5 = new TPad("pd5","This is pad5",0.51,0.02,0.98,0.98,pd5col);
746 pd5->Range(0,0,100,100);
747 pd5->SetTicks();
748 pd5->Draw();
749 pd5->cd();
750 gPad->SetLogy();
751 h1r->SetXTitle("Number of hit (dexyc>0 or dexy>0)");
752 h1r->SetYTitle("Number of events");
753 h1r->Draw();
754 h1max = h1r->GetMaximum()*2.05;
755 Double_t xh[4] = {4220.,4230.,4230.,4220.};
756 Double_t yh[4] = {0.,0.,h1max,h1max};
757 banda1 = new TPolyLine(4,xh,yh);
758 banda1->SetLineColor(5);
759 banda1->SetFillColor(5);
760 banda1->SetLineWidth(1);
761 banda1->Draw("fSAME");
762 h1r->Draw("SAME");
763 };
764 };
765 if ( !errorfull ) {
766 if ( calevn1 || calevn2 || calevn3 ) {
767 pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45);
768 pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45);
769 pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45);
770 pd4 = new TPad("pd4","This is pad4",0.26,0.02,0.49,0.49,45);
771 figura->cd();
772 // printf("ou2! \n");
773 check = true;
774 pd1->Range(0,0,100,100);
775 pd2->Range(0,0,100,100);
776 pd3->Range(0,0,100,100);
777 pd4->Range(0,0,100,100);
778 pd1->Draw();
779 pd2->Draw();
780 pd3->Draw();
781 pd4->Draw();
782
783 pd1->cd();
784 gPad->SetLogy();
785 calev01->SetXTitle("delta calevnum 1-2");
786 calev01->SetYTitle("Number of events");
787 calev01->Draw();
788
789 pd2->cd();
790 gPad->SetLogy();
791 calev23->SetXTitle("delta calevnum 3-4");
792 calev23->SetYTitle("Number of events");
793 calev23->Draw();
794
795 pd3->cd();
796 gPad->SetLogy();
797 calev03->SetXTitle("delta calevnum 1-4");
798 calev03->SetYTitle("Number of events");
799 calev03->Draw();
800
801 pd4->cd();
802 calev2->SetYTitle("calevnum 2");
803 calev2->SetXTitle("iev");
804 calev2->Draw();
805 } else {
806 if ( calevn4 ) {
807 pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.98,10);
808 figura->cd();
809 pd3->Range(0,0,100,100);
810 pd3->Draw();
811 pd3->cd();
812 calev2->SetYTitle("calevnum 2");
813 calev2->SetXTitle("iev");
814 calev2->Draw();
815 } else {
816 figura->cd();
817 t=new TLatex();
818 t->SetTextFont(32);
819 t->SetTextColor(1);
820 t->SetTextSize(0.04);
821 t->SetTextAlign(12);
822 t->DrawLatex(10.,49.,"No calevnum infos from DSP");
823 };
824 };
825 } else {
826 figura->cd();
827 check = true;
828 // printf("nou! \n");
829 pd1 = new TPad("pd1","This is pad1",0.02,0.02,0.49,0.98,45);
830 pd1->Range(0,0,100,100);
831 pd1->Draw();
832 pd1->cd();
833 gPad->SetLogy();
834 hdiff->SetXTitle("Differences in FULL mode");
835 hdiff->SetYTitle("Number of events");
836 hdiff->Draw();
837 };
838
839 //
840 // output figures, second sheet:
841 //
842 TCanvas *figura2 = new TCanvas("Calorimeter_Detector_Report_2/3","Calorimeter_Detector_Report_2/3", 1100, 900);
843 if ( compdata ){
844 Int_t pd1col = 10;
845 Int_t pd2col = 10;
846 Int_t pd3col = 10;
847 Int_t pd4col = 10;
848 if ( (outdexy+indexy) ) {
849 cdexy = (float)indexy/((float)outdexy + (float)indexy);
850 if ( cdexy < cdexythr ) {
851 check = true;
852 pd4col = 45;
853 };
854 };
855 if ( (outcshit+incshit) ) {
856 ccshit = (float)incshit/((float)outcshit + (float)incshit);
857 if ( ccshit < ctshitthr ) {
858 check = true;
859 pd3col = 45;
860 };
861 };
862 if ( (outdexyc+indexyc) ) {
863 cdexyc = (float)indexyc/((float)outdexyc + (float)indexyc);
864 if ( cdexyc < cdexycthr ) {
865 check = true;
866 pd2col = 45;
867 };
868 };
869 if ( (outbase+inbase) ) {
870 cbase = (float)inbase/((float)outbase + (float)inbase);
871 if ( cbase < cbasethr ) {
872 check = true;
873 pd1col = 45;
874 };
875 };
876 figura2->SetFillColor(10);
877 figura2->Range(0,0,100,100);
878 errore.str("");
879 errore << "EXPERT -- File: " << file;
880 errore << " ";
881 t=new TLatex();
882 t->SetTextFont(32);
883 t->SetTextColor(1);
884 t->SetTextAlign(12);
885 t->SetTextSize(0.015);
886 t->DrawLatex(2.,99.,errore.str().c_str());
887 pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.98,pd1col);
888 pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.98,pd2col);
889 pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.49,pd3col);
890 pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.49,pd4col);
891 figura2->cd();
892 pd1->Range(0,0,100,100);
893 pd2->Range(0,0,100,100);
894 pd3->Range(0,0,100,100);
895 pd4->Range(0,0,100,100);
896 pd1->SetTicks();
897 pd2->SetTicks();
898 pd3->SetTicks();
899 pd4->SetTicks();
900 pd1->Draw();
901 pd2->Draw();
902 pd3->Draw();
903 pd4->Draw();
904 pd1->cd();
905 Baseline->SetXTitle("ADC channels");
906 Baseline->SetYTitle("Number of events");
907 Baseline->Draw();
908 h1max = Baseline->GetMaximum()*1.05;
909 Double_t xc[4] = {2000.,4500.,4500.,2000.};
910 Double_t yc[4] = {0.,0.,h1max,h1max};
911 banda1 = new TPolyLine(4,xc,yc);
912 banda1->SetLineColor(5);
913 banda1->SetFillColor(5);
914 banda1->SetLineWidth(1);
915 banda1->Draw("fSAME");
916 Baseline->Draw("SAME");
917 //
918 pd2->cd();
919 gPad->SetLogy();
920 Dexyc->SetXTitle("ADC channels");
921 Dexyc->SetYTitle("Number of events");
922 Dexyc->Draw();
923 h1max = Dexyc->GetMaximum()*2.05;
924 Double_t xe[4] = {2000.,5000.,5000.,2000.};
925 Double_t ye[4] = {0.,0.,h1max,h1max};
926 banda1 = new TPolyLine(4,xe,ye);
927 banda1->SetLineColor(5);
928 banda1->SetFillColor(5);
929 banda1->SetLineWidth(1);
930 banda1->Draw("fSAME");
931 Double_t xj[4] = {0.,40.,40.,0.};
932 Double_t yj[4] = {0.,0.,h1max,h1max};
933 banda2 = new TPolyLine(4,xj,yj);
934 banda2->SetLineColor(5);
935 banda2->SetFillColor(5);
936 banda2->SetLineWidth(1);
937 banda2->Draw("fSAME");
938 Dexyc->Draw("SAME");
939 //
940 pd3->cd();
941 Calstriphit->SetXTitle("Number of hit");
942 Calstriphit->SetYTitle("Number of events");
943 Calstriphit->Draw();
944 h1max = Calstriphit->GetMaximum()*1.05;
945 Double_t xg[4] = {0.,25.,25.,0.};
946 Double_t yg[4] = {0.,0.,h1max,h1max};
947 banda1 = new TPolyLine(4,xg,yg);
948 banda1->SetLineColor(5);
949 banda1->SetFillColor(5);
950 banda1->SetLineWidth(1);
951 banda1->Draw("fSAME");
952 Double_t xh[4] = {40.,80.,80.,40.};
953 Double_t yh[4] = {0.,0.,h1max,h1max};
954 banda2 = new TPolyLine(4,xh,yh);
955 banda2->SetLineColor(5);
956 banda2->SetFillColor(5);
957 banda2->SetLineWidth(1);
958 banda2->Draw("fSAME");
959 Calstriphit->Draw("SAME");
960 //
961 pd4->cd();
962 Dexy->SetXTitle("ADC channels");
963 Dexy->SetYTitle("Number of events");
964 Dexy->Draw();
965 h1max = Dexy->GetMaximum()*1.05;
966 Double_t xd[4] = {2000.,5000.,5000.,2000.};
967 Double_t yd[4] = {0.,0.,h1max,h1max};
968 banda1 = new TPolyLine(4,xd,yd);
969 banda1->SetLineColor(5);
970 banda1->SetFillColor(5);
971 banda1->SetLineWidth(1);
972 banda1->Draw("fSAME");
973 Dexy->Draw("SAME");
974 } else {
975 Int_t pd4col = 10;
976 if ( (outdexy+indexy) ) {
977 cdexy = (float)indexy/((float)outdexy + (float)indexy);
978 if ( cdexy < cdexythr ) {
979 check = true;
980 pd4col = 45;
981 };
982 };
983 figura2->SetFillColor(10);
984 figura2->Range(0,0,100,100);
985 errore.str("");
986 errore << "EXPERT -- File: " << file;
987 errore << " ";
988 t=new TLatex();
989 t->SetTextFont(32);
990 t->SetTextColor(1);
991 t->SetTextAlign(12);
992 t->SetTextSize(0.015);
993 t->DrawLatex(2.,99.,errore.str().c_str());
994 pd4 = new TPad("pd4","This is pad4",0.02,0.02,0.98,0.98,pd4col);
995 figura2->cd();
996 pd4->Range(0,0,100,100);
997 pd4->SetTicks();
998 pd4->Draw();
999 //
1000 pd4->cd();
1001 Dexy->SetXTitle("ADC channels");
1002 Dexy->SetYTitle("Number of events");
1003 Dexy->Draw();
1004 h1max = Dexy->GetMaximum()*1.05;
1005 Double_t xd[4] = {2000.,5000.,5000.,2000.};
1006 Double_t yd[4] = {0.,0.,h1max,h1max};
1007 banda1 = new TPolyLine(4,xd,yd);
1008 banda1->SetLineColor(5);
1009 banda1->SetFillColor(5);
1010 banda1->SetLineWidth(1);
1011 banda1->Draw("fSAME");
1012 Dexy->Draw("SAME");
1013 };
1014 //
1015 TCanvas *figura3 = 0;
1016 Bool_t printfigure3 = false;
1017 for (Int_t i = 0; i<4; i++){
1018 if ( ver[i][2] || lver[i][2] ){
1019 printfigure3 = true;
1020 break;
1021 };
1022 };
1023 if ( printfigure3 ){
1024 figura3 = new TCanvas("Calorimeter_Detector_Report_2bis/3","Calorimeter_Detector_Report_2bis/3", 1100, 900);
1025 figura3->SetFillColor(10);
1026 figura3->Range(0,0,100,100);
1027 errore.str("");
1028 errore << "EXPERT -- File: " << file;
1029 errore << " ";
1030 t=new TLatex();
1031 t->SetTextFont(32);
1032 t->SetTextColor(1);
1033 t->SetTextAlign(12);
1034 t->SetTextSize(0.015);
1035 t->DrawLatex(2.,99.,errore.str().c_str());
1036 pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.73,45);
1037 pd5 = new TPad("pd5","This is pad5",0.02,0.76,0.49,0.98,45);
1038 pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.73,45);
1039 pd6 = new TPad("pd6","This is pad6",0.51,0.76,0.98,0.98,45);
1040 pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.23,45);
1041 pd7 = new TPad("pd7","This is pad7",0.02,0.26,0.49,0.49,45);
1042 pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.23,45);
1043 pd8 = new TPad("pd8","This is pad8",0.51,0.26,0.98,0.49,45);
1044 figura3->cd();
1045 pd1->Range(0,0,100,100);
1046 pd2->Range(0,0,100,100);
1047 pd3->Range(0,0,100,100);
1048 pd4->Range(0,0,100,100);
1049 pd1->SetTicks();
1050 pd2->SetTicks();
1051 pd3->SetTicks();
1052 pd4->SetTicks();
1053 pd1->Draw();
1054 pd2->Draw();
1055 pd3->Draw();
1056 pd4->Draw();
1057 pd5->Range(0,0,100,100);
1058 pd6->Range(0,0,100,100);
1059 pd7->Range(0,0,100,100);
1060 pd8->Range(0,0,100,100);
1061 pd5->SetTicks();
1062 pd6->SetTicks();
1063 pd7->SetTicks();
1064 pd8->SetTicks();
1065 pd5->Draw();
1066 pd6->Draw();
1067 pd7->Draw();
1068 pd8->Draw();
1069 pd1->cd();
1070 lup[0]->SetAxisRange((Double_t)minobt[0]*0.9,(Double_t)maxobt[0]*1.1,"X");
1071 lup[0]->Draw();
1072 pd5->cd();
1073 lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X");
1074 lupstw[0]->Draw();
1075 pd2->cd();
1076 lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X");
1077 lup[1]->Draw();
1078 pd6->cd();
1079 lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X");
1080 lupstw[1]->Draw();
1081 pd3->cd();
1082 lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X");
1083 lup[2]->Draw();
1084 pd7->cd();
1085 lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X");
1086 lupstw[2]->Draw();
1087 pd4->cd();
1088 lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X");
1089 lup[3]->Draw();
1090 pd8->cd();
1091 lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X");
1092 lupstw[3]->Draw();
1093 };
1094 //
1095 // output figures, report sheet:
1096 //
1097 TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900);
1098 rapporto->SetFillColor(10);
1099 rapporto->Range(0,0,100,100);
1100 t=new TLatex();
1101 t->SetTextFont(32);
1102 t->SetTextColor(1);
1103 t->SetTextSize(0.05);
1104 t->SetTextAlign(12);
1105 // t->DrawLatex(33.,95.,"Calorimeter quick look: ");
1106 errore.str("");
1107 errore << "BASIC: C1 - File: " << file;
1108 errore << " ";
1109 t->SetTextSize(0.02);
1110 t->DrawLatex(2.,99.,errore.str().c_str());
1111
1112 pad1 = new TPad("pad1","This is pad1",0.02,0.47,0.49,0.90,19);
1113 pad2 = new TPad("pad2","This is pad2",0.51,0.47,0.98,0.90,19);
1114 pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.49,0.45,19);
1115 pad4 = new TPad("pad4","This is pad4",0.51,0.02,0.98,0.45,19);
1116 pad1->Range(0,0,100,100);
1117 pad2->Range(0,0,100,100);
1118 pad3->Range(0,0,100,100);
1119 pad4->Range(0,0,100,100);
1120
1121 pad1->Draw();
1122 pad2->Draw();
1123 pad3->Draw();
1124 pad4->Draw();
1125
1126 for (Int_t i = 0; i < 4; i++){
1127 if (i == 2)
1128 {
1129 pad1->cd() ;
1130 sezione = "** Section YE (x even) **";
1131 }
1132 if (i == 3)
1133 {
1134 pad2->cd();
1135 sezione = "** Section YO (x odd) **";
1136 }
1137 if (i == 0)
1138 {
1139 pad3->cd();
1140 sezione = "** Section XE (y odd) **";
1141 }
1142 if (i == 1)
1143 {
1144 pad4->cd();
1145 sezione = "** Section XO (y even) **";
1146 }
1147 t->SetTextFont(32);
1148 t->SetTextColor(1);
1149 t->SetTextSize(0.05);
1150 t->SetTextAlign(12);
1151 t->DrawLatex(33.,97.,sezione);
1152 t->SetTextSize(0.05);
1153 for (Int_t j = 0; j < 23; j++){
1154 if ( ver[i][j] || lver[i][j] ) {
1155 t->SetTextColor(50);
1156 if (j == 0) {
1157 errore.str("");
1158 errore << "* DSP ack error: " << ver[i][j];
1159 errore << " time(s)";
1160 t->DrawLatex(2.,30.,errore.str().c_str());
1161 check = true;
1162 }
1163 if (j == 1) {
1164 errore.str("");
1165 errore << "* Temperature alarm: " << ver[i][j];
1166 errore << " time(s)";
1167 t->DrawLatex(2.,74.,errore.str().c_str());
1168 check = true;
1169 }
1170 if (j == 2) {
1171 // printf("boh! lalarm[%i] = %i \n",i,lalarm[i]);
1172 if ( lalarm[i] ){
1173 errore.str("");
1174 errore << "* Latch up: " << ver[i][j];
1175 errore << " (" << lalarm[i];
1176 errore << " NOT rec!): ";
1177 t->DrawLatex(2.,70.,errore.str().c_str());
1178 check = true;
1179 } else {
1180 errore.str("");
1181 errore << "* Latch up alarm: " << ver[i][j];
1182 errore << " time(s). View(s): ";
1183 t->DrawLatex(2.,70.,errore.str().c_str());
1184 check = true;
1185 };
1186 errore.str("");
1187 errore << "(" << lver[i][j];
1188 errore << " view(s))";
1189 t->DrawLatex(27.,65.,errore.str().c_str());
1190 Float_t inc=1.;
1191 for (Int_t e = 0; e < 11; e++){
1192 if ( pshit[i][e] ) {
1193 errore.str("");
1194 errore << " " << (e+1);
1195 errore << " ";
1196 t->DrawLatex(52.+inc,69.,errore.str().c_str());
1197 Int_t numer = pshit[i][e];
1198 errore.str("");
1199 errore << " (" << numer;
1200 errore << ") ";
1201 t->SetTextAngle(-70);
1202 t->DrawLatex(55.+inc,67.,errore.str().c_str());
1203 t->SetTextAngle(0);
1204 inc += 4.;
1205 }
1206 }
1207 }
1208 if (j == 3) {
1209 errore.str("");
1210 errore << "RAW mode: " << ver[i][j];
1211 errore << " time(s)";
1212 t->SetTextColor(32);
1213 t->DrawLatex(2.,90.,errore.str().c_str());
1214 }
1215 if (j == 4) {
1216 errore.str("");
1217 errore << "* CMD length error: " << ver[i][j];
1218 errore << " time(s)";
1219 t->DrawLatex(2.,66.,errore.str().c_str());
1220 check = true;
1221 }
1222 if (j == 5) {
1223 errore.str("");
1224 errore << "* Execution error: " << ver[i][j];
1225 errore << " time(s)";
1226 t->DrawLatex(2.,62.,errore.str().c_str());
1227 check = true;
1228 }
1229 if (j == 6) {
1230 errore.str("");
1231 errore << "* CRC error (st. word): " << ver[i][j];
1232 errore << " time(s)";
1233 t->DrawLatex(2.,58.,errore.str().c_str());
1234 check = true;
1235 }
1236 if (j == 7) {
1237 errore.str("");
1238 errore << "View or command not recognized: " << ver[i][j];
1239 errore << " time(s)";
1240 t->DrawLatex(2.,54.,errore.str().c_str());
1241 check = true;
1242 }
1243 if (j == 8) {
1244 errore.str("");
1245 errore << "Missing section: " << ver[i][j];
1246 errore << " time(s)";
1247 t->DrawLatex(2.,50.,errore.str().c_str());
1248 check = true;
1249 }
1250 if (j == 10) {
1251 errore.str("");
1252 errore << "Calevnum jump: " << ver[i][j];
1253 errore << " time(s)";
1254 t->DrawLatex(2.,42.,errore.str().c_str());
1255 check = true;
1256 }
1257 if (j == 11) {
1258 errore.str("");
1259 errore << "CRC error (data): " << ver[i][j];
1260 errore << " time(s)";
1261 t->DrawLatex(2.,38.,errore.str().c_str());
1262 check = true;
1263 }
1264 if (j == 12) {
1265 errore.str("");
1266 errore << "Length problems in RAW mode: " << ver[i][j];
1267 errore << " time(s)";
1268 t->DrawLatex(2.,34.,errore.str().c_str());
1269 check = true;
1270 }
1271 if (j == 13) {
1272 errore.str("");
1273 errore << "Length problems in COMPRESS mode: " << ver[i][j];
1274 errore << " time(s)";
1275 t->DrawLatex(2.,34.,errore.str().c_str());
1276 check = true;
1277 }
1278 if (j == 14) {
1279 errore.str("");
1280 errore << "Length problems in FULL mode: " << ver[i][j];
1281 errore << " time(s)";
1282 t->DrawLatex(2.,26.,errore.str().c_str());
1283 check = true;
1284 }
1285 if (j == 15) {
1286 errore.str("");
1287 errore << "Acquisition mode problems: " << ver[i][j];
1288 errore << " time(s)";
1289 t->DrawLatex(2.,22.,errore.str().c_str());
1290 check = true;
1291 }
1292 if (j == 16) {
1293 errore.str("");
1294 errore << "COMPRESS mode: " << ver[i][j];
1295 errore << " time(s)";
1296 t->SetTextColor(32);
1297 t->DrawLatex(2.,86.,errore.str().c_str());
1298 }
1299 if (j == 17) {
1300 errore.str("");
1301 errore << "FULL mode: " << ver[i][j];
1302 errore << " time(s)";
1303 t->SetTextColor(32);
1304 t->DrawLatex(2.,82.,errore.str().c_str());
1305 }
1306 if (j == 18) {
1307 errore.str("");
1308 errore << "Problems with coding: " << ver[i][j];
1309 errore << " time(s)";
1310 t->DrawLatex(2.,18.,errore.str().c_str());
1311 check = true;
1312 }
1313 if (j == 19) {
1314 errore.str("");
1315 errore << "Pedestal checksum wrong: " << ver[i][j];
1316 errore << " time(s)";
1317 t->DrawLatex(2.,14.,errore.str().c_str());
1318 check = true;
1319 }
1320 if (j == 20) {
1321 errore.str("");
1322 errore << "Thresholds checksum wrong: " << ver[i][j];
1323 errore << " time(s)";
1324 t->DrawLatex(2.,10.,errore.str().c_str());
1325 check = true;
1326 }
1327 if (j == 21) {
1328 errore.str("");
1329 errore << "WARNING! DEXYC < 0: " << ver[i][j];
1330 errore << " time(s)";
1331 t->DrawLatex(2.,6.,errore.str().c_str());
1332 check = true;
1333 }
1334 if (j == 22) {
1335 errore.str("");
1336 errore << "Packet length is zero (YODA input error), skipped: " << ver[i][j];
1337 errore << " time(s)";
1338 t->DrawLatex(2.,3.,errore.str().c_str());
1339 check = true;
1340 };
1341 };
1342 };
1343 t->SetTextColor(50);
1344 if ( fulldiff[i] !=0 ) {
1345 check = true;
1346 errore.str("");
1347 errore << "Full mode, differences between RAW and COMPRESS mode: " << fulldiff[i];
1348 errore << " time(s)";
1349 t->DrawLatex(2.,46.,errore.str().c_str());
1350 };
1351 if ( cpre[i] !=0 ) {
1352 errore.str("");
1353 errore << "Preamplifier fully transmitted: " << cpre[i];
1354 errore << " time(s)";
1355 t->SetTextColor(32);
1356 t->DrawLatex(2.,78.,errore.str().c_str());
1357 };
1358 };
1359 rapporto->cd();
1360 t->SetTextFont(32);
1361 t->SetTextColor(1);
1362 t->SetTextSize(0.05);
1363 t->SetTextAlign(12);
1364 t->DrawLatex(22.,95.,"Calorimeter quick look: ");
1365 //printf("check %i \n",check);
1366 if ( check ){
1367 t->SetTextColor(50);
1368 t->DrawLatex(60.,95.," WARNING, CHECK! ");
1369 printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase);
1370 } else {
1371 t->SetTextColor(32);
1372 t->DrawLatex(60.,95.," OK! ");
1373 };
1374 //
1375 // const string fil = (const char*)filename;
1376 // Int_t posiz = fil.find("dw_");
1377 // if ( posiz == -1 ) posiz = fil.find("DW_");
1378 // Int_t posiz2 = posiz+13;
1379 // TString file2;
1380 // stringcopy(file2,filename,posiz,posiz2);
1381 //
1382 const string fil = gSystem->BaseName(filename.Data());
1383 Int_t posiz = fil.find(".root");
1384 //
1385 TString file2;
1386 if ( posiz == -1 ){
1387 file2 = gSystem->BaseName(filename.Data());
1388 } else {
1389 Int_t posiz2 = 0;
1390 stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz);
1391 };
1392 const char *figrec = file2;
1393 //
1394 const char *outdir = outDir;
1395 stringstream figsave;
1396 stringstream figsave1;
1397 stringstream figsave2;
1398 const char *format = saveas;
1399 if ( !strcmp(format,"ps") ) {
1400 figsave.str("");
1401 figsave << outdir << "/" ;
1402 figsave << figrec << "_CaloQLOOK.";
1403 figsave << format << "(";
1404 rapporto->Print(figsave.str().c_str(),"Landscape");
1405 figsave1.str("");
1406 figsave1 << outdir << "/" ;
1407 figsave1 << figrec << "_CaloQLOOK.";
1408 figsave1 << format;
1409 figura->Print(figsave1.str().c_str(),"Landscape");
1410 figsave2.str("");
1411 figsave2 << outdir << "/" ;
1412 figsave2 << figrec << "_CaloQLOOK.";
1413 if ( printfigure3 ){
1414 figsave2 << format;
1415 figura2->Print(figsave2.str().c_str(),"Landscape");
1416 figsave2.str("");
1417 figsave2 << outdir << "/" ;
1418 figsave2 << figrec << "_CaloQLOOK.";
1419 figsave2 << format << ")";
1420 figura3->Print(figsave2.str().c_str(),"Landscape");
1421 } else {
1422 figsave2 << format << ")";;
1423 figura2->Print(figsave2.str().c_str(),"Landscape");
1424 };
1425 } else {
1426 figsave.str("");
1427 figsave << outdir << "/" ;
1428 figsave << figrec << "_CaloQLOOK1.";
1429 figsave << format;
1430 figura->SaveAs(figsave.str().c_str());
1431 figsave.str("");
1432 figsave << outdir << "/" ;
1433 figsave << figrec << "_CaloQLOOK2.";
1434 figsave << format;
1435 figura2->SaveAs(figsave.str().c_str());
1436 if ( printfigure3 ){
1437 figsave.str("");
1438 figsave << outdir << "/" ;
1439 figsave << figrec << "_CaloQLOOK2bis.";
1440 figsave << format;
1441 figura3->SaveAs(figsave.str().c_str());
1442 };
1443 figsave.str("");
1444 figsave << outdir << "/" ;
1445 figsave << figrec << "_CaloQLOOK3.";
1446 figsave << format;
1447 rapporto->SaveAs(figsave.str().c_str());
1448 };
1449 }
1450

  ViewVC Help
Powered by ViewVC 1.1.23