/[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.1 - (show annotations) (download)
Wed May 10 10:06:55 2006 UTC (18 years, 6 months ago) by pam-fi
Branch: MAIN
CVS Tags: R2v00
.cpp files of utilities removed, quicklook macros added

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

  ViewVC Help
Powered by ViewVC 1.1.23