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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations) (download)
Thu Aug 3 15:25:45 2006 UTC (18 years, 4 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r12
Changes since 1.12: +7 -3 lines
Set Y log. scale for figure C12

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

  ViewVC Help
Powered by ViewVC 1.1.23