1 |
/** |
/** |
2 |
* FTrkQLook_BASIC.cpp |
* FTrkQLook_BASIC.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v1r12 |
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> |
23 |
|
#include <TAxis.h> |
24 |
|
#include <TROOT.h> |
25 |
|
#include <cstdlib> |
26 |
|
#include <sys/stat.h> |
27 |
// |
// |
28 |
#include <physics/tracker/TrackerEvent.h> |
#include <physics/tracker/TrackerEvent.h> |
29 |
#include <PscuHeader.h> |
#include <PscuHeader.h> |
30 |
#include <EventHeader.h> |
#include <EventHeader.h> |
31 |
#include <RunHeaderEvent.h> |
#include <RunHeaderEvent.h> |
32 |
|
#include <EventCounter.h> |
33 |
|
#include <PacketType.h> |
34 |
// |
// |
35 |
|
#define MAXSTORAGE 50000 |
|
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); |
|
|
}; |
|
|
}; |
|
|
|
|
36 |
|
|
37 |
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) |
38 |
{ |
{ |
39 |
// |
// |
40 |
// obtain information about the data file and select the output dir |
// obtain information about the data file and select the output dir |
41 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
42 |
Int_t dwpos = filepath.rfind("DW_"); |
Int_t dwpos1 = file.Last('.'); |
|
Int_t dwpos1 = filepath.find(".root"); |
|
|
TString fpath=(filepath.c_str()); |
|
43 |
TString base,ffile ; |
TString base,ffile ; |
44 |
stringcopy(ffile,fpath,dwpos,dwpos1); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
45 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
46 |
|
|
47 |
TString out; |
TString out; |
48 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
50 |
}else{ |
}else{ |
51 |
out = outdir; |
out = outdir; |
52 |
} |
} |
53 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
54 |
|
|
55 |
// |
// |
56 |
// inizialise the variables and open the file |
// inizialise the variables and open the file |
57 |
pamela::tracker::TrackerEvent *te=0; |
pamela::tracker::TrackerEvent *te=0; |
58 |
pamela::EventHeader *eh=0,*eH=0; |
pamela::EventHeader *eh=0,*eH=0,*ceh=0; |
59 |
pamela::RunHeaderEvent *reh=0; |
pamela::RunHeaderEvent *reh=0; |
60 |
pamela::PscuHeader *ph=0,*pH=0; |
pamela::PscuHeader *ph=0,*pH=0; |
61 |
|
pamela::EventCounter *cod=0; |
62 |
|
|
63 |
|
pamela::PacketType *pctp=0; |
64 |
|
|
65 |
TFile *datafile = new TFile(file); |
TFile *datafile = new TFile(file); |
66 |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
69 |
TTree *tr = (TTree*)datafile->Get("Physics"); |
TTree *tr = (TTree*)datafile->Get("Physics"); |
70 |
tr->SetBranchAddress("Tracker",&te); |
tr->SetBranchAddress("Tracker",&te); |
71 |
tr->SetBranchAddress("Header",&eh); |
tr->SetBranchAddress("Header",&eh); |
72 |
|
TTree *ctr = (TTree*)datafile->Get("CalibTrk1"); |
73 |
|
ctr->SetBranchAddress("Header",&ceh); |
74 |
|
|
75 |
|
Long64_t neventC = ctr->GetEntries(); |
76 |
Long64_t nevent = tr->GetEntries(); |
Long64_t nevent = tr->GetEntries(); |
77 |
Long64_t neventH = otr->GetEntries(); |
Long64_t neventH = otr->GetEntries(); |
78 |
Int_t minevent=0; |
Int_t minevent=0; |
79 |
Int_t maxevent=0; |
Int_t maxevent=0; |
80 |
|
|
81 |
printf("Number of total events: %lld\nNumber of total header events: %lld\n",nevent,neventH); |
printf("Number of total events: %lld\nNumber of total header events: %lld\n",nevent,neventH); |
82 |
|
printf("Number of calibration events: %lld\n",neventC); |
83 |
|
|
84 |
if (nevent<=0){ |
if (nevent<=0){ |
85 |
datafile->Close(); |
datafile->Close(); |
107 |
} else if (toevent > nevent) { |
} else if (toevent > nevent) { |
108 |
maxevent = nevent; |
maxevent = nevent; |
109 |
} else { |
} else { |
110 |
maxevent = toevent+1; |
maxevent = nevent; |
111 |
} |
} |
112 |
nevent=maxevent-minevent ; |
nevent=maxevent-minevent ; |
113 |
} |
} |
115 |
// |
// |
116 |
// other variables definitions |
// other variables definitions |
117 |
stringstream oss,fromfile,isfile; |
stringstream oss,fromfile,isfile; |
118 |
const Int_t size=nevent; |
// |
119 |
Int_t dsp=0,count=0,trk_cal_us[50]; |
// information about the RunHeader |
120 |
Double_t perc; |
ULong_t HOBT[neventH]; |
121 |
Double_t yd[size*12], x[size+1]; |
Int_t trk_cal_us[neventH]; |
122 |
Double_t yyd[size+1],yyb[size], xb[size]; |
for (Int_t vi=0; vi<neventH;vi++){ |
123 |
ULong64_t HOBT[50]; |
HOBT[vi]=0; |
124 |
TGraph *dataletime,*dataletime1; |
trk_cal_us[vi]=0; |
|
|
|
|
for (Int_t i=0; i<50;i++){ |
|
|
HOBT[i]=0; |
|
|
trk_cal_us[i]=0; |
|
125 |
} |
} |
126 |
|
|
|
//*************************************************************************************** |
|
|
// LOOP on each event |
|
|
//*************************************************************************************** |
|
|
|
|
127 |
// |
// |
128 |
// information about trk_calib_used |
// information about RunHeader |
129 |
|
Int_t countnboot=1; |
130 |
for (Int_t ev=0; ev<neventH; ev++){ |
for (Int_t ev=0; ev<neventH; ev++){ |
131 |
otr->GetEntry(ev); |
otr->GetEntry(ev); |
132 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
133 |
HOBT[ev]= pH->GetOrbitalTime(); |
HOBT[ev]= pH->GetOrbitalTime(); |
134 |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
135 |
|
if((HOBT[ev]<HOBT[ev-1]) && ev>0) |
136 |
|
countnboot+=1; |
137 |
} |
} |
138 |
|
countnboot+=(Int_t)(2*nevent/MAXSTORAGE); |
139 |
|
// printf("\ncountnboot=%d\n",countnboot); |
140 |
|
|
141 |
// |
// |
142 |
// information about datalength |
// information about calibration OBT |
143 |
x[0]=(Double_t)HOBT[0]; |
ULong_t COBT[neventC]; |
144 |
for (Int_t ev=minevent; ev<maxevent; ev++){ |
for (Int_t vi=0; vi<neventC;vi++){ |
145 |
tr->GetEntry(ev); |
COBT[vi]=0; |
146 |
ph = eh->GetPscuHeader(); |
} |
147 |
|
for (Int_t ev=0; ev<neventC; ev++){ |
148 |
x[(ev-minevent)+1]= ph->GetOrbitalTime(); |
ctr->GetEntry(ev); |
149 |
dsp=0; |
pH = ceh->GetPscuHeader(); |
150 |
for(Int_t i=0; i<12; i++){ |
COBT[ev]= pH->GetOrbitalTime(); |
151 |
dsp=te->DSPnumber[i]-1; |
} |
|
yd[(ev-minevent)*12+dsp]= te->DATAlength[i]; |
|
|
} |
|
|
}; |
|
|
datafile->Close(); |
|
|
|
|
|
|
|
|
//**************************************************************************************** |
|
|
//Output figure |
|
|
//**************************************************************************************** |
|
|
|
|
|
TCanvas *DataTimeCanv=new TCanvas("Tracker_Detector_Report_","",900,1200); |
|
|
DataTimeCanv->SetFillColor(10); |
|
|
DataTimeCanv->Range(0,0,100,100); |
|
|
fromfile<<"FTrkQLook_BASIC File: "<<ffile; |
|
|
isfile<<"DATALENGTH vs. ORBITALTIME "; |
|
|
|
|
|
TLatex *t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextAlign(12); |
|
|
t->SetTextSize(0.02); |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
|
|
TLatex *t1=new TLatex(); |
|
|
t1->SetTextFont(32); |
|
|
t1->SetTextColor(1); |
|
|
t1->SetTextAlign(12); |
|
|
t1->SetTextSize(0.02); |
|
|
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
|
|
fromfile.str(""); |
|
|
isfile.str(""); |
|
|
|
|
152 |
|
|
153 |
//************************************************************************************* |
// |
154 |
//book pads and histos |
// Style options |
|
//*************************************************************************************** |
|
155 |
gStyle->SetLabelSize(0.06,"x"); |
gStyle->SetLabelSize(0.06,"x"); |
156 |
gStyle->SetLabelSize(0.06,"y"); |
gStyle->SetLabelSize(0.06,"y"); |
157 |
gStyle->SetStatFontSize(0.075); |
gStyle->SetStatFontSize(0.075); |
158 |
gStyle->SetOptStat(1110); |
gStyle->SetOptStat(10); |
159 |
gStyle->SetFillColor(10); |
gStyle->SetFillColor(10); |
160 |
gStyle->SetTitleFontSize(0.1); |
gStyle->SetTitleFontSize(0.1); |
161 |
|
gStyle->SetTitleFillColor(10); |
162 |
gStyle->SetTitleOffset(0.8,"y"); |
gStyle->SetTitleOffset(0.8,"y"); |
163 |
gStyle->SetTitleOffset(0.9,"x"); |
gStyle->SetTitleOffset(0.9,"x"); |
164 |
gStyle->SetTitleSize(0.06,"y"); |
gStyle->SetTitleSize(0.06,"y"); |
165 |
gStyle->SetTitleSize(0.055,"x"); |
gStyle->SetTitleSize(0.055,"x"); |
166 |
|
|
167 |
TPad *pad[12]; //pad for histos |
//*************************************************************************************** |
168 |
Double_t posy = 0.95; // up y-coord - top pads |
// LOOP on each event |
169 |
Double_t hpad = 0; // pad height |
//*************************************************************************************** |
|
Double_t posx1=0; // left x-coord - pad column |
|
|
Double_t posx0=0; // x-coord - column division |
|
|
Double_t wrel = 0; // relative x size of first sub-column |
|
|
Double_t marg = 0.004; // margin among pads |
|
|
|
|
|
hpad = (posy-marg*11)/6; |
|
|
wrel = (1-marg*4)/2; |
|
|
stringstream title; |
|
|
stringstream hid; |
|
|
|
|
|
for(Int_t n = 0; n<12; n++) { |
|
|
if ( (n+1)%2==1 ) { |
|
|
if(n>1) posy = posy-(marg*2+hpad); |
|
|
posx1 = marg; |
|
|
posx0 = posx1 + wrel; |
|
|
} |
|
|
else { |
|
|
posx1 = posx0 + 2*marg; |
|
|
posx0 = posx1 + wrel; |
|
|
} |
|
170 |
|
|
171 |
/* -----------> pad for histograms */ |
if (fromevent!=0) |
172 |
pad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
printf("\n Scan of events from %i to %i ... \n",minevent,maxevent-1); |
173 |
}; |
else |
174 |
|
printf("\n Scan of events from %i to %i ... \n",minevent+1,maxevent); |
175 |
|
|
176 |
TLine li; |
|
177 |
li.SetLineColor(1); |
Int_t minev=minevent,maxev=maxevent,hin=0,hfin=0,cin=0,cfin=0; |
178 |
li.SetLineStyle(1); |
TPad *pad[12][countnboot]; |
179 |
li.SetLineWidth(1); |
TGraph *dataletime[12][countnboot],*dataletime1[12][countnboot]; |
180 |
//********************************************************************************** |
TCanvas *DataTimeCanv[countnboot]; |
181 |
// Fill Graphs and Histos |
for(Int_t ii=0; ii<countnboot;ii++){ |
182 |
//********************************************************************************** |
fromfile<<"FTrkQLook_BASIC File: "<<ffile; |
183 |
stringstream calus; |
isfile<<"DATALENGTH vs. OBT pag"<<ii+1; |
184 |
TLatex *t2=new TLatex(); |
DataTimeCanv[ii]=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
185 |
t2->SetTextFont(32); |
DataTimeCanv[ii]->SetFillColor(10); |
186 |
t2->SetTextColor(1); |
DataTimeCanv[ii]->Range(0,0,100,100); |
187 |
t2->SetTextAlign(13); |
|
188 |
t2->SetTextSize(0.08); |
TLatex *t=new TLatex(); |
189 |
|
t->SetTextFont(32); |
190 |
for (Int_t i=0; i<12 ; i++){ |
t->SetTextColor(1); |
191 |
perc=0; |
t->SetTextAlign(12); |
192 |
count=0; |
t->SetTextSize(0.02); |
193 |
yyd[0]=-10000.; |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
194 |
for (Int_t ev=minevent; ev<maxevent; ev++){ |
TLatex *t1=new TLatex(); |
195 |
yyd[(ev-minevent)+1]=yd[12*(ev-minevent)+i]; |
t1->SetTextFont(32); |
196 |
if(i==6){ |
t1->SetTextColor(1); |
197 |
if(yyd[(ev-minevent)+1]>1500){ |
t1->SetTextAlign(12); |
198 |
if(yyd[(ev-minevent)+1]<3075){ |
t1->SetTextSize(0.02); |
199 |
yyb[count]= yyd[(ev-minevent)+1]; |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
200 |
xb[count]= x[(ev-minevent)+1]; |
fromfile.str(""); |
201 |
count++; |
isfile.str(""); |
202 |
} |
|
203 |
} |
fromfile<<"D = Default Calibration"; |
204 |
|
isfile<<"O = OnLine Calibration"; |
205 |
|
t->SetTextColor(6); |
206 |
|
t->SetTextSize(0.018); |
207 |
|
t->DrawLatex(70.,97.,fromfile.str().c_str()); |
208 |
|
t->SetTextColor(3); |
209 |
|
t->DrawLatex(70.,96.,isfile.str().c_str()); |
210 |
|
fromfile.str(""); |
211 |
|
isfile.str(""); |
212 |
|
|
213 |
|
fromfile<<"The green arrow (if present) points out the time of the online calibration"; |
214 |
|
t->DrawLatex(7.,96.,fromfile.str().c_str()); |
215 |
|
fromfile.str(""); |
216 |
|
|
217 |
|
//************************************************************************************* |
218 |
|
//book pads and histos |
219 |
|
//*************************************************************************************** |
220 |
|
|
221 |
|
|
222 |
|
Float_t posy = 0.95; // up y-coord - top pads |
223 |
|
Float_t hpad = 0; // pad height |
224 |
|
Float_t posx1=0; // left x-coord - pad column |
225 |
|
Float_t posx0=0; // x-coord - column division |
226 |
|
Float_t wrel = 0; // relative x size of first sub-column |
227 |
|
Float_t marg = 0.004; // margin among pads |
228 |
|
|
229 |
|
hpad = (posy-marg*11)/6; |
230 |
|
wrel = (1-marg*4)/2; |
231 |
|
stringstream title; |
232 |
|
stringstream hid; |
233 |
|
|
234 |
|
for(Int_t n = 0; n<12; n++) { |
235 |
|
if ( (n+1)%2==1 ) { |
236 |
|
if(n>1) posy = posy-(marg*2+hpad); |
237 |
|
posx1 = marg; |
238 |
|
posx0 = posx1 + wrel; |
239 |
|
} |
240 |
|
else { |
241 |
|
posx1 = posx0 + 2*marg; |
242 |
|
posx0 = posx1 + wrel; |
243 |
|
} |
244 |
|
|
245 |
|
/* -----------> pad for histograms */ |
246 |
|
oss<<"pad"<<n*100+ii; |
247 |
|
pad[n][ii]=new TPad(oss.str().c_str()," ",posx1,posy-hpad,posx0,posy,18,0,0); |
248 |
|
oss.str(""); |
249 |
|
}; |
250 |
|
|
251 |
|
TLine li; |
252 |
|
li.SetLineColor(1); |
253 |
|
li.SetLineStyle(1); |
254 |
|
li.SetLineWidth(1); |
255 |
|
|
256 |
|
TArrow ar; |
257 |
|
ar.SetLineColor(3); |
258 |
|
stringstream calus; |
259 |
|
|
260 |
|
TLatex *t2=new TLatex(); |
261 |
|
t2->SetTextFont(32); |
262 |
|
t2->SetTextColor(1); |
263 |
|
t2->SetTextAlign(13); |
264 |
|
t2->SetTextSize(0.08); |
265 |
|
|
266 |
|
Int_t i=0; |
267 |
|
ULong_t x[MAXSTORAGE], xb[MAXSTORAGE]; |
268 |
|
Float_t yyd[MAXSTORAGE][12],yyb[MAXSTORAGE][12]; |
269 |
|
Int_t countbad[12]; |
270 |
|
Float_t perc=0; |
271 |
|
Double_t xMIN=0.,xMAX=0.; |
272 |
|
for (Int_t n=0; n<12 ; n++) |
273 |
|
countbad[n]=0; |
274 |
|
|
275 |
|
// |
276 |
|
// obtain values of the datalenght |
277 |
|
for (Int_t ev=minev; ev<maxevent; ev++){ |
278 |
|
tr->GetEntry(ev); |
279 |
|
ph = eh->GetPscuHeader(); |
280 |
|
cod = eh->GetCounter(); |
281 |
|
|
282 |
|
if(ev==minev){ |
283 |
|
if(cod->Get(pctp->CalibTrk1)>0) cin=cod->Get(pctp->CalibTrk1)-1; |
284 |
|
else cin=cod->Get(pctp->CalibTrk1); |
285 |
|
if(cin==cfin-1) cin+=1; |
286 |
|
|
287 |
|
if(cod->Get(pctp->RunHeader)>0) hin=cod->Get(pctp->RunHeader)-1; |
288 |
|
else hin=cod->Get(pctp->RunHeader); |
289 |
|
if(hin==hfin-1) hin+=1; |
290 |
|
} |
291 |
|
|
292 |
|
if(ev==maxevent-1) maxev=maxevent-1; |
293 |
|
|
294 |
|
if(((ULong_t)ph->GetOrbitalTime()<x[ev-minev-1] && ev-minev!=0) || ev-minev==MAXSTORAGE){ |
295 |
|
maxev=ev; |
296 |
|
break; |
297 |
} |
} |
298 |
else{ |
else{ |
299 |
if(yyd[(ev-minevent)+1]>750){ |
cfin=cod->Get(pctp->CalibTrk1); |
300 |
if(yyd[(ev-minevent)+1]<3075){ |
hfin=cod->Get(pctp->RunHeader); |
301 |
yyb[count]= yyd[(ev-minevent)+1]; |
x[(ev-minev)]= ph->GetOrbitalTime(); |
302 |
xb[count]= x[(ev-minevent)+1]; |
i=0; |
303 |
count++; |
|
304 |
|
for (Int_t n=0; n<12 ; n++){ |
305 |
|
i=te->DSPnumber[n]-1; |
306 |
|
if(i>=0){ |
307 |
|
if(i<12){ |
308 |
|
yyb[countbad[i]][i]=0; |
309 |
|
xb[countbad[i]]= 0; |
310 |
|
|
311 |
|
yyd[(ev-minev)][i]=te->DATAlength[n]; |
312 |
|
if(i==6){ |
313 |
|
if(yyd[(ev-minev)][i]>1500){ |
314 |
|
if(yyd[(ev-minev)][i]<3075){ |
315 |
|
yyb[countbad[i]][i]= yyd[(ev-minev)][i]; |
316 |
|
xb[countbad[i]]= x[(ev-minev)]; |
317 |
|
countbad[i]+=1; |
318 |
|
} |
319 |
|
} |
320 |
|
} |
321 |
|
else{ |
322 |
|
if(yyd[(ev-minev)][i]>750){ |
323 |
|
if(yyd[(ev-minev)][i]<3075){ |
324 |
|
yyb[countbad[i]][i]= yyd[(ev-minev)][i]; |
325 |
|
xb[countbad[i]]= x[(ev-minev)]; |
326 |
|
countbad[i]+=1; |
327 |
|
} |
328 |
|
} |
329 |
|
} |
330 |
|
} |
331 |
} |
} |
332 |
} |
} |
333 |
} |
} |
334 |
} |
} |
335 |
|
|
336 |
if((maxevent-minevent)>100) perc=(count*100)/(maxevent-minevent); |
// |
337 |
else perc=(count*10)/(maxevent-minevent); |
// define limit for the Xaxis of the graphs |
338 |
|
|
339 |
|
xMAX=x[maxev-minev-1]+(x[maxev-minev-1]-x[0])/10; |
340 |
|
if(xMAX>1000000) xMIN=x[0]-(x[maxev-minev-1]-x[0])/10; |
341 |
|
if(xMAX<1000000 || xMIN<0) xMIN=0.; |
342 |
|
if(xMIN==xMAX) xMIN=x[0] * x[0]/xMAX; |
343 |
|
|
344 |
|
|
345 |
|
// |
346 |
|
// Draw Histos |
347 |
|
for (Int_t n=0; n<12 ; n++){ |
348 |
|
|
349 |
|
Double_t yd[maxev-minev],ybd[maxev-minev]; |
350 |
|
Double_t xd[maxev-minev],xbd[maxev-minev]; |
351 |
|
|
352 |
|
for(Int_t v=0;v<maxev-minev;v++){ |
353 |
|
yd[v]=(Double_t)yyd[v][n]; |
354 |
|
ybd[v]=(Double_t)yyb[v][n]; |
355 |
|
xd[v]=(Double_t)x[v]; |
356 |
|
xbd[v]=(Double_t)xb[v]; |
357 |
|
} |
358 |
|
|
359 |
|
if(xMAX<1000000){ |
360 |
|
xd[maxev-minev-1]=0; |
361 |
|
yd[maxev-minev-1]=0.; |
362 |
|
} |
363 |
|
|
364 |
|
if((maxev-minev)>1000){ |
365 |
|
perc=(countbad[n]*100)/(maxev-minev); |
366 |
|
if(perc>10) pad[n][ii]->SetFillColor(2); |
367 |
|
else pad[n][ii]->SetFillColor(10); |
368 |
|
|
369 |
|
} |
370 |
|
else{ |
371 |
|
if(countbad[n]>=100) pad[n][ii]->SetFillColor(2); |
372 |
|
else pad[n][ii]->SetFillColor(10); |
373 |
|
} |
374 |
|
|
375 |
|
oss<<"DSP "<<n+1; |
376 |
|
DataTimeCanv[ii]->cd(); |
377 |
|
pad[n][ii]->SetFrameFillColor(10); |
378 |
|
pad[n][ii]->Draw(); |
379 |
|
pad[n][ii]->cd(); |
380 |
|
dataletime[n][ii]= new TGraph((maxev-minev),xd,yd); |
381 |
|
if(maxev-minev==1) dataletime[n][ii]->GetXaxis()->SetNdivisions(-501); |
382 |
|
dataletime[n][ii]->SetTitle(oss.str().c_str()); |
383 |
|
dataletime[n][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
384 |
|
dataletime[n][ii]->GetXaxis()->CenterTitle(); |
385 |
|
dataletime[n][ii]->GetXaxis()->SetRangeUser(xMIN,xMAX); |
386 |
|
dataletime[n][ii]->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
387 |
|
dataletime[n][ii]->GetYaxis()->CenterTitle(); |
388 |
|
if(i==6) dataletime[n][ii]->GetYaxis()->SetRangeUser(0,4500); |
389 |
|
else dataletime[n][ii]->GetYaxis()->SetRangeUser(0,4000); |
390 |
|
dataletime[n][ii]->SetMarkerStyle(21); |
391 |
|
if((maxev-minev)<50) dataletime[n][ii]->SetMarkerSize(0.5); |
392 |
|
else dataletime[n][ii]->SetMarkerSize(0.1); |
393 |
|
dataletime[n][ii]->SetMarkerColor(4); |
394 |
|
dataletime[n][ii]->Draw("ap"); |
395 |
|
|
396 |
|
|
397 |
|
if((maxev-minev)>1000 && perc>10){ |
398 |
|
dataletime1[n][ii]= new TGraph(countbad[n],xbd,ybd); |
399 |
|
dataletime1[n][ii]->SetMarkerStyle(21); |
400 |
|
dataletime1[n][ii]->SetMarkerSize(0.1); |
401 |
|
dataletime1[n][ii]->SetMarkerColor(2); |
402 |
|
dataletime1[n][ii]->Draw("psame"); |
403 |
|
} |
404 |
|
else if((maxev-minev)<1000 && countbad[n]>=100){ |
405 |
|
dataletime1[n][ii]= new TGraph(countbad[n],xbd,ybd); |
406 |
|
dataletime1[n][ii]->SetMarkerStyle(21); |
407 |
|
if((maxev-minev)<50) dataletime1[n][ii]->SetMarkerSize(0.5); |
408 |
|
else dataletime1[n][ii]->SetMarkerSize(0.1); |
409 |
|
dataletime1[n][ii]->SetMarkerColor(2); |
410 |
|
dataletime1[n][ii]->Draw("psame"); |
411 |
|
} |
412 |
|
li.SetLineColor(1); |
413 |
|
li.SetLineStyle(1); |
414 |
|
li.SetLineWidth(1); |
415 |
|
if(i!=6) li.DrawLine(xMIN,750,xMAX,750); |
416 |
|
else li.DrawLine(xMIN,1500,xMAX,1500); |
417 |
|
li.DrawLine(xMIN,3075,xMAX,3075); |
418 |
|
|
|
Double_t min,max; |
|
|
if((maxevent-minevent)<100){ |
|
|
min=x[0]; |
|
|
max=x[size]*1.0001; |
|
|
} |
|
|
else{ |
|
|
min=x[0]; |
|
|
max=x[size-1]*1.0005; |
|
|
} |
|
|
oss<<"DSP "<<i+1; |
|
|
DataTimeCanv->cd(); |
|
|
if(perc>1) pad[i]->SetFillColor(2); |
|
|
else pad[i]->SetFillColor(10); |
|
|
pad[i]->SetFrameFillColor(10); |
|
|
pad[i]->Draw(); |
|
|
pad[i]->cd(); |
|
|
dataletime= new TGraph((maxevent-minevent)+1,x,yyd); |
|
|
dataletime->SetTitle(oss.str().c_str()); |
|
|
dataletime->GetXaxis()->SetTitle("OBT (ms)"); |
|
|
dataletime->GetXaxis()->CenterTitle(); |
|
|
dataletime->GetXaxis()->SetRangeUser(min,max); |
|
|
dataletime->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
|
|
dataletime->GetYaxis()->CenterTitle(); |
|
|
dataletime->GetYaxis()->SetRangeUser(0,3500); |
|
|
dataletime->SetMarkerStyle(21); |
|
|
if((maxevent-minevent)<50) dataletime->SetMarkerSize(0.5); |
|
|
else dataletime->SetMarkerSize(0.3); |
|
|
dataletime->SetMarkerColor(1); |
|
|
dataletime->Draw("ap"); |
|
|
if(perc>1){ |
|
|
dataletime1= new TGraph(count,xb,yyb); |
|
|
dataletime1->SetMarkerStyle(21); |
|
|
if((maxevent-minevent)<50) dataletime1->SetMarkerSize(0.5); |
|
|
else dataletime1->SetMarkerSize(0.3); |
|
|
dataletime1->SetMarkerColor(2); |
|
|
dataletime1->Draw("psame"); |
|
|
} |
|
|
li.SetLineColor(1); |
|
|
li.SetLineStyle(1); |
|
|
li.SetLineWidth(1); |
|
|
if(i!=6) li.DrawLine(min,750,max,750); |
|
|
else li.DrawLine(min,1500,max,1500); |
|
|
li.DrawLine(min,3075,max,3075); |
|
|
for(Int_t j=0;j<neventH;j++){ |
|
419 |
li.SetLineColor(12); |
li.SetLineColor(12); |
420 |
li.SetLineStyle(4); |
li.SetLineStyle(4); |
421 |
li.SetLineWidth(1); |
li.SetLineWidth(1); |
422 |
li.DrawLine(HOBT[j],0.,HOBT[j],3500.); |
for(Int_t j=hin;j<hfin;j++){ |
423 |
if(trk_cal_us[j]==104){ |
if(i==6) li.DrawLine(HOBT[j],0.,HOBT[j],4500.); |
424 |
calus<<"D"; |
else li.DrawLine(HOBT[j],0.,HOBT[j],4000.); |
425 |
t2->SetTextColor(6); |
if(trk_cal_us[j]==104){ |
426 |
t2->DrawLatex(HOBT[j],3350.,calus.str().c_str()); |
calus<<"D"; |
427 |
calus.str(""); |
t2->SetTextColor(6); |
428 |
} |
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
429 |
else{ |
else t2->DrawLatex(HOBT[j],3850.,calus.str().c_str()); |
430 |
calus<<trk_cal_us[j]; |
calus.str(""); |
431 |
t2->SetTextColor(3); |
} |
432 |
t2->DrawLatex(HOBT[j],3350.,calus.str().c_str()); |
else{ |
433 |
calus.str(""); |
calus<<"O"; |
434 |
|
t2->SetTextColor(3); |
435 |
|
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
436 |
|
else t2->DrawLatex(HOBT[j],3850.,calus.str().c_str()); |
437 |
|
calus.str(""); |
438 |
|
} |
439 |
|
} |
440 |
|
for(Int_t j=cin;j<cfin;j++){ |
441 |
|
if(i==6) ar.DrawArrow(COBT[j],1700.,COBT[j],2700.,0.01,"<"); |
442 |
|
else ar.DrawArrow(COBT[j],1000.,COBT[j],2000.,0.01,"<"); |
443 |
} |
} |
444 |
|
|
445 |
|
oss.str(""); |
446 |
|
DataTimeCanv[ii]->Update(); |
447 |
} |
} |
448 |
oss.str(""); |
|
449 |
}; |
minev=maxev; |
450 |
|
if(maxev==maxevent-1) { |
451 |
DataTimeCanv->Update(); |
countnboot=ii+1; |
452 |
|
break; |
453 |
|
} |
454 |
|
} |
455 |
printf("... end of packets. \n"); |
printf("... end of packets. \n"); |
456 |
|
|
457 |
//************************************************************************* |
//************************************************************************* |
458 |
// Save output Files |
// Save output Files |
459 |
//************************************************************************* |
//************************************************************************* |
460 |
stringstream out1; |
stringstream nom1,nom2,nom3; |
461 |
|
|
462 |
|
for(Int_t fl=0;fl<countnboot;fl++){ |
463 |
|
if(countnboot==1){ |
464 |
|
nom1<<ffile<<"_FTrkQLook_BASIC."<<outfile.Data(); |
465 |
|
DataTimeCanv[fl]->Print(out+nom1.str().c_str()); |
466 |
|
nom1.str(""); |
467 |
|
} |
468 |
|
|
469 |
|
if(countnboot>=2){ |
470 |
|
if(!strcmp(outfile.Data(),"ps") || !strcmp(outfile.Data(),"pdf")){ |
471 |
|
nom1.str(""); |
472 |
|
nom2.str(""); |
473 |
|
nom3.str(""); |
474 |
|
nom1<<ffile<<"_FTrkQLook_BASIC.ps("; |
475 |
|
nom2<<ffile<<"_FTrkQLook_BASIC.ps"; |
476 |
|
nom3<<ffile<<"_FTrkQLook_BASIC.ps)"; |
477 |
|
if(fl==0) DataTimeCanv[fl]->Print(out+nom1.str().c_str(),"portrait"); |
478 |
|
else if(fl==countnboot-1) DataTimeCanv[fl]->Print(out+nom3.str().c_str(),"portrait"); |
479 |
|
else DataTimeCanv[fl]->Print(out+nom2.str().c_str(),"portrait"); |
480 |
|
|
481 |
|
} |
482 |
|
else{ |
483 |
|
nom1.str(""); |
484 |
|
nom1<<ffile<<"_FTrkQLook_BASIC-pag"<<fl+1<<"."<<outfile.Data(); |
485 |
|
DataTimeCanv[fl]->Print(out+nom1.str().c_str()); |
486 |
|
} |
487 |
|
} |
488 |
|
} |
489 |
|
|
490 |
out1<<ffile<<"_FTrkQLook_BASIC."<<outfile.Data(); |
// |
491 |
DataTimeCanv->Print(out+out1.str().c_str()); |
// Convert ps to pdf if required |
492 |
out1.str(""); |
if(!strcmp(outfile.Data(),"pdf") && countnboot>=2){ |
493 |
|
stringstream com; |
494 |
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_BASIC.ps "<<out<<ffile<<"_FTrkQLook_BASIC.pdf"; |
495 |
|
system(com.str().c_str()); |
496 |
|
printf("\n---> ps file converted in pdf format!\n"); |
497 |
|
com.str(""); |
498 |
|
com<<"rm -f "<<out<<ffile<<"_FTrkQLook_BASIC.ps"; |
499 |
|
system(com.str().c_str()); |
500 |
|
printf("---> ps file removed!\n\n"); |
501 |
|
com.str(""); |
502 |
|
} |
503 |
|
|
504 |
|
datafile->Close(); |
505 |
gROOT->Reset(); |
gROOT->Reset(); |
506 |
return; |
return; |
507 |
} |
} |