| 1 |
/** |
/** |
| 2 |
* FTrkQLook_BASIC.cpp |
* FTrkQLook_BASIC.cxx |
| 3 |
* |
* |
| 4 |
* autor: D.Fedele |
* autor: D.Fedele |
| 5 |
* version 3.0 |
* version v1r06 |
| 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 |
| 17 |
#include <TCanvas.h> |
#include <TCanvas.h> |
| 18 |
#include <TGraph.h> |
#include <TGraph.h> |
| 19 |
#include <TStyle.h> |
#include <TStyle.h> |
| 20 |
|
#include <TFile.h> |
| 21 |
#include <TTree.h> |
#include <TTree.h> |
| 22 |
#include <TArrow.h> |
#include <TArrow.h> |
| 23 |
// |
// |
| 30 |
// |
// |
| 31 |
#define MAXSTORAGE 50000 |
#define MAXSTORAGE 50000 |
| 32 |
|
|
|
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
|
|
if ( to == 0 ){ |
|
|
Int_t t2length = s2.Length(); |
|
|
s1 = ""; |
|
|
to = t2length; |
|
|
}; |
|
|
for (Int_t i = from; i<to; i++){ |
|
|
s1.Append(s2[i],1); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
| 33 |
void FTrkQLook_BASIC(TString file,Int_t fromevent,Int_t toevent, TString outdir,TString outfile) |
void FTrkQLook_BASIC(TString file,Int_t fromevent,Int_t toevent, TString outdir,TString outfile) |
| 34 |
{ |
{ |
| 35 |
// |
// |
| 36 |
// obtain information about the data file and select the output dir |
// obtain information about the data file and select the output dir |
| 37 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
| 38 |
Int_t dwpos = filepath.rfind("/"); |
Int_t dwpos1 = file.Last('.'); |
|
Int_t dwpos1 = filepath.find(".root"); |
|
|
TString fpath=(filepath.c_str()); |
|
| 39 |
TString base,ffile ; |
TString base,ffile ; |
| 40 |
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
| 41 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
|
if(dwpos>0) base+="/"; |
|
| 42 |
|
|
| 43 |
TString out; |
TString out; |
| 44 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
| 46 |
}else{ |
}else{ |
| 47 |
out = outdir; |
out = outdir; |
| 48 |
} |
} |
| 49 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
| 50 |
|
|
| 51 |
// |
// |
| 52 |
// inizialise the variables and open the file |
// inizialise the variables and open the file |
| 113 |
stringstream oss,fromfile,isfile; |
stringstream oss,fromfile,isfile; |
| 114 |
// |
// |
| 115 |
// information about the RunHeader |
// information about the RunHeader |
| 116 |
Int_t HOBT[neventH]; |
ULong64_t HOBT[neventH]; |
| 117 |
Int_t trk_cal_us[neventH]; |
Int_t trk_cal_us[neventH]; |
| 118 |
for (Int_t vi=0; vi<neventH;vi++){ |
for (Int_t vi=0; vi<neventH;vi++){ |
| 119 |
HOBT[vi]=0; |
HOBT[vi]=0; |
| 136 |
|
|
| 137 |
// |
// |
| 138 |
// information about calibration OBT |
// information about calibration OBT |
| 139 |
Int_t COBT[neventC]; |
ULong64_t COBT[neventC]; |
| 140 |
for (Int_t vi=0; vi<neventC;vi++){ |
for (Int_t vi=0; vi<neventC;vi++){ |
| 141 |
COBT[vi]=0; |
COBT[vi]=0; |
| 142 |
} |
} |
| 260 |
t2->SetTextSize(0.08); |
t2->SetTextSize(0.08); |
| 261 |
|
|
| 262 |
Int_t i=0; |
Int_t i=0; |
| 263 |
Float_t x[MAXSTORAGE], xb[MAXSTORAGE]; |
Long64_t x[MAXSTORAGE], xb[MAXSTORAGE]; |
| 264 |
Float_t yyd[MAXSTORAGE][12],yyb[MAXSTORAGE][12]; |
Float_t yyd[MAXSTORAGE][12],yyb[MAXSTORAGE][12]; |
| 265 |
Int_t countbad[12]; |
Int_t countbad[12]; |
| 266 |
Float_t perc=0,xMIN=0.,xMAX=0.; |
Float_t perc=0,xMIN=0.,xMAX=0.; |
| 337 |
// Draw Histos |
// Draw Histos |
| 338 |
for (Int_t i=0; i<12 ; i++){ |
for (Int_t i=0; i<12 ; i++){ |
| 339 |
|
|
| 340 |
Float_t y[maxev-minev],yb[maxev-minev]; |
Double_t yd[maxev-minev],ybd[maxev-minev]; |
| 341 |
|
Double_t xd[maxev-minev],xbd[maxev-minev]; |
| 342 |
|
|
| 343 |
for(Int_t v=0;v<maxev-minev;v++){ |
for(Int_t v=0;v<maxev-minev;v++){ |
| 344 |
y[v]=yyd[v][i]; |
yd[v]=(Double_t)yyd[v][i]; |
| 345 |
yb[v]=yyb[v][i]; |
ybd[v]=(Double_t)yyb[v][i]; |
| 346 |
|
xd[v]=(Double_t)x[v]; |
| 347 |
|
xbd[v]=(Double_t)xb[v]; |
| 348 |
} |
} |
| 349 |
|
|
| 350 |
if(xMAX<1000000){ |
if(xMAX<1000000){ |
| 351 |
x[maxev-minev-1]=0.; |
xd[maxev-minev-1]=0; |
| 352 |
y[maxev-minev-1]=0.; |
yd[maxev-minev-1]=0.; |
| 353 |
} |
} |
| 354 |
|
|
| 355 |
if((maxev-minev)>1000){ |
if((maxev-minev)>1000){ |
| 367 |
pad[i][ii]->SetFrameFillColor(10); |
pad[i][ii]->SetFrameFillColor(10); |
| 368 |
pad[i][ii]->Draw(); |
pad[i][ii]->Draw(); |
| 369 |
pad[i][ii]->cd(); |
pad[i][ii]->cd(); |
| 370 |
dataletime[i][ii]= new TGraph((maxev-minev),x,y); |
dataletime[i][ii]= new TGraph((maxev-minev),xd,yd); |
| 371 |
dataletime[i][ii]->SetTitle(oss.str().c_str()); |
dataletime[i][ii]->SetTitle(oss.str().c_str()); |
| 372 |
dataletime[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
dataletime[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
| 373 |
dataletime[i][ii]->GetXaxis()->CenterTitle(); |
dataletime[i][ii]->GetXaxis()->CenterTitle(); |
| 378 |
else dataletime[i][ii]->GetYaxis()->SetRangeUser(0,4000); |
else dataletime[i][ii]->GetYaxis()->SetRangeUser(0,4000); |
| 379 |
dataletime[i][ii]->SetMarkerStyle(21); |
dataletime[i][ii]->SetMarkerStyle(21); |
| 380 |
if((maxev-minev)<50) dataletime[i][ii]->SetMarkerSize(0.5); |
if((maxev-minev)<50) dataletime[i][ii]->SetMarkerSize(0.5); |
| 381 |
else dataletime[i][ii]->SetMarkerSize(0.3); |
else dataletime[i][ii]->SetMarkerSize(0.1); |
| 382 |
dataletime[i][ii]->SetMarkerColor(4); |
dataletime[i][ii]->SetMarkerColor(4); |
| 383 |
dataletime[i][ii]->Draw("ap"); |
dataletime[i][ii]->Draw("ap"); |
| 384 |
|
|
| 385 |
|
|
| 386 |
if((maxev-minev)>1000 && perc>10){ |
if((maxev-minev)>1000 && perc>10){ |
| 387 |
dataletime1[i][ii]= new TGraph(countbad[i],xb,yb); |
dataletime1[i][ii]= new TGraph(countbad[i],xbd,ybd); |
| 388 |
dataletime1[i][ii]->SetMarkerStyle(21); |
dataletime1[i][ii]->SetMarkerStyle(21); |
| 389 |
if((maxev-minev)<50) dataletime1[i][ii]->SetMarkerSize(0.5); |
if((maxev-minev)<50) dataletime1[i][ii]->SetMarkerSize(0.5); |
| 390 |
else dataletime1[i][ii]->SetMarkerSize(0.3); |
else dataletime1[i][ii]->SetMarkerSize(0.1); |
| 391 |
dataletime1[i][ii]->SetMarkerColor(2); |
dataletime1[i][ii]->SetMarkerColor(2); |
| 392 |
dataletime1[i][ii]->Draw("psame"); |
dataletime1[i][ii]->Draw("psame"); |
| 393 |
} |
} |
| 394 |
else if((maxev-minev)<1000 && countbad[i]>=100){ |
else if((maxev-minev)<1000 && countbad[i]>=100){ |
| 395 |
dataletime1[i][ii]= new TGraph(countbad[i],xb,yb); |
dataletime1[i][ii]= new TGraph(countbad[i],xbd,ybd); |
| 396 |
dataletime1[i][ii]->SetMarkerStyle(21); |
dataletime1[i][ii]->SetMarkerStyle(21); |
| 397 |
if((maxev-minev)<50) dataletime1[i][ii]->SetMarkerSize(0.5); |
if((maxev-minev)<50) dataletime1[i][ii]->SetMarkerSize(0.5); |
| 398 |
else dataletime1[i][ii]->SetMarkerSize(0.3); |
else dataletime1[i][ii]->SetMarkerSize(0.1); |
| 399 |
dataletime1[i][ii]->SetMarkerColor(2); |
dataletime1[i][ii]->SetMarkerColor(2); |
| 400 |
dataletime1[i][ii]->Draw("psame"); |
dataletime1[i][ii]->Draw("psame"); |
| 401 |
} |
} |