1 |
/** |
2 |
* FTrkQLook_EXPERT |
3 |
* |
4 |
* autor: D.Fedele |
5 |
* version 2.0 |
6 |
* Parameters: |
7 |
* file - the data file to analyze |
8 |
* fromevent - first event to analyze |
9 |
* toevent - last event to analyze |
10 |
* outdir - total path of output file |
11 |
* outfile - extension of output file (pdf,ps,gif,jpg) |
12 |
* |
13 |
* |
14 |
*/ |
15 |
// |
16 |
#include <fstream> |
17 |
// |
18 |
#include <TPaveText.h> |
19 |
#include <TLatex.h> |
20 |
#include <TCanvas.h> |
21 |
#include <TGraph.h> |
22 |
#include <TTree.h> |
23 |
#include <TStyle.h> |
24 |
// |
25 |
#include <physics/tracker/TrackerEvent.h> |
26 |
#include <PscuHeader.h> |
27 |
#include <EventHeader.h> |
28 |
#include <TrkAlarmEvent.h> |
29 |
#include <tsbt/TsbTRecord.h> |
30 |
#include <tsbt/TsbTEvent.h> |
31 |
// |
32 |
|
33 |
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
34 |
if ( to == 0 ){ |
35 |
Int_t t2length = s2.Length(); |
36 |
s1 = ""; |
37 |
to = t2length; |
38 |
}; |
39 |
for (Int_t i = from; i<to; i++){ |
40 |
s1.Append(s2[i],1); |
41 |
}; |
42 |
}; |
43 |
|
44 |
|
45 |
void FTrkQLook_EXPERT(TString file,Int_t fromevent,Int_t toevent, TString outdir, TString outfile) |
46 |
{ |
47 |
// |
48 |
// obtain information about the data file and select the output dir |
49 |
const string filepath=file.Data(); |
50 |
Int_t dwpos = filepath.rfind("DW_"); |
51 |
Int_t dwpos1 = filepath.find(".root"); |
52 |
TString fpath=(filepath.c_str()); |
53 |
TString base,ffile ; |
54 |
stringcopy(ffile,fpath,dwpos,dwpos1); |
55 |
stringcopy(base,fpath,0,dwpos); |
56 |
|
57 |
TString out; |
58 |
if(outdir.Length()==0){ |
59 |
out = base; |
60 |
}else{ |
61 |
out = outdir; |
62 |
} |
63 |
|
64 |
// |
65 |
// inizialise the variables and open the file |
66 |
pamela::TsbTEvent *event = 0; |
67 |
pamela::TsbTRecord *record = 0; |
68 |
pamela::tracker::TrackerEvent *te=0; |
69 |
pamela::EventHeader *eh=0,*aleh=0; |
70 |
pamela::PscuHeader *ph=0; |
71 |
pamela::TrkAlarmEvent *al=0; |
72 |
|
73 |
TFile *datafile = new TFile(file); |
74 |
|
75 |
TTree *tree = (TTree*)datafile->Get("TsbT"); |
76 |
tree->SetBranchAddress("TsbT",&event); |
77 |
|
78 |
TTree *altr = (TTree*)datafile->Get("TrkAlarm"); |
79 |
altr->SetBranchAddress("TrkAlarm",&al); |
80 |
altr->SetBranchAddress("Header",&aleh); |
81 |
|
82 |
TTree *tr = (TTree*)datafile->Get("Physics"); |
83 |
tr->SetBranchAddress("Tracker",&te); |
84 |
tr->SetBranchAddress("Header",&eh); |
85 |
|
86 |
Long64_t nevent = tr->GetEntries(); |
87 |
Long64_t tnevent = tree->GetEntries(); |
88 |
Long64_t alnevent = altr->GetEntries(); |
89 |
Int_t minevent=0; |
90 |
Int_t maxevent=0; |
91 |
|
92 |
printf("Number of total events: %lld\n",nevent); |
93 |
|
94 |
if (nevent<=0){ |
95 |
datafile->Close(); |
96 |
return; |
97 |
} |
98 |
if ( fromevent > toevent && toevent>0 ){ |
99 |
printf("It must be fromevent < toevent \n"); |
100 |
return; |
101 |
} |
102 |
if ( fromevent > nevent || fromevent < 0 ) { |
103 |
printf("You can choose fromevent between 0 (all) and %lld \n",nevent); |
104 |
return; |
105 |
} |
106 |
if ( toevent > nevent || toevent < 0 ) { |
107 |
printf("You can choose toevent between 0 (all) and %lld \n",nevent); |
108 |
return; |
109 |
} |
110 |
if ( fromevent == 0 ) { |
111 |
minevent = 0; |
112 |
maxevent = nevent; |
113 |
} else { |
114 |
minevent = fromevent; |
115 |
if ( toevent > 0 ){ |
116 |
maxevent = toevent+1; |
117 |
} else if (toevent > nevent) { |
118 |
maxevent = nevent; |
119 |
} else { |
120 |
maxevent = toevent+1; |
121 |
} |
122 |
nevent=maxevent-minevent ; |
123 |
} |
124 |
|
125 |
|
126 |
if (fromevent!=0) |
127 |
printf("\n Scan of events from %i to %i ... \n",minevent,maxevent-1); |
128 |
else |
129 |
printf("\n Scan of events from %i to %i ... \n",minevent+1,maxevent); |
130 |
|
131 |
// |
132 |
// other variables definitions |
133 |
stringstream oss1,oss2,oss3,oss4,fromfile,isfile,tit; |
134 |
Int_t warning_dspnumber=0; |
135 |
Int_t ALARM=0; |
136 |
Int_t WARNING[12]; |
137 |
const Int_t size=nevent; |
138 |
Int_t dsp=0; |
139 |
Double_t yd[size*12], yc[size*12], x[size], eventint[size]; |
140 |
Double_t yyc[size], hi=0, land[size*12][3], illum[size*12][3]; |
141 |
|
142 |
TGraph *comprtime,*temp[5]; |
143 |
TGraph *eventnumb; |
144 |
TH1F *landau1[12],*landau2[12],*landau3[12],*illuminazione[12]; |
145 |
TPaveText *pt1; |
146 |
TPad *pt; |
147 |
|
148 |
// |
149 |
// information about the entries for the temperatures |
150 |
Int_t tmpSize=0,siztmp=0,maxsize=0; |
151 |
for (Int_t ev=0; ev<tnevent; ev++){ |
152 |
tree->GetEntry(ev); |
153 |
tmpSize = event->Records->GetEntries(); |
154 |
maxsize+=tmpSize; |
155 |
} |
156 |
const Int_t tsize=maxsize; |
157 |
Int_t tempt[tsize][5],xt[tsize], tempt_tmp[tsize]; |
158 |
|
159 |
|
160 |
// |
161 |
// open the output text files for the alarms |
162 |
ofstream warning(out + "warning.txt",ios::out); |
163 |
TString fname = out+ffile; |
164 |
TString fname1 = out+ffile; |
165 |
int slen=fname.Length(); |
166 |
int last=fname.Last('_'); |
167 |
if(last<(slen-1))fname.Append('_'); |
168 |
fname.Append("Trk-ALARM-report.txt"); |
169 |
ofstream alarm(fname,ios::out); |
170 |
alarm << "TRACKER ALARM REPORT - Downlink " << ffile<< endl; |
171 |
fname1.Append("_TrkAlarm-pkt-report.txt"); |
172 |
ofstream alarm1(fname1,ios::out); |
173 |
alarm1 << "TrkAlarm pkt REPORT - Downlink " << ffile<< endl; |
174 |
|
175 |
// |
176 |
// write the file for the TrkAlarm packet |
177 |
if(alnevent==0) alarm1 <<endl<< "------> NO ALARM!!! <-------"<< endl; |
178 |
else{ |
179 |
for (Int_t ev=0; ev<alnevent; ev++){ |
180 |
altr->GetEntry(ev); |
181 |
ph = aleh->GetPscuHeader(); |
182 |
|
183 |
alarm1 << "================================================="<< endl; |
184 |
alarm1 << "PSCU-Pkt N. "<< ph->GetCounter() ; |
185 |
alarm1 << " - OBT "<< ph->GetOrbitalTime() << " ms"<<endl; |
186 |
alarm1 << "(ROOT-tree entry "<<ev<<")"<<endl; |
187 |
alarm1 << "================================================="<< endl; |
188 |
|
189 |
alarm1 << " ALARM[1]= "<<(Int_t)al->ALARM[1]<<endl; |
190 |
alarm1 << " ALARM[2]= "<<(Int_t)al->ALARM[2]<<endl; |
191 |
alarm1 << " Aswr= "<<(Int_t)al->Aswr<<endl; |
192 |
alarm1 << " BID[1]= "<<(Int_t)al->BID[0]<<endl; |
193 |
alarm1 << " BID[2]= "<<(Int_t)al->BID[1]<<endl; |
194 |
alarm1 << " BID[3]= "<<(Int_t)al->BID[2]<<endl; |
195 |
alarm1 << " BID[4]= "<<(Int_t)al->BID[3]<<endl; |
196 |
alarm1 << " BID[5]= "<<(Int_t)al->BID[4]<<endl; |
197 |
alarm1 << " BID[6]= "<<(Int_t)al->BID[5]<<endl; |
198 |
alarm1 << " BID[7]= "<<(Int_t)al->BID[6]<<endl; |
199 |
alarm1 << " CmdDuringTrig= "<<(Int_t)al->CmdDuringTrig<<endl; |
200 |
alarm1 << " CmdIDMA= "<<(Int_t)al->CmdIDMA<<endl; |
201 |
alarm1 << " CmdNum= "<<(Int_t)al->CmdNum<<endl; |
202 |
alarm1 << " DSPBusy= "<<(Int_t)al->DSPBusy<<endl; |
203 |
alarm1 << " DSPMask= "<<(Int_t)al->DSPMask<<endl; |
204 |
alarm1 << " DSPSoft= "<<(Int_t)al->DSPSoft<<endl; |
205 |
alarm1 << " FinalCheck= "<<(Int_t)al->FinalCheck<<endl; |
206 |
alarm1 << " FlashData= "<<(Int_t)al->FlashData<<endl; |
207 |
alarm1 << " FlashOn= "<<(Int_t)al->FlashOn<<endl; |
208 |
alarm1 << " FlashShutdown= "<<(Int_t)al->FlashShutdown<<endl; |
209 |
alarm1 << " FlashUpset= "<<(Int_t)al->FlashUpset<<endl; |
210 |
alarm1 << " InterCheck= "<<(Int_t)al->InterCheck<<endl; |
211 |
alarm1 << " PNum= "<<(Int_t)al->PNum<<endl; |
212 |
alarm1 << " TrigIDMA= "<<(Int_t)al->TrigIDMA<<endl; |
213 |
alarm1 << " TrigMask= "<<(Int_t)al->TrigMask<<endl; |
214 |
alarm1 << " UnknownCmd= "<<(Int_t)al->UnknownCmd<<endl; |
215 |
} |
216 |
} |
217 |
|
218 |
//*************************************************************************************** |
219 |
// LOOP on each event |
220 |
//*************************************************************************************** |
221 |
|
222 |
// |
223 |
// information about the temperatures |
224 |
for (Int_t ev=0; ev<tnevent; ev++){ |
225 |
tree->GetEntry(ev); |
226 |
tmpSize = event->Records->GetEntries(); |
227 |
for (Int_t j = 0; j < tmpSize; j++){ |
228 |
record = (pamela::TsbTRecord*)event->Records->At(j); |
229 |
xt[siztmp]=record->RECORD_OBT; //0.051*record->RECORD_OBT; |
230 |
for (Int_t z = 0; z < 5; z++){ |
231 |
tempt[siztmp][z] = record->TEMPERATURES[z+1]; |
232 |
} |
233 |
siztmp++; |
234 |
} |
235 |
} |
236 |
|
237 |
// |
238 |
// information about the tracker data |
239 |
for (Int_t ev=minevent; ev<maxevent; ev++){ |
240 |
tr->GetEntry(ev); |
241 |
ph = eh->GetPscuHeader(); |
242 |
dsp=0; |
243 |
ALARM=0; |
244 |
for(Int_t i=0; i<12; i++){ |
245 |
dsp=te->DSPnumber[i]-1; |
246 |
yd[(ev-minevent)*12+dsp]= te->DATAlength[i]; |
247 |
yc[(ev-minevent)*12+dsp]= 0.051*te->compressiontime[i]; |
248 |
for(Int_t j=0;j<3;j++){ |
249 |
illum[(ev-minevent)*12+dsp][j]=te->addrcluster[i][j]; |
250 |
if(!(dsp%2)&&(te->signcluster[i][j])!=0) |
251 |
land[(ev-minevent)*12+dsp][j]=1024-(te->signcluster[i][j]); |
252 |
else land[(ev-minevent)*12+dsp][j]=te->signcluster[i][j]; |
253 |
} |
254 |
x[(ev-minevent)]= ph->GetOrbitalTime(); |
255 |
|
256 |
WARNING[i]=0; |
257 |
if(te->fc[i]!=0 || te->fl1[i]!=0 || te->fl2[i]!=0 || te->fl3[i]!=0 || te->fl4[i]!=0 || te->fl5[i]!=0 || te->fl6[i]!=0){ |
258 |
ALARM = 1; //general alarm |
259 |
WARNING[i] = 1; // DSP warning |
260 |
}; |
261 |
|
262 |
if(te->alarm[i]!=0){ // hardware alarm |
263 |
ALARM = 1; |
264 |
}; |
265 |
|
266 |
//************************************************************************************** |
267 |
// warning for internal number |
268 |
//************************************************************************************** |
269 |
if(i<=10){ |
270 |
if(te->eventn[i]!=te->eventn[i+1]){ |
271 |
warning_dspnumber++; |
272 |
warning<< "==> WARNING!! Check entry "<< ev<<" (DSP "<<dsp<<")" <<endl<< |
273 |
"eventn["<<i<<"]= "<<te->eventn[i]<<"!= eventn["<<i+1<<"]= "<< te->eventn[i+1]<<endl; |
274 |
} |
275 |
else |
276 |
eventint[(ev-minevent)]=te->eventn[0]; |
277 |
} |
278 |
} |
279 |
|
280 |
if(ev<=maxevent-1){ |
281 |
|
282 |
if((ev-minevent)>=1 && eventint[(ev-minevent)]!=eventint[(ev-minevent)-1]+1 && eventint[(ev-minevent)]!=1){ |
283 |
warning_dspnumber++; |
284 |
warning<< "==> WARNING!! Check entry "<< ev<<endl<< |
285 |
" DSP event num.= "<< eventint[(ev-minevent)]<< |
286 |
" is different from (previus+1) ="<<eventint[(ev-minevent)-1]+1 <<"\n"<<endl; |
287 |
} |
288 |
}; |
289 |
|
290 |
//******************************************************************************************** |
291 |
// file ALARM |
292 |
//******************************************************************************************** |
293 |
if(ALARM==1) { |
294 |
|
295 |
alarm << "================================================="<< endl; |
296 |
alarm << "PSCU-Pkt N. "<< ph->GetCounter() ; |
297 |
alarm << " - OBT "<< ph->GetOrbitalTime() << " ms"<<endl; |
298 |
alarm << "(ROOT-tree entry "<<ev<<")"<<endl; |
299 |
alarm << "================================================="<< endl; |
300 |
|
301 |
alarm << " DSPn"; |
302 |
alarm << " Event"; |
303 |
alarm << " Words"; |
304 |
alarm << " crc"; |
305 |
alarm << " FC"; |
306 |
alarm << " FL1"; |
307 |
alarm << " FL2"; |
308 |
alarm << " FL3"; |
309 |
alarm << " FL4"; |
310 |
alarm << " FL5"; |
311 |
alarm << " FL6" << endl; |
312 |
|
313 |
for(Int_t i=0; i<12 ; i++){ |
314 |
alarm.width(5); alarm << te->DSPnumber[i]; |
315 |
alarm.width(6); alarm << te->eventn[i]; |
316 |
alarm.width(6); alarm << te->DATAlength[i]; |
317 |
alarm.width(4); alarm << te->crc[i]; |
318 |
alarm.width(4); alarm << te->fc[i]; |
319 |
alarm.width(4); alarm << te->fl1[i]; |
320 |
alarm.width(4); alarm << te->fl2[i]; |
321 |
alarm.width(4); alarm << te->fl3[i]; |
322 |
alarm.width(4); alarm << te->fl4[i]; |
323 |
alarm.width(4); alarm << te->fl5[i]; |
324 |
alarm.width(4); alarm << te->fl6[i]; |
325 |
if(te->alarm[i]!=0)alarm<<" >> ALARM "; |
326 |
if(WARNING[i]!=0)alarm<<" (DSP warning) "; |
327 |
alarm << endl; |
328 |
} |
329 |
} |
330 |
} |
331 |
if(ALARM==0) alarm << endl<< "------> NO ALARM!!! <-------"<<endl; |
332 |
|
333 |
if(warning_dspnumber==0) warning<<"NONE"<<endl; |
334 |
|
335 |
//***************************************** |
336 |
//close all files |
337 |
//***************************************** |
338 |
warning.close(); |
339 |
alarm.close(); |
340 |
datafile->Close(); |
341 |
|
342 |
|
343 |
gStyle->SetLabelSize(0.05,"x"); |
344 |
gStyle->SetLabelSize(0.06,"y"); |
345 |
gStyle->SetStatFontSize(0.075); |
346 |
gStyle->SetOptStat(1110); |
347 |
gStyle->SetFillColor(10); |
348 |
gStyle->SetTitleFillColor(10); |
349 |
gStyle->SetTitleFontSize(0.1); |
350 |
gStyle->SetTitleOffset(0.8,"y"); |
351 |
gStyle->SetTitleOffset(0.9,"x"); |
352 |
gStyle->SetTitleSize(0.06,"y"); |
353 |
gStyle->SetTitleSize(0.055,"x"); |
354 |
|
355 |
//**************************************************************************************** |
356 |
//Output figures --- First sheet: |
357 |
//**************************************************************************************** |
358 |
|
359 |
TCanvas *CompTimeCanv=new TCanvas("Tracker_Detector_Report_4/6","",900,1200); |
360 |
CompTimeCanv->SetFillColor(10); |
361 |
CompTimeCanv->Range(0,0,100,100); |
362 |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
363 |
isfile<<"COMPRESSIONTIME vs. OBT"; |
364 |
TLatex *t=new TLatex(); |
365 |
t->SetTextFont(32); |
366 |
t->SetTextColor(1); |
367 |
t->SetTextAlign(12); |
368 |
t->SetTextSize(0.02); |
369 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
370 |
TLatex *t1=new TLatex(); |
371 |
t1->SetTextFont(32); |
372 |
t1->SetTextColor(1); |
373 |
t1->SetTextAlign(12); |
374 |
t1->SetTextSize(0.02); |
375 |
t1->DrawLatex(64.,98.7,isfile.str().c_str()); |
376 |
isfile.str(""); |
377 |
|
378 |
//**************************************************************************************** |
379 |
//Output figures --- Second sheet: |
380 |
//**************************************************************************************** |
381 |
|
382 |
TCanvas *EventNumCanv=new TCanvas("Tracker_Detector_Report_5/6","",900,1200); |
383 |
EventNumCanv->SetFillColor(10); |
384 |
EventNumCanv->Range(0,0,100,100); |
385 |
isfile<<"WARNINGS on DSP EVENT NUMBER "; |
386 |
t->SetTextFont(32); |
387 |
t->SetTextColor(1); |
388 |
t->SetTextAlign(12); |
389 |
t->SetTextSize(0.02); |
390 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
391 |
t1->SetTextFont(32); |
392 |
t1->SetTextColor(1); |
393 |
t1->SetTextAlign(12); |
394 |
t1->SetTextSize(0.02); |
395 |
t1->DrawLatex(68.4,98.7,isfile.str().c_str()); |
396 |
isfile.str(""); |
397 |
|
398 |
//**************************************************************************************** |
399 |
//Output figures --- Third sheet: |
400 |
//**************************************************************************************** |
401 |
|
402 |
TCanvas *LandauCanv1=new TCanvas("Landau ladder1","",900,1200); |
403 |
LandauCanv1->SetFillColor(10); |
404 |
LandauCanv1->Range(0,0,100,100); |
405 |
isfile<<"Landau ladder1"; |
406 |
|
407 |
t->SetTextFont(32); |
408 |
t->SetTextColor(1); |
409 |
t->SetTextAlign(12); |
410 |
t->SetTextSize(0.02); |
411 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
412 |
t1->SetTextFont(32); |
413 |
t1->SetTextColor(1); |
414 |
t1->SetTextAlign(12); |
415 |
t1->SetTextSize(0.02); |
416 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
417 |
isfile.str(""); |
418 |
|
419 |
//**************************************************************************************** |
420 |
//Output figures --- Third sheet: |
421 |
//**************************************************************************************** |
422 |
|
423 |
TCanvas *LandauCanv2=new TCanvas("Landau ladder2","",900,1200); |
424 |
LandauCanv2->SetFillColor(10); |
425 |
LandauCanv2->Range(0,0,100,100); |
426 |
isfile<<"Landau ladder2"; |
427 |
|
428 |
t->SetTextFont(32); |
429 |
t->SetTextColor(1); |
430 |
t->SetTextAlign(12); |
431 |
t->SetTextSize(0.02); |
432 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
433 |
t1->SetTextFont(32); |
434 |
t1->SetTextColor(1); |
435 |
t1->SetTextAlign(12); |
436 |
t1->SetTextSize(0.02); |
437 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
438 |
isfile.str(""); |
439 |
|
440 |
//**************************************************************************************** |
441 |
//Output figures --- Third sheet: |
442 |
//**************************************************************************************** |
443 |
|
444 |
TCanvas *LandauCanv3=new TCanvas("Landau ladder3","",900,1200); |
445 |
LandauCanv3->SetFillColor(10); |
446 |
LandauCanv3->Range(0,0,100,100); |
447 |
isfile<<"Landau ladder3"; |
448 |
|
449 |
t->SetTextFont(32); |
450 |
t->SetTextColor(1); |
451 |
t->SetTextAlign(12); |
452 |
t->SetTextSize(0.02); |
453 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
454 |
t1->SetTextFont(32); |
455 |
t1->SetTextColor(1); |
456 |
t1->SetTextAlign(12); |
457 |
t1->SetTextSize(0.02); |
458 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
459 |
isfile.str(""); |
460 |
|
461 |
//**************************************************************************************** |
462 |
//Output figures --- Fourth sheet: |
463 |
//**************************************************************************************** |
464 |
|
465 |
TCanvas *IlluminaCanv=new TCanvas("Illuminazione","",900,1200); |
466 |
IlluminaCanv->SetFillColor(10); |
467 |
IlluminaCanv->Range(0,0,100,100); |
468 |
isfile<<"lighting of the views"; |
469 |
t->SetTextFont(32); |
470 |
t->SetTextColor(1); |
471 |
t->SetTextAlign(12); |
472 |
t->SetTextSize(0.02); |
473 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
474 |
t1->SetTextFont(32); |
475 |
t1->SetTextColor(1); |
476 |
t1->SetTextAlign(12); |
477 |
t1->SetTextSize(0.02); |
478 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
479 |
isfile.str(""); |
480 |
|
481 |
//**************************************************************************************** |
482 |
//Output figures --- Fifth sheet: |
483 |
//**************************************************************************************** |
484 |
|
485 |
TCanvas *TempCanv=new TCanvas("Tracker_Detector_Temperaturt","",900,1200); |
486 |
TempCanv->SetFillColor(10); |
487 |
TempCanv->Range(0,0,100,100); |
488 |
isfile<<"Temperatures vs OBT"; |
489 |
|
490 |
t->SetTextFont(32); |
491 |
t->SetTextColor(1); |
492 |
t->SetTextAlign(12); |
493 |
t->SetTextSize(0.02); |
494 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
495 |
t1->SetTextFont(32); |
496 |
t1->SetTextColor(1); |
497 |
t1->SetTextAlign(12); |
498 |
t1->SetTextSize(0.02); |
499 |
t1->DrawLatex(80.,98.7,isfile.str().c_str()); |
500 |
isfile.str(""); |
501 |
|
502 |
//************************************************************************************* |
503 |
//book pads and histos |
504 |
//*************************************************************************************** |
505 |
|
506 |
TPad *pad1[12],*pad2[12],*pad3[12],*pad4[12],*pad5[12],*pad6[5]; //pad for histos |
507 |
Double_t posy = 0.95; // up y-coord - top pads |
508 |
Double_t hpad = 0; // pad height |
509 |
Double_t posx1=0; // left x-coord - pad column |
510 |
Double_t posx0=0; // x-coord - column division |
511 |
Double_t wrel = 0; // relative x size of first sub-column |
512 |
Double_t marg = 0.004; // margin among pads |
513 |
Double_t tposy = 0.95; // up y-coord - top pads |
514 |
Double_t thpad = 0; // pad height |
515 |
Double_t tposx1=0; // left x-coord - pad column |
516 |
Double_t tposx0=0; // x-coord - column division |
517 |
Double_t twrel = 0; // relative x size of first sub-column |
518 |
Double_t tmarg = 0.004; // margin among pads |
519 |
|
520 |
hpad = (posy-marg*11)/6; |
521 |
wrel = (1-marg*4)/2; |
522 |
thpad = (tposy-tmarg*5)/3; |
523 |
twrel = (1-tmarg*4)/2; |
524 |
stringstream title; |
525 |
stringstream hid; |
526 |
|
527 |
for(Int_t n = 0; n<12; n++) { |
528 |
|
529 |
if ( (n+1)%2==1 ) { |
530 |
if(n>1) posy = posy-(marg*2+hpad); |
531 |
posx1 = marg; |
532 |
posx0 = posx1 + wrel; |
533 |
} |
534 |
else { |
535 |
posx1 = posx0 + 2*marg; |
536 |
posx0 = posx1 + wrel; |
537 |
} |
538 |
|
539 |
if ( (n+1)%2==1 ) { |
540 |
if(n>1) tposy = tposy-(tmarg*2+thpad); |
541 |
tposx1 = tmarg; |
542 |
tposx0 = tposx1 + twrel; |
543 |
} |
544 |
else { |
545 |
tposx1 = tposx0 + 2*tmarg; |
546 |
tposx0 = tposx1 + twrel; |
547 |
} |
548 |
|
549 |
|
550 |
/* -----------> pad for histograms */ |
551 |
pad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
552 |
pad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
553 |
pad3[n] = new TPad("pad3"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
554 |
pad4[n] = new TPad("pad4"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
555 |
pad5[n] = new TPad("pad5"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
556 |
if(n<5) pad6[n] = new TPad("pad6"," ",tposx1,tposy-thpad,tposx0,tposy,18,0,0); |
557 |
|
558 |
|
559 |
/* -----------> HISTOGRAMS */ |
560 |
|
561 |
oss1<<"DSP "<<n+1; |
562 |
oss2<<"DSPh "<<n+1; |
563 |
oss3<<"DSP h "<<n+1; |
564 |
oss4<<"DSP h"<<n+1; |
565 |
|
566 |
landau1[n]=new TH1F(oss1.str().c_str(),oss1.str().c_str(),1201,-0.5,1200.5); |
567 |
landau1[n]->GetXaxis()->SetTitle("max signal"); |
568 |
landau1[n]->GetXaxis()->CenterTitle(); |
569 |
landau2[n]=new TH1F(oss2.str().c_str(),oss1.str().c_str(),1201,-0.5,1200.5); |
570 |
landau2[n]->GetXaxis()->SetTitle("max signal"); |
571 |
landau2[n]->GetXaxis()->CenterTitle(); |
572 |
landau3[n]=new TH1F(oss3.str().c_str(),oss1.str().c_str(),1201,-0.5,1200.5); |
573 |
landau3[n]->GetXaxis()->SetTitle("max signal"); |
574 |
landau3[n]->GetXaxis()->CenterTitle(); |
575 |
|
576 |
illuminazione[n]=new TH1F(oss4.str().c_str(),oss1.str().c_str(),3073,-0.5,3072.5); |
577 |
illuminazione[n]->GetXaxis()->SetTitle("strip with max signal"); |
578 |
illuminazione[n]->GetXaxis()->CenterTitle(); |
579 |
|
580 |
oss1.str(""); |
581 |
oss2.str(""); |
582 |
oss3.str(""); |
583 |
oss4.str(""); |
584 |
}; |
585 |
|
586 |
|
587 |
//********************************************************************************** |
588 |
// Fill Graphs and Histos |
589 |
//********************************************************************************** |
590 |
|
591 |
Double_t maxhist=0; |
592 |
TBox b; |
593 |
b.SetFillColor(5); |
594 |
|
595 |
for (Int_t i=0; i<12 ; i++){ |
596 |
|
597 |
for (Int_t ev=minevent; ev<maxevent; ev++){ |
598 |
yyc[(ev-minevent)]=yc[12*(ev-minevent)+i]; |
599 |
// if( land[12*(ev-minevent)+i][0]!=0 && illum[12*(ev-minevent)+i][0]>510 && illum[12*(ev-minevent)+i][0]<515) landau1[i]->Fill(land[12*(ev-minevent)+i][0]); |
600 |
if( land[12*(ev-minevent)+i][0]!=0) landau1[i]->Fill(land[12*(ev-minevent)+i][0]); |
601 |
if( land[12*(ev-minevent)+i][1]!=0) landau2[i]->Fill(land[12*(ev-minevent)+i][1]); |
602 |
if( land[12*(ev-minevent)+i][2]!=0) landau3[i]->Fill(land[12*(ev-minevent)+i][2]); |
603 |
for(Int_t j=0;j<3;j++){ |
604 |
if(land[12*(ev-minevent)+i][j]!=0){ |
605 |
hi=(j*1024)+illum[12*(ev-minevent)+i][j]; |
606 |
illuminazione[i]->Fill(hi); |
607 |
} |
608 |
} |
609 |
} |
610 |
|
611 |
LandauCanv1->cd(); |
612 |
pad1[i]->SetFillColor(10); |
613 |
pad1[i]->SetFrameFillColor(10); |
614 |
pad1[i]->Draw(); |
615 |
pad1[i]->cd(); |
616 |
landau1[i]->Draw(""); |
617 |
LandauCanv2->cd(); |
618 |
pad4[i]->SetFillColor(10); |
619 |
pad4[i]->SetFrameFillColor(10); |
620 |
pad4[i]->Draw(); |
621 |
pad4[i]->cd(); |
622 |
landau2[i]->Draw(""); |
623 |
LandauCanv3->cd(); |
624 |
pad5[i]->SetFillColor(10); |
625 |
pad5[i]->SetFrameFillColor(10); |
626 |
pad5[i]->Draw(); |
627 |
pad5[i]->cd(); |
628 |
landau3[i]->Draw(""); |
629 |
|
630 |
IlluminaCanv->cd(); |
631 |
pad2[i]->SetFillColor(10); |
632 |
pad2[i]->SetFrameFillColor(10); |
633 |
pad2[i]->Draw(); |
634 |
pad2[i]->cd(); |
635 |
pad2[i]->SetLogy(); |
636 |
// illuminazione[i]->SetStats(KFALSE); |
637 |
if(i==1){ |
638 |
illuminazione[i]->Draw("ah"); |
639 |
maxhist= illuminazione[i]->GetMaximum(); |
640 |
b.DrawBox(2816.,0.,3060.,maxhist); |
641 |
illuminazione[i]->Draw("axis same"); |
642 |
illuminazione[i]->Draw("same ]["); |
643 |
} |
644 |
else if(i==6){ |
645 |
illuminazione[i]->Draw("ah"); |
646 |
maxhist= illuminazione[i]->GetMaximum(); |
647 |
b.DrawBox(2560.,0.,2816.,maxhist); |
648 |
b.DrawBox(512.,0.,768.,maxhist); |
649 |
b.DrawBox(1024.,0.,1792.,maxhist); |
650 |
illuminazione[i]->Draw("axis same"); |
651 |
illuminazione[i]->Draw("same]["); |
652 |
} |
653 |
else if(i==11){ |
654 |
illuminazione[i]->Draw("ah"); |
655 |
maxhist= illuminazione[i]->GetMaximum(); |
656 |
b.DrawBox(768.,0.,1024.,maxhist); |
657 |
illuminazione[i]->Draw("axis same"); |
658 |
illuminazione[i]->Draw("same]["); |
659 |
} |
660 |
else illuminazione[i]->Draw(""); |
661 |
|
662 |
CompTimeCanv->cd(); |
663 |
pad3[i]->SetFillColor(10); |
664 |
pad3[i]->SetFrameFillColor(10); |
665 |
pad3[i]->Draw(); |
666 |
pad3[i]->cd(); |
667 |
comprtime= new TGraph(nevent,x,yyc); |
668 |
oss1<<"DSP "<<i+1; |
669 |
comprtime->SetTitle(oss1.str().c_str()); |
670 |
comprtime->GetXaxis()->SetTitle("OBT (ms)"); |
671 |
comprtime->GetXaxis()->CenterTitle(); |
672 |
comprtime->GetYaxis()->SetTitle("compressiontime (ms)"); |
673 |
comprtime->GetYaxis()->CenterTitle(); |
674 |
comprtime->GetYaxis()->SetRangeUser(0,2); |
675 |
comprtime->Draw("ap"); |
676 |
oss1.str(""); |
677 |
}; |
678 |
|
679 |
EventNumCanv->cd(); |
680 |
TPad *pt0=new TPad("pt0"," ",0.704,0.004,0.996,0.98); |
681 |
pt1 = new TPaveText(0.004,0.004,0.986,0.996); |
682 |
pt = new TPad("pt"," ",0.004,0.004,0.7,0.98,18,0,0); |
683 |
pt1->SetFillColor(10); |
684 |
pt1->ReadFile(out + "warning.txt"); |
685 |
pt1->SetTextAlign(22); |
686 |
pt1->SetTextSize(0.035); |
687 |
pt0->SetFillColor(10); |
688 |
pt0->SetFrameFillColor(10); |
689 |
pt0->Draw(); |
690 |
pt0->cd(); |
691 |
pt1->Draw(); |
692 |
EventNumCanv->cd(); |
693 |
pt->SetFillColor(10); |
694 |
pt->SetFrameFillColor(10); |
695 |
pt->Draw(); |
696 |
pt->cd(); |
697 |
eventnumb=new TGraph(nevent,x,eventint); |
698 |
eventnumb->SetTitle(""); |
699 |
eventnumb->GetXaxis()->SetLabelSize(0.04); |
700 |
eventnumb->GetXaxis()->SetTitleSize(0.04); |
701 |
eventnumb->GetXaxis()->SetTitle("OBT (ms)"); |
702 |
eventnumb->GetXaxis()->CenterTitle(); |
703 |
eventnumb->GetXaxis()->SetTickLength(0.01); |
704 |
eventnumb->GetXaxis()->SetTitleOffset(1.2); |
705 |
eventnumb->GetYaxis()->SetLabelSize(0.04); |
706 |
eventnumb->GetYaxis()->SetTitleSize(0.04); |
707 |
eventnumb->GetYaxis()->SetTitle("DSP event-number"); |
708 |
eventnumb->GetYaxis()->CenterTitle(); |
709 |
eventnumb->GetYaxis()->SetTitleOffset(1.5); |
710 |
eventnumb->SetMarkerStyle(21); |
711 |
eventnumb->SetMarkerColor(kBlue); |
712 |
eventnumb->SetMarkerSize(0.3); |
713 |
eventnumb->Draw("ap"); |
714 |
|
715 |
for(Int_t i=0; i<5; i++){ |
716 |
for (Int_t ev=0; ev<tsize; ev++){ |
717 |
tempt_tmp[ev]=(Int_t)(((3.3*tempt[ev][i]/4096)-0.586)/0.0231); |
718 |
} |
719 |
TempCanv->cd(); |
720 |
tit<<"T"<<i+5<<" (magnetic module "<<i+1<<")"; |
721 |
pad6[i]->SetFillColor(10); |
722 |
pad6[i]->Draw(); |
723 |
pad6[i]->cd(); |
724 |
temp[i]= new TGraph(tsize,xt,tempt_tmp); |
725 |
temp[i]->SetTitle(tit.str().c_str()); |
726 |
temp[i]->GetXaxis()->SetLabelSize(0.04); |
727 |
temp[i]->GetXaxis()->SetTitleSize(0.04); |
728 |
temp[i]->GetXaxis()->SetTitle("OBT (ms)"); |
729 |
temp[i]->GetXaxis()->CenterTitle(); |
730 |
temp[i]->GetXaxis()->SetTitleOffset(0.85); |
731 |
temp[i]->GetYaxis()->SetTitleOffset(1.2); |
732 |
temp[i]->GetYaxis()->SetLabelOffset(0.001); |
733 |
temp[i]->GetYaxis()->SetLabelSize(0.04); |
734 |
temp[i]->GetYaxis()->SetTitleSize(0.04); |
735 |
temp[i]->GetYaxis()->SetTitle("Temperatures ( ^{o}C)"); |
736 |
temp[i]->GetYaxis()->CenterTitle(); |
737 |
temp[i]->SetMarkerStyle(21); |
738 |
temp[i]->SetMarkerSize(0.2); |
739 |
temp[i]->Draw("ap"); |
740 |
tit.str(""); |
741 |
} |
742 |
CompTimeCanv->Update(); |
743 |
LandauCanv1->Update(); |
744 |
LandauCanv2->Update(); |
745 |
LandauCanv3->Update(); |
746 |
IlluminaCanv->Update(); |
747 |
TempCanv->Update(); |
748 |
|
749 |
printf("... end of packets. \n"); |
750 |
//************************************************************************* |
751 |
// Save output Files |
752 |
//************************************************************************* |
753 |
stringstream out1,out2,out3,command; |
754 |
|
755 |
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
756 |
out1.str(""); |
757 |
out2.str(""); |
758 |
out3.str(""); |
759 |
|
760 |
out1<<ffile<<"_FTrkQLook_EXPERT.ps("; |
761 |
out2<<ffile<<"_FTrkQLook_EXPERT.ps"; |
762 |
out3<<ffile<<"_FTrkQLook_EXPERT.ps)"; |
763 |
|
764 |
CompTimeCanv->Print(out+out1.str().c_str(),"Portrait"); |
765 |
EventNumCanv->Print(out+out2.str().c_str(),"Portrait"); |
766 |
LandauCanv1->Print(out+out2.str().c_str(),"Portrait"); |
767 |
LandauCanv2->Print(out+out2.str().c_str(),"Portrait"); |
768 |
LandauCanv3->Print(out+out2.str().c_str(),"Portrait"); |
769 |
IlluminaCanv->Print(out+out2.str().c_str(),"Portrait"); |
770 |
TempCanv->Print(out+out3.str().c_str(),"Portrait"); |
771 |
|
772 |
if(!strcmp(outfile.Data(),"pdf")){ |
773 |
stringstream com; |
774 |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_EXPERT.ps "<<out<<ffile<<"_FTrkQLook_EXPERT.pdf"; |
775 |
system(com.str().c_str()); |
776 |
printf("\n---> ps file converted in pdf format!\n"); |
777 |
com.str(""); |
778 |
com<<"rm -f "<<out<<ffile<<"_FTrkQLook_EXPERT.ps "; |
779 |
system(com.str().c_str()); |
780 |
printf("---> ps file removed!\n\n"); |
781 |
com.str(""); |
782 |
} |
783 |
} |
784 |
else{ |
785 |
out1.str(""); |
786 |
out1<<ffile<<"_FTrkQLook_EXPERT-CompTime."<<outfile.Data(); |
787 |
CompTimeCanv->Print(out+out1.str().c_str()); |
788 |
out1.str(""); |
789 |
out1<<ffile<<"_FTrkQLook_EXPERT-Temp."<<outfile.Data(); |
790 |
TempCanv->Print(out+out1.str().c_str()); |
791 |
out1.str(""); |
792 |
out1<<ffile<<"_FTrkQLook_EXPERT-EvNum."<<outfile.Data(); |
793 |
EventNumCanv->Print(out+out1.str().c_str()); |
794 |
out1.str(""); |
795 |
out1<<ffile<<"_FTrkQLook_EXPERT-LandauL1."<<outfile.Data(); |
796 |
LandauCanv1->Print(out+out1.str().c_str()); |
797 |
out1.str(""); |
798 |
out1<<ffile<<"_FTrkQLook_EXPERT-LandauL2."<<outfile.Data(); |
799 |
LandauCanv2->Print(out+out1.str().c_str()); |
800 |
out1.str(""); |
801 |
out1<<ffile<<"_FTrkQLook_EXPERT-LandauL3."<<outfile.Data(); |
802 |
LandauCanv3->Print(out+out1.str().c_str()); |
803 |
out1.str(""); |
804 |
out1<<ffile<<"_FTrkQLook_EXPERT-Lighting."<<outfile.Data(); |
805 |
IlluminaCanv->Print(out+out1.str().c_str()); |
806 |
} |
807 |
|
808 |
command.str(""); |
809 |
command<<"rm -f "<<out<<"warning.txt"; |
810 |
system(command.str().c_str()); |
811 |
|
812 |
gROOT->Reset(); |
813 |
return; |
814 |
} |