/[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.22 - (hide annotations) (download)
Mon Jul 23 09:34:07 2007 UTC (17 years, 4 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r23
Changes since 1.21: +30 -6 lines
Reduce the txt file size in case of many latchup errors

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

  ViewVC Help
Powered by ViewVC 1.1.23