/[PAMELA software]/quicklook/tracker/flight/macros/FTrkQLook_EXPERT.cxx
ViewVC logotype

Contents of /quicklook/tracker/flight/macros/FTrkQLook_EXPERT.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download)
Thu Jul 20 11:09:33 2006 UTC (18 years, 4 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r07
Changes since 1.10: +11 -8 lines
v1r07

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

  ViewVC Help
Powered by ViewVC 1.1.23