/[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.11 - (hide annotations) (download)
Mon May 29 13:15:49 2006 UTC (18 years, 6 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r10, v1r09
Changes since 1.10: +25 -10 lines
Small bug in the latchup warning fixed

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.11 // FCaloQLOOK.c version 1.09 (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.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.
11 mocchiut 1.9 //
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 mocchiut 1.11 Int_t planebases=0;
285     // Int_t stri=0;
286 mocchiut 1.1 Int_t fcheck = 0;
287     Int_t cestw=0;
288     Int_t cmask = 127 ;
289     compdata = 0;
290     rawdata = 0;
291     errorfull = 0;
292     calevn1 = 0;
293     calevn2 = 0;
294     calevn3 = 0;
295     calevn4 = 0;
296     fulldiff[0] = 0;
297     fulldiff[1] = 0;
298     fulldiff[2] = 0;
299     fulldiff[3] = 0;
300     printf("\n Processed events: \n\n");
301     unsigned short int calev0=0;
302     unsigned short int oldcalev0;
303     unsigned short int calev1=0;
304     unsigned short int oldcalev1;
305     unsigned short int calevv2=0;
306     unsigned short int oldcalev2;
307     unsigned short int calev3=0;
308     unsigned short int oldcalev3;
309     Int_t i = minevent;
310     Float_t headc = 0.;
311     Float_t headco = 0.;
312     Bool_t h1rcheck = false;
313     Int_t intshit = 0;
314     Int_t outtshit = 0;
315     Int_t incshit = 0;
316     Int_t outcshit = 0;
317     Int_t inbase = 0;
318     Int_t outbase = 0;
319     Int_t indexy = 0;
320     Int_t outdexy = 0;
321     Int_t indexyc = 0;
322     Int_t outdexyc = 0;
323 mocchiut 1.8 Int_t obt = 0;
324     Int_t minobt[4];
325     Int_t maxobt[4];
326     Int_t swminobt[4];
327     Int_t swmaxobt[4];
328     Bool_t firstobt[4];
329     Bool_t swfirstobt[4];
330     for ( Int_t i = 0; i<4; i++){
331     minobt[i] = 0;
332     maxobt[i] = 0;
333     swminobt[i] = 0;
334     swmaxobt[i] = 0;
335     firstobt[i] = true;
336     swfirstobt[i] = true;
337     };
338 mocchiut 1.1 while ( i < maxevent+1){
339     tshit = 0;
340     trshit = 0;
341     tr->GetEntry(i);
342     iev2[i] = ce->iev;
343     //
344     ph = eh->GetPscuHeader();
345     headco = headc;
346     headc = ph->GetCounter();
347 mocchiut 1.8 obt = ph->GetOrbitalTime();
348 mocchiut 1.1 calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1]));
349     calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3]));
350     calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3]));
351     calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1])));
352     calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3])));
353     calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3])));
354     unsigned short calvnm2 = (unsigned short)ce->calevnum[2];
355     calev2->Fill(ce->iev,calvnm2);
356     calevn4 += (int)ce->calevnum[2];
357     oldcalev0 = calev0;
358     calev0 = (int)ce->calevnum[0];
359     oldcalev1 = calev1;
360     calev1 = (int)ce->calevnum[1];
361     oldcalev2 = calevv2;
362     calevv2 = (int)ce->calevnum[2];
363     oldcalev3 = calev3;
364     calev3 = (int)ce->calevnum[3];
365     goto jumpprintout;
366     if ( (headc - headco -1.) == 0. && ((calev0 - oldcalev0 - 1) > 0 || (calev1 - oldcalev1 - 1) > 0 || (calevv2 - oldcalev2 - 1) > 0 || (calev3 - oldcalev3 - 1) > 0) ){
367     if ( i != minevent ) {
368     printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0);
369     printf(" %f 0 Event %i: %i\n",headc,i+1,calev0);
370     printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1);
371     printf(" %f 1 Event %i: %i\n",headc,i+1,calev1);
372     printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2);
373     printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2);
374     printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3);
375     printf(" %f 3 Event %i: %i\n",headc,i+1,calev3);
376     isRAW = 0;
377     if ( ce->stwerr[0] & (1 << 3)) isRAW = 1;
378     if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) {
379     ver[0][10]++;
380     };
381     isRAW = 0;
382     if ( ce->stwerr[0] & (1 << 3)) isRAW = 1;
383     if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){
384     ver[1][10]++;
385     };
386     isRAW = 0;
387     if ( ce->stwerr[0] & (1 << 3)) isRAW = 1;
388     if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){
389     ver[2][10]++;
390     };
391     isRAW = 0;
392     if ( ce->stwerr[0] & (1 << 3)) isRAW = 1;
393     if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){
394     ver[3][10]++;
395     };
396     }
397     };
398     jumpprintout:
399     memcpy(shit, nullsh, sizeof(nullsh));
400     memcpy(rshit, nullsh, sizeof(nullsh));
401     for (Int_t l = 0; l < 2; l++ ){
402     for (Int_t ii = 0; ii < 22; ii++){
403     if (l == 0 && ii%2 == 0){
404     se = 3;
405     pl = ii/2;
406     pdone = 0;
407     };
408     if (l == 0 && ii%2 != 0){
409     se = 2;
410     pl = (ii-1)/2;
411     pdone = 0;
412     };
413     if (l == 1 && ii%2 == 0){
414     se = 0;
415     pl = ii/2;
416     pdone = 0;
417     };
418     if (l == 1 && ii%2 != 0){
419     se = 1;
420     pl = (ii-1)/2;
421     pdone = 0;
422     };
423    
424     isCOMP = 0;
425     isFULL = 0;
426     isRAW = 0;
427     if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1;
428     if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1;
429     if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1;
430     bl = -1;
431     for (Int_t kk = 0; kk < 96 ; kk++ ){
432     if ( kk%16 == 0 ){
433     bdone = 0;
434     bl++;
435     allbase = ce->base[l][ii][bl];
436 mocchiut 1.11 // alldexy=0;
437     // alldexy2=0;
438     // stri=0;
439     // for (Int_t e = 0; e < 16 ; e++ ){
440     // stri = e + 16 * bl;
441     // alldexy += (int)ce->dexyc[l][ii][stri];
442     // alldexy2 += (int)ce->dexy[l][ii][stri];
443     // };
444     };
445     //
446     if ( kk == 0 ){
447     planebases = 0;
448 mocchiut 1.1 alldexy=0;
449     alldexy2=0;
450 mocchiut 1.11 for (Int_t e = 0; e < 96 ; e++ ){
451     if ( e < 6 ) planebases += (int)ce->base[l][ii][e];
452     alldexy += (int)ce->dexyc[l][ii][e];
453     alldexy2 += (int)ce->dexy[l][ii][e];
454 mocchiut 1.1 };
455     };
456 mocchiut 1.11 //
457 mocchiut 1.1 if ( !isRAW ) {
458     //
459     if ( !pdone ){
460 mocchiut 1.11 // if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) {
461     if ( (planebases>192000 || planebases == 0 ) && ( alldexy > 3072000 || alldexy == 0) && ce->perror[se] == 0 ) {
462 mocchiut 1.1 pdone = 1;
463     pshit[se][pl]++ ;
464 mocchiut 1.8 if ( (ce->stwerr[se] & (1 << 4)) == 0 ) {
465     lalarm[se]++;
466     lup[se]->Fill(obt);
467     if ( firstobt[se] ) minobt[se] = obt;
468     if ( obt > maxobt[se] ) maxobt[se] = obt;
469     };
470     lver[se][2]++ ;
471 mocchiut 1.1 };
472     }
473     //
474     if ( !bdone ){
475     Baseline->Fill(ce->base[l][ii][bl]);
476     if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 4500. ){
477     inbase++;
478     } else {
479     outbase++;
480     };
481     bdone = 1;
482     };
483     //
484     if (ce->dexyc[l][ii][kk] > 0 ) {
485     shit[se][pl]++ ;
486     compdata = 1;
487     };
488     //
489     if ( isFULL ) {
490     if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) {
491     rshit[se][pl]++ ;
492     rawdata = 1;
493     };
494     Dexy->Fill(ce->dexy[l][ii][kk]);
495     if ( ce->dexy[l][ii][kk] < 2000. || ce->dexy[l][ii][kk] > 5000. ) {
496     outdexy++;
497     } else {
498     indexy++;
499     };
500     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) ){
501     hdiff->Fill(ce->dexyc[l][ii][kk]-ce->dexy[l][ii][kk]);
502     fulldiff[se]++;
503     errorfull = 1;
504     };
505     };
506     //
507     Dexyc->Fill(ce->dexyc[l][ii][kk]);
508     if ( ce->dexyc[l][ii][kk] != 0. && ( ce->dexyc[l][ii][kk] < 2000. || ce->dexyc[l][ii][kk] > 5000. ) ) {
509     outdexyc++;
510     } else {
511     indexyc++;
512     };
513     //
514     if (ce->dexyc[l][ii][kk] < 0 ) ver[se][21]++ ;
515     //
516     if ( allbase == 0. || allbase > 32000.) {
517     fcheck = 0;
518     for (Int_t nn = bl*16; nn < (bl+1)*16 ; nn++){
519     if ( ce->dexyc[l][ii][nn] > 0. && ce->dexyc[l][ii][nn] < 32000. ) fcheck++;
520     };
521     if ( fcheck ) {
522     cpre[se]++;
523     allbase = 1.;
524     };
525     };
526     //
527     } else {
528     if ( !pdone ){
529 mocchiut 1.11 if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) {
530     // if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) {
531 mocchiut 1.1 pdone = 1;
532     pshit[se][pl]++ ;
533 mocchiut 1.8 if ( (ce->stwerr[se] & (1 << 4)) == 0 ){
534     lalarm[se]++;
535     lup[se]->Fill(obt);
536     if ( firstobt[se] ) minobt[se] = obt;
537     if ( obt > maxobt[se] ) maxobt[se] = obt;
538     };
539 mocchiut 1.1 lver[se][2]++ ;
540     };
541     };
542     if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) {
543     rshit[se][pl]++ ;
544     rawdata = 1;
545     };
546     Dexy->Fill(ce->dexy[l][ii][kk]);
547     if ( ce->dexy[l][ii][kk] < 2000. || ce->dexy[l][ii][kk] > 5000. ) {
548     outdexy++;
549     } else {
550     indexy++;
551     };
552     };
553     };
554     };
555     };
556     cshit = 0;
557     for (Int_t k = 0; k < 4 ; k++ ){
558     isCOMP = 0;
559     isFULL = 0;
560     if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1;
561     if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1;
562     if ( isCOMP ) ver[k][16]++;
563     if ( isFULL ) ver[k][17]++;
564     cshit += (int)ce->calstriphit[k];
565     cestw=0;
566     if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ;
567     if ( cestw ){
568     if ( cestw & (1 << 0) ) ver[k][6]++ ;
569     if ( cestw & (1 << 1) ) ver[k][5]++ ;
570     if ( cestw & (1 << 2) ) ver[k][4]++ ;
571     if ( cestw & (1 << 3) ) ver[k][3]++ ;
572 mocchiut 1.8 if ( cestw & (1 << 4) ){
573     ver[k][2]++ ;
574     lupstw[k]->Fill(obt);
575     if ( swfirstobt[k] ) swminobt[k] = obt;
576     if ( obt > swmaxobt[k] ) swmaxobt[k] = obt;
577     };
578 mocchiut 1.1 if ( cestw & (1 << 5) ) ver[k][1]++ ;
579     if ( cestw & (1 << 6) ) ver[k][0]++ ;
580     };
581     if ( ce->perror[k] != 0. ){
582     if (ce->perror[k] == 128) ver[k][7]++ ;
583     if (ce->perror[k] == 129) ver[k][8]++ ;
584     if (ce->perror[k] == 132) ver[k][11]++ ;
585     if (ce->perror[k] == 133) ver[k][12]++ ;
586     if (ce->perror[k] == 134) ver[k][13]++ ;
587     if (ce->perror[k] == 135) ver[k][14]++ ;
588     if (ce->perror[k] == 136) ver[k][15]++ ;
589     if (ce->perror[k] == 139) ver[k][18]++ ;
590     if (ce->perror[k] == 140) ver[k][19]++ ;
591     if (ce->perror[k] == 141) ver[k][20]++ ;
592     if (ce->perror[k] == 142) ver[k][22]++ ;
593     };
594     for (Int_t kk = 0; kk < 11 ; kk++ ){
595     tshit += shit[k][kk];
596     trshit += rshit[k][kk];
597     };
598     };
599     Calstriphit->Fill(cshit);
600     if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){
601     incshit++;
602     } else {
603     outcshit++;
604     };
605     if ( tshit>0 ) h1->Fill(tshit);
606     if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){
607     intshit++;
608     } else {
609     outtshit++;
610     };
611     if ( trshit>0 ) {
612     h1r->Fill(trshit);
613     if ( trshit < 4210 ){
614     h1rcheck = true;
615     // printf("ma come... trshit %i \n",trshit);
616     };
617     };
618     if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000);
619     i++;
620     };
621     printf("\n");
622    
623     //
624     // output figures, first sheet:
625     //
626     gStyle->SetOptDate(0);
627     gStyle->SetOptStat(1111);
628     TCanvas *figura = new TCanvas("Calorimeter_Detector_Report_1/3", "Calorimeter_Detector_Report_1/3", 1100, 900);
629     figura->SetFillColor(10);
630     figura->Range(0,0,100,100);
631     errore.str("");
632     errore << "EXPERT -- File: " << file;
633     errore << " ";
634     TLatex *t=new TLatex();
635     t->SetTextFont(32);
636     t->SetTextColor(1);
637     t->SetTextAlign(12);
638     t->SetTextSize(0.015);
639     t->DrawLatex(2.,99.,errore.str().c_str());
640     TPad *pd5;
641     TPad *pd6;
642 mocchiut 1.8 TPad *pd7;
643     TPad *pd8;
644 mocchiut 1.1 TPad *pad1;
645     TPad *pad2;
646     TPad *pad3;
647     TPad *pad4;
648     TPad *pd1;
649     TPad *pd2;
650     TPad *pd3;
651     TPad *pd4;
652     //
653     Double_t h1max;
654     TPolyLine *banda1;
655     TPolyLine *banda2;
656     Float_t ctshit = 0;
657     Float_t ccshit = 0;
658     Float_t cbase = 0;
659     Float_t cdexy = 0;
660     Float_t cdexyc = 0;
661     //
662     if ( compdata && rawdata ){
663     ctshit = (float)intshit/((float)outtshit + (float)intshit);
664     Int_t pd5col = 10;
665     Int_t pd6col = 10;
666     if ( ctshit < ctshitthr ) {
667     check = true;
668     pd5col = 45;
669     };
670     if ( h1rcheck ) {
671     check = true;
672     pd6col = 45;
673     };
674     pd5 = new TPad("pd5","This is pad5",0.51,0.51,0.98,0.98,pd5col);
675     pd6 = new TPad("pd6","This is pad6",0.51,0.02,0.98,0.49,pd6col);
676     pd5->SetTicks();
677     pd6->SetTicks();
678     pd5->Range(0,0,100,100);
679     pd6->Range(0,0,100,100);
680     figura->cd();
681     pd5->Draw();
682     pd5->cd();
683     h1->SetXTitle("Number of hit (dexyc>0)");
684     h1->SetYTitle("Number of events");
685     h1->Draw();
686     //
687     h1max = h1->GetMaximum()*1.05;
688     Double_t xc[4] = {0.,25.,25.,0.};
689     Double_t yc[4] = {0.,0.,h1max,h1max};
690     banda1 = new TPolyLine(4,xc,yc);
691     banda1->SetLineColor(5);
692     banda1->SetFillColor(5);
693     banda1->SetLineWidth(1);
694     banda1->Draw("fSAME");
695     Double_t xd[4] = {40.,80.,80.,40.};
696     Double_t yd[4] = {0.,0.,h1max,h1max};
697     banda2 = new TPolyLine(4,xd,yd);
698     banda2->SetLineColor(5);
699     banda2->SetFillColor(5);
700     banda2->SetLineWidth(1);
701     banda2->Draw("fSAME");
702     h1->Draw("SAME");
703     //
704     figura->cd();
705     pd6->Draw();
706     pd6->cd();
707     gPad->SetLogy();
708     h1r->SetXTitle("Number of hit (dexy>0)");
709     h1r->SetYTitle("Number of events");
710     h1r->Draw();
711     h1max = h1r->GetMaximum()*2.05;
712     Double_t xg[4] = {4220.,4230.,4230.,4220.};
713     Double_t yg[4] = {0.,0.,h1max,h1max};
714     banda1 = new TPolyLine(4,xg,yg);
715     banda1->SetLineColor(5);
716     banda1->SetFillColor(5);
717     banda1->SetLineWidth(1);
718     banda1->Draw("fSAME");
719     h1r->Draw("SAME");
720     };
721     if ( (compdata && !rawdata) || (!compdata && rawdata) ){
722     if ( tshit !=0 ) {
723     ctshit = (float)intshit/((float)outtshit + (float)intshit);
724     Int_t pd5col = 10;
725     if ( ctshit < ctshitthr ) {
726     check = true;
727     pd5col = 45;
728     };
729     pd5 = new TPad("pd5","This is pad5",0.51,0.02,0.98,0.98,pd5col);
730     pd5->Range(0,0,100,100);
731     pd5->SetTicks();
732     pd5->Draw();
733     pd5->cd();
734     h1->SetXTitle("Number of hit (dexyc>0)");
735     h1->SetYTitle("Number of events");
736     h1->Draw();
737     h1max = h1->GetMaximum()*1.05;
738     Double_t xe[4] = {0.,25.,25.,0.};
739     Double_t ye[4] = {0.,0.,h1max,h1max};
740     banda1 = new TPolyLine(4,xe,ye);
741     banda1->SetLineColor(5);
742     banda1->SetFillColor(5);
743     banda1->SetLineWidth(1);
744     banda1->Draw("fSAME");
745     Double_t xf[4] = {40.,80.,80.,40.};
746     Double_t yf[4] = {0.,0.,h1max,h1max};
747     banda2 = new TPolyLine(4,xf,yf);
748     banda2->SetLineColor(5);
749     banda2->SetFillColor(5);
750     banda2->SetLineWidth(1);
751     banda2->Draw("fSAME");
752     h1->Draw("SAME");
753     };
754     if ( trshit !=0 ) {
755     Int_t pd5col = 10;
756     if ( h1rcheck ) {
757     check = true;
758     pd5col = 45;
759     };
760     pd5 = new TPad("pd5","This is pad5",0.51,0.02,0.98,0.98,pd5col);
761     pd5->Range(0,0,100,100);
762     pd5->SetTicks();
763     pd5->Draw();
764     pd5->cd();
765     gPad->SetLogy();
766     h1r->SetXTitle("Number of hit (dexyc>0 or dexy>0)");
767     h1r->SetYTitle("Number of events");
768     h1r->Draw();
769     h1max = h1r->GetMaximum()*2.05;
770     Double_t xh[4] = {4220.,4230.,4230.,4220.};
771     Double_t yh[4] = {0.,0.,h1max,h1max};
772     banda1 = new TPolyLine(4,xh,yh);
773     banda1->SetLineColor(5);
774     banda1->SetFillColor(5);
775     banda1->SetLineWidth(1);
776     banda1->Draw("fSAME");
777     h1r->Draw("SAME");
778     };
779     };
780     if ( !errorfull ) {
781     if ( calevn1 || calevn2 || calevn3 ) {
782     pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45);
783     pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45);
784     pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45);
785     pd4 = new TPad("pd4","This is pad4",0.26,0.02,0.49,0.49,45);
786     figura->cd();
787     // printf("ou2! \n");
788     check = true;
789     pd1->Range(0,0,100,100);
790     pd2->Range(0,0,100,100);
791     pd3->Range(0,0,100,100);
792     pd4->Range(0,0,100,100);
793     pd1->Draw();
794     pd2->Draw();
795     pd3->Draw();
796     pd4->Draw();
797    
798     pd1->cd();
799     gPad->SetLogy();
800     calev01->SetXTitle("delta calevnum 1-2");
801     calev01->SetYTitle("Number of events");
802     calev01->Draw();
803    
804     pd2->cd();
805     gPad->SetLogy();
806     calev23->SetXTitle("delta calevnum 3-4");
807     calev23->SetYTitle("Number of events");
808     calev23->Draw();
809    
810     pd3->cd();
811     gPad->SetLogy();
812     calev03->SetXTitle("delta calevnum 1-4");
813     calev03->SetYTitle("Number of events");
814     calev03->Draw();
815    
816     pd4->cd();
817     calev2->SetYTitle("calevnum 2");
818     calev2->SetXTitle("iev");
819     calev2->Draw();
820     } else {
821     if ( calevn4 ) {
822     pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.98,10);
823     figura->cd();
824     pd3->Range(0,0,100,100);
825     pd3->Draw();
826     pd3->cd();
827     calev2->SetYTitle("calevnum 2");
828     calev2->SetXTitle("iev");
829     calev2->Draw();
830     } else {
831     figura->cd();
832     t=new TLatex();
833     t->SetTextFont(32);
834     t->SetTextColor(1);
835     t->SetTextSize(0.04);
836     t->SetTextAlign(12);
837     t->DrawLatex(10.,49.,"No calevnum infos from DSP");
838     };
839     };
840     } else {
841     figura->cd();
842     check = true;
843     // printf("nou! \n");
844     pd1 = new TPad("pd1","This is pad1",0.02,0.02,0.49,0.98,45);
845     pd1->Range(0,0,100,100);
846     pd1->Draw();
847     pd1->cd();
848     gPad->SetLogy();
849     hdiff->SetXTitle("Differences in FULL mode");
850     hdiff->SetYTitle("Number of events");
851     hdiff->Draw();
852     };
853    
854     //
855     // output figures, second sheet:
856     //
857     TCanvas *figura2 = new TCanvas("Calorimeter_Detector_Report_2/3","Calorimeter_Detector_Report_2/3", 1100, 900);
858     if ( compdata ){
859     Int_t pd1col = 10;
860     Int_t pd2col = 10;
861     Int_t pd3col = 10;
862     Int_t pd4col = 10;
863     if ( (outdexy+indexy) ) {
864     cdexy = (float)indexy/((float)outdexy + (float)indexy);
865     if ( cdexy < cdexythr ) {
866     check = true;
867     pd4col = 45;
868     };
869     };
870     if ( (outcshit+incshit) ) {
871     ccshit = (float)incshit/((float)outcshit + (float)incshit);
872     if ( ccshit < ctshitthr ) {
873     check = true;
874     pd3col = 45;
875     };
876     };
877     if ( (outdexyc+indexyc) ) {
878     cdexyc = (float)indexyc/((float)outdexyc + (float)indexyc);
879     if ( cdexyc < cdexycthr ) {
880     check = true;
881     pd2col = 45;
882     };
883     };
884     if ( (outbase+inbase) ) {
885     cbase = (float)inbase/((float)outbase + (float)inbase);
886     if ( cbase < cbasethr ) {
887     check = true;
888     pd1col = 45;
889     };
890     };
891     figura2->SetFillColor(10);
892     figura2->Range(0,0,100,100);
893     errore.str("");
894     errore << "EXPERT -- File: " << file;
895     errore << " ";
896     t=new TLatex();
897     t->SetTextFont(32);
898     t->SetTextColor(1);
899     t->SetTextAlign(12);
900     t->SetTextSize(0.015);
901     t->DrawLatex(2.,99.,errore.str().c_str());
902     pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.98,pd1col);
903     pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.98,pd2col);
904     pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.49,pd3col);
905     pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.49,pd4col);
906     figura2->cd();
907     pd1->Range(0,0,100,100);
908     pd2->Range(0,0,100,100);
909     pd3->Range(0,0,100,100);
910     pd4->Range(0,0,100,100);
911     pd1->SetTicks();
912     pd2->SetTicks();
913     pd3->SetTicks();
914     pd4->SetTicks();
915     pd1->Draw();
916     pd2->Draw();
917     pd3->Draw();
918     pd4->Draw();
919     pd1->cd();
920     Baseline->SetXTitle("ADC channels");
921     Baseline->SetYTitle("Number of events");
922     Baseline->Draw();
923     h1max = Baseline->GetMaximum()*1.05;
924     Double_t xc[4] = {2000.,4500.,4500.,2000.};
925     Double_t yc[4] = {0.,0.,h1max,h1max};
926     banda1 = new TPolyLine(4,xc,yc);
927     banda1->SetLineColor(5);
928     banda1->SetFillColor(5);
929     banda1->SetLineWidth(1);
930     banda1->Draw("fSAME");
931     Baseline->Draw("SAME");
932     //
933     pd2->cd();
934     gPad->SetLogy();
935     Dexyc->SetXTitle("ADC channels");
936     Dexyc->SetYTitle("Number of events");
937     Dexyc->Draw();
938     h1max = Dexyc->GetMaximum()*2.05;
939     Double_t xe[4] = {2000.,5000.,5000.,2000.};
940     Double_t ye[4] = {0.,0.,h1max,h1max};
941     banda1 = new TPolyLine(4,xe,ye);
942     banda1->SetLineColor(5);
943     banda1->SetFillColor(5);
944     banda1->SetLineWidth(1);
945     banda1->Draw("fSAME");
946     Double_t xj[4] = {0.,40.,40.,0.};
947     Double_t yj[4] = {0.,0.,h1max,h1max};
948     banda2 = new TPolyLine(4,xj,yj);
949     banda2->SetLineColor(5);
950     banda2->SetFillColor(5);
951     banda2->SetLineWidth(1);
952     banda2->Draw("fSAME");
953     Dexyc->Draw("SAME");
954     //
955     pd3->cd();
956     Calstriphit->SetXTitle("Number of hit");
957     Calstriphit->SetYTitle("Number of events");
958     Calstriphit->Draw();
959     h1max = Calstriphit->GetMaximum()*1.05;
960     Double_t xg[4] = {0.,25.,25.,0.};
961     Double_t yg[4] = {0.,0.,h1max,h1max};
962     banda1 = new TPolyLine(4,xg,yg);
963     banda1->SetLineColor(5);
964     banda1->SetFillColor(5);
965     banda1->SetLineWidth(1);
966     banda1->Draw("fSAME");
967     Double_t xh[4] = {40.,80.,80.,40.};
968     Double_t yh[4] = {0.,0.,h1max,h1max};
969     banda2 = new TPolyLine(4,xh,yh);
970     banda2->SetLineColor(5);
971     banda2->SetFillColor(5);
972     banda2->SetLineWidth(1);
973     banda2->Draw("fSAME");
974     Calstriphit->Draw("SAME");
975     //
976     pd4->cd();
977     Dexy->SetXTitle("ADC channels");
978     Dexy->SetYTitle("Number of events");
979     Dexy->Draw();
980     h1max = Dexy->GetMaximum()*1.05;
981     Double_t xd[4] = {2000.,5000.,5000.,2000.};
982     Double_t yd[4] = {0.,0.,h1max,h1max};
983     banda1 = new TPolyLine(4,xd,yd);
984     banda1->SetLineColor(5);
985     banda1->SetFillColor(5);
986     banda1->SetLineWidth(1);
987     banda1->Draw("fSAME");
988     Dexy->Draw("SAME");
989     } else {
990     Int_t pd4col = 10;
991     if ( (outdexy+indexy) ) {
992     cdexy = (float)indexy/((float)outdexy + (float)indexy);
993     if ( cdexy < cdexythr ) {
994     check = true;
995     pd4col = 45;
996     };
997     };
998     figura2->SetFillColor(10);
999     figura2->Range(0,0,100,100);
1000     errore.str("");
1001     errore << "EXPERT -- File: " << file;
1002     errore << " ";
1003     t=new TLatex();
1004     t->SetTextFont(32);
1005     t->SetTextColor(1);
1006     t->SetTextAlign(12);
1007     t->SetTextSize(0.015);
1008     t->DrawLatex(2.,99.,errore.str().c_str());
1009     pd4 = new TPad("pd4","This is pad4",0.02,0.02,0.98,0.98,pd4col);
1010     figura2->cd();
1011     pd4->Range(0,0,100,100);
1012     pd4->SetTicks();
1013     pd4->Draw();
1014     //
1015     pd4->cd();
1016     Dexy->SetXTitle("ADC channels");
1017     Dexy->SetYTitle("Number of events");
1018     Dexy->Draw();
1019     h1max = Dexy->GetMaximum()*1.05;
1020     Double_t xd[4] = {2000.,5000.,5000.,2000.};
1021     Double_t yd[4] = {0.,0.,h1max,h1max};
1022     banda1 = new TPolyLine(4,xd,yd);
1023     banda1->SetLineColor(5);
1024     banda1->SetFillColor(5);
1025     banda1->SetLineWidth(1);
1026     banda1->Draw("fSAME");
1027     Dexy->Draw("SAME");
1028     };
1029     //
1030 mocchiut 1.8 TCanvas *figura3 = 0;
1031     Bool_t printfigure3 = false;
1032     for (Int_t i = 0; i<4; i++){
1033     if ( ver[i][2] || lver[i][2] ){
1034     printfigure3 = true;
1035     break;
1036     };
1037     };
1038     if ( printfigure3 ){
1039     figura3 = new TCanvas("Calorimeter_Detector_Report_2bis/3","Calorimeter_Detector_Report_2bis/3", 1100, 900);
1040     figura3->SetFillColor(10);
1041     figura3->Range(0,0,100,100);
1042     errore.str("");
1043     errore << "EXPERT -- File: " << file;
1044     errore << " ";
1045     t=new TLatex();
1046     t->SetTextFont(32);
1047     t->SetTextColor(1);
1048     t->SetTextAlign(12);
1049     t->SetTextSize(0.015);
1050     t->DrawLatex(2.,99.,errore.str().c_str());
1051     pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.73,45);
1052     pd5 = new TPad("pd5","This is pad5",0.02,0.76,0.49,0.98,45);
1053     pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.73,45);
1054     pd6 = new TPad("pd6","This is pad6",0.51,0.76,0.98,0.98,45);
1055     pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.23,45);
1056     pd7 = new TPad("pd7","This is pad7",0.02,0.26,0.49,0.49,45);
1057     pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.23,45);
1058     pd8 = new TPad("pd8","This is pad8",0.51,0.26,0.98,0.49,45);
1059     figura3->cd();
1060     pd1->Range(0,0,100,100);
1061     pd2->Range(0,0,100,100);
1062     pd3->Range(0,0,100,100);
1063     pd4->Range(0,0,100,100);
1064     pd1->SetTicks();
1065     pd2->SetTicks();
1066     pd3->SetTicks();
1067     pd4->SetTicks();
1068     pd1->Draw();
1069     pd2->Draw();
1070     pd3->Draw();
1071     pd4->Draw();
1072     pd5->Range(0,0,100,100);
1073     pd6->Range(0,0,100,100);
1074     pd7->Range(0,0,100,100);
1075     pd8->Range(0,0,100,100);
1076     pd5->SetTicks();
1077     pd6->SetTicks();
1078     pd7->SetTicks();
1079     pd8->SetTicks();
1080     pd5->Draw();
1081     pd6->Draw();
1082     pd7->Draw();
1083     pd8->Draw();
1084     pd1->cd();
1085 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");
1086     lup[0]->SetXTitle("OBT");
1087     lup[0]->SetYTitle("Number of events");
1088 mocchiut 1.8 lup[0]->Draw();
1089     pd5->cd();
1090 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");
1091     // lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X");
1092     lupstw[0]->SetXTitle("OBT");
1093     lupstw[0]->SetYTitle("Number of events");
1094 mocchiut 1.8 lupstw[0]->Draw();
1095     pd2->cd();
1096 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");
1097     // lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X");
1098     lup[1]->SetXTitle("OBT");
1099     lup[1]->SetYTitle("Number of events");
1100 mocchiut 1.8 lup[1]->Draw();
1101     pd6->cd();
1102 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");
1103     // lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X");
1104     lupstw[1]->SetXTitle("OBT");
1105     lupstw[1]->SetYTitle("Number of events");
1106 mocchiut 1.8 lupstw[1]->Draw();
1107     pd3->cd();
1108 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");
1109     // lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X");
1110     lup[2]->SetXTitle("OBT");
1111     lup[2]->SetYTitle("Number of events");
1112 mocchiut 1.8 lup[2]->Draw();
1113     pd7->cd();
1114 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");
1115     // lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X");
1116     lupstw[2]->SetXTitle("OBT");
1117     lupstw[2]->SetYTitle("Number of events");
1118 mocchiut 1.8 lupstw[2]->Draw();
1119     pd4->cd();
1120 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");
1121     // lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X");
1122     lup[3]->SetXTitle("OBT");
1123     lup[3]->SetYTitle("Number of events");
1124 mocchiut 1.8 lup[3]->Draw();
1125     pd8->cd();
1126 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");
1127     // lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X");
1128     lupstw[3]->SetXTitle("OBT");
1129     lupstw[3]->SetYTitle("Number of events");
1130 mocchiut 1.8 lupstw[3]->Draw();
1131     };
1132     //
1133 mocchiut 1.1 // output figures, report sheet:
1134     //
1135     TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900);
1136     rapporto->SetFillColor(10);
1137     rapporto->Range(0,0,100,100);
1138     t=new TLatex();
1139     t->SetTextFont(32);
1140     t->SetTextColor(1);
1141     t->SetTextSize(0.05);
1142     t->SetTextAlign(12);
1143     // t->DrawLatex(33.,95.,"Calorimeter quick look: ");
1144     errore.str("");
1145     errore << "BASIC: C1 - File: " << file;
1146     errore << " ";
1147     t->SetTextSize(0.02);
1148     t->DrawLatex(2.,99.,errore.str().c_str());
1149    
1150     pad1 = new TPad("pad1","This is pad1",0.02,0.47,0.49,0.90,19);
1151     pad2 = new TPad("pad2","This is pad2",0.51,0.47,0.98,0.90,19);
1152     pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.49,0.45,19);
1153     pad4 = new TPad("pad4","This is pad4",0.51,0.02,0.98,0.45,19);
1154     pad1->Range(0,0,100,100);
1155     pad2->Range(0,0,100,100);
1156     pad3->Range(0,0,100,100);
1157     pad4->Range(0,0,100,100);
1158    
1159     pad1->Draw();
1160     pad2->Draw();
1161     pad3->Draw();
1162     pad4->Draw();
1163    
1164     for (Int_t i = 0; i < 4; i++){
1165     if (i == 2)
1166     {
1167     pad1->cd() ;
1168     sezione = "** Section YE (x even) **";
1169     }
1170     if (i == 3)
1171     {
1172     pad2->cd();
1173     sezione = "** Section YO (x odd) **";
1174     }
1175     if (i == 0)
1176     {
1177     pad3->cd();
1178     sezione = "** Section XE (y odd) **";
1179     }
1180     if (i == 1)
1181     {
1182     pad4->cd();
1183     sezione = "** Section XO (y even) **";
1184     }
1185     t->SetTextFont(32);
1186     t->SetTextColor(1);
1187     t->SetTextSize(0.05);
1188     t->SetTextAlign(12);
1189     t->DrawLatex(33.,97.,sezione);
1190     t->SetTextSize(0.05);
1191     for (Int_t j = 0; j < 23; j++){
1192     if ( ver[i][j] || lver[i][j] ) {
1193     t->SetTextColor(50);
1194     if (j == 0) {
1195     errore.str("");
1196     errore << "* DSP ack error: " << ver[i][j];
1197     errore << " time(s)";
1198     t->DrawLatex(2.,30.,errore.str().c_str());
1199     check = true;
1200     }
1201     if (j == 1) {
1202     errore.str("");
1203     errore << "* Temperature alarm: " << ver[i][j];
1204     errore << " time(s)";
1205     t->DrawLatex(2.,74.,errore.str().c_str());
1206     check = true;
1207     }
1208     if (j == 2) {
1209 mocchiut 1.8 // printf("boh! lalarm[%i] = %i \n",i,lalarm[i]);
1210 mocchiut 1.1 if ( lalarm[i] ){
1211     errore.str("");
1212     errore << "* Latch up: " << ver[i][j];
1213     errore << " (" << lalarm[i];
1214     errore << " NOT rec!): ";
1215 mocchiut 1.8 t->DrawLatex(2.,70.,errore.str().c_str());
1216 mocchiut 1.1 check = true;
1217     } else {
1218     errore.str("");
1219     errore << "* Latch up alarm: " << ver[i][j];
1220     errore << " time(s). View(s): ";
1221     t->DrawLatex(2.,70.,errore.str().c_str());
1222     check = true;
1223     };
1224     errore.str("");
1225     errore << "(" << lver[i][j];
1226     errore << " view(s))";
1227     t->DrawLatex(27.,65.,errore.str().c_str());
1228     Float_t inc=1.;
1229     for (Int_t e = 0; e < 11; e++){
1230     if ( pshit[i][e] ) {
1231     errore.str("");
1232     errore << " " << (e+1);
1233     errore << " ";
1234     t->DrawLatex(52.+inc,69.,errore.str().c_str());
1235     Int_t numer = pshit[i][e];
1236     errore.str("");
1237     errore << " (" << numer;
1238     errore << ") ";
1239     t->SetTextAngle(-70);
1240     t->DrawLatex(55.+inc,67.,errore.str().c_str());
1241     t->SetTextAngle(0);
1242     inc += 4.;
1243     }
1244     }
1245     }
1246     if (j == 3) {
1247     errore.str("");
1248     errore << "RAW mode: " << ver[i][j];
1249     errore << " time(s)";
1250     t->SetTextColor(32);
1251     t->DrawLatex(2.,90.,errore.str().c_str());
1252     }
1253     if (j == 4) {
1254     errore.str("");
1255     errore << "* CMD length error: " << ver[i][j];
1256     errore << " time(s)";
1257     t->DrawLatex(2.,66.,errore.str().c_str());
1258     check = true;
1259     }
1260     if (j == 5) {
1261     errore.str("");
1262     errore << "* Execution error: " << ver[i][j];
1263     errore << " time(s)";
1264     t->DrawLatex(2.,62.,errore.str().c_str());
1265     check = true;
1266     }
1267     if (j == 6) {
1268     errore.str("");
1269     errore << "* CRC error (st. word): " << ver[i][j];
1270     errore << " time(s)";
1271     t->DrawLatex(2.,58.,errore.str().c_str());
1272     check = true;
1273     }
1274     if (j == 7) {
1275     errore.str("");
1276     errore << "View or command not recognized: " << ver[i][j];
1277     errore << " time(s)";
1278     t->DrawLatex(2.,54.,errore.str().c_str());
1279     check = true;
1280     }
1281     if (j == 8) {
1282     errore.str("");
1283     errore << "Missing section: " << ver[i][j];
1284     errore << " time(s)";
1285     t->DrawLatex(2.,50.,errore.str().c_str());
1286     check = true;
1287     }
1288     if (j == 10) {
1289     errore.str("");
1290     errore << "Calevnum jump: " << ver[i][j];
1291     errore << " time(s)";
1292     t->DrawLatex(2.,42.,errore.str().c_str());
1293     check = true;
1294     }
1295     if (j == 11) {
1296     errore.str("");
1297     errore << "CRC error (data): " << ver[i][j];
1298     errore << " time(s)";
1299     t->DrawLatex(2.,38.,errore.str().c_str());
1300     check = true;
1301     }
1302     if (j == 12) {
1303     errore.str("");
1304     errore << "Length problems in RAW mode: " << ver[i][j];
1305     errore << " time(s)";
1306     t->DrawLatex(2.,34.,errore.str().c_str());
1307     check = true;
1308     }
1309     if (j == 13) {
1310     errore.str("");
1311     errore << "Length problems in COMPRESS mode: " << ver[i][j];
1312     errore << " time(s)";
1313     t->DrawLatex(2.,34.,errore.str().c_str());
1314     check = true;
1315     }
1316     if (j == 14) {
1317     errore.str("");
1318     errore << "Length problems in FULL mode: " << ver[i][j];
1319     errore << " time(s)";
1320     t->DrawLatex(2.,26.,errore.str().c_str());
1321     check = true;
1322     }
1323     if (j == 15) {
1324     errore.str("");
1325     errore << "Acquisition mode problems: " << ver[i][j];
1326     errore << " time(s)";
1327     t->DrawLatex(2.,22.,errore.str().c_str());
1328     check = true;
1329     }
1330     if (j == 16) {
1331     errore.str("");
1332     errore << "COMPRESS mode: " << ver[i][j];
1333     errore << " time(s)";
1334     t->SetTextColor(32);
1335     t->DrawLatex(2.,86.,errore.str().c_str());
1336     }
1337     if (j == 17) {
1338     errore.str("");
1339     errore << "FULL mode: " << ver[i][j];
1340     errore << " time(s)";
1341     t->SetTextColor(32);
1342     t->DrawLatex(2.,82.,errore.str().c_str());
1343     }
1344     if (j == 18) {
1345     errore.str("");
1346     errore << "Problems with coding: " << ver[i][j];
1347     errore << " time(s)";
1348     t->DrawLatex(2.,18.,errore.str().c_str());
1349     check = true;
1350     }
1351     if (j == 19) {
1352     errore.str("");
1353     errore << "Pedestal checksum wrong: " << ver[i][j];
1354     errore << " time(s)";
1355     t->DrawLatex(2.,14.,errore.str().c_str());
1356     check = true;
1357     }
1358     if (j == 20) {
1359     errore.str("");
1360     errore << "Thresholds checksum wrong: " << ver[i][j];
1361     errore << " time(s)";
1362     t->DrawLatex(2.,10.,errore.str().c_str());
1363     check = true;
1364     }
1365     if (j == 21) {
1366     errore.str("");
1367     errore << "WARNING! DEXYC < 0: " << ver[i][j];
1368     errore << " time(s)";
1369     t->DrawLatex(2.,6.,errore.str().c_str());
1370     check = true;
1371     }
1372     if (j == 22) {
1373     errore.str("");
1374     errore << "Packet length is zero (YODA input error), skipped: " << ver[i][j];
1375     errore << " time(s)";
1376     t->DrawLatex(2.,3.,errore.str().c_str());
1377     check = true;
1378     };
1379     };
1380     };
1381     t->SetTextColor(50);
1382     if ( fulldiff[i] !=0 ) {
1383     check = true;
1384     errore.str("");
1385     errore << "Full mode, differences between RAW and COMPRESS mode: " << fulldiff[i];
1386     errore << " time(s)";
1387     t->DrawLatex(2.,46.,errore.str().c_str());
1388     };
1389     if ( cpre[i] !=0 ) {
1390     errore.str("");
1391     errore << "Preamplifier fully transmitted: " << cpre[i];
1392     errore << " time(s)";
1393     t->SetTextColor(32);
1394     t->DrawLatex(2.,78.,errore.str().c_str());
1395     };
1396     };
1397     rapporto->cd();
1398     t->SetTextFont(32);
1399     t->SetTextColor(1);
1400     t->SetTextSize(0.05);
1401     t->SetTextAlign(12);
1402     t->DrawLatex(22.,95.,"Calorimeter quick look: ");
1403     //printf("check %i \n",check);
1404     if ( check ){
1405     t->SetTextColor(50);
1406     t->DrawLatex(60.,95.," WARNING, CHECK! ");
1407     printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase);
1408     } else {
1409     t->SetTextColor(32);
1410     t->DrawLatex(60.,95.," OK! ");
1411     };
1412     //
1413 mocchiut 1.9 // const string fil = (const char*)filename;
1414     // Int_t posiz = fil.find("dw_");
1415     // if ( posiz == -1 ) posiz = fil.find("DW_");
1416     // Int_t posiz2 = posiz+13;
1417     // TString file2;
1418     // stringcopy(file2,filename,posiz,posiz2);
1419     //
1420     const string fil = gSystem->BaseName(filename.Data());
1421     Int_t posiz = fil.find(".root");
1422     //
1423 mocchiut 1.1 TString file2;
1424 mocchiut 1.9 if ( posiz == -1 ){
1425     file2 = gSystem->BaseName(filename.Data());
1426     } else {
1427     Int_t posiz2 = 0;
1428     stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz);
1429     };
1430     const char *figrec = file2;
1431 mocchiut 1.1 //
1432     const char *outdir = outDir;
1433     stringstream figsave;
1434     stringstream figsave1;
1435     stringstream figsave2;
1436     const char *format = saveas;
1437     if ( !strcmp(format,"ps") ) {
1438     figsave.str("");
1439     figsave << outdir << "/" ;
1440 mocchiut 1.9 figsave << figrec << "_CaloQLOOK.";
1441 mocchiut 1.1 figsave << format << "(";
1442     rapporto->Print(figsave.str().c_str(),"Landscape");
1443     figsave1.str("");
1444     figsave1 << outdir << "/" ;
1445 mocchiut 1.9 figsave1 << figrec << "_CaloQLOOK.";
1446 mocchiut 1.1 figsave1 << format;
1447     figura->Print(figsave1.str().c_str(),"Landscape");
1448     figsave2.str("");
1449     figsave2 << outdir << "/" ;
1450 mocchiut 1.9 figsave2 << figrec << "_CaloQLOOK.";
1451 mocchiut 1.8 if ( printfigure3 ){
1452     figsave2 << format;
1453     figura2->Print(figsave2.str().c_str(),"Landscape");
1454     figsave2.str("");
1455     figsave2 << outdir << "/" ;
1456 mocchiut 1.9 figsave2 << figrec << "_CaloQLOOK.";
1457 mocchiut 1.8 figsave2 << format << ")";
1458     figura3->Print(figsave2.str().c_str(),"Landscape");
1459     } else {
1460     figsave2 << format << ")";;
1461     figura2->Print(figsave2.str().c_str(),"Landscape");
1462     };
1463 mocchiut 1.1 } else {
1464     figsave.str("");
1465     figsave << outdir << "/" ;
1466 mocchiut 1.9 figsave << figrec << "_CaloQLOOK1.";
1467 mocchiut 1.1 figsave << format;
1468     figura->SaveAs(figsave.str().c_str());
1469     figsave.str("");
1470     figsave << outdir << "/" ;
1471 mocchiut 1.9 figsave << figrec << "_CaloQLOOK2.";
1472 mocchiut 1.1 figsave << format;
1473     figura2->SaveAs(figsave.str().c_str());
1474 mocchiut 1.8 if ( printfigure3 ){
1475     figsave.str("");
1476     figsave << outdir << "/" ;
1477 mocchiut 1.9 figsave << figrec << "_CaloQLOOK2bis.";
1478 mocchiut 1.8 figsave << format;
1479     figura3->SaveAs(figsave.str().c_str());
1480     };
1481 mocchiut 1.1 figsave.str("");
1482     figsave << outdir << "/" ;
1483 mocchiut 1.9 figsave << figrec << "_CaloQLOOK3.";
1484 mocchiut 1.1 figsave << format;
1485     rapporto->SaveAs(figsave.str().c_str());
1486     };
1487     }
1488    

  ViewVC Help
Powered by ViewVC 1.1.23