/[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.10 - (hide annotations) (download)
Mon May 29 12:08:13 2006 UTC (18 years, 6 months ago) by mocchiut
Branch: MAIN
Changes since 1.9: +31 -8 lines
Small adjustement in the latchup figures

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

  ViewVC Help
Powered by ViewVC 1.1.23