2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version v1r06 |
* version v2r05 |
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*10 + # of calibration (if #of cal = 0, select every calibration) |
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> |
29 |
#include <physics/tracker/TrackerEvent.h> |
#include <physics/tracker/TrackerEvent.h> |
30 |
#include <PscuHeader.h> |
#include <PscuHeader.h> |
31 |
#include <EventHeader.h> |
#include <EventHeader.h> |
32 |
|
#include <CalibTrk1Event.h> |
33 |
|
#include <CalibTrk2Event.h> |
34 |
#include <RunHeaderEvent.h> |
#include <RunHeaderEvent.h> |
35 |
// |
// |
36 |
|
|
122 |
} |
} |
123 |
|
|
124 |
|
|
125 |
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) |
126 |
{ |
{ |
127 |
|
|
128 |
// |
// |
145 |
pamela::EventHeader *eh=0,*eH=0; |
pamela::EventHeader *eh=0,*eH=0; |
146 |
pamela::PscuHeader *ph=0,*pH=0; |
pamela::PscuHeader *ph=0,*pH=0; |
147 |
pamela::RunHeaderEvent *reh=0; |
pamela::RunHeaderEvent *reh=0; |
148 |
|
pamela::CalibTrk1Event *trk1 = 0; |
149 |
|
pamela::CalibTrk2Event *trk2 = 0; |
150 |
|
pamela::EventCounter *cod=0; |
151 |
|
|
152 |
|
pamela::PacketType *pctp=0; |
153 |
// open files |
// open files |
154 |
TFile *trackerFile = new TFile(file); |
TFile *trackerFile = new TFile(file); |
155 |
if ( !trackerFile ){ |
if ( !trackerFile ){ |
167 |
otr->SetBranchAddress("Header",&eH); |
otr->SetBranchAddress("Header",&eH); |
168 |
otr->SetBranchAddress("RunHeader",&reh); |
otr->SetBranchAddress("RunHeader",&reh); |
169 |
|
|
170 |
|
TTree *otr1 = (TTree*)trackerFile->Get("CalibTrk1"); |
171 |
|
otr1->SetBranchAddress("CalibTrk1", &trk1); |
172 |
|
TTree *otr2 = (TTree*)trackerFile->Get("CalibTrk2"); |
173 |
|
otr2->SetBranchAddress("CalibTrk2", &trk2); |
174 |
|
|
175 |
// Define variables |
// Define variables |
176 |
Int_t nevents = tr->GetEntries(); |
Int_t nevents = tr->GetEntries(); |
177 |
Int_t neventH = otr->GetEntries(); |
Int_t neventH = otr->GetEntries(); |
178 |
|
Int_t cevents=0; |
179 |
|
|
180 |
|
if(otr1->GetEntries()==otr2->GetEntries()) |
181 |
|
cevents = otr1->GetEntries(); |
182 |
|
else printf("\nWARNING: CalibTrk1 entries is different from CalibTrk2 entries\n\n"); |
183 |
|
|
184 |
|
|
185 |
if ( nevents <= 0 ) { |
if ( nevents <= 0 ) { |
186 |
trackerFile->Close(); |
trackerFile->Close(); |
187 |
printf("The file is empty, exiting...\n"); |
printf("The file is empty, exiting...\n"); |
188 |
return; |
return; |
189 |
} |
} |
190 |
|
|
191 |
|
// |
192 |
|
// open the output text files for the alarms |
193 |
|
TString fname = out+ffile; |
194 |
|
int slen=fname.Length(); |
195 |
|
int last=fname.Last('_'); |
196 |
|
if(last<(slen-1))fname.Append('_'); |
197 |
|
fname.Append("FTrk-DSP-values.dat"); |
198 |
|
ofstream values(fname,ios::out); |
199 |
|
|
200 |
|
// |
201 |
printf("\n Number of Entries: %d\n",nevents); |
printf("\n Number of Entries: %d\n",nevents); |
202 |
printf(" Number of Header Entries: %d\n",neventH); |
printf(" Number of Header Entries: %d\n",neventH); |
203 |
|
printf(" Number of Calibration: %d\n",cevents); |
204 |
|
|
205 |
Long64_t obt=0; |
Long64_t obt=0,hobt[neventH]; |
206 |
Int_t ev[2]; |
Int_t eve,cin=0,cins=0,br=0; |
207 |
TString cal=""; |
TString cal=""; |
208 |
|
|
209 |
ev[0]=0; |
eve=3; |
|
ev[1]=0; |
|
210 |
for(Int_t i=0;i<neventH;i++){ |
for(Int_t i=0;i<neventH;i++){ |
211 |
otr->GetEntry(i); |
otr->GetEntry(i); |
212 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
213 |
if(reh->TRK_CALIB_USED!=104){ |
hobt[i]= pH->GetOrbitalTime(); |
214 |
|
if(reh->TRK_CALIB_USED!=104 && br==0){ |
215 |
obt = pH->GetOrbitalTime(); |
obt = pH->GetOrbitalTime(); |
216 |
cal="Event with online calibration"; |
cal="Event with online calibration"; |
217 |
break; |
br=1; |
218 |
} |
} |
219 |
if(i==neventH-1){ |
if(i==neventH-1 && br==0){ |
220 |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
221 |
ev[0]=2; |
eve=2; |
|
ev[1]=3; |
|
222 |
} |
} |
223 |
} |
} |
224 |
if(ev[0]==0){ |
|
225 |
|
int tot=2,totvalues=0,TOT=0,totsum=0; |
226 |
|
if(event<0) tot=abs(event); |
227 |
|
if(value>0) totvalues=value/10; |
228 |
|
|
229 |
|
TOT= tot > totvalues ? tot : totvalues; |
230 |
|
if(value>0) totsum= (value/10) > 100 ? (value/10) : 100; |
231 |
|
else totsum=100; |
232 |
|
|
233 |
|
Int_t calev=cevents; |
234 |
|
|
235 |
|
TH1F *histomax[12][tot]; //histos of max signals |
236 |
|
TH1F *histocomp[12][tot]; //histos of compressed data |
237 |
|
TH1F *histofull[12][tot]; //histos of full data |
238 |
|
TCanvas *c1[tot],*csum[calev]; |
239 |
|
TH1F *histova[tot]; |
240 |
|
TGraph*sum[12][calev][totsum/2]; |
241 |
|
TCanvas *cva[tot]; |
242 |
|
|
243 |
|
TPad *trkpad[12]; //pad for histos |
244 |
|
|
245 |
|
stringstream fromfile,title,hid,message; |
246 |
|
TString figsa="",figsav="",figsava=""; |
247 |
|
Int_t canvasx=1200; |
248 |
|
Int_t canvasy=900; |
249 |
|
|
250 |
|
TLatex *t=new TLatex(); |
251 |
|
t->SetTextFont(32); |
252 |
|
t->SetTextColor(1); |
253 |
|
t->SetTextAlign(12); |
254 |
|
t->SetTextSize(0.02); |
255 |
|
|
256 |
|
gStyle->SetLabelSize(0.06,"x"); |
257 |
|
gStyle->SetLabelSize(0.06,"y"); |
258 |
|
gStyle->SetTitleFontSize(0.1); |
259 |
|
gStyle->SetFillColor(10); |
260 |
|
gStyle->SetTitleFillColor(10); |
261 |
|
gStyle->SetOptStat(0); |
262 |
|
|
263 |
|
Int_t p[12],psum=0; |
264 |
|
Int_t whistostrip[3072]; |
265 |
|
for(int s=0;s<3072;s++) whistostrip[s]=s+1; |
266 |
|
|
267 |
|
if(eve==3){ |
268 |
for(Int_t i=0;i<nevents;i++){ |
for(Int_t i=0;i<nevents;i++){ |
269 |
tr->GetEntry(i); |
tr->GetEntry(i); |
270 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
271 |
if(ph->GetOrbitalTime()>obt){ |
if(reh->TRK_CALIB_USED==104) continue; |
272 |
ev[0]=i+2; |
cod = eh->GetCounter(); |
273 |
ev[1]=i+3; |
if(value%10!=0){ |
274 |
break; |
if(i==0) cin=cod->Get(pctp->CalibTrk1)+((value%10)-1); |
275 |
|
if(cod->Get(pctp->CalibTrk1)==cin+1){ |
276 |
|
eve=i+3; |
277 |
|
cin=100; |
278 |
|
} |
279 |
|
} |
280 |
|
else { |
281 |
|
if(i==0) cin=cod->Get(pctp->CalibTrk1); |
282 |
|
if(event<0 && cod->Get(pctp->CalibTrk1)==cin+1){ |
283 |
|
eve=i+3; |
284 |
|
cin=100; |
285 |
|
} |
286 |
|
else if(event>=0 && ph->GetOrbitalTime()>obt && obt>0){ |
287 |
|
eve=i+3; |
288 |
|
obt=-1; |
289 |
|
} |
290 |
|
} |
291 |
|
if(i==0) cins=cod->Get(pctp->CalibTrk1); |
292 |
|
if(cod->Get(pctp->CalibTrk1)==cins+1){ |
293 |
|
psum=1; |
294 |
|
cins=cod->Get(pctp->CalibTrk1); |
295 |
|
} |
296 |
|
if(psum==1){ |
297 |
|
figsa=out+ffile+"_FTrkScanQLook_EXPERT_sumof"; |
298 |
|
figsa+=totsum; |
299 |
|
figsa+="events_cal"; |
300 |
|
figsa+=cins; |
301 |
|
csum[cins-1] = new TCanvas(figsa.Data(),"FTrkQLookSCAN",canvasx,canvasy); |
302 |
|
csum[cins-1]->SetFillColor(10); |
303 |
|
csum[cins-1]->Range(0,0,1,1); |
304 |
|
fromfile.str(""); |
305 |
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Sum of "<<totsum<<" events after the "<<cins<<" calibration at OBT= "<<hobt[(cod->Get(pctp->RunHeader))-1]; |
306 |
|
t->SetTextSize(0.02); |
307 |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
308 |
|
|
309 |
|
// draw pads |
310 |
|
Double_t posy = 0.95; // up y-coord - top pads |
311 |
|
Double_t hpad = 0.15; // pad height |
312 |
|
Double_t posx1=0; // left x-coord - pad column |
313 |
|
Double_t posx0=0; // x-coord - column division |
314 |
|
Double_t wrel = 0.6; // relative x size of first sub-column |
315 |
|
Double_t marg = 0.004; // margin among pads |
316 |
|
|
317 |
|
hpad = (posy-marg*11)/6; |
318 |
|
wrel = (1-marg*4)/2; |
319 |
|
for(Int_t n = 0; n<12; n++){ |
320 |
|
if ( (n+1)%2 ) { |
321 |
|
if(n>1)posy = posy-(marg*2+hpad); |
322 |
|
posx1 = marg; |
323 |
|
posx0 = posx1 + wrel; |
324 |
|
} else { |
325 |
|
posx1 = posx0 + 2*marg; |
326 |
|
posx0 = posx1 + wrel; |
327 |
|
}; |
328 |
|
|
329 |
|
/* -----------> pad for histograms */ |
330 |
|
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
331 |
|
trkpad[n]->SetFillColor(19); |
332 |
|
trkpad[n]->SetFrameFillColor(10); |
333 |
|
|
334 |
|
p[n]=0; |
335 |
|
} |
336 |
|
} |
337 |
|
if(psum>0 && psum<=totsum){ |
338 |
|
// = = = = = = = = = = = = = = = = = = = = = = = = = |
339 |
|
// create header dump retrieving event info |
340 |
|
// = = = = = = = = = = = = = = = = = = = = = = = = = |
341 |
|
Int_t ndsp=0; |
342 |
|
|
343 |
|
Int_t whistomax[3072]; |
344 |
|
Int_t whisto[3072]; |
345 |
|
Int_t whistocomp[3072]; |
346 |
|
Int_t whistofull[3072]; |
347 |
|
|
348 |
|
// // transmitted words |
349 |
|
Int_t word = 0; |
350 |
|
Int_t iword = 0; |
351 |
|
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
352 |
|
trkword thisword; |
353 |
|
|
354 |
|
Int_t address,ladder; |
355 |
|
|
356 |
|
|
357 |
|
for(Int_t n = 0; n<12; n++){ |
358 |
|
ndsp = trk->DSPnumber[n]; |
359 |
|
nn = ndsp-1; |
360 |
|
ifull[nn]=0; |
361 |
|
icomp[nn]=0; |
362 |
|
imax[nn]=0; |
363 |
|
|
364 |
|
for(Int_t vi = 0; vi< 3072; vi++){ |
365 |
|
whistomax[vi] = -200; |
366 |
|
whistocomp[vi] = -200; |
367 |
|
whistofull[vi] = -200; |
368 |
|
whisto[vi] = -200; |
369 |
|
} |
370 |
|
|
371 |
|
// // trasmitted data |
372 |
|
// |
373 |
|
address = 0; |
374 |
|
ladder = 1; |
375 |
|
for(Int_t vi = 0; vi < trk->DATAlength[n] ; vi++){ |
376 |
|
word = trk->TrackerData.At(iword); |
377 |
|
thisword = datadecode(word); |
378 |
|
iword++; |
379 |
|
switch (thisword.type){ |
380 |
|
|
381 |
|
case 0: //ADC value |
382 |
|
whisto[address] = thisword.decode; |
383 |
|
address++; |
384 |
|
// cout << " adr " << address << "\n"; |
385 |
|
break; |
386 |
|
|
387 |
|
case 1: //address |
388 |
|
address = 1024*(ladder-1) + thisword.decode; |
389 |
|
// cout << " adr " << address << "\n"; |
390 |
|
break; |
391 |
|
|
392 |
|
case 2: //end-of-ladder |
393 |
|
ladder = thisword.decode; |
394 |
|
// cout << "Ladder " << ladder << "\n"; |
395 |
|
if(ladder==3){ |
396 |
|
// end of compressed data - FILL HISTO |
397 |
|
//cout << ">>> COMPRESSED data" << "\n"; |
398 |
|
for(ii = 0; ii < 3072; ii++){ |
399 |
|
whistocomp[ii]=whisto[ii]; |
400 |
|
whisto[ii] = -200; |
401 |
|
} |
402 |
|
address = 0; |
403 |
|
ladder = 1; |
404 |
|
}else if(ladder==6){ |
405 |
|
// end of full data - FILL HISTO |
406 |
|
//cout << ">>> FULL data" << "\n"; |
407 |
|
for(ii = 0; ii < 3072; ii++){ |
408 |
|
whistofull[ii]=whisto[ii]; |
409 |
|
whisto[ii] = -200; |
410 |
|
} |
411 |
|
address = 0; |
412 |
|
ladder = 1; |
413 |
|
}else{ |
414 |
|
if(ladder>3) ladder=ladder-3; |
415 |
|
address= ladder*1024; |
416 |
|
ladder = ladder + 1; |
417 |
|
} |
418 |
|
} |
419 |
|
} |
420 |
|
|
421 |
|
for(Int_t vi = 0; vi < 3072; vi++){ |
422 |
|
if(whistofull[vi]>-200){ |
423 |
|
if(vi==3071){ |
424 |
|
sum[nn][cins-1][p[nn]] = new TGraph(3072,whistostrip,whistofull); |
425 |
|
p[nn]++; |
426 |
|
} |
427 |
|
if(value%10==0 && value>0){ |
428 |
|
if(whistofull[vi]>0){ |
429 |
|
if(vi==0) values << (short int)ndsp << " "; |
430 |
|
values <<(short int) whistofull[vi] <<" "; |
431 |
|
if(vi==3071) values << endl; |
432 |
|
} |
433 |
|
} |
434 |
|
} |
435 |
|
} |
436 |
|
} |
437 |
|
psum++; |
438 |
|
if(value%10==0 && value>0) values << (short int)0 << endl << endl; |
439 |
|
} |
440 |
|
if(psum==totsum+1){ |
441 |
|
if(value%10==0 && value>0) values << (short int)(-cins) << endl << endl; |
442 |
|
psum=0; |
443 |
|
for(Int_t vi = 0; vi < 12; vi++){ |
444 |
|
TLine li,liva1; |
445 |
|
li.SetLineColor(38); |
446 |
|
li.SetLineStyle(4); |
447 |
|
li.SetLineWidth(2); |
448 |
|
liva1.SetLineColor(42); |
449 |
|
liva1.SetLineStyle(3); |
450 |
|
liva1.SetLineWidth(1); |
451 |
|
|
452 |
|
Float_t va1x=0; |
453 |
|
csum[cins-1]->cd(); |
454 |
|
trkpad[vi]->Draw(); |
455 |
|
trkpad[vi]->cd(); |
456 |
|
trkpad[vi]->SetFillColor(10); |
457 |
|
|
458 |
|
stringstream tit,hid; |
459 |
|
tit.str(""); |
460 |
|
hid.str(""); |
461 |
|
tit<<"DSP "<<vi+1; |
462 |
|
sum[vi][cins-1][0]->SetTitle(tit.str().c_str()); |
463 |
|
sum[vi][cins-1][0]->GetXaxis()->SetTitle("channel id"); |
464 |
|
sum[vi][cins-1][0]->GetXaxis()->CenterTitle(); |
465 |
|
sum[vi][cins-1][0]->GetXaxis()->SetRangeUser(0,3073); |
466 |
|
sum[vi][cins-1][0]->GetXaxis()->SetTitleSize(0.06); |
467 |
|
sum[vi][cins-1][0]->GetXaxis()->SetTitleOffset(0.8); |
468 |
|
sum[vi][cins-1][0]->GetYaxis()->SetTitle("ADC value"); |
469 |
|
sum[vi][cins-1][0]->GetYaxis()->SetTitleSize(0.09); |
470 |
|
sum[vi][cins-1][0]->GetYaxis()->SetTitleOffset(0.4); |
471 |
|
sum[vi][cins-1][0]->GetYaxis()->CenterTitle(); |
472 |
|
sum[vi][cins-1][0]->GetYaxis()->SetRangeUser(0,4500); |
473 |
|
sum[vi][cins-1][0]->SetMarkerStyle(20); |
474 |
|
sum[vi][cins-1][0]->SetMarkerSize(0.1); |
475 |
|
sum[vi][cins-1][0]->SetMarkerColor(4); |
476 |
|
sum[vi][cins-1][0]->Draw("ap"); |
477 |
|
hid<<p[vi]<<" events"; |
478 |
|
t->SetTextSize(0.11); |
479 |
|
t->DrawLatex(2400,4250,hid.str().c_str()); |
480 |
|
for(int pi=1; pi<p[vi];pi++){ |
481 |
|
sum[vi][cins-1][pi]->SetMarkerStyle(21); |
482 |
|
sum[vi][cins-1][pi]->SetMarkerSize(0.1); |
483 |
|
sum[vi][cins-1][pi]->SetMarkerColor(4); |
484 |
|
sum[vi][cins-1][pi]->Draw("p"); |
485 |
|
} |
486 |
|
for(int va=1; va<24; va++){ |
487 |
|
va1x=128*va; |
488 |
|
liva1.DrawLine(va1x,0.,va1x,4500.); |
489 |
|
} |
490 |
|
li.DrawLine(1024.5,0.,1024.5,4500.); |
491 |
|
li.DrawLine(2048.5,0.,2048.5,4500.); |
492 |
|
csum[cins-1]->Update(); |
493 |
|
hid.str(""); |
494 |
|
} |
495 |
|
if(strcmp(outfile.Data(),"ps") && strcmp(outfile.Data(),"pdf")){ |
496 |
|
figsa+="."+outfile; |
497 |
|
csum[cins-1]->Print(figsa.Data()); |
498 |
|
} |
499 |
|
} |
500 |
|
|
501 |
|
} |
502 |
|
} |
503 |
|
|
504 |
|
if(!strcmp(outfile.Data(),"ps") || !strcmp(outfile.Data(),"pdf")){ |
505 |
|
stringstream nom1,nom2,nom3; |
506 |
|
nom1<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps("; |
507 |
|
nom2<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps"; |
508 |
|
nom3<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps)"; |
509 |
|
|
510 |
|
for(int va=0; va<cevents; va++){ |
511 |
|
if(cevents==1) csum[va]->Print(nom2.str().c_str(),"Landscape"); |
512 |
|
if(cevents>2){ |
513 |
|
if(va==0) csum[va]->Print(nom1.str().c_str(),"Landscape"); |
514 |
|
if(va>0 && va<cevents-1) csum[va]->Print(nom2.str().c_str(),"Landscape"); |
515 |
|
if(va>0 && va==cevents-1) csum[va]->Print(nom3.str().c_str(),"Landscape"); |
516 |
} |
} |
517 |
} |
} |
518 |
|
} |
519 |
|
// |
520 |
|
// Convert ps to pdf if required |
521 |
|
if(!strcmp(outfile.Data(),"pdf")){ |
522 |
|
stringstream com; |
523 |
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.pdf"; |
524 |
|
system(com.str().c_str()); |
525 |
|
printf("\n---> ps file converted in pdf format!\n"); |
526 |
|
com.str(""); |
527 |
|
com<<"rm -f "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps "; |
528 |
|
system(com.str().c_str()); |
529 |
|
printf("---> ps file removed!\n\n"); |
530 |
|
com.str(""); |
531 |
} |
} |
532 |
|
|
533 |
|
|
|
TH1F *histomax[12][2]; //histos of max signals |
|
|
TH1F *histocomp[12][2]; //histos of compressed data |
|
|
TH1F *histofull[12][2]; //histos of full data |
|
|
TCanvas *c1[2]; |
|
534 |
|
|
535 |
for(Int_t e=0;e<2;e++){ |
for(Int_t e=0;e<TOT;e++){ |
536 |
event=ev[e]; |
if(event<=0 || (value%10!=0 && e==0)) |
537 |
|
event=eve; |
538 |
|
else { |
539 |
|
event=event+1; |
540 |
|
if(event>eve-3 && eve>2) |
541 |
|
cal="Event with online calibration"; |
542 |
|
else |
543 |
|
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
544 |
|
} |
545 |
printf("Scan of Entry %d\n",event); |
printf("Scan of Entry %d\n",event); |
546 |
|
|
547 |
tr->GetEntry(event); |
tr->GetEntry(event); |
548 |
//============================================================================ |
//============================================================================ |
549 |
|
|
|
gStyle->SetLabelSize(0.06,"x"); |
|
|
gStyle->SetLabelSize(0.06,"y"); |
|
|
gStyle->SetTitleFontSize(0.1); |
|
|
gStyle->SetFillColor(10); |
|
|
gStyle->SetTitleFillColor(10); |
|
|
gStyle->SetTitleOffset(-1,"Y"); |
|
|
gStyle->SetOptStat(0); |
|
|
|
|
550 |
// draw display area |
// draw display area |
551 |
|
|
552 |
Int_t canvasx=1200; |
TPad *trkpad[12],*pad=0; //pad for histos |
|
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; |
|
|
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()); |
|
|
t->DrawLatex(0.60,0.98,cal.Data()); |
|
|
|
|
|
// draw pads |
|
|
TPad *trkpad[12]; //pad for histos |
|
553 |
TPaveText *trkpadtext[12]; //pad for header |
TPaveText *trkpadtext[12]; //pad for header |
554 |
Double_t posy = 0.95; // up y-coord - top pads |
Int_t ndsp=0; |
|
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 |
|
555 |
|
|
556 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
557 |
|
figsav=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
558 |
|
figsav+=event+1; |
559 |
|
c1[e] = new TCanvas(figsav.Data(),"FTrkQLookSCAN",canvasx,canvasy); |
560 |
|
c1[e]->SetFillColor(10); |
561 |
|
c1[e]->Range(0,0,1,1); |
562 |
|
fromfile.str(""); |
563 |
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event; |
564 |
|
t->SetTextSize(0.02); |
565 |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
566 |
|
t->DrawLatex(0.60,0.98,cal.Data()); |
567 |
|
|
568 |
|
if(va1!=0){ |
569 |
|
figsava=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
570 |
|
figsava+=event+1; |
571 |
|
figsava+="_DSP"; |
572 |
|
figsava+=(int)(va1/100); |
573 |
|
figsava+="_VA1-"; |
574 |
|
figsava+=va1%100; |
575 |
|
cva[e] = new TCanvas(figsava.Data(),"TrkQLookSCAN VA1",canvasx,canvasy); |
576 |
|
cva[e]->SetFillColor(10); |
577 |
|
cva[e]->Range(0,0,1,1); |
578 |
|
fromfile.str(""); |
579 |
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event<<" --> DSP "<<(int)(va1/100)<<" --> va1 "<<va1%100; |
580 |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
581 |
|
// t->DrawLatex(0.65,0.98,cal.Data()); |
582 |
|
} |
583 |
|
|
584 |
stringstream title; |
// draw pads |
585 |
stringstream hid; |
Double_t posy = 0.95; // up y-coord - top pads |
586 |
for(Int_t n = 0; n<12; n++){ |
Double_t hpad = 0.15; // pad height |
587 |
if ( (n+1)%2 ) { |
Double_t posx1=0; // left x-coord - pad column |
588 |
if(n>1)posy = posy-(marg*2+hpad); |
Double_t posx2=0; // right x-coord - pad olumn |
589 |
posx1 = marg; |
Double_t posx0=0; // x-coord - column division |
590 |
posx2 = 0.5 - marg; |
Double_t wrel = 0.6; // relative x size of first sub-column |
591 |
posx0 = 0.5*wrel; |
Double_t marg = 0.004; // margin among pads |
592 |
} else { |
|
593 |
posx1 = posx1 + 0.5; |
for(Int_t n = 0; n<12; n++){ |
594 |
posx2 = posx2 + 0.5; |
if ( (n+1)%2 ) { |
595 |
posx0 = posx0 + 0.5; |
if(n>1)posy = posy-(marg*2+hpad); |
596 |
}; |
posx1 = marg; |
597 |
|
posx2 = 0.5 - marg; |
598 |
|
posx0 = 0.5*wrel; |
599 |
|
} else { |
600 |
|
posx1 = posx1 + 0.5; |
601 |
|
posx2 = posx2 + 0.5; |
602 |
|
posx0 = posx0 + 0.5; |
603 |
|
}; |
604 |
|
|
605 |
|
/* -----------> pad for histograms */ |
606 |
|
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
607 |
|
trkpad[n]->SetFillColor(19); |
608 |
|
trkpad[n]->SetFrameFillColor(10); |
609 |
|
/* -----------> pad for header dump */ |
610 |
|
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
611 |
|
/* -----------> HISTOGRAMS */ |
612 |
|
|
613 |
|
title.str(""); |
614 |
|
title<<"DSP "<<n+1; |
615 |
|
hid<<"h"<<n+e*100; |
616 |
|
histomax[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
617 |
|
hid<<"hh"<<n+e*100; |
618 |
|
histocomp[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
619 |
|
hid<<"hhh"<<n+e*100; |
620 |
|
histofull[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
621 |
|
title.str(""); |
622 |
|
hid.str(""); |
623 |
|
} |
624 |
|
if(va1!=0){ |
625 |
|
title.str(""); |
626 |
|
title<<"DSP "<<(int)(va1/100)<<" -- va1 "<<va1%100; |
627 |
|
hid<<"va"<<e; |
628 |
|
histova[e] = new TH1F(hid.str().c_str(),title.str().c_str(),130,0,129); |
629 |
|
} //end loop on views |
630 |
|
|
631 |
/* -----------> pad for histograms */ |
/* -----------> pad for histograms */ |
632 |
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); |
633 |
trkpad[n]->SetFillColor(19); |
pad->SetFillColor(19); |
634 |
trkpad[n]->SetFrameFillColor(10); |
pad->SetFrameFillColor(10); |
635 |
/* -----------> 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 |
|
|
|
|
636 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
637 |
// create header dump retrieving event info |
// create header dump retrieving event info |
638 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
639 |
Int_t ndsp=0; |
|
|
stringstream message; |
|
640 |
|
|
641 |
Double_t whistomax[3072]; |
Double_t whistomax[3072]; |
642 |
Double_t whisto[3072]; |
Double_t whisto[3072]; |
652 |
trkword thisword; |
trkword thisword; |
653 |
|
|
654 |
Int_t address,ladder; |
Int_t address,ladder; |
655 |
|
|
656 |
|
|
657 |
for(Int_t n = 0; n<12; n++){ |
for(Int_t n = 0; n<12; n++){ |
658 |
|
|
659 |
ndsp = trk->DSPnumber[n]; |
ndsp = trk->DSPnumber[n]; |
661 |
ifull[nn]=0; |
ifull[nn]=0; |
662 |
icomp[nn]=0; |
icomp[nn]=0; |
663 |
imax[nn]=0; |
imax[nn]=0; |
664 |
|
if(ndsp>0){ |
665 |
|
if(ndsp<13){ |
666 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
667 |
|
|
668 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
669 |
* |
* |
670 |
* Write event LEVEL0 report |
* Write event LEVEL0 report |
671 |
* |
* |
672 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
673 |
|
|
674 |
trkpadtext[nn]->SetTextFont(40); |
trkpadtext[nn]->SetTextFont(40); |
675 |
trkpadtext[nn]->SetFillColor(33); |
trkpadtext[nn]->SetFillColor(33); |
676 |
trkpadtext[nn]->SetTextSize(0.012); |
trkpadtext[nn]->SetTextSize(0.012); |
677 |
trkpadtext[nn]->SetTextAlign(13); |
trkpadtext[nn]->SetTextAlign(13); |
678 |
|
|
679 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
680 |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
681 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
682 |
message.str(""); |
message.str(""); |
683 |
message<<"Event number --------> "<<trk->eventn[n]; |
message<<"Event number --------> "<<trk->eventn[n]; |
684 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
685 |
message.str(""); |
message.str(""); |
686 |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
687 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
688 |
message.str(""); |
message.str(""); |
689 |
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]); |
690 |
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]); |
691 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
692 |
message.str(""); |
message.str(""); |
693 |
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]); |
694 |
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]; |
695 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
696 |
message.str(""); |
message.str(""); |
697 |
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]); |
698 |
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]; |
699 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
700 |
message.str(""); |
message.str(""); |
701 |
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]; |
702 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
703 |
message.str(""); |
message.str(""); |
704 |
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"; |
705 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
706 |
message.str(""); |
message.str(""); |
707 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
708 |
message<<"CRC --> "<<trk->crc[n]; |
message<<"CRC --> "<<trk->crc[n]; |
709 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
710 |
message.str(""); |
message.str(""); |
711 |
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]; |
712 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
713 |
message.str(""); |
message.str(""); |
714 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
715 |
trkpadtext[nn]->AddLine(0,0,0,0); |
trkpadtext[nn]->AddLine(0,0,0,0); |
716 |
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]; |
717 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
718 |
message.str(""); |
message.str(""); |
719 |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
720 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
721 |
message.str(""); |
message.str(""); |
722 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
723 |
|
|
724 |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
725 |
|
} |
726 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
727 |
* |
* |
728 |
* Plot event LEVEL0 histo |
* Plot event LEVEL0 histo |
729 |
* |
* |
730 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
731 |
|
|
732 |
//============================================= |
//============================================= |
733 |
|
} |
734 |
for(Int_t i = 0; i< 3072; i++){ |
for(Int_t i = 0; i< 3072; i++){ |
735 |
whistomax[i] = -200; |
whistomax[i] = -200; |
736 |
whistocomp[i] = -200; |
whistocomp[i] = -200; |
737 |
whistofull[i] = -200; |
whistofull[i] = -200; |
738 |
whisto[i] = -200; |
whisto[i] = -200; |
739 |
} |
} |
740 |
|
|
741 |
// =============== |
// =============== |
742 |
// trasmitted data |
// trasmitted data |
743 |
// =============== |
// =============== |
744 |
|
|
745 |
address = 0; |
address = 0; |
746 |
ladder = 1; |
ladder = 1; |
747 |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
748 |
word = trk->TrackerData.At(iword); |
word = trk->TrackerData.At(iword); |
749 |
thisword = datadecode(word); |
thisword = datadecode(word); |
750 |
iword++; |
iword++; |
751 |
switch (thisword.type){ |
switch (thisword.type){ |
752 |
|
|
753 |
case 0: //ADC value |
case 0: //ADC value |
754 |
whisto[address] = thisword.decode; |
whisto[address] = thisword.decode; |
755 |
address++; |
address++; |
756 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
757 |
break; |
break; |
758 |
|
|
759 |
case 1: //address |
case 1: //address |
760 |
address = 1024*(ladder-1) + thisword.decode; |
address = 1024*(ladder-1) + thisword.decode; |
761 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
762 |
break; |
break; |
763 |
|
|
764 |
case 2: //end-of-ladder |
case 2: //end-of-ladder |
765 |
ladder = thisword.decode; |
ladder = thisword.decode; |
766 |
// cout << "Ladder " << ladder << "\n"; |
// cout << "Ladder " << ladder << "\n"; |
767 |
if(ladder==3){ |
if(ladder==3){ |
768 |
// end of compressed data - FILL HISTO |
// end of compressed data - FILL HISTO |
769 |
//cout << ">>> COMPRESSED data" << "\n"; |
//cout << ">>> COMPRESSED data" << "\n"; |
770 |
for(ii = 0; ii < 3072; ii++){ |
for(ii = 0; ii < 3072; ii++){ |
771 |
whistocomp[ii]=whisto[ii]; |
whistocomp[ii]=whisto[ii]; |
772 |
whisto[ii] = -200; |
whisto[ii] = -200; |
773 |
} |
} |
774 |
address = 0; |
address = 0; |
775 |
ladder = 1; |
ladder = 1; |
776 |
}else if(ladder==6){ |
}else if(ladder==6){ |
777 |
// end of full data - FILL HISTO |
// end of full data - FILL HISTO |
778 |
//cout << ">>> FULL data" << "\n"; |
//cout << ">>> FULL data" << "\n"; |
779 |
for(ii = 0; ii < 3072; ii++){ |
for(ii = 0; ii < 3072; ii++){ |
780 |
whistofull[ii]=whisto[ii]; |
whistofull[ii]=whisto[ii]; |
781 |
whisto[ii] = -200; |
whisto[ii] = -200; |
782 |
|
} |
783 |
|
address = 0; |
784 |
|
ladder = 1; |
785 |
|
}else{ |
786 |
|
if(ladder>3) ladder=ladder-3; |
787 |
|
address= ladder*1024; |
788 |
|
ladder = ladder + 1; |
789 |
} |
} |
790 |
address = 0; |
} |
|
ladder = 1; |
|
|
}else{ |
|
|
if(ladder>3) ladder=ladder-3; |
|
|
address= ladder*1024; |
|
|
ladder = ladder + 1; |
|
|
} |
|
791 |
} |
} |
|
} |
|
792 |
|
|
793 |
|
|
794 |
// =============== |
// =============== |
795 |
// maximum signals |
// maximum signals |
796 |
// =============== |
// =============== |
797 |
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]]; |
798 |
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]]; |
799 |
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]]; |
800 |
|
|
801 |
for(Int_t i = 0; i < 3072; i++){ |
for(Int_t i = 0; i < 3072; i++){ |
802 |
if(whistomax[i]>-200) imax[nn]=1; |
if(whistomax[i]>-200) imax[nn]=1; |
803 |
if(whistocomp[i]>-200) icomp[nn]=1; |
if(whistocomp[i]>-200) icomp[nn]=1; |
804 |
if(whistofull[i]>-200) ifull[nn]=1; |
if(whistofull[i]>-200) ifull[nn]=1; |
805 |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
if(value%10!=0){ |
806 |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
if((totvalues<TOT && e<totvalues) || totvalues==TOT){ |
807 |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
if(whistofull[i]>0){ |
808 |
} |
if(i==0) values << (short int)ndsp << " "; |
809 |
|
values <<(short int) whistofull[i] <<" "; |
810 |
TBox b; |
if(i==3071) values << endl; |
811 |
b.SetFillColor(6); |
} |
812 |
b.SetFillStyle(3945); |
} |
813 |
|
} |
814 |
c1[e]->cd(); |
if((tot<TOT && e<tot) || tot==TOT){ |
815 |
trkpadtext[nn]->Draw(); |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
816 |
trkpad[nn]->Draw(); |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
817 |
trkpad[nn]->cd(); |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
818 |
trkpad[nn]->SetFillColor(10); |
if(va1!=0 && ndsp==(int)(va1/100) && i>=128*((va1%100)-1)){ |
819 |
|
if(i<128*(va1%100)) |
820 |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
histova[e]->Fill((Float_t)(i-128*((va1%100)-1)+1),whistofull[i]); |
821 |
histocomp[nn][e]->SetLineStyle(1); |
} |
822 |
histocomp[nn][e]->SetLineColor(38); |
} |
823 |
histocomp[nn][e]->SetFillColor(38); |
} |
824 |
histocomp[nn][e]->SetLineWidth(1); |
|
825 |
histocomp[nn][e]->Draw(""); |
if((tot<TOT && e<tot) || tot==TOT){ |
826 |
|
TBox b; |
827 |
histofull[nn][e]->SetLineColor(40); |
TLine li,liva1; |
828 |
histofull[nn][e]->SetFillColor(40); |
li.SetLineColor(38); |
829 |
histofull[nn][e]->SetLineWidth(1); |
li.SetLineStyle(4); |
830 |
histofull[nn][e]->SetLineStyle(2); |
li.SetLineWidth(2); |
831 |
|
liva1.SetLineColor(42); |
832 |
histomax[nn][e]->SetLineColor(2); |
liva1.SetLineStyle(3); |
833 |
histomax[nn][e]->SetLineWidth(1); |
liva1.SetLineWidth(1); |
834 |
histomax[nn][e]->SetLineStyle(3); |
|
835 |
|
Float_t va1x=0; |
836 |
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
|
837 |
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
if(va1!=0){ |
838 |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
cva[e]->cd(); |
839 |
histocomp[nn][e]->Draw("axis same"); |
pad->Draw(); |
840 |
if(nn==1){ |
pad->cd(); |
841 |
b.DrawBox(2816.,-500.,3060.,4500.); |
pad->SetFillColor(10); |
842 |
} |
histova[e]->SetTitleSize(0.01); |
843 |
else if(nn==6){ |
histova[e]->GetYaxis()->SetRangeUser(1500,4500); |
844 |
b.DrawBox(2560.,-500.,2816.,4500.); |
histova[e]->SetLineColor(40); |
845 |
b.DrawBox(512.,-500.,768.,4500.); |
histova[e]->SetFillColor(40); |
846 |
b.DrawBox(1024.,-500.,1792.,4500.); |
histova[e]->SetLineWidth(1); |
847 |
} |
histova[e]->SetLineStyle(2); |
848 |
else if(nn==11){ |
// histova[e]->GetYaxis()->SetLabelSize(0.03); |
849 |
b.DrawBox(768.,-500.,1024.,4500.); |
histova[e]->Draw(""); |
850 |
|
cva[e]->Update(); |
851 |
|
} |
852 |
|
|
853 |
|
c1[e]->cd(); |
854 |
|
trkpadtext[nn]->Draw(); |
855 |
|
trkpad[nn]->Draw(); |
856 |
|
trkpad[nn]->cd(); |
857 |
|
trkpad[nn]->SetFillColor(10); |
858 |
|
|
859 |
|
histocomp[nn][e]->SetTitleSize(0.1); |
860 |
|
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
861 |
|
histocomp[nn][e]->SetLineStyle(1); |
862 |
|
histocomp[nn][e]->SetLineColor(38); |
863 |
|
histocomp[nn][e]->SetFillColor(38); |
864 |
|
histocomp[nn][e]->SetLineWidth(1); |
865 |
|
histocomp[nn][e]->Draw(""); |
866 |
|
|
867 |
|
histofull[nn][e]->SetLineColor(40); |
868 |
|
histofull[nn][e]->SetFillColor(40); |
869 |
|
histofull[nn][e]->SetLineWidth(1); |
870 |
|
histofull[nn][e]->SetLineStyle(2); |
871 |
|
|
872 |
|
histomax[nn][e]->SetLineColor(2); |
873 |
|
histomax[nn][e]->SetLineWidth(1); |
874 |
|
histomax[nn][e]->SetLineStyle(3); |
875 |
|
|
876 |
|
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
877 |
|
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
878 |
|
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
879 |
|
histocomp[nn][e]->Draw("axis same"); |
880 |
|
if(nn==0){ |
881 |
|
b.SetFillColor(107); |
882 |
|
b.SetFillStyle(3945); |
883 |
|
b.DrawBox(256.,-500.,384.,4500); |
884 |
|
b.DrawBox(768.,-500.,2047.,4500.); |
885 |
|
} |
886 |
|
else if(nn==1){ |
887 |
|
b.SetFillColor(6); |
888 |
|
b.SetFillStyle(3945); |
889 |
|
b.DrawBox(2944.,-500.,3060.,4500.); |
890 |
|
|
891 |
|
b.SetFillColor(107); |
892 |
|
b.SetFillStyle(3954); |
893 |
|
b.DrawBox(384.,-500.,512.,4500.); |
894 |
|
b.DrawBox(2048.,-500.,2432.,4500.); |
895 |
|
b.DrawBox(2816.,-500.,2944.,4500.); |
896 |
|
} |
897 |
|
else if(nn==3){ |
898 |
|
b.SetFillColor(107); |
899 |
|
b.SetFillStyle(3954); |
900 |
|
b.DrawBox(2816.,-500.,3070.,4500.); |
901 |
|
} |
902 |
|
else if(nn==4){ |
903 |
|
b.SetFillColor(107); |
904 |
|
b.SetFillStyle(3954); |
905 |
|
b.DrawBox(256.,-500.,512.,4500.); |
906 |
|
b.DrawBox(2816.,-500.,3070.,4500.); |
907 |
|
} |
908 |
|
else if(nn==5){ |
909 |
|
b.SetFillColor(107); |
910 |
|
b.SetFillStyle(3954); |
911 |
|
b.DrawBox(896.,-500.,1024.,4500.); |
912 |
|
} |
913 |
|
else if(nn==6){ |
914 |
|
b.SetFillColor(6); |
915 |
|
b.SetFillStyle(3945); |
916 |
|
b.DrawBox(1024.,-500.,1280.,4500.); |
917 |
|
|
918 |
|
b.SetFillColor(107); |
919 |
|
b.SetFillStyle(3954); |
920 |
|
b.DrawBox(512.,-500.,768.,4500.); |
921 |
|
b.DrawBox(1280.,-500.,1792.,4500.); |
922 |
|
b.DrawBox(2560.,-500.,2816.,4500.); |
923 |
|
} |
924 |
|
else if(nn==7){ |
925 |
|
b.SetFillColor(107); |
926 |
|
b.SetFillStyle(3954); |
927 |
|
b.DrawBox(512.,-500.,768.,4500.); |
928 |
|
b.DrawBox(896.,-500.,1535.,4500.); |
929 |
|
} |
930 |
|
else if(nn==8){ |
931 |
|
b.SetFillColor(107); |
932 |
|
b.SetFillStyle(3954); |
933 |
|
b.DrawBox(512.,-500.,768.,4500.); |
934 |
|
} |
935 |
|
else if(nn==9){ |
936 |
|
b.SetFillColor(107); |
937 |
|
b.SetFillStyle(3954); |
938 |
|
b.DrawBox(256.,-500.,384.,4500.); |
939 |
|
b.DrawBox(1280.,-500.,1535.,4500.); |
940 |
|
b.DrawBox(1792.,-500.,1920.,4500.); |
941 |
|
} |
942 |
|
else if(nn==10){ |
943 |
|
b.SetFillColor(107); |
944 |
|
b.SetFillStyle(3954); |
945 |
|
b.DrawBox(1024.,-500.,1152.,4500.); |
946 |
|
b.DrawBox(2048.,-500.,3070.,4500.); |
947 |
|
} |
948 |
|
else if(nn==11){ |
949 |
|
b.SetFillColor(6); |
950 |
|
b.SetFillStyle(3945); |
951 |
|
b.DrawBox(768.,-500.,1024.,4500.); |
952 |
|
|
953 |
|
b.SetFillColor(107); |
954 |
|
b.SetFillStyle(3954); |
955 |
|
b.DrawBox(0.,-500.,512.,4500.); |
956 |
|
b.DrawBox(1920.,-500.,2560.,4500.); |
957 |
|
} |
958 |
|
for(int va=1; va<24; va++){ |
959 |
|
va1x=128*va; |
960 |
|
liva1.DrawLine(va1x,-500.,va1x,4500.); |
961 |
|
} |
962 |
|
li.DrawLine(1024.5,-500.,1024.5,4500.); |
963 |
|
li.DrawLine(2048.5,-500.,2048.5,4500.); |
964 |
|
c1[e]->Update(); |
965 |
|
} |
966 |
|
|
967 |
} |
} |
|
c1[e]->Update(); |
|
|
|
|
968 |
}//end loop on views |
}//end loop on views |
969 |
|
|
970 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
971 |
|
stringstream nom1,nom2,nom3; |
972 |
|
nom1<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps("; |
973 |
|
nom2<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps"; |
974 |
|
nom3<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps)"; |
975 |
|
|
976 |
|
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
977 |
|
if(e==0){ |
978 |
|
c1[e]->Print(nom1.str().c_str(),"Landscape"); |
979 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Landscape"); |
980 |
|
} |
981 |
|
if(e>0 && tot>2){ |
982 |
|
c1[e]->Print(nom2.str().c_str(),"Landscape"); |
983 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Landscape"); |
984 |
|
} |
985 |
|
if(e==tot-1){ |
986 |
|
c1[e]->Print(nom2.str().c_str(),"Landscape"); |
987 |
|
if(va1!=0) cva[e]->Print(nom3.str().c_str(),"Landscape"); |
988 |
|
} |
989 |
|
} |
990 |
|
else{ |
991 |
|
figsav+="."+outfile; |
992 |
|
c1[e]->Print(figsav.Data()); |
993 |
|
if(va1!=0){ |
994 |
|
figsava+="."+outfile; |
995 |
|
cva[e]->Print(figsava.Data()); |
996 |
|
} |
997 |
|
} |
998 |
|
} |
999 |
|
if(value%10!=0){ |
1000 |
|
if(totvalues==TOT || (totvalues<TOT && e<totvalues)) |
1001 |
|
values << (short int)0 << endl << endl; |
1002 |
|
} |
1003 |
|
} |
1004 |
|
stringstream com; |
1005 |
|
|
1006 |
c1[e]->Print(figsav.str().c_str()); |
values.close(); |
1007 |
|
if(value==0){ |
1008 |
|
com<<"rm -f "<<fname; |
1009 |
|
system(com.str().c_str()); |
1010 |
} |
} |
1011 |
|
// |
1012 |
|
// Convert ps to pdf if required |
1013 |
|
if(!strcmp(outfile.Data(),"pdf")){ |
1014 |
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "<<out<<ffile<<"_FTrkScanQLook_EXPERT.pdf"; |
1015 |
|
system(com.str().c_str()); |
1016 |
|
printf("\n---> ps file converted in pdf format!\n"); |
1017 |
|
com.str(""); |
1018 |
|
com<<"rm -f "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "; |
1019 |
|
system(com.str().c_str()); |
1020 |
|
printf("---> ps file removed!\n\n"); |
1021 |
|
com.str(""); |
1022 |
|
} |
1023 |
|
|
1024 |
return; |
return; |
1025 |
} |
} |