/[PAMELA software]/quicklook/tracker/flight/src/TrkQLook_EXPERT.cpp
ViewVC logotype

Annotation of /quicklook/tracker/flight/src/TrkQLook_EXPERT.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Tue Mar 21 15:54:06 2006 UTC (18 years, 8 months ago) by pam-fi
Branch: MAIN
Changes since 1.1: +1 -1 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.23