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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.23