1 |
|
2 |
/** |
3 |
* FTrkQLook_EXPERT.cxx |
4 |
* |
5 |
* autor: D.Fedele |
6 |
* version v1r27 |
7 |
* Parameters: |
8 |
* file - the data file to analyze |
9 |
* fromevent - first event to analyze |
10 |
* toevent - last event to analyze |
11 |
* outdir - total path of output file |
12 |
* outfile - extension of output file (pdf,ps,gif,jpg) |
13 |
* |
14 |
* |
15 |
*/ |
16 |
// |
17 |
#include <fstream> |
18 |
// |
19 |
#include <TPaveText.h> |
20 |
#include <TLatex.h> |
21 |
#include <TCanvas.h> |
22 |
#include <TGraph.h> |
23 |
#include <TFile.h> |
24 |
#include <TTree.h> |
25 |
#include <TStyle.h> |
26 |
// |
27 |
#include <physics/tracker/TrackerEvent.h> |
28 |
#include <PscuHeader.h> |
29 |
#include <EventHeader.h> |
30 |
#include <RunHeaderEvent.h> |
31 |
#include <TrkAlarmEvent.h> |
32 |
#include <tsbt/TsbTRecord.h> |
33 |
#include <tsbt/TsbTEvent.h> |
34 |
#include <tsbb/TsbBRecord.h> |
35 |
#include <tsbb/TsbBEvent.h> |
36 |
#include <EventCounter.h> |
37 |
#include <PacketType.h> |
38 |
// |
39 |
#define MAXSTORAGE 50000 |
40 |
|
41 |
void FTrkQLook_EXPERT(TString file,Int_t fromevent,Int_t toevent, TString outdir, TString outfile) |
42 |
{ |
43 |
// |
44 |
// obtain information about the data file and select the output dir |
45 |
Int_t dwpos = file.Last('/'); |
46 |
Int_t dwpos1 = file.Last('.'); |
47 |
TString base,ffile ; |
48 |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
49 |
if(dwpos>0) base=file(0,dwpos); |
50 |
|
51 |
TString out; |
52 |
if(outdir.Length()==0){ |
53 |
out = base; |
54 |
}else{ |
55 |
out = outdir; |
56 |
} |
57 |
if(out.Last('/')+1<out.Length()) out+="/"; |
58 |
|
59 |
// |
60 |
// inizialise the variables and open the file |
61 |
pamela::TsbTEvent *event = 0; |
62 |
pamela::TsbTRecord *record = 0; |
63 |
pamela::TsbBEvent *Bevent = 0; |
64 |
pamela::TsbBRecord *Brecord = 0; |
65 |
pamela::tracker::TrackerEvent *te=0; |
66 |
pamela::EventHeader *eh=0,*aleh=0,*eH=0,*eT=0,*eB=0; |
67 |
pamela::PscuHeader *ph=0,*pH=0; |
68 |
pamela::TrkAlarmEvent *al=0; |
69 |
pamela::RunHeaderEvent *reh=0; |
70 |
pamela::EventCounter *cod=0; |
71 |
|
72 |
pamela::PacketType *pctp=0; |
73 |
|
74 |
TFile *datafile = new TFile(file); |
75 |
if ( !datafile ){ |
76 |
printf("No data file, exiting...\n"); |
77 |
return; |
78 |
} |
79 |
|
80 |
TTree *tree = (TTree*)datafile->Get("TsbT"); |
81 |
tree->SetBranchAddress("TsbT",&event); |
82 |
tree->SetBranchAddress("Header",&eT); |
83 |
|
84 |
TTree *Btree = (TTree*)datafile->Get("TsbB"); |
85 |
Btree->SetBranchAddress("TsbB",&Bevent); |
86 |
Btree->SetBranchAddress("Header",&eB); |
87 |
|
88 |
TTree *altr = (TTree*)datafile->Get("TrkAlarm"); |
89 |
altr->SetBranchAddress("TrkAlarm",&al); |
90 |
altr->SetBranchAddress("Header",&aleh); |
91 |
|
92 |
TTree *tr = (TTree*)datafile->Get("Physics"); |
93 |
tr->SetBranchAddress("Tracker",&te); |
94 |
tr->SetBranchAddress("Header",&eh); |
95 |
|
96 |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
97 |
otr->SetBranchAddress("Header",&eH); |
98 |
otr->SetBranchAddress("RunHeader",&reh); |
99 |
|
100 |
Long64_t nevent = tr->GetEntries(); |
101 |
Long64_t neventH = otr->GetEntries(); |
102 |
Long64_t tnevent = tree->GetEntries(); |
103 |
Long64_t bnevent = Btree->GetEntries(); |
104 |
Long64_t alnevent = altr->GetEntries(); |
105 |
Int_t minevent=0; |
106 |
Int_t maxevent=0; |
107 |
|
108 |
printf("Number of total events: %lld\n",nevent); |
109 |
printf("Number of header events: %lld\n",neventH); |
110 |
printf("Number of TsbT events: %lld\n",tnevent); |
111 |
printf("Number of TsbB events: %lld\n",bnevent); |
112 |
printf("Number of TrkAlarm packet events: %lld\n",alnevent); |
113 |
|
114 |
if (nevent<=0){ |
115 |
datafile->Close(); |
116 |
return; |
117 |
} |
118 |
if ( fromevent > toevent && toevent>0 ){ |
119 |
printf("It must be fromevent < toevent \n"); |
120 |
return; |
121 |
} |
122 |
if ( fromevent > nevent || fromevent < 0 ) { |
123 |
printf("You can choose fromevent between 0 (all) and %lld \n",nevent); |
124 |
return; |
125 |
} |
126 |
if ( toevent > nevent || toevent < 0 ) { |
127 |
printf("You can choose toevent between 0 (all) and %lld \n",nevent); |
128 |
return; |
129 |
} |
130 |
if ( fromevent == 0 ) { |
131 |
minevent = 0; |
132 |
maxevent = nevent; |
133 |
} else { |
134 |
minevent = fromevent; |
135 |
if ( toevent > 0 ){ |
136 |
maxevent = toevent+1; |
137 |
} else if (toevent > nevent) { |
138 |
maxevent = nevent; |
139 |
} else { |
140 |
maxevent = nevent; |
141 |
} |
142 |
nevent=maxevent-minevent ; |
143 |
} |
144 |
|
145 |
// |
146 |
// information about the RunHeader |
147 |
ULong_t HOBT[neventH]; |
148 |
Int_t trk_cal_us[neventH]; |
149 |
ULong_t acq_info[neventH]; |
150 |
Int_t countnboot=1; |
151 |
for (Int_t vi=0; vi<neventH;vi++){ |
152 |
HOBT[vi]=0; |
153 |
trk_cal_us[vi]=0; |
154 |
acq_info[vi]=0; |
155 |
} |
156 |
for (Int_t ev=0; ev<neventH; ev++){ |
157 |
otr->GetEntry(ev); |
158 |
pH = eH->GetPscuHeader(); |
159 |
HOBT[ev]= pH->GetOrbitalTime(); |
160 |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
161 |
acq_info[ev]=reh->ACQ_BUILD_INFO; |
162 |
if((HOBT[ev]<HOBT[ev-1]) && ev>0) |
163 |
countnboot+=1; |
164 |
} |
165 |
countnboot+=(Int_t)(2*nevent/MAXSTORAGE); |
166 |
// printf("\ncountnboot=%d\n",countnboot); |
167 |
|
168 |
// |
169 |
// other variables definitions |
170 |
stringstream oss1,oss2,oss3,oss4,fromfile,isfile,tit; |
171 |
Int_t ALARM=0; |
172 |
Int_t WARNING[12]; |
173 |
|
174 |
// |
175 |
// information about the entries for the temperatures |
176 |
Int_t tmpSize=0,siztmp=0,maxsize=0; |
177 |
for (Int_t ev=0; ev<tnevent; ev++){ |
178 |
tree->GetEntry(ev); |
179 |
tmpSize = event->Records->GetEntries(); |
180 |
maxsize+=tmpSize; |
181 |
} |
182 |
const Int_t tsize=maxsize; |
183 |
Int_t tempt[tsize][5]; |
184 |
ULong_t xt[tsize]; |
185 |
|
186 |
Int_t cntpgtemp=1,cntpgdat=0,cntpgmag=0; |
187 |
// |
188 |
// information about the temperatures |
189 |
for (Int_t ev=0; ev<tnevent; ev++){ |
190 |
tree->GetEntry(ev); |
191 |
tmpSize = event->Records->GetEntries(); |
192 |
for (Int_t j = 0; j < tmpSize; j++){ |
193 |
record = (pamela::TsbTRecord*)event->Records->At(j); |
194 |
xt[siztmp]=record->RECORD_OBT; |
195 |
if((xt[siztmp]<xt[siztmp-1]) && siztmp>0) |
196 |
cntpgtemp+=1; |
197 |
|
198 |
for (Int_t z = 0; z < 5; z++){ |
199 |
tempt[siztmp][z] = record->TEMPERATURES[z+1]; |
200 |
} |
201 |
siztmp++; |
202 |
} |
203 |
} |
204 |
|
205 |
// |
206 |
// information about the entries for the magnetic field |
207 |
if(bnevent>0) cntpgmag=1; |
208 |
maxsize=0; |
209 |
for (Int_t ev=0; ev<bnevent; ev++){ |
210 |
Btree->GetEntry(ev); |
211 |
tmpSize = Bevent->Records->GetEntries(); |
212 |
maxsize+=tmpSize; |
213 |
} |
214 |
const Int_t bsize=maxsize; |
215 |
Int_t magt[bsize][5]; |
216 |
ULong_t xb[bsize]; |
217 |
siztmp=0; |
218 |
// |
219 |
// information about the magnetic field |
220 |
for (Int_t ev=0; ev<bnevent; ev++){ |
221 |
Btree->GetEntry(ev); |
222 |
tmpSize = Bevent->Records->GetEntries(); |
223 |
for (Int_t j = 0; j < tmpSize; j++){ |
224 |
Brecord = (pamela::TsbBRecord*)Bevent->Records->At(j); |
225 |
xb[siztmp]=Brecord->RECORD_OBT; |
226 |
if((xb[siztmp]<xb[siztmp-1]) && siztmp>0) |
227 |
cntpgmag+=1; |
228 |
for (Int_t z = 0; z < 5; z++){ |
229 |
magt[siztmp][z] = Brecord->B_FIELD[z+1]; |
230 |
} |
231 |
siztmp++; |
232 |
} |
233 |
} |
234 |
|
235 |
// |
236 |
// open the output text files for the alarms |
237 |
TString fname1 = out+ffile; |
238 |
TString fname = out+ffile; |
239 |
int slen=fname.Length(); |
240 |
int last=fname.Last('_'); |
241 |
if(last<(slen-1))fname.Append('_'); |
242 |
fname.Append("FTrk-DSP-report.txt"); |
243 |
ofstream alarm(fname,ios::out); |
244 |
alarm << "TRACKER DSP REPORT - Downlink " << ffile<< endl; |
245 |
fname1.Append("_FTrkAlarm-pkt-report.txt"); |
246 |
ofstream alarm1(fname1,ios::out); |
247 |
alarm1 << "TrkAlarm pkt REPORT - Downlink " << ffile<< endl; |
248 |
|
249 |
// |
250 |
// write the file for the TrkAlarm packet |
251 |
if(alnevent==0) alarm1 <<endl<< "------> NO ALARM!!! <-------"<< endl; |
252 |
else{ |
253 |
ULong_t obt=0; |
254 |
for (Int_t ev=0; ev<alnevent; ev++){ |
255 |
altr->GetEntry(ev); |
256 |
ph = aleh->GetPscuHeader(); |
257 |
|
258 |
if((ULong_t)ph->GetOrbitalTime()<obt && ev>0) |
259 |
alarm1<<endl<<"NEW CPU BOOT"<<endl; |
260 |
obt=ph->GetOrbitalTime(); |
261 |
|
262 |
alarm1 << "================================================="<< endl; |
263 |
alarm1 << "PSCU-Pkt N. "<< ph->GetCounter() ; |
264 |
alarm1 << " - OBT "<< (ULong_t)ph->GetOrbitalTime() << " ms"<<endl; |
265 |
alarm1 << "(ROOT-tree entry "<<ev<<")"<<endl; |
266 |
alarm1 << "================================================="<< endl<<endl; |
267 |
|
268 |
alarm1 << "Alarm variables (range 0-1)"<<endl; |
269 |
alarm1 << " ALARM[1]= 0x"<< hex << (Int_t)al->ALARM[0]<<endl; |
270 |
alarm1 << " ALARM[2]= 0x"<< (Int_t)al->ALARM[1]<<endl; |
271 |
alarm1 << " CmdDuringTrig= 0x"<< (Int_t)al->CmdDuringTrig<<endl; |
272 |
alarm1 << " FinalCheck= 0x"<< (Int_t)al->FinalCheck<<endl; |
273 |
alarm1 << " FlashData= 0x"<< (Int_t)al->FlashData<<endl; |
274 |
alarm1 << " FlashShutdown= 0x"<< (Int_t)al->FlashShutdown<<endl; |
275 |
alarm1 << " FlashUpset= 0x"<< (Int_t)al->FlashUpset<<endl; |
276 |
alarm1 << " InterCheck= 0x"<< (Int_t)al->InterCheck<<endl; |
277 |
alarm1 << " UnknownCmd= 0x"<<(Int_t)al->UnknownCmd<<endl<<endl; |
278 |
|
279 |
alarm1 << "Alarm variables (range 0-3F)"<<endl; |
280 |
alarm1 << " CmdIDMA= 0x"<< (Int_t)al->CmdIDMA<<endl; |
281 |
alarm1 << " DSPSoft= 0x"<< (Int_t)al->DSPSoft<<endl; |
282 |
alarm1 << " TrigIDMA= 0x"<< (Int_t)al->TrigIDMA<<endl<<endl; |
283 |
|
284 |
alarm1 << "Control variables (range 0-3F)"<<endl; |
285 |
alarm1 << " DSPBusy= 0x"<< (Int_t)al->DSPBusy<<endl; |
286 |
alarm1 << " DSPMask= 0x"<< (Int_t)al->DSPMask<<endl<<endl; |
287 |
|
288 |
alarm1 << "Control variables (range 0-1)"<<endl; |
289 |
alarm1 << " FlashOn= 0x"<< (Int_t)al->FlashOn<<endl<<endl; |
290 |
|
291 |
alarm1 << "Control variables (range 0-3)"<<endl; |
292 |
alarm1 << " TrigMask= 0x"<< (Int_t)al->TrigMask<<endl<<endl; |
293 |
|
294 |
alarm1 << "Control bits fixed"<<endl; |
295 |
alarm1 << " Aswr= 0x"<< (Int_t)al->Aswr<<endl; |
296 |
alarm1 << " BID[1]= 0x"<< (Int_t)al->BID[0]<<endl; |
297 |
alarm1 << " BID[2]= 0x"<< (Int_t)al->BID[1]<<endl; |
298 |
alarm1 << " BID[3]= 0x"<< (Int_t)al->BID[2]<<endl; |
299 |
alarm1 << " BID[4]= 0x"<< (Int_t)al->BID[3]<<endl; |
300 |
alarm1 << " BID[5]= 0x"<< (Int_t)al->BID[4]<<endl; |
301 |
alarm1 << " BID[6]= 0x"<< (Int_t)al->BID[5]<<endl; |
302 |
alarm1 << " BID[7]= 0x"<< (Int_t)al->BID[6]<<endl; |
303 |
alarm1 << " CmdNum= 0x"<< (Int_t)al->CmdNum<<endl; |
304 |
alarm1 << " PNum= 0x"<< (Int_t)al->PNum<< dec <<endl; |
305 |
|
306 |
alarm1 << "================================================="<< endl<<endl; |
307 |
|
308 |
} |
309 |
} |
310 |
|
311 |
// |
312 |
// Set Style options |
313 |
gStyle->SetLabelSize(0.05,"x"); |
314 |
gStyle->SetLabelSize(0.06,"y"); |
315 |
gStyle->SetStatFontSize(0.075); |
316 |
gStyle->SetOptStat(1110); |
317 |
gStyle->SetFillColor(10); |
318 |
gStyle->SetStatColor(10); |
319 |
gStyle->SetTitleFillColor(10); |
320 |
gStyle->SetTitleFontSize(0.1); |
321 |
gStyle->SetTitleOffset(0.8,"y"); |
322 |
gStyle->SetTitleOffset(0.9,"x"); |
323 |
gStyle->SetTitleSize(0.06,"y"); |
324 |
gStyle->SetTitleSize(0.055,"x"); |
325 |
|
326 |
// |
327 |
// Define output canvas, histos and graphs |
328 |
TCanvas *CompTimeCanv[countnboot],*EventNumCanv[countnboot],*TempCanv[cntpgtemp],*BfieldCanv[cntpgmag]; |
329 |
TCanvas *IlluminaCanv,*LandauCanv1,*LandauCanv2,*LandauCanv3; |
330 |
|
331 |
TH1F *landau1[12],*landau2[12],*landau3[12],*illuminazione[12]; |
332 |
TGraph *comprtime[12][countnboot],*temp[5][cntpgtemp],*tempw[5][cntpgtemp],*eventnumb[countnboot],*mag[5][cntpgmag]; |
333 |
TPad *pad1[12],*pad2[12],*pad3[12],*pad4[12],*pad5[12],*pad6[5],*pad7[5]; |
334 |
|
335 |
for(Int_t n = 0; n<12; n++) { |
336 |
|
337 |
/* -----------> HISTOGRAMS */ |
338 |
|
339 |
tit<<"DSP "<<n+1; |
340 |
oss1<<"DSP "<<n+1; |
341 |
oss2<<"DSPh "<<n+1; |
342 |
oss3<<"DSP h "<<n+1; |
343 |
oss4<<"DSP h"<<n+1; |
344 |
|
345 |
landau1[n]= new TH1F(oss1.str().c_str(),tit.str().c_str(),401,-0.5,1200.5); |
346 |
landau2[n]= new TH1F(oss2.str().c_str(),tit.str().c_str(),401,-0.5,1200.5); |
347 |
landau3[n]= new TH1F(oss3.str().c_str(),tit.str().c_str(),401,-0.5,1200.5); |
348 |
|
349 |
illuminazione[n]= new TH1F(oss4.str().c_str(),tit.str().c_str(),3073,-0.5,3072.5); |
350 |
|
351 |
tit.str(""); |
352 |
oss1.str(""); |
353 |
oss2.str(""); |
354 |
oss3.str(""); |
355 |
oss4.str(""); |
356 |
}; |
357 |
|
358 |
|
359 |
//*************************************************************************************** |
360 |
// LOOP on each event |
361 |
//*************************************************************************************** |
362 |
|
363 |
if (fromevent!=0) |
364 |
printf("\n Scan of events from %i to %i ... \n",minevent,maxevent-1); |
365 |
else |
366 |
printf("\n Scan of events from %i to %i ... \n",minevent+1,maxevent); |
367 |
|
368 |
TLatex *t=new TLatex(); |
369 |
TLatex *t1=new TLatex(); |
370 |
|
371 |
TLine li,liva1; |
372 |
|
373 |
Int_t minev=minevent,maxev=maxevent,countTEMP=0,countMAG=0; |
374 |
ULong_t countALARMx=0,countALARMy=0,countFC[12],countFL1[12],countFL2[12],countFL3[12],countFL4[12],countFL5[12],countFL6[12]; |
375 |
|
376 |
for(int i=0; i<12; i++){ |
377 |
countFC[i]=0; |
378 |
countFL1[i]=0; |
379 |
countFL2[i]=0; |
380 |
countFL3[i]=0; |
381 |
countFL4[i]=0; |
382 |
countFL5[i]=0; |
383 |
countFL6[i]=0; |
384 |
} |
385 |
|
386 |
// |
387 |
// Fill temperature graphs |
388 |
for(Int_t ii=0; ii<cntpgtemp;ii++){ |
389 |
//**************************************************************************************** |
390 |
//Temperature Output Pages |
391 |
//**************************************************************************************** |
392 |
fromfile.str(""); |
393 |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
394 |
isfile<<"Temperatures vs OBT pag"<<ii+1; |
395 |
TempCanv[ii]=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
396 |
TempCanv[ii]->SetFillColor(10); |
397 |
TempCanv[ii]->Range(0,0,100,100); |
398 |
|
399 |
t->SetTextFont(32); |
400 |
t->SetTextColor(1); |
401 |
t->SetTextAlign(12); |
402 |
t->SetTextSize(0.02); |
403 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
404 |
t1->SetTextFont(32); |
405 |
t1->SetTextColor(1); |
406 |
t1->SetTextAlign(12); |
407 |
t1->SetTextSize(0.02); |
408 |
t1->DrawLatex(78.,98.7,isfile.str().c_str()); |
409 |
isfile.str(""); |
410 |
t1->SetTextSize(0.025); |
411 |
t1->SetTextColor(196); |
412 |
isfile<<"--> Values at 28.5^{o}C (if presents) correspond"; |
413 |
t1->DrawLatex(50.,22.,isfile.str().c_str()); |
414 |
isfile.str(""); |
415 |
isfile<<" to wrong readings ( > 100^{o}C) of the Tsb"; |
416 |
t1->DrawLatex(50.,19.,isfile.str().c_str()); |
417 |
isfile.str(""); |
418 |
isfile<<"--> Values at 25.5^{o}C (if presents) correspond"; |
419 |
t1->DrawLatex(50.,12.,isfile.str().c_str()); |
420 |
isfile.str(""); |
421 |
isfile<<" to wrong readings ( < 0^{o}C) of the Tsb"; |
422 |
t1->DrawLatex(50.,9.,isfile.str().c_str()); |
423 |
isfile.str(""); |
424 |
|
425 |
Float_t tposy = 0.95; // up y-coord - top pads |
426 |
Float_t thpad = 0; // pad height |
427 |
Float_t tposx1=0; // left x-coord - pad column |
428 |
Float_t tposx0=0; // x-coord - column division |
429 |
Float_t twrel = 0; // relative x size of first sub-column |
430 |
Float_t tmarg = 0.004; // margin among pads |
431 |
|
432 |
thpad = (tposy-tmarg*5)/3; |
433 |
twrel = (1-tmarg*4)/2; |
434 |
|
435 |
for(Int_t i=0; i<5; i++){ |
436 |
if ( (i+1)%2==1 ) { |
437 |
if(i>1) tposy = tposy-(tmarg*2+thpad); |
438 |
tposx1 = tmarg; |
439 |
tposx0 = tposx1 + twrel; |
440 |
} |
441 |
else { |
442 |
tposx1 = tposx0 + 2*tmarg; |
443 |
tposx0 = tposx1 + twrel; |
444 |
} |
445 |
|
446 |
/* -----------> pad for histograms */ |
447 |
pad6[i] = new TPad("pad6"," ",tposx1,tposy-thpad,tposx0,tposy,18,0,0); |
448 |
|
449 |
Int_t v=0,vv=0; |
450 |
Double_t xt_tmp[tsize], tempt_tmp[tsize]; |
451 |
Double_t xt_tmpw[tsize], tempt_tmpw[tsize]; |
452 |
for (Int_t ev=countTEMP; ev<tsize; ev++){ |
453 |
|
454 |
if(ev==tsize-1 && i==4 && ii==cntpgtemp-1) countTEMP=tsize-1; |
455 |
if(xt[ev]<xt[ev-1] && ev>countTEMP){ |
456 |
if(i==4) countTEMP=ev; |
457 |
break; |
458 |
} |
459 |
else{ |
460 |
tempt_tmp[v]=(Double_t)((Int_t)(((3.3*tempt[ev][i]/4096)-0.586)/0.0231)); |
461 |
if(tempt_tmp[v]>100) { |
462 |
tempt_tmp[v]=28.5; |
463 |
tempt_tmpw[vv]=28.5; |
464 |
xt_tmpw[vv++]=(Double_t)xt[ev]; |
465 |
} |
466 |
else if(tempt_tmp[v]<0){ |
467 |
tempt_tmp[v]=25.5; |
468 |
tempt_tmpw[vv]=25.5; |
469 |
xt_tmpw[vv++]=(Double_t)xt[ev]; |
470 |
} |
471 |
xt_tmp[v++]=(Double_t)xt[ev]; |
472 |
} |
473 |
} |
474 |
TempCanv[ii]->cd(); |
475 |
tit<<"T"<<i+5<<" (magnetic module "<<i+1<<")"; |
476 |
pad6[i]->SetFillColor(10); |
477 |
pad6[i]->Draw(); |
478 |
pad6[i]->cd(); |
479 |
temp[i][ii]= new TGraph(v,xt_tmp,tempt_tmp); |
480 |
temp[i][ii]->SetTitle(tit.str().c_str()); |
481 |
if(v==1) temp[i][ii]->GetXaxis()->SetNdivisions(-501); |
482 |
temp[i][ii]->GetXaxis()->SetLabelSize(0.04); |
483 |
temp[i][ii]->GetXaxis()->SetTitleSize(0.04); |
484 |
temp[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
485 |
temp[i][ii]->GetXaxis()->CenterTitle(); |
486 |
temp[i][ii]->GetXaxis()->SetTitleOffset(0.85); |
487 |
temp[i][ii]->GetYaxis()->SetTitleOffset(1.2); |
488 |
temp[i][ii]->GetYaxis()->SetLabelOffset(0.001); |
489 |
temp[i][ii]->GetYaxis()->SetLabelSize(0.04); |
490 |
temp[i][ii]->GetYaxis()->SetTitleSize(0.04); |
491 |
temp[i][ii]->GetYaxis()->SetTitle("Temperatures ( ^{o}C)"); |
492 |
temp[i][ii]->GetYaxis()->CenterTitle(); |
493 |
temp[i][ii]->SetMarkerStyle(21); |
494 |
temp[i][ii]->SetMarkerSize(0.2); |
495 |
temp[i][ii]->Draw("ap"); |
496 |
tit.str(""); |
497 |
if(vv>0){ |
498 |
tempw[i][ii]= new TGraph(vv,xt_tmpw,tempt_tmpw); |
499 |
tempw[i][ii]->SetMarkerStyle(21); |
500 |
tempw[i][ii]->SetMarkerSize(0.2); |
501 |
tempw[i][ii]->SetMarkerColor(196); |
502 |
tempw[i][ii]->Draw("samep"); |
503 |
} |
504 |
TempCanv[ii]->Update(); |
505 |
|
506 |
|
507 |
} |
508 |
if(countTEMP==tsize-1 && ii==cntpgtemp-1){ |
509 |
break; |
510 |
} |
511 |
} |
512 |
|
513 |
// |
514 |
// Fill magnetic field graphs |
515 |
for(Int_t ii=0; ii<cntpgmag;ii++){ |
516 |
//**************************************************************************************** |
517 |
//Magnetic Field Output Pages |
518 |
//**************************************************************************************** |
519 |
fromfile.str(""); |
520 |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
521 |
isfile<<"Magnetic Axial Field vs OBT pag"<<ii+1; |
522 |
BfieldCanv[ii]=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
523 |
BfieldCanv[ii]->SetFillColor(10); |
524 |
BfieldCanv[ii]->Range(0,0,100,100); |
525 |
|
526 |
t->SetTextFont(32); |
527 |
t->SetTextColor(1); |
528 |
t->SetTextAlign(12); |
529 |
t->SetTextSize(0.02); |
530 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
531 |
t1->SetTextFont(32); |
532 |
t1->SetTextColor(1); |
533 |
t1->SetTextAlign(12); |
534 |
t1->SetTextSize(0.02); |
535 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
536 |
isfile.str(""); |
537 |
|
538 |
li.SetLineStyle(1); |
539 |
li.SetLineWidth(1); |
540 |
li.SetLineColor(190); |
541 |
t1->SetTextColor(190); |
542 |
t1->SetTextSize(0.04); |
543 |
|
544 |
Float_t tposy = 0.95; // up y-coord - top pads |
545 |
Float_t thpad = 0; // pad height |
546 |
Float_t tposx1=0; // left x-coord - pad column |
547 |
Float_t tposx0=0; // x-coord - column division |
548 |
Float_t twrel = 0; // relative x size of first sub-column |
549 |
Float_t tmarg = 0.004; // margin among pads |
550 |
|
551 |
thpad = (tposy-tmarg*5)/3; |
552 |
twrel = (1-tmarg*4)/2; |
553 |
|
554 |
for(Int_t i=0; i<5; i++){ |
555 |
if ( (i+1)%2==1 ) { |
556 |
if(i>1) tposy = tposy-(tmarg*2+thpad); |
557 |
tposx1 = tmarg; |
558 |
tposx0 = tposx1 + twrel; |
559 |
} |
560 |
else { |
561 |
tposx1 = tposx0 + 2*tmarg; |
562 |
tposx0 = tposx1 + twrel; |
563 |
} |
564 |
|
565 |
/* -----------> pad for histograms */ |
566 |
pad7[i] = new TPad("pad7"," ",tposx1,tposy-thpad,tposx0,tposy,18,0,0); |
567 |
|
568 |
Int_t v=0; |
569 |
Double_t xb_tmp[bsize], magt_tmp[bsize]; |
570 |
for (Int_t ev=countMAG; ev<bsize; ev++){ |
571 |
|
572 |
if(ev==bsize-1 && i==4 && ii==cntpgmag-1) countMAG=bsize-1; |
573 |
if(xb[ev]<xb[ev-1] && ev>countMAG){ |
574 |
if(i==4) countMAG=ev; |
575 |
break; |
576 |
} |
577 |
else{ |
578 |
magt_tmp[v]=(Double_t)magt[ev][i]; |
579 |
xb_tmp[v++]=(Double_t)xb[ev]; |
580 |
} |
581 |
} |
582 |
BfieldCanv[ii]->cd(); |
583 |
tit<<"B"<<i+5<<" (magnetic module "<<i+1<<")"; |
584 |
pad7[i]->SetFillColor(10); |
585 |
pad7[i]->Draw(); |
586 |
pad7[i]->cd(); |
587 |
mag[i][ii]= new TGraph(v,xb_tmp,magt_tmp); |
588 |
mag[i][ii]->SetTitle(tit.str().c_str()); |
589 |
if(v==1) mag[i][ii]->GetXaxis()->SetNdivisions(-501); |
590 |
mag[i][ii]->GetXaxis()->SetLabelSize(0.04); |
591 |
mag[i][ii]->GetXaxis()->SetTitleSize(0.04); |
592 |
mag[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
593 |
mag[i][ii]->GetXaxis()->CenterTitle(); |
594 |
mag[i][ii]->GetXaxis()->SetTitleOffset(0.85); |
595 |
if(i!=4) mag[i][ii]->GetYaxis()->SetRangeUser(2047,2058); |
596 |
else mag[i][ii]->GetYaxis()->SetRangeUser(2059,2067); |
597 |
mag[i][ii]->GetYaxis()->SetTitleOffset(1.2); |
598 |
mag[i][ii]->GetYaxis()->SetLabelOffset(0.001); |
599 |
mag[i][ii]->GetYaxis()->SetLabelSize(0.03); |
600 |
mag[i][ii]->GetYaxis()->SetTitleSize(0.04); |
601 |
mag[i][ii]->GetYaxis()->SetTitle("Magnetic Field (au)"); |
602 |
mag[i][ii]->GetYaxis()->CenterTitle(); |
603 |
mag[i][ii]->SetMarkerStyle(21); |
604 |
mag[i][ii]->SetMarkerSize(0.4); |
605 |
mag[i][ii]->Draw("ap"); |
606 |
Double_t min=0.,max=0,xlat=0.; |
607 |
min=mag[i][ii]->GetXaxis()->GetXmin(); |
608 |
max=mag[i][ii]->GetXaxis()->GetXmax(); |
609 |
xlat=min+(max-min)/2; |
610 |
stringstream mi,ma; |
611 |
mi<<"minimum recorded value"; |
612 |
ma<<"maximum recorded value"; |
613 |
t->SetTextSize(0.1); |
614 |
switch(i){ |
615 |
case 0: |
616 |
li.DrawLine(min,2054.,max,2054.); |
617 |
li.DrawLine(min,2048.,max,2048.); |
618 |
t1->DrawLatex(xlat,2054.3,ma.str().c_str()); |
619 |
t1->DrawLatex(xlat,2047.7,mi.str().c_str()); |
620 |
break; |
621 |
|
622 |
case 1: |
623 |
li.DrawLine(min,2055.,max,2055.); |
624 |
li.DrawLine(min,2049.,max,2049.); |
625 |
t1->DrawLatex(xlat,2055.3,ma.str().c_str()); |
626 |
t1->DrawLatex(xlat,2048.7,mi.str().c_str()); |
627 |
break; |
628 |
|
629 |
case 2: |
630 |
li.DrawLine(min,2056.,max,2056.); |
631 |
li.DrawLine(min,2050.,max,2050.); |
632 |
t1->DrawLatex(xlat,2056.3,ma.str().c_str()); |
633 |
t1->DrawLatex(xlat,2049.7,mi.str().c_str()); |
634 |
break; |
635 |
|
636 |
case 3: |
637 |
li.DrawLine(min,2057.,max,2057.); |
638 |
li.DrawLine(min,2051.,max,2051.); |
639 |
t1->DrawLatex(xlat,2057.3,ma.str().c_str()); |
640 |
t1->DrawLatex(xlat,2050.7,mi.str().c_str()); |
641 |
break; |
642 |
|
643 |
case 4: |
644 |
li.DrawLine(min,2066.,max,2066.); |
645 |
li.DrawLine(min,2060.,max,2060.); |
646 |
t1->DrawLatex(xlat,2066.2,ma.str().c_str()); |
647 |
t1->DrawLatex(xlat,2059.8,mi.str().c_str()); |
648 |
break; |
649 |
|
650 |
} |
651 |
BfieldCanv[ii]->Update(); |
652 |
tit.str(""); |
653 |
} |
654 |
if(countMAG==bsize-1 && ii==cntpgmag-1){ |
655 |
break; |
656 |
} |
657 |
} |
658 |
|
659 |
|
660 |
// |
661 |
// Fill compressiontime and eventnumber graphs and DSP warnings |
662 |
for(Int_t ii=0; ii<countnboot;ii++){ |
663 |
TPad *pt; //pad for histos |
664 |
|
665 |
//**************************************************************************************** |
666 |
//COMPRESSIONTIME vs. OBT Output Pages |
667 |
//**************************************************************************************** |
668 |
fromfile.str(""); |
669 |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
670 |
isfile<<"COMPRESSIONTIME vs. OBT pag"<<ii+1; |
671 |
CompTimeCanv[ii]=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
672 |
CompTimeCanv[ii]->SetFillColor(10); |
673 |
CompTimeCanv[ii]->Range(0,0,100,100); |
674 |
t->SetTextFont(32); |
675 |
t->SetTextColor(1); |
676 |
t->SetTextAlign(12); |
677 |
t->SetTextSize(0.02); |
678 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
679 |
t1->SetTextFont(32); |
680 |
t1->SetTextColor(1); |
681 |
t1->SetTextAlign(12); |
682 |
t1->SetTextSize(0.02); |
683 |
t1->DrawLatex(62.,98.7,isfile.str().c_str()); |
684 |
isfile.str(""); |
685 |
|
686 |
//**************************************************************************************** |
687 |
//DSP EVENT NUMBER Output Pages |
688 |
//**************************************************************************************** |
689 |
|
690 |
isfile<<"DSP EVENT NUMBER vs. OBT pag"<<ii+1; |
691 |
EventNumCanv[ii]=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
692 |
EventNumCanv[ii]->SetFillColor(10); |
693 |
EventNumCanv[ii]->Range(0,0,100,100); |
694 |
t->SetTextFont(32); |
695 |
t->SetTextColor(1); |
696 |
t->SetTextAlign(12); |
697 |
t->SetTextSize(0.02); |
698 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
699 |
t1->SetTextFont(32); |
700 |
t1->SetTextColor(1); |
701 |
t1->SetTextAlign(12); |
702 |
t1->SetTextSize(0.02); |
703 |
t1->DrawLatex(62.,98.7,isfile.str().c_str()); |
704 |
isfile.str(""); |
705 |
|
706 |
Float_t posy = 0.95; // up y-coord - top pads |
707 |
Float_t hpad = 0; // pad height |
708 |
Float_t posx1=0; // left x-coord - pad column |
709 |
Float_t posx0=0; // x-coord - column division |
710 |
Float_t wrel = 0; // relative x size of first sub-column |
711 |
Float_t marg = 0.004; // margin among pads |
712 |
|
713 |
hpad = (posy-marg*11)/6; |
714 |
wrel = (1-marg*4)/2; |
715 |
|
716 |
for(Int_t n = 0; n<12; n++) { |
717 |
|
718 |
if ( (n+1)%2==1 ) { |
719 |
if(n>1) posy = posy-(marg*2+hpad); |
720 |
posx1 = marg; |
721 |
posx0 = posx1 + wrel; |
722 |
} |
723 |
else { |
724 |
posx1 = posx0 + 2*marg; |
725 |
posx0 = posx1 + wrel; |
726 |
} |
727 |
|
728 |
/* -----------> pad for histograms */ |
729 |
pad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
730 |
pad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
731 |
pad3[n] = new TPad("pad3"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
732 |
pad4[n] = new TPad("pad4"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
733 |
pad5[n] = new TPad("pad5"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
734 |
} |
735 |
|
736 |
// |
737 |
// Obtain information about the tracker data |
738 |
// and fill graphs and histos |
739 |
|
740 |
Int_t al=0; |
741 |
ULong_t obtx=0; |
742 |
Double_t x[MAXSTORAGE]; |
743 |
Float_t yc[MAXSTORAGE][12]; |
744 |
Double_t eventint[MAXSTORAGE]; |
745 |
Int_t eventn[12]; |
746 |
|
747 |
for (Int_t ev=minev; ev<maxevent; ev++){ |
748 |
tr->GetEntry(ev); |
749 |
ph = eh->GetPscuHeader(); |
750 |
cod = eh->GetCounter(); |
751 |
|
752 |
|
753 |
if(ev==maxevent-1) maxev=maxevent-1; |
754 |
|
755 |
if(((ULong_t)ph->GetOrbitalTime()<x[ev-minev-1] && ev-minev!=0) || ev-minev==MAXSTORAGE){ |
756 |
maxev=ev; |
757 |
break; |
758 |
} |
759 |
else{ |
760 |
obtx = ph->GetOrbitalTime(); |
761 |
x[(ev-minev)]=(Double_t)obtx; |
762 |
ALARM=0; |
763 |
Int_t dsp=0; |
764 |
Int_t noacq=0; |
765 |
Int_t acq_dsp[12]; |
766 |
ULong_t acq_info_tmp=0; |
767 |
if(cod->Get(pctp->RunHeader)>0) acq_info_tmp=acq_info[cod->Get(pctp->RunHeader)-1]; |
768 |
else acq_info_tmp=acq_info[cod->Get(pctp->RunHeader)]; |
769 |
for(Int_t io=0;io<12;io++){ |
770 |
acq_dsp[dsp]=(acq_info_tmp>>(12+io))&(~(~0<<1)); |
771 |
if(((acq_info_tmp>>(12+io))&(~(~0<<1)))==0) |
772 |
noacq+=1; |
773 |
WARNING[io]=0; |
774 |
} |
775 |
|
776 |
for(Int_t i=0; i<12; i++){ |
777 |
|
778 |
if(i<12-noacq){ |
779 |
if(te->DSPnumber[i]<1 || te->DSPnumber[i]>12) { |
780 |
ALARM=1; |
781 |
break; |
782 |
} |
783 |
|
784 |
dsp=te->DSPnumber[i]-1; |
785 |
yc[(ev-minev)][dsp]= 0.051*te->compressiontime[i]; |
786 |
|
787 |
// |
788 |
// Fill Cluster Signal and Lighting of the view histos |
789 |
for(Int_t j=0;j<3;j++){ |
790 |
if(te->signcluster[i][j]!=0){ |
791 |
if((te->addrcluster[i][j]>6 && te->addrcluster[i][j]<505) ||(te->addrcluster[i][j]>518 && te->addrcluster[i][j]<1018)){ |
792 |
illuminazione[dsp]->Fill((Float_t)((j*1024.)+te->addrcluster[i][j])); |
793 |
} |
794 |
} |
795 |
} |
796 |
if(trk_cal_us[cod->Get(pctp->RunHeader)]!=104){ |
797 |
if(!(dsp%2)){ |
798 |
if(te->signcluster[i][0]!=0) landau1[dsp]->Fill((Float_t)(1024.-te->signcluster[i][0])); |
799 |
if(te->signcluster[i][1]!=0) landau2[dsp]->Fill((Float_t)(1024.-te->signcluster[i][1])); |
800 |
if(te->signcluster[i][2]!=0) landau3[dsp]->Fill((Float_t)(1024.-te->signcluster[i][2])); |
801 |
} |
802 |
else{ |
803 |
if(te->signcluster[i][0]!=0) landau1[dsp]->Fill((Float_t)te->signcluster[i][0]); |
804 |
if(te->signcluster[i][1]!=0) landau2[dsp]->Fill((Float_t)te->signcluster[i][1]); |
805 |
if(te->signcluster[i][2]!=0) landau3[dsp]->Fill((Float_t)te->signcluster[i][2]); |
806 |
} |
807 |
} |
808 |
|
809 |
WARNING[i]=0; |
810 |
if(te->fc[i]!=0){ |
811 |
if(countFC[dsp]==0){ |
812 |
ALARM = 1; //general alarm |
813 |
WARNING[i] = 1; // DSP warning |
814 |
} |
815 |
countFC[dsp]+=1; |
816 |
}; |
817 |
|
818 |
if(te->fl1[i]!=0){ |
819 |
if(countFL1[dsp]==0){ |
820 |
ALARM = 1; //general alarm |
821 |
WARNING[i] = 1; // DSP warning |
822 |
} |
823 |
countFL1[dsp]+=1; |
824 |
}; |
825 |
|
826 |
if(te->fl2[i]!=0){ |
827 |
if(countFL2[dsp]==0){ |
828 |
ALARM = 1; //general alarm |
829 |
WARNING[i] = 1; // DSP warning |
830 |
} |
831 |
countFL2[dsp]+=1; |
832 |
}; |
833 |
|
834 |
if(te->fl3[i]!=0){ |
835 |
if(countFL3[dsp]==0){ |
836 |
ALARM = 1; //general alarm |
837 |
WARNING[i] = 1; // DSP warning |
838 |
} |
839 |
countFL3[dsp]+=1; |
840 |
}; |
841 |
|
842 |
if(te->fl4[i]!=0){ |
843 |
if(countFL4[dsp]==0){ |
844 |
ALARM = 1; //general alarm |
845 |
WARNING[i] = 1; // DSP warning |
846 |
} |
847 |
countFL4[dsp]+=1; |
848 |
}; |
849 |
|
850 |
if(te->fl5[i]!=0){ |
851 |
if(countFL5[dsp]==0){ |
852 |
ALARM = 1; //general alarm |
853 |
WARNING[i] = 1; // DSP warning |
854 |
} |
855 |
countFL5[dsp]+=1; |
856 |
}; |
857 |
|
858 |
if(te->fl6[i]!=0){ |
859 |
if(countFL6[dsp]==0){ |
860 |
ALARM = 1; //general alarm |
861 |
WARNING[i] = 1; // DSP warning |
862 |
} |
863 |
countFL6[dsp]+=1; |
864 |
}; |
865 |
|
866 |
if(dsp%2==0 && te->alarm[i]!=0){ // hardware alarm |
867 |
if(countALARMy==0) |
868 |
ALARM = 1; |
869 |
countALARMy+=1; |
870 |
}; |
871 |
|
872 |
if(dsp%2==1 && te->alarm[i]!=0){ // hardware alarm |
873 |
if(countALARMx==0) |
874 |
ALARM = 1; |
875 |
countALARMx+=1; |
876 |
}; |
877 |
|
878 |
//************************************************************************************** |
879 |
// warning for internal number |
880 |
//************************************************************************************** |
881 |
if(ev==minev && i<=10 && te->eventn[i]!=te->eventn[i+1]) ALARM=1; |
882 |
if((ev-minev)>=1 && eventn[i]+1!=te->eventn[i] && te->eventn[i]!=1) ALARM=1; |
883 |
} |
884 |
} |
885 |
eventint[(ev-minev)]=te->eventn[0]; |
886 |
|
887 |
//******************************************************************************************** |
888 |
// file DSP warning |
889 |
//******************************************************************************************** |
890 |
|
891 |
if(ALARM==1) { |
892 |
al=1; |
893 |
alarm <<endl<< "================================================="<< endl; |
894 |
alarm << "PSCU-Pkt N. "<< ph->GetCounter() ; |
895 |
alarm << " - OBT "<< (ULong_t)ph->GetOrbitalTime() << " ms"<<endl; |
896 |
alarm << "Total events "<<nevent<<endl; |
897 |
alarm << "(ROOT-tree entry "<<ev<<" in page "<<ii+1<<" )"<<endl; |
898 |
alarm << "================================================="<< endl; |
899 |
|
900 |
alarm << " DSPn"; |
901 |
alarm << " Counter"; |
902 |
alarm << " previous"; |
903 |
alarm << " Words"; |
904 |
alarm << " crc"; |
905 |
alarm << " FC"; |
906 |
alarm << " FL1"; |
907 |
alarm << " FL2"; |
908 |
alarm << " FL3"; |
909 |
alarm << " FL4"; |
910 |
alarm << " FL5"; |
911 |
alarm << " FL6" << endl; |
912 |
|
913 |
for(Int_t i=0; i<12 ; i++){ |
914 |
alarm.width(5); alarm << te->DSPnumber[i]; |
915 |
alarm.width(8); alarm << te->eventn[i]; |
916 |
alarm.width(8); alarm << eventn[i]; |
917 |
alarm.width(6); alarm << te->DATAlength[i]; |
918 |
alarm.width(4); alarm << te->crc[i]; |
919 |
alarm.width(4); alarm << te->fc[i]; |
920 |
alarm.width(4); alarm << te->fl1[i]; |
921 |
alarm.width(4); alarm << te->fl2[i]; |
922 |
alarm.width(4); alarm << te->fl3[i]; |
923 |
alarm.width(4); alarm << te->fl4[i]; |
924 |
alarm.width(4); alarm << te->fl5[i]; |
925 |
alarm.width(4); alarm << te->fl6[i]; |
926 |
if(te->alarm[i]!=0)alarm<<" >> ALARM "; |
927 |
if(WARNING[i]!=0)alarm<<" (DSP warning) "; |
928 |
alarm << endl; |
929 |
} |
930 |
} |
931 |
for(Int_t i=0; i<12 ; i++) |
932 |
eventn[i]=te->eventn[i]; |
933 |
} |
934 |
} |
935 |
if(al==0) alarm << endl<< "Page "<<ii+1<< ": ------> NO ALARM!!! <-------"<<endl; |
936 |
if(maxev==maxevent-1) { |
937 |
if(countALARMy!=0){ |
938 |
if(countALARMy%6!=0) alarm << endl<<endl<< "***** "<<countALARMy/6+1 <<" events with hardware alarm in Y-view *****"<<endl; |
939 |
else alarm << endl<<endl<< "***** "<<countALARMy/6 <<" events with hardware alarm in Y-view *****"<<endl; |
940 |
} |
941 |
if(countALARMx!=0){ |
942 |
if(countALARMx%6!=0) alarm << endl<<endl<< "***** "<<countALARMx/6+1 <<" events with hardware alarm in X-view *****"<<endl; |
943 |
else alarm << endl<<endl<< "***** "<<countALARMx/6 <<" events with hardware alarm in X-view *****"<<endl; |
944 |
} |
945 |
for(int p=0; p<12; p++){ |
946 |
if(countFC[p]!=0) alarm << endl<<endl<< "***** "<<countFC[p] <<" events with fc!=0 in DSP "<<p+1<<" *****"<<endl; |
947 |
if(countFL1[p]!=0) alarm << endl<<endl<< "***** "<<countFL1[p] <<" events with fl1!=0 in DSP "<<p+1<<" *****"<<endl; |
948 |
if(countFL2[p]!=0) alarm << endl<<endl<< "***** "<<countFL2[p] <<" events with fl2!=0 in DSP "<<p+1<<" *****"<<endl; |
949 |
if(countFL3[p]!=0) alarm << endl<<endl<< "***** "<<countFL3[p] <<" events with fl3!=0 in DSP "<<p+1<<" *****"<<endl; |
950 |
if(countFL4[p]!=0) alarm << endl<<endl<< "***** "<<countFL4[p] <<" events with fl4!=0 in DSP "<<p+1<<" *****"<<endl; |
951 |
if(countFL5[p]!=0) alarm << endl<<endl<< "***** "<<countFL5[p] <<" events with fl5!=0 in DSP "<<p+1<<" *****"<<endl; |
952 |
if(countFL6[p]!=0) alarm << endl<<endl<< "***** "<<countFL6[p] <<" events with fl6!=0 in DSP "<<p+1<<" *****"<<endl; |
953 |
} |
954 |
} |
955 |
|
956 |
// |
957 |
// Draw the graphs |
958 |
for (Int_t i=0; i<12 ; i++){ |
959 |
Double_t yyc[maxev-minev]; |
960 |
for (Int_t v=0; v<maxev-minev; v++){ |
961 |
yyc[v]=yc[v][i]; |
962 |
} |
963 |
|
964 |
CompTimeCanv[ii]->cd(); |
965 |
pad3[i]->SetFillColor(10); |
966 |
pad3[i]->SetFrameFillColor(10); |
967 |
pad3[i]->Draw(); |
968 |
pad3[i]->cd(); |
969 |
comprtime[i][ii]= new TGraph(maxev-minev,x,yyc); |
970 |
oss1<<"DSP "<<i+1; |
971 |
comprtime[i][ii]->SetTitle(oss1.str().c_str()); |
972 |
comprtime[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
973 |
comprtime[i][ii]->GetXaxis()->CenterTitle(); |
974 |
comprtime[i][ii]->GetYaxis()->SetTitle("compressiontime (ms)"); |
975 |
comprtime[i][ii]->GetYaxis()->CenterTitle(); |
976 |
if(maxev-minev==1) comprtime[i][ii]->GetXaxis()->SetNdivisions(-501); |
977 |
// comprtime[i][ii]->GetYaxis()->SetRangeUser(0,3); |
978 |
comprtime[i][ii]->Draw("ap"); |
979 |
oss1.str(""); |
980 |
CompTimeCanv[ii]->Update(); |
981 |
} |
982 |
|
983 |
|
984 |
EventNumCanv[ii]->cd(); |
985 |
pt = new TPad("pt"," ",0.02,0.01,1.,0.98,18,0,0); |
986 |
pt->SetFillColor(10); |
987 |
pt->SetFrameFillColor(10); |
988 |
pt->Draw(); |
989 |
pt->cd(); |
990 |
eventnumb[ii]=new TGraph(maxev-minev,x,eventint); |
991 |
eventnumb[ii]->SetTitle(""); |
992 |
eventnumb[ii]->GetXaxis()->SetLabelSize(0.02); |
993 |
eventnumb[ii]->GetXaxis()->SetTitleSize(0.03); |
994 |
eventnumb[ii]->GetXaxis()->SetTitle("OBT (ms)"); |
995 |
eventnumb[ii]->GetXaxis()->CenterTitle(); |
996 |
eventnumb[ii]->GetXaxis()->SetTickLength(0.01); |
997 |
eventnumb[ii]->GetXaxis()->SetTitleOffset(1.1); |
998 |
eventnumb[ii]->GetYaxis()->SetLabelSize(0.02); |
999 |
eventnumb[ii]->GetYaxis()->SetTitleSize(0.03); |
1000 |
eventnumb[ii]->GetYaxis()->SetTitle("DSP event-number"); |
1001 |
eventnumb[ii]->GetYaxis()->CenterTitle(); |
1002 |
if(maxev-minev==1) eventnumb[ii]->GetXaxis()->SetNdivisions(-501); |
1003 |
eventnumb[ii]->GetYaxis()->SetTitleOffset(2.); |
1004 |
eventnumb[ii]->SetMarkerStyle(21); |
1005 |
eventnumb[ii]->SetMarkerColor(kBlue); |
1006 |
eventnumb[ii]->SetMarkerSize(0.2); |
1007 |
oss1.str(""); |
1008 |
oss1<<"number of events in this graph: "<<maxev-minev; |
1009 |
t->SetTextColor(kBlue); |
1010 |
t->SetTextSize(0.02); |
1011 |
double xtex=0,ytex=0; |
1012 |
xtex=x[maxev-minev-1]-(x[maxev-minev-1]-x[0])/3; |
1013 |
ytex=1000.+eventnumb[ii]->GetYaxis()->GetXmax(); |
1014 |
t->DrawLatex(xtex,ytex,oss1.str().c_str()); |
1015 |
oss1.str(""); |
1016 |
eventnumb[ii]->Draw("ap"); |
1017 |
EventNumCanv[ii]->Update(); |
1018 |
|
1019 |
minev=maxev; |
1020 |
if(maxev==maxevent-1) { |
1021 |
cntpgdat=ii+1; |
1022 |
break; |
1023 |
} |
1024 |
|
1025 |
} |
1026 |
|
1027 |
alarm.close(); |
1028 |
|
1029 |
//**************************************************************************************** |
1030 |
//Cluster Signal ladder1 Output Pages |
1031 |
//**************************************************************************************** |
1032 |
|
1033 |
fromfile.str(""); |
1034 |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
1035 |
isfile<<"Cluster Signal ladder1"; |
1036 |
LandauCanv1=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
1037 |
LandauCanv1->SetFillColor(10); |
1038 |
LandauCanv1->Range(0,0,100,100); |
1039 |
|
1040 |
t->SetTextFont(32); |
1041 |
t->SetTextColor(1); |
1042 |
t->SetTextAlign(12); |
1043 |
t->SetTextSize(0.02); |
1044 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
1045 |
t1->SetTextFont(32); |
1046 |
t1->SetTextColor(1); |
1047 |
t1->SetTextAlign(12); |
1048 |
t1->SetTextSize(0.02); |
1049 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
1050 |
isfile.str(""); |
1051 |
|
1052 |
//**************************************************************************************** |
1053 |
//Cluster Signal ladder2 Output Pages |
1054 |
//**************************************************************************************** |
1055 |
|
1056 |
isfile<<"Cluster Signal ladder2"; |
1057 |
LandauCanv2=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
1058 |
LandauCanv2->SetFillColor(10); |
1059 |
LandauCanv2->Range(0,0,100,100); |
1060 |
|
1061 |
t->SetTextFont(32); |
1062 |
t->SetTextColor(1); |
1063 |
t->SetTextAlign(12); |
1064 |
t->SetTextSize(0.02); |
1065 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
1066 |
t1->SetTextFont(32); |
1067 |
t1->SetTextColor(1); |
1068 |
t1->SetTextAlign(12); |
1069 |
t1->SetTextSize(0.02); |
1070 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
1071 |
isfile.str(""); |
1072 |
|
1073 |
//**************************************************************************************** |
1074 |
//Cluster Signal ladder3 Output Pages |
1075 |
//**************************************************************************************** |
1076 |
|
1077 |
isfile<<"Cluster Signal ladder3"; |
1078 |
LandauCanv3=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
1079 |
LandauCanv3->SetFillColor(10); |
1080 |
LandauCanv3->Range(0,0,100,100); |
1081 |
|
1082 |
t->SetTextFont(32); |
1083 |
t->SetTextColor(1); |
1084 |
t->SetTextAlign(12); |
1085 |
t->SetTextSize(0.02); |
1086 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
1087 |
t1->SetTextFont(32); |
1088 |
t1->SetTextColor(1); |
1089 |
t1->SetTextAlign(12); |
1090 |
t1->SetTextSize(0.02); |
1091 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
1092 |
isfile.str(""); |
1093 |
|
1094 |
//**************************************************************************************** |
1095 |
//Lighting of the views Output Pages |
1096 |
//**************************************************************************************** |
1097 |
|
1098 |
isfile<<"lighting of the views"; |
1099 |
IlluminaCanv=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
1100 |
IlluminaCanv->SetFillColor(10); |
1101 |
IlluminaCanv->Range(0,0,100,100); |
1102 |
t->SetTextFont(32); |
1103 |
t->SetTextColor(1); |
1104 |
t->SetTextAlign(12); |
1105 |
t->SetTextSize(0.02); |
1106 |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
1107 |
t1->SetTextFont(32); |
1108 |
t1->SetTextColor(1); |
1109 |
t1->SetTextAlign(12); |
1110 |
t1->SetTextSize(0.02); |
1111 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
1112 |
isfile.str(""); |
1113 |
|
1114 |
isfile<<"Boxes so colored point out chips broken before the launch and never resumed"; |
1115 |
t->SetTextColor(6); |
1116 |
t->SetTextSize(0.018); |
1117 |
t->DrawLatex(7.,97.2,isfile.str().c_str()); |
1118 |
isfile.str(""); |
1119 |
|
1120 |
isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)"; |
1121 |
t->SetTextColor(107); |
1122 |
t->DrawLatex(7.,95.7,isfile.str().c_str()); |
1123 |
isfile.str(""); |
1124 |
t->SetTextColor(1); |
1125 |
|
1126 |
// |
1127 |
// Draw the histos |
1128 |
for (Int_t i=0; i<12 ; i++){ |
1129 |
|
1130 |
TBox b; |
1131 |
|
1132 |
Float_t maxhist=0,va1x=0; |
1133 |
LandauCanv1->cd(); |
1134 |
pad1[i]->SetFillColor(10); |
1135 |
pad1[i]->SetFrameFillColor(10); |
1136 |
pad1[i]->Draw(); |
1137 |
pad1[i]->cd(); |
1138 |
landau1[i]->GetXaxis()->SetTitle("max signal"); |
1139 |
landau1[i]->GetXaxis()->CenterTitle(); |
1140 |
landau1[i]->Draw(""); |
1141 |
LandauCanv1->Update(); |
1142 |
|
1143 |
LandauCanv2->cd(); |
1144 |
pad4[i]->SetFillColor(10); |
1145 |
pad4[i]->SetFrameFillColor(10); |
1146 |
pad4[i]->Draw(); |
1147 |
pad4[i]->cd(); |
1148 |
landau2[i]->GetXaxis()->SetTitle("max signal"); |
1149 |
landau2[i]->GetXaxis()->CenterTitle(); |
1150 |
landau2[i]->Draw(""); |
1151 |
LandauCanv2->Update(); |
1152 |
|
1153 |
LandauCanv3->cd(); |
1154 |
pad5[i]->SetFillColor(10); |
1155 |
pad5[i]->SetFrameFillColor(10); |
1156 |
pad5[i]->Draw(); |
1157 |
pad5[i]->cd(); |
1158 |
landau3[i]->GetXaxis()->SetTitle("max signal"); |
1159 |
landau3[i]->GetXaxis()->CenterTitle(); |
1160 |
landau3[i]->Draw(""); |
1161 |
LandauCanv3->Update(); |
1162 |
|
1163 |
|
1164 |
li.SetLineColor(38); |
1165 |
li.SetLineStyle(4); |
1166 |
li.SetLineWidth(2); |
1167 |
liva1.SetLineColor(42); |
1168 |
liva1.SetLineStyle(3); |
1169 |
liva1.SetLineWidth(1); |
1170 |
|
1171 |
IlluminaCanv->cd(); |
1172 |
pad2[i]->SetFillColor(10); |
1173 |
pad2[i]->SetFrameFillColor(10); |
1174 |
pad2[i]->SetLogy(); |
1175 |
pad2[i]->Draw(); |
1176 |
pad2[i]->cd(); |
1177 |
illuminazione[i]->GetXaxis()->SetTitle("strip with max signal"); |
1178 |
illuminazione[i]->GetXaxis()->CenterTitle(); |
1179 |
illuminazione[i]->Draw(""); |
1180 |
maxhist= illuminazione[i]->GetMaximum(); |
1181 |
if(i==0){ |
1182 |
b.SetFillColor(107); |
1183 |
b.SetFillStyle(3954); |
1184 |
b.DrawBox(256.,0.,384.,maxhist); |
1185 |
b.DrawBox(768.,0.,2047.,maxhist); |
1186 |
} |
1187 |
else if(i==1){ |
1188 |
b.SetFillColor(6); |
1189 |
b.SetFillStyle(3945); |
1190 |
b.DrawBox(2944.,0.,3070.,maxhist); |
1191 |
|
1192 |
b.SetFillColor(107); |
1193 |
b.SetFillStyle(3954); |
1194 |
b.DrawBox(384.,0.,512.,maxhist); |
1195 |
b.DrawBox(896.,0.,1024.,maxhist); |
1196 |
b.DrawBox(2048.,0.,2432.,maxhist); |
1197 |
b.DrawBox(2816.,0.,2944.,maxhist); |
1198 |
} |
1199 |
else if(i==3){ |
1200 |
b.SetFillColor(107); |
1201 |
b.SetFillStyle(3954); |
1202 |
b.DrawBox(2816.,0.,3070.,maxhist); |
1203 |
} |
1204 |
else if(i==4){ |
1205 |
b.SetFillColor(107); |
1206 |
b.SetFillStyle(3954); |
1207 |
b.DrawBox(256.,0.,512.,maxhist); |
1208 |
b.DrawBox(2816.,0.,3070.,maxhist); |
1209 |
} |
1210 |
else if(i==5){ |
1211 |
b.SetFillColor(107); |
1212 |
b.SetFillStyle(3954); |
1213 |
b.DrawBox(896.,0.,1024.,maxhist); |
1214 |
// b.DrawBox(1664.,0.,1792.,maxhist); |
1215 |
} |
1216 |
else if(i==6){ |
1217 |
b.SetFillColor(107); |
1218 |
b.SetFillStyle(3954); |
1219 |
b.DrawBox(512.,0.,768.,maxhist); |
1220 |
b.DrawBox(1024.,0.,1280.,maxhist); |
1221 |
b.DrawBox(1280.,0.,1792.,maxhist); |
1222 |
b.DrawBox(2560.,0.,2816.,maxhist); |
1223 |
} |
1224 |
else if(i==7){ |
1225 |
b.SetFillColor(107); |
1226 |
b.SetFillStyle(3954); |
1227 |
b.DrawBox(512.,0.,768.,maxhist); |
1228 |
b.DrawBox(896.,0.,1535.,maxhist); |
1229 |
b.DrawBox(2024.,0.,2280.,maxhist); |
1230 |
} |
1231 |
else if(i==8){ |
1232 |
b.SetFillColor(107); |
1233 |
b.SetFillStyle(3954); |
1234 |
b.DrawBox(512.,0.,768.,maxhist); |
1235 |
} |
1236 |
else if(i==9){ |
1237 |
b.SetFillColor(107); |
1238 |
b.SetFillStyle(3954); |
1239 |
b.DrawBox(0.,0.,128.,maxhist); |
1240 |
b.DrawBox(256.,0.,384.,maxhist); |
1241 |
b.DrawBox(512.,0.,640.,maxhist); |
1242 |
b.DrawBox(896.,0.,1024.,maxhist); |
1243 |
b.DrawBox(1280.,0.,1535.,maxhist); |
1244 |
b.DrawBox(1664.,0.,1920.,maxhist); |
1245 |
} |
1246 |
else if(i==10){ |
1247 |
b.SetFillColor(107); |
1248 |
b.SetFillStyle(3954); |
1249 |
b.DrawBox(0.,0.,512.,maxhist); |
1250 |
b.DrawBox(1024.,0.,3070.,maxhist); |
1251 |
} |
1252 |
else if(i==11){ |
1253 |
b.SetFillColor(6); |
1254 |
b.SetFillStyle(3945); |
1255 |
b.DrawBox(768.,0.,1024.,maxhist); |
1256 |
|
1257 |
b.SetFillColor(107); |
1258 |
b.SetFillStyle(3954); |
1259 |
b.DrawBox(0.,0.,512.,maxhist); |
1260 |
b.DrawBox(1920.,0.,2560.,maxhist); |
1261 |
b.DrawBox(2816.,0.,3070.,maxhist); |
1262 |
} |
1263 |
for(int va=1; va<24; va++){ |
1264 |
va1x=128*va; |
1265 |
liva1.DrawLine(va1x,0.,va1x,maxhist); |
1266 |
} |
1267 |
li.DrawLine(1024.5,0,1024.5,maxhist); |
1268 |
li.DrawLine(2048.5,0,2048.5,maxhist); |
1269 |
IlluminaCanv->Update(); |
1270 |
} |
1271 |
|
1272 |
printf("... end of packets. \n"); |
1273 |
|
1274 |
//************************************************************************* |
1275 |
// Save output Files |
1276 |
//************************************************************************* |
1277 |
stringstream out1,out2,out3,command; |
1278 |
Int_t totpg=0; |
1279 |
if(cntpgtemp>cntpgdat) totpg=cntpgtemp; |
1280 |
else if(cntpgtemp<=cntpgdat) totpg=cntpgdat; |
1281 |
|
1282 |
for(Int_t fl=0;fl<totpg;fl++){ |
1283 |
|
1284 |
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
1285 |
out1.str(""); |
1286 |
out2.str(""); |
1287 |
out3.str(""); |
1288 |
|
1289 |
out1<<ffile<<"_FTrkQLook_EXPERT.ps("; |
1290 |
out2<<ffile<<"_FTrkQLook_EXPERT.ps"; |
1291 |
out3<<ffile<<"_FTrkQLook_EXPERT.ps)"; |
1292 |
|
1293 |
if(totpg==1){ |
1294 |
CompTimeCanv[fl]->Print(out+out1.str().c_str(),"Portrait"); |
1295 |
EventNumCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); |
1296 |
TempCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); |
1297 |
BfieldCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); |
1298 |
LandauCanv1->Print(out+out2.str().c_str(),"Portrait"); |
1299 |
LandauCanv2->Print(out+out2.str().c_str(),"Portrait"); |
1300 |
LandauCanv3->Print(out+out2.str().c_str(),"Portrait"); |
1301 |
IlluminaCanv->Print(out+out3.str().c_str(),"Portrait"); |
1302 |
} |
1303 |
else if(totpg>1){ |
1304 |
if(fl==0) CompTimeCanv[fl]->Print(out+out1.str().c_str(),"Portrait"); |
1305 |
if(fl>0 && fl<cntpgdat) CompTimeCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); |
1306 |
if(fl<cntpgdat) EventNumCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); |
1307 |
if(fl<cntpgmag) BfieldCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); |
1308 |
if(fl<cntpgtemp) TempCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); |
1309 |
if(fl==totpg-1){ |
1310 |
LandauCanv1->Print(out+out2.str().c_str(),"Portrait"); |
1311 |
LandauCanv2->Print(out+out2.str().c_str(),"Portrait"); |
1312 |
LandauCanv3->Print(out+out2.str().c_str(),"Portrait"); |
1313 |
IlluminaCanv->Print(out+out3.str().c_str(),"Portrait"); |
1314 |
} |
1315 |
} |
1316 |
} |
1317 |
else{ |
1318 |
out1.str(""); |
1319 |
out1<<ffile<<"_FTrkQLook_EXPERT-CompTime-pag"<<fl+1<<"."<<outfile.Data(); |
1320 |
if(fl<cntpgdat) CompTimeCanv[fl]->Print(out+out1.str().c_str()); |
1321 |
out1.str(""); |
1322 |
out1<<ffile<<"_FTrkQLook_EXPERT-BField-pag"<<fl+1<<"."<<outfile.Data(); |
1323 |
if(fl<cntpgmag) BfieldCanv[fl]->Print(out+out1.str().c_str()); |
1324 |
out1.str(""); |
1325 |
out1<<ffile<<"_FTrkQLook_EXPERT-Temp-pag"<<fl+1<<"."<<outfile.Data(); |
1326 |
if(fl<cntpgtemp) TempCanv[fl]->Print(out+out1.str().c_str()); |
1327 |
out1.str(""); |
1328 |
out1<<ffile<<"_FTrkQLook_EXPERT-EvNum-pag"<<fl+1<<"."<<outfile.Data(); |
1329 |
if(fl<cntpgdat) EventNumCanv[fl]->Print(out+out1.str().c_str()); |
1330 |
if(fl==totpg-1){ |
1331 |
out1.str(""); |
1332 |
out1<<ffile<<"_FTrkQLook_EXPERT-LandauL1."<<outfile.Data(); |
1333 |
LandauCanv1->Print(out+out1.str().c_str()); |
1334 |
out1.str(""); |
1335 |
out1<<ffile<<"_FTrkQLook_EXPERT-LandauL2."<<outfile.Data(); |
1336 |
LandauCanv2->Print(out+out1.str().c_str()); |
1337 |
out1.str(""); |
1338 |
out1<<ffile<<"_FTrkQLook_EXPERT-LandauL3."<<outfile.Data(); |
1339 |
LandauCanv3->Print(out+out1.str().c_str()); |
1340 |
out1.str(""); |
1341 |
out1<<ffile<<"_FTrkQLook_EXPERT-Lighting."<<outfile.Data(); |
1342 |
IlluminaCanv->Print(out+out1.str().c_str()); |
1343 |
} |
1344 |
} |
1345 |
} |
1346 |
|
1347 |
// |
1348 |
// Convert ps to pdf if required |
1349 |
if(!strcmp(outfile.Data(),"pdf")){ |
1350 |
stringstream com; |
1351 |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_EXPERT.ps "<<out<<ffile<<"_FTrkQLook_EXPERT.pdf"; |
1352 |
system(com.str().c_str()); |
1353 |
printf("\n---> ps file converted in pdf format!\n"); |
1354 |
com.str(""); |
1355 |
com<<"rm -f "<<out<<ffile<<"_FTrkQLook_EXPERT.ps "; |
1356 |
system(com.str().c_str()); |
1357 |
printf("---> ps file removed!\n\n"); |
1358 |
com.str(""); |
1359 |
} |
1360 |
|
1361 |
gROOT->Reset(); |
1362 |
return; |
1363 |
} |