1 |
pam-fi |
1.1 |
/** |
2 |
|
|
* FTrkCalibQLookExpert.cpp |
3 |
|
|
* |
4 |
|
|
* autor: D.Fedele |
5 |
|
|
* version 2.0 |
6 |
|
|
* Parameters: |
7 |
|
|
* file - the data file to analyze |
8 |
|
|
* step - select =1 in order to analyze one event at time |
9 |
|
|
* fromevent - first event to analyze |
10 |
|
|
* toevent - last event to analyze |
11 |
|
|
* outdir - total path of output file |
12 |
|
|
* outfile - extension of output file (pdf,ps,gif,jpg) |
13 |
|
|
* |
14 |
|
|
*/ |
15 |
|
|
// |
16 |
|
|
#include <iostream> |
17 |
|
|
// |
18 |
|
|
#include <TPaveText.h> |
19 |
|
|
#include <TLatex.h> |
20 |
|
|
#include <TCanvas.h> |
21 |
|
|
#include <TTree.h> |
22 |
|
|
#include <TGraph.h> |
23 |
|
|
#include <TStyle.h> |
24 |
|
|
#include <TString.h> |
25 |
|
|
// |
26 |
|
|
#include <PscuHeader.h> |
27 |
|
|
#include <EventHeader.h> |
28 |
|
|
#include <CalibTrk1Event.h> |
29 |
|
|
#include <CalibTrk2Event.h> |
30 |
|
|
// |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
34 |
|
|
if ( to == 0 ){ |
35 |
|
|
Int_t t2length = s2.Length(); |
36 |
|
|
s1 = ""; |
37 |
|
|
to = t2length; |
38 |
|
|
}; |
39 |
|
|
for (Int_t i = from; i<to; i++){ |
40 |
|
|
s1.Append(s2[i],1); |
41 |
|
|
}; |
42 |
|
|
}; |
43 |
|
|
|
44 |
|
|
typedef struct caltrk_def{ |
45 |
|
|
Int_t good0[2]; |
46 |
|
|
Int_t daqmode[12]; |
47 |
|
|
Int_t dspnum[12]; |
48 |
|
|
Int_t calibnum[12]; |
49 |
|
|
Int_t ncalev[12]; |
50 |
|
|
Int_t calfl[12]; |
51 |
|
|
Int_t ped1[12]; |
52 |
|
|
Int_t ped2[12]; |
53 |
|
|
Int_t ped3[12]; |
54 |
|
|
Int_t sig1[12]; |
55 |
|
|
Int_t sig2[12]; |
56 |
|
|
Int_t sig3[12]; |
57 |
|
|
Int_t nbad1[12]; |
58 |
|
|
Int_t nbad2[12]; |
59 |
|
|
Int_t nbad3[12]; |
60 |
|
|
Float_t dspped[12][3702]; |
61 |
|
|
Float_t dspsig[12][3702]; |
62 |
|
|
Float_t dspbad[12][3702]; |
63 |
|
|
Int_t crc_c[12][3]; |
64 |
|
|
Int_t crc_hc[12]; |
65 |
|
|
}; |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
void FTrkCalibQLook_EXPERT(TString file,Int_t step,Int_t fromevent, Int_t toevent,TString outdir,TString outfile) |
69 |
|
|
{ |
70 |
|
|
// |
71 |
|
|
// obtain information about the data file and select the output dir |
72 |
|
|
const string filepath=file.Data(); |
73 |
pam-fi |
1.3 |
Int_t dwpos = filepath.rfind("/"); |
74 |
|
|
Int_t dwpos1 = filepath.rfind(".root"); |
75 |
pam-fi |
1.1 |
TString fpath=(filepath.c_str()); |
76 |
|
|
TString base,ffile; |
77 |
|
|
stringcopy(base,fpath,0,dwpos); |
78 |
pam-fi |
1.3 |
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
79 |
|
|
if(dwpos>0) base+="/"; |
80 |
pam-fi |
1.1 |
|
81 |
|
|
TString out; |
82 |
|
|
if(outdir.Length()==0){ |
83 |
|
|
out = base; |
84 |
|
|
}else{ |
85 |
|
|
out = outdir; |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
// |
89 |
|
|
// inizialise the variables and open the file |
90 |
|
|
Int_t nevents=0; |
91 |
|
|
Int_t minevent = 0; |
92 |
|
|
Int_t maxevent = 0; |
93 |
|
|
ULong64_t FOBT[2], HOBT=0, TOBT=0; |
94 |
|
|
|
95 |
|
|
FOBT[0]=0; |
96 |
|
|
FOBT[1]=0; |
97 |
|
|
|
98 |
|
|
struct caltrk_def ctrk; |
99 |
|
|
ctrk.good0[0]=0; |
100 |
|
|
ctrk.good0[1]=0; |
101 |
|
|
for(Int_t i=0;i<12;i++){ |
102 |
|
|
ctrk.daqmode[i]=0; |
103 |
|
|
ctrk.dspnum[i]=0; |
104 |
|
|
ctrk.calibnum[i]=0; |
105 |
|
|
ctrk.ncalev[i]=0; |
106 |
|
|
ctrk.calfl[i]=0; |
107 |
|
|
ctrk.ped1[i]=0; |
108 |
|
|
ctrk.ped2[i]=0; |
109 |
|
|
ctrk.ped3[i]=0; |
110 |
|
|
ctrk.sig1[i]=0; |
111 |
|
|
ctrk.sig2[i]=0; |
112 |
|
|
ctrk.sig3[i]=0; |
113 |
|
|
ctrk.nbad1[i]=0; |
114 |
|
|
ctrk.nbad2[i]=0; |
115 |
|
|
ctrk.nbad3[i]=0; |
116 |
|
|
ctrk.crc_c[i][0]=0; |
117 |
|
|
ctrk.crc_c[i][1]=0; |
118 |
|
|
ctrk.crc_c[i][2]=0; |
119 |
|
|
ctrk.crc_hc[i]=0; |
120 |
|
|
for(Int_t iii=0;iii<3072;iii++){ |
121 |
|
|
ctrk.dspped[i][iii]=0; |
122 |
|
|
ctrk.dspsig[i][iii]=0; |
123 |
|
|
ctrk.dspbad[i][iii]=0; |
124 |
|
|
}; |
125 |
|
|
|
126 |
|
|
}; |
127 |
|
|
|
128 |
|
|
TFile *calibFile = new TFile(file); |
129 |
|
|
if ( !calibFile ){ |
130 |
|
|
printf("No data file, exiting...\n"); |
131 |
|
|
return; |
132 |
|
|
}; |
133 |
|
|
TTree *otr1,*otr2,*hotr,*totr; |
134 |
|
|
pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0; |
135 |
|
|
pamela::PscuHeader *ph=0; |
136 |
|
|
pamela::CalibTrk1Event *trk1 = 0; |
137 |
|
|
pamela::CalibTrk2Event *trk2 = 0; |
138 |
|
|
|
139 |
|
|
hotr = (TTree*)calibFile->Get("CalibHeader"); |
140 |
|
|
hotr->SetBranchAddress("Header", &eh4); |
141 |
|
|
|
142 |
|
|
totr = (TTree*)calibFile->Get("CalibTrailer"); |
143 |
|
|
totr->SetBranchAddress("Header", &eh3); |
144 |
|
|
|
145 |
|
|
otr1 = (TTree*)calibFile->Get("CalibTrk1"); |
146 |
|
|
otr1->SetBranchAddress("CalibTrk1", &trk1); |
147 |
|
|
otr1->SetBranchAddress("Header",&eh1); |
148 |
|
|
otr2 = (TTree*)calibFile->Get("CalibTrk2"); |
149 |
|
|
otr2->SetBranchAddress("CalibTrk2", &trk2); |
150 |
|
|
otr2->SetBranchAddress("Header",&eh2); |
151 |
|
|
|
152 |
|
|
if(otr1->GetEntries()==otr2->GetEntries()) |
153 |
|
|
nevents = otr1->GetEntries(); |
154 |
|
|
else{ |
155 |
|
|
printf("WARNING: CalibTrk1 entries is different from CalibTrk2 entries"); |
156 |
|
|
return;} |
157 |
|
|
if (nevents<=0) { |
158 |
|
|
calibFile->Close(); |
159 |
|
|
printf("No calibration packets found, exiting...\n"); |
160 |
|
|
return; |
161 |
|
|
}; |
162 |
|
|
|
163 |
|
|
printf("Number of calibration packets: %i\n",nevents); |
164 |
|
|
|
165 |
|
|
if ( fromevent > toevent && toevent ){ |
166 |
|
|
printf("It must be fromevent < toevent \n"); |
167 |
|
|
return; |
168 |
|
|
}; |
169 |
|
|
|
170 |
|
|
if ( fromevent > nevents || fromevent < 0 ) { |
171 |
|
|
printf("You can choose fromevent between 0 (all) and %i \n",nevents); |
172 |
|
|
return; |
173 |
|
|
}; |
174 |
|
|
|
175 |
|
|
if ( toevent > nevents || toevent < 0 ) { |
176 |
|
|
printf("You can choose toevent between 0 (all) and %i \n",nevents); |
177 |
|
|
return; |
178 |
|
|
}; |
179 |
|
|
if ( fromevent == 0 ) { |
180 |
|
|
minevent = 0; |
181 |
|
|
maxevent = nevents; |
182 |
|
|
} else { |
183 |
|
|
minevent = fromevent - 1; |
184 |
|
|
if ( toevent > 0 ){ |
185 |
|
|
maxevent = toevent; |
186 |
|
|
} else if (toevent > nevents) { |
187 |
|
|
maxevent = nevents; |
188 |
|
|
} else { |
189 |
|
|
maxevent = fromevent; |
190 |
|
|
}; |
191 |
|
|
}; |
192 |
|
|
|
193 |
|
|
//********************************************************************** |
194 |
|
|
// |
195 |
|
|
// LOOP OVER EVENTS |
196 |
|
|
// |
197 |
|
|
//********************************************************************** |
198 |
|
|
|
199 |
|
|
printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent); |
200 |
|
|
for (Int_t i = minevent; i < maxevent; i++){ |
201 |
|
|
|
202 |
|
|
otr1->GetEntry(i); |
203 |
|
|
otr2->GetEntry(i); |
204 |
|
|
totr->GetEntry(i); |
205 |
|
|
hotr->GetEntry(i); |
206 |
|
|
ph = eh4->GetPscuHeader(); |
207 |
|
|
HOBT= ph->GetOrbitalTime(); |
208 |
|
|
ph = eh3->GetPscuHeader(); |
209 |
|
|
TOBT= ph->GetOrbitalTime(); |
210 |
|
|
|
211 |
|
|
ctrk.good0[0]=trk1->good0; |
212 |
|
|
ctrk.good0[1]=trk2->good0; |
213 |
|
|
for (Int_t m = 0; m < 6; m++){ |
214 |
|
|
ph = eh1->GetPscuHeader(); |
215 |
|
|
FOBT[0]= ph->GetOrbitalTime(); |
216 |
|
|
ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; |
217 |
|
|
ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; |
218 |
|
|
ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m]; |
219 |
|
|
ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m]; |
220 |
|
|
ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m]; |
221 |
|
|
ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m]; |
222 |
|
|
ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m]; |
223 |
|
|
ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m]; |
224 |
|
|
ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m]; |
225 |
|
|
ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m]; |
226 |
|
|
ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m]; |
227 |
|
|
ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m]; |
228 |
|
|
ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m]; |
229 |
|
|
ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m]; |
230 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0]; |
231 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1]; |
232 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2]; |
233 |
|
|
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m]; |
234 |
|
|
for (Int_t j = 0; j < 3072; j++){ |
235 |
|
|
ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j]; |
236 |
|
|
ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j]; |
237 |
|
|
ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j]; |
238 |
|
|
}; |
239 |
|
|
ph = eh2->GetPscuHeader(); |
240 |
|
|
FOBT[1]= ph->GetOrbitalTime(); |
241 |
|
|
ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m]; |
242 |
|
|
ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m]; |
243 |
|
|
ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m]; |
244 |
|
|
ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m]; |
245 |
|
|
ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m]; |
246 |
|
|
ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m]; |
247 |
|
|
ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m]; |
248 |
|
|
ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m]; |
249 |
|
|
ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m]; |
250 |
|
|
ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m]; |
251 |
|
|
ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m]; |
252 |
|
|
ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m]; |
253 |
|
|
ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m]; |
254 |
|
|
ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m]; |
255 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0]; |
256 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1]; |
257 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2]; |
258 |
|
|
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m]; |
259 |
|
|
for (Int_t j = 0; j < 3072; j++){ |
260 |
|
|
ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; |
261 |
|
|
ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; |
262 |
|
|
ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; |
263 |
|
|
}; |
264 |
|
|
}; |
265 |
|
|
|
266 |
|
|
|
267 |
|
|
// |
268 |
|
|
// other variables definitions |
269 |
|
|
Int_t risposta=0; |
270 |
|
|
stringstream fromfile; |
271 |
|
|
|
272 |
|
|
fromfile<<"FTrkCalibQLook_EXPERT File: "<<ffile<<" -- CalibHeader OBT= "<<HOBT<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT<<" --"; |
273 |
|
|
|
274 |
|
|
gStyle->SetLabelSize(0.08,"x"); |
275 |
|
|
gStyle->SetLabelSize(0.08,"y"); |
276 |
|
|
gStyle->SetTitleFillColor(10); |
277 |
|
|
gStyle->SetTitleFontSize(0.1); |
278 |
|
|
gStyle->SetTitleOffset(0.8,"y"); |
279 |
|
|
gStyle->SetTitleOffset(1.,"x"); |
280 |
|
|
gStyle->SetTitleSize(0.06,"y"); |
281 |
|
|
gStyle->SetTitleSize(0.06,"x"); |
282 |
|
|
gStyle->SetOptStat(0); |
283 |
|
|
|
284 |
|
|
// |
285 |
|
|
// draw display area |
286 |
|
|
TLatex *tzz=new TLatex(); |
287 |
|
|
tzz->SetTextFont(32); |
288 |
|
|
tzz->SetTextColor(1); |
289 |
|
|
tzz->SetTextAlign(12); |
290 |
|
|
tzz->SetTextSize(0.019); |
291 |
|
|
Int_t canvasx=1200; |
292 |
|
|
Int_t canvasy=900; |
293 |
|
|
TCanvas *c1 = new TCanvas("c1","FTrkCalibQLook_EXPERT_ped",canvasx,canvasy); |
294 |
|
|
c1->SetFillColor(10); |
295 |
|
|
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
296 |
|
|
tzz->DrawLatex(.90,0.98,"PEDESTAL"); |
297 |
|
|
TCanvas *c2 = new TCanvas("c2","FTrkCalibQLook_EXPERT_sig",canvasx,canvasy); |
298 |
|
|
c2->SetFillColor(10); |
299 |
|
|
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
300 |
|
|
tzz->DrawLatex(.90,0.98,"SIGMA"); |
301 |
|
|
|
302 |
|
|
// draw pads |
303 |
|
|
TPad *trkpad1[12],*trkpad2[12]; //pad for histos |
304 |
|
|
TPaveText *trkpadtext[12]; //pad for header |
305 |
|
|
TH1F *histosig[12]; //histos of sigma |
306 |
|
|
TH1F *histoped[12]; //histos of pedestals |
307 |
|
|
TH1F *histoasig[12]; //histos of sigma |
308 |
|
|
TH1F *histoaped[12]; //histos of pedestals |
309 |
|
|
|
310 |
pam-fi |
1.3 |
Float_t posy = 0.95; // up y-coord - top pads |
311 |
|
|
Float_t hpad = 0.15; // pad height |
312 |
|
|
Float_t posx1=0; // left x-coord - pad column |
313 |
|
|
Float_t posx2=0; // right x-coord - pad olumn |
314 |
|
|
Float_t posx0=0; // x-coord - column division |
315 |
|
|
Float_t wrel = 0.6; // relative x size of first sub-column |
316 |
|
|
Float_t marg = 0.004; // margin among pads |
317 |
pam-fi |
1.1 |
stringstream title; |
318 |
|
|
stringstream hid; |
319 |
|
|
|
320 |
|
|
for(Int_t n = 0; n<12; n++){ |
321 |
|
|
if ( (n+1)%2 ) { |
322 |
|
|
if(n>1)posy = posy-(marg*2+hpad); |
323 |
|
|
posx1 = marg; |
324 |
|
|
posx2 = 0.5 - marg; |
325 |
|
|
posx0 = 0.5*wrel; |
326 |
|
|
} else { |
327 |
|
|
posx1 = posx1 + 0.5; |
328 |
|
|
posx2 = posx2 + 0.5; |
329 |
|
|
posx0 = posx0 + 0.5; |
330 |
|
|
}; |
331 |
|
|
/* -----------> pad for histograms */ |
332 |
|
|
trkpad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
333 |
|
|
trkpad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
334 |
|
|
/* -----------> pad for header dump */ |
335 |
|
|
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
336 |
|
|
/* -----------> HISTOGRAMS */ |
337 |
|
|
/* calibration parameters */ |
338 |
|
|
title<<"DSP "<<n+1; |
339 |
pam-fi |
1.4 |
hid<<"h"<<n<<"i"<<i; |
340 |
pam-fi |
1.1 |
histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
341 |
|
|
hid.str(""); |
342 |
pam-fi |
1.4 |
hid<<"hh"<<n<<"i"<<i; |
343 |
pam-fi |
1.1 |
histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
344 |
|
|
hid.str(""); |
345 |
pam-fi |
1.4 |
hid<<"hhh"<<n<<"i"<<i; |
346 |
pam-fi |
1.1 |
title.str(""); |
347 |
|
|
hid.str(""); |
348 |
|
|
/* AVERAGE calibration parameters */ |
349 |
pam-fi |
1.4 |
hid<<"ah"<<n<<"i"<<i; |
350 |
pam-fi |
1.1 |
histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
351 |
|
|
hid.str(""); |
352 |
pam-fi |
1.4 |
hid<<"ahh"<<n<<"i"<<i; |
353 |
pam-fi |
1.1 |
histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
354 |
|
|
hid.str(""); |
355 |
|
|
}; //end loop on views |
356 |
|
|
|
357 |
|
|
|
358 |
|
|
stringstream message; |
359 |
|
|
|
360 |
|
|
//-------------------------------- |
361 |
|
|
//CHECK CALIBRATION procedure |
362 |
|
|
//-------------------------------- |
363 |
|
|
Int_t nn=0; |
364 |
|
|
Int_t calok = 0;//BAD |
365 |
|
|
for(Int_t n = 0; n<12; n++){ |
366 |
|
|
if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD |
367 |
|
|
|
368 |
|
|
|
369 |
|
|
nn=ctrk.dspnum[n]-1; |
370 |
|
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
371 |
|
|
* |
372 |
|
|
* Write event LEVEL0 report |
373 |
|
|
* |
374 |
|
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
375 |
|
|
trkpadtext[nn]->SetTextFont(40); |
376 |
|
|
trkpadtext[nn]->SetFillColor(33); |
377 |
|
|
if(calok==0)trkpadtext[nn]->SetFillColor(2); |
378 |
|
|
trkpadtext[nn]->SetTextSize(0.013); |
379 |
|
|
trkpadtext[nn]->SetTextAlign(13); |
380 |
|
|
trkpadtext[nn]->SetTextColor(1); |
381 |
|
|
|
382 |
|
|
trkpadtext[nn]->AddText(" "); |
383 |
|
|
message<<"DSP num --------> "<<ctrk.dspnum[n]; |
384 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
385 |
|
|
message.str(""); |
386 |
|
|
message<<"DAQ mode -------> "<<ctrk.daqmode[n]; |
387 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
388 |
|
|
message.str(""); |
389 |
|
|
message<<"Calibnumber ----> "<<ctrk.calibnum[n]; |
390 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
391 |
|
|
message.str(""); |
392 |
|
|
message<<"ncalib_event ---> "<<ctrk.ncalev[n]; |
393 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
394 |
|
|
message.str(""); |
395 |
|
|
message<<"Cal_flag -------> "<<ctrk.calfl[n]; |
396 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
397 |
|
|
message.str(""); |
398 |
|
|
message<<"crc_hcal -------> "<<ctrk.crc_hc[n]; |
399 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
400 |
|
|
message.str(""); |
401 |
|
|
message<<"crc_cal: l1- ";message.width(5);message<< ctrk.crc_c[n][0]; |
402 |
|
|
message<<" l2- ";message.width(5);message<< ctrk.crc_c[n][1]; |
403 |
|
|
message<<" l3- ";message.width(5);message<< ctrk.crc_c[n][2]; |
404 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
405 |
|
|
message.str(""); |
406 |
|
|
message<<"<PED>: l1- "; message.width(5);message<< ctrk.ped1[n]; |
407 |
|
|
message<<" l2-"; message.width(5);message<< ctrk.ped2[n]; |
408 |
|
|
message<<" l3-"; message.width(5);message<< ctrk.ped3[n]; |
409 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
410 |
|
|
message.str(""); |
411 |
|
|
message<<"<SIG>: l1- "; message.width(5);message<< ctrk.sig1[n]; |
412 |
|
|
message<<" l2-"; message.width(5);message<< ctrk.sig2[n]; |
413 |
|
|
message<<" l3-"; message.width(5);message<< ctrk.sig3[n]; |
414 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
415 |
|
|
message.str(""); |
416 |
|
|
message<<"n.BAD: l1- "; message.width(5);message<<ctrk.nbad1[n]; |
417 |
|
|
message<<" l2-"; message.width(5);message<< ctrk.nbad2[n]; |
418 |
|
|
message<<" l3-"; message.width(5);message<< ctrk.nbad3[n]; |
419 |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
420 |
|
|
message.str(""); |
421 |
|
|
|
422 |
|
|
if(calok==0){ |
423 |
|
|
|
424 |
|
|
message.str("*** FAILED ***"); |
425 |
|
|
TText *t=trkpadtext[nn]->AddText(message.str().c_str()); |
426 |
|
|
t->SetTextSize(0.02); |
427 |
|
|
t->SetTextAlign(23); |
428 |
|
|
t->SetTextColor(5); |
429 |
|
|
}; |
430 |
|
|
|
431 |
|
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
432 |
|
|
* |
433 |
|
|
* Plot histo |
434 |
|
|
* |
435 |
|
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
436 |
|
|
|
437 |
|
|
|
438 |
|
|
/******************************************************/ |
439 |
|
|
/* fill histos */ |
440 |
|
|
for(Int_t j = 0; j < 3072; j++){ |
441 |
|
|
histosig[nn]->Fill((Float_t)j,ctrk.dspsig[nn][j]); |
442 |
|
|
histoped[nn]->Fill((Float_t)j,ctrk.dspped[nn][j]); |
443 |
|
|
}; |
444 |
|
|
histoasig[nn]->Fill(1,ctrk.sig1[nn]); |
445 |
|
|
histoasig[nn]->Fill(1025,ctrk.sig2[nn]); |
446 |
|
|
histoasig[nn]->Fill(2049,ctrk.sig3[nn]); |
447 |
|
|
histoaped[nn]->Fill(1,ctrk.ped1[nn]); |
448 |
|
|
histoaped[nn]->Fill(1025,ctrk.ped2[nn]); |
449 |
|
|
histoaped[nn]->Fill(2049,ctrk.ped3[nn]); |
450 |
|
|
/******************************************************/ |
451 |
|
|
|
452 |
|
|
TLine li; |
453 |
|
|
li.SetLineColor(38); |
454 |
|
|
li.SetLineStyle(3); |
455 |
|
|
li.SetLineWidth(2); |
456 |
|
|
|
457 |
pam-fi |
1.3 |
Float_t maxhist=0; |
458 |
pam-fi |
1.2 |
TBox b; |
459 |
|
|
b.SetFillColor(6); |
460 |
|
|
b.SetFillStyle(3945); |
461 |
pam-fi |
1.1 |
/* plot PEDESTAL */ |
462 |
|
|
c1->cd(); |
463 |
|
|
trkpadtext[nn]->Draw(); |
464 |
|
|
trkpad1[nn]->Draw(); |
465 |
|
|
trkpad1[nn]->cd(); |
466 |
|
|
trkpad1[nn]->SetFillColor(10); |
467 |
|
|
trkpad1[nn]->SetFrameFillColor(10); |
468 |
|
|
histoped[nn]->SetLineColor(1); |
469 |
|
|
histoped[nn]->SetFillColor(12); |
470 |
|
|
histoped[nn]->SetLineWidth(1); |
471 |
|
|
histoped[nn]->GetYaxis()->SetTitle("PED (ADC channels)"); |
472 |
|
|
histoped[nn]->GetYaxis()->CenterTitle(); |
473 |
pam-fi |
1.2 |
if((nn+1)%2==1) histoped[nn]->GetYaxis()->SetRangeUser(2200,3200); |
474 |
|
|
if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(700,1700); |
475 |
pam-fi |
1.1 |
histoaped[nn]->SetLineColor(5); |
476 |
|
|
histoaped[nn]->SetLineWidth(1); |
477 |
pam-fi |
1.2 |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
478 |
|
|
histoped[nn]->Draw("b"); |
479 |
|
|
if(nn==1){ |
480 |
|
|
maxhist=histoped[nn]->GetMaximum(); |
481 |
|
|
b.DrawBox(2816.,700.,3060.,maxhist); |
482 |
|
|
} |
483 |
|
|
else if(nn==6){ |
484 |
|
|
maxhist=histoped[nn]->GetMaximum(); |
485 |
|
|
b.DrawBox(2560.,2200.,2816.,maxhist); |
486 |
|
|
b.DrawBox(512.,2200.,768.,maxhist); |
487 |
|
|
b.DrawBox(1024.,2200.,1792.,maxhist); |
488 |
|
|
} |
489 |
|
|
else if(nn==11){ |
490 |
|
|
maxhist=histoped[nn]->GetMaximum(); |
491 |
|
|
b.DrawBox(768.,700.,1024.,maxhist); |
492 |
|
|
} |
493 |
|
|
} |
494 |
pam-fi |
1.1 |
else histoped[nn]->Draw("axis"); |
495 |
|
|
histoaped[nn]->Draw("same"); |
496 |
|
|
if((nn+1)%2==1) { |
497 |
pam-fi |
1.2 |
li.DrawLine(1024.5,2200,1024.5,3200); |
498 |
|
|
li.DrawLine(2048.5,2200,2048.5,3200); |
499 |
pam-fi |
1.1 |
} |
500 |
|
|
if((nn+1)%2==0) { |
501 |
pam-fi |
1.2 |
li.DrawLine(1024.5,700,1024.5,1700); |
502 |
|
|
li.DrawLine(2048.5,700,2048.5,1700); |
503 |
pam-fi |
1.1 |
} |
504 |
|
|
|
505 |
pam-fi |
1.2 |
|
506 |
pam-fi |
1.1 |
|
507 |
|
|
/* plot SIGMA */ |
508 |
pam-fi |
1.3 |
Float_t max=500.; |
509 |
pam-fi |
1.1 |
c2->cd(); |
510 |
|
|
trkpadtext[nn]->Draw(); |
511 |
|
|
trkpad2[nn]->SetLogy(); |
512 |
|
|
trkpad2[nn]->Draw(); |
513 |
|
|
trkpad2[nn]->cd(); |
514 |
|
|
trkpad2[nn]->SetFillColor(10); |
515 |
|
|
trkpad2[nn]->SetFrameFillColor(10); |
516 |
|
|
histosig[nn]->SetLineColor(1); |
517 |
|
|
histosig[nn]->SetFillColor(12); |
518 |
|
|
histosig[nn]->SetLineWidth(1); |
519 |
|
|
histosig[nn]->SetMaximum(max); |
520 |
|
|
histosig[nn]->SetMinimum(0.5); |
521 |
|
|
histosig[nn]->GetYaxis()->SetTitle("SIG (ADC channels)"); |
522 |
|
|
histosig[nn]->GetYaxis()->CenterTitle(); |
523 |
|
|
histoasig[nn]->SetLineColor(5); |
524 |
|
|
histoasig[nn]->SetLineWidth(1); |
525 |
pam-fi |
1.2 |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
526 |
|
|
histosig[nn]->Draw("b"); |
527 |
|
|
if(nn==1){ |
528 |
|
|
maxhist=histosig[nn]->GetMaximum(); |
529 |
|
|
b.DrawBox(2816.,0.,3060.,maxhist); |
530 |
|
|
} |
531 |
|
|
else if(nn==6){ |
532 |
|
|
maxhist=histosig[nn]->GetMaximum(); |
533 |
|
|
b.DrawBox(2560.,0.,2816.,maxhist); |
534 |
|
|
b.DrawBox(512.,0.,768.,maxhist); |
535 |
|
|
b.DrawBox(1024.,0.,1792.,maxhist); |
536 |
|
|
} |
537 |
|
|
else if(nn==11){ |
538 |
|
|
maxhist=histosig[nn]->GetMaximum(); |
539 |
|
|
b.DrawBox(768.,0.,1024.,maxhist); |
540 |
|
|
} |
541 |
|
|
} |
542 |
pam-fi |
1.1 |
else histosig[nn]->Draw("axis"); |
543 |
|
|
histoasig[nn]->Draw("same"); |
544 |
|
|
li.DrawLine(1024.5,0,1024.5,max); |
545 |
|
|
li.DrawLine(2048.5,0,2048.5,max); |
546 |
pam-fi |
1.2 |
|
547 |
|
|
|
548 |
|
|
|
549 |
pam-fi |
1.1 |
};//end loop on views |
550 |
|
|
|
551 |
|
|
c1->Update();//draw pads in canvas |
552 |
|
|
c2->Update();//draw pads in canvas |
553 |
|
|
|
554 |
|
|
stringstream nom1; |
555 |
|
|
stringstream nom2; |
556 |
|
|
|
557 |
|
|
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
558 |
|
|
nom1.str(""); |
559 |
|
|
nom2.str(""); |
560 |
|
|
nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps("; |
561 |
|
|
nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps)"; |
562 |
|
|
c1->Print(nom1.str().c_str(),"Landscape"); |
563 |
|
|
c2->Print(nom2.str().c_str(),"Landscape"); |
564 |
|
|
if(!strcmp(outfile.Data(),"pdf")){ |
565 |
|
|
stringstream com; |
566 |
|
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps "<<out<<ffile<<"_FTrkCalibQlook_EXPERT-pkt"<<i+1<<".pdf"; |
567 |
|
|
system(com.str().c_str()); |
568 |
|
|
printf("\n---> ps file converted in pdf format!\n"); |
569 |
|
|
com.str(""); |
570 |
|
|
com<<"rm -f "<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps"; |
571 |
|
|
system(com.str().c_str()); |
572 |
|
|
printf("---> ps file removed!\n\n"); |
573 |
|
|
com.str(""); |
574 |
|
|
} |
575 |
|
|
} |
576 |
|
|
else{ |
577 |
|
|
nom1.str(""); |
578 |
|
|
nom2.str(""); |
579 |
|
|
nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-ped-pkt"<<i+1<<"."<<outfile.Data(); |
580 |
|
|
nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-sig-pkt"<<i+1<<"."<<outfile.Data(); |
581 |
|
|
c1->Print(nom1.str().c_str()); |
582 |
|
|
c2->Print(nom2.str().c_str()); |
583 |
|
|
} |
584 |
|
|
|
585 |
|
|
if(step==1 && i!=maxevent-1 ){ |
586 |
|
|
printf("\n Press 1<enter> to continue, 2<enter> to quit.\n"); |
587 |
|
|
cin>>risposta; |
588 |
|
|
if ( i != maxevent-1 ) { |
589 |
|
|
if ( risposta == 2 ) { |
590 |
|
|
gROOT->Reset(); |
591 |
|
|
printf("Exiting...\n"); |
592 |
|
|
return; |
593 |
|
|
} |
594 |
|
|
} |
595 |
|
|
} |
596 |
|
|
};//end loop on events |
597 |
|
|
|
598 |
|
|
gROOT->Reset(); |
599 |
|
|
printf("... end of packets. \n"); |
600 |
|
|
return; |
601 |
|
|
} |
602 |
|
|
|
603 |
|
|
|