/[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.36 - (hide annotations) (download)
Fri Jan 17 15:10:40 2014 UTC (10 years, 10 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.35: +6 -2 lines
Compilation warnings using GCC4.7 fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23