/[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.12 - (hide annotations) (download)
Fri Aug 11 10:24:09 2006 UTC (18 years, 4 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r08
Changes since 1.11: +268 -21 lines
release v1r08

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

  ViewVC Help
Powered by ViewVC 1.1.23