/[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.18 - (show annotations) (download)
Fri Sep 29 06:22:43 2006 UTC (18 years, 2 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r18
Changes since 1.17: +5 -2 lines
Tuning of warning parameter

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

  ViewVC Help
Powered by ViewVC 1.1.23