2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 3.0 |
* version v1r10 |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the path to the root file to analyze |
* file - the path to the root file to analyze |
8 |
* outdir - total path of output file |
* outdir - total path of output file |
19 |
#include <TLatex.h> |
#include <TLatex.h> |
20 |
#include <TCanvas.h> |
#include <TCanvas.h> |
21 |
#include <TGraph.h> |
#include <TGraph.h> |
22 |
|
#include <TFile.h> |
23 |
#include <TTree.h> |
#include <TTree.h> |
24 |
#include <TStyle.h> |
#include <TStyle.h> |
25 |
#include <TString.h> |
#include <TString.h> |
117 |
} |
} |
118 |
} |
} |
119 |
|
|
|
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); |
|
|
} |
|
|
} |
|
|
|
|
120 |
|
|
121 |
void FTrkScanQLook_EXPERT(TString file, TString outdir,Int_t event, Int_t DSPprint, TString outfile) |
void FTrkScanQLook_EXPERT(TString file, TString outdir,Int_t event, Int_t DSPprint, TString outfile) |
122 |
{ |
{ |
123 |
|
|
124 |
// |
// |
125 |
// obtain information about the data file and select the output file |
// obtain information about the data file and select the output file |
126 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
127 |
Int_t dwpos = filepath.rfind("/"); |
Int_t dwpos1 = file.Last('.'); |
|
Int_t dwpos1 = filepath.find(".root"); |
|
|
TString fpath=(filepath.c_str()); |
|
128 |
TString base,ffile ; |
TString base,ffile ; |
129 |
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
130 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
|
if(dwpos>0) base+="/"; |
|
131 |
|
|
132 |
TString out; |
TString out; |
133 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
135 |
}else{ |
}else{ |
136 |
out = outdir; |
out = outdir; |
137 |
} |
} |
138 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
139 |
|
|
140 |
pamela::tracker::TrackerEvent *trk=0; |
pamela::tracker::TrackerEvent *trk=0; |
141 |
pamela::EventHeader *eh=0,*eH=0; |
pamela::EventHeader *eh=0,*eH=0; |
173 |
printf(" Number of Header Entries: %d\n",neventH); |
printf(" Number of Header Entries: %d\n",neventH); |
174 |
|
|
175 |
Long64_t obt=0; |
Long64_t obt=0; |
176 |
|
Int_t ev[2]; |
177 |
|
TString cal=""; |
178 |
|
|
179 |
|
ev[0]=0; |
180 |
|
ev[1]=0; |
181 |
for(Int_t i=0;i<neventH;i++){ |
for(Int_t i=0;i<neventH;i++){ |
182 |
otr->GetEntry(i); |
otr->GetEntry(i); |
183 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
184 |
if(reh->TRK_CALIB_USED!=104){ |
if(reh->TRK_CALIB_USED!=104){ |
185 |
obt = pH->GetOrbitalTime(); |
obt = pH->GetOrbitalTime(); |
186 |
|
cal="Event with online calibration"; |
187 |
break; |
break; |
188 |
} |
} |
189 |
if(i==neventH-1){ |
if(i==neventH-1){ |
190 |
printf("\n\n ****** ONLINE CALIBRATION NOT FOUND IN THIS FILE ******\n\n"); |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
191 |
return; |
ev[0]=2; |
192 |
|
ev[1]=3; |
193 |
} |
} |
194 |
} |
} |
195 |
Int_t ev[2]; |
if(ev[0]==0){ |
196 |
for(Int_t i=0;i<nevents;i++){ |
for(Int_t i=0;i<nevents;i++){ |
197 |
tr->GetEntry(i); |
tr->GetEntry(i); |
198 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
199 |
if(ph->GetOrbitalTime()>obt){ |
if(ph->GetOrbitalTime()>obt){ |
200 |
ev[0]=i+2; |
ev[0]=i+2; |
201 |
ev[1]=i+3; |
ev[1]=i+3; |
202 |
break; |
break; |
203 |
|
} |
204 |
} |
} |
205 |
} |
} |
206 |
|
|
212 |
|
|
213 |
for(Int_t e=0;e<2;e++){ |
for(Int_t e=0;e<2;e++){ |
214 |
event=ev[e]; |
event=ev[e]; |
215 |
printf("Scan of Entry %d\n",event-1); |
printf("Scan of Entry %d\n",event); |
216 |
|
|
217 |
tr->GetEntry(event-1); |
tr->GetEntry(event); |
218 |
//============================================================================ |
//============================================================================ |
219 |
|
|
220 |
gStyle->SetLabelSize(0.06,"x"); |
gStyle->SetLabelSize(0.06,"x"); |
236 |
c1[e]->SetFillColor(10); |
c1[e]->SetFillColor(10); |
237 |
c1[e]->Range(0,0,1,1); |
c1[e]->Range(0,0,1,1); |
238 |
stringstream fromfile; |
stringstream fromfile; |
239 |
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event-1; |
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event; |
240 |
TLatex *t=new TLatex(); |
TLatex *t=new TLatex(); |
241 |
t->SetTextFont(32); |
t->SetTextFont(32); |
242 |
t->SetTextColor(1); |
t->SetTextColor(1); |
243 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
244 |
t->SetTextSize(0.02); |
t->SetTextSize(0.02); |
245 |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
246 |
|
t->DrawLatex(0.60,0.98,cal.Data()); |
247 |
|
|
248 |
// draw pads |
// draw pads |
249 |
TPad *trkpad[12]; //pad for histos |
TPad *trkpad[12]; //pad for histos |
462 |
} |
} |
463 |
|
|
464 |
TBox b; |
TBox b; |
|
b.SetFillColor(6); |
|
|
b.SetFillStyle(3945); |
|
465 |
|
|
466 |
c1[e]->cd(); |
c1[e]->cd(); |
467 |
trkpadtext[nn]->Draw(); |
trkpadtext[nn]->Draw(); |
490 |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
491 |
histocomp[nn][e]->Draw("axis same"); |
histocomp[nn][e]->Draw("axis same"); |
492 |
if(nn==1){ |
if(nn==1){ |
493 |
b.DrawBox(2816.,-500.,3060.,4500.); |
b.SetFillColor(6); |
494 |
|
b.SetFillStyle(3945); |
495 |
|
b.DrawBox(2944.,-500.,3060.,4500.); |
496 |
|
|
497 |
|
b.SetFillColor(107); |
498 |
|
b.SetFillStyle(3954); |
499 |
|
b.DrawBox(2816.,-500.,2944.,4500.); |
500 |
|
b.DrawBox(2048.,-500.,2176.,4500.); |
501 |
|
} |
502 |
|
else if(nn==4){ |
503 |
|
b.SetFillColor(107); |
504 |
|
b.SetFillStyle(3954); |
505 |
|
b.DrawBox(384.,-500.,512.,4500.); |
506 |
} |
} |
507 |
else if(nn==6){ |
else if(nn==6){ |
508 |
|
b.SetFillColor(6); |
509 |
|
b.SetFillStyle(3945); |
510 |
b.DrawBox(2560.,-500.,2816.,4500.); |
b.DrawBox(2560.,-500.,2816.,4500.); |
511 |
|
b.DrawBox(1024.,-500.,1535.,4500.); |
512 |
|
|
513 |
|
b.SetFillColor(107); |
514 |
|
b.SetFillStyle(3954); |
515 |
|
b.DrawBox(512.,-500.,768.,4500.); |
516 |
|
b.DrawBox(1536.,-500.,1792.,4500.); |
517 |
|
} |
518 |
|
else if(nn==7){ |
519 |
|
b.SetFillColor(107); |
520 |
|
b.SetFillStyle(3954); |
521 |
b.DrawBox(512.,-500.,768.,4500.); |
b.DrawBox(512.,-500.,768.,4500.); |
|
b.DrawBox(1024.,-500.,1792.,4500.); |
|
522 |
} |
} |
523 |
else if(nn==11){ |
else if(nn==11){ |
524 |
|
b.SetFillColor(6); |
525 |
|
b.SetFillStyle(3945); |
526 |
b.DrawBox(768.,-500.,1024.,4500.); |
b.DrawBox(768.,-500.,1024.,4500.); |
527 |
|
|
528 |
|
b.SetFillColor(107); |
529 |
|
b.SetFillStyle(3954); |
530 |
|
b.DrawBox(0.,-500.,512.,4500); |
531 |
|
b.DrawBox(1920.,-500.,2048.,4500); |
532 |
|
b.DrawBox(2176.,-500.,2304.,4500); |
533 |
} |
} |
534 |
c1[e]->Update(); |
c1[e]->Update(); |
535 |
|
|