1 |
/** |
2 |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
4 |
* autor: D.Fedele |
5 |
* version v2r00 |
6 |
* Parameters: |
7 |
* file - the path to the root file to analyze |
8 |
* outdir - total path of output file |
9 |
* event - the number of the single event to analyze |
10 |
* va1 - the number of the single va1 to analyze (dsp*100+va1) |
11 |
* 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> |
17 |
#include <sstream> |
18 |
#include <fstream> |
19 |
// |
20 |
#include <TPaveText.h> |
21 |
#include <TLatex.h> |
22 |
#include <TCanvas.h> |
23 |
#include <TGraph.h> |
24 |
#include <TFile.h> |
25 |
#include <TTree.h> |
26 |
#include <TStyle.h> |
27 |
#include <TString.h> |
28 |
// |
29 |
#include <physics/tracker/TrackerEvent.h> |
30 |
#include <PscuHeader.h> |
31 |
#include <EventHeader.h> |
32 |
#include <RunHeaderEvent.h> |
33 |
// |
34 |
|
35 |
using namespace std; |
36 |
|
37 |
typedef struct trkword{ |
38 |
int type; |
39 |
int decode; |
40 |
}; |
41 |
|
42 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
43 |
* |
44 |
| The function "datadecode" decodes the tracker words. |
45 |
* |
46 |
| Tracker words are of three types: |
47 |
* - ADC data |
48 |
| - strip address |
49 |
* - end of ladder |
50 |
| |
51 |
* The function returns a struct variable (trkword) |
52 |
| that contains two quantities, type and decode, which are assigned |
53 |
* the following values: |
54 |
| |
55 |
* type decode |
56 |
| ---------------------------------------------------- |
57 |
* -1 error 0 |
58 |
| 0 data 0-4095 ADC values |
59 |
* 1 address 0-1023 strip address (relative to ladder) |
60 |
| 2 end-of-ladder 1,2,3 ladder number (compressed acq mode) |
61 |
* 4,5,6 ladder number + 3 (full acq mode) |
62 |
| |
63 |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
64 |
trkword datadecode(int word){ |
65 |
int type =0; |
66 |
int data =0; |
67 |
int nodata = word&0xf000; |
68 |
int zero = 0; |
69 |
|
70 |
trkword thisword; |
71 |
|
72 |
switch (nodata>>12){ |
73 |
|
74 |
case 0: |
75 |
|
76 |
thisword.decode = word; |
77 |
thisword.type = 0; |
78 |
// cout << thisword.decode << "\n"; |
79 |
return (thisword); //>>>>> ADC data (0) |
80 |
|
81 |
case 1: |
82 |
|
83 |
type = word&0xC00; |
84 |
data = word&0x3ff; |
85 |
|
86 |
switch(type>>10){ |
87 |
|
88 |
case 0: |
89 |
thisword.decode = data; |
90 |
thisword.type = 1; //>>> address (1) |
91 |
return (thisword); |
92 |
|
93 |
case 2: |
94 |
// if(data>=4)data = data-3; |
95 |
if(data>6){ |
96 |
printf("Error on data \n"); |
97 |
thisword.decode = zero; |
98 |
thisword.type = -1; |
99 |
return (thisword); //>>>>> error (-1) |
100 |
} |
101 |
thisword.decode = data; |
102 |
thisword.type = 2; |
103 |
return (thisword); //>>> end-of-ladder |
104 |
|
105 |
default: |
106 |
printf("Error on data \n"); |
107 |
thisword.decode = zero; |
108 |
thisword.type = -1; |
109 |
return (thisword); //>>>>> error (-1) |
110 |
|
111 |
} |
112 |
|
113 |
default: |
114 |
|
115 |
printf("Error on data \n"); |
116 |
thisword.decode = zero; |
117 |
thisword.type = -1; |
118 |
return (thisword); //>>>>> error (-1) |
119 |
} |
120 |
} |
121 |
|
122 |
|
123 |
void FTrkScanQLook_EXPERT(TString file, TString outdir,Int_t event, Int_t va1, Int_t value, TString outfile) |
124 |
{ |
125 |
|
126 |
// |
127 |
// obtain information about the data file and select the output file |
128 |
Int_t dwpos = file.Last('/'); |
129 |
Int_t dwpos1 = file.Last('.'); |
130 |
TString base,ffile ; |
131 |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
132 |
if(dwpos>0) base=file(0,dwpos); |
133 |
|
134 |
TString out; |
135 |
if(outdir.Length()==0){ |
136 |
out = base; |
137 |
}else{ |
138 |
out = outdir; |
139 |
} |
140 |
if(out.Last('/')+1<out.Length()) out+="/"; |
141 |
|
142 |
pamela::tracker::TrackerEvent *trk=0; |
143 |
pamela::EventHeader *eh=0,*eH=0; |
144 |
pamela::PscuHeader *ph=0,*pH=0; |
145 |
pamela::RunHeaderEvent *reh=0; |
146 |
pamela::EventCounter *cod=0; |
147 |
|
148 |
pamela::PacketType *pctp=0; |
149 |
// open files |
150 |
TFile *trackerFile = new TFile(file); |
151 |
if ( !trackerFile ){ |
152 |
trackerFile->Close(); |
153 |
printf("No tracker file! \n"); |
154 |
return; |
155 |
} |
156 |
|
157 |
//Takes the tree and branches |
158 |
TTree *tr = (TTree*)trackerFile->Get("Physics"); |
159 |
tr->SetBranchAddress("Tracker",&trk); |
160 |
tr->SetBranchAddress("Header",&eh); |
161 |
|
162 |
TTree *otr = (TTree*)trackerFile->Get("RunHeader"); |
163 |
otr->SetBranchAddress("Header",&eH); |
164 |
otr->SetBranchAddress("RunHeader",&reh); |
165 |
|
166 |
// Define variables |
167 |
Int_t nevents = tr->GetEntries(); |
168 |
Int_t neventH = otr->GetEntries(); |
169 |
if ( nevents <= 0 ) { |
170 |
trackerFile->Close(); |
171 |
printf("The file is empty, exiting...\n"); |
172 |
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); |
186 |
printf(" Number of Header Entries: %d\n",neventH); |
187 |
|
188 |
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++){ |
194 |
otr->GetEntry(i); |
195 |
pH = eH->GetPscuHeader(); |
196 |
if(reh->TRK_CALIB_USED!=104){ |
197 |
obt = pH->GetOrbitalTime(); |
198 |
cal="Event with online calibration"; |
199 |
break; |
200 |
} |
201 |
if(i==neventH-1){ |
202 |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
203 |
eve=2; |
204 |
} |
205 |
} |
206 |
if(eve==3){ |
207 |
for(Int_t i=0;i<nevents;i++){ |
208 |
tr->GetEntry(i); |
209 |
ph = eh->GetPscuHeader(); |
210 |
cod = eh->GetCounter(); |
211 |
if(i==0) cin=cod->Get(pctp->CalibTrk1); |
212 |
if(reh->TRK_CALIB_USED==104) continue; |
213 |
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][tot]; //histos of max signals |
231 |
TH1F *histocomp[12][tot]; //histos of compressed data |
232 |
TH1F *histofull[12][tot]; //histos of full data |
233 |
TCanvas *c1[tot]; |
234 |
TH1F *histova[tot]; //histos of va1 signals |
235 |
TCanvas *cva[tot]; |
236 |
|
237 |
|
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); |
258 |
//============================================================================ |
259 |
|
260 |
gStyle->SetLabelSize(0.06,"x"); |
261 |
gStyle->SetLabelSize(0.06,"y"); |
262 |
//gStyle->SetTitleFontSize(0.1); |
263 |
gStyle->SetFillColor(10); |
264 |
gStyle->SetTitleFillColor(10); |
265 |
gStyle->SetTitleOffset(-1,"Y"); |
266 |
gStyle->SetOptStat(0); |
267 |
|
268 |
// draw display area |
269 |
|
270 |
stringstream fromfile,title,hid,message; |
271 |
TString figsa="",figsav="",figsava=""; |
272 |
|
273 |
TPad *trkpad[12],*pad=0; //pad for histos |
274 |
TPaveText *trkpadtext[12]; //pad for header |
275 |
|
276 |
if((tot<TOT && e<tot) || tot==TOT){ |
277 |
Int_t canvasx=1200; |
278 |
Int_t canvasy=900; |
279 |
figsav=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
280 |
figsav+=event+1; |
281 |
c1[e] = new TCanvas(figsav.Data(),"FTrkQLookSCAN",canvasx,canvasy); |
282 |
c1[e]->SetFillColor(10); |
283 |
c1[e]->Range(0,0,1,1); |
284 |
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 */ |
352 |
pad = new TPad("padva"," ",0,0,1,0.97,18,0,0); |
353 |
pad->SetFillColor(19); |
354 |
pad->SetFrameFillColor(10); |
355 |
} |
356 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
357 |
// create header dump retrieving event info |
358 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
359 |
Int_t ndsp=0; |
360 |
|
361 |
Double_t whistomax[3072]; |
362 |
Double_t whisto[3072]; |
363 |
Double_t whistocomp[3072]; |
364 |
Double_t whistofull[3072]; |
365 |
|
366 |
//============================================= |
367 |
// transmitted words |
368 |
Int_t word = 0; |
369 |
Int_t iword = 0; |
370 |
Int_t TOTDATAlength_check = 0; |
371 |
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
372 |
trkword thisword; |
373 |
|
374 |
Int_t address,ladder; |
375 |
|
376 |
|
377 |
for(Int_t n = 0; n<12; n++){ |
378 |
|
379 |
ndsp = trk->DSPnumber[n]; |
380 |
nn = ndsp-1; |
381 |
ifull[nn]=0; |
382 |
icomp[nn]=0; |
383 |
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 |
391 |
* |
392 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
393 |
|
394 |
trkpadtext[nn]->SetTextFont(40); |
395 |
trkpadtext[nn]->SetFillColor(33); |
396 |
trkpadtext[nn]->SetTextSize(0.012); |
397 |
trkpadtext[nn]->SetTextAlign(13); |
398 |
|
399 |
trkpadtext[nn]->AddText(" "); |
400 |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
401 |
trkpadtext[nn]->AddText(message.str().c_str()); |
402 |
message.str(""); |
403 |
message<<"Event number --------> "<<trk->eventn[n]; |
404 |
trkpadtext[nn]->AddText(message.str().c_str()); |
405 |
message.str(""); |
406 |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
407 |
trkpadtext[nn]->AddText(message.str().c_str()); |
408 |
message.str(""); |
409 |
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]); |
411 |
trkpadtext[nn]->AddText(message.str().c_str()); |
412 |
message.str(""); |
413 |
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]; |
415 |
trkpadtext[nn]->AddText(message.str().c_str()); |
416 |
message.str(""); |
417 |
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]; |
419 |
trkpadtext[nn]->AddText(message.str().c_str()); |
420 |
message.str(""); |
421 |
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
422 |
trkpadtext[nn]->AddText(message.str().c_str()); |
423 |
message.str(""); |
424 |
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
425 |
trkpadtext[nn]->AddText(message.str().c_str()); |
426 |
message.str(""); |
427 |
trkpadtext[nn]->AddText(" "); |
428 |
message<<"CRC --> "<<trk->crc[n]; |
429 |
trkpadtext[nn]->AddText(message.str().c_str()); |
430 |
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]; |
432 |
trkpadtext[nn]->AddText(message.str().c_str()); |
433 |
message.str(""); |
434 |
trkpadtext[nn]->AddText(" "); |
435 |
trkpadtext[nn]->AddLine(0,0,0,0); |
436 |
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
437 |
trkpadtext[nn]->AddText(message.str().c_str()); |
438 |
message.str(""); |
439 |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
440 |
trkpadtext[nn]->AddText(message.str().c_str()); |
441 |
message.str(""); |
442 |
trkpadtext[nn]->AddText(" "); |
443 |
|
444 |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
445 |
} |
446 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
447 |
* |
448 |
* Plot event LEVEL0 histo |
449 |
* |
450 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
451 |
|
452 |
//============================================= |
453 |
} |
454 |
for(Int_t i = 0; i< 3072; i++){ |
455 |
whistomax[i] = -200; |
456 |
whistocomp[i] = -200; |
457 |
whistofull[i] = -200; |
458 |
whisto[i] = -200; |
459 |
} |
460 |
|
461 |
// =============== |
462 |
// trasmitted data |
463 |
// =============== |
464 |
|
465 |
address = 0; |
466 |
ladder = 1; |
467 |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
468 |
word = trk->TrackerData.At(iword); |
469 |
thisword = datadecode(word); |
470 |
iword++; |
471 |
switch (thisword.type){ |
472 |
|
473 |
case 0: //ADC value |
474 |
whisto[address] = thisword.decode; |
475 |
address++; |
476 |
// cout << " adr " << address << "\n"; |
477 |
break; |
478 |
|
479 |
case 1: //address |
480 |
address = 1024*(ladder-1) + thisword.decode; |
481 |
// cout << " adr " << address << "\n"; |
482 |
break; |
483 |
|
484 |
case 2: //end-of-ladder |
485 |
ladder = thisword.decode; |
486 |
// cout << "Ladder " << ladder << "\n"; |
487 |
if(ladder==3){ |
488 |
// end of compressed data - FILL HISTO |
489 |
//cout << ">>> COMPRESSED data" << "\n"; |
490 |
for(ii = 0; ii < 3072; ii++){ |
491 |
whistocomp[ii]=whisto[ii]; |
492 |
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 |
} |
511 |
} |
512 |
|
513 |
|
514 |
// =============== |
515 |
// maximum signals |
516 |
// =============== |
517 |
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]]; |
519 |
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++){ |
522 |
if(whistomax[i]>-200) imax[nn]=1; |
523 |
if(whistocomp[i]>-200) icomp[nn]=1; |
524 |
if(whistofull[i]>-200) ifull[nn]=1; |
525 |
if(totvalues==TOT || (totvalues<TOT && e<totvalues)){ |
526 |
if(whistofull[i]>0){ |
527 |
if(i==0) values << 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 |
if((tot<TOT && e<tot) || tot==TOT){ |
544 |
TBox b; |
545 |
TLine li,liva1; |
546 |
li.SetLineColor(38); |
547 |
li.SetLineStyle(4); |
548 |
li.SetLineWidth(2); |
549 |
liva1.SetLineColor(42); |
550 |
liva1.SetLineStyle(3); |
551 |
liva1.SetLineWidth(1); |
552 |
|
553 |
Float_t va1x=0; |
554 |
|
555 |
if(va1!=0){ |
556 |
cva[e]->cd(); |
557 |
pad->Draw(); |
558 |
pad->cd(); |
559 |
pad->SetFillColor(10); |
560 |
histova[e]->SetTitleSize(0.01); |
561 |
histova[e]->GetYaxis()->SetRangeUser(1500,4500); |
562 |
histova[e]->SetLineColor(40); |
563 |
histova[e]->SetFillColor(40); |
564 |
histova[e]->SetLineWidth(1); |
565 |
histova[e]->SetLineStyle(2); |
566 |
// histova[e]->GetYaxis()->SetLabelSize(0.03); |
567 |
histova[e]->Draw(""); |
568 |
cva[e]->Update(); |
569 |
} |
570 |
|
571 |
c1[e]->cd(); |
572 |
trkpadtext[nn]->Draw(); |
573 |
trkpad[nn]->Draw(); |
574 |
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 |
}//end loop on views |
673 |
|
674 |
if((tot<TOT && e<tot) || tot==TOT){ |
675 |
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{ |
695 |
figsav+="."+outfile; |
696 |
c1[e]->Print(figsav.Data()); |
697 |
if(va1!=0){ |
698 |
figsava+="."+outfile; |
699 |
cva[e]->Print(figsava.Data()); |
700 |
} |
701 |
} |
702 |
} |
703 |
|
704 |
if(totvalues==TOT || (totvalues<TOT && e<totvalues)) |
705 |
values << 0 << endl << endl; |
706 |
} |
707 |
stringstream com; |
708 |
|
709 |
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; |
728 |
} |