2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v2r06 |
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> |
22 |
#include <TCanvas.h> |
#include <TCanvas.h> |
23 |
#include <TGraph.h> |
#include <TGraph.h> |
24 |
|
#include <TFile.h> |
25 |
#include <TTree.h> |
#include <TTree.h> |
26 |
#include <TStyle.h> |
#include <TStyle.h> |
27 |
#include <TString.h> |
#include <TString.h> |
28 |
// |
// |
29 |
#include <physics/tracker/TrackerEvent.h> |
#include <physics/tracker/TrackerEvent.h> |
30 |
|
#include <PscuHeader.h> |
31 |
|
#include <EventHeader.h> |
32 |
|
#include <CalibTrk1Event.h> |
33 |
|
#include <CalibTrk2Event.h> |
34 |
|
#include <RunHeaderEvent.h> |
35 |
// |
// |
36 |
|
|
37 |
using namespace std; |
using namespace std; |
121 |
} |
} |
122 |
} |
} |
123 |
|
|
|
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
|
|
if ( to == 0 ){ |
|
|
Int_t t2length = s2.Length(); |
|
|
s1 = ""; |
|
|
to = t2length; |
|
|
} |
|
|
for (Int_t i = from; i<to; i++){ |
|
|
s1.Append(s2[i],1); |
|
|
} |
|
|
} |
|
|
|
|
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 |
// |
// |
129 |
// obtain information about the data file and select the output file |
// obtain information about the data file and select the output file |
130 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
131 |
Int_t dwpos = filepath.rfind("/"); |
Int_t dwpos1 = file.Last('.'); |
|
Int_t dwpos1 = filepath.find(".root"); |
|
|
TString fpath=(filepath.c_str()); |
|
132 |
TString base,ffile ; |
TString base,ffile ; |
133 |
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
134 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
|
if(dwpos>0) base+="/"; |
|
135 |
|
|
136 |
TString out; |
TString out; |
137 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
139 |
}else{ |
}else{ |
140 |
out = outdir; |
out = outdir; |
141 |
} |
} |
142 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
143 |
|
|
144 |
pamela::tracker::TrackerEvent *trk=0; |
pamela::tracker::TrackerEvent *trk=0; |
145 |
|
pamela::EventHeader *eh=0,*eH=0; |
146 |
|
pamela::PscuHeader *ph=0,*pH=0; |
147 |
|
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 ){ |
159 |
} |
} |
160 |
|
|
161 |
//Takes the tree and branches |
//Takes the tree and branches |
162 |
TTree *otr; |
TTree *tr = (TTree*)trackerFile->Get("Physics"); |
163 |
otr = (TTree*)trackerFile->Get("Physics"); |
tr->SetBranchAddress("Tracker",&trk); |
164 |
|
tr->SetBranchAddress("Header",&eh); |
165 |
|
|
166 |
|
TTree *otr = (TTree*)trackerFile->Get("RunHeader"); |
167 |
|
otr->SetBranchAddress("Header",&eH); |
168 |
|
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 = otr->GetEntries(); |
Int_t nevents = tr->GetEntries(); |
177 |
|
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); |
203 |
|
printf(" Number of Calibration: %d\n",cevents); |
204 |
|
|
205 |
printf("Scan of Entry %d\n",event-1); |
ULong_t obt=0,hobt[neventH]; |
206 |
|
Int_t eve,cin=0,cins=0,br=0; |
207 |
otr->SetBranchAddress("Tracker", &trk); |
TString cal=""; |
208 |
otr->GetEntry(event-1); |
|
209 |
//============================================================================ |
eve=3; |
210 |
|
for(Int_t i=0;i<neventH;i++){ |
211 |
|
otr->GetEntry(i); |
212 |
|
pH = eH->GetPscuHeader(); |
213 |
|
hobt[i]= pH->GetOrbitalTime(); |
214 |
|
if(reh->TRK_CALIB_USED!=104 && br==0){ |
215 |
|
obt = pH->GetOrbitalTime(); |
216 |
|
cal="Event with online calibration"; |
217 |
|
br=1; |
218 |
|
} |
219 |
|
if(i==neventH-1 && br==0){ |
220 |
|
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
221 |
|
eve=2; |
222 |
|
} |
223 |
|
} |
224 |
|
|
225 |
gStyle->SetLabelSize(0.06,"x"); |
int tot=2,totvalues=0,TOT=0,totsum=0; |
226 |
gStyle->SetLabelSize(0.06,"y"); |
if(event<0) tot=abs(event); |
227 |
gStyle->SetTitleFontSize(0.1); |
if(value>0) totvalues=value/10; |
|
gStyle->SetFillColor(10); |
|
|
gStyle->SetTitleFillColor(10); |
|
|
gStyle->SetTitleOffset(-1,"Y"); |
|
|
gStyle->SetOptStat(0); |
|
228 |
|
|
229 |
// draw display area |
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; |
Int_t canvasx=1200; |
248 |
Int_t canvasy=900; |
Int_t canvasy=900; |
249 |
stringstream figsav; |
|
|
figsav.str(""); |
|
|
figsav<<out<<ffile<<"_FTrkScanQLook_EXPERT_ev"<<event<<"."<<outfile.Data(); |
|
|
TCanvas *c1 = new TCanvas(figsav.str().c_str(),"FTrkQLookSCAN",canvasx,canvasy); |
|
|
c1->SetFillColor(10); |
|
|
c1->Range(0,0,1,1); |
|
|
stringstream fromfile; |
|
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event-1; |
|
250 |
TLatex *t=new TLatex(); |
TLatex *t=new TLatex(); |
251 |
t->SetTextFont(32); |
t->SetTextFont(32); |
252 |
t->SetTextColor(1); |
t->SetTextColor(1); |
253 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
254 |
t->SetTextSize(0.02); |
t->SetTextSize(0.02); |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
|
255 |
|
|
256 |
// draw pads |
gStyle->SetLabelSize(0.06,"x"); |
257 |
TPad *trkpad[12]; //pad for histos |
gStyle->SetLabelSize(0.06,"y"); |
258 |
TPaveText *trkpadtext[12]; //pad for header |
gStyle->SetTitleFontSize(0.1); |
259 |
TH1F *histomax[12]; //histos of max signals |
gStyle->SetFillColor(10); |
260 |
TH1F *histocomp[12]; //histos of compressed data |
gStyle->SetTitleFillColor(10); |
261 |
TH1F *histofull[12]; //histos of full data |
gStyle->SetOptStat(0); |
262 |
|
|
263 |
Double_t posy = 0.95; // up y-coord - top pads |
Int_t p[12],psum=0; |
264 |
Double_t hpad = 0.15; // pad height |
Int_t whistostrip[3072]; |
265 |
Double_t posx1=0; // left x-coord - pad column |
for(int s=0;s<3072;s++) whistostrip[s]=s+1; |
266 |
Double_t posx2=0; // right x-coord - pad olumn |
|
267 |
Double_t posx0=0; // x-coord - column division |
if(eve==3){ |
268 |
Double_t wrel = 0.6; // relative x size of first sub-column |
for(Int_t i=0;i<nevents;i++){ |
269 |
Double_t marg = 0.004; // margin among pads |
tr->GetEntry(i); |
270 |
|
ph = eh->GetPscuHeader(); |
271 |
|
if(reh->TRK_CALIB_USED==104) continue; |
272 |
stringstream title; |
cod = eh->GetCounter(); |
273 |
stringstream hid; |
if(value%10!=0){ |
274 |
for(Int_t n = 0; n<12; n++){ |
if(i==0) cin=cod->Get(pctp->CalibTrk1)+((value%10)-1); |
275 |
if ( (n+1)%2 ) { |
if(cod->Get(pctp->CalibTrk1)==cin+1){ |
276 |
if(n>1)posy = posy-(marg*2+hpad); |
eve=i+3; |
277 |
posx1 = marg; |
cin=100; |
278 |
posx2 = 0.5 - marg; |
} |
279 |
posx0 = 0.5*wrel; |
} |
280 |
} else { |
else { |
281 |
posx1 = posx1 + 0.5; |
if(i==0) cin=cod->Get(pctp->CalibTrk1); |
282 |
posx2 = posx2 + 0.5; |
if(event<0 && cod->Get(pctp->CalibTrk1)==cin+1){ |
283 |
posx0 = posx0 + 0.5; |
eve=i+3; |
284 |
}; |
cin=100; |
285 |
|
} |
286 |
/* -----------> pad for histograms */ |
else if(event>=0 && (ULong_t)ph->GetOrbitalTime()>obt && obt>0){ |
287 |
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
eve=i+3; |
288 |
trkpad[n]->SetFillColor(19); |
obt=0; |
289 |
trkpad[n]->SetFrameFillColor(10); |
} |
290 |
/* -----------> pad for header dump */ |
} |
291 |
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
if(i==0) cins=cod->Get(pctp->CalibTrk1); |
292 |
/* -----------> HISTOGRAMS */ |
if(cod->Get(pctp->CalibTrk1)==cins+1){ |
293 |
|
psum=1; |
294 |
title<<"DSP "<<n+1; |
cins=cod->Get(pctp->CalibTrk1); |
295 |
hid<<"h"<<n; |
} |
296 |
histomax[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
if(psum==1){ |
297 |
hid<<"hh"<<n; |
figsa=out+ffile+"_FTrkScanQLook_EXPERT_sumof"; |
298 |
histocomp[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
figsa+=totsum; |
299 |
hid<<"hhh"<<n; |
figsa+="events_cal"; |
300 |
histofull[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
figsa+=cins; |
301 |
title.str(""); |
csum[cins-1] = new TCanvas(figsa.Data(),"FTrkQLookSCAN",canvasx,canvasy); |
302 |
hid.str(""); |
csum[cins-1]->SetFillColor(10); |
303 |
} //end loop on views |
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 |
// create header dump retrieving event info |
t->SetTextSize(0.02); |
307 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
308 |
Int_t ndsp=0; |
|
309 |
stringstream message; |
// draw pads |
310 |
|
Double_t posy = 0.95; // up y-coord - top pads |
311 |
Double_t whistomax[3072]; |
Double_t hpad = 0.15; // pad height |
312 |
Double_t whisto[3072]; |
Double_t posx1=0; // left x-coord - pad column |
313 |
Double_t whistocomp[3072]; |
Double_t posx0=0; // x-coord - column division |
314 |
Double_t whistofull[3072]; |
Double_t wrel = 0.6; // relative x size of first sub-column |
315 |
|
Double_t marg = 0.004; // margin among pads |
316 |
//============================================= |
|
317 |
// transmitted words |
hpad = (posy-marg*11)/6; |
318 |
Int_t word = 0; |
wrel = (1-marg*4)/2; |
319 |
Int_t iword = 0; |
for(Int_t n = 0; n<12; n++){ |
320 |
Int_t TOTDATAlength_check = 0; |
if ( (n+1)%2 ) { |
321 |
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
if(n>1)posy = posy-(marg*2+hpad); |
322 |
trkword thisword; |
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 |
Int_t address,ladder; |
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 |
for(Int_t n = 0; n<12; n++){ |
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 |
ndsp = trk->DSPnumber[n]; |
for(int va=0; va<cevents; va++){ |
511 |
nn = ndsp-1; |
if(cevents==1) csum[va]->Print(nom2.str().c_str(),"Landscape"); |
512 |
ifull[nn]=0; |
if(cevents>2){ |
513 |
icomp[nn]=0; |
if(va==0) csum[va]->Print(nom1.str().c_str(),"Landscape"); |
514 |
imax[nn]=0; |
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 |
* Write event LEVEL0 report |
} |
519 |
* |
// |
520 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
// Convert ps to pdf if required |
521 |
|
if(!strcmp(outfile.Data(),"pdf")){ |
522 |
trkpadtext[nn]->SetTextFont(40); |
stringstream com; |
523 |
trkpadtext[nn]->SetFillColor(33); |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.pdf"; |
524 |
trkpadtext[nn]->SetTextSize(0.012); |
system(com.str().c_str()); |
525 |
trkpadtext[nn]->SetTextAlign(13); |
printf("\n---> ps file converted in pdf format!\n"); |
526 |
|
com.str(""); |
527 |
trkpadtext[nn]->AddText(" "); |
com<<"rm -f "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps "; |
528 |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
system(com.str().c_str()); |
529 |
trkpadtext[nn]->AddText(message.str().c_str()); |
printf("---> ps file removed!\n\n"); |
530 |
message.str(""); |
com.str(""); |
531 |
message<<"Event number --------> "<<trk->eventn[n]; |
} |
532 |
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
if (!(nn%2)&&trk->signcluster[n][0]!=0) message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<1024-(trk->signcluster[n][0]); |
|
|
else message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<(trk->signcluster[n][0]); |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
if (!(nn%2)&&trk->signcluster[n][1]!=0) message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<1024-(trk->signcluster[n][1]); |
|
|
else message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<trk->signcluster[n][1]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
if (!(nn%2)&&trk->signcluster[n][2]!=0) message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<1024-(trk->signcluster[n][2]); |
|
|
else message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<trk->signcluster[n][2]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
trkpadtext[nn]->AddText(" "); |
|
|
message<<"CRC --> "<<trk->crc[n]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
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]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
trkpadtext[nn]->AddText(" "); |
|
|
trkpadtext[nn]->AddLine(0,0,0,0); |
|
|
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
trkpadtext[nn]->AddText(" "); |
|
|
|
|
|
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
|
|
|
|
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
|
|
* |
|
|
* Plot event LEVEL0 histo |
|
|
* |
|
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
|
533 |
|
|
|
//============================================= |
|
534 |
|
|
535 |
for(Int_t i = 0; i< 3072; i++){ |
for(Int_t e=0;e<TOT;e++){ |
536 |
whistomax[i] = -200; |
if(event<=0 || (value%10!=0 && e==0)) |
537 |
whistocomp[i] = -200; |
event=eve; |
538 |
whistofull[i] = -200; |
else { |
539 |
whisto[i] = -200; |
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); |
546 |
|
|
547 |
|
tr->GetEntry(event); |
548 |
|
//============================================================================ |
549 |
|
|
550 |
|
// draw display area |
551 |
|
|
552 |
|
TPad *trkpad[12],*pad=0; //pad for histos |
553 |
|
TPaveText *trkpadtext[12]; //pad for header |
554 |
|
Int_t ndsp=0; |
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 |
|
// draw pads |
585 |
|
Double_t posy = 0.95; // up y-coord - top pads |
586 |
|
Double_t hpad = 0.15; // pad height |
587 |
|
Double_t posx1=0; // left x-coord - pad column |
588 |
|
Double_t posx2=0; // right x-coord - pad olumn |
589 |
|
Double_t posx0=0; // x-coord - column division |
590 |
|
Double_t wrel = 0.6; // relative x size of first sub-column |
591 |
|
Double_t marg = 0.004; // margin among pads |
592 |
|
|
593 |
|
for(Int_t n = 0; n<12; n++){ |
594 |
|
if ( (n+1)%2 ) { |
595 |
|
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 */ |
632 |
|
pad = new TPad("padva"," ",0,0,1,0.97,18,0,0); |
633 |
|
pad->SetFillColor(19); |
634 |
|
pad->SetFrameFillColor(10); |
635 |
|
} |
636 |
|
// = = = = = = = = = = = = = = = = = = = = = = = = = |
637 |
|
// create header dump retrieving event info |
638 |
|
// = = = = = = = = = = = = = = = = = = = = = = = = = |
639 |
|
|
640 |
|
|
641 |
|
Double_t whistomax[3072]; |
642 |
|
Double_t whisto[3072]; |
643 |
|
Double_t whistocomp[3072]; |
644 |
|
Double_t whistofull[3072]; |
645 |
|
|
646 |
|
//============================================= |
647 |
|
// transmitted words |
648 |
|
Int_t word = 0; |
649 |
|
Int_t iword = 0; |
650 |
|
Int_t TOTDATAlength_check = 0; |
651 |
|
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
652 |
|
trkword thisword; |
653 |
|
|
654 |
|
Int_t address,ladder; |
655 |
|
|
656 |
|
|
657 |
|
for(Int_t n = 0; n<12; n++){ |
658 |
|
|
659 |
|
ndsp = trk->DSPnumber[n]; |
660 |
|
nn = ndsp-1; |
661 |
|
ifull[nn]=0; |
662 |
|
icomp[nn]=0; |
663 |
|
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 |
671 |
|
* |
672 |
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
673 |
|
|
674 |
|
trkpadtext[nn]->SetTextFont(40); |
675 |
|
trkpadtext[nn]->SetFillColor(33); |
676 |
|
trkpadtext[nn]->SetTextSize(0.012); |
677 |
|
trkpadtext[nn]->SetTextAlign(13); |
678 |
|
|
679 |
|
trkpadtext[nn]->AddText(" "); |
680 |
|
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
681 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
682 |
|
message.str(""); |
683 |
|
message<<"Event number --------> "<<trk->eventn[n]; |
684 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
685 |
|
message.str(""); |
686 |
|
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
687 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
688 |
|
message.str(""); |
689 |
|
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]); |
691 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
692 |
|
message.str(""); |
693 |
|
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]; |
695 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
696 |
|
message.str(""); |
697 |
|
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]; |
699 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
700 |
|
message.str(""); |
701 |
|
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
702 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
703 |
|
message.str(""); |
704 |
|
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
705 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
706 |
|
message.str(""); |
707 |
|
trkpadtext[nn]->AddText(" "); |
708 |
|
message<<"CRC --> "<<trk->crc[n]; |
709 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
710 |
|
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]; |
712 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
713 |
|
message.str(""); |
714 |
|
trkpadtext[nn]->AddText(" "); |
715 |
|
trkpadtext[nn]->AddLine(0,0,0,0); |
716 |
|
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
717 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
718 |
|
message.str(""); |
719 |
|
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
720 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
721 |
|
message.str(""); |
722 |
|
trkpadtext[nn]->AddText(" "); |
723 |
|
|
724 |
|
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
725 |
|
} |
726 |
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
727 |
|
* |
728 |
|
* Plot event LEVEL0 histo |
729 |
|
* |
730 |
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
731 |
|
|
732 |
// =============== |
//============================================= |
733 |
// trasmitted data |
} |
734 |
// =============== |
for(Int_t i = 0; i< 3072; i++){ |
735 |
|
whistomax[i] = -200; |
736 |
address = 0; |
whistocomp[i] = -200; |
737 |
ladder = 1; |
whistofull[i] = -200; |
738 |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
whisto[i] = -200; |
739 |
word = trk->TrackerData.At(iword); |
} |
740 |
thisword = datadecode(word); |
|
741 |
iword++; |
// =============== |
742 |
switch (thisword.type){ |
// trasmitted data |
743 |
|
// =============== |
744 |
|
|
745 |
|
address = 0; |
746 |
|
ladder = 1; |
747 |
|
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
748 |
|
word = trk->TrackerData.At(iword); |
749 |
|
thisword = datadecode(word); |
750 |
|
iword++; |
751 |
|
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; |
775 |
|
ladder = 1; |
776 |
|
}else if(ladder==6){ |
777 |
|
// end of full data - FILL HISTO |
778 |
|
//cout << ">>> FULL data" << "\n"; |
779 |
|
for(ii = 0; ii < 3072; ii++){ |
780 |
|
whistofull[ii]=whisto[ii]; |
781 |
|
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 |
|
} |
791 |
|
} |
792 |
|
|
793 |
|
|
794 |
|
// =============== |
795 |
|
// maximum signals |
796 |
|
// =============== |
797 |
|
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]]; |
799 |
|
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++){ |
802 |
|
if(whistomax[i]>-200) imax[nn]=1; |
803 |
|
if(whistocomp[i]>-200) icomp[nn]=1; |
804 |
|
if(whistofull[i]>-200) ifull[nn]=1; |
805 |
|
if(value%10!=0){ |
806 |
|
if((totvalues<TOT && e<totvalues) || totvalues==TOT){ |
807 |
|
if(whistofull[i]>0){ |
808 |
|
if(i==0) values << (short int)ndsp << " "; |
809 |
|
values <<(short int) whistofull[i] <<" "; |
810 |
|
if(i==3071) values << endl; |
811 |
|
} |
812 |
|
} |
813 |
} |
} |
814 |
address = 0; |
if((tot<TOT && e<tot) || tot==TOT){ |
815 |
ladder = 1; |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
816 |
}else if(ladder==6){ |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
817 |
// end of full data - FILL HISTO |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
818 |
//cout << ">>> FULL data" << "\n"; |
if(va1!=0 && ndsp==(int)(va1/100) && i>=128*((va1%100)-1)){ |
819 |
for(ii = 0; ii < 3072; ii++){ |
if(i<128*(va1%100)) |
820 |
whistofull[ii]=whisto[ii]; |
histova[e]->Fill((Float_t)(i-128*((va1%100)-1)+1),whistofull[i]); |
821 |
whisto[ii] = -200; |
} |
822 |
} |
} |
823 |
address = 0; |
} |
|
ladder = 1; |
|
|
}else{ |
|
|
if(ladder>3) ladder=ladder-3; |
|
|
address= ladder*1024; |
|
|
ladder = ladder + 1; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// =============== |
|
|
// maximum signals |
|
|
// =============== |
|
|
if(trk->signcluster[nn][0]!=0) whistomax[ 0+(int)trk->addrcluster[nn][0]] = whistocomp[ 0+(int)trk->addrcluster[nn][0]]; |
|
|
if(trk->signcluster[nn][1]!=0) whistomax[1024+(int)trk->addrcluster[nn][1]] = whistocomp[1024+(int)trk->addrcluster[nn][1]]; |
|
|
if(trk->signcluster[nn][2]!=0) whistomax[2048+(int)trk->addrcluster[nn][2]] = whistocomp[2048+(int)trk->addrcluster[nn][2]]; |
|
|
|
|
|
for(Int_t i = 0; i < 3072; i++){ |
|
|
if(whistomax[i]>-200) imax[nn]=1; |
|
|
if(whistocomp[i]>-200) icomp[nn]=1; |
|
|
if(whistofull[i]>-200) ifull[nn]=1; |
|
|
histomax[nn]->Fill((Float_t)i,whistomax[i]); |
|
|
histocomp[nn]->Fill((Float_t)i,whistocomp[i]); |
|
|
histofull[nn]->Fill((Float_t)i,whistofull[i]); |
|
|
} |
|
824 |
|
|
825 |
TBox b; |
if((tot<TOT && e<tot) || tot==TOT){ |
826 |
b.SetFillColor(6); |
TBox b; |
827 |
b.SetFillStyle(3945); |
TLine li,liva1; |
828 |
|
li.SetLineColor(38); |
829 |
c1->cd(); |
li.SetLineStyle(4); |
830 |
trkpadtext[nn]->Draw(); |
li.SetLineWidth(2); |
831 |
trkpad[nn]->Draw(); |
liva1.SetLineColor(42); |
832 |
trkpad[nn]->cd(); |
liva1.SetLineStyle(3); |
833 |
trkpad[nn]->SetFillColor(10); |
liva1.SetLineWidth(1); |
834 |
|
|
835 |
histocomp[nn]->GetYaxis()->SetRangeUser(-500,4500); |
Float_t va1x=0; |
836 |
histocomp[nn]->SetLineStyle(1); |
|
837 |
histocomp[nn]->SetLineColor(38); |
if(va1!=0){ |
838 |
histocomp[nn]->SetFillColor(38); |
cva[e]->cd(); |
839 |
histocomp[nn]->SetLineWidth(1); |
pad->Draw(); |
840 |
histocomp[nn]->Draw(""); |
pad->cd(); |
841 |
|
pad->SetFillColor(10); |
842 |
histofull[nn]->SetLineColor(40); |
histova[e]->SetTitleSize(0.01); |
843 |
histofull[nn]->SetFillColor(40); |
histova[e]->GetYaxis()->SetRangeUser(1500,4500); |
844 |
histofull[nn]->SetLineWidth(1); |
histova[e]->SetLineColor(40); |
845 |
histofull[nn]->SetLineStyle(2); |
histova[e]->SetFillColor(40); |
846 |
|
histova[e]->SetLineWidth(1); |
847 |
histomax[nn]->SetLineColor(2); |
histova[e]->SetLineStyle(2); |
848 |
histomax[nn]->SetLineWidth(1); |
// histova[e]->GetYaxis()->SetLabelSize(0.03); |
849 |
histomax[nn]->SetLineStyle(3); |
histova[e]->Draw(""); |
850 |
|
cva[e]->Update(); |
851 |
if(ifull[nn]==1) histofull[nn]->Draw("9bsame]["); |
} |
852 |
if(icomp[nn]==1) histocomp[nn]->Draw("9bsame]["); |
|
853 |
if(imax[nn]==1) histomax[nn]->Draw("same]["); |
c1[e]->cd(); |
854 |
histocomp[nn]->Draw("axis same"); |
trkpadtext[nn]->Draw(); |
855 |
if(nn==1){ |
trkpad[nn]->Draw(); |
856 |
b.DrawBox(2816.,-500.,3060.,4500.); |
trkpad[nn]->cd(); |
857 |
} |
trkpad[nn]->SetFillColor(10); |
858 |
else if(nn==6){ |
|
859 |
b.DrawBox(2560.,-500.,2816.,4500.); |
histocomp[nn][e]->SetTitleSize(0.1); |
860 |
b.DrawBox(512.,-500.,768.,4500.); |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
861 |
b.DrawBox(1024.,-500.,1792.,4500.); |
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(107); |
915 |
|
b.SetFillStyle(3954); |
916 |
|
b.DrawBox(512.,-500.,768.,4500.); |
917 |
|
b.DrawBox(1024.,-500.,1280.,4500.); |
918 |
|
b.DrawBox(1280.,-500.,1792.,4500.); |
919 |
|
b.DrawBox(2560.,-500.,2816.,4500.); |
920 |
|
} |
921 |
|
else if(nn==7){ |
922 |
|
b.SetFillColor(107); |
923 |
|
b.SetFillStyle(3954); |
924 |
|
b.DrawBox(512.,-500.,768.,4500.); |
925 |
|
b.DrawBox(896.,-500.,1535.,4500.); |
926 |
|
b.DrawBox(2024.,-500.,2280.,4500.); |
927 |
|
} |
928 |
|
else if(nn==8){ |
929 |
|
b.SetFillColor(107); |
930 |
|
b.SetFillStyle(3954); |
931 |
|
b.DrawBox(512.,-500.,768.,4500.); |
932 |
|
} |
933 |
|
else if(nn==9){ |
934 |
|
b.SetFillColor(107); |
935 |
|
b.SetFillStyle(3954); |
936 |
|
b.DrawBox(256.,-500.,384.,4500.); |
937 |
|
b.DrawBox(1280.,-500.,1535.,4500.); |
938 |
|
b.DrawBox(1792.,-500.,1920.,4500.); |
939 |
|
} |
940 |
|
else if(nn==10){ |
941 |
|
b.SetFillColor(107); |
942 |
|
b.SetFillStyle(3954); |
943 |
|
b.DrawBox(1024.,-500.,1152.,4500.); |
944 |
|
b.DrawBox(2048.,-500.,3070.,4500.); |
945 |
|
} |
946 |
|
else if(nn==11){ |
947 |
|
b.SetFillColor(6); |
948 |
|
b.SetFillStyle(3945); |
949 |
|
b.DrawBox(768.,-500.,1024.,4500.); |
950 |
|
|
951 |
|
b.SetFillColor(107); |
952 |
|
b.SetFillStyle(3954); |
953 |
|
b.DrawBox(0.,-500.,512.,4500.); |
954 |
|
b.DrawBox(1920.,-500.,2560.,4500.); |
955 |
|
} |
956 |
|
for(int va=1; va<24; va++){ |
957 |
|
va1x=128*va; |
958 |
|
liva1.DrawLine(va1x,-500.,va1x,4500.); |
959 |
|
} |
960 |
|
li.DrawLine(1024.5,-500.,1024.5,4500.); |
961 |
|
li.DrawLine(2048.5,-500.,2048.5,4500.); |
962 |
|
c1[e]->Update(); |
963 |
|
} |
964 |
|
|
965 |
|
} |
966 |
|
}//end loop on views |
967 |
|
|
968 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
969 |
|
stringstream nom1,nom2,nom3; |
970 |
|
nom1<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps("; |
971 |
|
nom2<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps"; |
972 |
|
nom3<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps)"; |
973 |
|
|
974 |
|
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
975 |
|
if(e==0){ |
976 |
|
c1[e]->Print(nom1.str().c_str(),"Landscape"); |
977 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Landscape"); |
978 |
|
} |
979 |
|
if(e>0 && tot>2){ |
980 |
|
c1[e]->Print(nom2.str().c_str(),"Landscape"); |
981 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Landscape"); |
982 |
|
} |
983 |
|
if(e==tot-1){ |
984 |
|
c1[e]->Print(nom2.str().c_str(),"Landscape"); |
985 |
|
if(va1!=0) cva[e]->Print(nom3.str().c_str(),"Landscape"); |
986 |
|
} |
987 |
|
} |
988 |
|
else{ |
989 |
|
figsav+="."+outfile; |
990 |
|
c1[e]->Print(figsav.Data()); |
991 |
|
if(va1!=0){ |
992 |
|
figsava+="."+outfile; |
993 |
|
cva[e]->Print(figsava.Data()); |
994 |
|
} |
995 |
|
} |
996 |
} |
} |
997 |
else if(nn==11){ |
if(value%10!=0){ |
998 |
b.DrawBox(768.,-500.,1024.,4500.); |
if(totvalues==TOT || (totvalues<TOT && e<totvalues)) |
999 |
|
values << (short int)0 << endl << endl; |
1000 |
} |
} |
1001 |
c1->Update(); |
} |
1002 |
|
stringstream com; |
|
}//end loop on views |
|
1003 |
|
|
1004 |
c1->Print(figsav.str().c_str()); |
values.close(); |
1005 |
|
if(value==0){ |
1006 |
|
com<<"rm -f "<<fname; |
1007 |
|
system(com.str().c_str()); |
1008 |
|
} |
1009 |
|
// |
1010 |
|
// Convert ps to pdf if required |
1011 |
|
if(!strcmp(outfile.Data(),"pdf")){ |
1012 |
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "<<out<<ffile<<"_FTrkScanQLook_EXPERT.pdf"; |
1013 |
|
system(com.str().c_str()); |
1014 |
|
printf("\n---> ps file converted in pdf format!\n"); |
1015 |
|
com.str(""); |
1016 |
|
com<<"rm -f "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "; |
1017 |
|
system(com.str().c_str()); |
1018 |
|
printf("---> ps file removed!\n\n"); |
1019 |
|
com.str(""); |
1020 |
|
} |
1021 |
|
|
1022 |
return; |
return; |
1023 |
} |
} |