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.02 (2006-03-13) |
// 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. |
// 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. |
69 |
} |
} |
70 |
|
|
71 |
TString getFilename(const TString filename){ |
TString getFilename(const TString filename){ |
72 |
const string fil = (const char*)filename; |
// |
73 |
Int_t posiz = fil.find("dw_"); |
const string fil = gSystem->BaseName(filename.Data()); |
74 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
Int_t posiz = fil.find(".root"); |
75 |
if ( posiz == -1 ) return 0; |
// |
|
Int_t posiz2 = posiz+13; |
|
76 |
TString file2; |
TString file2; |
77 |
stringcopy(file2,filename,posiz,posiz2); |
if ( posiz == -1 ){ |
78 |
TString pdat(".dat"); |
file2 = gSystem->BaseName(filename.Data()); |
79 |
stringappend(file2,pdat); |
} else { |
80 |
|
Int_t posiz2 = 0; |
81 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
82 |
|
TString pdat(".dat"); |
83 |
|
stringappend(file2,pdat); |
84 |
|
}; |
85 |
return file2; |
return file2; |
86 |
} |
} |
87 |
|
|
88 |
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"){ |
89 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
90 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
91 |
|
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
92 |
|
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
93 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
94 |
// |
// |
95 |
// |
// |
114 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
115 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
116 |
Float_t cdexythr = 0.995; |
Float_t cdexythr = 0.995; |
117 |
|
//Float_t cdexythr = 0.90; |
118 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
119 |
|
Float_t h1rth = 0.90; |
120 |
|
Int_t calevnth = 13; |
121 |
// |
// |
122 |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
123 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = 0; |
192 |
TH1F *calev01; |
TH1F *calev01; |
193 |
TH1F *calev23; |
TH1F *calev23; |
194 |
TH1F *calev03; |
TH1F *calev03; |
195 |
|
TH1F *lupstw[4]; |
196 |
|
TH1F *lup[4]; |
197 |
TH2D *calev2; |
TH2D *calev2; |
198 |
|
|
199 |
h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.); |
h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.); |
203 |
hdiff->SetBit(TH1F::kCanRebin); |
hdiff->SetBit(TH1F::kCanRebin); |
204 |
Baseline = new TH1F("C9","baselines",100,0,3); |
Baseline = new TH1F("C9","baselines",100,0,3); |
205 |
Baseline->SetBit(TH1F::kCanRebin); |
Baseline->SetBit(TH1F::kCanRebin); |
206 |
Dexy = new TH1F("C12","dexy",100,0.,37000.); |
Dexy = new TH1F("C12","dexy",100,0.,10000.); |
207 |
Dexyc = new TH1F("C10","dexyc",100,0,3); |
Dexy->SetBit(TH1F::kCanRebin); |
208 |
Dexyc->SetBit(TH1F::kCanRebin); |
Dexyc = new TH1F("C10","dexyc",100,-100.,37000.); |
209 |
|
// Dexyc->SetBit(TH1F::kCanRebin); |
210 |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
211 |
|
|
212 |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
217 |
calev03->SetBit(TH1F::kCanRebin); |
calev03->SetBit(TH1F::kCanRebin); |
218 |
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.); |
219 |
calev2->SetBit(TH2D::kCanRebin); |
calev2->SetBit(TH2D::kCanRebin); |
220 |
|
|
221 |
|
stringstream oss; |
222 |
|
stringstream noss; |
223 |
|
for ( Int_t i=0; i<4; i++){ |
224 |
|
oss.str(""); |
225 |
|
oss << "OBT stw latch up section " << i; |
226 |
|
noss.str(""); |
227 |
|
noss << "C" << 21+i; |
228 |
|
lupstw[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1); |
229 |
|
lupstw[i]->SetBit(TH1F::kCanRebin); |
230 |
|
oss.str(""); |
231 |
|
oss << "OBT no stw latch up section " << i; |
232 |
|
noss.str(""); |
233 |
|
noss << "C" << 25+i; |
234 |
|
lup[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1); |
235 |
|
lup[i]->SetBit(TH1F::kCanRebin); |
236 |
|
}; |
237 |
|
|
238 |
// |
// |
239 |
// run over each event and take out some variables |
// run over each event and take out some variables |
240 |
// |
// |
287 |
bool isRAW = 0; |
bool isRAW = 0; |
288 |
Int_t alldexy=0; |
Int_t alldexy=0; |
289 |
Int_t alldexy2=0; |
Int_t alldexy2=0; |
290 |
Int_t stri=0; |
Int_t planebases=0; |
291 |
|
// Int_t stri=0; |
292 |
Int_t fcheck = 0; |
Int_t fcheck = 0; |
293 |
Int_t cestw=0; |
Int_t cestw=0; |
294 |
Int_t cmask = 127 ; |
Int_t cmask = 127 ; |
316 |
Float_t headc = 0.; |
Float_t headc = 0.; |
317 |
Float_t headco = 0.; |
Float_t headco = 0.; |
318 |
Bool_t h1rcheck = false; |
Bool_t h1rcheck = false; |
319 |
|
Int_t h1rin = 0; |
320 |
|
Int_t h1rout = 0; |
321 |
Int_t intshit = 0; |
Int_t intshit = 0; |
322 |
Int_t outtshit = 0; |
Int_t outtshit = 0; |
323 |
Int_t incshit = 0; |
Int_t incshit = 0; |
328 |
Int_t outdexy = 0; |
Int_t outdexy = 0; |
329 |
Int_t indexyc = 0; |
Int_t indexyc = 0; |
330 |
Int_t outdexyc = 0; |
Int_t outdexyc = 0; |
331 |
|
Int_t obt = 0; |
332 |
|
Int_t minobt[4]; |
333 |
|
Int_t maxobt[4]; |
334 |
|
Int_t swminobt[4]; |
335 |
|
Int_t swmaxobt[4]; |
336 |
|
Bool_t firstobt[4]; |
337 |
|
Bool_t swfirstobt[4]; |
338 |
|
for ( Int_t i = 0; i<4; i++){ |
339 |
|
minobt[i] = 0; |
340 |
|
maxobt[i] = 0; |
341 |
|
swminobt[i] = 0; |
342 |
|
swmaxobt[i] = 0; |
343 |
|
firstobt[i] = true; |
344 |
|
swfirstobt[i] = true; |
345 |
|
}; |
346 |
while ( i < maxevent+1){ |
while ( i < maxevent+1){ |
347 |
tshit = 0; |
tshit = 0; |
348 |
trshit = 0; |
trshit = 0; |
352 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
353 |
headco = headc; |
headco = headc; |
354 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
355 |
calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
obt = ph->GetOrbitalTime(); |
356 |
calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
357 |
calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
358 |
|
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
359 |
|
// calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
360 |
|
// calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
361 |
|
// calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
362 |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
363 |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
364 |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
444 |
bdone = 0; |
bdone = 0; |
445 |
bl++; |
bl++; |
446 |
allbase = ce->base[l][ii][bl]; |
allbase = ce->base[l][ii][bl]; |
447 |
|
// alldexy=0; |
448 |
|
// alldexy2=0; |
449 |
|
// stri=0; |
450 |
|
// for (Int_t e = 0; e < 16 ; e++ ){ |
451 |
|
// stri = e + 16 * bl; |
452 |
|
// alldexy += (int)ce->dexyc[l][ii][stri]; |
453 |
|
// alldexy2 += (int)ce->dexy[l][ii][stri]; |
454 |
|
// }; |
455 |
|
}; |
456 |
|
// |
457 |
|
if ( kk == 0 ){ |
458 |
|
planebases = 0; |
459 |
alldexy=0; |
alldexy=0; |
460 |
alldexy2=0; |
alldexy2=0; |
461 |
stri=0; |
for (Int_t e = 0; e < 96 ; e++ ){ |
462 |
for (Int_t e = 0; e < 16 ; e++ ){ |
if ( e < 6 ) planebases += (int)ce->base[l][ii][e]; |
463 |
stri = e + 16 * bl; |
alldexy += (int)ce->dexyc[l][ii][e]; |
464 |
alldexy += (int)ce->dexyc[l][ii][stri]; |
alldexy2 += (int)ce->dexy[l][ii][e]; |
|
alldexy2 += (int)ce->dexy[l][ii][stri]; |
|
465 |
}; |
}; |
466 |
}; |
}; |
467 |
|
// |
468 |
if ( !isRAW ) { |
if ( !isRAW ) { |
469 |
// |
// |
470 |
if ( !pdone ){ |
if ( !pdone ){ |
471 |
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 ) { |
472 |
|
if ( (planebases>192000 || planebases == 0 ) && ( alldexy > 3072000 || alldexy == 0) && ce->perror[se] == 0 ) { |
473 |
pdone = 1; |
pdone = 1; |
474 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
475 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++; |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) { |
476 |
lver[se][2]++ ; |
lalarm[se]++; |
477 |
|
lup[se]->Fill(obt); |
478 |
|
if ( firstobt[se] ) minobt[se] = obt; |
479 |
|
if ( obt > maxobt[se] ) maxobt[se] = obt; |
480 |
|
}; |
481 |
|
lver[se][2]++ ; |
482 |
}; |
}; |
483 |
} |
} |
484 |
// |
// |
537 |
// |
// |
538 |
} else { |
} else { |
539 |
if ( !pdone ){ |
if ( !pdone ){ |
540 |
if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
541 |
|
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
542 |
pdone = 1; |
pdone = 1; |
543 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
544 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++; |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
545 |
|
lalarm[se]++; |
546 |
|
lup[se]->Fill(obt); |
547 |
|
if ( firstobt[se] ) minobt[se] = obt; |
548 |
|
if ( obt > maxobt[se] ) maxobt[se] = obt; |
549 |
|
}; |
550 |
lver[se][2]++ ; |
lver[se][2]++ ; |
551 |
}; |
}; |
552 |
}; |
}; |
580 |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
581 |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
582 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
583 |
if ( cestw & (1 << 4) ) ver[k][2]++ ; |
if ( cestw & (1 << 4) ){ |
584 |
|
ver[k][2]++ ; |
585 |
|
lupstw[k]->Fill(obt); |
586 |
|
if ( swfirstobt[k] ) swminobt[k] = obt; |
587 |
|
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
588 |
|
}; |
589 |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
590 |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
591 |
}; |
}; |
607 |
trshit += rshit[k][kk]; |
trshit += rshit[k][kk]; |
608 |
}; |
}; |
609 |
}; |
}; |
610 |
Calstriphit->Fill(cshit); |
if (isCOMP || isFULL){ |
611 |
if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
Calstriphit->Fill(cshit); |
612 |
incshit++; |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
613 |
} else { |
if ( (cshit > 10 && cshit < 100) ){ |
614 |
outcshit++; |
incshit++; |
615 |
}; |
} else { |
616 |
if ( tshit>0 ) h1->Fill(tshit); |
outcshit++; |
617 |
if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
}; |
618 |
intshit++; |
// |
619 |
} else { |
if ( tshit>0 ) h1->Fill(tshit); |
620 |
outtshit++; |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
621 |
|
if ( (tshit > 10 && tshit < 100) ){ |
622 |
|
intshit++; |
623 |
|
} else { |
624 |
|
outtshit++; |
625 |
|
}; |
626 |
}; |
}; |
627 |
if ( trshit>0 ) { |
if ( trshit>0 ) { |
628 |
h1r->Fill(trshit); |
h1r->Fill(trshit); |
629 |
if ( trshit < 4210 ){ |
if ( trshit < 4210 ){ |
630 |
h1rcheck = true; |
h1rout++; |
631 |
// printf("ma come... trshit %i \n",trshit); |
// printf("ma come... trshit %i \n",trshit); |
632 |
|
} else { |
633 |
|
h1rin++; |
634 |
}; |
}; |
635 |
}; |
}; |
636 |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
637 |
i++; |
i++; |
638 |
}; |
}; |
639 |
printf("\n"); |
printf("\n"); |
640 |
|
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
641 |
|
h1rcheck = true; |
642 |
|
}; |
643 |
// |
// |
644 |
// output figures, first sheet: |
// output figures, first sheet: |
645 |
// |
// |
659 |
t->DrawLatex(2.,99.,errore.str().c_str()); |
t->DrawLatex(2.,99.,errore.str().c_str()); |
660 |
TPad *pd5; |
TPad *pd5; |
661 |
TPad *pd6; |
TPad *pd6; |
662 |
|
TPad *pd7; |
663 |
|
TPad *pd8; |
664 |
TPad *pad1; |
TPad *pad1; |
665 |
TPad *pad2; |
TPad *pad2; |
666 |
TPad *pad3; |
TPad *pad3; |
705 |
h1->Draw(); |
h1->Draw(); |
706 |
// |
// |
707 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
708 |
Double_t xc[4] = {0.,25.,25.,0.}; |
Double_t xc[4] = {10.,100.,100.,10.}; |
709 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
710 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
711 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
712 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
713 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
714 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
715 |
Double_t xd[4] = {40.,80.,80.,40.}; |
// Double_t xd[4] = {40.,80.,80.,40.}; |
716 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
// Double_t yd[4] = {0.,0.,h1max,h1max}; |
717 |
banda2 = new TPolyLine(4,xd,yd); |
// banda2 = new TPolyLine(4,xd,yd); |
718 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
719 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
720 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
721 |
banda2->Draw("fSAME"); |
//banda2->Draw("fSAME"); |
722 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
723 |
// |
// |
724 |
figura->cd(); |
figura->cd(); |
755 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
756 |
h1->Draw(); |
h1->Draw(); |
757 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
758 |
Double_t xe[4] = {0.,25.,25.,0.}; |
Double_t xe[4] = {10.,100.,100.,10.}; |
759 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
760 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
761 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
762 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
763 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
764 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
765 |
Double_t xf[4] = {40.,80.,80.,40.}; |
// Double_t xf[4] = {40.,80.,80.,40.}; |
766 |
Double_t yf[4] = {0.,0.,h1max,h1max}; |
// Double_t yf[4] = {0.,0.,h1max,h1max}; |
767 |
banda2 = new TPolyLine(4,xf,yf); |
// banda2 = new TPolyLine(4,xf,yf); |
768 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
769 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
770 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
771 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
772 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
773 |
}; |
}; |
774 |
if ( trshit !=0 ) { |
if ( trshit !=0 ) { |
798 |
}; |
}; |
799 |
}; |
}; |
800 |
if ( !errorfull ) { |
if ( !errorfull ) { |
801 |
if ( calevn1 || calevn2 || calevn3 ) { |
if ( calevn1 > calevnth || calevn2 > calevnth || calevn3 > calevnth ) { |
802 |
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); |
803 |
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); |
804 |
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); |
973 |
Dexyc->Draw("SAME"); |
Dexyc->Draw("SAME"); |
974 |
// |
// |
975 |
pd3->cd(); |
pd3->cd(); |
976 |
|
// gPad->SetLogy(); |
977 |
Calstriphit->SetXTitle("Number of hit"); |
Calstriphit->SetXTitle("Number of hit"); |
978 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
979 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
980 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
981 |
Double_t xg[4] = {0.,25.,25.,0.}; |
Double_t xg[4] = {10.,100.,100.,10.}; |
982 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
983 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
984 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
985 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
986 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
987 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
988 |
Double_t xh[4] = {40.,80.,80.,40.}; |
// Double_t xh[4] = {40.,80.,80.,40.}; |
989 |
Double_t yh[4] = {0.,0.,h1max,h1max}; |
// Double_t yh[4] = {0.,0.,h1max,h1max}; |
990 |
banda2 = new TPolyLine(4,xh,yh); |
// banda2 = new TPolyLine(4,xh,yh); |
991 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
992 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
993 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
994 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
995 |
Calstriphit->Draw("SAME"); |
Calstriphit->Draw("SAME"); |
996 |
// |
// |
997 |
pd4->cd(); |
pd4->cd(); |
998 |
|
gPad->SetLogy(); |
999 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1000 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1001 |
Dexy->Draw(); |
Dexy->Draw(); |
1002 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1003 |
|
h1max = Dexy->GetMaximum()*2.05; |
1004 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1005 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1006 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1036 |
pd4->Draw(); |
pd4->Draw(); |
1037 |
// |
// |
1038 |
pd4->cd(); |
pd4->cd(); |
1039 |
|
gPad->SetLogy(); |
1040 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1041 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1042 |
Dexy->Draw(); |
Dexy->Draw(); |
1043 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1044 |
|
h1max = Dexy->GetMaximum()*2.05; |
1045 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1046 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1047 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1052 |
Dexy->Draw("SAME"); |
Dexy->Draw("SAME"); |
1053 |
}; |
}; |
1054 |
// |
// |
1055 |
|
TCanvas *figura3 = 0; |
1056 |
|
Bool_t printfigure3 = false; |
1057 |
|
for (Int_t i = 0; i<4; i++){ |
1058 |
|
if ( ver[i][2] || lver[i][2] ){ |
1059 |
|
printfigure3 = true; |
1060 |
|
break; |
1061 |
|
}; |
1062 |
|
}; |
1063 |
|
if ( printfigure3 ){ |
1064 |
|
figura3 = new TCanvas("Calorimeter_Detector_Report_2bis/3","Calorimeter_Detector_Report_2bis/3", 1100, 900); |
1065 |
|
figura3->SetFillColor(10); |
1066 |
|
figura3->Range(0,0,100,100); |
1067 |
|
errore.str(""); |
1068 |
|
errore << "EXPERT -- File: " << file; |
1069 |
|
errore << " "; |
1070 |
|
t=new TLatex(); |
1071 |
|
t->SetTextFont(32); |
1072 |
|
t->SetTextColor(1); |
1073 |
|
t->SetTextAlign(12); |
1074 |
|
t->SetTextSize(0.015); |
1075 |
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
1076 |
|
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.73,45); |
1077 |
|
pd5 = new TPad("pd5","This is pad5",0.02,0.76,0.49,0.98,45); |
1078 |
|
pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.73,45); |
1079 |
|
pd6 = new TPad("pd6","This is pad6",0.51,0.76,0.98,0.98,45); |
1080 |
|
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.23,45); |
1081 |
|
pd7 = new TPad("pd7","This is pad7",0.02,0.26,0.49,0.49,45); |
1082 |
|
pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.23,45); |
1083 |
|
pd8 = new TPad("pd8","This is pad8",0.51,0.26,0.98,0.49,45); |
1084 |
|
figura3->cd(); |
1085 |
|
pd1->Range(0,0,100,100); |
1086 |
|
pd2->Range(0,0,100,100); |
1087 |
|
pd3->Range(0,0,100,100); |
1088 |
|
pd4->Range(0,0,100,100); |
1089 |
|
pd1->SetTicks(); |
1090 |
|
pd2->SetTicks(); |
1091 |
|
pd3->SetTicks(); |
1092 |
|
pd4->SetTicks(); |
1093 |
|
pd1->Draw(); |
1094 |
|
pd2->Draw(); |
1095 |
|
pd3->Draw(); |
1096 |
|
pd4->Draw(); |
1097 |
|
pd5->Range(0,0,100,100); |
1098 |
|
pd6->Range(0,0,100,100); |
1099 |
|
pd7->Range(0,0,100,100); |
1100 |
|
pd8->Range(0,0,100,100); |
1101 |
|
pd5->SetTicks(); |
1102 |
|
pd6->SetTicks(); |
1103 |
|
pd7->SetTicks(); |
1104 |
|
pd8->SetTicks(); |
1105 |
|
pd5->Draw(); |
1106 |
|
pd6->Draw(); |
1107 |
|
pd7->Draw(); |
1108 |
|
pd8->Draw(); |
1109 |
|
pd1->cd(); |
1110 |
|
lup[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); |
1111 |
|
lup[0]->SetXTitle("OBT"); |
1112 |
|
lup[0]->SetYTitle("Number of events"); |
1113 |
|
lup[0]->Draw(); |
1114 |
|
pd5->cd(); |
1115 |
|
lupstw[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); |
1116 |
|
// lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X"); |
1117 |
|
lupstw[0]->SetXTitle("OBT"); |
1118 |
|
lupstw[0]->SetYTitle("Number of events"); |
1119 |
|
lupstw[0]->Draw(); |
1120 |
|
pd2->cd(); |
1121 |
|
lup[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); |
1122 |
|
// lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X"); |
1123 |
|
lup[1]->SetXTitle("OBT"); |
1124 |
|
lup[1]->SetYTitle("Number of events"); |
1125 |
|
lup[1]->Draw(); |
1126 |
|
pd6->cd(); |
1127 |
|
lupstw[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); |
1128 |
|
// lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X"); |
1129 |
|
lupstw[1]->SetXTitle("OBT"); |
1130 |
|
lupstw[1]->SetYTitle("Number of events"); |
1131 |
|
lupstw[1]->Draw(); |
1132 |
|
pd3->cd(); |
1133 |
|
lup[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); |
1134 |
|
// lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X"); |
1135 |
|
lup[2]->SetXTitle("OBT"); |
1136 |
|
lup[2]->SetYTitle("Number of events"); |
1137 |
|
lup[2]->Draw(); |
1138 |
|
pd7->cd(); |
1139 |
|
lupstw[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); |
1140 |
|
// lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X"); |
1141 |
|
lupstw[2]->SetXTitle("OBT"); |
1142 |
|
lupstw[2]->SetYTitle("Number of events"); |
1143 |
|
lupstw[2]->Draw(); |
1144 |
|
pd4->cd(); |
1145 |
|
lup[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); |
1146 |
|
// lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X"); |
1147 |
|
lup[3]->SetXTitle("OBT"); |
1148 |
|
lup[3]->SetYTitle("Number of events"); |
1149 |
|
lup[3]->Draw(); |
1150 |
|
pd8->cd(); |
1151 |
|
lupstw[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); |
1152 |
|
// lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X"); |
1153 |
|
lupstw[3]->SetXTitle("OBT"); |
1154 |
|
lupstw[3]->SetYTitle("Number of events"); |
1155 |
|
lupstw[3]->Draw(); |
1156 |
|
}; |
1157 |
|
// |
1158 |
// output figures, report sheet: |
// output figures, report sheet: |
1159 |
// |
// |
1160 |
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); |
1231 |
check = true; |
check = true; |
1232 |
} |
} |
1233 |
if (j == 2) { |
if (j == 2) { |
1234 |
|
// printf("boh! lalarm[%i] = %i \n",i,lalarm[i]); |
1235 |
if ( lalarm[i] ){ |
if ( lalarm[i] ){ |
1236 |
errore.str(""); |
errore.str(""); |
1237 |
errore << "* Latch up: " << ver[i][j]; |
errore << "* Latch up: " << ver[i][j]; |
1238 |
errore << " (" << lalarm[i]; |
errore << " (" << lalarm[i]; |
1239 |
errore << " NOT rec!): "; |
errore << " NOT rec!): "; |
1240 |
t->DrawLatex(0.,70.,errore.str().c_str()); |
t->DrawLatex(2.,70.,errore.str().c_str()); |
1241 |
check = true; |
check = true; |
1242 |
} else { |
} else { |
1243 |
errore.str(""); |
errore.str(""); |
1308 |
errore << "Missing section: " << ver[i][j]; |
errore << "Missing section: " << ver[i][j]; |
1309 |
errore << " time(s)"; |
errore << " time(s)"; |
1310 |
t->DrawLatex(2.,50.,errore.str().c_str()); |
t->DrawLatex(2.,50.,errore.str().c_str()); |
1311 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1312 |
} |
} |
1313 |
if (j == 10) { |
if (j == 10) { |
1314 |
errore.str(""); |
errore.str(""); |
1322 |
errore << "CRC error (data): " << ver[i][j]; |
errore << "CRC error (data): " << ver[i][j]; |
1323 |
errore << " time(s)"; |
errore << " time(s)"; |
1324 |
t->DrawLatex(2.,38.,errore.str().c_str()); |
t->DrawLatex(2.,38.,errore.str().c_str()); |
1325 |
check = true; |
if ( ver[i][j] > 10 ) check = true; |
1326 |
} |
} |
1327 |
if (j == 12) { |
if (j == 12) { |
1328 |
errore.str(""); |
errore.str(""); |
1435 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1436 |
}; |
}; |
1437 |
// |
// |
1438 |
const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1439 |
Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1440 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
1441 |
Int_t posiz2 = posiz+13; |
// Int_t posiz2 = posiz+13; |
1442 |
TString file2; |
// TString file2; |
1443 |
stringcopy(file2,filename,posiz,posiz2); |
// stringcopy(file2,filename,posiz,posiz2); |
1444 |
// |
// |
1445 |
|
const string fil = gSystem->BaseName(filename.Data()); |
1446 |
|
Int_t posiz = fil.find(".root"); |
1447 |
|
// |
1448 |
|
TString file2; |
1449 |
|
if ( posiz == -1 ){ |
1450 |
|
file2 = gSystem->BaseName(filename.Data()); |
1451 |
|
} else { |
1452 |
|
Int_t posiz2 = 0; |
1453 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
1454 |
|
}; |
1455 |
const char *figrec = file2; |
const char *figrec = file2; |
1456 |
|
// |
1457 |
const char *outdir = outDir; |
const char *outdir = outDir; |
1458 |
stringstream figsave; |
stringstream figsave; |
1459 |
stringstream figsave1; |
stringstream figsave1; |
1462 |
if ( !strcmp(format,"ps") ) { |
if ( !strcmp(format,"ps") ) { |
1463 |
figsave.str(""); |
figsave.str(""); |
1464 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1465 |
figsave << figrec << "_qlook."; |
figsave << figrec << "_CaloQLOOK."; |
1466 |
figsave << format << "("; |
figsave << format << "("; |
1467 |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
1468 |
figsave1.str(""); |
figsave1.str(""); |
1469 |
figsave1 << outdir << "/" ; |
figsave1 << outdir << "/" ; |
1470 |
figsave1 << figrec << "_qlook."; |
figsave1 << figrec << "_CaloQLOOK."; |
1471 |
figsave1 << format; |
figsave1 << format; |
1472 |
figura->Print(figsave1.str().c_str(),"Landscape"); |
figura->Print(figsave1.str().c_str(),"Landscape"); |
1473 |
figsave2.str(""); |
figsave2.str(""); |
1474 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1475 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1476 |
figsave2 << format << ")"; |
if ( printfigure3 ){ |
1477 |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
figsave2 << format; |
1478 |
|
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1479 |
|
figsave2.str(""); |
1480 |
|
figsave2 << outdir << "/" ; |
1481 |
|
figsave2 << figrec << "_CaloQLOOK."; |
1482 |
|
figsave2 << format << ")"; |
1483 |
|
figura3->Print(figsave2.str().c_str(),"Landscape"); |
1484 |
|
} else { |
1485 |
|
figsave2 << format << ")";; |
1486 |
|
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1487 |
|
}; |
1488 |
} else { |
} else { |
1489 |
figsave.str(""); |
figsave.str(""); |
1490 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1491 |
figsave << figrec << "_qlook1."; |
figsave << figrec << "_CaloQLOOK1."; |
1492 |
figsave << format; |
figsave << format; |
1493 |
figura->SaveAs(figsave.str().c_str()); |
figura->SaveAs(figsave.str().c_str()); |
1494 |
figsave.str(""); |
figsave.str(""); |
1495 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1496 |
figsave << figrec << "_qlook2."; |
figsave << figrec << "_CaloQLOOK2."; |
1497 |
figsave << format; |
figsave << format; |
1498 |
figura2->SaveAs(figsave.str().c_str()); |
figura2->SaveAs(figsave.str().c_str()); |
1499 |
|
if ( printfigure3 ){ |
1500 |
|
figsave.str(""); |
1501 |
|
figsave << outdir << "/" ; |
1502 |
|
figsave << figrec << "_CaloQLOOK2bis."; |
1503 |
|
figsave << format; |
1504 |
|
figura3->SaveAs(figsave.str().c_str()); |
1505 |
|
}; |
1506 |
figsave.str(""); |
figsave.str(""); |
1507 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1508 |
figsave << figrec << "_qlook3."; |
figsave << figrec << "_CaloQLOOK3."; |
1509 |
figsave << format; |
figsave << format; |
1510 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1511 |
}; |
}; |