2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version v1r05 |
* version v2r00 |
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 |
9 |
* event - the number of the single event to analyze |
* event - the number of the single event to analyze |
10 |
* DSPprint - the number of a particular DSP to draw (0 don't draw) |
* va1 - the number of the single va1 to analyze (dsp*100+va1) |
11 |
* outfile - extension of output file (pdf,ps,gif,jpg) |
* value - the number of events to store in the .dat file with va1 values |
12 |
|
* outfile - extension of output file (pdf,ps,gif,jpg) |
13 |
* |
* |
14 |
*/ |
*/ |
15 |
// |
// |
16 |
#include <iostream> |
#include <iostream> |
17 |
#include <sstream> |
#include <sstream> |
18 |
|
#include <fstream> |
19 |
// |
// |
20 |
#include <TPaveText.h> |
#include <TPaveText.h> |
21 |
#include <TLatex.h> |
#include <TLatex.h> |
120 |
} |
} |
121 |
|
|
122 |
|
|
123 |
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 va1, Int_t value, TString outfile) |
124 |
{ |
{ |
125 |
|
|
126 |
// |
// |
143 |
pamela::EventHeader *eh=0,*eH=0; |
pamela::EventHeader *eh=0,*eH=0; |
144 |
pamela::PscuHeader *ph=0,*pH=0; |
pamela::PscuHeader *ph=0,*pH=0; |
145 |
pamela::RunHeaderEvent *reh=0; |
pamela::RunHeaderEvent *reh=0; |
146 |
|
pamela::EventCounter *cod=0; |
147 |
|
|
148 |
|
pamela::PacketType *pctp=0; |
149 |
// open files |
// open files |
150 |
TFile *trackerFile = new TFile(file); |
TFile *trackerFile = new TFile(file); |
151 |
if ( !trackerFile ){ |
if ( !trackerFile ){ |
172 |
return; |
return; |
173 |
} |
} |
174 |
|
|
175 |
|
// |
176 |
|
// open the output text files for the alarms |
177 |
|
TString fname = out+ffile; |
178 |
|
int slen=fname.Length(); |
179 |
|
int last=fname.Last('_'); |
180 |
|
if(last<(slen-1))fname.Append('_'); |
181 |
|
fname.Append("FTrk-DSP-values.dat"); |
182 |
|
ofstream values(fname,ios::out); |
183 |
|
|
184 |
|
// |
185 |
printf("\n Number of Entries: %d\n",nevents); |
printf("\n Number of Entries: %d\n",nevents); |
186 |
printf(" Number of Header Entries: %d\n",neventH); |
printf(" Number of Header Entries: %d\n",neventH); |
187 |
|
|
188 |
Long64_t obt=0; |
Long64_t obt=0; |
189 |
|
Int_t eve,cin=0; |
190 |
|
TString cal=""; |
191 |
|
|
192 |
|
eve=3; |
193 |
for(Int_t i=0;i<neventH;i++){ |
for(Int_t i=0;i<neventH;i++){ |
194 |
otr->GetEntry(i); |
otr->GetEntry(i); |
195 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
196 |
if(reh->TRK_CALIB_USED!=104){ |
if(reh->TRK_CALIB_USED!=104){ |
197 |
obt = pH->GetOrbitalTime(); |
obt = pH->GetOrbitalTime(); |
198 |
|
cal="Event with online calibration"; |
199 |
break; |
break; |
200 |
} |
} |
201 |
if(i==neventH-1){ |
if(i==neventH-1){ |
202 |
printf("\n\n ****** ONLINE CALIBRATION NOT FOUND IN THIS FILE ******\n\n"); |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
203 |
return; |
eve=2; |
204 |
} |
} |
205 |
} |
} |
206 |
Int_t ev[2]; |
if(eve==3){ |
207 |
for(Int_t i=0;i<nevents;i++){ |
for(Int_t i=0;i<nevents;i++){ |
208 |
tr->GetEntry(i); |
tr->GetEntry(i); |
209 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
210 |
if(ph->GetOrbitalTime()>obt){ |
cod = eh->GetCounter(); |
211 |
ev[0]=i+2; |
if(i==0) cin=cod->Get(pctp->CalibTrk1); |
212 |
ev[1]=i+3; |
if(reh->TRK_CALIB_USED==104) continue; |
213 |
break; |
if(event<0 && cod->Get(pctp->CalibTrk1)==cin+1){ |
214 |
|
eve=i+3; |
215 |
|
break; |
216 |
|
} |
217 |
|
else if(event>=0 && ph->GetOrbitalTime()>obt){ |
218 |
|
eve=i+3; |
219 |
|
break; |
220 |
|
} |
221 |
} |
} |
222 |
} |
} |
223 |
|
|
224 |
|
int tot=2,totvalues=0,TOT=0; |
225 |
|
if(event<0) tot=abs(event); |
226 |
|
if(value>0) totvalues=value; |
227 |
|
|
228 |
|
TOT= tot > totvalues ? tot : totvalues; |
229 |
|
|
230 |
TH1F *histomax[12][2]; //histos of max signals |
TH1F *histomax[12][tot]; //histos of max signals |
231 |
TH1F *histocomp[12][2]; //histos of compressed data |
TH1F *histocomp[12][tot]; //histos of compressed data |
232 |
TH1F *histofull[12][2]; //histos of full data |
TH1F *histofull[12][tot]; //histos of full data |
233 |
TCanvas *c1[2]; |
TCanvas *c1[tot]; |
234 |
|
TH1F *histova[tot]; //histos of va1 signals |
235 |
for(Int_t e=0;e<2;e++){ |
TCanvas *cva[tot]; |
236 |
event=ev[e]; |
|
237 |
printf("Scan of Entry %d\n",event-1); |
|
238 |
|
TLatex *t=new TLatex(); |
239 |
|
t->SetTextFont(32); |
240 |
|
t->SetTextColor(1); |
241 |
|
t->SetTextAlign(12); |
242 |
|
t->SetTextSize(0.02); |
243 |
|
|
244 |
|
|
245 |
|
for(Int_t e=0;e<TOT;e++){ |
246 |
|
if(event<=0) |
247 |
|
event=eve; |
248 |
|
else { |
249 |
|
event=event+1; |
250 |
|
if(event>eve-3 && eve>2) |
251 |
|
cal="Event with online calibration"; |
252 |
|
else |
253 |
|
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
254 |
|
} |
255 |
|
printf("Scan of Entry %d\n",event); |
256 |
|
|
257 |
tr->GetEntry(event-1); |
tr->GetEntry(event); |
258 |
//============================================================================ |
//============================================================================ |
259 |
|
|
260 |
gStyle->SetLabelSize(0.06,"x"); |
gStyle->SetLabelSize(0.06,"x"); |
261 |
gStyle->SetLabelSize(0.06,"y"); |
gStyle->SetLabelSize(0.06,"y"); |
262 |
gStyle->SetTitleFontSize(0.1); |
//gStyle->SetTitleFontSize(0.1); |
263 |
gStyle->SetFillColor(10); |
gStyle->SetFillColor(10); |
264 |
gStyle->SetTitleFillColor(10); |
gStyle->SetTitleFillColor(10); |
265 |
gStyle->SetTitleOffset(-1,"Y"); |
gStyle->SetTitleOffset(-1,"Y"); |
266 |
gStyle->SetOptStat(0); |
gStyle->SetOptStat(0); |
267 |
|
|
268 |
// draw display area |
// draw display area |
|
|
|
|
Int_t canvasx=1200; |
|
|
Int_t canvasy=900; |
|
|
stringstream figsav; |
|
|
figsav.str(""); |
|
|
figsav<<out<<ffile<<"_FTrkScanQLook_EXPERT_ev"<<event+1<<"."<<outfile.Data(); |
|
|
c1[e] = new TCanvas(figsav.str().c_str(),"FTrkQLookSCAN",canvasx,canvasy); |
|
|
c1[e]->SetFillColor(10); |
|
|
c1[e]->Range(0,0,1,1); |
|
|
stringstream fromfile; |
|
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event-1; |
|
|
TLatex *t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextAlign(12); |
|
|
t->SetTextSize(0.02); |
|
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
|
|
|
|
|
// draw pads |
|
|
TPad *trkpad[12]; //pad for histos |
|
|
TPaveText *trkpadtext[12]; //pad for header |
|
|
Double_t posy = 0.95; // up y-coord - top pads |
|
|
Double_t hpad = 0.15; // pad height |
|
|
Double_t posx1=0; // left x-coord - pad column |
|
|
Double_t posx2=0; // right x-coord - pad olumn |
|
|
Double_t posx0=0; // x-coord - column division |
|
|
Double_t wrel = 0.6; // relative x size of first sub-column |
|
|
Double_t marg = 0.004; // margin among pads |
|
269 |
|
|
270 |
|
stringstream fromfile,title,hid,message; |
271 |
|
TString figsa="",figsav="",figsava=""; |
272 |
|
|
273 |
stringstream title; |
TPad *trkpad[12],*pad=0; //pad for histos |
274 |
stringstream hid; |
TPaveText *trkpadtext[12]; //pad for header |
275 |
for(Int_t n = 0; n<12; n++){ |
|
276 |
if ( (n+1)%2 ) { |
if((tot<TOT && e<tot) || tot==TOT){ |
277 |
if(n>1)posy = posy-(marg*2+hpad); |
Int_t canvasx=1200; |
278 |
posx1 = marg; |
Int_t canvasy=900; |
279 |
posx2 = 0.5 - marg; |
figsav=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
280 |
posx0 = 0.5*wrel; |
figsav+=event+1; |
281 |
} else { |
c1[e] = new TCanvas(figsav.Data(),"FTrkQLookSCAN",canvasx,canvasy); |
282 |
posx1 = posx1 + 0.5; |
c1[e]->SetFillColor(10); |
283 |
posx2 = posx2 + 0.5; |
c1[e]->Range(0,0,1,1); |
284 |
posx0 = posx0 + 0.5; |
fromfile.str(""); |
285 |
}; |
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event; |
286 |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
287 |
|
t->DrawLatex(0.60,0.98,cal.Data()); |
288 |
|
|
289 |
|
if(va1!=0){ |
290 |
|
figsava=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
291 |
|
figsava+=event+1; |
292 |
|
figsava+="_DSP"; |
293 |
|
figsava+=(int)(va1/100); |
294 |
|
figsava+="_VA1-"; |
295 |
|
figsava+=va1%100; |
296 |
|
cva[e] = new TCanvas(figsava.Data(),"TrkQLookSCAN VA1",canvasx,canvasy); |
297 |
|
cva[e]->SetFillColor(10); |
298 |
|
cva[e]->Range(0,0,1,1); |
299 |
|
fromfile.str(""); |
300 |
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event<<" --> DSP "<<(int)(va1/100)<<" --> va1 "<<va1%100; |
301 |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
302 |
|
// t->DrawLatex(0.65,0.98,cal.Data()); |
303 |
|
} |
304 |
|
|
305 |
|
// draw pads |
306 |
|
Double_t posy = 0.95; // up y-coord - top pads |
307 |
|
Double_t hpad = 0.15; // pad height |
308 |
|
Double_t posx1=0; // left x-coord - pad column |
309 |
|
Double_t posx2=0; // right x-coord - pad olumn |
310 |
|
Double_t posx0=0; // x-coord - column division |
311 |
|
Double_t wrel = 0.6; // relative x size of first sub-column |
312 |
|
Double_t marg = 0.004; // margin among pads |
313 |
|
|
314 |
|
for(Int_t n = 0; n<12; n++){ |
315 |
|
if ( (n+1)%2 ) { |
316 |
|
if(n>1)posy = posy-(marg*2+hpad); |
317 |
|
posx1 = marg; |
318 |
|
posx2 = 0.5 - marg; |
319 |
|
posx0 = 0.5*wrel; |
320 |
|
} else { |
321 |
|
posx1 = posx1 + 0.5; |
322 |
|
posx2 = posx2 + 0.5; |
323 |
|
posx0 = posx0 + 0.5; |
324 |
|
}; |
325 |
|
|
326 |
|
/* -----------> pad for histograms */ |
327 |
|
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
328 |
|
trkpad[n]->SetFillColor(19); |
329 |
|
trkpad[n]->SetFrameFillColor(10); |
330 |
|
/* -----------> pad for header dump */ |
331 |
|
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
332 |
|
/* -----------> HISTOGRAMS */ |
333 |
|
|
334 |
|
title<<"DSP "<<n+1; |
335 |
|
hid<<"h"<<n+e*100; |
336 |
|
histomax[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
337 |
|
hid<<"hh"<<n+e*100; |
338 |
|
histocomp[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
339 |
|
hid<<"hhh"<<n+e*100; |
340 |
|
histofull[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
341 |
|
title.str(""); |
342 |
|
hid.str(""); |
343 |
|
} |
344 |
|
if(va1!=0){ |
345 |
|
title.str(""); |
346 |
|
title<<"DSP "<<(int)(va1/100)<<" -- va1 "<<va1%100; |
347 |
|
hid<<"va"<<e; |
348 |
|
histova[e] = new TH1F(hid.str().c_str(),title.str().c_str(),130,0,129); |
349 |
|
} //end loop on views |
350 |
|
|
351 |
/* -----------> pad for histograms */ |
/* -----------> pad for histograms */ |
352 |
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
pad = new TPad("padva"," ",0,0,1,0.97,18,0,0); |
353 |
trkpad[n]->SetFillColor(19); |
pad->SetFillColor(19); |
354 |
trkpad[n]->SetFrameFillColor(10); |
pad->SetFrameFillColor(10); |
355 |
/* -----------> pad for header dump */ |
} |
|
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
|
|
/* -----------> HISTOGRAMS */ |
|
|
|
|
|
title<<"DSP "<<n+1; |
|
|
hid<<"h"<<n+e*100; |
|
|
histomax[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
|
|
hid<<"hh"<<n+e*100; |
|
|
histocomp[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
|
|
hid<<"hhh"<<n+e*100; |
|
|
histofull[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
|
|
title.str(""); |
|
|
hid.str(""); |
|
|
} //end loop on views |
|
|
|
|
356 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
357 |
// create header dump retrieving event info |
// create header dump retrieving event info |
358 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
359 |
Int_t ndsp=0; |
Int_t ndsp=0; |
|
stringstream message; |
|
360 |
|
|
361 |
Double_t whistomax[3072]; |
Double_t whistomax[3072]; |
362 |
Double_t whisto[3072]; |
Double_t whisto[3072]; |
372 |
trkword thisword; |
trkword thisword; |
373 |
|
|
374 |
Int_t address,ladder; |
Int_t address,ladder; |
375 |
|
|
376 |
|
|
377 |
for(Int_t n = 0; n<12; n++){ |
for(Int_t n = 0; n<12; n++){ |
378 |
|
|
379 |
ndsp = trk->DSPnumber[n]; |
ndsp = trk->DSPnumber[n]; |
381 |
ifull[nn]=0; |
ifull[nn]=0; |
382 |
icomp[nn]=0; |
icomp[nn]=0; |
383 |
imax[nn]=0; |
imax[nn]=0; |
384 |
|
if(ndsp>0){ |
385 |
|
if(ndsp<13){ |
386 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
387 |
|
|
388 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
389 |
* |
* |
390 |
* Write event LEVEL0 report |
* Write event LEVEL0 report |
391 |
* |
* |
392 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
393 |
|
|
394 |
trkpadtext[nn]->SetTextFont(40); |
trkpadtext[nn]->SetTextFont(40); |
395 |
trkpadtext[nn]->SetFillColor(33); |
trkpadtext[nn]->SetFillColor(33); |
396 |
trkpadtext[nn]->SetTextSize(0.012); |
trkpadtext[nn]->SetTextSize(0.012); |
397 |
trkpadtext[nn]->SetTextAlign(13); |
trkpadtext[nn]->SetTextAlign(13); |
398 |
|
|
399 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
400 |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
401 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
402 |
message.str(""); |
message.str(""); |
403 |
message<<"Event number --------> "<<trk->eventn[n]; |
message<<"Event number --------> "<<trk->eventn[n]; |
404 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
405 |
message.str(""); |
message.str(""); |
406 |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
407 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
408 |
message.str(""); |
message.str(""); |
409 |
if (!(nn%2)&&trk->signcluster[n][0]!=0) message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<1024-(trk->signcluster[n][0]); |
if (!(nn%2)&&trk->signcluster[n][0]!=0) message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<1024-(trk->signcluster[n][0]); |
410 |
else message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<(trk->signcluster[n][0]); |
else message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<(trk->signcluster[n][0]); |
411 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
412 |
message.str(""); |
message.str(""); |
413 |
if (!(nn%2)&&trk->signcluster[n][1]!=0) message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<1024-(trk->signcluster[n][1]); |
if (!(nn%2)&&trk->signcluster[n][1]!=0) message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<1024-(trk->signcluster[n][1]); |
414 |
else message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<trk->signcluster[n][1]; |
else message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<trk->signcluster[n][1]; |
415 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
416 |
message.str(""); |
message.str(""); |
417 |
if (!(nn%2)&&trk->signcluster[n][2]!=0) message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<1024-(trk->signcluster[n][2]); |
if (!(nn%2)&&trk->signcluster[n][2]!=0) message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<1024-(trk->signcluster[n][2]); |
418 |
else message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<trk->signcluster[n][2]; |
else message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<trk->signcluster[n][2]; |
419 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
420 |
message.str(""); |
message.str(""); |
421 |
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
422 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
423 |
message.str(""); |
message.str(""); |
424 |
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
425 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
426 |
message.str(""); |
message.str(""); |
427 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
428 |
message<<"CRC --> "<<trk->crc[n]; |
message<<"CRC --> "<<trk->crc[n]; |
429 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
430 |
message.str(""); |
message.str(""); |
431 |
message<<"FL1-6 --> "<<trk->fl1[n]<<" "<<trk->fl2[n]<<" "<<trk->fl3[n]<<" "<<trk->fl4[n]<<" "<<trk->fl5[n]<<" "<<trk->fl6[n]<<" FC "<<trk->fc[n]; |
message<<"FL1-6 --> "<<trk->fl1[n]<<" "<<trk->fl2[n]<<" "<<trk->fl3[n]<<" "<<trk->fl4[n]<<" "<<trk->fl5[n]<<" "<<trk->fl6[n]<<" FC "<<trk->fc[n]; |
432 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
433 |
message.str(""); |
message.str(""); |
434 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
435 |
trkpadtext[nn]->AddLine(0,0,0,0); |
trkpadtext[nn]->AddLine(0,0,0,0); |
436 |
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
437 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
438 |
message.str(""); |
message.str(""); |
439 |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
440 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
441 |
message.str(""); |
message.str(""); |
442 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
443 |
|
|
444 |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
445 |
|
} |
446 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
447 |
* |
* |
448 |
* Plot event LEVEL0 histo |
* Plot event LEVEL0 histo |
449 |
* |
* |
450 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
451 |
|
|
452 |
//============================================= |
//============================================= |
453 |
|
} |
454 |
for(Int_t i = 0; i< 3072; i++){ |
for(Int_t i = 0; i< 3072; i++){ |
455 |
whistomax[i] = -200; |
whistomax[i] = -200; |
456 |
whistocomp[i] = -200; |
whistocomp[i] = -200; |
457 |
whistofull[i] = -200; |
whistofull[i] = -200; |
458 |
whisto[i] = -200; |
whisto[i] = -200; |
459 |
} |
} |
460 |
|
|
461 |
// =============== |
// =============== |
462 |
// trasmitted data |
// trasmitted data |
463 |
// =============== |
// =============== |
464 |
|
|
465 |
address = 0; |
address = 0; |
466 |
ladder = 1; |
ladder = 1; |
467 |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
468 |
word = trk->TrackerData.At(iword); |
word = trk->TrackerData.At(iword); |
469 |
thisword = datadecode(word); |
thisword = datadecode(word); |
470 |
iword++; |
iword++; |
471 |
switch (thisword.type){ |
switch (thisword.type){ |
472 |
|
|
473 |
case 0: //ADC value |
case 0: //ADC value |
474 |
whisto[address] = thisword.decode; |
whisto[address] = thisword.decode; |
475 |
address++; |
address++; |
476 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
477 |
break; |
break; |
478 |
|
|
479 |
case 1: //address |
case 1: //address |
480 |
address = 1024*(ladder-1) + thisword.decode; |
address = 1024*(ladder-1) + thisword.decode; |
481 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
482 |
break; |
break; |
483 |
|
|
484 |
case 2: //end-of-ladder |
case 2: //end-of-ladder |
485 |
ladder = thisword.decode; |
ladder = thisword.decode; |
486 |
// cout << "Ladder " << ladder << "\n"; |
// cout << "Ladder " << ladder << "\n"; |
487 |
if(ladder==3){ |
if(ladder==3){ |
488 |
// end of compressed data - FILL HISTO |
// end of compressed data - FILL HISTO |
489 |
//cout << ">>> COMPRESSED data" << "\n"; |
//cout << ">>> COMPRESSED data" << "\n"; |
490 |
for(ii = 0; ii < 3072; ii++){ |
for(ii = 0; ii < 3072; ii++){ |
491 |
whistocomp[ii]=whisto[ii]; |
whistocomp[ii]=whisto[ii]; |
492 |
whisto[ii] = -200; |
whisto[ii] = -200; |
493 |
|
} |
494 |
|
address = 0; |
495 |
|
ladder = 1; |
496 |
|
}else if(ladder==6){ |
497 |
|
// end of full data - FILL HISTO |
498 |
|
//cout << ">>> FULL data" << "\n"; |
499 |
|
for(ii = 0; ii < 3072; ii++){ |
500 |
|
whistofull[ii]=whisto[ii]; |
501 |
|
whisto[ii] = -200; |
502 |
|
} |
503 |
|
address = 0; |
504 |
|
ladder = 1; |
505 |
|
}else{ |
506 |
|
if(ladder>3) ladder=ladder-3; |
507 |
|
address= ladder*1024; |
508 |
|
ladder = ladder + 1; |
509 |
} |
} |
510 |
address = 0; |
} |
|
ladder = 1; |
|
|
}else if(ladder==6){ |
|
|
// end of full data - FILL HISTO |
|
|
//cout << ">>> FULL data" << "\n"; |
|
|
for(ii = 0; ii < 3072; ii++){ |
|
|
whistofull[ii]=whisto[ii]; |
|
|
whisto[ii] = -200; |
|
|
} |
|
|
address = 0; |
|
|
ladder = 1; |
|
|
}else{ |
|
|
if(ladder>3) ladder=ladder-3; |
|
|
address= ladder*1024; |
|
|
ladder = ladder + 1; |
|
|
} |
|
511 |
} |
} |
|
} |
|
512 |
|
|
513 |
|
|
514 |
// =============== |
// =============== |
515 |
// maximum signals |
// maximum signals |
516 |
// =============== |
// =============== |
517 |
if(trk->signcluster[nn][0]!=0) whistomax[ 0+(int)trk->addrcluster[nn][0]] = whistocomp[ 0+(int)trk->addrcluster[nn][0]]; |
if(trk->signcluster[nn][0]!=0) whistomax[ 0+(int)trk->addrcluster[nn][0]] = whistocomp[ 0+(int)trk->addrcluster[nn][0]]; |
518 |
if(trk->signcluster[nn][1]!=0) whistomax[1024+(int)trk->addrcluster[nn][1]] = whistocomp[1024+(int)trk->addrcluster[nn][1]]; |
if(trk->signcluster[nn][1]!=0) whistomax[1024+(int)trk->addrcluster[nn][1]] = whistocomp[1024+(int)trk->addrcluster[nn][1]]; |
519 |
if(trk->signcluster[nn][2]!=0) whistomax[2048+(int)trk->addrcluster[nn][2]] = whistocomp[2048+(int)trk->addrcluster[nn][2]]; |
if(trk->signcluster[nn][2]!=0) whistomax[2048+(int)trk->addrcluster[nn][2]] = whistocomp[2048+(int)trk->addrcluster[nn][2]]; |
520 |
|
|
521 |
for(Int_t i = 0; i < 3072; i++){ |
for(Int_t i = 0; i < 3072; i++){ |
522 |
if(whistomax[i]>-200) imax[nn]=1; |
if(whistomax[i]>-200) imax[nn]=1; |
523 |
if(whistocomp[i]>-200) icomp[nn]=1; |
if(whistocomp[i]>-200) icomp[nn]=1; |
524 |
if(whistofull[i]>-200) ifull[nn]=1; |
if(whistofull[i]>-200) ifull[nn]=1; |
525 |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
if(totvalues==TOT || (totvalues<TOT && e<totvalues)){ |
526 |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
if(whistofull[i]>0){ |
527 |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
if(i==0) values << (short int)ndsp << " "; |
528 |
} |
values <<(short int) whistofull[i] <<" "; |
529 |
|
if(i==3071) values << endl; |
530 |
|
} |
531 |
|
} |
532 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
533 |
|
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
534 |
|
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
535 |
|
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
536 |
|
if(va1!=0 && ndsp==(int)(va1/100) && i>=128*((va1%100)-1)){ |
537 |
|
if(i<128*(va1%100)) |
538 |
|
histova[e]->Fill((Float_t)(i-128*((va1%100)-1)+1),whistofull[i]); |
539 |
|
} |
540 |
|
} |
541 |
|
} |
542 |
|
|
543 |
TBox b; |
if((tot<TOT && e<tot) || tot==TOT){ |
544 |
b.SetFillColor(6); |
TBox b; |
545 |
b.SetFillStyle(3945); |
TLine li,liva1; |
546 |
|
li.SetLineColor(38); |
547 |
c1[e]->cd(); |
li.SetLineStyle(4); |
548 |
trkpadtext[nn]->Draw(); |
li.SetLineWidth(2); |
549 |
trkpad[nn]->Draw(); |
liva1.SetLineColor(42); |
550 |
trkpad[nn]->cd(); |
liva1.SetLineStyle(3); |
551 |
trkpad[nn]->SetFillColor(10); |
liva1.SetLineWidth(1); |
552 |
|
|
553 |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
Float_t va1x=0; |
554 |
histocomp[nn][e]->SetLineStyle(1); |
|
555 |
histocomp[nn][e]->SetLineColor(38); |
if(va1!=0){ |
556 |
histocomp[nn][e]->SetFillColor(38); |
cva[e]->cd(); |
557 |
histocomp[nn][e]->SetLineWidth(1); |
pad->Draw(); |
558 |
histocomp[nn][e]->Draw(""); |
pad->cd(); |
559 |
|
pad->SetFillColor(10); |
560 |
histofull[nn][e]->SetLineColor(40); |
histova[e]->SetTitleSize(0.01); |
561 |
histofull[nn][e]->SetFillColor(40); |
histova[e]->GetYaxis()->SetRangeUser(1500,4500); |
562 |
histofull[nn][e]->SetLineWidth(1); |
histova[e]->SetLineColor(40); |
563 |
histofull[nn][e]->SetLineStyle(2); |
histova[e]->SetFillColor(40); |
564 |
|
histova[e]->SetLineWidth(1); |
565 |
histomax[nn][e]->SetLineColor(2); |
histova[e]->SetLineStyle(2); |
566 |
histomax[nn][e]->SetLineWidth(1); |
// histova[e]->GetYaxis()->SetLabelSize(0.03); |
567 |
histomax[nn][e]->SetLineStyle(3); |
histova[e]->Draw(""); |
568 |
|
cva[e]->Update(); |
569 |
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
} |
570 |
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
|
571 |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
c1[e]->cd(); |
572 |
histocomp[nn][e]->Draw("axis same"); |
trkpadtext[nn]->Draw(); |
573 |
if(nn==1){ |
trkpad[nn]->Draw(); |
574 |
b.DrawBox(2816.,-500.,3060.,4500.); |
trkpad[nn]->cd(); |
575 |
|
trkpad[nn]->SetFillColor(10); |
576 |
|
|
577 |
|
histocomp[nn][e]->SetTitleSize(0.1); |
578 |
|
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
579 |
|
histocomp[nn][e]->SetLineStyle(1); |
580 |
|
histocomp[nn][e]->SetLineColor(38); |
581 |
|
histocomp[nn][e]->SetFillColor(38); |
582 |
|
histocomp[nn][e]->SetLineWidth(1); |
583 |
|
histocomp[nn][e]->Draw(""); |
584 |
|
|
585 |
|
histofull[nn][e]->SetLineColor(40); |
586 |
|
histofull[nn][e]->SetFillColor(40); |
587 |
|
histofull[nn][e]->SetLineWidth(1); |
588 |
|
histofull[nn][e]->SetLineStyle(2); |
589 |
|
|
590 |
|
histomax[nn][e]->SetLineColor(2); |
591 |
|
histomax[nn][e]->SetLineWidth(1); |
592 |
|
histomax[nn][e]->SetLineStyle(3); |
593 |
|
|
594 |
|
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
595 |
|
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
596 |
|
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
597 |
|
histocomp[nn][e]->Draw("axis same"); |
598 |
|
if(nn==0){ |
599 |
|
b.SetFillColor(107); |
600 |
|
b.SetFillStyle(3945); |
601 |
|
b.DrawBox(768.,-500.,2047.,4500.); |
602 |
|
} |
603 |
|
else if(nn==1){ |
604 |
|
b.SetFillColor(6); |
605 |
|
b.SetFillStyle(3945); |
606 |
|
b.DrawBox(2944.,-500.,3060.,4500.); |
607 |
|
|
608 |
|
b.SetFillColor(107); |
609 |
|
b.SetFillStyle(3954); |
610 |
|
//b.DrawBox(384.,-500.,512.,4500.); |
611 |
|
b.DrawBox(2816.,-500.,2944.,4500.); |
612 |
|
b.DrawBox(2048.,-500.,2176.,4500.); |
613 |
|
} |
614 |
|
else if(nn==4){ |
615 |
|
b.SetFillColor(107); |
616 |
|
b.SetFillStyle(3954); |
617 |
|
b.DrawBox(384.,-500.,512.,4500.); |
618 |
|
} |
619 |
|
else if(nn==6){ |
620 |
|
b.SetFillColor(6); |
621 |
|
b.SetFillStyle(3945); |
622 |
|
b.DrawBox(2560.,-500.,2816.,4500.); |
623 |
|
b.DrawBox(1024.,-500.,1535.,4500.); |
624 |
|
|
625 |
|
b.SetFillColor(107); |
626 |
|
b.SetFillStyle(3954); |
627 |
|
b.DrawBox(512.,-500.,768.,4500.); |
628 |
|
b.DrawBox(1536.,-500.,1792.,4500.); |
629 |
|
} |
630 |
|
else if(nn==7){ |
631 |
|
b.SetFillColor(107); |
632 |
|
b.SetFillStyle(3954); |
633 |
|
b.DrawBox(512.,-500.,768.,4500.); |
634 |
|
} |
635 |
|
else if(nn==8){ |
636 |
|
b.SetFillColor(107); |
637 |
|
b.SetFillStyle(3954); |
638 |
|
b.DrawBox(512.,-500.,768.,4500.); |
639 |
|
} |
640 |
|
else if(nn==9){ |
641 |
|
b.SetFillColor(107); |
642 |
|
b.SetFillStyle(3954); |
643 |
|
b.DrawBox(256.,-500.,384.,4500.); |
644 |
|
//b.DrawBox(1280.,-500.,1408.,4500.); |
645 |
|
//b.DrawBox(1792.,-500.,1920.,4500.); |
646 |
|
} |
647 |
|
else if(nn==10){ |
648 |
|
b.SetFillColor(107); |
649 |
|
b.SetFillStyle(3954); |
650 |
|
b.DrawBox(2048.,-500.,3070.,4500.); |
651 |
|
} |
652 |
|
else if(nn==11){ |
653 |
|
b.SetFillColor(6); |
654 |
|
b.SetFillStyle(3945); |
655 |
|
b.DrawBox(768.,-500.,1024.,4500.); |
656 |
|
|
657 |
|
b.SetFillColor(107); |
658 |
|
b.SetFillStyle(3954); |
659 |
|
b.DrawBox(0.,-500.,512.,4500.); |
660 |
|
b.DrawBox(1920.,-500.,2560.,4500.); |
661 |
|
} |
662 |
|
for(int va=1; va<24; va++){ |
663 |
|
va1x=128*va; |
664 |
|
liva1.DrawLine(va1x,-500.,va1x,4500.); |
665 |
|
} |
666 |
|
li.DrawLine(1024.5,-500.,1024.5,4500.); |
667 |
|
li.DrawLine(2048.5,-500.,2048.5,4500.); |
668 |
|
c1[e]->Update(); |
669 |
|
} |
670 |
|
|
671 |
} |
} |
672 |
else if(nn==6){ |
}//end loop on views |
673 |
b.DrawBox(2560.,-500.,2816.,4500.); |
|
674 |
b.DrawBox(512.,-500.,768.,4500.); |
if((tot<TOT && e<tot) || tot==TOT){ |
675 |
b.DrawBox(1024.,-500.,1792.,4500.); |
stringstream nom1,nom2,nom3; |
676 |
|
nom1<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps("; |
677 |
|
nom2<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps"; |
678 |
|
nom3<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps)"; |
679 |
|
|
680 |
|
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
681 |
|
if(e==0){ |
682 |
|
c1[e]->Print(nom1.str().c_str(),"Portrait"); |
683 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Portrait"); |
684 |
|
} |
685 |
|
if(e>0 && tot>2){ |
686 |
|
c1[e]->Print(nom2.str().c_str(),"Portrait"); |
687 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Portrait"); |
688 |
|
} |
689 |
|
if(e==tot-1){ |
690 |
|
c1[e]->Print(nom2.str().c_str(),"Portrait"); |
691 |
|
if(va1!=0) cva[e]->Print(nom3.str().c_str(),"Portrait"); |
692 |
|
} |
693 |
} |
} |
694 |
else if(nn==11){ |
else{ |
695 |
b.DrawBox(768.,-500.,1024.,4500.); |
figsav+="."+outfile; |
696 |
|
c1[e]->Print(figsav.Data()); |
697 |
|
if(va1!=0){ |
698 |
|
figsava+="."+outfile; |
699 |
|
cva[e]->Print(figsava.Data()); |
700 |
|
} |
701 |
} |
} |
702 |
c1[e]->Update(); |
} |
703 |
|
|
704 |
}//end loop on views |
if(totvalues==TOT || (totvalues<TOT && e<totvalues)) |
705 |
|
values << (short int)0 << endl << endl; |
706 |
|
} |
707 |
|
stringstream com; |
708 |
|
|
709 |
c1[e]->Print(figsav.str().c_str()); |
values.close(); |
710 |
|
if(value==0){ |
711 |
|
com<<"rm -f "<<fname; |
712 |
|
system(com.str().c_str()); |
713 |
|
} |
714 |
|
// |
715 |
|
// Convert ps to pdf if required |
716 |
|
if(!strcmp(outfile.Data(),"pdf")){ |
717 |
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "<<out<<ffile<<"_FTrkScanQLook_EXPERT.pdf"; |
718 |
|
system(com.str().c_str()); |
719 |
|
printf("\n---> ps file converted in pdf format!\n"); |
720 |
|
com.str(""); |
721 |
|
com<<"rm -f "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "; |
722 |
|
system(com.str().c_str()); |
723 |
|
printf("---> ps file removed!\n\n"); |
724 |
|
com.str(""); |
725 |
} |
} |
726 |
|
|
727 |
return; |
return; |
728 |
} |
} |