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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations) (download)
Fri Aug 4 15:24:01 2006 UTC (18 years, 4 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r13
Changes since 1.13: +10 -1 lines
Bug fixed in CHKCALIB + new features added

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

  ViewVC Help
Powered by ViewVC 1.1.23