/[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.15 - (show annotations) (download)
Fri Sep 22 13:38:58 2006 UTC (18 years, 2 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r15
Changes since 1.14: +165 -46 lines
Create also a txt file, some bugs fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23