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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Mon Jul 17 08:51:11 2006 UTC (18 years, 4 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r11
Changes since 1.11: +68 -47 lines
Adapted to flight conditions

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

  ViewVC Help
Powered by ViewVC 1.1.23