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