/[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.31 - (hide annotations) (download)
Thu Mar 8 01:41:02 2007 UTC (17 years, 9 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r29
Changes since 1.30: +14 -14 lines
obt bug fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23