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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (hide annotations) (download)
Mon Sep 18 15:01:56 2006 UTC (18 years, 2 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r13, v1r12
Changes since 1.16: +14 -3 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.23