| 2 |
* FTrkCalibQLook_BASIC.cxx |
* FTrkCalibQLook_BASIC.cxx |
| 3 |
* |
* |
| 4 |
* autor: D.Fedele |
* autor: D.Fedele |
| 5 |
* version 2.0 |
* version v1r04 |
| 6 |
* Parameters: |
* Parameters: |
| 7 |
* file - the data file to analyze |
* file - the data file to analyze |
| 8 |
* fromevent - first event to analyze |
* fromevent - first event to analyze |
| 15 |
#include <TLatex.h> |
#include <TLatex.h> |
| 16 |
#include <TCanvas.h> |
#include <TCanvas.h> |
| 17 |
#include <TGraph.h> |
#include <TGraph.h> |
| 18 |
|
#include <TFile.h> |
| 19 |
#include <TTree.h> |
#include <TTree.h> |
| 20 |
#include <TStyle.h> |
#include <TStyle.h> |
| 21 |
#include <TString.h> |
#include <TString.h> |
| 26 |
#include <CalibTrk2Event.h> |
#include <CalibTrk2Event.h> |
| 27 |
// |
// |
| 28 |
|
|
| 29 |
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
typedef struct caltrk_def{ |
|
if ( to == 0 ){ |
|
|
Int_t t2length = s2.Length(); |
|
|
s1 = ""; |
|
|
to = t2length; |
|
|
}; |
|
|
for (Int_t i = from; i<to; i++){ |
|
|
s1.Append(s2[i],1); |
|
|
}; |
|
|
}; |
|
|
|
|
|
typedef struct caltrk_def{ |
|
| 30 |
Int_t good0[2]; |
Int_t good0[2]; |
| 31 |
Int_t daqmode[12]; |
Int_t daqmode[12]; |
| 32 |
Int_t dspnum[12]; |
Int_t dspnum[12]; |
| 55 |
// |
// |
| 56 |
// obtain information about the data file and select the output dir |
// obtain information about the data file and select the output dir |
| 57 |
const string filepath=file.Data(); |
const string filepath=file.Data(); |
| 58 |
Int_t dwpos = filepath.rfind("DW_"); |
Int_t dwpos = file.Last('/'); |
| 59 |
Int_t dwpos1 = filepath.find(".root"); |
Int_t dwpos1 = file.Last('.'); |
| 60 |
TString fpath=(filepath.c_str()); |
TString base,ffile ; |
| 61 |
TString base,ffile; |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
| 62 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
|
stringcopy(ffile,fpath,dwpos,dwpos1); |
|
| 63 |
|
|
| 64 |
TString out; |
TString out; |
| 65 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
| 67 |
}else{ |
}else{ |
| 68 |
out = outdir; |
out = outdir; |
| 69 |
}; |
}; |
| 70 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
| 71 |
|
|
| 72 |
// |
// |
| 73 |
// inizialise the variables and open the file |
// inizialise the variables and open the file |
| 74 |
struct caltrk_def ctrk; |
struct caltrk_def ctrk; |
| 202 |
// inizialize the limits for simga and pedestall |
// inizialize the limits for simga and pedestall |
| 203 |
for(Int_t i=0;i<12;i++){ |
for(Int_t i=0;i<12;i++){ |
| 204 |
for(Int_t ii=0;ii<12;ii++){ |
for(Int_t ii=0;ii<12;ii++){ |
| 205 |
siglimsup[i][ii]=20.; |
siglimsup[i][ii]=30.; |
| 206 |
sigliminf[i][ii]=0.; |
sigliminf[i][ii]=1.5; |
| 207 |
pedlimsup[i][ii]=3500.; |
if(!(i%2)){ |
| 208 |
pedliminf[i][ii]=50.; |
pedlimsup[i][ii]=3700.; |
| 209 |
|
pedliminf[i][ii]=1700.; |
| 210 |
|
} |
| 211 |
|
else{ |
| 212 |
|
pedlimsup[i][ii]=2200.; |
| 213 |
|
pedliminf[i][ii]=200.; |
| 214 |
|
} |
| 215 |
} |
} |
| 216 |
} |
} |
| 217 |
|
|
| 232 |
if(trk2->cal_flag[m]!=0) alarm+=1; |
if(trk2->cal_flag[m]!=0) alarm+=1; |
| 233 |
} |
} |
| 234 |
} |
} |
| 235 |
const Int_t cnum=alarm/30 + 10; |
const Int_t cnum=alarm/30 + 100; |
| 236 |
Int_t flcanvas=1; |
Int_t flcanvas=1; |
| 237 |
Float_t spacep=1.5,space[cnum]; |
Float_t spacep=1.5,space[cnum]; |
| 238 |
TCanvas *c[cnum]; |
TCanvas *c[cnum]; |
|
|
|
| 239 |
// |
// |
| 240 |
// create output canvas |
// create output canvas |
| 241 |
for(Int_t i=0;i<cnum;i++){ |
for(Int_t i=0;i<cnum;i++){ |
| 246 |
rep<<"FTrkCalibQLook_BASIC_pag"<<i+1; |
rep<<"FTrkCalibQLook_BASIC_pag"<<i+1; |
| 247 |
c[i]=new TCanvas(tit.str().c_str(),rep.str().c_str(),canvasx,canvasy); |
c[i]=new TCanvas(tit.str().c_str(),rep.str().c_str(),canvasx,canvasy); |
| 248 |
c[i]->Range(0,0,100,100); |
c[i]->Range(0,0,100,100); |
| 249 |
|
c[i]->SetFillColor(10); |
| 250 |
tzz->DrawLatex(1,98.5,fromfile.str().c_str()); |
tzz->DrawLatex(1,98.5,fromfile.str().c_str()); |
| 251 |
rep.str(""); |
rep.str(""); |
| 252 |
rep<<"CALIBRATION REPORT pag"<<i+1; |
rep<<"CALIBRATION REPORT pag"<<i+1; |
| 423 |
if(pedav[nn][ii]>pedlimsup[nn][ii] || pedav[nn][ii]<pedliminf[nn][ii]) flpedav[nn][ii]=1; |
if(pedav[nn][ii]>pedlimsup[nn][ii] || pedav[nn][ii]<pedliminf[nn][ii]) flpedav[nn][ii]=1; |
| 424 |
if(sigav[nn][ii]>siglimsup[nn][ii] || sigav[nn][ii]<sigliminf[nn][ii]) flsigav[nn][ii]=1; |
if(sigav[nn][ii]>siglimsup[nn][ii] || sigav[nn][ii]<sigliminf[nn][ii]) flsigav[nn][ii]=1; |
| 425 |
|
|
| 426 |
if(flpedav[nn][ii]==1){ |
if((nn==1 && ii==11)||(nn==6 && ii==2)||(nn==6 && ii==4)||(nn==6 && ii==5)||(nn==6 && ii==6)||(nn==6 && ii==10)||(nn==11 && ii==3)) |
| 427 |
ok=1; |
continue; |
| 428 |
if(space[wc]<=3){ |
else{ |
| 429 |
wc+=1; |
if(flpedav[nn][ii]==1){ |
| 430 |
flcanvas+=1; |
ok=1; |
| 431 |
|
if(space[wc]<=3){ |
| 432 |
|
wc+=1; |
| 433 |
|
flcanvas+=1; |
| 434 |
|
} |
| 435 |
|
c[wc]->cd(); |
| 436 |
|
tzz->SetTextFont(40); |
| 437 |
|
tzz->SetTextSize(0.02); |
| 438 |
|
tzz->SetTextAlign(13); |
| 439 |
|
tzz->SetTextColor(50); |
| 440 |
|
rep<<"********************************************************************************************************************************"; |
| 441 |
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
| 442 |
|
rep.str(""); |
| 443 |
|
space[wc]-=spacep; |
| 444 |
|
rep<<"WARNING >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<"-->DSP "<<nn+1<<" -VA1 "<<2*ii+1<<"-"<<2*ii+2<<" --> <PED>= "<<pedav[nn][ii]; |
| 445 |
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
| 446 |
|
rep.str(""); |
| 447 |
|
space[wc]-=spacep; |
| 448 |
} |
} |
| 449 |
c[wc]->cd(); |
|
| 450 |
tzz->SetTextFont(40); |
if(flsigav[nn][ii]==1){ |
| 451 |
tzz->SetTextSize(0.02); |
ok=1; |
| 452 |
tzz->SetTextAlign(13); |
if(space[wc]<=3){ |
| 453 |
tzz->SetTextColor(50); |
wc+=1; |
| 454 |
rep<<"********************************************************************************************************************************"; |
flcanvas+=1; |
| 455 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
} |
| 456 |
rep.str(""); |
c[wc]->cd(); |
| 457 |
space[wc]-=spacep; |
tzz->SetTextFont(40); |
| 458 |
rep<<"WARNING >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<"-->DSP "<<nn+1<<" -VA1 "<<2*ii+1<<"-"<<2*ii+2<<" --> <PED>= "<<pedav[nn][ii]; |
tzz->SetTextSize(0.02); |
| 459 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
tzz->SetTextAlign(13); |
| 460 |
rep.str(""); |
tzz->SetTextColor(50); |
| 461 |
space[wc]-=spacep; |
rep<<"********************************************************************************************************************************"; |
| 462 |
} |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
| 463 |
|
rep.str(""); |
| 464 |
if(flsigav[nn][ii]==1){ |
space[wc]-=spacep; |
| 465 |
ok=1; |
rep<<"WARNING >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<"-->DSP "<<nn+1<<" -VA1 "<<2*ii+1<<"-"<<2*ii+2<<" --> <SIG>= "<<sigav[nn][ii]; |
| 466 |
if(space[wc]<=3){ |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
| 467 |
wc+=1; |
rep.str(""); |
| 468 |
flcanvas+=1; |
space[wc]-=spacep; |
| 469 |
} |
} |
|
c[wc]->cd(); |
|
|
tzz->SetTextFont(40); |
|
|
tzz->SetTextSize(0.02); |
|
|
tzz->SetTextAlign(13); |
|
|
tzz->SetTextColor(50); |
|
|
rep<<"********************************************************************************************************************************"; |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
|
|
rep.str(""); |
|
|
space[wc]-=spacep; |
|
|
rep<<"WARNING >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<"-->DSP "<<nn+1<<" -VA1 "<<2*ii+1<<"-"<<2*ii+2<<" --> <SIG>= "<<sigav[nn][ii]; |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
|
|
rep.str(""); |
|
|
space[wc]-=spacep; |
|
| 470 |
} |
} |
| 471 |
} |
} |
| 472 |
} |
} |
| 473 |
} |
} |
| 474 |
|
if(ok==0 && ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
|
if(ok==0 && ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
|
| 475 |
if(space[wc]<=10){ |
if(space[wc]<=10){ |
| 476 |
wc+=1; |
wc+=1; |
| 477 |
flcanvas+=1; |
flcanvas+=1; |