/[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.8 - (show annotations) (download)
Thu Jun 29 11:11:59 2006 UTC (18 years, 5 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r04
Changes since 1.7: +32 -76 lines
new release tagged v1r04

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

  ViewVC Help
Powered by ViewVC 1.1.23