ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/DTDPGAnalysis/src/DTDPGCreateAnalyzerSummary.cc
(Generate patch)

Comparing UserCode/DTDPGAnalysis/src/DTDPGCreateAnalyzerSummary.cc (file contents):
Revision 1.6 by cerminar, Fri Dec 19 16:36:40 2008 UTC vs.
Revision 1.10 by marycruz, Wed Jul 13 08:46:59 2011 UTC

# Line 36 | Line 36
36   #include "TF1.h"
37   #include "TH2F.h"
38   #include "TCanvas.h"
39 + #include "TPad.h"
40   #include "TGraph.h"
41   #include "TPostScript.h"
42   #include "TPaveLabel.h"
# Line 43 | Line 44
44   #include "TProfile.h"
45   #include "TStyle.h"
46   #include "TFolder.h"
47 + #include "TColor.h"
48 + #include "TPaletteAxis.h"
49   #include "boost/filesystem.hpp"
50  
51   using namespace edm;
# Line 65 | Line 68 | DTDPGCreateAnalyzerSummary::~DTDPGCreate
68   }
69  
70  
71 < void DTDPGCreateAnalyzerSummary::beginJob(const edm::EventSetup& context){
71 > void DTDPGCreateAnalyzerSummary::beginJob(){
72  
73    edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: BeginJob";
74  
75   }
76  
77   void DTDPGCreateAnalyzerSummary::analyze(const edm::Event& e, const edm::EventSetup& context){
75  
78   }
79  
80  
# Line 110 | Line 112 | void DTDPGCreateAnalyzerSummary::endJob(
112  
113   }
114  
115 < void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, int wh, int sec, string tag, TCanvas *canvas) {
115 > void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, int wh, int sec, string tag, TCanvas *canvas, bool isExtraFile) {
116  
117    stringstream gifBase;
118    gifBase << "Run" << myRunNumber << "/Wheel" << showpos << wh << "/Sect" << noshowpos << setfill('0')<< setw(2) << sec;
119 +  if (isExtraFile) { gifBase << "/ExtraPlots"; }
120 +
121    try {
122      create_directories(gifBase.str());
123    } catch(const std::exception & ex) {
# Line 127 | Line 131 | void DTDPGCreateAnalyzerSummary::createG
131  
132   }
133  
134 < void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, int wh, string tag, TCanvas *canvas) {
134 > void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, int wh, string tag, TCanvas *canvas, bool isExtraFile) {
135  
136    stringstream gifBase;
137    gifBase << "Run" << myRunNumber << "/Wheel" << showpos << wh << noshowpos;
138 +  if (isExtraFile) { gifBase << "/ExtraPlots"; }
139    try {
140      create_directories(gifBase.str());
141    } catch(const std::exception & ex) {
# Line 143 | Line 148 | void DTDPGCreateAnalyzerSummary::createG
148    canvas->Print(gifFile.c_str());
149  
150   }
151 < void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, string tag, TCanvas *canvas) {
151 >
152 > void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, string tag, TCanvas *canvas, bool isExtraFile) {
153  
154    stringstream gifBase;
155    gifBase << "Run" << myRunNumber;
156 +  if (isExtraFile) { gifBase << "/ExtraPlots"; }
157    try {
158      create_directories(gifBase.str());
159    } catch(const std::exception & ex) {
# Line 161 | Line 168 | void DTDPGCreateAnalyzerSummary::createG
168  
169   }
170    
164  
171   void DTDPGCreateAnalyzerSummary::createSummaryPlots() {
172  
173    string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
# Line 179 | Line 185 | void DTDPGCreateAnalyzerSummary::createS
185  
186    
187    // Get histos to be plotted
182  // char histoname[240];
183  // char htit[240]; // ???
188    TH1F * first_to_paint;
189 +  //TH1F * first_to_paint_MB[4];
190    string SLname[3]={"Phi1","Theta","Phi2"};
191  
192 <  int nbin;
193 <  float max, max1;
192 >  //int nbin;
193 >  //float max, max1;
194  
195    TH2F *DigiXYS[5][14];
196    TH1F *DigiXSecMBSlLayer[5][14][4][3][4];
197    TH1F *TBoxSecMBSlLayer[5][14][4][3][4];
198 +  //TH1F *OccupMB[5][4];
199    TH1F *Correlated_trig_Bx[5][14][4][3];
200    TH1F *hTrg_effnum_SecMB[5][14][4];
201    TH1F *hTrg_effdenum_SecMB[5][14][4];
# Line 331 | Line 337 | void DTDPGCreateAnalyzerSummary::createS
337        int ichmin=1; if (isec==13|| isec==14)ichmin=4;
338        for(int ich=ichmin;ich<5;ich++){
339          for(int isl=1;isl<4;isl++){
334          TCanvas *DigiSL = new TCanvas("DigiSL", "",201,81,999,699);  
340            bool dodraw=1;
341            if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
342            if(dodraw){
343 +            TCanvas *DigiSL = new TCanvas("DigiSL", "",201,81,999,699);  
344              // look first for the maximum bin entries
345              first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
346              float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
# Line 348 | Line 354 | void DTDPGCreateAnalyzerSummary::createS
354              }
355              stringstream htitle;  htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
356              first_to_paint->SetTitle(htitle.str().c_str());
351            //int icpos=(ich-1)*3+isl;
357              first_to_paint->GetYaxis()->SetLabelSize(0.05);
358              first_to_paint->GetXaxis()->SetLabelSize(0.05);
359              first_to_paint->Draw();
# Line 413 | Line 418 | void DTDPGCreateAnalyzerSummary::createS
418        ichmin=1; if (isec==13|| isec==14)ichmin=4;
419        for(int ich=ichmin;ich<5;ich++){
420          for(int isl=1;isl<4;isl++){
416          TCanvas *TboxSL = new TCanvas("TboxSL", "",201,81,999,699);
421            
422            bool dodraw=1;
423            if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
424            if(dodraw){
425 +             TCanvas *TboxSL = new TCanvas("TboxSL", "",201,81,999,699);
426              // look first for the maximum bin entries
427              first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
428              float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
# Line 448 | Line 453 | void DTDPGCreateAnalyzerSummary::createS
453      }
454    }//end Loop on sectors/wheels
455  
451
452  //===================================================================================
453  //    Trigger Stuff
454  //===================================================================================
455  
456  TH1F *heffTrgSecMB[5][14][4];
457  char * labTriggerMatrix[]={"no trig"," ","MB1","MB2","MB3","MB4"," ","1 & 2","1 & 3","1 & 4","2 & 3","2 & 4",
458                             "3 & 4"," ","1 & 2 & 3","1 & 2 & 4","1 & 3 & 4","2 & 3 & 4"," ","1 & 2 & 3 & 4"};
459
460  whIt  = mySectors.begin();
461  whEnd = mySectors.end();
462  for(;whIt!=whEnd;++whIt) {
463    int iw = (*whIt).first + 2;
464    std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
465    std::vector<int>::const_iterator secEnd = (*whIt).second.end();
466    for(;secIt!=secEnd;++secIt) {
467      int isec = (*secIt);
468      if(isec <13){
469
470        //===================================================================================
471        // BX profiles:
472        //===================================================================================
473        edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing single chamber BX profiles per Sector wh"
474                                          << (iw-2) << " sec " << isec << endl;
475        TCanvas *Trigg = new TCanvas("Trigg", "",201,81,999,699);
476        Trigg->Divide(2,2) ;
477        for(int ich=1;ich<5;ich++){
478          Trigg->cd(ich) ;
479          Trigg->cd(ich)->SetLogy();
480          Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetTitle("BX id");
481          stringstream htitle; htitle << "llHlHH_trig_bxMB"<< ich;
482          Correlated_trig_Bx[iw][isec-1][ich-1][2]->SetTitle(htitle.str().c_str());
483          Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetTitleSize(0.05);
484          Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetLabelSize(0.05);
485          Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetLabelSize(0.05);
486          Correlated_trig_Bx[iw][isec-1][ich-1][2]->Draw();
487          Correlated_trig_Bx[iw][isec-1][ich-1][1]->SetLineColor(2);
488          Correlated_trig_Bx[iw][isec-1][ich-1][1]->Draw("same");
489          Correlated_trig_Bx[iw][isec-1][ich-1][0]->SetLineColor(3);
490          Correlated_trig_Bx[iw][isec-1][ich-1][0]->Draw("same");
491        }// end loop on chambers
492
493        createGifFile("Trigger_Summary",(iw-2),isec,"",Trigg);
494        delete Trigg;
495
496        //===================================================================================
497        //    Trigger: HH&HL efficiencies
498        //===================================================================================
499        edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing HH&HL efficiencies wh "
500                                          << (iw-2) << " sec " << isec << endl;
501        TCanvas *EffTrg = new TCanvas("EffTrg", "",201,81,999,699);
502        EffTrg->Divide(2,4); // divide canvas in 2 columns, 4 raws
503
504        for(int ich=1;ich<5;ich++){
505          stringstream histoname; histoname << "heffTrgSec" << isec << "MB" << ich;
506          heffTrgSecMB[iw][isec-1][ich-1] =(TH1F*)hTrg_effnum_SecMB[iw][isec-1][ich-1]->Clone(histoname.str().c_str());
507          heffTrgSecMB[iw][isec-1][ich-1]->Divide(hTrg_effnum_SecMB[iw][isec-1][ich-1]
508                                                  ,hTrg_effdenum_SecMB[iw][isec-1][ich-1],1.0,1.0);
509          heffTrgSecMB[iw][isec-1][ich-1]->SetMaximum(1.1);
510          heffTrgSecMB[iw][isec-1][ich-1]->SetMinimum(0.);
511          heffTrgSecMB[iw][isec-1][ich-1]->GetXaxis()->SetLabelSize(0.05);
512          heffTrgSecMB[iw][isec-1][ich-1]->GetYaxis()->SetLabelSize(0.05);
513          for (int i = 0; i <= hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetNbinsX()+1; i++ ) {
514            Float_t tot   = hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetBinContent(i) ;
515            Float_t tot_e = hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetBinError(i);
516            Float_t eff = heffTrgSecMB[iw][isec-1][ich-1]->GetBinContent(i) ;
517            Float_t Err = 0.;
518            if (tot > 0) Err = tot_e / tot * sqrt( eff* (1-eff) );
519            // if (eff == 1. || isnan(Err) || !isfinite(Err) ) Err=1.e-3;
520            heffTrgSecMB[iw][isec-1][ich-1]->SetBinError(i, Err);
521          }
522        
523          EffTrg->cd((ich-1)*2+1);  
524          heffTrgSecMB[iw][isec-1][ich-1]->Draw();
525          EffTrg->cd((ich-1)*2+2);  
526          hPhiHL_SecMB[iw][isec-1][ich-1]->Draw();
527        }
528
529        createGifFile("TriggEff_HH&HL",(iw-2),isec,"",EffTrg);
530        delete EffTrg;
531
532        //===================================================================================
533        //    Trigger: TriggerMatrix
534        //===================================================================================
535        edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing TriggerMatrix wh "
536                                          << (iw-2) << " sec " << isec << endl;
537
538        for (int ibin=1; ibin<21; ibin++) TriggerMatrix[iw][isec-1]->GetXaxis()->SetBinLabel(ibin,labTriggerMatrix[ibin-1]);
539        nbin = TriggerMatrix[iw][isec-1]->GetXaxis()->GetNbins();
540        max = 0;
541        TCanvas *Trigmatri = new TCanvas("TriggerMatrix", "",201,81,999,699);
542        Trigmatri->SetBottomMargin(0.12);
543      
544        for (int ibin=1; ibin<nbin+1; ibin++)
545          max = (max > TriggerMatrix[iw][isec-1]->GetBinContent(ibin) ) ? max : TriggerMatrix[iw][isec-1]->GetBinContent(ibin) ;
546        max1=max*1.3;
547      
548        TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelOffset(0.043);
549        // TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelOffset(-0.01);
550        // TriggerMatrix[iw][isec-1]->LabelsOption("v");
551        // TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelSize(0.04);
552      
553        TriggerMatrix[iw][isec-1]->SetMaximum(max1);
554        TriggerMatrix[iw][isec-1]->Draw();
555      
556        //sid = new TPaveText (-0.5,max1-(max1-max)/2,5,max1);
557        //sprintf (sid1,"YB%i, Sector %u, run %u",wheel, isec, run);
558        //sid->AddText(sid1);
559        //sid->Draw();
560      
561        TPaveText* labcont[50];
562        memset(labcont,0,50*sizeof(TPaveText*));
563        TText* cont[50];
564        memset(cont,0,50*sizeof(TText*));
565        
566        for (int ibin=1; ibin<nbin+1; ibin++) {
567          if (ibin == 2 || ibin == 7 ||  ibin == 14 ||  ibin == 19) continue;
568          float x1 = TriggerMatrix[iw][isec-1]->GetBinCenter(ibin) - TriggerMatrix[iw][isec-1]->GetBinWidth(ibin)/2;
569          float x2 = TriggerMatrix[iw][isec-1]->GetBinCenter(ibin) + TriggerMatrix[iw][isec-1]->GetBinWidth(ibin)/2;
570          float y1 = max + (max1-max)/8;
571          float y2 = max1 - (max1-max)/2;
572          labcont[ibin-1] = new TPaveText (x1,y1,x2,y2);
573          
574          char contbin[6];
575          sprintf (contbin,"%u",int(TriggerMatrix[iw][isec-1]->GetBinContent(ibin)));
576          //  labcont[ibin-1]->AddText(cont[ibin-1]);
577      
578          cont[ibin-1] = labcont[ibin-1]->AddText (contbin);
579          //    isme.SetTextAngle(90.);
580          cont[ibin-1]->SetTextSize(0.02);
581          labcont[ibin-1]->Draw();
582        }
583      
584        createGifFile("TriggerMatrix",(iw-2),isec,"",Trigmatri);
585        delete Trigmatri;
586        for (int i=0;i<50;++i) {
587          if (labcont[i]) delete labcont[i];
588        }
589        
590        //===================================================================================
591        //    Trigger: TriggerInclusive SECTOR BY SECTOR
592        //===================================================================================
593
594        TCanvas *TrigmatriSec = new TCanvas("TriggerInclusive[iw]", "",201,81,999,699);
595        TrigmatriSec->SetBottomMargin(0.12);
596        
597        int ibin_init=(isec-1)*5+1;
598        int xpos_init=(isec-1)*5+1;
599
600        max = 0;
601        for (int ibin=ibin_init; ibin<ibin_init+5; ibin++)
602          max = (max > TriggerInclusive[iw]->GetBinContent(ibin) ) ? max : TriggerInclusive[iw]->GetBinContent(ibin) ;
603        max1=max*1.3;
604
605        TriggerInclusive[iw]->GetXaxis()->SetRange(xpos_init,xpos_init+4);
606        TriggerInclusive[iw]->GetXaxis()->SetLabelSize(0.07);
607        TriggerInclusive[iw]->SetMaximum(max1);
608        TriggerInclusive[iw]->Draw();
609        
610        memset(labcont,0,50*sizeof(TPaveText*));
611        memset(cont,0,50*sizeof(TText*));  
612        for (int ibin=ibin_init; ibin<ibin_init+4; ibin++) {
613          
614          float x1 = TriggerInclusive[iw]->GetBinCenter(ibin) - TriggerInclusive[iw]->GetBinWidth(ibin)/2;
615          float x2 = TriggerInclusive[iw]->GetBinCenter(ibin) + TriggerInclusive[iw]->GetBinWidth(ibin)/2;
616          float y1 = max + (max1-max)/8;
617          float y2 = max1 - (max1-max)/2;
618          labcont[ibin-1] = new TPaveText (x1,y1,x2,y2);
619          
620          char contbin[6];
621          sprintf (contbin,"%u",int(TriggerInclusive[iw]->GetBinContent(ibin)));
622          //  labcont[ibin-1]->AddText(cont[ibin-1]);
623      
624          cont[ibin-1] = labcont[ibin-1]->AddText (contbin);
625          //    isme.SetTextAngle(90.);
626          cont[ibin-1]->SetTextSize(0.04);
627          labcont[ibin-1]->Draw();
628          
629        }
630
631        createGifFile("TriggerInclusive",(iw-2),isec,"",TrigmatriSec);
632        delete TrigmatriSec;
633        for (int i=0;i<50;++i) {
634          if (labcont[i]) delete labcont[i];
635        }
636        
637
638      }// if on isec < 13
639    }// end loop on sectors
640
641    //===================================================================================
642    //    Trigger: TriggerInclusive FULL WHEEL
643    //===================================================================================
644    TCanvas *Trigmatri = new TCanvas("TriggerMatrix", "",201,81,999,699);
645    Trigmatri->SetBottomMargin(0.12);
646
647    nbin = TriggerInclusive[iw]->GetXaxis()->GetNbins();
648    TriggerInclusive[iw]->GetXaxis()->SetRange(1,nbin);
649        
650    max = 0;
651
652    for (int ibin=1; ibin<nbin+1; ibin++)
653      max = (max > TriggerInclusive[iw]->GetBinContent(ibin) ) ? max : TriggerInclusive[iw]->GetBinContent(ibin) ;
654    max1=max*1.3;
655    TriggerInclusive[iw]->SetMaximum(max1);
656    TriggerInclusive[iw]->GetXaxis()->SetLabelSize(0.035);
657    TriggerInclusive[iw]->Draw();
658    
659    TPaveText* sid = new TPaveText (0,max1-(max1-max)/2,2,max1);
660  
661    stringstream chname; chname << "YB," << (iw-2) <<",";
662    sid->AddText(chname.str().c_str());
663    sid->Draw();
664    
665    createGifFile("TriggerInclusive",(iw-2),"",Trigmatri);
666    delete Trigmatri;
667    delete sid;
668        
669  }// end loop on wheels
670
456   }
457  
458   void DTDPGCreateAnalyzerSummary::createSummaryWheelPlots() {
# Line 676 | Line 461 | void DTDPGCreateAnalyzerSummary::createS
461    string SLname[3]={"Phi1","Theta","Phi2"};
462    
463    TH1F *historun   = getHisto<TH1F>("RunInfo_RunNumbers");
464 <  float TotEntries = historun->GetEntries();
464 >  float TotEntries = 999999999.; // It was happen sometime that this histo was not created.
465 >                                 // to protect from this problem
466 >  if(historun != NULL) TotEntries = historun->GetEntries();
467 >  else {
468 >   for(int i=1;i<10;i++)cout << "WARNING!!!! histo RunInfo_RunNumbers was NOT FOUND " << endl;
469 >  }
470    
471    gStyle->SetTitleX(0.01);
472    gStyle->SetTitleY(0.99);
473    
684  gStyle->SetOptStat(10);
685  gStyle->SetStatY(0.97);
686  gStyle->SetStatX(0.98);
687  gStyle->SetStatW(0.35);
688  gStyle->SetStatH(0.45);
689
474    gStyle->SetPalette(1);   // set palette for 2D histos
475    gStyle->SetTitleW(0.97);
476    gStyle->SetTitleH(0.1);
477  
478 +  gStyle->SetOptFit(1);
479 +  gStyle->SetOptStat(10);
480 +  gStyle->SetStatY(0.95); //92
481 +  gStyle->SetStatX(0.98);
482 +  gStyle->SetStatW(0.35); //45
483 +  gStyle->SetStatH(0.45); //85
484 +
485 +
486    TH1F * first_to_paint;
487  
696  float BXSummary_mean=0.;
697  float NBXSummary_mean=0.;
488    TH1F *BXSummary[5][4];
489    for(int iw=0;iw<5;iw++){ // Loop in wheels
490      for(int ic=1;ic<5;ic++){
# Line 710 | Line 500 | void DTDPGCreateAnalyzerSummary::createS
500  
501    
502  
503 < for(int iw=0;iw<5;iw++){ // Loop in wheels
503 > for(int iw=0;iw<5;iw++){ // Loop in wheels  
504  
505     edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Processing Wheel " << iw-2 << endl;
506     //    Digi scatter plots
# Line 722 | Line 512 | void DTDPGCreateAnalyzerSummary::createS
512     DQM2->Divide(2,3) ;
513     TCanvas *DQM2b = new TCanvas("DQM2b", "",201,81,999,699);
514     DQM2b->Divide(2,3) ;
515 +
516 +   TCanvas *ExtraS13S14 = new TCanvas("ExtraS13S14", "",201,81,1150,950);  
517 +   ExtraS13S14->Divide(2,4);
518 +   int iExtraPad=1;
519    
520      TH2F *hDigiXYList[14];
521    
522 <    for(int isec=1;isec<13;isec++){
522 >    for(int isec=1;isec<15;isec++){
523        stringstream histoname; histoname << "hDigiXY_" << Whname[iw] << "_S" << isec;
524 +      for(int iih=1;iih<25;++iih)
525        hDigiXYList[isec-1]= getHisto<TH2F>(histoname.str());
526      }
527    
528 <    float Max=2000;
528 >    float Max=3000;
529      float Max0[12];
530 <    float MaxMean=0;
530 >    //float MaxMean=0;
531      float MaxMean0=0;
532      float MaxRMS0=0;
533 <    float MaxRMS=0;
533 >    //float MaxRMS=0;
534      int Ns=0;
535      for(int is=0;is<12; is++){
536 +     if(hDigiXYList[is] != NULL)
537 +     {
538        Max0[is]=0;
539        Max0[is]=hDigiXYList[is]->GetMaximum();
540        if(Max0[is]>Max)Max=Max0[is];
541        if(Max0[is]>0){ MaxMean0+=Max0[is]; MaxRMS0+=Max0[is]*Max0[is];Ns++;}
542 +     }
543      }
544  
545 +
546      for(int is=0;is<12; is++){
547        if(is<6){DQM1->cd(is+1); DQM1->cd(is+1)->SetLogz();}
548        else  {DQM2->cd(is-5); DQM2->cd(is-5)->SetLogz();}
549 +     if(hDigiXYList[is] != NULL)
550 +     {
551        hDigiXYList[is]->SetStats(0);
552        hDigiXYList[is]->SetMaximum(Max);
553        hDigiXYList[is]->Draw("colz");
554 +     }
555      }
556  
557      createGifFile("Digi",(iw-2),"_S1-S6",DQM1);
558      createGifFile("Digi",(iw-2),"_S7_S12",DQM2);
559 +  
560 +    // MB4 S13 & S14  
561 +    for(int is=13;is<15; is++){
562 +      ExtraS13S14->cd(iExtraPad);iExtraPad++;
563 +      if(hDigiXYList[is-1] != NULL)
564 +      {
565 +       hDigiXYList[is-1]->SetStats(0);
566 +       hDigiXYList[is-1]->SetMaximum(Max);
567 +       hDigiXYList[is-1]->Draw("colz");
568 +      }
569 +    }
570  
571      if(Max>TotEntries){ // To cut noise cells and see better the
572                          // occupancies on other cells
573        for(int is=0;is<12; is++){
574 <        if(is<6){DQM1b->cd(is+1); DQM1b->cd(is+1)->SetLogz();}
575 <        else  {DQM2b->cd(is-5); DQM2b->cd(is-5)->SetLogz();}
576 <        hDigiXYList[is]->SetStats(0);
577 <        hDigiXYList[is]->SetMaximum(TotEntries);
578 <        hDigiXYList[is]->Draw("colz");
574 >          if(is<6){DQM1b->cd(is+1); DQM1b->cd(is+1)->SetLogz();}
575 >          else  {DQM2b->cd(is-5); DQM2b->cd(is-5)->SetLogz();}
576 >        if(hDigiXYList[is] != NULL)
577 >        {
578 >             hDigiXYList[is]->SetStats(0);
579 >             hDigiXYList[is]->SetMaximum(TotEntries);
580 >             hDigiXYList[is]->Draw("colz");
581 >        }
582        }
583        
584        createGifFile("Digi",(iw-2),"_S1-S6_b",DQM1b);
# Line 771 | Line 587 | void DTDPGCreateAnalyzerSummary::createS
587  
588      //    Ocupancies per SL    
589      // Get histos to be plotted
590 <    int nbin;
591 <    float max, max1;
592 <    TPaveText *sid;
777 <    char sid1[50]; char answ;
778 <    TPaveText *labcont[50]; TText *cont[50];
590 >    //int nbin;
591 >    //float max, max1;
592 >    //char sid1[50];
593      
594       // Occupancies
595      TH2F *DigiXYS[5][14];
# Line 803 | Line 617 | void DTDPGCreateAnalyzerSummary::createS
617      }
618      
619      for(int isec=1;isec<15;isec++){
620 +     if(DigiXYS[iw][isec-1] != NULL)
621 +     {
622        int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
623 <      int nby= DigiXYS[iw][isec-1]->GetNbinsY() ;
623 >      //int nby= DigiXYS[iw][isec-1]->GetNbinsY() ;
624      
625        for(int ich=1;ich<5;ich++){
626          for(int isl=1;isl<4;isl++){
# Line 829 | Line 645 | void DTDPGCreateAnalyzerSummary::createS
645            }
646          }
647        }
648 +     }
649      }// end loop sector
650  
651 <    //    DIGI's occupancies
652 <
653 <    TCanvas *Digi1 = new TCanvas("Digi1", "",201,81,999,699);  
654 <    TCanvas *Digi2 = new TCanvas("Digi2", "",201,81,999,699);  
838 <    TCanvas *Digi3 = new TCanvas("Digi3", "",201,81,999,699);  
839 <    Digi1->Divide(4,4); Digi2->Divide(4,4); Digi3->Divide(4,4);
651 >    TCanvas *Digi1 = new TCanvas("Digi1", "",201,81,1150,950);  
652 >    TCanvas *Digi2 = new TCanvas("Digi2", "",201,81,1150,950);  
653 >    TCanvas *Digi3 = new TCanvas("Digi3", "",201,81,1150,950);  
654 >    Digi1->Divide(4,12,0.00001,0.00001); Digi2->Divide(4,12,0.00001,0.00001); Digi3->Divide(4,12,0.00001,0.00001);
655      for(int isec=1;isec<13;isec++){ // Loop on sectors
656 <      for(int ich=1;ich<5;ich++){
656 >      gStyle->SetTitleW(0.25);
657 >      gStyle->SetTitleH(0.22);
658 >      gStyle->SetTitleX(0.72);
659 >      gStyle->SetTitleY(0.99);
660 >
661 >
662 >    for(int ich=1;ich<5;ich++){
663 >    for(int isl=1;isl<4;isl++){
664 >     if(!(ich==4 && isl==2)){ // avoid ThetaMB4
665          // look first for the maximum bin entries
666 <        first_to_paint=DigiXSecMBSl[iw][isec-1][ich-1][0];
667 <        float nbmax=DigiXSecMBSl[iw][isec-1][ich-1][0]->GetMaximum();
668 <        for(int isl=1;isl<4;isl++){
669 <          if(!(ich==4 && isl==2)){ // avoid ThetaMB4
847 <            float nbmax0=DigiXSecMBSl[iw][isec-1][ich-1][isl-1]->GetMaximum();
666 >        first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
667 >        float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
668 >        for(int il=1;il<5;il++){
669 >            float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
670              if(nbmax0>nbmax){
671 <              first_to_paint=DigiXSecMBSl[iw][isec-1][ich-1][isl-1];
671 >              first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
672                nbmax=nbmax0;
673              }
674 <            DigiXSecMBSl[iw][isec-1][ich-1][isl-1]->SetLineColor(isl);
853 <          }
674 >            DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
675          }
676 <        stringstream htitle; htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich;
676 >        stringstream htitle; htitle << "W" << (iw-2) << " S" << isec << " MB" << ich << " SL " << isl;
677          first_to_paint->SetTitle(htitle.str().c_str());
678 <        if(isec<5)           {int icpos=(isec-1)*4+ich; Digi1->cd(icpos) ; Digi1->cd(icpos)->SetLogy();}
679 <        if(isec>4 && isec<9) {int icpos=(isec-5)*4+ich; Digi2->cd(icpos) ; Digi2->cd(icpos)->SetLogy();}
680 <        if(isec>8 && isec<13){int icpos=(isec-9)*4+ich; Digi3->cd(icpos) ; Digi3->cd(icpos)->SetLogy();}
681 <        first_to_paint->GetYaxis()->SetLabelSize(0.07);
682 <        first_to_paint->GetXaxis()->SetLabelSize(0.07);
678 >        if(isec<5)           {int icpos=(ich-1)*3*4+(isl-1)*4+isec;     Digi1->cd(icpos) ; Digi1->cd(icpos)->SetBottomMargin(0.15) ; Digi1->cd(icpos)->SetLeftMargin(0.15) ; Digi1->cd(icpos)->SetLogy();}
679 >        if(isec>4 && isec<9) {int icpos=(ich-1)*3*4+(isl-1)*4+(isec-4); Digi2->cd(icpos) ; Digi2->cd(icpos)->SetBottomMargin(0.15) ; Digi2->cd(icpos)->SetLeftMargin(0.15) ; Digi2->cd(icpos)->SetLogy();}
680 >        if(isec>8 && isec<13){int icpos=(ich-1)*3*4+(isl-1)*4+(isec-8); Digi3->cd(icpos) ; Digi3->cd(icpos)->SetBottomMargin(0.15) ; Digi3->cd(icpos)->SetLeftMargin(0.15) ; Digi3->cd(icpos)->SetLogy();}
681 >        first_to_paint->GetYaxis()->SetLabelSize(0.14);
682 >        first_to_paint->GetXaxis()->SetLabelSize(0.14);
683 >        first_to_paint->SetStats(0);
684          first_to_paint->Draw();
685 <        for(int isl=1;isl<4;isl++){
686 <          if(!(ich==4 && isl==2)) // avoid ThetaMB4
687 <            DigiXSecMBSl[iw][isec-1][ich-1][isl-1]->Draw("same");
688 <        }
689 <      }
685 >        for(int il=1;il<5;il++)
686 >            DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
687 >     }
688 >      
689 >     if(ich==4 && isl !=2)
690 >     {
691 >       if(isec ==4 || isec ==10)
692 >       {
693 >        int isec_extra=13;
694 >        if (isec ==10)isec_extra=14;
695 >        ExtraS13S14->cd(iExtraPad); iExtraPad++;
696 >          DigiXSecMBSlLayer[iw][isec_extra-1][ich-1][isl-1][0]->Draw();
697 >          for(int il=2;il<5;il++)
698 >        {
699 >          DigiXSecMBSlLayer[iw][isec_extra-1][ich-1][isl-1][il-1]->SetLineColor(il);
700 >          DigiXSecMBSlLayer[iw][isec_extra-1][ich-1][isl-1][il-1]->Draw("same");
701 >        }
702 >       }
703 >     }
704 >
705 >    }// End Loop in  SLs
706 >    }// End Loop in Chambers
707      }// End Loop on sectors
708      createGifFile("Occupancies_LogScale",(iw-2),"_S1-S4",Digi1);
709      createGifFile("Occupancies_LogScale",(iw-2),"_S5-S8",Digi2);
710      createGifFile("Occupancies_LogScale",(iw-2),"_S9-S12",Digi3);
711  
712 +  gStyle->SetTitleX(0.01);
713 +  gStyle->SetTitleY(0.99);
714 +  gStyle->SetTitleW(0.97);
715 +  gStyle->SetTitleH(0.1);
716 +
717      //    TimeBoxes        
718 <    DQM1->Clear();
719 <    DQM1->Divide(6,2) ;
720 <    for (int ins=1; ins<13;ins++){
721 <      TH1F *hHisto[4];
718 >
719 >    TCanvas *TB1 = new TCanvas("TB1", "",201,81,999,999);
720 >    TCanvas *TB2 = new TCanvas("TB2", "",201,81,999,999);
721 >    TB1->Divide(4,6,0.00001,0.00001) ;
722 >    TB2->Divide(4,6,0.00001,0.00001) ;
723 >    for (int ins=1; ins<13;ins++)
724 >    for(int ic=1;ic<5;ic++){
725 >      TH1F *hHisto[3];
726        int nbmax=0;
727        int nbmax0=0;
728  
729 <      DQM1->cd(ins);
730 <      for(int ic=1;ic<5;ic++){
731 <        stringstream hname; hname << "htime_" << Whname[iw] << "_S" << ins << "_MB" << ic;
732 <        hHisto[ic-1]=getHisto<TH1F>(hname.str());
733 <        hHisto[ic-1]->SetLineColor(ic);
729 >
730 >      for(int isl=1;isl<4;isl++){
731 >        stringstream hname; hname << "htime_" << Whname[iw] << "_S" << ins << "_MB" << ic << "_SL" << isl;
732 >        hHisto[isl-1]=getHisto<TH1F>(hname.str());
733 >        if(hHisto[isl-1] !=NULL) hHisto[isl-1]->SetLineColor(isl);
734        }
735  
736        first_to_paint = hHisto[0];
737 <      nbmax=hHisto[0]->GetMaximum();
737 >      if(first_to_paint !=NULL)nbmax=hHisto[0]->GetMaximum();
738  
739 <      for(int ic=2;ic<5;ic++){
740 <        nbmax0=hHisto[ic-1]->GetMaximum();
739 >      for(int isl=2;isl<4;isl++){
740 >       if(hHisto[isl-1] !=NULL)
741 >       {
742 >        nbmax0=hHisto[isl-1]->GetMaximum();
743          if(nbmax0>nbmax){
744            nbmax=nbmax0;
745 <          first_to_paint=hHisto[ic-1];
745 >          first_to_paint=hHisto[isl-1];
746 >        }
747 >       }
748 >      }
749 >
750 >      if(ins<7)
751 >      {
752 >         int icpos=(ins-1)*4+ic;
753 >         TB1->cd(icpos);
754 >         TB1->cd(icpos)->SetLeftMargin(0.20);
755 >      }
756 >      else  
757 >      {
758 >         int icpos=(ins-7)*4+ic;
759 >         TB2->cd(icpos);
760 >         TB2->cd(icpos)->SetLeftMargin(0.20);
761 >      }
762 >
763 >      if(first_to_paint != NULL)
764 >      {
765 >        first_to_paint->GetYaxis()->SetLabelSize(0.08);
766 >        first_to_paint->GetXaxis()->SetLabelSize(0.08);
767 >        first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
768 >        first_to_paint->GetXaxis()->SetTitle("ns");
769 >        first_to_paint->GetXaxis()->SetTitleSize(0.09);
770 >        first_to_paint->GetXaxis()->SetTitleOffset(0.5);
771 >        first_to_paint->GetXaxis()->SetNdivisions(308);
772 >        //char htit[240];
773 >        stringstream htitle; htitle << "TimeBox W" << iw-2 << " S" << ins << " MB"<< ic;
774 >        first_to_paint->SetTitle(htitle.str().c_str());
775 >        first_to_paint->Draw();
776 >        for(int isl=1;isl<4;isl++) hHisto[isl-1]->Draw("same");
777 >      }
778 >
779 >      if(ic==4)
780 >      {
781 >       if(ins==4 || ins==10)
782 >       {
783 >        int isec_extra=13;
784 >        if (ins ==10)isec_extra=14;
785 >        TH1F *hHisto_extra[3];
786 >        for(int isl=1;isl<4;isl++){
787 >          stringstream hname; hname << "htime_" << Whname[iw] << "_S" << isec_extra << "_MB" << ic << "_SL" << isl;
788 >          hHisto_extra[isl-1]=getHisto<TH1F>(hname.str());
789 >          if(hHisto_extra[isl-1] != NULL) hHisto_extra[isl-1]->SetLineColor(isl);
790 >        }
791 >        ExtraS13S14->cd(iExtraPad); iExtraPad++;
792 >        int nbmax=0;
793 >        first_to_paint=hHisto_extra[0];
794 >        if(first_to_paint !=NULL)nbmax=hHisto[0]->GetMaximum();
795 >        for(int isl=2;isl<4;isl++){
796 >         if(hHisto[isl-1] !=NULL)
797 >         {
798 >          int nbmax0=hHisto[isl-1]->GetMaximum();
799 >          if(nbmax0>nbmax)
800 >           { nbmax=nbmax0; first_to_paint=hHisto[isl-1];}
801 >         }
802 >        }
803 >
804 >        if(first_to_paint!=NULL)
805 >        {
806 >          stringstream nhtitle; nhtitle << "TimeBox W" << iw-2 << " S" << isec_extra << " MB"<< ic;
807 >          first_to_paint->SetTitle(nhtitle.str().c_str());
808 >          first_to_paint->Draw();
809 >          for(int isl=1;isl<4;isl++) hHisto_extra[isl-1]->Draw("same");
810          }
811 +       }
812        }
813 +        
814 +    }// end loop on sectors & Chambers
815 +    createGifFile("TBox_S1_S6",(iw-2),"",TB1);
816 +    createGifFile("TBox_S7_S12",(iw-2),"",TB2);
817 +
818 +    createGifFile("MB4S13S14Plots",(iw-2),"",ExtraS13S14);
819  
899      first_to_paint->GetXaxis()->SetLabelSize(0.08);
900      first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
901      first_to_paint->GetXaxis()->SetTitle("cm");
902      first_to_paint->GetXaxis()->SetTitleSize(0.09);
903      first_to_paint->GetXaxis()->SetTitleOffset(0.5);
904      first_to_paint->GetXaxis()->SetNdivisions(308);
905      char htit[240];
906      stringstream htitle; htitle << "TimeBox W" << iw-2 << " S" << ins;
907      first_to_paint->SetTitle(htitle.str().c_str());
908      first_to_paint->Draw();
909      for(int ic=1;ic<5;ic++)hHisto[ic-1]->Draw("same");
910      
911    }// end loop on sectors
912    stringstream fileTBox; fileTBox <<"TBox_r" << myRunNumber <<"_W" << (iw-2);
913    createGifFile("TBox",(iw-2),"",DQM1);
820  
821      //    Hit Residuals        
822      DQM1->Clear();
# Line 919 | Line 825 | void DTDPGCreateAnalyzerSummary::createS
825      for(int ins=1;ins<13; ins++){
826        TH1F *hHisto[4];
827        DQM1->cd(ins);
828 +      DQM1->cd(ins)->SetLeftMargin(0.20);
829  
830        int nbmax=0;
831        int nbmax0=0;
# Line 940 | Line 847 | void DTDPGCreateAnalyzerSummary::createS
847          }
848        }
849        
850 +      first_to_paint->GetYaxis()->SetLabelSize(0.08);
851        first_to_paint->GetXaxis()->SetLabelSize(0.08);
852        first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
853        first_to_paint->GetXaxis()->SetTitle("cm");
# Line 952 | Line 860 | void DTDPGCreateAnalyzerSummary::createS
860        first_to_paint->Draw();
861        for(int ic=1;ic<5;ic++)
862          hHisto[ic-1]->Draw("same");
863 +
864      }// end loop on sectors
865  
866      createGifFile("HitResiduals",(iw-2),"",DQM1);
# Line 963 | Line 872 | void DTDPGCreateAnalyzerSummary::createS
872      for (int ins=1; ins<13;ins++){
873        TH1F *hPhi[4];
874        DQM1->cd(ins);
875 +      DQM1->cd(ins)->SetLeftMargin(0.20);
876        int nbmax=0;
877        int nbmax0=0;
878        
# Line 983 | Line 893 | void DTDPGCreateAnalyzerSummary::createS
893          }
894        }
895  
896 +      first_to_paint->GetYaxis()->SetLabelSize(0.08);
897        first_to_paint->GetXaxis()->SetLabelSize(0.08);
898        first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
899        first_to_paint->GetXaxis()->SetTitle("deg");
# Line 1004 | Line 915 | void DTDPGCreateAnalyzerSummary::createS
915      DQM1->Clear();
916      
917      stringstream hnameSTADigi; hnameSTADigi << "hHitsPosXYSA_" << Whname[iw];
1007    TH1F *hXYHisto=getHisto<TH1F>(hnameSTADigi.str());;
1008    
1009    hXYHisto->SetStats(0);
1010    hXYHisto->Draw("colz");
918  
919 <    
920 <    createGifFile("STADigi",(iw-2),"",DQM1);
919 >    // STA Plots created only on demand they could not exist
920 >    TH1F *hXYHisto=force_getHisto<TH1F>(hnameSTADigi.str());;
921 >    if(hXYHisto)
922 >    {
923 >      hXYHisto->SetStats(0);
924 >      hXYHisto->Draw("colz");
925 >
926 >      createGifFile("STADigi",(iw-2),"",DQM1);
927 >    }
928 >    else
929 >       edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: STA histo "
930 >            << hnameSTADigi.str() << " not present, skiping STADigi gif file" << endl;
931  
932  
933      //    STA Phi Hits    
934      TCanvas *DQM6 = new TCanvas("DQM6", "",301,81,999,699); // open a large canvas
935      TH1F *hnHitDT= getHisto<TH1F>("hnHitDT");
936 <    Float_t Nevents = hnHitDT->GetEntries();
937 <    edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Total nr. of triggers:" << Nevents << endl;
938 <
939 <    TH1F *hPhiHisto[4];
940 <    TH1F *heff[4];
941 <
942 <    float ymax = 0.1;
943 <    for(int ic=1;ic<5;ic++){
944 <      stringstream hname1, hname2, htitle;
936 >    //int hh=0;
937 >    if(hnHitDT != NULL)
938 >    {
939 >       Float_t Nevents = hnHitDT->GetEntries();
940 >       edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Total nr. of triggers:" << Nevents << endl;
941 >      
942 >       TH1F *hPhiHisto[4];
943 >       TH1F *heff[4];
944 >      
945 >       bool doSTAPhiHits=false;
946 >       //float ymax = 0.1;
947 >       float ymax = 0.0;
948 >       for(int ic=1;ic<5;ic++){
949 >         stringstream hname1, hname2, htitle;
950 >      
951 >         hname1 << "hPhiHit_" << Whname[iw] << "_MB" << ic;
952 >         // STA Plots created only on demand they could not exist
953 >         hPhiHisto[ic-1]=force_getHisto<TH1F>(hname1.str());
954 >        
955 >         if(hPhiHisto[ic-1])
956 >         {
957 >           doSTAPhiHits=true;
958 >           hname2 << "heff" << ic;
959 >           heff[ic-1] =(TH1F*) hPhiHisto[ic-1]->Clone(hname2.str().c_str());
960 >           heff[ic-1]->Add(heff[ic-1],heff[ic-1],0.5/Nevents,0.5/Nevents);
961 >          
962 >           float nbmax=heff[ic-1]->GetMaximum();
963 >           if(nbmax>ymax)ymax=nbmax;
964 >           heff[ic-1]->SetStats(0);
965 >           heff[ic-1]->SetLineColor(ic);
966 >           htitle << "Phi of ass. hit, W" << (iw-2);
967 >           heff[0]->SetTitle(htitle.str().c_str());
968 >         }
969 >        
970 >       }
971 >       ymax=ymax*1.1;
972 >       for(int ic=1;ic<5;ic++){
973 >         if(hPhiHisto[ic-1])
974 >         {
975 >           heff[ic-1]->SetMaximum(ymax);
976 >           if(ic==1)heff[ic-1]->Draw();
977 >           else   heff[ic-1]->Draw("same");
978 >         }
979 >       }
980  
981 <      hname1 << "hPhiHit_" << Whname[iw] << "_MB" << ic;
982 <      hPhiHisto[ic-1]=getHisto<TH1F>(hname1.str());
983 <      
984 <      hname2 << "heff" << ic;
985 <      heff[ic-1] =(TH1F*) hPhiHisto[ic-1]->Clone(hname2.str().c_str());
986 <      heff[ic-1]->Add(heff[ic-1],heff[ic-1],0.5/Nevents,0.5/Nevents);
987 <      
988 <      heff[ic-1]->SetMaximum(ymax);
989 <      heff[ic-1]->SetStats(0);
990 <      heff[ic-1]->SetLineColor(ic);
991 <      htitle << "Phi of ass. hit, W" << (iw-2);
992 <      heff[0]->SetTitle(htitle.str().c_str());
993 <      if(ic==1)heff[ic-1]->Draw();
994 <      else   heff[ic-1]->Draw("same");
995 <      
981 >       TLine *l[16];
982 >       l[0] = new TLine(-165, 0, -165, ymax); l[0]->Draw();
983 >       l[1] = new TLine(-135, 0, -135, ymax); l[1]->Draw();
984 >       l[2] = new TLine(-105, 0, -105, ymax); l[2]->Draw();
985 >       l[3] = new TLine( -75, 0,  -75, ymax); l[3]->Draw();
986 >       l[4] = new TLine( -45, 0,  -45, ymax); l[4]->Draw();
987 >       l[5] = new TLine( -15, 0,  -15, ymax); l[5]->Draw();
988 >       l[6] = new TLine(  15, 0,   15, ymax); l[6]->Draw();
989 >       l[7] = new TLine(  45, 0,   45, ymax); l[7]->Draw();
990 >       l[8] = new TLine(  75, 0,   75, ymax); l[8]->Draw();
991 >       l[9] = new TLine( 105, 0,  105, ymax); l[9]->Draw();
992 >       l[10] = new TLine( 135, 0,  135, ymax); l[10]->Draw();
993 >       l[11] = new TLine( 165, 0,  165, ymax); l[11]->Draw();
994 >      
995 >       l[12] = new TLine( -40, 0.8*ymax,  -20, 0.8*ymax); //l->Draw();
996 >       l[12]->SetLineColor(1);
997 >       l[12]->Draw();
998 >       TPaveLabel * box [4];
999 >       box[0] = new TPaveLabel(-10,0.8*ymax,5,0.85*ymax,"MB1");
1000 >       box[0]->Draw();
1001 >      
1002 >       l[13] = new TLine( -40, 0.7*ymax,  -20, 0.7*ymax); //l->Draw();
1003 >       l[13]->SetLineColor(2);
1004 >       l[13]->Draw();
1005 >       box[1] = new TPaveLabel(-10,0.7*ymax,5,0.75*ymax,"MB2");
1006 >       box[1]->Draw();
1007 >      
1008 >       l[14] = new TLine( -40, 0.6*ymax,  -20, 0.6*ymax); //l->Draw();
1009 >       l[14]->SetLineColor(3);
1010 >       l[14]->Draw();
1011 >       box[2] = new TPaveLabel(-10,0.6*ymax,5,0.65*ymax,"MB3");
1012 >       box[2]->Draw();
1013 >      
1014 >       l[15] = new TLine( -40, 0.5*ymax,  -20, 0.5*ymax); //l->Draw();
1015 >       l[15]->SetLineColor(4);
1016 >       l[15]->Draw();
1017 >       box[3] = new TPaveLabel(-10,0.5*ymax,5,0.55*ymax,"MB4");
1018 >       box[3]->Draw();
1019 >      
1020 >       if(doSTAPhiHits) createGifFile("STAPhiHits",(iw-2),"",DQM6);
1021 >      
1022 >       for (int i=0;i<16;++i) delete l[i];
1023 >       for (int i=0;i<4;++i) delete box[i];
1024      }
1025  
1046    TLine *l[16];
1047    l[0] = new TLine(-165, 0, -165, ymax); l[0]->Draw();
1048    l[1] = new TLine(-135, 0, -135, ymax); l[1]->Draw();
1049    l[2] = new TLine(-105, 0, -105, ymax); l[2]->Draw();
1050    l[3] = new TLine( -75, 0,  -75, ymax); l[3]->Draw();
1051    l[4] = new TLine( -45, 0,  -45, ymax); l[4]->Draw();
1052    l[5] = new TLine( -15, 0,  -15, ymax); l[5]->Draw();
1053    l[6] = new TLine(  15, 0,   15, ymax); l[6]->Draw();
1054    l[7] = new TLine(  45, 0,   45, ymax); l[7]->Draw();
1055    l[8] = new TLine(  75, 0,   75, ymax); l[8]->Draw();
1056    l[9] = new TLine( 105, 0,  105, ymax); l[9]->Draw();
1057    l[10] = new TLine( 135, 0,  135, ymax); l[10]->Draw();
1058    l[11] = new TLine( 165, 0,  165, ymax); l[11]->Draw();
1059
1060    l[12] = new TLine( -40, 0.8*ymax,  -20, 0.8*ymax); //l->Draw();
1061    l[12]->SetLineColor(1);
1062    l[12]->Draw();
1063    TPaveLabel * box [4];
1064    box[0] = new TPaveLabel(-10,0.8*ymax,5,0.85*ymax,"MB1");
1065    box[0]->Draw();
1066
1067    l[13] = new TLine( -40, 0.7*ymax,  -20, 0.7*ymax); //l->Draw();
1068    l[13]->SetLineColor(2);
1069    l[13]->Draw();
1070    box[1] = new TPaveLabel(-10,0.7*ymax,5,0.75*ymax,"MB2");
1071    box[1]->Draw();
1072
1073    l[14] = new TLine( -40, 0.6*ymax,  -20, 0.6*ymax); //l->Draw();
1074    l[14]->SetLineColor(3);
1075    l[14]->Draw();
1076    box[2] = new TPaveLabel(-10,0.6*ymax,5,0.65*ymax,"MB3");
1077    box[2]->Draw();
1078    
1079    l[15] = new TLine( -40, 0.5*ymax,  -20, 0.5*ymax); //l->Draw();
1080    l[15]->SetLineColor(4);
1081    l[15]->Draw();
1082    box[3] = new TPaveLabel(-10,0.5*ymax,5,0.55*ymax,"MB4");
1083    box[3]->Draw();
1084    
1085    createGifFile("STAPhiHits",(iw-2),"",DQM6);
1086
1087    for (int i=0;i<16;++i) delete l[i];
1088    for (int i=0;i<4;++i) delete box[i];
1089
1026      //    STA Hits    
1027      DQM1->Clear();
1028      DQM1->Divide(6,2) ;
# Line 1095 | Line 1031 | void DTDPGCreateAnalyzerSummary::createS
1031  
1032      for(int isec=1;isec<13;isec++){
1033        stringstream histoname; histoname << "hNhass_" << Whname[iw] << "_S" << isec;
1034 <      hNassList[isec-1]=getHisto<TH1F>(histoname.str());
1034 >      hNassList[isec-1]=force_getHisto<TH1F>(histoname.str());
1035      }
1036  
1037  
1038 +    bool doSTAHits=false;
1039      for(int is=0;is<12;is++){
1040 +     if(hNassList[is])
1041 +     {
1042 +      doSTAHits=true;
1043 +      hNassList[is]->GetYaxis()->SetLabelSize(0.08);
1044        hNassList[is]->GetXaxis()->SetNdivisions(308);
1045        hNassList[is]->GetXaxis()->SetLabelSize(0.08);
1046        hNassList[is]->GetXaxis()->SetLabelOffset(-0.025);
# Line 1108 | Line 1049 | void DTDPGCreateAnalyzerSummary::createS
1049        hNassList[is]->GetXaxis()->SetTitleOffset(0.5);
1050        
1051        DQM1->cd(is+1);
1052 +      DQM1->cd(is+1)->SetLeftMargin(0.20);
1053        hNassList[is]->SetStats(1);
1054        hNassList[is]->Draw();
1055 +     }
1056      }
1057  
1058 <    createGifFile("STAHits",(iw-2),"",DQM1);
1058 >    if(doSTAHits) createGifFile("STAHits",(iw-2),"",DQM1);
1059  
1060  
1061      //    Segment Hits    
# Line 1122 | Line 1065 | void DTDPGCreateAnalyzerSummary::createS
1065      TH1F *hNhits[12][4];
1066      for (int ins=1; ins<13;ins++){
1067        DQM2->cd(ins);
1068 +      DQM2->cd(ins)->SetLeftMargin(0.20);
1069        int nbmax=0;
1070        int nbmax0=0;
1071        
# Line 1142 | Line 1086 | void DTDPGCreateAnalyzerSummary::createS
1086          }
1087        }
1088  
1089 +      first_to_paint->GetYaxis()->SetLabelSize(0.08);
1090        first_to_paint->GetXaxis()->SetLabelSize(0.08);
1091        first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
1092        first_to_paint->GetXaxis()->SetTitle("#hits");
# Line 1153 | Line 1098 | void DTDPGCreateAnalyzerSummary::createS
1098  
1099        first_to_paint->Draw();
1100        for(int ic=1;ic<5;ic++) hNhits[ins-1][ic-1]->Draw( "same");
1101 <      
1101 >
1102      }// end loop on sectors
1103  
1104  
1105      createGifFile("SegHits",(iw-2),"",DQM2);
1106  
1107 +
1108      //    Segment Hits    
1109      DQM1->Clear();
1110      DQM1->Divide(6,2);
# Line 1171 | Line 1117 | void DTDPGCreateAnalyzerSummary::createS
1117      
1118      for(int is=0;is<12;is++){
1119        DQM1->cd(is+1);
1120 +      DQM1->cd(is+1)->SetLeftMargin(0.20);
1121 +      hNsegsList[is]->GetYaxis()->SetLabelSize(0.08);
1122        hNsegsList[is]->GetXaxis()->SetNdivisions(308);
1123        hNsegsList[is]->GetXaxis()->SetLabelSize(0.08);
1124        hNsegsList[is]->GetXaxis()->SetLabelOffset(-0.025);
1125        hNsegsList[is]->GetXaxis()->SetTitleSize(0.09);
1126        hNsegsList[is]->GetXaxis()->SetTitleOffset(0.5);
1127        hNsegsList[is]->SetStats(1);
1128 +      hNsegsList[is]->GetXaxis()->SetRangeUser(1.,10.);
1129        hNsegsList[is]->Draw();
1130      }
1131      
# Line 1184 | Line 1133 | void DTDPGCreateAnalyzerSummary::createS
1133  
1134      //    TMAX
1135      
1136 +
1137 +    gStyle->SetOptStat(10);
1138 +    gStyle->SetStatY(0.95);
1139 +    gStyle->SetStatX(0.98);
1140 +    gStyle->SetStatW(0.35);
1141 +    gStyle->SetStatH(0.45);
1142 +
1143      TCanvas *DQM11 = new TCanvas("DQM11", "1",101,81,999,699);
1144      TCanvas *DQM12 = new TCanvas("DQM12", "2",101,81,999,699);
1145      TCanvas *DQM13 = new TCanvas("DQM13", "3",101,81,999,699);
# Line 1193 | Line 1149 | void DTDPGCreateAnalyzerSummary::createS
1149      DQM13->Divide(4,3) ;
1150      DQM14->Divide(4,3) ;
1151  
1152 +
1153      for (int ins=1; ins<13;ins++){
1154        TH1F *hHisto[2];
1155        for(int ic=1;ic<5;ic++){
1156  
1157 +
1158          stringstream hname; hname << "htmax_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1159          hHisto[0]= getHisto<TH1F>(hname.str()+"_SL1");
1160          hHisto[1]= getHisto<TH1F>(hname.str()+"_SL3");
# Line 1219 | Line 1177 | void DTDPGCreateAnalyzerSummary::createS
1177          }
1178  
1179          hHisto[0]->SetStats(1);
1180 +        gStyle->SetOptFit(1);
1181          hHisto[0]->Draw();
1182 +        if(hHisto[0]->GetEntries()>50) // Problems on version 31X when no entries or few entries
1183          try {
1184            hHisto[0]->Fit("gaus","Q");
1185 +          hHisto[0]->Draw("same");
1186          } catch(const cms::Exception&) {
1187            edm::LogError("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]:  Error fitting " << hname.str() << "_SL1";
1188          }
# Line 1230 | Line 1191 | void DTDPGCreateAnalyzerSummary::createS
1191        }// end loop on chambers
1192      }// end loop on sectors
1193  
1194 <    createGifFile("TMax",(iw-2),"S1-S3",DQM11);
1195 <    createGifFile("TMax",(iw-2),"S4-S6",DQM12);
1196 <    createGifFile("TMax",(iw-2),"S7-S9",DQM13);
1197 <    createGifFile("TMax",(iw-2),"S10-S12",DQM14);
1198 <
1194 >    createGifFile("TMax",(iw-2),"S1-S3",DQM11,true);
1195 >    createGifFile("TMax",(iw-2),"S4-S6",DQM12,true);
1196 >    createGifFile("TMax",(iw-2),"S7-S9",DQM13,true);
1197 >    createGifFile("TMax",(iw-2),"S10-S12",DQM14,true);
1198 >
1199 >     gStyle->SetOptStat(10);
1200 >     gStyle->SetStatY(0.95); //92
1201 >     gStyle->SetStatX(0.98);
1202 >     gStyle->SetStatW(0.35); //45
1203 >     gStyle->SetStatH(0.45); //85
1204  
1205      //    Phi-Trig Efficiency
1206      TCanvas *Eff = new TCanvas("Eff", "",201,81,999,699);
# Line 1247 | Line 1213 | void DTDPGCreateAnalyzerSummary::createS
1213        hHisto[ic-1]= getHisto<TH1F>(hname1.str());
1214  
1215        stringstream hname2; hname2 << "heff" << ic <<"x";
1250      //heffx[ic-1]=hHisto[ic-1]->Clone(hname);
1216        heffx[ic-1] =(TH1F*) hHisto[ic-1]->Clone(hname2.str().c_str());
1217        heffx[ic-1]->SetLineColor(ic);
1218        
# Line 1274 | Line 1239 | void DTDPGCreateAnalyzerSummary::createS
1239        else heffx[ic-1]->Draw("same");
1240      }
1241  
1242 <    ymax = 1.;
1242 >    float ymax = 1.;
1243 >    TLine *l[16];
1244      l[0] = new TLine(-165, 0, -165, ymax); l[0]->Draw();
1245      l[1] = new TLine(-135, 0, -135, ymax); l[1]->Draw();
1246      l[2] = new TLine(-105, 0, -105, ymax); l[2]->Draw();
# Line 1288 | Line 1254 | void DTDPGCreateAnalyzerSummary::createS
1254      l[10] = new TLine( 135, 0,  135, ymax); l[10]->Draw();
1255      l[11] = new TLine( 165, 0,  165, ymax); l[11]->Draw();
1256      
1257 <    createGifFile("TrigEff",(iw-2),"",Eff);
1292 <
1293 <    for (int i=0;i<12;++i) delete l[i];
1294 <    
1295 <    //    Segment Hits    
1296 <    DQM1->Clear();
1297 <    DQM1->Divide(6,2) ;
1298 <    
1299 <    for (int ins=1; ins<13;ins++){
1300 <     TH1F *hHisto[4];
1301 <     DQM1->cd(ins);
1302 <
1303 <     int nbmax=0;
1304 <     int nbmax0=0;
1305 <
1306 <
1307 <     for(int ic=1;ic<5;ic++){
1308 <       stringstream hname; hname << "hTrigBits_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1309 <       hHisto[ic-1]= getHisto<TH1F>(hname.str());
1310 <       hHisto[ic-1]->SetLineColor(ic);
1311 <     }
1312 <
1313 <     first_to_paint = hHisto[0];
1314 <     nbmax=hHisto[0]->GetMaximum();
1315 <
1316 <     for(int ic=2;ic<5;ic++){
1317 <       nbmax0=hHisto[ic-1]->GetMaximum();
1318 <       if(nbmax0>nbmax){
1319 <         nbmax=nbmax0;
1320 <         first_to_paint=hHisto[ic-1];
1321 <       }
1322 <     }
1323 <     first_to_paint->GetXaxis()->SetLabelSize(0.08);
1324 <     first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
1325 <     first_to_paint->GetXaxis()->SetTitle("Quality");
1326 <     first_to_paint->GetXaxis()->SetTitleSize(0.09);
1327 <     first_to_paint->GetXaxis()->SetTitleOffset(0.5);
1328 <     first_to_paint->GetXaxis()->SetNdivisions(308);
1329 <     stringstream htitle; htitle << "Highest trig qual W" << (iw-2) << " S" << ins;
1330 <     first_to_paint->SetTitle(htitle.str().c_str());
1331 <    
1332 <     first_to_paint->Draw();
1333 <     for(int ic=1;ic<5;ic++)
1334 <       hHisto[ic-1]->Draw("same");
1335 <    
1336 <    }// end loop on sectors
1337 <
1338 <    createGifFile("TrigHighQual",(iw-2),"",DQM1);
1339 <
1340 <
1341 <    //   SC BX Summary
1342 <    TCanvas *BX = new TCanvas("BX", "",201,81,999,699);
1343 <    BX->Divide(6,2);
1344 <    for(int ins=1;ins<13;ins++){ // Loop in sectors
1345 <    
1346 <     int nbmax=0;
1347 <     int nbmax0=0;
1257 >    createGifFile("TrigEff",(iw-2),"",Eff,true);
1258  
1259 <     TH1F *hHH[4];
1350 <     TH1F *hHL[4];
1351 <     BX->cd(ins);
1352 <     BX->cd(ins)->SetLogy();
1353 <     for(int ic=1;ic<5;ic++){ // Loop in chambers
1354 <    
1355 <       stringstream hname; hname << "hTrigBX_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1356 <       hHH[ic-1]= getHisto<TH1F>(hname.str()+"_qual6");
1357 <       hHL[ic-1]= getHisto<TH1F>(hname.str()+"_qual5");
1358 <
1359 <       hHH[ic-1]->Add(hHL[ic-1]);
1360 <       hHH[ic-1]->SetLineColor(ic);
1361 <       hHH[ic-1]->SetStats(0);
1362 <     } // end loop in chambers
1363 <    
1364 <     first_to_paint = hHH[0];
1365 <     nbmax=hHH[0]->GetMaximum();
1366 <     first_to_paint->Draw();
1367 <
1368 <     for(int ic=2;ic<5;ic++){
1369 <       nbmax0=hHH[ic-1]->GetMaximum();
1370 <       if(nbmax0>nbmax){
1371 <         nbmax=nbmax0;
1372 <         first_to_paint=hHH[ic-1];
1373 <       }
1374 <     }
1375 <
1376 <     first_to_paint->GetXaxis()->SetLabelSize(0.08);
1377 <     first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
1378 <     first_to_paint->GetXaxis()->SetTitle("Slot");
1379 <     first_to_paint->GetXaxis()->SetTitleSize(0.09);
1380 <     first_to_paint->GetXaxis()->SetTitleOffset(0.5);
1381 <     first_to_paint->GetXaxis()->SetNdivisions(308);
1382 <     stringstream htitle; htitle << "BX for HH,HL W" << (iw-2) << " S" << ins;
1383 <     first_to_paint->SetTitle(htitle.str().c_str());
1384 <
1385 <     first_to_paint->Draw();
1386 <     for(int ic=1;ic<5;ic++)
1387 <       hHH[ic-1]->Draw("same");
1388 <    
1389 <    }// end Loop in sectors
1390 <    
1391 <    createGifFile("TrigBXhhhl",(iw-2),"",BX);
1259 > //     for (int i=0;i<12;++i) delete l[i];
1260  
1261 +    delete TB1;
1262 +    delete TB2;
1263      delete DQM1;
1264      delete DQM2;
1265      delete DQM1b;
# Line 1403 | Line 1273 | void DTDPGCreateAnalyzerSummary::createS
1273      delete DQM12;
1274      delete DQM13;
1275      delete DQM14;
1276 +
1277      delete Eff;
1278 <    delete BX;
1278 >    delete ExtraS13S14;
1279  
1280   }// END loop in wheels
1281 +
1282      
1283   }
1284    
1285  
1286   void DTDPGCreateAnalyzerSummary::createSummaryAllPlots() {
1415  
1287    string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
1288 <  
1288 >
1289 >  gStyle->SetTitleW(0.55);
1290 >  gStyle->SetTitleH(0.13);
1291    gStyle->SetTitleX(0.01);
1292    gStyle->SetTitleY(0.99);
1293    
# Line 1423 | Line 1296 | void DTDPGCreateAnalyzerSummary::createS
1296    gStyle->SetStatX(0.98);
1297    gStyle->SetStatW(0.35);
1298    gStyle->SetStatH(0.45);
1299 <  
1300 <  gStyle->SetPalette(1);   // set palette for 2D histos
1301 <  gStyle->SetTitleW(0.97);
1302 <  gStyle->SetTitleH(0.1);
1303 <  
1304 <  float BXSummary_mean=0.;
1305 <  float NBXSummary_mean=0.;
1306 <  TH1F * BXSummary[5][4];
1307 <  for(int iw=0;iw<5;iw++){ // Loop in wheels
1308 <    for(int ic=1;ic<5;ic++){
1309 <      
1310 <      stringstream hname, htitle;
1311 <      hname  << "BX_mean_MB" << ic << "_W" << (iw-2);
1312 <      htitle << "BX MeanValue (HH,HL) MB" <<  ic << " W" << (iw-2);
1313 <      BXSummary[iw][ic-1]= new TH1F(hname.str().c_str(),htitle.str().c_str(),12,1.,13.);
1314 <      for(int is=1;is<13;is++){
1315 <        stringstream xlab; xlab << "S" << is;
1316 <        BXSummary[iw][ic-1]->GetXaxis()->SetBinLabel(is,xlab.str().c_str());
1299 >
1300 >  //Change standard palette colors
1301 >  const Int_t NRGBs = 5;
1302 >  //const Int_t NCont = 255;
1303 >  const Int_t NCont = 155;
1304 >
1305 >  Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
1306 >  Double_t red[NRGBs]   = { 0.99, 0.40, 0.00, 0.80, 0.95 };
1307 >  Double_t green[NRGBs] = { 0.99, 0.40, 0.40, 0.10, 0.00 };
1308 >  Double_t blue[NRGBs]  = { 0.20, 0.00, 0.90, 0.10, 0.00 };
1309 >  // It needs to be initialize if not root gives a warning and cmssw an error and
1310 >  // the program stops
1311 >  TColor::InitializeColors();
1312 >  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
1313 >  //gStyle->SetNumberContours(NCont);
1314 >
1315 >  // Get histos to be plotted
1316 >  TH1F * first_to_paint;
1317 >  TH1F * first_to_paint_MB[4];
1318 >  string SLname[3]={"Phi1","Theta","Phi2"};
1319 >
1320 >  TH1F *DigiXSecMBSlLayer[5][14][4][3][4];
1321 >
1322 >  for(int iw=0;iw<5;++iw)
1323 >  for(int isec=1;isec<15;++isec)
1324 >  for(int ich=1;ich<5;++ich)
1325 >  for(int isl=1;isl<4;++isl)
1326 >  for(int il=1;il<5;++il){
1327 >      // Create individual layer occupancy plots from hDigiXY_S
1328 >      stringstream histoNameOccup;  histoNameOccup  << "Occup_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" <<il;
1329 >      stringstream histoTitleOccup; histoTitleOccup << "Occupancy  " << Whname[iw] << " S" << isec << " MB" << ich << " SL" << SLname[isl-1] << "L" << il;
1330 >      DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]= new TH1F(histoNameOccup.str().c_str(),histoTitleOccup.str().c_str(),100, 0.,100.);
1331 >  }
1332 >
1333 >  TH2F *DigiXYS[5][14];
1334 >  TH1F *OccupMB[5][4];
1335 >  TH1F *OccupWh[5];
1336 >
1337 >  std::map<int,std::vector<int> >::const_iterator whIt  = mySectors.begin();
1338 >  std::map<int,std::vector<int> >::const_iterator whEnd = mySectors.end();
1339 >  for(;whIt!=whEnd;++whIt) {
1340 >    int iw = (*whIt).first + 2;
1341 >    std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
1342 >    std::vector<int>::const_iterator secEnd = (*whIt).second.end();
1343 >    for(;secIt!=secEnd;++secIt) {
1344 >      int isec = (*secIt);
1345 >
1346 >     // Occupancies
1347 >      stringstream histoNameOcc; histoNameOcc << "hDigiXY_" << Whname[iw] << "_S" << isec;
1348 >      DigiXYS[iw][isec-1]=getHisto<TH2F>(histoNameOcc.str());
1349 >      int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
1350 >
1351 >      for(int ich=1;ich<5;ich++){
1352 >         for(int isl=1;isl<4;isl++){
1353 >          for(int il=1;il<5;il++){
1354 >            int iby=(ich-1)*20+(isl-1)*4+il+1;
1355 >            float totentr=0;
1356 >            for(int ibx=1;ibx<nbx;ibx++){
1357 >              float yval=DigiXYS[iw][isec-1]->GetBinContent(ibx,iby);
1358 >              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetBinContent(ibx,yval);
1359 >              totentr+=yval;
1360 >            }
1361 >            DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetEntries(totentr);
1362 >          }
1363 >         }
1364 >      }
1365 >    }// End loop Sectors
1366 >  }//End loop Wheels
1367 >
1368 >  for(int iw=0;iw<5;++iw)
1369 >  for(int ich=1;ich<5;++ich)
1370 >  {
1371 >     stringstream histoNameOccMB; histoNameOccMB << "Digi_" << Whname[iw] << "_MB" << ich;
1372 >     OccupMB[iw][ich-1]= new TH1F(histoNameOccMB.str().c_str(),histoNameOccMB.str().c_str(),14, 0.,14.);
1373 >  }
1374 >  whIt  = mySectors.begin();
1375 >  whEnd = mySectors.end();
1376 >  for(;whIt!=whEnd;++whIt) {
1377 >   int iw = (*whIt).first + 2;
1378 >   for(int ich=1;ich<5;++ich){
1379 >     for(int isec=1;isec<13;isec++){
1380 >      float totentr=0;
1381 >      for(int isl=1;isl<4;isl++){
1382 >        for(int il=1;il<5;il++){
1383 >          totentr+=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetEntries();
1384 >        }
1385 >      }
1386 >      OccupMB[iw][ich-1]->Fill(isec,totentr);
1387 >     }
1388 >   }
1389 >  }
1390 >  
1391 >
1392 > /*
1393 > for(int ic=0;ic<4;ic++)
1394 > {
1395 >   first_to_paint_MB[ic]=OccupMB[0][ic];
1396 >   float nbmax=0;
1397 >   nbmax=OccupMB[0][ic]->GetMaximum();
1398 >   for(int iw=0;iw<5;iw++)
1399 >   {
1400 >      float nbmax0=0;
1401 >      nbmax0=OccupMB[iw][ic]->GetMaximum();
1402 >
1403 >      if(nbmax0>nbmax)
1404 >      {
1405 >         nbmax=nbmax0; first_to_paint_MB[ic]=OccupMB[iw][ic];
1406        }
1407 +   }
1408 + }
1409 +
1410 + */
1411 +
1412 + float Ocmax[4]={0.,0.,0.,0};
1413 + for(int ic=0;ic<4;ic++)
1414 + {
1415 +   first_to_paint_MB[ic]=OccupMB[0][ic];
1416 +   float nbmin=9999999;
1417 +   //float nbmin00=OccupMB[0][ic]->GetMinimum();
1418 +   //if(nbmin00 > 0) nbmin=nbmin00;
1419 +   for(int iw=0;iw<5;iw++)
1420 +   {
1421 +      float nbmax0=0;
1422 +      float nbmin0=99999999.;
1423 +      nbmax0=OccupMB[iw][ic]->GetMaximum();
1424 +      //nbmin0=OccupMB[iw][ic]->GetMinimum();
1425 +
1426 +      if(nbmax0>Ocmax[ic]) Ocmax[ic]=nbmax0;
1427 +      if(nbmax0>0 && nbmax0<nbmin)
1428 +      {
1429 +         nbmin=nbmax0; first_to_paint_MB[ic]=OccupMB[iw][ic];
1430 +      }
1431 +      //if(nbmin0>0 && nbmin0<nbmin)
1432 +     // {
1433 +      //  nbmin=nbmin0; first_to_paint_MB[ic]=OccupMB[iw][ic];
1434 +     // }
1435 +   }
1436 + }
1437 +
1438 +
1439 + for(int ic=1;ic<5;ic++)
1440 + {
1441 +   stringstream hname21; hname21 << "Total Occupancy  MB" << ic ;
1442 +   first_to_paint_MB[ic-1]->SetTitle(hname21.str().c_str());
1443 +
1444 +   first_to_paint_MB[ic-1]->GetXaxis()->SetLabelSize(0.09);
1445 +   first_to_paint_MB[ic-1]->GetXaxis()->SetTitleSize(0.09);
1446 +   first_to_paint_MB[ic-1]->GetXaxis()->SetTitleOffset(0.5);
1447 +   first_to_paint_MB[ic-1]->GetXaxis()->SetTitle("Sector   ");
1448 +   first_to_paint_MB[ic-1]->GetYaxis()->SetLabelSize(0.09);
1449 +   first_to_paint_MB[ic-1]->GetYaxis()->SetTitleSize(0.09);
1450 +   first_to_paint_MB[ic-1]->GetYaxis()->SetTitleOffset(0.5);
1451 +   first_to_paint_MB[ic-1]->GetYaxis()->SetTitle("Entries");
1452 +   first_to_paint_MB[ic-1]->SetStats(0);
1453 +   first_to_paint_MB[ic-1]->SetMaximum(Ocmax[ic-1]*1.25);
1454 + //   int nbb=first_to_paint_MB[ic-1]->GetNbinsX();
1455 + //   float ymin=9999999999999.;
1456 + //   for(int ib=1;ib<nbb;ib++)
1457 + //   {
1458 + //      float ymin0= first_to_paint_MB[ic-1]->GetBinContent(ib);
1459 + //      if(ymin0>0 && ymin0<ymin)ymin=ymin0;
1460 + //   }
1461 + //   first_to_paint_MB[ic-1]->SetMinimum(ymin*.20);
1462 + }
1463 +
1464 +  gStyle->SetTitleW(0.25);
1465 +  gStyle->SetTitleH(0.22);
1466 +  gStyle->SetTitleX(0.74);
1467 +  gStyle->SetTitleY(0.99);
1468 +
1469 +
1470 + TCanvas *OccupanALL = new TCanvas("OccupanALL", "",201,81,999,950);
1471 + OccupanALL->Divide(1,4) ;
1472 + for(int ic=1;ic<5;ic++)
1473 + {
1474 +    OccupanALL->cd(ic)->SetLogy(1);
1475 +    OccupanALL->cd(ic)->SetFillColor(0);
1476 +    OccupanALL->cd(ic)->SetFrameFillColor(0);
1477 +    OccupanALL->cd(ic);
1478 +    first_to_paint_MB[ic-1]->Draw();
1479 +
1480 +    for(int iw=0;iw<5;iw++)
1481 +    {
1482 +      OccupMB[iw][ic-1]->SetLineColor(iw+1);
1483 +      if(iw==4)
1484 +         OccupMB[iw][ic-1]->SetLineColor(6);
1485 +      OccupanALL->cd(ic);  OccupMB[iw][ic-1]->Draw("same");
1486      }
1487 + }
1488 + createGifFile("OccupancyAll","",OccupanALL,false);
1489 +
1490 + delete OccupanALL;
1491 +
1492 +
1493 + // Occupancies/Sector
1494 +  for(int iw=0;iw<5;iw++){
1495 +    stringstream histoNameOccMB; histoNameOccMB << "Digi_" << Whname[iw];
1496 +    OccupWh[iw]= new TH1F(histoNameOccMB.str().c_str(),histoNameOccMB.str().c_str(),14, 0.,14.);
1497 +    for(int isec=1;isec<13;isec++){
1498 +     float totentr=0;
1499 +     for(int ich=1;ich<5;++ich){
1500 +      for(int isl=1;isl<4;isl++){
1501 +        for(int il=1;il<5;il++){
1502 +          if(DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1])
1503 +            totentr+=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetEntries();
1504 +        }
1505 +      }
1506 +     OccupWh[iw]->Fill(isec,totentr);
1507 +     }
1508 +   }
1509    }
1510 +
1511 + first_to_paint=OccupWh[0];
1512 +
1513 + /*
1514 + float nbmax=0;
1515 + nbmax=OccupWh[0]->GetMaximum();
1516 + for(int iw=1;iw<5;iw++)
1517 + {
1518 +   float nbmax0=0;
1519 +   nbmax0=OccupWh[iw]->GetMaximum();
1520 +   if(nbmax0>nbmax)
1521 +   {
1522 +      nbmax=nbmax0; first_to_paint=OccupWh[iw];
1523 +   }
1524 + }
1525 + */
1526 +
1527 + float OcmaxS=0;
1528 + float nbminS=9999999;
1529 + float nbminS00=OccupWh[0]->GetMinimum();
1530 + if(nbminS00 > 0) nbminS=nbminS00;
1531 + for(int iw=1;iw<5;iw++)
1532 + {
1533 +    float nbmax0=0;
1534 +    float nbmin0=99999999.;
1535 +    nbmax0=OccupWh[iw]->GetMaximum();
1536 +
1537 +    if(nbmax0>OcmaxS) OcmaxS=nbmax0;
1538 +    if(nbmin0>0 && nbmin0<nbminS)
1539 +    {
1540 +        nbminS=nbmin0; first_to_paint_MB[iw]=OccupWh[iw];
1541 +    }
1542 + }
1543 +
1544 +
1545 +
1546 + stringstream hname21; hname21 << "Total Occupancy ";
1547 + first_to_paint->SetTitle(hname21.str().c_str());
1548 +
1549 + first_to_paint->GetXaxis()->SetLabelSize(0.04);
1550 + first_to_paint->GetXaxis()->SetTitleSize(0.04);
1551 + // first_to_paint->GetXaxis()->SetTitleOffset(0.5);
1552 + first_to_paint->GetXaxis()->SetTitle("Sector   ");
1553 + first_to_paint->GetYaxis()->SetLabelSize(0.04);
1554 + first_to_paint->GetYaxis()->SetTitleSize(0.04);
1555 + // first_to_paint->GetYaxis()->SetTitleOffset(0.5);
1556 + first_to_paint->GetYaxis()->SetTitle("Entries");
1557 + first_to_paint->SetStats(0);
1558 +
1559 +
1560 +  gStyle->SetTitleX(0.1);
1561 +  gStyle->SetTitleY(0.99);
1562 +  gStyle->SetTitleW(0.87);
1563 +  gStyle->SetTitleH(0.1);
1564 +
1565 +
1566 + TCanvas *OccupanSec = new TCanvas("OccupanSec", "",201,81,650,550);
1567 + OccupanSec->SetLogy(1) ;
1568 + first_to_paint->SetMaximum(OcmaxS*1.25);
1569 + float yminS=9999999999999.;
1570 + int nbbS=first_to_paint->GetNbinsX();
1571 + for(int ib=1;ib<nbbS;ib++)
1572 + {
1573 +   float ymin0= first_to_paint->GetBinContent(ib);
1574 +   if(ymin0>0 && ymin0<yminS)yminS=ymin0;
1575 +  }
1576 + first_to_paint->SetMinimum(yminS*.20);
1577 + first_to_paint->Draw();
1578 + for(int iw=0;iw<5;iw++)
1579 + {
1580 +   OccupWh[iw]->SetLineColor(iw+1);
1581 +   if(iw==4)OccupWh[iw]->SetLineColor(6);
1582 +   OccupWh[iw]->Draw("same");
1583 + }
1584 +
1585 + createGifFile("OccupancySec","",OccupanSec,false);
1586 + delete OccupanSec;
1587 +
1588 +  gStyle->SetTitleW(0.55);
1589 +  gStyle->SetTitleH(0.13);
1590 +  gStyle->SetTitleX(0.01);
1591 +  gStyle->SetTitleY(0.99);
1592    
1593 <  
1594 <  //   SC BX Summary    
1595 <  for(int iw=0;iw<5;iw++){ // Loop in wheels
1596 <    for(int ins=1;ins<13;ins++){ // Loop in sectors
1597 <    
1598 <      TH1F *hHH[4];
1599 <      TH1F *hHL[4];
1600 <      for(int ic=1;ic<5;ic++){ // Loop in chambers
1601 <      
1602 <        stringstream hname; hname << "hTrigBX_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1603 <        hHH[ic-1]= getHisto<TH1F>(hname.str()+"_qual6");
1604 <        hHL[ic-1]= getHisto<TH1F>(hname.str()+"_qual5");
1605 <      
1606 <        hHH[ic-1]->Add(hHL[ic-1]);
1607 <        hHH[ic-1]->SetLineColor(ic);
1608 <        hHH[ic-1]->SetStats(0);
1609 <      
1610 <        // Compute average for BX summary plot
1611 <        int nb=hHH[ic-1]->GetNbinsX();
1612 <        int nbMax=hHH[ic-1]->GetMaximumBin();
1613 <        float xmean=0;
1614 <        float xtot0=0;
1615 <        for(int inb=nbMax-2;inb<nbMax+3;inb++){ // Takes Central BX+-2
1616 <          if(inb>1 && inb<nb){ //To avoid problems if it is on the "border"
1617 <            float yval=hHH[ic-1]->GetBinContent(inb);
1618 <            float xval=hHH[ic-1]->GetBinCenter(inb);
1619 <            xmean+=xval*yval;
1620 <            xtot0+=yval;
1621 <          }
1622 <        }
1623 <        if(xtot0>0){
1624 <          xmean=xmean/xtot0 ;
1625 <          BXSummary[iw][ic-1]->Fill(ins,xmean);
1626 <          BXSummary_mean+=xmean;
1627 <          NBXSummary_mean++;
1628 <        }
1593 >  gStyle->SetOptStat(10);
1594 >  gStyle->SetStatX(0.98);
1595 >  gStyle->SetStatY(0.97);
1596 >  gStyle->SetStatW(0.35);
1597 >  gStyle->SetStatH(0.38);
1598 >
1599 >
1600 > TH1F *TBoxSec[5][12];
1601 > TH1F *TBoxMB[5][4];
1602 > TH1F *TBoxMBTop[5][4];
1603 > TH1F *TBoxMBBottom[5][4];
1604 > TH1F *TBoxMBVertical[5][4];
1605 >
1606 > whIt  = mySectors.begin();
1607 > whEnd = mySectors.end();
1608 > for(;whIt!=whEnd;++whIt) {
1609 >   int iw = (*whIt).first + 2;
1610 >  
1611 >   std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
1612 >   std::vector<int>::const_iterator secEnd = (*whIt).second.end();
1613 >   for(;secIt!=secEnd;++secIt) {
1614 >      int isec = (*secIt);
1615 >    if(isec<13)  
1616 >    for(int ic=1;ic<5;ic++){
1617 >        stringstream hname; hname << "htime_" << Whname[iw] << "_S" << isec << "_MB" << ic;
1618 >        TH1F * theHisto=getHisto<TH1F>(hname.str());
1619 >
1620 >        if(isec==1)
1621 >        {
1622 >           stringstream hname2; hname2 << "htime_" << Whname[iw] << "_MB" << ic ;
1623 >           TBoxMB[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1624 >           TBoxMB[iw][ic-1]->SetTitle(hname2.str().c_str());
1625 >
1626 >           stringstream hname3; hname3 << "htime_" << Whname[iw] << "_MB" << ic << "_Vertical" ;
1627 >           TBoxMBVertical[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1628 >           TBoxMBVertical[iw][ic-1]->SetTitle(hname2.str().c_str());
1629 >        }
1630 >        if(isec==2)
1631 >        {
1632 >           stringstream hname2; hname2 << "htime_" << Whname[iw] << "_MB" << ic << "_Top"  ;
1633 >           TBoxMBTop[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1634 >           TBoxMBTop[iw][ic-1]->SetTitle(hname2.str().c_str());
1635 >        }
1636 >        if(isec==8)
1637 >        {
1638 >           stringstream hname2; hname2 << "htime_" << Whname[iw] << "_MB" << ic << "_Bottom"  ;
1639 >           TBoxMBBottom[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1640 >           TBoxMBBottom[iw][ic-1]->SetTitle(hname2.str().c_str());
1641 >        }
1642 >
1643 >        if(isec>2)TBoxMB[iw][ic-1]->Add(theHisto);   //
1644 >        if(isec>2 && isec<7)TBoxMBTop[iw][ic-1]->Add(theHisto);  
1645 >        if(isec>8)TBoxMBBottom[iw][ic-1]->Add(theHisto);  
1646 >        if(isec==7)TBoxMBVertical[iw][ic-1]->Add(theHisto);   //
1647 >
1648 >        if(ic==1)
1649 >        {
1650 >           stringstream hname2; hname2 << "timebox_" << Whname[iw] << "_S" << isec ;
1651 >           TBoxSec[iw][isec-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1652 >           TBoxSec[iw][isec-1]->SetTitle(hname2.str().c_str());
1653 >
1654 >        }
1655 >        if(ic>1)TBoxSec[iw][isec-1]->Add(theHisto);   //
1656 >
1657 >    }// end loop MB
1658 >   }// end loop Sector
1659 > }// end loop Wheel
1660 >
1661 > TH1F * first_to_paint_MB_typ[4][4];
1662 > for(int ic=0;ic<4;ic++)
1663 > {
1664 >   first_to_paint_MB_typ[ic][0]=TBoxMB[0][ic];
1665 >   first_to_paint_MB_typ[ic][1]=TBoxMBTop[0][ic];
1666 >   first_to_paint_MB_typ[ic][2]=TBoxMBBottom[0][ic];
1667 >   first_to_paint_MB_typ[ic][3]=TBoxMBVertical[0][ic];
1668 >   float nbmax[4]={0,0,0,0};
1669 >   nbmax[0]=TBoxMB[0][ic]->GetMaximum();
1670 >   nbmax[1]=TBoxMBTop[0][ic]->GetMaximum();
1671 >   nbmax[2]=TBoxMBBottom[0][ic]->GetMaximum();
1672 >   nbmax[3]=TBoxMBVertical[0][ic]->GetMaximum();
1673 >   for(int iw=1;iw<5;iw++)
1674 >   {
1675 >      float nbmax0[4]={0,0,0,0};
1676 >      nbmax0[0]=TBoxMB[iw][ic]->GetMaximum();
1677 >      nbmax0[1]=TBoxMBTop[iw][ic]->GetMaximum();
1678 >      nbmax0[2]=TBoxMBBottom[iw][ic]->GetMaximum();
1679 >      nbmax0[3]=TBoxMBVertical[iw][ic]->GetMaximum();
1680 >
1681 >      if(nbmax0[0]>nbmax[0])
1682 >      {
1683 >         nbmax[0]=nbmax0[0]; first_to_paint_MB_typ[ic][0]=TBoxMB[iw][ic];
1684 >      }
1685 >      if(nbmax0[1]>nbmax[1])
1686 >      {
1687 >         nbmax[1]=nbmax0[1]; first_to_paint_MB_typ[ic][1]=TBoxMBTop[iw][ic];
1688 >      }
1689 >      if(nbmax0[2]>nbmax[2])
1690 >      {
1691 >         nbmax[2]=nbmax0[2]; first_to_paint_MB_typ[ic][2]=TBoxMBBottom[iw][ic];
1692 >      }
1693 >      if(nbmax0[3]>nbmax[3])
1694 >      {
1695 >         nbmax[3]=nbmax0[3]; first_to_paint_MB_typ[ic][3]=TBoxMBVertical[iw][ic];
1696        }
1485    }// end Loop in chambers
1486  }// END loop in wheels and sectors
1697  
1698 <  string titlename = "BX Average (HH,HL)";
1699 <  TCanvas *BXaverage = new TCanvas("BXAverage", "",201,81,999,699);
1700 <  BXaverage->SetTopMargin(0.42);
1701 <  BXaverage->SetBottomMargin(0.32);
1702 <  BXaverage->SetRightMargin(0.12);
1703 <  BXaverage->Divide(1,5,0.,0) ;
1704 <  
1705 <  TPaveLabel* title = new TPaveLabel(0.1,0.93,0.85,0.99,titlename.c_str());
1706 <  title->SetFillColor(0);
1707 <  title->SetTextColor(4);
1708 <  title->Draw();
1709 <  TPaveLabel* wheelName[5];
1710 <  memset(wheelName,0,5*sizeof(TPaveLabel*));
1711 <
1712 <  int BXSummary_min=0;
1713 <  int BXSummary_max=0;
1714 <  if(NBXSummary_mean>0)BXSummary_min=-6+int(BXSummary_mean/NBXSummary_mean);
1715 <  if(NBXSummary_mean>0)BXSummary_max=6+int(BXSummary_mean/NBXSummary_mean);
1716 <  for(int iw=0;iw<5;iw++){
1717 <    BXaverage->cd(iw+1);
1718 <    BXaverage->cd(iw+1)->SetGrid();
1698 >   }
1699 > }
1700 > for(int ic=1;ic<5;ic++)
1701 > {
1702 >   stringstream hname21; hname21 << "htime_MB" << ic ;
1703 >   stringstream hname22; hname22 << "htime_MB" << ic << "_Top"  ;
1704 >   stringstream hname23; hname23 << "htime_MB" << ic << "_Bottom"  ;
1705 >   stringstream hname24; hname24 << "htime_MB" << ic << "_Vertical"  ;
1706 >   first_to_paint_MB_typ[ic-1][0]->SetTitle(hname21.str().c_str());
1707 >   first_to_paint_MB_typ[ic-1][1]->SetTitle(hname22.str().c_str());
1708 >   first_to_paint_MB_typ[ic-1][2]->SetTitle(hname23.str().c_str());
1709 >   first_to_paint_MB_typ[ic-1][3]->SetTitle(hname24.str().c_str());
1710 >
1711 >   for(int ityp=0;ityp<4;ityp++)
1712 >   {
1713 >     first_to_paint_MB_typ[ic-1][ityp]->GetXaxis()->SetLabelSize(0.07);
1714 >     first_to_paint_MB_typ[ic-1][ityp]->GetYaxis()->SetLabelSize(0.05);
1715 >     first_to_paint_MB_typ[ic-1][ityp]->SetNdivisions(505);
1716 >   }
1717 > }
1718 >
1719 >
1720 > TCanvas *TBoxAll = new TCanvas("TBoxAll", "",201,81,999,950);
1721 > TBoxAll->Divide(4,4) ;
1722 > for(int ic=1;ic<5;ic++)
1723 > {
1724 >    first_to_paint_MB_typ[ic-1][0]->SetMinimum(0);
1725 >    first_to_paint_MB_typ[ic-1][1]->SetMinimum(0);
1726 >    first_to_paint_MB_typ[ic-1][2]->SetMinimum(0);
1727 >    first_to_paint_MB_typ[ic-1][3]->SetMinimum(0);
1728 >    TBoxAll->cd((ic-1)*4+1); first_to_paint_MB_typ[ic-1][0]->Draw();
1729 >    TBoxAll->cd((ic-1)*4+2); first_to_paint_MB_typ[ic-1][1]->Draw();
1730 >    TBoxAll->cd((ic-1)*4+3); first_to_paint_MB_typ[ic-1][2]->Draw();
1731 >    TBoxAll->cd((ic-1)*4+4); first_to_paint_MB_typ[ic-1][3]->Draw();
1732 >
1733 >    for(int iw=0;iw<5;iw++)
1734 >    {
1735 >      TBoxMB[iw][ic-1]->SetLineColor(iw+1);
1736 >      TBoxMBTop[iw][ic-1]->SetLineColor(iw+1);
1737 >      TBoxMBBottom[iw][ic-1]->SetLineColor(iw+1);
1738 >      TBoxMBVertical[iw][ic-1]->SetLineColor(iw+1);
1739 >      if(iw==4)
1740 >       {
1741 >         TBoxMB[iw][ic-1]->SetLineColor(6);
1742 >         TBoxMBTop[iw][ic-1]->SetLineColor(6);
1743 >         TBoxMBBottom[iw][ic-1]->SetLineColor(6);
1744 >         TBoxMBVertical[iw][ic-1]->SetLineColor(6);
1745 >       }
1746 >      TBoxAll->cd((ic-1)*4+1);  TBoxMB[iw][ic-1]->Draw("same");
1747 >      TBoxAll->cd((ic-1)*4+2);  TBoxMBTop[iw][ic-1]->Draw("same");
1748 >      TBoxAll->cd((ic-1)*4+3);  TBoxMBBottom[iw][ic-1]->Draw("same");
1749 >      TBoxAll->cd((ic-1)*4+4);  TBoxMBVertical[iw][ic-1]->Draw("same");
1750 >    }
1751 > }
1752 >
1753 > createGifFile("TimeBoxAll","",TBoxAll,false);
1754 > delete TBoxAll;
1755 >
1756 >
1757 > TCanvas *TBoxWh[5];
1758 > TBoxWh[0] = new TCanvas("TBoxWh-2", "",201,81,999,950);
1759 > TBoxWh[1] = new TCanvas("TBoxWh-1", "",201,81,999,950);
1760 > TBoxWh[2] = new TCanvas("TBoxWh0", "",201,81,999,950);
1761 > TBoxWh[3] = new TCanvas("TBoxWh+1", "",201,81,999,950);
1762 > TBoxWh[4] = new TCanvas("TBoxWh+2", "",201,81,999,950);
1763 > for(int iw=0;iw<5;iw++)
1764 > {
1765 >   TBoxWh[iw]->Divide(3,4) ;
1766 >   for(int isec=1;isec<13;isec++)
1767 >   {
1768 >      TBoxWh[iw]->cd(isec);
1769 >      TBoxWh[iw]->cd(isec)->SetFillColor(0);
1770 >      TBoxWh[iw]->cd(isec)->SetFrameFillColor(0);
1771 >      TBoxSec[iw][isec-1]->GetXaxis()->SetLabelSize(0.07);
1772 >      TBoxSec[iw][isec-1]->GetYaxis()->SetLabelSize(0.05);
1773 >      TBoxSec[iw][isec-1]->SetNdivisions(505);
1774 >      TBoxSec[iw][isec-1]->Draw();   //
1775 >   }
1776 > }
1777 >
1778 > for(int iw=0;iw<5;iw++)
1779 > {
1780 >    createGifFile("TimeBoxAll",(iw-2),"",TBoxWh[iw]);
1781 >    delete TBoxWh[iw];
1782 > }
1783 >
1784 >
1785 >  gStyle->SetOptStat(10);
1786 >  gStyle->SetStatX(0.4);
1787 >  gStyle->SetStatY(0.88);
1788 >  gStyle->SetStatW(0.29);
1789 >  gStyle->SetStatH(0.38);
1790 >
1791 >
1792 > TH1F *NHitsSec[5][12];
1793 > TH1F *NHitsMB[5][4];
1794 > TH1F *NHitsMBTop[5][4];
1795 > TH1F *NHitsMBBottom[5][4];
1796 > TH1F *NHitsMBVertical[5][4];
1797 > for(int iw=0;iw<5;iw++)
1798 > {
1799 >   for(int isec=0;isec<12;isec++)NHitsSec[iw][isec]=NULL;
1800 >   for(int ic=0;ic<5;ic++)
1801 >   {
1802 >    NHitsMB[iw][ic]=NULL;
1803 >    NHitsMBTop[iw][ic]=NULL;
1804 >    NHitsMBBottom[iw][ic]=NULL;
1805 >    NHitsMBVertical[iw][ic]=NULL;
1806 >   }
1807 > }
1808 >
1809 > whIt  = mySectors.begin();
1810 > whEnd = mySectors.end();
1811 > for(;whIt!=whEnd;++whIt) {
1812 >  int iw = (*whIt).first + 2;
1813 >  std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
1814 >  std::vector<int>::const_iterator secEnd = (*whIt).second.end();
1815 >  for(;secIt!=secEnd;++secIt) {
1816 >    int isec = (*secIt);
1817 >    if(isec<13)
1818      for(int ic=1;ic<5;ic++){
1819 <      BXSummary[iw][ic-1]->SetMaximum(BXSummary_max);
1820 <      BXSummary[iw][ic-1]->SetMinimum(BXSummary_min);
1821 <      BXSummary[iw][ic-1]->SetStats(0);
1822 <      BXSummary[iw][ic-1]->SetTitle(0);
1823 <      BXSummary[iw][ic-1]->SetLineWidth(2);
1824 <      BXSummary[iw][ic-1]->GetXaxis()->SetLabelSize(0.25);
1825 <      BXSummary[iw][ic-1]->GetYaxis()->SetLabelSize(0.2);
1826 <      if(iw==4)BXSummary[iw][ic-1]->GetYaxis()->SetLabelSize(0.15);
1827 <      BXSummary[iw][ic-1]->GetYaxis()->SetNdivisions(502);
1828 <      BXSummary[iw][ic-1]->SetLineColor(ic);
1829 <      if(ic==1)BXSummary[iw][ic-1]->Draw();
1830 <      else BXSummary[iw][ic-1]->Draw("same");
1831 <    }
1832 <    stringstream ptitle; ptitle << "Wheel " << (iw-2);
1833 <    wheelName[iw] = new TPaveLabel(1.00,0.70,1.12,0.90,ptitle.str().c_str(),"NDC");
1834 <    wheelName[iw]->Draw();
1835 <  }
1819 >      //for(int isl=1;isl<4;isl++){
1820 >        //stringstream hname; hname << "hNhits_" << Whname[iw] << "_S" << isec << "_MB" << ic << "_SL" << isl;
1821 >      {
1822 >        stringstream hname; hname << "hNhits_" << Whname[iw] << "_S" << isec << "_MB" << ic;
1823 >        TH1F * theHisto=getHisto<TH1F>(hname.str());
1824 >
1825 >        if(isec==1)
1826 >        {
1827 >           stringstream hname2; hname2 << "nHits_" << Whname[iw] << "_MB" << ic ;
1828 >           NHitsMB[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1829 >           NHitsMB[iw][ic-1]->SetTitle(hname2.str().c_str());
1830 >
1831 >           stringstream hname3; hname3 << "nHits_" << Whname[iw] << "_MB" << ic << "_Vertical";
1832 >           NHitsMBVertical[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1833 >           NHitsMBVertical[iw][ic-1]->SetTitle(hname3.str().c_str());
1834 >        }
1835 >        if(isec==2)
1836 >        {
1837 >           stringstream hname2; hname2 << "nHits_" << Whname[iw] << "_MB" << ic << "_Top"  ;
1838 >           NHitsMBTop[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1839 >           NHitsMBTop[iw][ic-1]->SetTitle(hname2.str().c_str());
1840 >        }
1841 >        if(isec==8)
1842 >        {
1843 >           stringstream hname2; hname2 << "nHits_" << Whname[iw] << "_MB" << ic << "_Bottom"  ;
1844 >           NHitsMBBottom[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1845 >           NHitsMBBottom[iw][ic-1]->SetTitle(hname2.str().c_str());
1846 >        }
1847 >
1848 >
1849 >        if(isec>2)NHitsMB[iw][ic-1]->Add(theHisto);   //
1850 >        if(isec>2 && isec<7)NHitsMBTop[iw][ic-1]->Add(theHisto);
1851 >        if(isec>8)NHitsMBBottom[iw][ic-1]->Add(theHisto);
1852 >        if(isec==7)NHitsMBVertical[iw][ic-1]->Add(theHisto);
1853 >
1854 >        if(ic==1)
1855 >        {
1856 >           stringstream hname2; hname2 << "nHits_" << Whname[iw] << "_S"  << isec ;
1857 >           NHitsSec[iw][isec-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1858 >           NHitsSec[iw][isec-1]->SetTitle(hname2.str().c_str());
1859  
1860 <  createGifFile("TrigBXhhhl_average","",BXaverage);
1861 <  delete BXaverage;
1862 <  delete title;
1863 <  for (int i=0;i<5;++i) {
1532 <    if (wheelName[i]) {
1533 <      delete wheelName[i];
1860 >        }
1861 >        if(ic>1 && ic<4)NHitsSec[iw][isec-1]->Add(theHisto);  // To avoid mix with MB4
1862 >                                                              // that has not Theta SLs
1863 >      }
1864      }
1865    }
1866 + }
1867 +
1868 + for(int ic=0;ic<4;ic++)
1869 + {
1870 +   first_to_paint_MB_typ[ic][0]=NHitsMB[0][ic];
1871 +   first_to_paint_MB_typ[ic][1]=NHitsMBTop[0][ic];
1872 +   first_to_paint_MB_typ[ic][2]=NHitsMBBottom[0][ic];
1873 +   first_to_paint_MB_typ[ic][3]=NHitsMBVertical[0][ic];
1874 +   float nbmax[4]={0,0,0,0};
1875 +   if(NHitsMB[0][ic])nbmax[0]=NHitsMB[0][ic]->GetMaximum();
1876 +   if(NHitsMBTop[0][ic])nbmax[1]=NHitsMBTop[0][ic]->GetMaximum();
1877 +   if(NHitsMBBottom[0][ic])nbmax[2]=NHitsMBBottom[0][ic]->GetMaximum();
1878 +   if(NHitsMBVertical[0][ic])nbmax[3]=NHitsMBVertical[0][ic]->GetMaximum();
1879 +   for(int iw=1;iw<5;iw++)
1880 +   {
1881 +      float nbmax0[4]={0,0,0,0};
1882 +      if(NHitsMB[iw][ic] !=NULL)nbmax0[0]=NHitsMB[iw][ic]->GetMaximum();
1883 +      if(NHitsMBTop[iw][ic] !=NULL)nbmax0[1]=NHitsMBTop[iw][ic]->GetMaximum();
1884 +      if(NHitsMBBottom[iw][ic] !=NULL)nbmax0[2]=NHitsMBBottom[iw][ic]->GetMaximum();
1885 +      if(NHitsMBVertical[iw][ic] !=NULL)nbmax0[3]=NHitsMBVertical[iw][ic]->GetMaximum();
1886 +
1887 +      if(nbmax0[0]>nbmax[0])
1888 +      {
1889 +         nbmax[0]=nbmax0[0]; first_to_paint_MB_typ[ic][0]=NHitsMB[iw][ic];
1890 +      }
1891 +      if(nbmax0[1]>nbmax[1])
1892 +      {
1893 +         nbmax[1]=nbmax0[1]; first_to_paint_MB_typ[ic][1]=NHitsMBTop[iw][ic];
1894 +      }
1895 +      if(nbmax0[2]>nbmax[2])
1896 +      {
1897 +         nbmax[2]=nbmax0[2]; first_to_paint_MB_typ[ic][2]=NHitsMBBottom[iw][ic];
1898 +      }
1899 +      if(nbmax0[3]>nbmax[3])
1900 +      {
1901 +         nbmax[3]=nbmax0[3]; first_to_paint_MB_typ[ic][3]=NHitsMBVertical[iw][ic];
1902 +      }
1903 +   }
1904 + }
1905 +
1906 + for(int ic=1;ic<5;ic++)
1907 + {
1908 +   stringstream hname21; hname21 << "nHits_MB" << ic ;
1909 +   stringstream hname22; hname22 << "nHits_MB" << ic << "_Top"  ;
1910 +   stringstream hname23; hname23 << "nHits_MB" << ic << "_Bottom"  ;
1911 +   stringstream hname24; hname24 << "nHits_MB" << ic << "_Vertical"  ;
1912 +   if(first_to_paint_MB_typ[ic-1][0] != NULL) first_to_paint_MB_typ[ic-1][0]->SetTitle(hname21.str().c_str());
1913 +   if(first_to_paint_MB_typ[ic-1][1] != NULL) first_to_paint_MB_typ[ic-1][1]->SetTitle(hname22.str().c_str());
1914 +   if(first_to_paint_MB_typ[ic-1][2] != NULL) first_to_paint_MB_typ[ic-1][2]->SetTitle(hname23.str().c_str());
1915 +   if(first_to_paint_MB_typ[ic-1][3] != NULL) first_to_paint_MB_typ[ic-1][3]->SetTitle(hname24.str().c_str());
1916 +
1917 +   for(int ityp=0;ityp<4;ityp++)
1918 +   {
1919 +     if(first_to_paint_MB_typ[ic-1][ityp] != NULL)
1920 +     {
1921 +       first_to_paint_MB_typ[ic-1][ityp]->GetXaxis()->SetLabelSize(0.07);
1922 +       first_to_paint_MB_typ[ic-1][ityp]->GetYaxis()->SetLabelSize(0.05);
1923 +       first_to_paint_MB_typ[ic-1][ityp]->SetNdivisions(505);
1924 +     }
1925 +   }
1926 + }
1927 +
1928 + TCanvas *NHitsAll = new TCanvas("NHitsAll", "",201,81,999,950);
1929 + NHitsAll->Divide(4,4) ;
1930 + for(int ip=1;ip<17;ip++)
1931 + {
1932 +    NHitsAll->cd(ip)->SetFillColor(0) ;
1933 +    NHitsAll->cd(ip)->SetFrameFillColor(0) ;
1934 + }
1935 + for(int ic=1;ic<5;ic++)
1936 + {
1937 +    NHitsAll->cd((ic-1)*4+1); if(first_to_paint_MB_typ[ic-1][0] != NULL)first_to_paint_MB_typ[ic-1][0]->Draw();
1938 +    NHitsAll->cd((ic-1)*4+2); if(first_to_paint_MB_typ[ic-1][1] != NULL)first_to_paint_MB_typ[ic-1][1]->Draw();
1939 +    NHitsAll->cd((ic-1)*4+3); if(first_to_paint_MB_typ[ic-1][2] != NULL)first_to_paint_MB_typ[ic-1][2]->Draw();
1940 +    NHitsAll->cd((ic-1)*4+4); if(first_to_paint_MB_typ[ic-1][3] != NULL)first_to_paint_MB_typ[ic-1][3]->Draw();
1941 +
1942 +    for(int iw=0;iw<5;iw++)
1943 +    {
1944 +      if(NHitsMB[iw][ic-1] != NULL)NHitsMB[iw][ic-1]->SetLineColor(iw+1);
1945 +      if(NHitsMBTop[iw][ic-1] != NULL)NHitsMBTop[iw][ic-1]->SetLineColor(iw+1);
1946 +      if(NHitsMBBottom[iw][ic-1] != NULL)NHitsMBBottom[iw][ic-1]->SetLineColor(iw+1);
1947 +      if(NHitsMBVertical[iw][ic-1]!= NULL)NHitsMBVertical[iw][ic-1]->SetLineColor(iw+1);
1948 +      if(iw==4)
1949 +       {
1950 +         if(NHitsMB[iw][ic-1] != NULL)NHitsMB[iw][ic-1]->SetLineColor(6);
1951 +         if(NHitsMBTop[iw][ic-1] != NULL)NHitsMBTop[iw][ic-1]->SetLineColor(6);
1952 +         if(NHitsMBBottom[iw][ic-1] != NULL)NHitsMBBottom[iw][ic-1]->SetLineColor(6);
1953 +         if(NHitsMBVertical[iw][ic-1]!= NULL)NHitsMBVertical[iw][ic-1]->SetLineColor(6);
1954 +       }
1955 +      NHitsAll->cd((ic-1)*4+1);   if(NHitsMB[iw][ic-1] != NULL)NHitsMB[iw][ic-1]->Draw("same");
1956 +      NHitsAll->cd((ic-1)*4+2);   if(NHitsMBTop[iw][ic-1] != NULL)NHitsMBTop[iw][ic-1]->Draw("same");
1957 +      NHitsAll->cd((ic-1)*4+3);   if(NHitsMBBottom[iw][ic-1] != NULL)NHitsMBBottom[iw][ic-1]->Draw("same");
1958 +      NHitsAll->cd((ic-1)*4+4);   if(NHitsMBVertical[iw][ic-1]!= NULL)NHitsMBVertical[iw][ic-1]->Draw("same");
1959 +    }
1960 + }
1961 +
1962 + createGifFile("NHitsAll","",NHitsAll,false);
1963 + delete NHitsAll;
1964 +
1965 +
1966 + TCanvas *NHitsWh[5];
1967 + NHitsWh[0] = new TCanvas("NHitsWh-2", "",201,81,999,950);
1968 + NHitsWh[1] = new TCanvas("NHitsWh-1", "",201,81,999,950);
1969 + NHitsWh[2] = new TCanvas("NHitsWh0", "",201,81,999,950);
1970 + NHitsWh[3] = new TCanvas("NHitsWh+1", "",201,81,999,950);
1971 + NHitsWh[4] = new TCanvas("NHitsWh+2", "",201,81,999,950);
1972 + for(int iw=0;iw<5;iw++)
1973 + {
1974 +   NHitsWh[iw]->Divide(3,4) ;
1975 +   for(int isec=1;isec<13;isec++)
1976 +   {
1977 +      NHitsWh[iw]->cd(isec);
1978 +      NHitsWh[iw]->cd(isec)->SetFillColor(0);
1979 +      NHitsWh[iw]->cd(isec)->SetFrameFillColor(0);
1980 +      if(NHitsSec[iw][isec-1] != NULL)
1981 +      {
1982 +        NHitsSec[iw][isec-1]->GetXaxis()->SetLabelSize(0.07);
1983 +        NHitsSec[iw][isec-1]->GetYaxis()->SetLabelSize(0.05);
1984 +        NHitsSec[iw][isec-1]->SetNdivisions(505);
1985 +        NHitsSec[iw][isec-1]->Draw();   //
1986 +      }
1987 +   }
1988 + }
1989 +
1990 +
1991 + for(int iw=0;iw<5;iw++)
1992 + {
1993 +   createGifFile("NHitsSec",(iw-2),"",NHitsWh[iw]);
1994 +   delete NHitsWh[iw];
1995 + }
1996 +
1997 + TCanvas *NHitsWhAll;
1998 + NHitsWhAll = new TCanvas("NHitsWhAll", "",201,81,999,950);
1999 + NHitsWhAll->Divide(3,4) ;
2000 + for(int ins=1;ins<13;ins++)
2001 + {
2002 +   first_to_paint=NHitsSec[0][ins-1];
2003 +   float nbmax1=0;
2004 +   if(NHitsSec[0][ins-1]!=NULL)NHitsSec[0][ins-1]->GetMaximum();
2005 +   for(int iw=1;iw<5;iw++)
2006 +   {
2007 +      float nbmax2=0;
2008 +      if(NHitsSec[iw][ins-1] != NULL)nbmax2=NHitsSec[iw][ins-1]->GetMaximum();
2009 +      if(nbmax2>nbmax1)
2010 +      {
2011 +         nbmax1=nbmax2; first_to_paint=NHitsSec[iw][ins-1];
2012 +      }
2013 +    }
2014 +
2015 +    NHitsWhAll->cd(ins) ;
2016 +    NHitsWhAll->cd(ins)->SetFillColor(0) ;
2017 +    NHitsWhAll->cd(ins)->SetFrameFillColor(0) ;
2018 +    stringstream hname; hname << "nHits_S"  << ins ;
2019 +    if(first_to_paint != NULL)
2020 +    {
2021 +      first_to_paint->SetTitle(hname.str().c_str());
2022 +      first_to_paint->Draw();
2023 +      for(int iw=0;iw<5;iw++)
2024 +      {
2025 +        if(NHitsSec[iw][ins-1] != NULL)
2026 +        {
2027 +         NHitsSec[iw][ins-1]->SetLineColor(iw+1);
2028 +         if(iw==4) NHitsSec[iw][ins-1]->SetLineColor(6);
2029 +         NHitsSec[iw][ins-1]->Draw("same");
2030 +        }
2031 +      }
2032 +    }
2033 + }
2034 +
2035 + createGifFile("NHitsSec","",NHitsWhAll,false);
2036 +
2037 + delete NHitsWhAll;
2038 +
2039 + gStyle->SetStatY(0.99);
2040 + gStyle->SetStatX(0.98);
2041 + gStyle->SetStatW(0.40);
2042 + gStyle->SetStatH(0.25);
2043 +
2044 +
2045 + stringstream hnameSTA1; hnameSTA1 << "hrIPSA" ;
2046 + stringstream hnameSTA2; hnameSTA2 << "hzIPSA" ;
2047 + stringstream hnameSTA3; hnameSTA3 << "hrVszIPSA" ;
2048 +
2049 + TH1F * theHistoSTA1=NULL;
2050 + TH1F * theHistoSTA2=NULL;
2051 + TH2F * theHistoSTA3=NULL;
2052 +
2053 + theHistoSTA1=getHisto<TH1F>(hnameSTA1.str());
2054 + theHistoSTA2=getHisto<TH1F>(hnameSTA2.str());
2055 + theHistoSTA3=getHisto<TH2F>(hnameSTA3.str());
2056 +
2057 + TCanvas *STAatIP;
2058 + STAatIP = new TCanvas("STAatIP", "",201,81,999,400);
2059 + STAatIP->Divide(3,1) ;
2060 + for(int i=1;i<5;i++)
2061 + { STAatIP->cd(i)->SetFillColor(0);STAatIP->cd(i)->SetFrameFillColor(0); }
2062 + if(theHistoSTA1 != NULL){STAatIP->cd(1);theHistoSTA1->Draw(); }
2063 + else cout << " hrIPSA histo not found " << endl;
2064 + if(theHistoSTA2 != NULL){STAatIP->cd(2);theHistoSTA2->Draw(); }
2065 + else cout << " hzIPSA histo not found " << endl;
2066 + if(theHistoSTA3 != NULL){STAatIP->cd(3);theHistoSTA3->Draw("colz"); }
2067 + else cout << " hrvszIPSA histo not found " << endl;
2068 +
2069 + createGifFile("STATrack_at_IP","",STAatIP,false);
2070 + delete STAatIP;
2071 +
2072 +
2073 + gStyle->SetStatY(0.97);
2074 + gStyle->SetStatX(0.98);
2075 + gStyle->SetStatW(0.25);
2076 + gStyle->SetStatH(0.15);
2077 +
2078 +
2079 + TH1F * segphi=getHisto<TH1F>("segphi");
2080 + TH1F * segphivsz=getHisto<TH1F>("segphivsz");
2081 +
2082 + TH1F * segphiMB[4];
2083 + TH1F * segzMB[4];
2084 + for(int ic=1;ic<5;ic++)
2085 + {
2086 +   stringstream hname1; hname1 << "segphiMB" << ic ;
2087 +   stringstream hname2; hname2 << "segzMB" << ic ;
2088 +   segphiMB[ic-1]=getHisto<TH1F>(hname1.str());
2089 +   segzMB[ic-1]=getHisto<TH1F>(hname2.str());
2090 + }
2091 +
2092 + TCanvas *SegPhiZ;
2093 + SegPhiZ = new TCanvas("SegPhiZ", "",201,81,999,850);
2094 + SegPhiZ->Divide(2,2) ;
2095 + for(int i=1;i<5;i++)
2096 + { SegPhiZ->cd(i)->SetFillColor(0);SegPhiZ->cd(i)->SetFrameFillColor(0); }
2097 +
2098 + SegPhiZ->cd(1);segphi->Draw();
2099 + SegPhiZ->cd(2);segphivsz->Draw("colz");
2100 + first_to_paint=segphiMB[0];
2101 + int nbmaxPSeg=segphiMB[0]->GetMaximum();
2102 + for(int i=1;i<4;i++)
2103 + {
2104 +   int nbmax0=segphiMB[i]->GetMaximum();
2105 +   if(nbmax0>nbmaxPSeg){
2106 +      nbmaxPSeg=nbmax0;
2107 +      first_to_paint=segphiMB[i];
2108 +   }
2109 + }
2110 + first_to_paint->SetTitle("phi of segment position");
2111 + first_to_paint->SetMinimum(0);
2112 + SegPhiZ->cd(3);first_to_paint->Draw();
2113 + for(int i=0;i<4;i++)
2114 + {
2115 +  segphiMB[i]->SetLineColor(i+1);
2116 +  segphiMB[i]->Draw("same");
2117 + }
2118 + first_to_paint=segzMB[0];
2119 + first_to_paint->SetMinimum(0);
2120 + int nbmaxZSeg=segzMB[0]->GetMaximum();
2121 + for(int i=1;i<3;i++) // Not consider the MB4, not Theta Segment
2122 + {
2123 +   int nbmax0=segzMB[i]->GetMaximum();
2124 +   if(nbmax0>nbmaxZSeg){
2125 +      nbmaxZSeg=nbmax0;
2126 +      first_to_paint=segzMB[i];
2127 +   }
2128 + }
2129 + first_to_paint->SetTitle("z of segment position");
2130 + SegPhiZ->cd(4);first_to_paint->Draw();
2131 + for(int i=0;i<3;i++)  // Not consider the MB4, not Theta Segment
2132 + {
2133 +  segzMB[i]->SetLineColor(i+1);
2134 +  segzMB[i]->Draw("same");
2135 + }
2136 +
2137 +
2138 + createGifFile("SegmentPosition","",SegPhiZ,false);
2139 + delete SegPhiZ;
2140 +
2141 + TH1F * difPhi4_all=getHisto<TH1F>("DifPhi4_1");
2142 + TH1F * difPhi4_top=getHisto<TH1F>("DifPhi4_1_top");
2143 + TH1F * difPhi4_bot=getHisto<TH1F>("DifPhi4_1_bot");
2144 +
2145 + TCanvas *DifPhi4;
2146 + DifPhi4 = new TCanvas("DifPhi4", "",201,81,699,400);
2147 + DifPhi4->Divide(2,1) ;
2148 + for(int i=1;i<3;i++)
2149 + { DifPhi4->cd(i)->SetFillColor(0);DifPhi4->cd(i)->SetFrameFillColor(0); }
2150 + TPad *DifPhi4_2 = (TPad*) DifPhi4->GetListOfPrimitives()->FindObject("DifPhi4_2");
2151 +
2152 + DifPhi4->cd(1);difPhi4_all->Draw();
2153 + TPaveLabel * titleDifPhi41 = new TPaveLabel(0.05,0.92,0.7,0.99,"phi pos. in MB4-MB1","NDC");
2154 + titleDifPhi41->Draw();                                                                      
2155 +
2156 + difPhi4_top->SetTitle("Top Sectors"); difPhi4_bot->SetTitle("Bottom Sectors");
2157 + DifPhi4->cd(2)->SetFillColor(0);DifPhi4->cd(2)->SetFrameFillColor(0);
2158 + DifPhi4->cd(2);
2159 + gStyle->SetOptTitle(0);
2160 + double nphi4top=difPhi4_top->GetMaximum();
2161 + double nphi4bot=difPhi4_bot->GetMaximum();
2162 + if(nphi4bot>nphi4top)
2163 + { difPhi4_bot->Draw();difPhi4_top->Draw("same"); }
2164 + else
2165 +  {difPhi4_top->Draw();difPhi4_bot->Draw("same"); }
2166 +  
2167 + DifPhi4_2->BuildLegend();
2168 + titleDifPhi41->Draw();
2169 +
2170 +
2171 + createGifFile("DifPhi14","",DifPhi4,false);
2172 +
2173 + delete DifPhi4;
2174 +
2175 + gStyle->SetOptTitle(1);
2176 +
2177 +
2178 + TCanvas *hSeg;
2179 + hSeg = new TCanvas("hSeg", "",201,81,999,850);
2180 + hSeg->Divide(2,2);
2181 + for(int i=1;i<4;i++)
2182 + { hSeg->cd(i)->SetFillColor(0);hSeg->cd(i)->SetFrameFillColor(0); }
2183 +
2184 + TH1F * hnSegDT=getHisto<TH1F>("hnSegDT");
2185 + TH1F * hnHSegDT=getHisto<TH1F>("hnHSegDT");
2186 + TH1F * hnSegMB1=getHisto<TH1F>("hnSegMB1");
2187 + TH1F * hnHSegMB1=getHisto<TH1F>("hnHSegMB1");
2188 +
2189 + hSeg->cd(1);hnSegDT->Draw();
2190 + hSeg->cd(2);hnHSegDT->Draw();
2191 + hSeg->cd(3);hnSegMB1->Draw();
2192 + hSeg->cd(4);hnHSegMB1->Draw();
2193 +
2194 + createGifFile("SegmentsAll","",hSeg,false);
2195 + delete hSeg;
2196  
2197   }
2198  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines