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.1 by battilan, Sun Nov 2 20:43:11 2008 UTC vs.
Revision 1.6 by cerminar, Fri Dec 19 16:36:40 2008 UTC

# Line 12 | Line 12
12  
13  
14   #include <UserCode/DTDPGAnalysis/src/DTDPGCreateAnalyzerSummary.h>
15 + #include "UserCode/DTDPGAnalysis/src/DTROUtility.h"
16  
17   // Framework
17 #include <FWCore/Utilities/interface/Exception.h>
18   #include <FWCore/Framework/interface/Event.h>
19   #include <FWCore/Framework/interface/EventSetup.h>
20  
# Line 62 | Line 62 | DTDPGCreateAnalyzerSummary::~DTDPGCreate
62  
63    edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Destructor ";
64  
65  if(myFile) {
66    myFile->Close();
67    delete myFile;
68  }
69
65   }
66  
67  
# Line 96 | Line 91 | void DTDPGCreateAnalyzerSummary::endJob(
91    myMainFolder.append(cMainFolder);
92    myMainFolder.append("/DT/Run summary/DTOfflineAnalyzer/");
93  
94 <
94 >  string mainFold;
95 >  mainFold.append(cMainFolder);
96 >  mainFold.append("/DT/Run summary/");
97    edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Creating summaries!";
98 <  
99 <  if (myParameters.getUntrackedParameter<bool>("FullWheelHistos", false))    { createFullWheelPlots(); }
98 >
99 >  DTROUtility roUtil(myFile,mainFold);
100 >  mySectors = roUtil.getSectorMap();
101 >
102 >  if (myParameters.getUntrackedParameter<bool>("SummaryHistos", false))    { createSummaryPlots(); }
103    if (myParameters.getUntrackedParameter<bool>("SummaryWheelHistos", false)) { createSummaryWheelPlots(); }
104    if (myParameters.getUntrackedParameter<bool>("SummaryAllHistos", false))   { createSummaryAllPlots(); }
105  
106 +  if(myFile) {
107 +    myFile->Close();
108 +    delete myFile;
109 +  }
110 +
111   }
112  
113   void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, int wh, int sec, string tag, TCanvas *canvas) {
# Line 157 | Line 162 | void DTDPGCreateAnalyzerSummary::createG
162   }
163    
164    
165 < void DTDPGCreateAnalyzerSummary::createFullWheelPlots() {
165 > void DTDPGCreateAnalyzerSummary::createSummaryPlots() {
166  
167    string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
168  
# Line 181 | Line 186 | void DTDPGCreateAnalyzerSummary::createF
186  
187    int nbin;
188    float max, max1;
184  TPaveText* sid;
185  TPaveText* labcont[50]; TText* cont[50];
186
189  
188  // Occupancies
190    TH2F *DigiXYS[5][14];
191 <  for(int iw=0;iw<5;++iw) {
192 <    for(int isec=1;isec<15;isec++) {
193 <      stringstream histoname; histoname << "hDigiXY_" << Whname[iw] << "_S" << isec;
194 <      DigiXYS[iw][isec-1]=getHisto<TH2F*>(histoname.str());
195 <    }
196 <  }
197 <
198 <   // Crea and fill individual layer occupancy plots from hDigiXY_S
199 <   TH1F * DigiXSecMBSlLayer[5][14][4][3][4];
200 <   for(int iw=0;iw<5;++iw){
201 <     for(int isec=1;isec<15;++isec){
202 <       for(int ich=1;ich<5;++ich){
203 <         for(int isl=1;isl<4;++isl){
204 <           for(int il=1;il<5;++il){
205 <             stringstream histoname;  histoname  << "Occup_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" <<il;
206 <             stringstream histotitle; histotitle << "Occupancy  " << Whname[iw] << " S" << isec << " MB" << ich << " SL" << SLname[isl-1] << "L" << il;
207 <             DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]= new TH1F(histoname.str().c_str(),histotitle.str().c_str(),100, 0.,100.);
208 <           }
209 <         }
210 <       }
211 <     }
212 <   }
213 <
214 <   for(int iw=0;iw<5;iw++){
215 <     for(int isec=1;isec<15;isec++){
216 <      
217 <       int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
218 <       //int nby= DigiXYS[iw][isec-1]->GetNbinsY() ;
191 >  TH1F *DigiXSecMBSlLayer[5][14][4][3][4];
192 >  TH1F *TBoxSecMBSlLayer[5][14][4][3][4];
193 >  TH1F *Correlated_trig_Bx[5][14][4][3];
194 >  TH1F *hTrg_effnum_SecMB[5][14][4];
195 >  TH1F *hTrg_effdenum_SecMB[5][14][4];
196 >  TH1F *hPhiHL_SecMB[5][14][4];
197 >  TH1F *TriggerMatrix[5][15];
198 >  TH1F * TriggerInclusive[5];
199 >
200 >  std::map<int,std::vector<int> >::const_iterator whIt  = mySectors.begin();
201 >  std::map<int,std::vector<int> >::const_iterator whEnd = mySectors.end();
202 >  for(;whIt!=whEnd;++whIt) {
203 >    int iw = (*whIt).first + 2;
204 >    std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
205 >    std::vector<int>::const_iterator secEnd = (*whIt).second.end();
206 >    for(;secIt!=secEnd;++secIt) {
207 >      int isec = (*secIt);
208 >
209 >     // Occupancies
210 >      stringstream histoNameOcc; histoNameOcc << "hDigiXY_" << Whname[iw] << "_S" << isec;
211 >      DigiXYS[iw][isec-1]=getHisto<TH2F>(histoNameOcc.str());
212 >      for(int ich=1;ich<5;++ich){
213 >        for(int isl=1;isl<4;++isl){
214 >          for(int il=1;il<5;++il){
215 >            // Create and fill individual layer occupancy plots from hDigiXY_S
216 >            stringstream histoNameOccup;  histoNameOccup  << "Occup_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" <<il;
217 >            stringstream histoTitleOccup; histoTitleOccup << "Occupancy  " << Whname[iw] << " S" << isec << " MB" << ich << " SL" << SLname[isl-1] << "L" << il;
218 >            DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]= new TH1F(histoNameOccup.str().c_str(),histoTitleOccup.str().c_str(),100, 0.,100.);
219 >            // TBoxes
220 >            stringstream histoNameTBox; histoNameTBox << "htime_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" << il;
221 >            TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]=getHisto<TH1F>(histoNameTBox.str());
222 >          }
223 >        }
224 >        // Correlated Triggers
225 >        for(int iq=4;iq<7;iq++){
226 >          stringstream histoNameTrQual; histoNameTrQual << "hTrigBX_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_qual" << iq;
227 >          Correlated_trig_Bx[iw][isec-1][ich-1][iq-4]=getHisto<TH1F>(histoNameTrQual.str());
228 >        }
229 >        // Trig Eff
230 >        stringstream htag; htag << "_" << Whname[iw] << "_S" << isec << "_MB" << ich;
231 >        stringstream heffden; heffden << "hTrg_effdenum" << htag.str();
232 >        hTrg_effdenum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(heffden.str());
233 >        stringstream heffnum; heffnum  << "hTrg_effnum" << htag.str();
234 >        hTrg_effnum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(heffnum.str());
235 >        stringstream phihl; phihl << "hPhiHL" << htag.str();
236 >        hPhiHL_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(phihl.str());
237  
238 <       for(int ich=1;ich<5;ich++){
220 <         for(int isl=1;isl<4;isl++){
221 <           for(int il=1;il<5;il++){
222 <             int iby=(ich-1)*20+(isl-1)*4+il+1;
223 <             float totentr=0;
224 <             for(int ibx=1;ibx<nbx;ibx++){
225 <               float yval=DigiXYS[iw][isec-1]->GetBinContent(ibx,iby);
226 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetBinContent(ibx,yval);
227 <               totentr+=yval;
228 <             }
229 <             DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetEntries(totentr);
230 <           }
231 <         }
232 <       }
233 <     }
234 <   }// end loop sector
238 >      }
239  
240 <   // TBoxes
237 <   TH1F * TBoxSecMBSlLayer[5][14][4][3][4];
238 <   for(int iw=0;iw<5;iw++){
239 <     for(int isec=1;isec<15;isec++){
240 <       for(int ich=1;ich<5;ich++){
241 <         for(int isl=1;isl<4;isl++){
242 <           for(int il=1;il<5;il++){
243 <             stringstream histoname; histoname << "htime_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" << il;
244 <             TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]=getHisto<TH1F*>(histoname.str());
245 <           }
246 <         }
247 <       }
248 <     }
249 <   }
240 >      int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
241  
242 <   TH1F *Correlated_trig_Bx[5][14][4][3];
243 <   for(int iw=0;iw<5;iw++){
244 <     for(int isec=1;isec<15;isec++){
245 <       for(int ich=1;ich<5;ich++){
246 <         for(int iq=4;iq<7;iq++){
247 <           stringstream histoname; histoname << "hTrigBX_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_qual" << iq;
248 <           Correlated_trig_Bx[iw][isec-1][ich-1][iq-4]=getHisto<TH1F*>(histoname.str());
249 <         }
250 <       }
251 <     }
252 <   }
242 >      for(int ich=1;ich<5;ich++){
243 >        for(int isl=1;isl<4;isl++){
244 >          for(int il=1;il<5;il++){
245 >            int iby=(ich-1)*20+(isl-1)*4+il+1;
246 >            float totentr=0;
247 >            for(int ibx=1;ibx<nbx;ibx++){
248 >              float yval=DigiXYS[iw][isec-1]->GetBinContent(ibx,iby);
249 >              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetBinContent(ibx,yval);
250 >              totentr+=yval;
251 >            }
252 >            DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetEntries(totentr);
253 >          }
254 >        }
255 >      }
256  
257 <   TH1F *hTrg_effnum_SecMB[5][14][4];
258 <   TH1F *hTrg_effdenum_SecMB[5][14][4];
259 <   TH1F *hPhiHL_SecMB[5][14][4];
266 <   for(int iw=0;iw<5;iw++){
267 <     for(int isec=1;isec<15;isec++){
268 <       for(int ich=1;ich<5;ich++){
269 <         stringstream htag; htag << "_" << Whname[iw] << "_S" << isec << "_MB" << ich;
270 <         stringstream heffden; heffden << "hTrg_effdenum" << htag.str();
271 <         hTrg_effdenum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F*>(heffden.str());
272 <         stringstream heffnum; heffnum  << "hTrg_effnum" << htag.str();
273 <         hTrg_effnum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F*>(heffnum.str());
274 <         stringstream phihl; phihl << "hPhiHL" << htag.str();
275 <         hPhiHL_SecMB[iw][isec-1][ich-1]=getHisto<TH1F*>(phihl.str());
276 <       }
277 <     }
278 <   }
257 >      // Trigger matrix
258 >      stringstream histoNameTrMatrix; histoNameTrMatrix << "TriggerMatrix" << Whname[iw] << "_S" << isec;
259 >      TriggerMatrix[iw][isec-1]=getHisto<TH1F>(histoNameTrMatrix.str());
260  
261 <   TH1F *TriggerMatrix[5][15];
262 <   for(int iw=0;iw<5;iw++){
263 <     for(int isec=1;isec<15;isec++){
264 <       stringstream histoname; histoname << "TriggerMatrix" << Whname[iw] << "_S" << isec;
265 <       TriggerMatrix[iw][isec-1]=getHisto<TH1F*>(histoname.str());
266 <     }
267 <   }
261 >    }
262 >    // Trigger Inclusive
263 >    stringstream histoNameTrInclusive; histoNameTrInclusive << "TriggerInclusive" << Whname[iw];
264 >    TriggerInclusive[iw]=getHisto<TH1F>(histoNameTrInclusive.str());
265 >    for (int isec=1;isec<13;++isec) {
266 >      for (int ibin=1; ibin<5; ibin++) {
267 >        stringstream hlabel; hlabel << "S" << isec << "MB" << ibin;
268 >        TriggerInclusive[iw]->GetXaxis()->SetBinLabel((isec-1)*5+ibin,hlabel.str().c_str());
269 >      }
270 >      TriggerInclusive[iw]->GetXaxis()->SetBinLabel(isec*5," ");
271 >    }  
272 >  }
273  
274 <   TH1F * TriggerInclusive[5];
275 <   for(int iw=0;iw<5;iw++){
276 <     stringstream histoname; histoname << "TriggerInclusive" << Whname[iw];
277 <     TriggerInclusive[iw]=getHisto<TH1F*>(histoname.str());
278 <   }
279 <
280 <   //===================================================================================
281 <   //    DIGI's occupancies
282 <   //===================================================================================
283 <
284 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing  DIGI's occupancies per layer in 1 single page per Sector" << endl;
285 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
286 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
287 <
302 <       TCanvas *Digi = new TCanvas("Digi", "",201,81,999,699);  
303 <       Digi->Divide(3,4) ;
304 <
305 <       for(int ich=1;ich<5;ich++){
306 <         for(int isl=1;isl<4;isl++){
307 <           bool dodraw=1;
308 <           if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
309 <           if(dodraw){
310 <             // look first for the maximum bin entries
311 <             first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
312 <             float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
313 <             for(int il=2;il<5;il++){
314 <               float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
315 <               if(nbmax0>nbmax){
316 <                 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
317 <                 nbmax=nbmax0;
318 <               }
319 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
320 <             }
321 <             stringstream htitle; htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
322 <             first_to_paint->SetTitle(htitle.str().c_str());
323 <             int icpos=(ich-1)*3+isl;
324 <             Digi->cd(icpos) ;
325 <             Digi->cd(icpos)->SetLogy();
326 <             first_to_paint->GetYaxis()->SetLabelSize(0.07);
327 <             first_to_paint->GetXaxis()->SetLabelSize(0.07);
328 <             first_to_paint->Draw();
329 <             for(int il=1;il<5;il++){
330 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
331 <             }
332 <           }
333 <         }
334 <       }
274 >  whIt  = mySectors.begin();
275 >  whEnd = mySectors.end();
276 >  for(;whIt!=whEnd;++whIt) {
277 >    int iw = (*whIt).first + 2;
278 >    std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
279 >    std::vector<int>::const_iterator secEnd = (*whIt).second.end();
280 >    for(;secIt!=secEnd;++secIt) {
281 >      int isec = (*secIt);
282 >
283 >      //===================================================================================
284 >      //    DIGI's occupancies
285 >      //===================================================================================
286 >      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing DIGI's occupancies per layer in 1 single page per Sector wh "
287 >                                        << (iw-2) << " sec " << isec << endl;
288  
289 <       createGifFile("Occupancies_LogScale",iw-2,isec,"",Digi);
290 <       delete Digi;
338 <     }
339 <   }// End Loop on sectors
289 >      TCanvas *Digi = new TCanvas("Digi", "",201,81,999,699);  
290 >      Digi->Divide(3,4) ;
291  
292 +      for(int ich=1;ich<5;ich++){
293 +        for(int isl=1;isl<4;isl++){
294 +          bool dodraw=1;
295 +          if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
296 +          if(dodraw){
297 +            // look first for the maximum bin entries
298 +            first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
299 +            float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
300 +            for(int il=2;il<5;il++){
301 +              float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
302 +              if(nbmax0>nbmax){
303 +                first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
304 +                nbmax=nbmax0;
305 +              }
306 +              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
307 +            }
308 +            stringstream htitle; htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
309 +            first_to_paint->SetTitle(htitle.str().c_str());
310 +            int icpos=(ich-1)*3+isl;
311 +            Digi->cd(icpos) ;
312 +            Digi->cd(icpos)->SetLogy();
313 +            first_to_paint->GetYaxis()->SetLabelSize(0.07);
314 +            first_to_paint->GetXaxis()->SetLabelSize(0.07);
315 +            first_to_paint->Draw();
316 +            for(int il=1;il<5;il++){
317 +              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
318 +            }
319 +          }
320 +        }
321 +      }
322 +      createGifFile("Occupancies_LogScale",iw-2,isec,"",Digi);
323 +      delete Digi;
324  
325 <   //===================================================================================
326 <   //    DIGI's occupancies
327 <   //    now print 1 page per SL
328 <   //===================================================================================
329 <
330 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing DIGI's occupancies  per layer in 1 single page per SL" << endl;
331 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
332 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
333 <
334 <       int ichmin=1; if (isec==13|| isec==14)ichmin=4;
335 <       for(int ich=ichmin;ich<5;ich++){
336 <         for(int isl=1;isl<4;isl++){
337 <           TCanvas *DigiSL = new TCanvas("DigiSL", "",201,81,999,699);  
338 <           bool dodraw=1;
339 <           if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
340 <           if(dodraw){
341 <             // look first for the maximum bin entries
342 <             first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
343 <             float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
344 <             for(int il=2;il<5;il++){
345 <               float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
346 <               if(nbmax0>nbmax){
347 <                 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
348 <                 nbmax=nbmax0;
349 <               }
350 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
351 <             }
352 <             stringstream htitle;  htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
353 <             first_to_paint->SetTitle(htitle.str().c_str());
354 <             //int icpos=(ich-1)*3+isl;
355 <             first_to_paint->GetYaxis()->SetLabelSize(0.05);
356 <             first_to_paint->GetXaxis()->SetLabelSize(0.05);
357 <             first_to_paint->Draw();
375 <             for(int il=1;il<5;il++){
376 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
377 <             }
325 >      //===================================================================================
326 >      //    DIGI's occupancies
327 >      //    now print 1 page per SL
328 >      //===================================================================================
329 >      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing DIGI's occupancies  per layer in 1 single page per SL wh "
330 >                                        << (iw-2) << " sec " << isec << endl;
331 >      int ichmin=1; if (isec==13|| isec==14)ichmin=4;
332 >      for(int ich=ichmin;ich<5;ich++){
333 >        for(int isl=1;isl<4;isl++){
334 >          TCanvas *DigiSL = new TCanvas("DigiSL", "",201,81,999,699);  
335 >          bool dodraw=1;
336 >          if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
337 >          if(dodraw){
338 >            // look first for the maximum bin entries
339 >            first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
340 >            float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
341 >            for(int il=2;il<5;il++){
342 >              float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
343 >              if(nbmax0>nbmax){
344 >                first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
345 >                nbmax=nbmax0;
346 >              }
347 >              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
348 >            }
349 >            stringstream htitle;  htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
350 >            first_to_paint->SetTitle(htitle.str().c_str());
351 >            //int icpos=(ich-1)*3+isl;
352 >            first_to_paint->GetYaxis()->SetLabelSize(0.05);
353 >            first_to_paint->GetXaxis()->SetLabelSize(0.05);
354 >            first_to_paint->Draw();
355 >            for(int il=1;il<5;il++){
356 >              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
357 >            }
358              
359 <             stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
360 <             createGifFile("Occupancies",(iw-2),isec,fileTag.str(),DigiSL);
361 <             delete DigiSL;
362 <           }
359 >            stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
360 >            createGifFile("Occupancies",(iw-2),isec,fileTag.str(),DigiSL);
361 >            delete DigiSL;
362 >          }
363            
364 <         }//end Loop Superlayers
365 <       }//end Loop chambers
386 <     }// End Loop on sectors
387 <   }// End Loop on wheels
388 <
364 >        }//end Loop Superlayers
365 >      }//end Loop chambers
366  
367 <   //====================================================================================
368 <   //    Time boxes: all in 1 single page (Layer granularity)
369 <   //===================================================================================
370 <  
371 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per Sector" << endl;
372 <   //for(int isec=1;isec<15;isec++) // Loop on sectors
373 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
397 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
398 <      
399 <       TCanvas *Tboxes = new TCanvas("Tboxes", "",201,81,999,699);
400 <       Tboxes->Divide(3,4) ;
367 >      //====================================================================================
368 >      //    Time boxes: all in 1 single page (Layer granularity)
369 >      //===================================================================================
370 >      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per Sector wh "
371 >                                        << (iw-2) << " sec " << isec << endl;
372 >      TCanvas *Tboxes = new TCanvas("Tboxes", "",201,81,999,699);
373 >      Tboxes->Divide(3,4) ;
374  
375 <       for(int ich=1;ich<5;ich++){
376 <         for(int isl=1;isl<4;isl++){
377 <           bool dodraw=1;
378 <           if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
379 <           if(dodraw){
380 <               // look first for the maximum bin entries
381 <               first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
382 <               float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
383 <               for(int il=2;il<5;il++){
384 <                 float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
385 <                 if(nbmax0>nbmax){
386 <                   first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
387 <                   nbmax=nbmax0;
388 <                 }
389 <                 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
390 <               }
391 <               stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
392 <               first_to_paint->SetTitle(htitle.str().c_str());
393 <               int icpos=(ich-1)*3+isl;
394 <               Tboxes->cd(icpos) ;
395 <               first_to_paint->GetYaxis()->SetLabelSize(0.07);
396 <               first_to_paint->GetXaxis()->SetLabelSize(0.07);
397 <               first_to_paint->Draw();
398 <               for(int il=1;il<5;il++){
399 <                 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
400 <               }
401 <           }
402 <         }
403 <       }
375 >      for(int ich=1;ich<5;ich++){
376 >        for(int isl=1;isl<4;isl++){
377 >          bool dodraw=1;
378 >          if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
379 >          if(dodraw){
380 >            // look first for the maximum bin entries
381 >            first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
382 >            float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
383 >            for(int il=2;il<5;il++){
384 >              float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
385 >              if(nbmax0>nbmax){
386 >                first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
387 >                nbmax=nbmax0;
388 >              }
389 >              TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
390 >            }
391 >            stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
392 >            first_to_paint->SetTitle(htitle.str().c_str());
393 >            int icpos=(ich-1)*3+isl;
394 >            Tboxes->cd(icpos) ;
395 >            first_to_paint->GetYaxis()->SetLabelSize(0.07);
396 >            first_to_paint->GetXaxis()->SetLabelSize(0.07);
397 >            first_to_paint->Draw();
398 >            for(int il=1;il<5;il++){
399 >              TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
400 >            }
401 >          }
402 >        }
403 >      }
404    
405 <       createGifFile("Tboxes",(iw-2),isec,"",Tboxes);
406 <       delete Tboxes;
434 <     }// End Loop on sectors
435 <   }// End Loop on wheels
436 <
405 >      createGifFile("Tboxes",(iw-2),isec,"",Tboxes);
406 >      delete Tboxes;
407  
408 <   //===================================================================================
409 <   //    Time boxes: 1 page per SL
410 <   //===================================================================================
411 <  
412 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per SL" << endl;
413 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
414 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
415 <      
416 <       int ichmin=1; if (isec==13|| isec==14)ichmin=4;
447 <       for(int ich=ichmin;ich<5;ich++){
448 <         for(int isl=1;isl<4;isl++){
449 <           TCanvas *TboxSL = new TCanvas("TboxSL", "",201,81,999,699);
408 >      //===================================================================================
409 >      //    Time boxes: 1 page per SL
410 >      //===================================================================================
411 >      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per SL wh "
412 >                                        << (iw-2) << " sec " << isec << endl;
413 >      ichmin=1; if (isec==13|| isec==14)ichmin=4;
414 >      for(int ich=ichmin;ich<5;ich++){
415 >        for(int isl=1;isl<4;isl++){
416 >          TCanvas *TboxSL = new TCanvas("TboxSL", "",201,81,999,699);
417            
418 <           bool dodraw=1;
419 <           if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
420 <           if(dodraw){
421 <             // look first for the maximum bin entries
422 <             first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
423 <             float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
424 <             for(int il=2;il<5;il++){
425 <               float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
426 <               if(nbmax0>nbmax){
427 <                 first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
428 <                 nbmax=nbmax0;
429 <               }
430 <               TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
431 <             }
432 <             stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
433 <             first_to_paint->SetTitle(htitle.str().c_str());
434 <             first_to_paint->GetYaxis()->SetLabelSize(0.04);
435 <             first_to_paint->GetXaxis()->SetLabelSize(0.04);
436 <             first_to_paint->Draw();
437 <             for(int il=1;il<5;il++){
438 <               TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
439 <             }
418 >          bool dodraw=1;
419 >          if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
420 >          if(dodraw){
421 >            // look first for the maximum bin entries
422 >            first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
423 >            float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
424 >            for(int il=2;il<5;il++){
425 >              float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
426 >              if(nbmax0>nbmax){
427 >                first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
428 >                nbmax=nbmax0;
429 >              }
430 >              TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
431 >            }
432 >            stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
433 >            first_to_paint->SetTitle(htitle.str().c_str());
434 >            first_to_paint->GetYaxis()->SetLabelSize(0.04);
435 >            first_to_paint->GetXaxis()->SetLabelSize(0.04);
436 >            first_to_paint->Draw();
437 >            for(int il=1;il<5;il++){
438 >              TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
439 >            }
440              
441 <             stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
442 <             createGifFile("Tboxes",(iw-2),isec,fileTag.str(),TboxSL);
443 <             delete TboxSL;
444 <           }
445 <         }//end loop SL      
446 <       }//end loop chambers
480 <     }// End Loop on sectors
481 <   } // End Loop on wheels
482 <
441 >            stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
442 >            createGifFile("Tboxes",(iw-2),isec,fileTag.str(),TboxSL);
443 >            delete TboxSL;
444 >          }
445 >        }//end loop SL      
446 >      }//end loop chambers
447  
448 <   //===================================================================================
449 <   //    Trigger: Summary & BX profile
486 <   //===================================================================================
487 <  
488 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing single chamber BX profiles per Sector" << endl;
489 <   // BX profiles:
490 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
491 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
492 <      
493 <       if(isec <13){
494 <         TCanvas *Trigg = new TCanvas("Trigg", "",201,81,999,699);
495 <         Trigg->Divide(2,2) ;
496 <         for(int ich=1;ich<5;ich++){
497 <           Trigg->cd(ich) ;
498 <           Trigg->cd(ich)->SetLogy();
499 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetTitle("BX id");
500 <           stringstream htitle; htitle << "llHlHH_trig_bxMB"<< ich;
501 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->SetTitle(htitle.str().c_str());
502 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetTitleSize(0.05);
503 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetLabelSize(0.05);
504 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetLabelSize(0.05);
505 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->Draw();
506 <           Correlated_trig_Bx[iw][isec-1][ich-1][1]->SetLineColor(2);
507 <           Correlated_trig_Bx[iw][isec-1][ich-1][1]->Draw("same");
508 <           Correlated_trig_Bx[iw][isec-1][ich-1][0]->SetLineColor(3);
509 <           Correlated_trig_Bx[iw][isec-1][ich-1][0]->Draw("same");
510 <         }// end loop on chambers
511 <         createGifFile("Trigger_Summary",(iw-2),isec,"",Trigg);
512 <         delete Trigg;
513 <       }
514 <     }// end loop on sectors
515 <   }// end loop on wheels
448 >    }
449 >  }//end Loop on sectors/wheels
450  
451  
452 <   //===================================================================================
453 <   //    Trigger: HH&HL efficiencies
454 <   //===================================================================================
455 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing HH&HL efficiencies" << endl;
456 <   TH1F *heffTrgSecMB[5][14][4];
457 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
458 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
459 <       if(isec <13){
460 <         TCanvas *EffTrg = new TCanvas("EffTrg", "",201,81,999,699);
461 <         EffTrg->Divide(2,4); // divide canvas in 2 columns, 4 raws
462 <         for(int ich=1;ich<5;ich++){
463 <           stringstream histoname; histoname << "heffTrgSec" << isec << "MB" << ich;
464 <           heffTrgSecMB[iw][isec-1][ich-1] =(TH1F*)hTrg_effnum_SecMB[iw][isec-1][ich-1]->Clone(histoname.str().c_str());
465 <           heffTrgSecMB[iw][isec-1][ich-1]->Divide(hTrg_effnum_SecMB[iw][isec-1][ich-1]
466 <                                                   ,hTrg_effdenum_SecMB[iw][isec-1][ich-1],1.0,1.0);
467 <           heffTrgSecMB[iw][isec-1][ich-1]->SetMaximum(1.1);
468 <           heffTrgSecMB[iw][isec-1][ich-1]->SetMinimum(0.);
469 <           heffTrgSecMB[iw][isec-1][ich-1]->GetXaxis()->SetLabelSize(0.05);
470 <           heffTrgSecMB[iw][isec-1][ich-1]->GetYaxis()->SetLabelSize(0.05);
471 <           for (int i = 0; i <= hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetNbinsX()+1; i++ ) {
472 <             Float_t tot   = hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetBinContent(i) ;
473 <             Float_t tot_e = hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetBinError(i);
474 <             Float_t eff = heffTrgSecMB[iw][isec-1][ich-1]->GetBinContent(i) ;
475 <             Float_t Err = 0.;
476 <             if (tot > 0) Err = tot_e / tot * sqrt( eff* (1-eff) );
477 <             // if (eff == 1. || isnan(Err) || !isfinite(Err) ) Err=1.e-3;
478 <             heffTrgSecMB[iw][isec-1][ich-1]->SetBinError(i, Err);
479 <           }
480 <        
481 <           EffTrg->cd((ich-1)*2+1);  
482 <           heffTrgSecMB[iw][isec-1][ich-1]->Draw();
483 <           EffTrg->cd((ich-1)*2+2);  
484 <           hPhiHL_SecMB[iw][isec-1][ich-1]->Draw();
485 <         }
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 <         createGifFile("TriggEff_HH&HL",(iw-2),isec,"",EffTrg);
524 <         delete EffTrg;
525 <       }
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 <     }// End loop on sectors
530 <   }// End loop on wheels
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 <   //===================================================================================
539 <   //    Trigger: TriggerMatrix
540 <   //===================================================================================
541 <  
542 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing TriggerMatrix" << endl;
543 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
544 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
545 <       if(isec <13){
546 <         nbin = TriggerMatrix[iw][isec-1]->GetXaxis()->GetNbins();
547 <         max = 0;
548 <         TCanvas *Trigmatri = new TCanvas("TriggerMatrix", "",201,81,999,699);
549 <         Trigmatri->SetBottomMargin(0.12);
550 <      
551 <         for (int ibin=1; ibin<nbin+1; ibin++)
552 <           max = (max > TriggerMatrix[iw][isec-1]->GetBinContent(ibin) ) ? max : TriggerMatrix[iw][isec-1]->GetBinContent(ibin) ;
553 <         max1=max*1.3;
554 <      
555 <         TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelOffset(0.043);
556 <         // TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelOffset(-0.01);
557 <         // TriggerMatrix[iw][isec-1]->LabelsOption("v");
558 <         // TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelSize(0.04);
559 <      
560 <         TriggerMatrix[iw][isec-1]->SetMaximum(max1);
561 <         TriggerMatrix[iw][isec-1]->Draw();
562 <      
563 <         //sid = new TPaveText (-0.5,max1-(max1-max)/2,5,max1);
564 <         //sprintf (sid1,"YB%i, Sector %u, run %u",wheel, isec, run);
565 <         //sid->AddText(sid1);
566 <         //sid->Draw();
567 <      
568 <         for (int ibin=1; ibin<nbin+1; ibin++) {
569 <           if (ibin == 2 || ibin == 7 ||  ibin == 14 ||  ibin == 19) continue;
570 <           float x1 = TriggerMatrix[iw][isec-1]->GetBinCenter(ibin) - TriggerMatrix[iw][isec-1]->GetBinWidth(ibin)/2;
571 <           float x2 = TriggerMatrix[iw][isec-1]->GetBinCenter(ibin) + TriggerMatrix[iw][isec-1]->GetBinWidth(ibin)/2;
572 <           float y1 = max + (max1-max)/8;
596 <           float y2 = max1 - (max1-max)/2;
597 <           labcont[ibin-1] = new TPaveText (x1,y1,x2,y2);
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]);
602 <      
603 <           cont[ibin-1] = labcont[ibin-1]->AddText (contbin);
604 <           //    isme.SetTextAngle(90.);
605 <           cont[ibin-1]->SetTextSize(0.02);
606 <           labcont[ibin-1]->Draw();
607 <         }
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 <         createGifFile("TriggerMatrix",(iw-2),isec,"",Trigmatri);
579 <         delete Trigmatri;
580 <       }
581 <
582 <     }// End loop on sectors
583 <   }// End loop on wheels
584 <
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  
617   //===================================================================================
618   //    Trigger: TriggerInclusive
619   //===================================================================================
620
621   //=======   ALL   SECTORS             ===============================================
622   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing TriggerInclusive Sector by Sector" << endl;
623   for(int iw=0;iw<5;iw++){ //Loop on wheels
624
625     TCanvas *Trigmatri = new TCanvas("TriggerMatrix", "",201,81,999,699);
626     Trigmatri->SetBottomMargin(0.12);
627
628     nbin = TriggerInclusive[iw]->GetXaxis()->GetNbins();
629     max = 0;
630
631     for (int ibin=1; ibin<nbin+1; ibin++)
632       max = (max > TriggerInclusive[iw]->GetBinContent(ibin) ) ? max : TriggerInclusive[iw]->GetBinContent(ibin) ;
633     max1=max*1.3;
634     TriggerInclusive[iw]->SetMaximum(max1);
635     TriggerInclusive[iw]->GetXaxis()->SetLabelSize(0.035);
636     TriggerInclusive[iw]->Draw();
637    
638     sid = new TPaveText (0,max1-(max1-max)/2,2,max1);
639  
640     //cout <<" --> wheel, sector, run "; cin >>wheel>>sector>>run;
641     stringstream chname; chname << "YB," << (iw-2) <<",";
642     sid->AddText(chname.str().c_str());
643     sid->Draw();
644    
645     createGifFile("TriggerInclusive",(iw-2),"",Trigmatri);
646     delete Trigmatri;
647   }
648
649   //=======   SECTOR By SECTOR             ============================================
650   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing TriggerInclusive Sector by Sector" << endl;
651   for(int iw=0;iw<5;iw++){ //Loop on wheels
652     for(int isec=1;isec<15;isec++){ // Loop on sectors
653       if(isec<13){
594          TCanvas *TrigmatriSec = new TCanvas("TriggerInclusive[iw]", "",201,81,999,699);
595          TrigmatriSec->SetBottomMargin(0.12);
596          
# Line 667 | Line 607 | void DTDPGCreateAnalyzerSummary::createF
607          TriggerInclusive[iw]->SetMaximum(max1);
608          TriggerInclusive[iw]->Draw();
609          
610 <        sid = new TPaveText (0,max1-(max1-max)/2,2,max1);
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;
# Line 689 | Line 630 | void DTDPGCreateAnalyzerSummary::createF
630  
631          createGifFile("TriggerInclusive",(iw-2),isec,"",TrigmatriSec);
632          delete TrigmatriSec;
633 <      }
634 <    }// End loop on sectors
635 <  }// End loop on wheels
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 < }
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  
671 + }
672  
673   void DTDPGCreateAnalyzerSummary::createSummaryWheelPlots() {
674  
675    string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
676    string SLname[3]={"Phi1","Theta","Phi2"};
677    
678 <  TH1F *historun   = getHisto<TH1F*>("RunInfo_RunNumbers");
678 >  TH1F *historun   = getHisto<TH1F>("RunInfo_RunNumbers");
679    float TotEntries = historun->GetEntries();
680    
681    gStyle->SetTitleX(0.01);
# Line 736 | Line 710 | void DTDPGCreateAnalyzerSummary::createS
710  
711    
712  
713 < for(int iw=0;iw<4;iw++){ // Loop in wheels
713 > for(int iw=0;iw<5;iw++){ // Loop in wheels
714  
715     edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Processing Wheel " << iw-2 << endl;
742   //===================================================================================
716     //    Digi scatter plots
744   //===================================================================================
717     TCanvas *DQM1 = new TCanvas("DQM1", "",201,81,999,699);
718     DQM1->Divide(2,3) ;
719     TCanvas *DQM1b = new TCanvas("DQM1b", "",201,81,999,699);
# Line 755 | Line 727 | void DTDPGCreateAnalyzerSummary::createS
727    
728      for(int isec=1;isec<13;isec++){
729        stringstream histoname; histoname << "hDigiXY_" << Whname[iw] << "_S" << isec;
730 <      hDigiXYList[isec-1]= getHisto<TH2F*>(histoname.str());
730 >      hDigiXYList[isec-1]= getHisto<TH2F>(histoname.str());
731      }
732    
733      float Max=2000;
# Line 780 | Line 752 | void DTDPGCreateAnalyzerSummary::createS
752        hDigiXYList[is]->Draw("colz");
753      }
754  
783    stringstream fileDigi; fileDigi <<"Digi_r" << myRunNumber <<"_W" << (iw-2);
755      createGifFile("Digi",(iw-2),"_S1-S6",DQM1);
756      createGifFile("Digi",(iw-2),"_S7_S12",DQM2);
757  
# Line 798 | Line 769 | void DTDPGCreateAnalyzerSummary::createS
769        createGifFile("Digi",(iw-2),"_S7-S12_b",DQM2b);
770      }
771  
772 <    //===================================================================================
802 <    //    Ocupancies per SL
803 <    //===================================================================================
804 <    
772 >    //    Ocupancies per SL    
773      // Get histos to be plotted
774      int nbin;
775      float max, max1;
# Line 813 | Line 781 | void DTDPGCreateAnalyzerSummary::createS
781      TH2F *DigiXYS[5][14];
782      for(int isec=1;isec<15;isec++){
783        stringstream histoname; histoname << "hDigiXY_" << Whname[iw] << "_S" << isec;
784 <      DigiXYS[iw][isec-1]=getHisto<TH2F*>(histoname.str());
784 >      DigiXYS[iw][isec-1]=getHisto<TH2F>(histoname.str());
785      }
786      
787      // Crea and fill individual layer occupancy plots from hDigiXY_S
# Line 863 | Line 831 | void DTDPGCreateAnalyzerSummary::createS
831        }
832      }// end loop sector
833  
866    //===================================================================================
834      //    DIGI's occupancies
868    //===================================================================================
835  
836      TCanvas *Digi1 = new TCanvas("Digi1", "",201,81,999,699);  
837      TCanvas *Digi2 = new TCanvas("Digi2", "",201,81,999,699);  
# Line 904 | Line 870 | void DTDPGCreateAnalyzerSummary::createS
870      createGifFile("Occupancies_LogScale",(iw-2),"_S5-S8",Digi2);
871      createGifFile("Occupancies_LogScale",(iw-2),"_S9-S12",Digi3);
872  
907    //===================================================================================
873      //    TimeBoxes        
909    //===================================================================================
874      DQM1->Clear();
875      DQM1->Divide(6,2) ;
876      for (int ins=1; ins<13;ins++){
# Line 917 | Line 881 | void DTDPGCreateAnalyzerSummary::createS
881        DQM1->cd(ins);
882        for(int ic=1;ic<5;ic++){
883          stringstream hname; hname << "htime_" << Whname[iw] << "_S" << ins << "_MB" << ic;
884 <        hHisto[ic-1]=getHisto<TH1F*>(hname.str());
884 >        hHisto[ic-1]=getHisto<TH1F>(hname.str());
885          hHisto[ic-1]->SetLineColor(ic);
886        }
887  
# Line 948 | Line 912 | void DTDPGCreateAnalyzerSummary::createS
912      stringstream fileTBox; fileTBox <<"TBox_r" << myRunNumber <<"_W" << (iw-2);
913      createGifFile("TBox",(iw-2),"",DQM1);
914  
951    //===================================================================================
915      //    Hit Residuals        
953    //===================================================================================
916      DQM1->Clear();
917      DQM1->Divide(6,2) ;
918  
# Line 963 | Line 925 | void DTDPGCreateAnalyzerSummary::createS
925            
926        for(int ic=1;ic<5;ic++){
927          stringstream hname; hname << "hResX_" << Whname[iw] << "_S" << ins << "_MB" << ic;
928 <        hHisto[ic-1]= getHisto<TH1F*>(hname.str());
928 >        hHisto[ic-1]= getHisto<TH1F>(hname.str());
929          hHisto[ic-1]->SetLineColor(ic);
930        }
931        
# Line 994 | Line 956 | void DTDPGCreateAnalyzerSummary::createS
956  
957      createGifFile("HitResiduals",(iw-2),"",DQM1);
958      
997    //===================================================================================
959      //    Angle Phi LOCAL
999    //===================================================================================
960      DQM1->Clear();
961      DQM1->Divide(6,2) ;
962  
# Line 1008 | Line 968 | void DTDPGCreateAnalyzerSummary::createS
968        
969        for(int ic=1;ic<5;ic++){
970          stringstream hname; hname << "hPhi_" << Whname[iw] << "_S" << ins << "_MB" << ic;
971 <        hPhi[ic-1]=getHisto<TH1F*>(hname.str());
971 >        hPhi[ic-1]=getHisto<TH1F>(hname.str());
972          hPhi[ic-1]->SetLineColor(ic);
973        }
974  
# Line 1040 | Line 1000 | void DTDPGCreateAnalyzerSummary::createS
1000  
1001      createGifFile("PhiLocal",(iw-2),"",DQM1);
1002  
1043    //===================================================================================
1003      //    STA Digis              
1045    //===================================================================================
1004      DQM1->Clear();
1005      
1006      stringstream hnameSTADigi; hnameSTADigi << "hHitsPosXYSA_" << Whname[iw];
1007 <    TH1F *hXYHisto=getHisto<TH1F*>(hnameSTADigi.str());;
1007 >    TH1F *hXYHisto=getHisto<TH1F>(hnameSTADigi.str());;
1008      
1009      hXYHisto->SetStats(0);
1010      hXYHisto->Draw("colz");
# Line 1055 | Line 1013 | void DTDPGCreateAnalyzerSummary::createS
1013      createGifFile("STADigi",(iw-2),"",DQM1);
1014  
1015  
1058    //===================================================================================
1016      //    STA Phi Hits    
1060    //===================================================================================
1017      TCanvas *DQM6 = new TCanvas("DQM6", "",301,81,999,699); // open a large canvas
1018 <    TH1F *hnHitDT= getHisto<TH1F*>("hnHitDT");
1018 >    TH1F *hnHitDT= getHisto<TH1F>("hnHitDT");
1019      Float_t Nevents = hnHitDT->GetEntries();
1020      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Total nr. of triggers:" << Nevents << endl;
1021  
# Line 1071 | Line 1027 | void DTDPGCreateAnalyzerSummary::createS
1027        stringstream hname1, hname2, htitle;
1028  
1029        hname1 << "hPhiHit_" << Whname[iw] << "_MB" << ic;
1030 <      hPhiHisto[ic-1]=getHisto<TH1F*>(hname1.str());
1030 >      hPhiHisto[ic-1]=getHisto<TH1F>(hname1.str());
1031        
1032        hname2 << "heff" << ic;
1033        heff[ic-1] =(TH1F*) hPhiHisto[ic-1]->Clone(hname2.str().c_str());
# Line 1087 | Line 1043 | void DTDPGCreateAnalyzerSummary::createS
1043        
1044      }
1045  
1046 <    TLine * l;
1047 <    l = new TLine(-165, 0, -165, ymax); l->Draw();
1048 <    l = new TLine(-135, 0, -135, ymax); l->Draw();
1049 <    l = new TLine(-105, 0, -105, ymax); l->Draw();
1050 <    l = new TLine( -75, 0,  -75, ymax); l->Draw();
1051 <    l = new TLine( -45, 0,  -45, ymax); l->Draw();
1052 <    l = new TLine( -15, 0,  -15, ymax); l->Draw();
1053 <    l = new TLine(  15, 0,   15, ymax); l->Draw();
1054 <    l = new TLine(  45, 0,   45, ymax); l->Draw();
1055 <    l = new TLine(  75, 0,   75, ymax); l->Draw();
1056 <    l = new TLine( 105, 0,  105, ymax); l->Draw();
1057 <    l = new TLine( 135, 0,  135, ymax); l->Draw();
1058 <    l = new TLine( 165, 0,  165, ymax); l->Draw();
1059 <
1060 <    l = new TLine( -40, 0.8*ymax,  -20, 0.8*ymax); l->Draw();
1061 <    l->SetLineColor(1);
1062 <    l->Draw();
1063 <    TPaveLabel * box = new TPaveLabel(-10,0.8*ymax,5,0.85*ymax,"MB1");
1064 <    box->Draw();
1065 <
1066 <    l = new TLine( -40, 0.7*ymax,  -20, 0.7*ymax); l->Draw();
1067 <    l->SetLineColor(2);
1068 <    l->Draw();
1069 <    box = new TPaveLabel(-10,0.7*ymax,5,0.75*ymax,"MB2");
1070 <    box->Draw();
1071 <
1072 <    l = new TLine( -40, 0.6*ymax,  -20, 0.6*ymax); l->Draw();
1073 <    l->SetLineColor(3);
1074 <    l->Draw();
1075 <    box = new TPaveLabel(-10,0.6*ymax,5,0.65*ymax,"MB3");
1076 <    box->Draw();
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 = new TLine( -40, 0.5*ymax,  -20, 0.5*ymax); l->Draw();
1080 <    l->SetLineColor(4);
1081 <    l->Draw();
1082 <    box = new TPaveLabel(-10,0.5*ymax,5,0.55*ymax,"MB4");
1083 <    box->Draw();
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  
1131    //===================================================================================
1090      //    STA Hits    
1133    //===================================================================================
1091      DQM1->Clear();
1092      DQM1->Divide(6,2) ;
1093  
# Line 1138 | Line 1095 | void DTDPGCreateAnalyzerSummary::createS
1095  
1096      for(int isec=1;isec<13;isec++){
1097        stringstream histoname; histoname << "hNhass_" << Whname[iw] << "_S" << isec;
1098 <      hNassList[isec-1]=getHisto<TH1F*>(histoname.str());
1098 >      hNassList[isec-1]=getHisto<TH1F>(histoname.str());
1099      }
1100  
1101  
# Line 1158 | Line 1115 | void DTDPGCreateAnalyzerSummary::createS
1115      createGifFile("STAHits",(iw-2),"",DQM1);
1116  
1117  
1161    //===================================================================================
1118      //    Segment Hits    
1163    //===================================================================================
1119      DQM2->Clear();
1120      DQM2->Divide(6,2);
1121  
# Line 1172 | Line 1127 | void DTDPGCreateAnalyzerSummary::createS
1127        
1128        for(int ic=1;ic<5;ic++){
1129          stringstream hname; hname << "hNhits_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1130 <        hNhits[ins-1][ic-1]= getHisto<TH1F*>(hname.str());
1130 >        hNhits[ins-1][ic-1]= getHisto<TH1F>(hname.str());
1131          hNhits[ins-1][ic-1]->SetLineColor(ic);
1132        }
1133  
# Line 1204 | Line 1159 | void DTDPGCreateAnalyzerSummary::createS
1159  
1160      createGifFile("SegHits",(iw-2),"",DQM2);
1161  
1207    //===================================================================================
1162      //    Segment Hits    
1209    //===================================================================================
1163      DQM1->Clear();
1164      DQM1->Divide(6,2);
1165      TH1F * hNsegsList[12];
1166      for(int is=0;is<12;is++){
1167        stringstream hname; hname << "hNsegs_" << Whname[iw] << "_S" <<is+1;
1168 <      hNsegsList[is]= getHisto<TH1F*>(hname.str());
1168 >      hNsegsList[is]= getHisto<TH1F>(hname.str());
1169        hNsegsList[is]->GetXaxis()->SetTitle("# Segments");
1170      }
1171      
# Line 1229 | Line 1182 | void DTDPGCreateAnalyzerSummary::createS
1182      
1183      createGifFile("Segments",(iw-2),"",DQM1);
1184  
1232    //===================================================================================
1185      //    TMAX
1186 <    //===================================================================================
1235 <
1186 >    
1187      TCanvas *DQM11 = new TCanvas("DQM11", "1",101,81,999,699);
1188      TCanvas *DQM12 = new TCanvas("DQM12", "2",101,81,999,699);
1189      TCanvas *DQM13 = new TCanvas("DQM13", "3",101,81,999,699);
# Line 1247 | Line 1198 | void DTDPGCreateAnalyzerSummary::createS
1198        for(int ic=1;ic<5;ic++){
1199  
1200          stringstream hname; hname << "htmax_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1201 <        hHisto[0]= getHisto<TH1F*>(hname.str()+"_SL1");
1202 <        hHisto[1]= getHisto<TH1F*>(hname.str()+"_SL3");
1201 >        hHisto[0]= getHisto<TH1F>(hname.str()+"_SL1");
1202 >        hHisto[1]= getHisto<TH1F>(hname.str()+"_SL3");
1203  
1204          if(ins<4){
1205            int ipos=(ins-1)*4+ic;
# Line 1268 | Line 1219 | void DTDPGCreateAnalyzerSummary::createS
1219          }
1220  
1221          hHisto[0]->SetStats(1);
1222 <        //hHisto[0]->Fit("gaus");  //CB va scommentato e wrappato!!!!
1222 >        hHisto[0]->Draw();
1223 >        try {
1224 >          hHisto[0]->Fit("gaus","Q");
1225 >        } catch(const cms::Exception&) {
1226 >          edm::LogError("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]:  Error fitting " << hname.str() << "_SL1";
1227 >        }
1228          hHisto[1]->SetLineColor(2);
1229          hHisto[1]->Draw("same");
1230        }// end loop on chambers
1231      }// end loop on sectors
1232  
1277    stringstream fileTMax; fileTMax << "TMax_r" << myRunNumber <<"_W" << (iw-2);
1233      createGifFile("TMax",(iw-2),"S1-S3",DQM11);
1234 <    createGifFile("TMax",(iw-2),"S4-S6",DQM11);
1235 <    createGifFile("TMax",(iw-2),"S7-S9",DQM11);
1236 <    createGifFile("TMax",(iw-2),"S10-S12",DQM11);
1234 >    createGifFile("TMax",(iw-2),"S4-S6",DQM12);
1235 >    createGifFile("TMax",(iw-2),"S7-S9",DQM13);
1236 >    createGifFile("TMax",(iw-2),"S10-S12",DQM14);
1237  
1238  
1284    //===================================================================================
1239      //    Phi-Trig Efficiency
1286    //===================================================================================
1240      TCanvas *Eff = new TCanvas("Eff", "",201,81,999,699);
1241      TH1F *hHisto[4];
1242      TH1F *hHistoTr[4];
# Line 1291 | Line 1244 | void DTDPGCreateAnalyzerSummary::createS
1244      for(int ic=1;ic<5;ic++)
1245      {
1246        stringstream hname1; hname1 << "hPhiGlob_" << Whname[iw] << "_MB" << ic;
1247 <      hHisto[ic-1]= getHisto<TH1F*>(hname1.str());
1247 >      hHisto[ic-1]= getHisto<TH1F>(hname1.str());
1248  
1249        stringstream hname2; hname2 << "heff" << ic <<"x";
1250        //heffx[ic-1]=hHisto[ic-1]->Clone(hname);
# Line 1299 | Line 1252 | void DTDPGCreateAnalyzerSummary::createS
1252        heffx[ic-1]->SetLineColor(ic);
1253        
1254        stringstream hname3; hname3 << "hPhiTrigg_" << Whname[iw] << "_MB" << ic;
1255 <      hHistoTr[ic-1]= getHisto<TH1F*>(hname3.str());
1255 >      hHistoTr[ic-1]= getHisto<TH1F>(hname3.str());
1256        heffx[ic-1]->Divide(hHistoTr[ic-1],hHisto[ic-1],1.0,1.0);
1257        
1258        for (int i = 0; i <= heffx[ic-1]->GetNbinsX()+1; i++ ) {
# Line 1322 | Line 1275 | void DTDPGCreateAnalyzerSummary::createS
1275      }
1276  
1277      ymax = 1.;
1278 <    l = new TLine(-165, 0, -165, ymax); l->Draw();
1279 <    l = new TLine(-135, 0, -135, ymax); l->Draw();
1280 <    l = new TLine(-105, 0, -105, ymax); l->Draw();
1281 <    l = new TLine( -75, 0,  -75, ymax); l->Draw();
1282 <    l = new TLine( -45, 0,  -45, ymax); l->Draw();
1283 <    l = new TLine( -15, 0,  -15, ymax); l->Draw();
1284 <    l = new TLine(  15, 0,   15, ymax); l->Draw();
1285 <    l = new TLine(  45, 0,   45, ymax); l->Draw();
1286 <    l = new TLine(  75, 0,   75, ymax); l->Draw();
1287 <    l = new TLine( 105, 0,  105, ymax); l->Draw();
1288 <    l = new TLine( 135, 0,  135, ymax); l->Draw();
1289 <    l = new TLine( 165, 0,  165, ymax); l->Draw();
1278 >    l[0] = new TLine(-165, 0, -165, ymax); l[0]->Draw();
1279 >    l[1] = new TLine(-135, 0, -135, ymax); l[1]->Draw();
1280 >    l[2] = new TLine(-105, 0, -105, ymax); l[2]->Draw();
1281 >    l[3] = new TLine( -75, 0,  -75, ymax); l[3]->Draw();
1282 >    l[4] = new TLine( -45, 0,  -45, ymax); l[4]->Draw();
1283 >    l[5] = new TLine( -15, 0,  -15, ymax); l[5]->Draw();
1284 >    l[6] = new TLine(  15, 0,   15, ymax); l[6]->Draw();
1285 >    l[7] = new TLine(  45, 0,   45, ymax); l[7]->Draw();
1286 >    l[8] = new TLine(  75, 0,   75, ymax); l[8]->Draw();
1287 >    l[9] = new TLine( 105, 0,  105, ymax); l[9]->Draw();
1288 >    l[10] = new TLine( 135, 0,  135, ymax); l[10]->Draw();
1289 >    l[11] = new TLine( 165, 0,  165, ymax); l[11]->Draw();
1290      
1291      createGifFile("TrigEff",(iw-2),"",Eff);
1339    
1292  
1293 <    //===================================================================================
1293 >    for (int i=0;i<12;++i) delete l[i];
1294 >    
1295      //    Segment Hits    
1343    //===================================================================================
1296      DQM1->Clear();
1297      DQM1->Divide(6,2) ;
1298      
# Line 1354 | Line 1306 | void DTDPGCreateAnalyzerSummary::createS
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());
1309 >       hHisto[ic-1]= getHisto<TH1F>(hname.str());
1310         hHisto[ic-1]->SetLineColor(ic);
1311       }
1312  
# Line 1386 | Line 1338 | void DTDPGCreateAnalyzerSummary::createS
1338      createGifFile("TrigHighQual",(iw-2),"",DQM1);
1339  
1340  
1341 <    //===================================================================================
1390 <    //   SC BX Summary    
1391 <    //===================================================================================
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
# Line 1403 | Line 1353 | void DTDPGCreateAnalyzerSummary::createS
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");
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);
# Line 1440 | Line 1390 | void DTDPGCreateAnalyzerSummary::createS
1390      
1391      createGifFile("TrigBXhhhl",(iw-2),"",BX);
1392  
1393 <    // CB fai il delete dei vari canvases!
1393 >    delete DQM1;
1394 >    delete DQM2;
1395 >    delete DQM1b;
1396 >    delete DQM2b;
1397 >    delete Digi1;
1398 >    delete Digi2;
1399 >    delete Digi3;
1400 >    delete DQM6;
1401 >    
1402 >    delete DQM11;
1403 >    delete DQM12;
1404 >    delete DQM13;
1405 >    delete DQM14;
1406 >    delete Eff;
1407 >    delete BX;
1408  
1409   }// END loop in wheels
1410      
# Line 1448 | Line 1412 | void DTDPGCreateAnalyzerSummary::createS
1412    
1413  
1414   void DTDPGCreateAnalyzerSummary::createSummaryAllPlots() {
1415 <
1415 >  
1416    string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
1417    
1418    gStyle->SetTitleX(0.01);
# Line 1459 | Line 1423 | void DTDPGCreateAnalyzerSummary::createS
1423    gStyle->SetStatX(0.98);
1424    gStyle->SetStatW(0.35);
1425    gStyle->SetStatH(0.45);
1426 <
1426 >  
1427    gStyle->SetPalette(1);   // set palette for 2D histos
1428    gStyle->SetTitleW(0.97);
1429    gStyle->SetTitleH(0.1);
1430 <
1430 >  
1431    float BXSummary_mean=0.;
1432    float NBXSummary_mean=0.;
1433    TH1F * BXSummary[5][4];
1434    for(int iw=0;iw<5;iw++){ // Loop in wheels
1435      for(int ic=1;ic<5;ic++){
1436 <
1436 >      
1437        stringstream hname, htitle;
1438        hname  << "BX_mean_MB" << ic << "_W" << (iw-2);
1439        htitle << "BX MeanValue (HH,HL) MB" <<  ic << " W" << (iw-2);
# Line 1481 | Line 1445 | void DTDPGCreateAnalyzerSummary::createS
1445      }
1446    }
1447    
1448 <
1485 <  //===================================================================================
1448 >  
1449    //   SC BX Summary    
1487  //===================================================================================
1450    for(int iw=0;iw<5;iw++){ // Loop in wheels
1451      for(int ins=1;ins<13;ins++){ // Loop in sectors
1452 <      
1452 >    
1453        TH1F *hHH[4];
1454        TH1F *hHL[4];
1455        for(int ic=1;ic<5;ic++){ // Loop in chambers
1456 <    
1456 >      
1457          stringstream hname; hname << "hTrigBX_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1458 <        hHH[ic-1]= getHisto<TH1F*>(hname.str()+"_qual6");
1459 <        hHL[ic-1]= getHisto<TH1F*>(hname.str()+"_qual5");
1460 <        
1458 >        hHH[ic-1]= getHisto<TH1F>(hname.str()+"_qual6");
1459 >        hHL[ic-1]= getHisto<TH1F>(hname.str()+"_qual5");
1460 >      
1461          hHH[ic-1]->Add(hHL[ic-1]);
1462          hHH[ic-1]->SetLineColor(ic);
1463          hHH[ic-1]->SetStats(0);
1464 <        
1464 >      
1465          // Compute average for BX summary plot
1466          int nb=hHH[ic-1]->GetNbinsX();
1467          int nbMax=hHH[ic-1]->GetMaximumBin();
# Line 1534 | Line 1496 | void DTDPGCreateAnalyzerSummary::createS
1496    title->SetFillColor(0);
1497    title->SetTextColor(4);
1498    title->Draw();
1499 +  TPaveLabel* wheelName[5];
1500 +  memset(wheelName,0,5*sizeof(TPaveLabel*));
1501  
1502    int BXSummary_min=0;
1503    int BXSummary_max=0;
# Line 1557 | Line 1521 | void DTDPGCreateAnalyzerSummary::createS
1521        else BXSummary[iw][ic-1]->Draw("same");
1522      }
1523      stringstream ptitle; ptitle << "Wheel " << (iw-2);
1524 <    TPaveLabel* WheelName = new TPaveLabel(1.00,0.70,1.12,0.90,ptitle.str().c_str(),"NDC");
1525 <    WheelName->Draw();
1524 >    wheelName[iw] = new TPaveLabel(1.00,0.70,1.12,0.90,ptitle.str().c_str(),"NDC");
1525 >    wheelName[iw]->Draw();
1526    }
1527  
1528    createGifFile("TrigBXhhhl_average","",BXaverage);
1529    delete BXaverage;
1530 +  delete title;
1531 +  for (int i=0;i<5;++i) {
1532 +    if (wheelName[i]) {
1533 +      delete wheelName[i];
1534 +    }
1535 +  }
1536  
1537   }
1538  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines