/[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.33 - (hide annotations) (download)
Mon Jul 30 14:23:02 2007 UTC (17 years, 4 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r31
Changes since 1.32: +28 -14 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.23