2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 3.0 |
* version v1r06 |
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 |