1 |
// |
// |
2 |
// Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti |
// Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti |
3 |
// |
// |
4 |
// FCaloQLOOK.c version 1.01 (2006-02-28) |
// FCaloQLOOK.c version 1.11 (2006-07-17) |
5 |
// |
// |
6 |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
7 |
// |
// |
8 |
// Changelog: |
// Changelog: |
9 |
// |
// |
10 |
|
// 1.09 - 1.11 (2006-07-17): Adapted to flight conditions. |
11 |
|
// |
12 |
|
// 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 |
|
// |
14 |
|
// 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 |
|
// 1.05 - 1.06 (2006-03-22): Add optimize flag in compiling the script! |
18 |
|
// |
19 |
|
// 1.04 - 1.05 (2006-03-22): Corrected wrong .C files. |
20 |
|
// |
21 |
|
// 1.03 - 1.04 (2006-03-20): Documentation updated. |
22 |
|
// |
23 |
|
// 1.02 - 1.03 (2006-03-20): Changed name of shared libraries (from FCaloQLOOK_cxx.so to libFCaloQLOOK.so). |
24 |
|
// |
25 |
|
// 1.01 - 1.02 (2006-03-13): Include files from YODA without "event" directory. |
26 |
|
// |
27 |
// 1.00 - 1.01 (2006-02-28): Works on YODA v6 output (single file), does not require anymore calocommon package. |
// 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). |
// 0.00 - 1.00 (2006-02-28): Clone of CaloQLOOK.c (ground software). |
43 |
#include <TPolyLine.h> |
#include <TPolyLine.h> |
44 |
#include <TStyle.h> |
#include <TStyle.h> |
45 |
#include <TSystem.h> |
#include <TSystem.h> |
46 |
|
#include <TApplication.h> |
47 |
// |
// |
48 |
#include <event/PamelaRun.h> |
#include <PamelaRun.h> |
49 |
#include <event/physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
50 |
// |
// |
51 |
#include <FCaloQLOOKfun.h> |
#include <FCaloQLOOKfun.h> |
52 |
// |
// |
70 |
} |
} |
71 |
|
|
72 |
TString getFilename(const TString filename){ |
TString getFilename(const TString filename){ |
73 |
const string fil = (const char*)filename; |
// |
74 |
Int_t posiz = fil.find("dw_"); |
const string fil = gSystem->BaseName(filename.Data()); |
75 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
Int_t posiz = fil.find(".root"); |
76 |
if ( posiz == -1 ) return 0; |
// |
|
Int_t posiz2 = posiz+13; |
|
77 |
TString file2; |
TString file2; |
78 |
stringcopy(file2,filename,posiz,posiz2); |
if ( posiz == -1 ){ |
79 |
TString pdat(".dat"); |
file2 = gSystem->BaseName(filename.Data()); |
80 |
stringappend(file2,pdat); |
} else { |
81 |
|
Int_t posiz2 = 0; |
82 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
83 |
|
TString pdat(".dat"); |
84 |
|
stringappend(file2,pdat); |
85 |
|
}; |
86 |
return file2; |
return file2; |
87 |
} |
} |
88 |
|
|
89 |
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){ |
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "png", Bool_t iactive =false, Bool_t w4i=false){ |
90 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
91 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
92 |
|
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
93 |
|
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
94 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
95 |
// |
// |
96 |
|
TApplication *app = 0; |
97 |
|
if ( iactive ) app = new TApplication("app",0,0); |
98 |
// |
// |
99 |
ifstream myfile; |
ifstream myfile; |
100 |
myfile.open(filename.Data()); |
myfile.open(filename.Data()); |
117 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
118 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
119 |
Float_t cdexythr = 0.995; |
Float_t cdexythr = 0.995; |
120 |
|
//Float_t cdexythr = 0.90; |
121 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
122 |
|
Float_t h1rth = 0.90; |
123 |
|
Int_t calevnth = 13; |
124 |
// |
// |
125 |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
126 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = 0; |
195 |
TH1F *calev01; |
TH1F *calev01; |
196 |
TH1F *calev23; |
TH1F *calev23; |
197 |
TH1F *calev03; |
TH1F *calev03; |
198 |
|
TH1F *lupstw[4]; |
199 |
|
TH1F *lup[4]; |
200 |
TH2D *calev2; |
TH2D *calev2; |
201 |
|
|
202 |
h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.); |
h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.); |
206 |
hdiff->SetBit(TH1F::kCanRebin); |
hdiff->SetBit(TH1F::kCanRebin); |
207 |
Baseline = new TH1F("C9","baselines",100,0,3); |
Baseline = new TH1F("C9","baselines",100,0,3); |
208 |
Baseline->SetBit(TH1F::kCanRebin); |
Baseline->SetBit(TH1F::kCanRebin); |
209 |
Dexy = new TH1F("C12","dexy",100,0.,37000.); |
Dexy = new TH1F("C12","dexy",100,0.,10000.); |
210 |
Dexyc = new TH1F("C10","dexyc",100,0,3); |
Dexy->SetBit(TH1F::kCanRebin); |
211 |
Dexyc->SetBit(TH1F::kCanRebin); |
Dexyc = new TH1F("C10","dexyc",100,-100.,37000.); |
212 |
|
// Dexyc->SetBit(TH1F::kCanRebin); |
213 |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
214 |
|
|
215 |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
220 |
calev03->SetBit(TH1F::kCanRebin); |
calev03->SetBit(TH1F::kCanRebin); |
221 |
calev2 = new TH2D("C2","calevnum(2)%iev",3000,0.,2.,100,0.,2.); |
calev2 = new TH2D("C2","calevnum(2)%iev",3000,0.,2.,100,0.,2.); |
222 |
calev2->SetBit(TH2D::kCanRebin); |
calev2->SetBit(TH2D::kCanRebin); |
223 |
|
|
224 |
|
stringstream oss; |
225 |
|
stringstream noss; |
226 |
|
for ( Int_t i=0; i<4; i++){ |
227 |
|
oss.str(""); |
228 |
|
oss << "OBT stw latch up section " << i; |
229 |
|
noss.str(""); |
230 |
|
noss << "C" << 21+i; |
231 |
|
lupstw[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1); |
232 |
|
lupstw[i]->SetBit(TH1F::kCanRebin); |
233 |
|
oss.str(""); |
234 |
|
oss << "OBT no stw latch up section " << i; |
235 |
|
noss.str(""); |
236 |
|
noss << "C" << 25+i; |
237 |
|
lup[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1); |
238 |
|
lup[i]->SetBit(TH1F::kCanRebin); |
239 |
|
}; |
240 |
|
|
241 |
// |
// |
242 |
// run over each event and take out some variables |
// run over each event and take out some variables |
243 |
// |
// |
290 |
bool isRAW = 0; |
bool isRAW = 0; |
291 |
Int_t alldexy=0; |
Int_t alldexy=0; |
292 |
Int_t alldexy2=0; |
Int_t alldexy2=0; |
293 |
Int_t stri=0; |
Int_t planebases=0; |
294 |
|
// Int_t stri=0; |
295 |
Int_t fcheck = 0; |
Int_t fcheck = 0; |
296 |
Int_t cestw=0; |
Int_t cestw=0; |
297 |
Int_t cmask = 127 ; |
Int_t cmask = 127 ; |
319 |
Float_t headc = 0.; |
Float_t headc = 0.; |
320 |
Float_t headco = 0.; |
Float_t headco = 0.; |
321 |
Bool_t h1rcheck = false; |
Bool_t h1rcheck = false; |
322 |
|
Int_t h1rin = 0; |
323 |
|
Int_t h1rout = 0; |
324 |
Int_t intshit = 0; |
Int_t intshit = 0; |
325 |
Int_t outtshit = 0; |
Int_t outtshit = 0; |
326 |
Int_t incshit = 0; |
Int_t incshit = 0; |
331 |
Int_t outdexy = 0; |
Int_t outdexy = 0; |
332 |
Int_t indexyc = 0; |
Int_t indexyc = 0; |
333 |
Int_t outdexyc = 0; |
Int_t outdexyc = 0; |
334 |
|
Int_t obt = 0; |
335 |
|
Int_t minobt[4]; |
336 |
|
Int_t maxobt[4]; |
337 |
|
Int_t swminobt[4]; |
338 |
|
Int_t swmaxobt[4]; |
339 |
|
Bool_t firstobt[4]; |
340 |
|
Bool_t swfirstobt[4]; |
341 |
|
for ( Int_t i = 0; i<4; i++){ |
342 |
|
minobt[i] = 0; |
343 |
|
maxobt[i] = 0; |
344 |
|
swminobt[i] = 0; |
345 |
|
swmaxobt[i] = 0; |
346 |
|
firstobt[i] = true; |
347 |
|
swfirstobt[i] = true; |
348 |
|
}; |
349 |
while ( i < maxevent+1){ |
while ( i < maxevent+1){ |
350 |
tshit = 0; |
tshit = 0; |
351 |
trshit = 0; |
trshit = 0; |
355 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
356 |
headco = headc; |
headco = headc; |
357 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
358 |
calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
obt = ph->GetOrbitalTime(); |
359 |
calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
360 |
calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
361 |
|
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
362 |
|
// calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
363 |
|
// calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
364 |
|
// calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
365 |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
366 |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
367 |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
447 |
bdone = 0; |
bdone = 0; |
448 |
bl++; |
bl++; |
449 |
allbase = ce->base[l][ii][bl]; |
allbase = ce->base[l][ii][bl]; |
450 |
|
// alldexy=0; |
451 |
|
// alldexy2=0; |
452 |
|
// stri=0; |
453 |
|
// for (Int_t e = 0; e < 16 ; e++ ){ |
454 |
|
// stri = e + 16 * bl; |
455 |
|
// alldexy += (int)ce->dexyc[l][ii][stri]; |
456 |
|
// alldexy2 += (int)ce->dexy[l][ii][stri]; |
457 |
|
// }; |
458 |
|
}; |
459 |
|
// |
460 |
|
if ( kk == 0 ){ |
461 |
|
planebases = 0; |
462 |
alldexy=0; |
alldexy=0; |
463 |
alldexy2=0; |
alldexy2=0; |
464 |
stri=0; |
for (Int_t e = 0; e < 96 ; e++ ){ |
465 |
for (Int_t e = 0; e < 16 ; e++ ){ |
if ( e < 6 ) planebases += (int)ce->base[l][ii][e]; |
466 |
stri = e + 16 * bl; |
alldexy += (int)ce->dexyc[l][ii][e]; |
467 |
alldexy += (int)ce->dexyc[l][ii][stri]; |
alldexy2 += (int)ce->dexy[l][ii][e]; |
|
alldexy2 += (int)ce->dexy[l][ii][stri]; |
|
468 |
}; |
}; |
469 |
}; |
}; |
470 |
|
// |
471 |
if ( !isRAW ) { |
if ( !isRAW ) { |
472 |
// |
// |
473 |
if ( !pdone ){ |
if ( !pdone ){ |
474 |
if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) { |
// if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) { |
475 |
|
if ( (planebases>192000 || planebases == 0 ) && ( alldexy > 3072000 || alldexy == 0) && ce->perror[se] == 0 ) { |
476 |
pdone = 1; |
pdone = 1; |
477 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
478 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++; |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) { |
479 |
lver[se][2]++ ; |
lalarm[se]++; |
480 |
|
lup[se]->Fill(obt); |
481 |
|
if ( firstobt[se] ) minobt[se] = obt; |
482 |
|
if ( obt > maxobt[se] ) maxobt[se] = obt; |
483 |
|
}; |
484 |
|
lver[se][2]++ ; |
485 |
}; |
}; |
486 |
} |
} |
487 |
// |
// |
540 |
// |
// |
541 |
} else { |
} else { |
542 |
if ( !pdone ){ |
if ( !pdone ){ |
543 |
if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
544 |
|
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
545 |
pdone = 1; |
pdone = 1; |
546 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
547 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++; |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
548 |
|
lalarm[se]++; |
549 |
|
lup[se]->Fill(obt); |
550 |
|
if ( firstobt[se] ) minobt[se] = obt; |
551 |
|
if ( obt > maxobt[se] ) maxobt[se] = obt; |
552 |
|
}; |
553 |
lver[se][2]++ ; |
lver[se][2]++ ; |
554 |
}; |
}; |
555 |
}; |
}; |
583 |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
584 |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
585 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
586 |
if ( cestw & (1 << 4) ) ver[k][2]++ ; |
if ( cestw & (1 << 4) ){ |
587 |
|
ver[k][2]++ ; |
588 |
|
lupstw[k]->Fill(obt); |
589 |
|
if ( swfirstobt[k] ) swminobt[k] = obt; |
590 |
|
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
591 |
|
}; |
592 |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
593 |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
594 |
}; |
}; |
610 |
trshit += rshit[k][kk]; |
trshit += rshit[k][kk]; |
611 |
}; |
}; |
612 |
}; |
}; |
613 |
Calstriphit->Fill(cshit); |
if (isCOMP || isFULL){ |
614 |
if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
Calstriphit->Fill(cshit); |
615 |
incshit++; |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
616 |
} else { |
if ( (cshit > 10 && cshit < 100) ){ |
617 |
outcshit++; |
incshit++; |
618 |
}; |
} else { |
619 |
if ( tshit>0 ) h1->Fill(tshit); |
outcshit++; |
620 |
if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
}; |
621 |
intshit++; |
// |
622 |
} else { |
if ( tshit>0 ) h1->Fill(tshit); |
623 |
outtshit++; |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
624 |
|
if ( (tshit > 10 && tshit < 100) ){ |
625 |
|
intshit++; |
626 |
|
} else { |
627 |
|
outtshit++; |
628 |
|
}; |
629 |
}; |
}; |
630 |
if ( trshit>0 ) { |
if ( trshit>0 ) { |
631 |
h1r->Fill(trshit); |
h1r->Fill(trshit); |
632 |
if ( trshit < 4210 ){ |
if ( trshit < 4210 ){ |
633 |
h1rcheck = true; |
h1rout++; |
634 |
// printf("ma come... trshit %i \n",trshit); |
// printf("ma come... trshit %i \n",trshit); |
635 |
|
} else { |
636 |
|
h1rin++; |
637 |
}; |
}; |
638 |
}; |
}; |
639 |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
640 |
i++; |
i++; |
641 |
}; |
}; |
642 |
printf("\n"); |
printf("\n"); |
643 |
|
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
644 |
|
h1rcheck = true; |
645 |
|
}; |
646 |
// |
// |
647 |
// output figures, first sheet: |
// output figures, first sheet: |
648 |
// |
// |
662 |
t->DrawLatex(2.,99.,errore.str().c_str()); |
t->DrawLatex(2.,99.,errore.str().c_str()); |
663 |
TPad *pd5; |
TPad *pd5; |
664 |
TPad *pd6; |
TPad *pd6; |
665 |
|
TPad *pd7; |
666 |
|
TPad *pd8; |
667 |
TPad *pad1; |
TPad *pad1; |
668 |
TPad *pad2; |
TPad *pad2; |
669 |
TPad *pad3; |
TPad *pad3; |
708 |
h1->Draw(); |
h1->Draw(); |
709 |
// |
// |
710 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
711 |
Double_t xc[4] = {0.,25.,25.,0.}; |
Double_t xc[4] = {10.,100.,100.,10.}; |
712 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
713 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
714 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
715 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
716 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
717 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
718 |
Double_t xd[4] = {40.,80.,80.,40.}; |
// Double_t xd[4] = {40.,80.,80.,40.}; |
719 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
// Double_t yd[4] = {0.,0.,h1max,h1max}; |
720 |
banda2 = new TPolyLine(4,xd,yd); |
// banda2 = new TPolyLine(4,xd,yd); |
721 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
722 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
723 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
724 |
banda2->Draw("fSAME"); |
//banda2->Draw("fSAME"); |
725 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
726 |
// |
// |
727 |
figura->cd(); |
figura->cd(); |
758 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
759 |
h1->Draw(); |
h1->Draw(); |
760 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
761 |
Double_t xe[4] = {0.,25.,25.,0.}; |
Double_t xe[4] = {10.,100.,100.,10.}; |
762 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
763 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
764 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
765 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
766 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
767 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
768 |
Double_t xf[4] = {40.,80.,80.,40.}; |
// Double_t xf[4] = {40.,80.,80.,40.}; |
769 |
Double_t yf[4] = {0.,0.,h1max,h1max}; |
// Double_t yf[4] = {0.,0.,h1max,h1max}; |
770 |
banda2 = new TPolyLine(4,xf,yf); |
// banda2 = new TPolyLine(4,xf,yf); |
771 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
772 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
773 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
774 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
775 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
776 |
}; |
}; |
777 |
if ( trshit !=0 ) { |
if ( trshit !=0 ) { |
801 |
}; |
}; |
802 |
}; |
}; |
803 |
if ( !errorfull ) { |
if ( !errorfull ) { |
804 |
if ( calevn1 || calevn2 || calevn3 ) { |
if ( calevn1 > calevnth || calevn2 > calevnth || calevn3 > calevnth ) { |
805 |
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45); |
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45); |
806 |
pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45); |
pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45); |
807 |
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45); |
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45); |
976 |
Dexyc->Draw("SAME"); |
Dexyc->Draw("SAME"); |
977 |
// |
// |
978 |
pd3->cd(); |
pd3->cd(); |
979 |
|
// gPad->SetLogy(); |
980 |
Calstriphit->SetXTitle("Number of hit"); |
Calstriphit->SetXTitle("Number of hit"); |
981 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
982 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
983 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
984 |
Double_t xg[4] = {0.,25.,25.,0.}; |
Double_t xg[4] = {10.,100.,100.,10.}; |
985 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
986 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
987 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
988 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
989 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
990 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
991 |
Double_t xh[4] = {40.,80.,80.,40.}; |
// Double_t xh[4] = {40.,80.,80.,40.}; |
992 |
Double_t yh[4] = {0.,0.,h1max,h1max}; |
// Double_t yh[4] = {0.,0.,h1max,h1max}; |
993 |
banda2 = new TPolyLine(4,xh,yh); |
// banda2 = new TPolyLine(4,xh,yh); |
994 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
995 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
996 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
997 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
998 |
Calstriphit->Draw("SAME"); |
Calstriphit->Draw("SAME"); |
999 |
// |
// |
1000 |
pd4->cd(); |
pd4->cd(); |
1001 |
|
gPad->SetLogy(); |
1002 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1003 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1004 |
Dexy->Draw(); |
Dexy->Draw(); |
1005 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1006 |
|
h1max = Dexy->GetMaximum()*2.05; |
1007 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1008 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1009 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1039 |
pd4->Draw(); |
pd4->Draw(); |
1040 |
// |
// |
1041 |
pd4->cd(); |
pd4->cd(); |
1042 |
|
gPad->SetLogy(); |
1043 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1044 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1045 |
Dexy->Draw(); |
Dexy->Draw(); |
1046 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1047 |
|
h1max = Dexy->GetMaximum()*2.05; |
1048 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1049 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1050 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1055 |
Dexy->Draw("SAME"); |
Dexy->Draw("SAME"); |
1056 |
}; |
}; |
1057 |
// |
// |
1058 |
|
TCanvas *figura3 = 0; |
1059 |
|
Bool_t printfigure3 = false; |
1060 |
|
for (Int_t i = 0; i<4; i++){ |
1061 |
|
if ( ver[i][2] || lver[i][2] ){ |
1062 |
|
printfigure3 = true; |
1063 |
|
break; |
1064 |
|
}; |
1065 |
|
}; |
1066 |
|
if ( printfigure3 ){ |
1067 |
|
figura3 = new TCanvas("Calorimeter_Detector_Report_2bis/3","Calorimeter_Detector_Report_2bis/3", 1100, 900); |
1068 |
|
figura3->SetFillColor(10); |
1069 |
|
figura3->Range(0,0,100,100); |
1070 |
|
errore.str(""); |
1071 |
|
errore << "EXPERT -- File: " << file; |
1072 |
|
errore << " "; |
1073 |
|
t=new TLatex(); |
1074 |
|
t->SetTextFont(32); |
1075 |
|
t->SetTextColor(1); |
1076 |
|
t->SetTextAlign(12); |
1077 |
|
t->SetTextSize(0.015); |
1078 |
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
1079 |
|
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.73,45); |
1080 |
|
pd5 = new TPad("pd5","This is pad5",0.02,0.76,0.49,0.98,45); |
1081 |
|
pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.73,45); |
1082 |
|
pd6 = new TPad("pd6","This is pad6",0.51,0.76,0.98,0.98,45); |
1083 |
|
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.23,45); |
1084 |
|
pd7 = new TPad("pd7","This is pad7",0.02,0.26,0.49,0.49,45); |
1085 |
|
pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.23,45); |
1086 |
|
pd8 = new TPad("pd8","This is pad8",0.51,0.26,0.98,0.49,45); |
1087 |
|
figura3->cd(); |
1088 |
|
pd1->Range(0,0,100,100); |
1089 |
|
pd2->Range(0,0,100,100); |
1090 |
|
pd3->Range(0,0,100,100); |
1091 |
|
pd4->Range(0,0,100,100); |
1092 |
|
pd1->SetTicks(); |
1093 |
|
pd2->SetTicks(); |
1094 |
|
pd3->SetTicks(); |
1095 |
|
pd4->SetTicks(); |
1096 |
|
pd1->Draw(); |
1097 |
|
pd2->Draw(); |
1098 |
|
pd3->Draw(); |
1099 |
|
pd4->Draw(); |
1100 |
|
pd5->Range(0,0,100,100); |
1101 |
|
pd6->Range(0,0,100,100); |
1102 |
|
pd7->Range(0,0,100,100); |
1103 |
|
pd8->Range(0,0,100,100); |
1104 |
|
pd5->SetTicks(); |
1105 |
|
pd6->SetTicks(); |
1106 |
|
pd7->SetTicks(); |
1107 |
|
pd8->SetTicks(); |
1108 |
|
pd5->Draw(); |
1109 |
|
pd6->Draw(); |
1110 |
|
pd7->Draw(); |
1111 |
|
pd8->Draw(); |
1112 |
|
pd1->cd(); |
1113 |
|
lup[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); |
1114 |
|
lup[0]->SetXTitle("OBT"); |
1115 |
|
lup[0]->SetYTitle("Number of events"); |
1116 |
|
lup[0]->Draw(); |
1117 |
|
pd5->cd(); |
1118 |
|
lupstw[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); |
1119 |
|
// lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X"); |
1120 |
|
lupstw[0]->SetXTitle("OBT"); |
1121 |
|
lupstw[0]->SetYTitle("Number of events"); |
1122 |
|
lupstw[0]->Draw(); |
1123 |
|
pd2->cd(); |
1124 |
|
lup[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); |
1125 |
|
// lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X"); |
1126 |
|
lup[1]->SetXTitle("OBT"); |
1127 |
|
lup[1]->SetYTitle("Number of events"); |
1128 |
|
lup[1]->Draw(); |
1129 |
|
pd6->cd(); |
1130 |
|
lupstw[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); |
1131 |
|
// lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X"); |
1132 |
|
lupstw[1]->SetXTitle("OBT"); |
1133 |
|
lupstw[1]->SetYTitle("Number of events"); |
1134 |
|
lupstw[1]->Draw(); |
1135 |
|
pd3->cd(); |
1136 |
|
lup[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); |
1137 |
|
// lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X"); |
1138 |
|
lup[2]->SetXTitle("OBT"); |
1139 |
|
lup[2]->SetYTitle("Number of events"); |
1140 |
|
lup[2]->Draw(); |
1141 |
|
pd7->cd(); |
1142 |
|
lupstw[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); |
1143 |
|
// lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X"); |
1144 |
|
lupstw[2]->SetXTitle("OBT"); |
1145 |
|
lupstw[2]->SetYTitle("Number of events"); |
1146 |
|
lupstw[2]->Draw(); |
1147 |
|
pd4->cd(); |
1148 |
|
lup[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); |
1149 |
|
// lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X"); |
1150 |
|
lup[3]->SetXTitle("OBT"); |
1151 |
|
lup[3]->SetYTitle("Number of events"); |
1152 |
|
lup[3]->Draw(); |
1153 |
|
pd8->cd(); |
1154 |
|
lupstw[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); |
1155 |
|
// lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X"); |
1156 |
|
lupstw[3]->SetXTitle("OBT"); |
1157 |
|
lupstw[3]->SetYTitle("Number of events"); |
1158 |
|
lupstw[3]->Draw(); |
1159 |
|
}; |
1160 |
|
// |
1161 |
// output figures, report sheet: |
// output figures, report sheet: |
1162 |
// |
// |
1163 |
TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900); |
TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900); |
1234 |
check = true; |
check = true; |
1235 |
} |
} |
1236 |
if (j == 2) { |
if (j == 2) { |
1237 |
|
// printf("boh! lalarm[%i] = %i \n",i,lalarm[i]); |
1238 |
if ( lalarm[i] ){ |
if ( lalarm[i] ){ |
1239 |
errore.str(""); |
errore.str(""); |
1240 |
errore << "* Latch up: " << ver[i][j]; |
errore << "* Latch up: " << ver[i][j]; |
1241 |
errore << " (" << lalarm[i]; |
errore << " (" << lalarm[i]; |
1242 |
errore << " NOT rec!): "; |
errore << " NOT rec!): "; |
1243 |
t->DrawLatex(0.,70.,errore.str().c_str()); |
t->DrawLatex(2.,70.,errore.str().c_str()); |
1244 |
check = true; |
check = true; |
1245 |
} else { |
} else { |
1246 |
errore.str(""); |
errore.str(""); |
1311 |
errore << "Missing section: " << ver[i][j]; |
errore << "Missing section: " << ver[i][j]; |
1312 |
errore << " time(s)"; |
errore << " time(s)"; |
1313 |
t->DrawLatex(2.,50.,errore.str().c_str()); |
t->DrawLatex(2.,50.,errore.str().c_str()); |
1314 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1315 |
} |
} |
1316 |
if (j == 10) { |
if (j == 10) { |
1317 |
errore.str(""); |
errore.str(""); |
1325 |
errore << "CRC error (data): " << ver[i][j]; |
errore << "CRC error (data): " << ver[i][j]; |
1326 |
errore << " time(s)"; |
errore << " time(s)"; |
1327 |
t->DrawLatex(2.,38.,errore.str().c_str()); |
t->DrawLatex(2.,38.,errore.str().c_str()); |
1328 |
check = true; |
if ( ver[i][j] > 10 ) check = true; |
1329 |
} |
} |
1330 |
if (j == 12) { |
if (j == 12) { |
1331 |
errore.str(""); |
errore.str(""); |
1438 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1439 |
}; |
}; |
1440 |
// |
// |
1441 |
const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1442 |
Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1443 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
1444 |
Int_t posiz2 = posiz+13; |
// Int_t posiz2 = posiz+13; |
1445 |
TString file2; |
// TString file2; |
1446 |
stringcopy(file2,filename,posiz,posiz2); |
// stringcopy(file2,filename,posiz,posiz2); |
1447 |
|
// |
1448 |
|
const string fil = gSystem->BaseName(filename.Data()); |
1449 |
|
Int_t posiz = fil.find(".root"); |
1450 |
// |
// |
1451 |
|
TString file2; |
1452 |
|
if ( posiz == -1 ){ |
1453 |
|
file2 = gSystem->BaseName(filename.Data()); |
1454 |
|
} else { |
1455 |
|
Int_t posiz2 = 0; |
1456 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
1457 |
|
}; |
1458 |
const char *figrec = file2; |
const char *figrec = file2; |
1459 |
|
// |
1460 |
const char *outdir = outDir; |
const char *outdir = outDir; |
1461 |
stringstream figsave; |
stringstream figsave; |
1462 |
stringstream figsave1; |
stringstream figsave1; |
1465 |
if ( !strcmp(format,"ps") ) { |
if ( !strcmp(format,"ps") ) { |
1466 |
figsave.str(""); |
figsave.str(""); |
1467 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1468 |
figsave << figrec << "_qlook."; |
figsave << figrec << "_CaloQLOOK."; |
1469 |
figsave << format << "("; |
figsave << format << "("; |
1470 |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
1471 |
figsave1.str(""); |
figsave1.str(""); |
1472 |
figsave1 << outdir << "/" ; |
figsave1 << outdir << "/" ; |
1473 |
figsave1 << figrec << "_qlook."; |
figsave1 << figrec << "_CaloQLOOK."; |
1474 |
figsave1 << format; |
figsave1 << format; |
1475 |
figura->Print(figsave1.str().c_str(),"Landscape"); |
figura->Print(figsave1.str().c_str(),"Landscape"); |
1476 |
figsave2.str(""); |
figsave2.str(""); |
1477 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1478 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1479 |
figsave2 << format << ")"; |
if ( printfigure3 ){ |
1480 |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
figsave2 << format; |
1481 |
|
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1482 |
|
figsave2.str(""); |
1483 |
|
figsave2 << outdir << "/" ; |
1484 |
|
figsave2 << figrec << "_CaloQLOOK."; |
1485 |
|
figsave2 << format << ")"; |
1486 |
|
figura3->Print(figsave2.str().c_str(),"Landscape"); |
1487 |
|
} else { |
1488 |
|
figsave2 << format << ")";; |
1489 |
|
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1490 |
|
}; |
1491 |
} else { |
} else { |
1492 |
figsave.str(""); |
figsave.str(""); |
1493 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1494 |
figsave << figrec << "_qlook1."; |
figsave << figrec << "_CaloQLOOK1."; |
1495 |
figsave << format; |
figsave << format; |
1496 |
figura->SaveAs(figsave.str().c_str()); |
figura->SaveAs(figsave.str().c_str()); |
1497 |
figsave.str(""); |
figsave.str(""); |
1498 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1499 |
figsave << figrec << "_qlook2."; |
figsave << figrec << "_CaloQLOOK2."; |
1500 |
figsave << format; |
figsave << format; |
1501 |
figura2->SaveAs(figsave.str().c_str()); |
figura2->SaveAs(figsave.str().c_str()); |
1502 |
|
if ( printfigure3 ){ |
1503 |
|
figsave.str(""); |
1504 |
|
figsave << outdir << "/" ; |
1505 |
|
figsave << figrec << "_CaloQLOOK2bis."; |
1506 |
|
figsave << format; |
1507 |
|
figura3->SaveAs(figsave.str().c_str()); |
1508 |
|
}; |
1509 |
figsave.str(""); |
figsave.str(""); |
1510 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1511 |
figsave << figrec << "_qlook3."; |
figsave << figrec << "_CaloQLOOK3."; |
1512 |
figsave << format; |
figsave << format; |
1513 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1514 |
}; |
}; |
1515 |
|
if ( iactive && w4i ){ |
1516 |
|
while ( gROOT->GetListOfCanvases()->FindObject(rapporto) || gROOT->GetListOfCanvases()->FindObject(figura3) || gROOT->GetListOfCanvases()->FindObject(figura2) || gROOT->GetListOfCanvases()->FindObject(figura) ){ |
1517 |
|
gSystem->ProcessEvents(); |
1518 |
|
gSystem->Sleep(10); |
1519 |
|
}; |
1520 |
|
}; |
1521 |
} |
} |
1522 |
|
|