mcr/hdt_read/DefaultHistos.C

00001 
00002 // First version (with lots of histograms)
00003 //  of the FINUDA run-summary histograms production
00004 // Date:   September 2006
00005 // Author: Piergiorgio Cerello
00006 
00007 #include "TH2.h"
00008 #include "TCanvas.h"
00009 #include "TPDF.h"
00010 #include "TFile.h"
00011 #include "TApplication.h"
00012 #include "TTree.h"
00013 #include "TDatime.h"
00014 #include "TLegend.h"
00015 #include "TStyle.h"
00016 
00017 #include "TFndGenInfo.h"
00018 #include "TFndHdt.h"
00019 #include "Gui.h"
00020 
00021 using namespace FROOT;
00022 //using namespace FROOT;
00023 
00024 // Load Library for the PDF/PS management
00025 
00026 Int_t fVerboseLev = 0;
00027 
00028 //gSystem->Load("libPostscript.so");
00029 TLegend *leg[30];
00030 // Gts Histos
00031 
00032 TH1F *fHPU_cont[K_N_GTS_P_UNITS]; //-> Pattern Units histograms
00033 TH1F *fHPU_mult[K_N_GTS_P_UNITS]; //-> Pattern Units histograms
00034 TH1F *fHTrigSel[K_N_GTS_SELECTORS]; //-> Pattern Units histograms
00035 
00036 // Tof Histos
00037 
00038 TH2F *fH_Tof_i_o_mult;
00039 TH1F *fH_Tof_map[2]; 
00040 
00041 TH1F *fH_Tofi_High_mult; // multiplicity on high thresholds
00042 TH1F *fH_Tofi_High_map; // pattern on high thresholds
00043 
00044 TH1F *fH_Tof_map_ae[2];
00045 TH1F *fH_Tof_map_ap[2];
00046 TH1F *fH_Tof_map_te[2];
00047 TH1F *fH_Tof_map_tp[2];
00048 TH1F *fH_Tof_map_mt[2]; 
00049 TH1F *fH_Tof_TotAdc[2][K_N_TOFONE_SLABS+1];
00050 TH1F *fH_Tof_AvgTdc[2][K_N_TOFONE_SLABS+1];
00051 
00052 // Sil Histos
00053 //    pattern filled with number of clusters/module/event
00054 TH1F *fH_Sil_Patt_Clust_Low[2]; // [ISIM,OSIM] under threshold (MIP)
00055 TH1F *fH_Sil_Patt_Clust_High[2]; // [ISIM,OSIM] over threshold (PROTON/KAON)
00056 
00057 // Lmd Histos
00058 
00059 TH2F *fH_Lmd_i_o_mult;
00060 TH1F *fH_Lmd_tot_mult;
00061 TH2F *fH_Lmd_map[2]; 
00062 TH2F *fH_Lmd_map_ae[2];
00063 TH2F *fH_Lmd_map_ap[2];
00064 TH2F *fH_Lmd_map_te[2];
00065 TH2F *fH_Lmd_map_tp[2];
00066 TH1F *fH_Lmd_TotAdc[2][K_N_LMD_CHAMS_PER_LAYER+1];
00067 TH1F *fH_Lmd_AvgTdc[2][K_N_LMD_CHAMS_PER_LAYER+1];
00068 
00069 // Stb Histos
00070 
00071 TH1F *fH_Stb_mult;
00072 TH1F *fH_Stb_map[K_N_STB_CROWNS]; 
00073 TH1F *fH_Stb_Tdc[K_N_STB_CROWNS];
00074 
00075 TFile *fHdtFile = 0;
00076 
00077 TFndHdt *fCurHdtEv = 0;
00078 TTree *fHdtTree = 0;
00079 
00080 TString fCanvTit = 0;
00081 TString fCurRunName = 0;
00082 
00083 TFndGenInfo *fRunInfo = 0;
00084 
00085 void DeclareGtsHistos(){
00086 
00087   TString hname;
00088   TString htitle;
00089   for(Int_t i=0;i < K_N_GTS_P_UNITS ; i++){
00090     hname.Form("GtsHist_PU_cont_%d",i+1);
00091     htitle.Form("Pattern Unit %d (bits content)",i+1);
00092     fHPU_cont[i] = new TH1F(hname,htitle,17,-0.5,16.5);
00093     hname.Form("GtsHist_PU_mult_%d",i+1);
00094     htitle.Form("Pattern Unit %d (multiplicity)",i+1);
00095     fHPU_mult[i] = new TH1F(hname,htitle,16,-0.5,15.5);
00096   }
00097   
00098   for(Int_t i=0;i < K_N_GTS_SELECTORS ; i++){
00099     hname.Form("GtsHist_TrigSel_%d",i+1);
00100     htitle.Form("Trigger Selector %d",i+1);
00101     fHTrigSel[i] = new TH1F(hname,htitle,16,-0.5,15.5);
00102   }
00103 }
00104 
00105 void DeclareTofHistos(){
00106 
00107   fH_Tof_i_o_mult = new TH2F("tof_i_o_mult","Tof inner vs outer mult.",74,-0.5,73.5,14,-0.5,13.5);
00108 
00109   fH_Tof_map[0] = new TH1F("tof_i_map","Inner Tof Hit Map - full hits",14,-0.5,13.5);   
00110   fH_Tof_map[1] = new TH1F("tof_o_map","Outer Tof Hit Map - full hits",74,-0.5,73.5);   
00111 
00112   // --- 
00113   fH_Tofi_High_mult = new TH1F("TOFINO_MT_H_mul","TOFINO hi-MT-mult.",14,-0.5,13.5);
00114   fH_Tofi_High_map = new TH1F("TOFINO_MT_H_map","TOFINO hi-MT-patt.",14,-0.5,13.5);
00115 
00116   fH_Tof_map_mt[0] = new TH1F("tof_i_mt_map","Inner Tof Mean Timer pattern",14,-0.5,13.5);   
00117   fH_Tof_map_mt[1] = new TH1F("tof_o_mt_map","Outer Tof Mean Timer pattern",74,-0.5,73.5);   
00118 
00119   fH_Tof_map_ae[0] = new TH1F("tof_i_map_ae","Inner Tof Hit Map - ADC e-side",14,-0.5,13.5);
00120   fH_Tof_map_ae[1] = new TH1F("tof_o_map_ae","Outer Tof Hit Map - ADC e-side",74,-0.5,73.5);
00121 
00122   fH_Tof_map_ap[0] = new TH1F("tof_i_map_ap","Inner Tof Hit Map - ADC p-side",14,-0.5,13.5);
00123   fH_Tof_map_ap[1] = new TH1F("tof_o_map_ap","Outer Tof Hit Map - ADC p-side",74,-0.5,73.5);
00124    
00125   fH_Tof_map_te[0] = new TH1F("tof_i_map_te","Inner Tof Hit Map - TDC e-side",14,-0.5,13.5);
00126   fH_Tof_map_te[1] = new TH1F("tof_o_map_te","Outer Tof Hit Map - TDC e-side",74,-0.5,73.5);
00127 
00128   fH_Tof_map_tp[0] = new TH1F("tof_i_map_tp","Inner Tof Hit Map - TDC p-side",14,-0.5,13.5);
00129   fH_Tof_map_tp[1] = new TH1F("tof_o_map_tp","Outer Tof Hit Map - TDC p-side",74,-0.5,73.5);
00130 
00131   TString hname;
00132   TString htitle;
00133 
00134   for(Int_t lay=0;lay<2;lay++ ){
00135         for(Int_t ch=0;ch<12+60*lay;ch++ ){
00136           hname.Form("fH_Tof_TotAdc_%d_%d",lay+1,ch+1);
00137           htitle.Form("Tof Adc sqrt(e*p) lay: %d, slab: %d",lay+1,ch+1);
00138           fH_Tof_TotAdc[lay][ch] = new TH1F(hname,htitle,105,0,4200);
00139           hname.Form("fH_Tof_AvgTdc_%d_%d",lay+1,ch+1);
00140           htitle.Form("Tof Tdc (e+p)/2 lay: %d, slab: %d",lay+1,ch+1);
00141           fH_Tof_AvgTdc[lay][ch] = new TH1F(hname,htitle,105,0,4200);
00142           //Printf("Out name: \"%s\"",hname.Data());
00143     }
00144         Int_t idx = 12;
00145         if(lay == 1) idx = 72;
00146         hname.Form("fH_Tof_TotAdc_%d",lay+1);
00147     htitle.Form("Tof Adc sqrt(e*p) layer: %d, all slabs",lay+1);
00148         fH_Tof_TotAdc[lay][idx] = new TH1F(hname,htitle,105,0,4200);
00149         hname.Form("fH_Tof_AvgTdc_%d",lay+1);
00150         htitle.Form("Tof Tdc (e+p)/2 layer: %d, all slabs",lay+1);
00151         fH_Tof_AvgTdc[lay][idx] = new TH1F(hname,htitle,105,0,4200);
00152   }
00153 
00154 }
00155 
00156 void DeclareSilHistos(){
00157 
00158   fH_Sil_Patt_Clust_Low[0]  = new TH1F("ISIM_PATT_Low" ,"ISIM PATT Low",10,-0.5,9.5);
00159   fH_Sil_Patt_Clust_High[0] = new TH1F("ISIM_PATT_High","ISIM PATT High",10,-0.5,9.5);
00160 
00161   fH_Sil_Patt_Clust_Low[1]  = new TH1F("OSIM_PATT_Low" ,"OSIM PATT Low",10,-0.5,9.5);
00162   fH_Sil_Patt_Clust_High[1] = new TH1F("OSIM_PATT_High","OSIM PATT High",10,-0.5,9.5);
00163 
00164 }
00165 
00166 void DeclareLmdHistos(){
00167 
00168   fH_Lmd_i_o_mult = new TH2F("lmd_i_o_mult","Lmd inner vs outer mult.",10,-0.5,9.5,10,-0.5,9.5);
00169   fH_Lmd_tot_mult = new TH1F("lmd_tot_mult","Lmd total multiplicity",30,-0.5,29.5);
00170 
00171   fH_Lmd_map[0] = new TH2F("lmd_i_map","Inner Lmd Hit Map (Wire vs Drift Number) - full hits",9,-0.5,9.5,14,-0.5,13.5);   
00172   fH_Lmd_map[1] = new TH2F("lmd_o_map","Outer Lmd Hit Map (Wire vs Drift Number) - full hits",9,-0.5,9.5,24,-0.5,23.5);   
00173 
00174   fH_Lmd_map_ae[0] = new TH2F("lmd_i_map_ae","Inner Lmd Hit Map (Wire vs Drift Number) - ADC e-side",
00175                               10,-0.5,9.5,14,-0.5,13.5);   
00176   fH_Lmd_map_ae[1] = new TH2F("lmd_o_map_ae","Outer Lmd Hit Map (Wire vs Drift Number) - ADC e-side",
00177                               10,-0.5,9.5,24,-0.5,23.5);
00178 
00179   fH_Lmd_map_ap[0] = new TH2F("lmd_i_map_ap","Inner Lmd Hit Map (Wire vs Drift Number) - ADC p-side",
00180                               10,-0.5,9.5,14,-0.5,13.5);   
00181   fH_Lmd_map_ap[1] = new TH2F("lmd_o_map_ap","Outer Lmd Hit Map (Wire vs Drift Number) - ADC p-side",
00182                               10,-0.5,9.5,24,-0.5,23.5);
00183    
00184   fH_Lmd_map_te[0] = new TH2F("lmd_i_map_te","Inner Lmd Hit Map (Wire vs Drift Number) - TDC e-side",
00185                               10,-0.5,9.5,14,-0.5,13.5);   
00186   fH_Lmd_map_te[1] = new TH2F("lmd_o_map_te","Outer Lmd Hit Map (Wire vs Drift Number) - TDC e-side",
00187                               10,-0.5,9.5,24,-0.5,23.5);
00188 
00189   fH_Lmd_map_tp[0] = new TH2F("lmd_i_map_tp","Inner Lmd Hit Map (Wire vs Drift Number) - TDC p-side",
00190                               10,-0.5,9.5,14,-0.5,13.5);   
00191   fH_Lmd_map_tp[1] = new TH2F("lmd_o_map_tp","Outer Lmd Hit Map (Wire vs Drift Number) - TDC p-side",
00192                               10,-0.5,9.5,24,-0.5,23.5);
00193 
00194   TString hname;
00195   TString htitle;
00196 
00197   Int_t idx = 8;
00198   for(Int_t lay=0;lay<2;lay++ ){
00199         for(Int_t ch=0;ch<K_N_LMD_CHAMS_PER_LAYER;ch++ ){
00200           hname.Form("fH_Lmd_TotAdc_%d_%d",lay+1,ch+1);
00201           htitle.Form("Lmd Adc (e+p) lay: %d, ch: %d",lay+1,ch+1);
00202           fH_Lmd_TotAdc[lay][ch] = new TH1F(hname,htitle,210,0,8400);
00203           hname.Form("fH_Lmd_AvgTdc_%d_%d",lay+1,ch+1);
00204           htitle.Form("Lmd Tdc (e+p)/2 lay: %d, ch: %d",lay+1,ch+1);
00205           fH_Lmd_AvgTdc[lay][ch] = new TH1F(hname,htitle,105,0,4200);
00206           //Printf("Out name: \"%s\"",hname.Data());
00207     }
00208         hname.Form("fH_Lmd_TotAdc_%d",lay+1);
00209         htitle.Form("Lmd Adc (e+p) layer: %d all wires",lay+1);
00210         fH_Lmd_TotAdc[lay][idx] = new TH1F(hname,htitle,210,0,8400);
00211         hname.Form("fH_Lmd_AvgTdc_%d",lay+1);
00212         htitle.Form("Lmd Tdc (e+p)/2 layer: %d all wires",lay+1);
00213         fH_Lmd_AvgTdc[lay][idx] = new TH1F(hname,htitle,105,0,4200);
00214   }
00215 }
00216 
00217 void DeclareStbHistos(){
00218 
00219   fH_Stb_mult = new TH1F("stb_mult","Stb multiplicity",101,-0.5,100.5);
00220   TString hname;
00221   TString htitle;
00222 
00223   for(Int_t ch=0;ch<K_N_STB_CROWNS;ch++ ){
00224         hname.Form("stb_map_%d",ch+1);
00225         htitle.Form("Stb Crown %d pattern",ch+1);
00226         fH_Stb_map[ch] = new TH1F(hname,htitle,K_N_STB_TUBES+2,-0.5,(Float_t) K_N_STB_TUBES+1.5); 
00227         hname.Form("Stb_Tdc_Crown_%d",ch+1);
00228         htitle.Form("Stb Crown %d Tdc distribution",ch+1);
00229         fH_Stb_Tdc[ch] = new TH1F(hname,htitle,660,0.,1980.);
00230   }
00231 }
00232 
00233 void DeclareHistos(){
00234         DeclareGtsHistos();
00235         DeclareTofHistos();
00236         DeclareSilHistos();
00237         DeclareLmdHistos();
00238         DeclareStbHistos();
00239 }
00240 
00241 Int_t OpenHdtFile(const TString &runname){
00242   // return value:
00243   //              0: ok
00244   //             -1: file not found
00245 
00246   if(fHdtFile){
00247     if(fHdtFile->IsOpen()) fHdtFile->Close();
00248     delete fHdtFile;
00249     fHdtFile = 0;
00250   }
00251 
00252   TString fnam;
00253   fnam.Form("%s/%s.hdt.root",ExpandPathName("$FND_HDT").Data(),runname.Data());
00254   
00255   if(gSystem->AccessPathName(fnam)){
00256     gROOT->Warning("OpenHdtFile","file \"%s\" not found",fnam.Data());
00257     return -1;
00258   }
00259 
00260   if(fVerboseLev > 1) gROOT->Info("OpenHdtFile","opening file \"%s\"",fnam.Data());
00261   fHdtFile = new TFile(fnam,"OPEN");
00262   fRunInfo = (TFndGenInfo *) fHdtFile->Get("TFndGenInfo");
00263 
00264   return 0;
00265 }
00266 
00267 
00268 Int_t LoadHdtTree(){
00269   // return value:
00270   //              0: ok
00271   //             -1: Problems while getting HDT tree from file
00272   
00273   
00274   fHdtTree = (TTree *) ( fHdtFile->Get("FIN_HDT_TREE") );
00275   if(!fHdtTree){
00276     gROOT->Warning("LoadHdtTree","Problems while getting HDT tree from file");
00277     return -1;
00278   }
00279   if(fVerboseLev > 1) fHdtTree->Print();
00280 
00281   fHdtTree->SetBranchAddress("fndhdt",&fCurHdtEv);
00282   return 0;
00283 }
00284 
00285 
00286 void FillGtsHistos(){
00287 
00288   TFndTrig *fTrig = fCurHdtEv->GetGts();
00289   Int_t pu_mult[K_N_GTS_P_UNITS] = {0};
00290   for(Int_t i=0;i < K_N_GTS_P_UNITS ; i++){
00291     for(Int_t bit=0;bit<16;bit++){
00292       Short_t content = fTrig->GetPU_cont_bit(i,bit);
00293       fHPU_cont[i]->Fill(bit+1,content);
00294       if(content > 0) pu_mult[i]++;
00295     }
00296     fHPU_mult[i]->Fill(pu_mult[i]);
00297   }
00298   // ---
00299   for(Int_t i=0;i < K_N_GTS_SELECTORS ; i++){
00300     for(Int_t bit=0;bit<16;bit++) fHTrigSel[i]->Fill(bit,fTrig->GetTriggerSelector_bit(i,bit));
00301   }  
00302 }
00303 
00304 void FillTofHistos(){
00305 
00306   TClonesArray *TofHits = fCurHdtEv->GetTofHits();
00307 
00308   Int_t lay, slab;
00309   TFndHTof *cur_hit = 0;
00310   Int_t i_mult = 0;
00311   Int_t i_high_mult = 0;
00312   Int_t o_mult = 0;
00313   //cout << TofHits->GetEntries() << " tof hits" << endl;
00314   for(Int_t ic=0;ic< TofHits->GetEntries(); ic++) {
00315     cur_hit =  (TFndHTof *) ( TofHits->At(ic) );
00316     //cur_hit->PrintHit();
00317     cur_hit->GetLayer_Slab(lay,slab);
00318         //Printf("%d %d",lay, slab);
00319     //Printf("");
00320         Int_t ae = cur_hit->GetAdcE();
00321         Int_t ap = cur_hit->GetAdcP();
00322         Int_t te = cur_hit->GetTdcE();
00323         Int_t tp = cur_hit->GetTdcP();
00324         Int_t tm = cur_hit->GetMeanTimer();
00325         Int_t tm_high = cur_hit->GetHighMeanTimer();
00326         Bool_t fullHit = kTRUE;
00327         if(ae==-1 || ap==-1 || te==-1 || tp==-1) fullHit = 0;
00328 
00329         if(tm >= 0 && lay == 1) i_mult++;
00330         if(tm_high >= 0 && lay == 1) i_high_mult++;
00331         else if(tm >= 0 && lay == 2) o_mult++;
00332 
00333         if(fullHit) fH_Tof_map[lay-1]->Fill(slab);
00334         if(ae>=0) fH_Tof_map_ae[lay-1]->Fill(slab); 
00335         if(ap>=0) fH_Tof_map_ap[lay-1]->Fill(slab); 
00336         if(te>=0) fH_Tof_map_te[lay-1]->Fill(slab); 
00337         if(tp>=0) fH_Tof_map_tp[lay-1]->Fill(slab);   
00338         if(tm>=0) fH_Tof_map_mt[lay-1]->Fill(slab);
00339         if(tm_high >= 0 && lay == 1) fH_Tofi_High_map->Fill(slab);
00340 
00341         fH_Tof_TotAdc[lay-1][slab-1]->Fill(TMath::Sqrt(ae*ap));
00342         fH_Tof_AvgTdc[lay-1][slab-1]->Fill(0.5*(te+tp));
00343         Int_t idx = 12;
00344         if(slab > 12) idx = 72;
00345         fH_Tof_TotAdc[lay-1][idx]->Fill(TMath::Sqrt(ae*ap));
00346         fH_Tof_AvgTdc[lay-1][idx]->Fill(0.5*(te+tp));
00347   }   
00348   fH_Tof_i_o_mult->Fill(o_mult,i_mult);
00349   fH_Tofi_High_mult->Fill(i_high_mult);
00350 }
00351 
00352 void FillSilHistos(){
00353 
00354   TClonesArray *SilClus = fCurHdtEv->GetSilClusters();
00355   if(!SilClus) return;
00356   TFndHSilCluster *cur_clus = 0;
00357   Int_t n_clusts = (Int_t)SilClus->GetEntries();
00358   //  cout << "n_clusts: " << n_clusts << endl;
00359 
00360   for(Int_t ic=0;ic< n_clusts; ic++) {
00361     cur_clus = (TFndHSilCluster *) ( SilClus->At(ic) );
00362     if(!cur_clus) return;
00363     //    cur_clus->PrintHit();
00364     Int_t slay = cur_clus->GetLayer();
00365     Int_t smod = cur_clus->GetModNum();
00366     // --- check
00367     if(slay < 1 || slay > 2){
00368       cout << " ************* ERROR: FillSilHistos(): slay = " << slay << endl;
00369       return;
00370     }
00371     if(slay == 1 && (smod < 1 || smod > 8) ){
00372       cout << " ************* ERROR: FillSilHistos(): slay = " << slay << "; mod = " << smod << endl;
00373       return;      
00374     }
00375     if(slay == 2 && (smod < 1 || smod > 10) ){
00376       cout << " ************* ERROR: FillSilHistos(): slay = " << slay << "; mod = " << smod << endl;
00377       return;      
00378     }
00379        // ---
00380 
00381     // add energy selection
00382     Bool_t is_over_threshold = kTRUE; // GET IT FROM THE CLUSTER
00383     //    if(is_over_threshold)
00384       fH_Sil_Patt_Clust_High[slay-1]->Fill(smod);
00385     //    else
00386       fH_Sil_Patt_Clust_Low[slay-1]->Fill(smod);
00387 
00388   }// hits loop end
00389 
00390 }
00391 
00392 void FillLmdHistos(){
00393   
00394   TClonesArray *LmdHits = fCurHdtEv->GetLmdHits();
00395 
00396   Int_t lay, cham, wire;
00397   TFndHLmd *cur_hit = 0;
00398   Int_t i_mult = 0;
00399   Int_t o_mult = 0;
00400   Int_t idx = 8;
00401   for(Int_t ic=0;ic< LmdHits->GetEntries(); ic++) {
00402     cur_hit =  (TFndHLmd *) ( LmdHits->At(ic) );
00403     //cur_hit->PrintHit();
00404     cur_hit->GetLayer_Chamber_Wire(lay, cham, wire);
00405         //Printf("%d %d %d",lay, cham, wire);
00406     //Printf("");
00407         Float_t ae = cur_hit->GetAdcE();
00408         Float_t ap = cur_hit->GetAdcP();
00409         Float_t te = cur_hit->GetTdcE();
00410         Float_t tp = cur_hit->GetTdcP();
00411         Float_t fullHit = ae*ap*te*tp;
00412         if(lay == 1) i_mult++;
00413         if(lay == 2) o_mult++;
00414 
00415         if(fullHit) fH_Lmd_map[lay-1]->Fill(cham,wire);
00416         if(ae>=0) fH_Lmd_map_ae[lay-1]->Fill(cham,wire); 
00417         if(ap>=0) fH_Lmd_map_ap[lay-1]->Fill(cham,wire); 
00418         if(te>=0) fH_Lmd_map_te[lay-1]->Fill(cham,wire); 
00419         if(tp>=0) fH_Lmd_map_tp[lay-1]->Fill(cham,wire);   
00420         fH_Lmd_TotAdc[lay-1][cham-1]->Fill(ae+ap);
00421         fH_Lmd_AvgTdc[lay-1][cham-1]->Fill(0.5*(te+tp));
00422         fH_Lmd_TotAdc[lay-1][idx]->Fill(ae+ap);
00423         fH_Lmd_AvgTdc[lay-1][idx]->Fill(0.5*(te+tp));
00424   }   
00425   fH_Lmd_i_o_mult->Fill(o_mult,i_mult);
00426   fH_Lmd_tot_mult->Fill(o_mult+i_mult);
00427 
00428 }
00429 
00430 void FillStbHistos(){
00431 
00432   TClonesArray *StbHits = fCurHdtEv->GetStbHits();
00433 
00434   Int_t crown, tube;
00435   TFndHStb *cur_hit = 0;
00436   fH_Stb_mult->Fill(StbHits->GetEntries());
00437   for(Int_t ic=0;ic< StbHits->GetEntries(); ic++) {
00438     cur_hit =  (TFndHStb *) ( StbHits->At(ic) );
00439     //cur_hit->PrintHit();
00440     cur_hit->GetCrown_Tube(crown, tube);
00441     //     Printf("%d %d %d",lay, cham, wire);
00442     //     Printf("");
00443         fH_Stb_map[crown-1]->Fill(tube);
00444         fH_Stb_Tdc[crown-1]->Fill(cur_hit->GetTdc());
00445   }   
00446 }
00447 
00448 void FillHistos(){
00449   //cout << "fill gts histos" << endl;
00450   FillGtsHistos();
00451   //cout << "fill tof histos" << endl;
00452   FillTofHistos();
00453   //cout << "fill sil histos" << endl;
00454   FillSilHistos();
00455   //cout << "fill lmd histos" << endl;
00456   FillLmdHistos();
00457   //cout << "fill stb histos" << endl;
00458   FillStbHistos();
00459 }
00460 
00461 void EventLoop(const Int_t &nevs){
00462   
00463   Int_t entries = fHdtTree->GetEntries();
00464   if(fVerboseLev > 2) cout << entries << " events in the run" << endl;
00465   
00466   Int_t cur_ev = 0;
00467   while(1){
00468     if(cur_ev >= entries){      
00469       if(fVerboseLev > 0) gROOT->Info("EventLoop","run completed");
00470       break;
00471     }
00472     if(nevs != -1 && cur_ev >= nevs){      
00473       if(fVerboseLev > 0) gROOT->Info("EventLoop","requested number of events reached");
00474       break;
00475     }
00476     //cout << "get event " << cur_ev << endl; 
00477     fHdtTree->GetEntry(cur_ev);
00478     //
00479     //cout << "fill histos" << endl;
00480     FillHistos();
00481     if(fVerboseLev > 2 || ( (cur_ev%1000)==0 && fVerboseLev>0) ) cout << "processing event: " << cur_ev << endl;
00482     //fCurHdtEv->PrintLmdHits();
00483     //
00484     cur_ev++;
00485   }
00486 }
00487 
00488 void SaveGtsHistos(){
00489   for(Int_t i=0;i < K_N_GTS_P_UNITS ; i++) {
00490         fHPU_cont[i]->Write();
00491         fHPU_mult[i]->Write();
00492   }
00493   // ---
00494   for(Int_t i=0;i < K_N_GTS_SELECTORS ; i++) fHTrigSel[i]->Write();
00495 }
00496   
00497 void SaveTofHistos(){
00498 
00499   for(Int_t lay=0;lay<2;lay++ ){
00500         fH_Tof_map[lay]->Write();
00501         fH_Tof_map_ae[lay]->Write();
00502         fH_Tof_map_ap[lay]->Write();
00503         fH_Tof_map_te[lay]->Write();  
00504         fH_Tof_map_tp[lay]->Write();
00505         fH_Tof_map_mt[lay]->Write();
00506 
00507         for(Int_t slab=0;slab<=12+60*lay;slab++ ){
00508           fH_Tof_TotAdc[lay][slab]->Write();
00509           fH_Tof_AvgTdc[lay][slab]->Write();
00510         }   
00511 
00512   }
00513   fH_Tof_i_o_mult->Write();
00514 }
00515 
00516 void SaveSilHistos(){
00517   
00518   for(Int_t lay=0;lay<2;lay++){
00519     fH_Sil_Patt_Clust_Low[lay]->Write();
00520     fH_Sil_Patt_Clust_High[lay]->Write();
00521   }
00522   
00523 }
00524   
00525 void SaveLmdHistos(){
00526   for(Int_t lay=0;lay<2;lay++ ){
00527         fH_Lmd_map[lay]->Write();
00528         fH_Lmd_map_ae[lay]->Write();
00529         fH_Lmd_map_ap[lay]->Write();
00530         fH_Lmd_map_te[lay]->Write();  
00531         fH_Lmd_map_tp[lay]->Write();
00532         for(Int_t ch=0;ch<=K_N_LMD_CHAMS_PER_LAYER;ch++ ){
00533           fH_Lmd_TotAdc[lay][ch]->Write();
00534           fH_Lmd_AvgTdc[lay][ch]->Write();
00535         }   
00536   }
00537   fH_Lmd_i_o_mult->Write();
00538   fH_Lmd_tot_mult->Write();
00539 }
00540   
00541 void SaveStbHistos(){
00542   fH_Stb_mult->Write();
00543   for(Int_t crown=0;crown<K_N_STB_CROWNS;crown++ ){
00544         fH_Stb_map[crown]->Write();
00545         fH_Stb_Tdc[crown]->Write();
00546   }
00547 }
00548   
00549 void SaveHistos(TString &fname){        
00550   fname.Append("_monitor.root");
00551   TFile *fOutFile = new TFile(fname,"RECREATE");
00552   SaveGtsHistos();
00553   SaveTofHistos();
00554   SaveSilHistos();
00555   SaveLmdHistos();
00556   SaveStbHistos();
00557   fOutFile->Close();
00558   delete fOutFile;
00559   fOutFile = 0;
00560 }
00561 
00563 
00564 void SetHistoProperties(TH1 *his,Int_t mode){
00565   // mode values:
00566   //            0: normal with thik line
00567   //            1: first of (BW) superposition
00568   //            2: second of (BW) superposition
00569   gStyle->SetOptStat(1000101);
00570   gStyle->SetStatStyle(3002);
00571   gStyle->SetStatColor(0);
00572   gStyle->SetStatTextColor(12);
00573   
00574   gStyle->SetStatX(0.98);
00575   gStyle->SetStatW(0.235);
00576   gStyle->SetStatY(0.99);
00577   gStyle->SetStatH(0.35);
00578   
00579   gStyle->SetTitleX(0);
00580   gStyle->SetTitleW(0.5);
00581   gStyle->SetTitleY(1);
00582   gStyle->SetTitleH(0.08);
00583   
00584   switch(mode){
00585   case 0:
00586     his->SetLineWidth(2);
00587     break;
00588   case 1:
00589     his->SetLineStyle(1);
00590     his->SetLineWidth(3);
00591     his->SetFillStyle(3005);
00592     his->SetFillColor(15);
00593     break;
00594   case 2:    
00595     gStyle->SetStatX(0.74);
00596     //     gStyle->SetStatW(0.20);
00597     //     gStyle->SetStatY(0.99);
00598     //     gStyle->SetStatH(0.35);
00599     
00600     his->SetLineStyle(1);
00601     his->SetLineWidth(1);
00602     his->SetFillStyle(3001);
00603     his->SetFillColor(1);
00604   }
00605 
00606 }
00607 
00608 
00609 void DrawGtsHistos(TCanvas *gts, TString &fname){
00610         gts->Clear();
00611         gts->Divide(2,4);
00612         for(Int_t k=0; k<4; k++) {
00613           gts->cd(2*k+1);
00614           fHPU_cont[k]->Draw();
00615           gts->cd(2*(k+1));
00616           fHPU_mult[k]->Draw();
00617         }
00618         gts->Print(fname.Data());
00619 }
00620 
00621 void DrawMultiplicityHistos(TCanvas *mlt, TString &fname){
00622         mlt->Clear();
00623         mlt->Divide(1,3);
00624         mlt->cd(1);
00625         fH_Tof_i_o_mult->Draw("zcol");
00626         mlt->cd(2);
00627         fH_Lmd_i_o_mult->Draw("zcol");
00628         mlt->cd(3);
00629         fH_Stb_mult->Draw();
00630         mlt->Print(fname.Data());
00631 }
00632 
00633 void DrawTofHistos(TCanvas *tof, TString &fname){
00634 
00635         tof->Clear();
00636         tof->Divide(2,3);
00637         TH1D *i_mult = fH_Tof_i_o_mult->ProjectionY();
00638         i_mult->SetTitle("tofino multiplicity");
00639         tof->cd(1);
00640         i_mult->Draw();
00641         tof->cd(2);
00642         fH_Tof_map[0]->Draw();
00643         tof->cd(3);
00644         fH_Tof_map_ae[0]->Draw();       
00645         tof->cd(4);
00646         fH_Tof_map_ap[0]->Draw();
00647         tof->cd(5);
00648         fH_Tof_map_te[0]->Draw();
00649         tof->cd(6);
00650         fH_Tof_map_tp[0]->Draw();
00651         tof->Print(fname.Data());
00652 
00653         tof->Clear();
00654         tof->Divide(2,3);
00655         TH1D *o_mult = fH_Tof_i_o_mult->ProjectionX();
00656         o_mult->SetTitle("TOFONE multiplicity");
00657         tof->cd(1);
00658         o_mult->Draw();
00659         tof->cd(2);
00660         fH_Tof_map[1]->Draw();
00661         tof->cd(3);
00662         fH_Tof_map_ae[1]->Draw();       
00663         tof->cd(4);
00664         fH_Tof_map_ap[1]->Draw();
00665         tof->cd(5);
00666         fH_Tof_map_te[1]->Draw();
00667         tof->cd(6);
00668         fH_Tof_map_tp[1]->Draw();
00669         tof->Print(fname.Data());
00670 
00671         tof->Clear();
00672         tof->Divide(2,2);
00673         tof->cd(1);
00674         fH_Tof_TotAdc[0][12]->Draw();
00675         tof->cd(2);
00676         fH_Tof_AvgTdc[0][12]->Draw();
00677         tof->cd(3);
00678         fH_Tof_TotAdc[1][72]->Draw();
00679         tof->cd(4);
00680         fH_Tof_AvgTdc[1][72]->Draw();
00681         tof->Print(fname.Data());
00682 }
00683 
00684 void DrawLmdHistos(TCanvas *lmd, TString &fname){
00685 
00686         lmd->Clear();
00687         lmd->Divide(2,3);
00688         TH1D *i_mult = fH_Lmd_i_o_mult->ProjectionY();
00689         i_mult->SetTitle("Inner LMD multiplicity");
00690         lmd->cd(1);
00691         i_mult->Draw();
00692         lmd->cd(2);
00693         fH_Lmd_map[0]->Draw("zcol");
00694         lmd->cd(3);
00695         fH_Lmd_map_ae[0]->Draw("zcol"); 
00696         lmd->cd(4);
00697         fH_Lmd_map_ap[0]->Draw("zcol");
00698         lmd->cd(5);
00699         fH_Lmd_map_te[0]->Draw("zcol");
00700         lmd->cd(6);
00701         fH_Lmd_map_tp[0]->Draw("zcol");
00702         lmd->Print(fname.Data());
00703 
00704         lmd->Clear();
00705         lmd->Divide(2,3);
00706         TH1D *o_mult = fH_Lmd_i_o_mult->ProjectionX();
00707         o_mult->SetTitle("Outer LMD multiplicity");
00708         lmd->cd(1);
00709         o_mult->Draw();
00710         lmd->cd(2);
00711         fH_Lmd_map[1]->Draw("zcol");
00712         lmd->cd(3);
00713         fH_Lmd_map_ae[1]->Draw("zcol"); 
00714         lmd->cd(4);
00715         fH_Lmd_map_ap[1]->Draw("zcol");
00716         lmd->cd(5);
00717         fH_Lmd_map_te[1]->Draw("zcol");
00718         lmd->cd(6);
00719         fH_Lmd_map_tp[1]->Draw("zcol");
00720         lmd->Print(fname.Data());
00721 
00722         for(Int_t j=0;j<2;j++) {
00723           lmd->Clear();
00724           lmd->Divide(2,4);
00725           for(Int_t i=0;i<8;i++) {
00726                 lmd->cd(i+1);
00727                 fH_Lmd_TotAdc[j][i]->Draw();
00728           }
00729           lmd->Print(fname.Data());
00730         }
00731         
00732         for(Int_t j=0;j<2;j++) {
00733           lmd->Clear();
00734           lmd->Divide(2,4);
00735           for(Int_t i=0;i<8;i++) {
00736                 lmd->cd(i+1);
00737                 fH_Lmd_AvgTdc[j][i]->Draw();
00738           }
00739           lmd->Print(fname.Data());
00740         }
00741         
00742 }
00743 
00744 void DrawStbHistos(TCanvas *stb, TString &fname){
00745 
00746         stb->Clear();
00747         stb->Divide(2,3);
00748         for(Int_t i=0;i<6;i++) {
00749           stb->cd(i+1);
00750           fH_Stb_map[i]->Draw();
00751         }
00752         stb->Print(fname.Data());
00753 
00754         stb->Clear();
00755         stb->Divide(2,3);
00756         for(Int_t i=0;i<6;i++) {
00757           stb->cd(i+1);
00758           fH_Stb_Tdc[i]->Draw();
00759         }
00760         stb->Print(fname.Data());
00761 }
00762 
00763 void DrawHistos(TString &fname){        
00764   TString pdfname(fname);
00765   pdfname.Append(".pdf");
00766   fname.Append(".ps");
00767 
00768   gStyle->SetPalette(1,0);
00769   TCanvas *fCanvas = new TCanvas("FND_Monitor","FND_Monitor",580,840);
00770   TString cName(fname.Data());
00771   cName.Append("[");
00772   fCanvas->Print(cName.Data());
00773   DrawGtsHistos(fCanvas,fname);
00774   DrawMultiplicityHistos(fCanvas,fname);
00775   DrawTofHistos(fCanvas,fname);
00776   DrawLmdHistos(fCanvas,fname);
00777   DrawStbHistos(fCanvas,fname);
00778   TString dName(fname.Data());
00779   dName.Append("]");
00780   fCanvas->Print(dName.Data());
00781   TString cmd("ps2pdf ");
00782   cmd.Append(fname.Data());
00783   cmd.Append(" ");
00784   cmd.Append(pdfname.Data());
00785   if(fVerboseLev > 2) cout << "command is " << cmd.Data() << endl;
00786   gSystem->Exec(cmd.Data());
00787   TString cmd1("rm ");
00788   cmd1.Append(fname.Data());
00789   gSystem->Exec(cmd1.Data());
00790 }
00791 
00792 
00793 void EvalPatternUnit(){
00794 
00795   if(fVerboseLev > 0) Printf("\n Evaluating trigger");
00796 
00797   Float_t max = fHPU_cont[0]->GetMaximum();
00798   if(fVerboseLev > 1) Printf("maximum: %1f",max);
00799 
00800   Float_t thr = max/10;
00801   if(fVerboseLev > 1) Printf("thr: %3f",thr);
00802 
00803   const Int_t nbinsx = (const Int_t) ( fHPU_cont[0]->GetNbinsX() );
00804   
00805   UInt_t b_on_code = 0;
00806   UInt_t b_over_th_code = 0;
00807   Bool_t b_on[16+1] = { kFALSE };
00808   Bool_t b_over_th[16+1] = { kFALSE };
00809   
00810   // take care: b_on indexing as bit numbering (from 1 to 16)
00811   //           b_on[0] will be always empty!
00812   for(Int_t b=2; b<=nbinsx; b++){
00813     Float_t cont = fHPU_cont[0]->GetBinContent(b);
00814     if(fVerboseLev > 2) Printf("b: %i; content: %1f",b-1,cont);
00815     if(cont > 0 ) b_on[b-1] = kTRUE;
00816     if(cont > thr) b_over_th[b-1] = kTRUE;
00817   }
00818   // ---
00819   TString chk_str_on = "bits on: " ;
00820   TString chk_str_over_thr = "bits over threshold: " ;
00821   for(Int_t b=1; b<=16; b++){
00822     if(b_on[b]) {
00823       chk_str_on += b; chk_str_on +=  " "; 
00824       b_on_code = b_on_code | (0x1 << b);
00825     }
00826     if(b_over_th[b]) {
00827       chk_str_over_thr += b; chk_str_over_thr +=  " ";
00828       b_over_th_code = b_over_th_code | (0x1 << b);
00829     }
00830   }
00831   if(fVerboseLev > 2){
00832     Printf("%s (0x%X)",chk_str_on.Data(),b_on_code);
00833     Printf("%s (0x%X)",chk_str_over_thr.Data(),b_over_th_code);
00834   }
00835   // ---
00836   UInt_t bhabha_code = 0x614;
00837   UInt_t hype_code = 0x432;
00838   UInt_t cosm_code = 0x450;
00839 
00840   UInt_t chk_bhabha = b_on_code & bhabha_code;
00841   UInt_t chk_hype   = b_on_code & hype_code;
00842   UInt_t chk_cosm   = b_on_code & cosm_code;
00843 
00844   if(fVerboseLev > 1){
00845     Printf("\n\n-----------------------");
00846     
00847     
00848     Printf("Check bhabha: 0x%X",chk_bhabha);
00849     Printf("Check hype  : 0x%X",chk_hype);
00850     Printf("Check cosm  : 0x%X",chk_cosm);
00851   }
00852 
00853   Bool_t rec_bha  = (chk_bhabha == bhabha_code) ? kTRUE : kFALSE;
00854   Bool_t rec_hyp  = (chk_hype  == hype_code) ? kTRUE : kFALSE;
00855   Bool_t rec_cosm = (chk_cosm  == cosm_code) ? kTRUE : kFALSE;
00856 
00857   TString res_msg = "TRIG: ";
00858   if(rec_bha && ( (b_on_code & 0x40) == 0) )  res_msg += " BHA ";
00859   if(rec_hyp && ( (b_on_code & 0x40) == 0) ){
00860     res_msg += " HYP ";
00861     if( (b_over_th_code & 0x4) == 0) res_msg = " HYP ";
00862   }
00863   if(rec_cosm) res_msg += " COSM ";
00864   
00865   if(res_msg.CompareTo("TRIG: ")==0) res_msg = " ? ";
00866 
00867   if(fVerboseLev > 0) Printf("detected trigger: \"%s\"",res_msg.Data());
00868   // ---
00869 
00870   fCanvTit.Form("%s (%s)",fCurRunName.Data(),res_msg.Data());
00871 
00872   //   Grab runtime (last run)
00873   TString rtim_str = "";
00874   if(fRunInfo){
00875     //    fRunInfo->Print();
00876     TDatime rdatime = fRunInfo->GetDateTime();
00877     rtim_str.Form(" (%s)",rdatime.AsSQLString());
00878     fCanvTit+=rtim_str;
00879   }
00880 
00881 }
00882 
00883 void DrawSummaryHistos(TString &fname){ 
00884 
00885   TString pdfname = fname;
00886   pdfname+=".pdf";
00887 
00888   gStyle->SetPalette(1,0);
00889   TCanvas *fCanvas = new TCanvas("FND_Monitor","FND_Monitor",580,840);
00890   
00891   fCanvas->Clear();
00892 
00894   TString title = fCanvTit;
00895   TString filename = pdfname;
00896   Int_t TitColor = -1;
00897   Double_t pad_tit_h = 0.05;
00898   Double_t TitSize = 0.5;
00899   // ---
00900    
00901   Double_t sep = 0.005;  
00902   Double_t ori_w = (Double_t) ( fCanvas->GetWindowWidth() );
00903   Double_t ori_h = (Double_t) ( fCanvas->GetWindowHeight() );
00904 
00905   //   if(ori_w == 0 || ori_w == 32000) ori_w = 800;
00906   //   if(ori_h == 0 || ori_h == 32000) ori_h = 600;
00907   
00908   Double_t w_h_ratio = ori_w / ori_h;
00909   
00910   UInt_t displ_h = (UInt_t) ( ori_h - ( ori_h * pad_tit_h + sep) );
00911   UInt_t displ_w = (UInt_t) ( displ_h * w_h_ratio );
00912 
00913   
00914   TPad *pt = new TPad("pt","ptit",
00915                       .01 , (1.- (pad_tit_h - sep) ) ,
00916                       .99 ,  .999);
00917   
00918   if(TitColor != -1)pt->SetFillColor(TitColor);
00919   
00920   fCanvas->cd();
00921   pt->Draw();
00922   // WRITE TITLE
00923   pt->cd();
00924   TLatex tit;//= new TLatex(.05,.95,title);
00925   tit.SetTextAlign(23);
00926   tit.SetTextSize(TitSize);
00927   tit.DrawLatex(0.5,0.65,title);
00928 
00929   Double_t dis_perc_w = (Double_t) (displ_w) / ori_w;
00930   Double_t dis_perc_h = (Double_t) (displ_h) / ori_h;
00931   
00932   Double_t half_p = (1. - dis_perc_w)/2;
00933 
00934   TPad *pd = new TPad("pd","pdis",
00935                       half_p     , .0001,
00936                       1 - half_p , dis_perc_h);
00937 
00938   fCanvas->cd();
00939   pd->Draw();
00940 
00941   pd->cd();  
00943 
00944   pd->Divide(2,4);
00945   pd->cd(1);
00946 
00947   // --- TOF multiplicities
00948   TH1D *i_mult = fH_Tof_i_o_mult->ProjectionY();
00949   i_mult->SetAxisRange(-0.5,7.5,"X");
00950   i_mult->SetName("TOFINO MT multiplicity");
00951   i_mult->SetTitle("TOFINO MT multiplicity");
00952   SetHistoProperties(i_mult,1);
00953   i_mult->Draw();
00954 
00955   fH_Tofi_High_mult->SetAxisRange(-0.5,7.5,"X");
00956   fH_Tofi_High_mult->SetName("TOFINO MT-h mult.");
00957   SetHistoProperties(fH_Tofi_High_mult,2);
00958   fH_Tofi_High_mult->Draw("sames");
00959   if(fH_Tofi_High_mult->GetMaximum() > i_mult->GetMaximum() ) i_mult->SetAxisRange(0,fH_Tofi_High_mult->GetMaximum(),"Y");
00960 
00961   leg[0] = new TLegend(0.6,0.5,0.99,0.75);
00962   leg[0]->AddEntry(i_mult->GetName(),"low th.","cf");
00963   leg[0]->AddEntry(fH_Tofi_High_mult->GetName(),"high th.","cf");
00964   leg[0]->Draw();
00965 
00966   pd->cd(2);
00967   TH1D *o_mult = fH_Tof_i_o_mult->ProjectionX();
00968   o_mult->SetAxisRange(-0.5,15.5,"X");
00969   o_mult->SetTitle("TOFONE MT multiplicity");
00970   SetHistoProperties(o_mult,0);
00971   o_mult->Draw();
00972   
00973   // --- TOF patterns
00974   pd->cd(3);
00975   fH_Tof_map_mt[0]->SetAxisRange(-0.5,13.5,"X");
00976   fH_Tof_map_mt[0]->SetName("TOFINO MT-l patt.");
00977   fH_Tof_map_mt[0]->SetTitle("TOFINO MT-low patt.");
00978   SetHistoProperties(fH_Tof_map_mt[0],1);
00979   fH_Tof_map_mt[0]->Draw();
00980 
00981   fH_Tofi_High_map->SetAxisRange(-0.5,13.5,"X");
00982   fH_Tofi_High_map->SetName("TOFINO MT-h pattern");
00983   fH_Tofi_High_map->SetTitle("TOFINO MT-high pattern");
00984   SetHistoProperties(fH_Tofi_High_map,2);
00985   fH_Tofi_High_map->Draw("sames");
00986 
00987   pd->cd(4);
00988   fH_Tof_map_mt[1]->SetAxisRange(-0.5,72.5,"X");
00989   SetHistoProperties(fH_Tof_map_mt[1],0);
00990   fH_Tof_map_mt[1]->Draw();
00991 
00992   // --- SIL
00993   pd->cd(5);// ISIM
00994   SetHistoProperties(fH_Sil_Patt_Clust_Low[0],1);
00995   fH_Sil_Patt_Clust_Low[0]->Draw();
00996   SetHistoProperties(fH_Sil_Patt_Clust_High[0],2);
00997   fH_Sil_Patt_Clust_High[0]->Draw("sames");
00998   pd->cd(6);// OSIM
00999   SetHistoProperties(fH_Sil_Patt_Clust_Low[1],1);
01000   fH_Sil_Patt_Clust_Low[1]->Draw();
01001   SetHistoProperties(fH_Sil_Patt_Clust_High[1],2);
01002   fH_Sil_Patt_Clust_High[1]->Draw("sames");
01003 
01004 
01005   // --- LMD and STB multiplicities
01006   pd->cd(7);
01007   fH_Lmd_tot_mult->SetAxisRange(-0.5,14.5,"X");
01008   SetHistoProperties(fH_Lmd_tot_mult,0);
01009   fH_Lmd_tot_mult->Draw();  
01010 
01011   pd->cd(8);
01012   fH_Stb_mult->SetAxisRange(-0.5,34.5,"X");
01013   SetHistoProperties(fH_Stb_mult,0);
01014   fH_Stb_mult->Draw();
01015 
01016 
01017   // --- SAVE PDF
01018   fCanvas->cd();
01019   fCanvas->SaveAs(filename);
01020   /* first summary without SIL histos
01021     fCanvas->Divide(2,3);
01022     fCanvas->cd(1);
01023     TH1D *i_mult = fH_Tof_i_o_mult->ProjectionY();
01024     i_mult->SetAxisRange(-0.5,7.5,"X");
01025     i_mult->SetTitle("tofino multiplicity");
01026     i_mult->Draw();
01027     fCanvas->cd(2);
01028     TH1D *o_mult = fH_Tof_i_o_mult->ProjectionX();
01029     o_mult->SetAxisRange(-0.5,15.5,"X");
01030     o_mult->SetTitle("TOFONE multiplicity");
01031     o_mult->Draw();
01032     fCanvas->cd(3);
01033     fH_Lmd_tot_mult->SetAxisRange(-0.5,14.5,"X");
01034     fH_Lmd_tot_mult->Draw();  
01035     fCanvas->cd(4);
01036     fH_Stb_mult->SetAxisRange(-0.5,34.5,"X");
01037     fH_Stb_mult->Draw();
01038     fCanvas->cd(5);
01039     fH_Tof_map_mt[0]->SetAxisRange(-0.5,12.5,"X");
01040     fH_Tof_map_mt[0]->Draw();
01041     fCanvas->cd(6);
01042     fH_Tof_map_mt[1]->SetAxisRange(-0.5,72.5,"X");
01043     fH_Tof_map_mt[1]->Draw();
01044   */
01045   //  Gui::SaveCanvasWithTitle(fCanvas,fCanvTit,pdfname,"","",-1,0.05,0.3);
01046 
01047   // --- PU1 histogram (used for checking trigger)
01048   //   TCanvas *c_remove = new TCanvas();
01049   //   fHPU_cont[0]->Draw();
01050   
01051 }
01052 
01053 void DefaultHistos(const TString &runtype,const Int_t &run_num,const Int_t &nOfRuns = 1, const Int_t &nevs = 10000000){
01054 
01055   DeclareHistos();
01056   if(fVerboseLev > 0) cout << "Loop on " << nOfRuns << " runs" << endl;
01057   for(Int_t irun=0;irun<nOfRuns;irun++) {
01058         if(fVerboseLev > 0) cout << "run " << irun+1 << " of " << nOfRuns << endl;
01059         fCurRunName = BuildRunName(runtype,run_num+irun);
01060 
01061         if(fVerboseLev > 2) cout << "open hdt" << endl;
01062         if(OpenHdtFile(fCurRunName) !=0) continue;
01063 
01064         if(fVerboseLev > 2) cout << "load tree" << endl;
01065         if(LoadHdtTree() != 0) continue;
01066 
01067         if(fVerboseLev > 2) cout << "event loop" << endl;
01068         EventLoop(nevs);
01069   }
01070   TString fullrunname = BuildRunName(runtype,run_num);
01071   fullrunname.Append("-");
01072   TString finalrunname = BuildRunName(fullrunname,run_num+nOfRuns-1);
01073   finalrunname.Prepend(FROOT::ExpandPathName("$FND_HISTOS/").Data());
01074   SaveHistos(finalrunname);
01075   if(fVerboseLev > 2) cout << "Run name: " << finalrunname.Data() << endl;
01076 
01077   EvalPatternUnit();
01078 
01079   if(nOfRuns == 1) {
01080     DrawSummaryHistos(finalrunname);
01081   }
01082   else
01083         DrawHistos(finalrunname);
01084 }

Generated on Tue Oct 16 15:40:47 2007 by  doxygen 1.5.2