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