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.2 by battilan, Mon Nov 3 11:06:39 2008 UTC vs.
Revision 1.5 by battilan, Fri Dec 19 14:22:34 2008 UTC

# Line 67 | Line 67 | DTDPGCreateAnalyzerSummary::~DTDPGCreate
67   void DTDPGCreateAnalyzerSummary::beginJob(const edm::EventSetup& context){
68  
69    edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: BeginJob";
70 +  vector<int> emptyVector, wheelVector;
71 +  wheelVector = myParameters.getUntrackedParameter<vector<int> >("sectorsWhm2", emptyVector);
72 +  if (! wheelVector.empty()) mySectors[-2]=wheelVector;
73 +  wheelVector = myParameters.getUntrackedParameter<vector<int> >("sectorsWhm1", emptyVector);
74 +  if (! wheelVector.empty()) mySectors[-1]=wheelVector;
75 +  wheelVector = myParameters.getUntrackedParameter<vector<int> >("sectorsWh0", emptyVector);
76 +  if (! wheelVector.empty()) mySectors[0]=wheelVector;
77 +  wheelVector = myParameters.getUntrackedParameter<vector<int> >("sectorsWh1", emptyVector);
78 +  if (! wheelVector.empty()) mySectors[1]=wheelVector;
79 +  wheelVector = myParameters.getUntrackedParameter<vector<int> >("sectorsWh2", emptyVector);
80 +  if (! wheelVector.empty()) mySectors[2]=wheelVector;
81  
82   }
83  
# Line 93 | Line 104 | void DTDPGCreateAnalyzerSummary::endJob(
104  
105    edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Creating summaries!";
106    
107 <  if (myParameters.getUntrackedParameter<bool>("FullWheelHistos", false))    { createFullWheelPlots(); }
107 >  if (myParameters.getUntrackedParameter<bool>("SummaryHistos", false))    { createSummaryPlots(); }
108    if (myParameters.getUntrackedParameter<bool>("SummaryWheelHistos", false)) { createSummaryWheelPlots(); }
109    if (myParameters.getUntrackedParameter<bool>("SummaryAllHistos", false))   { createSummaryAllPlots(); }
110  
# Line 156 | Line 167 | void DTDPGCreateAnalyzerSummary::createG
167   }
168    
169    
170 < void DTDPGCreateAnalyzerSummary::createFullWheelPlots() {
170 > void DTDPGCreateAnalyzerSummary::createSummaryPlots() {
171  
172    string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
173  
# Line 180 | Line 191 | void DTDPGCreateAnalyzerSummary::createF
191  
192    int nbin;
193    float max, max1;
183  TPaveText* sid;
184  TPaveText* labcont[50]; TText* cont[50];
194  
186
187  // Occupancies
195    TH2F *DigiXYS[5][14];
196 <  for(int iw=0;iw<5;++iw) {
197 <    for(int isec=1;isec<15;isec++) {
198 <      stringstream histoname; histoname << "hDigiXY_" << Whname[iw] << "_S" << isec;
199 <      DigiXYS[iw][isec-1]=getHisto<TH2F>(histoname.str());
200 <    }
201 <  }
202 <
203 <   // Crea and fill individual layer occupancy plots from hDigiXY_S
204 <   TH1F * DigiXSecMBSlLayer[5][14][4][3][4];
205 <   for(int iw=0;iw<5;++iw){
206 <     for(int isec=1;isec<15;++isec){
207 <       for(int ich=1;ich<5;++ich){
208 <         for(int isl=1;isl<4;++isl){
209 <           for(int il=1;il<5;++il){
210 <             stringstream histoname;  histoname  << "Occup_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" <<il;
211 <             stringstream histotitle; histotitle << "Occupancy  " << Whname[iw] << " S" << isec << " MB" << ich << " SL" << SLname[isl-1] << "L" << il;
212 <             DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]= new TH1F(histoname.str().c_str(),histotitle.str().c_str(),100, 0.,100.);
213 <           }
214 <         }
215 <       }
216 <     }
217 <   }
218 <
219 <   for(int iw=0;iw<5;iw++){
220 <     for(int isec=1;isec<15;isec++){
221 <      
222 <       int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
223 <       //int nby= DigiXYS[iw][isec-1]->GetNbinsY() ;
196 >  TH1F *DigiXSecMBSlLayer[5][14][4][3][4];
197 >  TH1F *TBoxSecMBSlLayer[5][14][4][3][4];
198 >  TH1F *Correlated_trig_Bx[5][14][4][3];
199 >  TH1F *hTrg_effnum_SecMB[5][14][4];
200 >  TH1F *hTrg_effdenum_SecMB[5][14][4];
201 >  TH1F *hPhiHL_SecMB[5][14][4];
202 >  TH1F *TriggerMatrix[5][15];
203 >  TH1F * TriggerInclusive[5];
204 >
205 >  std::map<int,std::vector<int> >::const_iterator whIt  = mySectors.begin();
206 >  std::map<int,std::vector<int> >::const_iterator whEnd = mySectors.end();
207 >  for(;whIt!=whEnd;++whIt) {
208 >    int iw = (*whIt).first + 2;
209 >    std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
210 >    std::vector<int>::const_iterator secEnd = (*whIt).second.end();
211 >    for(;secIt!=secEnd;++secIt) {
212 >      int isec = (*secIt);
213 >
214 >     // Occupancies
215 >      stringstream histoNameOcc; histoNameOcc << "hDigiXY_" << Whname[iw] << "_S" << isec;
216 >      DigiXYS[iw][isec-1]=getHisto<TH2F>(histoNameOcc.str());
217 >      for(int ich=1;ich<5;++ich){
218 >        for(int isl=1;isl<4;++isl){
219 >          for(int il=1;il<5;++il){
220 >            // Create and fill individual layer occupancy plots from hDigiXY_S
221 >            stringstream histoNameOccup;  histoNameOccup  << "Occup_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" <<il;
222 >            stringstream histoTitleOccup; histoTitleOccup << "Occupancy  " << Whname[iw] << " S" << isec << " MB" << ich << " SL" << SLname[isl-1] << "L" << il;
223 >            DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]= new TH1F(histoNameOccup.str().c_str(),histoTitleOccup.str().c_str(),100, 0.,100.);
224 >            // TBoxes
225 >            stringstream histoNameTBox; histoNameTBox << "htime_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" << il;
226 >            TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]=getHisto<TH1F>(histoNameTBox.str());
227 >          }
228 >        }
229 >        // Correlated Triggers
230 >        for(int iq=4;iq<7;iq++){
231 >          stringstream histoNameTrQual; histoNameTrQual << "hTrigBX_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_qual" << iq;
232 >          Correlated_trig_Bx[iw][isec-1][ich-1][iq-4]=getHisto<TH1F>(histoNameTrQual.str());
233 >        }
234 >        // Trig Eff
235 >        stringstream htag; htag << "_" << Whname[iw] << "_S" << isec << "_MB" << ich;
236 >        stringstream heffden; heffden << "hTrg_effdenum" << htag.str();
237 >        hTrg_effdenum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(heffden.str());
238 >        stringstream heffnum; heffnum  << "hTrg_effnum" << htag.str();
239 >        hTrg_effnum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(heffnum.str());
240 >        stringstream phihl; phihl << "hPhiHL" << htag.str();
241 >        hPhiHL_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(phihl.str());
242  
243 <       for(int ich=1;ich<5;ich++){
219 <         for(int isl=1;isl<4;isl++){
220 <           for(int il=1;il<5;il++){
221 <             int iby=(ich-1)*20+(isl-1)*4+il+1;
222 <             float totentr=0;
223 <             for(int ibx=1;ibx<nbx;ibx++){
224 <               float yval=DigiXYS[iw][isec-1]->GetBinContent(ibx,iby);
225 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetBinContent(ibx,yval);
226 <               totentr+=yval;
227 <             }
228 <             DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetEntries(totentr);
229 <           }
230 <         }
231 <       }
232 <     }
233 <   }// end loop sector
243 >      }
244  
245 <   // TBoxes
236 <   TH1F * TBoxSecMBSlLayer[5][14][4][3][4];
237 <   for(int iw=0;iw<5;iw++){
238 <     for(int isec=1;isec<15;isec++){
239 <       for(int ich=1;ich<5;ich++){
240 <         for(int isl=1;isl<4;isl++){
241 <           for(int il=1;il<5;il++){
242 <             stringstream histoname; histoname << "htime_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" << il;
243 <             TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]=getHisto<TH1F>(histoname.str());
244 <           }
245 <         }
246 <       }
247 <     }
248 <   }
245 >      int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
246  
247 <   TH1F *Correlated_trig_Bx[5][14][4][3];
248 <   for(int iw=0;iw<5;iw++){
249 <     for(int isec=1;isec<15;isec++){
250 <       for(int ich=1;ich<5;ich++){
251 <         for(int iq=4;iq<7;iq++){
252 <           stringstream histoname; histoname << "hTrigBX_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_qual" << iq;
253 <           Correlated_trig_Bx[iw][isec-1][ich-1][iq-4]=getHisto<TH1F>(histoname.str());
254 <         }
255 <       }
256 <     }
257 <   }
247 >      for(int ich=1;ich<5;ich++){
248 >        for(int isl=1;isl<4;isl++){
249 >          for(int il=1;il<5;il++){
250 >            int iby=(ich-1)*20+(isl-1)*4+il+1;
251 >            float totentr=0;
252 >            for(int ibx=1;ibx<nbx;ibx++){
253 >              float yval=DigiXYS[iw][isec-1]->GetBinContent(ibx,iby);
254 >              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetBinContent(ibx,yval);
255 >              totentr+=yval;
256 >            }
257 >            DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetEntries(totentr);
258 >          }
259 >        }
260 >      }
261  
262 <   TH1F *hTrg_effnum_SecMB[5][14][4];
263 <   TH1F *hTrg_effdenum_SecMB[5][14][4];
264 <   TH1F *hPhiHL_SecMB[5][14][4];
265 <   for(int iw=0;iw<5;iw++){
266 <     for(int isec=1;isec<15;isec++){
267 <       for(int ich=1;ich<5;ich++){
268 <         stringstream htag; htag << "_" << Whname[iw] << "_S" << isec << "_MB" << ich;
269 <         stringstream heffden; heffden << "hTrg_effdenum" << htag.str();
270 <         hTrg_effdenum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(heffden.str());
271 <         stringstream heffnum; heffnum  << "hTrg_effnum" << htag.str();
272 <         hTrg_effnum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(heffnum.str());
273 <         stringstream phihl; phihl << "hPhiHL" << htag.str();
274 <         hPhiHL_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(phihl.str());
275 <       }
276 <     }
277 <   }
262 >      // Trigger matrix
263 >      stringstream histoNameTrMatrix; histoNameTrMatrix << "TriggerMatrix" << Whname[iw] << "_S" << isec;
264 >      TriggerMatrix[iw][isec-1]=getHisto<TH1F>(histoNameTrMatrix.str());
265  
266 <   TH1F *TriggerMatrix[5][15];
267 <   for(int iw=0;iw<5;iw++){
268 <     for(int isec=1;isec<15;isec++){
269 <       stringstream histoname; histoname << "TriggerMatrix" << Whname[iw] << "_S" << isec;
270 <       TriggerMatrix[iw][isec-1]=getHisto<TH1F>(histoname.str());
271 <     }
272 <   }
266 >    }
267 >    // Trigger Inclusive
268 >    stringstream histoNameTrInclusive; histoNameTrInclusive << "TriggerInclusive" << Whname[iw];
269 >    TriggerInclusive[iw]=getHisto<TH1F>(histoNameTrInclusive.str());
270 >    for (int isec=1;isec<13;++isec) {
271 >      for (int ibin=1; ibin<5; ibin++) {
272 >        stringstream hlabel; hlabel << "S" << isec << "MB" << ibin;
273 >        TriggerInclusive[iw]->GetXaxis()->SetBinLabel((isec-1)*5+ibin,hlabel.str().c_str());
274 >      }
275 >      TriggerInclusive[iw]->GetXaxis()->SetBinLabel(isec*5," ");
276 >    }  
277 >  }
278  
279 <   TH1F * TriggerInclusive[5];
280 <   for(int iw=0;iw<5;iw++){
281 <     stringstream histoname; histoname << "TriggerInclusive" << Whname[iw];
282 <     TriggerInclusive[iw]=getHisto<TH1F>(histoname.str());
283 <   }
284 <
285 <   //===================================================================================
286 <   //    DIGI's occupancies
287 <   //===================================================================================
288 <
289 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing  DIGI's occupancies per layer in 1 single page per Sector" << endl;
290 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
291 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
292 <
301 <       TCanvas *Digi = new TCanvas("Digi", "",201,81,999,699);  
302 <       Digi->Divide(3,4) ;
303 <
304 <       for(int ich=1;ich<5;ich++){
305 <         for(int isl=1;isl<4;isl++){
306 <           bool dodraw=1;
307 <           if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
308 <           if(dodraw){
309 <             // look first for the maximum bin entries
310 <             first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
311 <             float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
312 <             for(int il=2;il<5;il++){
313 <               float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
314 <               if(nbmax0>nbmax){
315 <                 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
316 <                 nbmax=nbmax0;
317 <               }
318 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
319 <             }
320 <             stringstream htitle; htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
321 <             first_to_paint->SetTitle(htitle.str().c_str());
322 <             int icpos=(ich-1)*3+isl;
323 <             Digi->cd(icpos) ;
324 <             Digi->cd(icpos)->SetLogy();
325 <             first_to_paint->GetYaxis()->SetLabelSize(0.07);
326 <             first_to_paint->GetXaxis()->SetLabelSize(0.07);
327 <             first_to_paint->Draw();
328 <             for(int il=1;il<5;il++){
329 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
330 <             }
331 <           }
332 <         }
333 <       }
279 >  whIt  = mySectors.begin();
280 >  whEnd = mySectors.end();
281 >  for(;whIt!=whEnd;++whIt) {
282 >    int iw = (*whIt).first + 2;
283 >    std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
284 >    std::vector<int>::const_iterator secEnd = (*whIt).second.end();
285 >    for(;secIt!=secEnd;++secIt) {
286 >      int isec = (*secIt);
287 >
288 >      //===================================================================================
289 >      //    DIGI's occupancies
290 >      //===================================================================================
291 >      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing DIGI's occupancies per layer in 1 single page per Sector wh "
292 >                                        << (iw-2) << " sec " << isec << endl;
293  
294 <       createGifFile("Occupancies_LogScale",iw-2,isec,"",Digi);
295 <       delete Digi;
337 <     }
338 <   }// End Loop on sectors
294 >      TCanvas *Digi = new TCanvas("Digi", "",201,81,999,699);  
295 >      Digi->Divide(3,4) ;
296  
297 +      for(int ich=1;ich<5;ich++){
298 +        for(int isl=1;isl<4;isl++){
299 +          bool dodraw=1;
300 +          if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
301 +          if(dodraw){
302 +            // look first for the maximum bin entries
303 +            first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
304 +            float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
305 +            for(int il=2;il<5;il++){
306 +              float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
307 +              if(nbmax0>nbmax){
308 +                first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
309 +                nbmax=nbmax0;
310 +              }
311 +              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
312 +            }
313 +            stringstream htitle; htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
314 +            first_to_paint->SetTitle(htitle.str().c_str());
315 +            int icpos=(ich-1)*3+isl;
316 +            Digi->cd(icpos) ;
317 +            Digi->cd(icpos)->SetLogy();
318 +            first_to_paint->GetYaxis()->SetLabelSize(0.07);
319 +            first_to_paint->GetXaxis()->SetLabelSize(0.07);
320 +            first_to_paint->Draw();
321 +            for(int il=1;il<5;il++){
322 +              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
323 +            }
324 +          }
325 +        }
326 +      }
327 +      createGifFile("Occupancies_LogScale",iw-2,isec,"",Digi);
328 +      delete Digi;
329  
330 <   //===================================================================================
331 <   //    DIGI's occupancies
332 <   //    now print 1 page per SL
333 <   //===================================================================================
334 <
335 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing DIGI's occupancies  per layer in 1 single page per SL" << endl;
336 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
337 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
338 <
339 <       int ichmin=1; if (isec==13|| isec==14)ichmin=4;
340 <       for(int ich=ichmin;ich<5;ich++){
341 <         for(int isl=1;isl<4;isl++){
342 <           TCanvas *DigiSL = new TCanvas("DigiSL", "",201,81,999,699);  
343 <           bool dodraw=1;
344 <           if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
345 <           if(dodraw){
346 <             // look first for the maximum bin entries
347 <             first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
348 <             float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
349 <             for(int il=2;il<5;il++){
350 <               float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
351 <               if(nbmax0>nbmax){
352 <                 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
353 <                 nbmax=nbmax0;
354 <               }
355 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
356 <             }
357 <             stringstream htitle;  htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
358 <             first_to_paint->SetTitle(htitle.str().c_str());
359 <             //int icpos=(ich-1)*3+isl;
360 <             first_to_paint->GetYaxis()->SetLabelSize(0.05);
361 <             first_to_paint->GetXaxis()->SetLabelSize(0.05);
362 <             first_to_paint->Draw();
374 <             for(int il=1;il<5;il++){
375 <               DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
376 <             }
330 >      //===================================================================================
331 >      //    DIGI's occupancies
332 >      //    now print 1 page per SL
333 >      //===================================================================================
334 >      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing DIGI's occupancies  per layer in 1 single page per SL wh "
335 >                                        << (iw-2) << " sec " << isec << endl;
336 >      int ichmin=1; if (isec==13|| isec==14)ichmin=4;
337 >      for(int ich=ichmin;ich<5;ich++){
338 >        for(int isl=1;isl<4;isl++){
339 >          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 >            // look first for the maximum bin entries
344 >            first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
345 >            float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
346 >            for(int il=2;il<5;il++){
347 >              float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
348 >              if(nbmax0>nbmax){
349 >                first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
350 >                nbmax=nbmax0;
351 >              }
352 >              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
353 >            }
354 >            stringstream htitle;  htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
355 >            first_to_paint->SetTitle(htitle.str().c_str());
356 >            //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();
360 >            for(int il=1;il<5;il++){
361 >              DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
362 >            }
363              
364 <             stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
365 <             createGifFile("Occupancies",(iw-2),isec,fileTag.str(),DigiSL);
366 <             delete DigiSL;
367 <           }
364 >            stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
365 >            createGifFile("Occupancies",(iw-2),isec,fileTag.str(),DigiSL);
366 >            delete DigiSL;
367 >          }
368            
369 <         }//end Loop Superlayers
370 <       }//end Loop chambers
385 <     }// End Loop on sectors
386 <   }// End Loop on wheels
369 >        }//end Loop Superlayers
370 >      }//end Loop chambers
371  
372 +      //====================================================================================
373 +      //    Time boxes: all in 1 single page (Layer granularity)
374 +      //===================================================================================
375 +      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per Sector wh "
376 +                                        << (iw-2) << " sec " << isec << endl;
377 +      TCanvas *Tboxes = new TCanvas("Tboxes", "",201,81,999,699);
378 +      Tboxes->Divide(3,4) ;
379  
380 <   //====================================================================================
381 <   //    Time boxes: all in 1 single page (Layer granularity)
382 <   //===================================================================================
383 <  
384 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per Sector" << endl;
385 <   //for(int isec=1;isec<15;isec++) // Loop on sectors
386 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
387 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
388 <      
389 <       TCanvas *Tboxes = new TCanvas("Tboxes", "",201,81,999,699);
390 <       Tboxes->Divide(3,4) ;
391 <
392 <       for(int ich=1;ich<5;ich++){
393 <         for(int isl=1;isl<4;isl++){
394 <           bool dodraw=1;
395 <           if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
396 <           if(dodraw){
397 <               // look first for the maximum bin entries
398 <               first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
399 <               float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
400 <               for(int il=2;il<5;il++){
401 <                 float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
402 <                 if(nbmax0>nbmax){
403 <                   first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
404 <                   nbmax=nbmax0;
405 <                 }
406 <                 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
407 <               }
408 <               stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
418 <               first_to_paint->SetTitle(htitle.str().c_str());
419 <               int icpos=(ich-1)*3+isl;
420 <               Tboxes->cd(icpos) ;
421 <               first_to_paint->GetYaxis()->SetLabelSize(0.07);
422 <               first_to_paint->GetXaxis()->SetLabelSize(0.07);
423 <               first_to_paint->Draw();
424 <               for(int il=1;il<5;il++){
425 <                 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
426 <               }
427 <           }
428 <         }
429 <       }
380 >      for(int ich=1;ich<5;ich++){
381 >        for(int isl=1;isl<4;isl++){
382 >          bool dodraw=1;
383 >          if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
384 >          if(dodraw){
385 >            // look first for the maximum bin entries
386 >            first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
387 >            float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
388 >            for(int il=2;il<5;il++){
389 >              float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
390 >              if(nbmax0>nbmax){
391 >                first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
392 >                nbmax=nbmax0;
393 >              }
394 >              TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
395 >            }
396 >            stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
397 >            first_to_paint->SetTitle(htitle.str().c_str());
398 >            int icpos=(ich-1)*3+isl;
399 >            Tboxes->cd(icpos) ;
400 >            first_to_paint->GetYaxis()->SetLabelSize(0.07);
401 >            first_to_paint->GetXaxis()->SetLabelSize(0.07);
402 >            first_to_paint->Draw();
403 >            for(int il=1;il<5;il++){
404 >              TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
405 >            }
406 >          }
407 >        }
408 >      }
409    
410 <       createGifFile("Tboxes",(iw-2),isec,"",Tboxes);
411 <       delete Tboxes;
433 <     }// End Loop on sectors
434 <   }// End Loop on wheels
435 <
410 >      createGifFile("Tboxes",(iw-2),isec,"",Tboxes);
411 >      delete Tboxes;
412  
413 <   //===================================================================================
414 <   //    Time boxes: 1 page per SL
415 <   //===================================================================================
416 <  
417 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per SL" << endl;
418 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
419 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
420 <      
421 <       int ichmin=1; if (isec==13|| isec==14)ichmin=4;
446 <       for(int ich=ichmin;ich<5;ich++){
447 <         for(int isl=1;isl<4;isl++){
448 <           TCanvas *TboxSL = new TCanvas("TboxSL", "",201,81,999,699);
413 >      //===================================================================================
414 >      //    Time boxes: 1 page per SL
415 >      //===================================================================================
416 >      edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per SL wh "
417 >                                        << (iw-2) << " sec " << isec << endl;
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++){
421 >          TCanvas *TboxSL = new TCanvas("TboxSL", "",201,81,999,699);
422            
423 <           bool dodraw=1;
424 <           if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
425 <           if(dodraw){
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();
429 <             for(int il=2;il<5;il++){
430 <               float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
431 <               if(nbmax0>nbmax){
432 <                 first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
433 <                 nbmax=nbmax0;
434 <               }
435 <               TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
436 <             }
437 <             stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
438 <             first_to_paint->SetTitle(htitle.str().c_str());
439 <             first_to_paint->GetYaxis()->SetLabelSize(0.04);
440 <             first_to_paint->GetXaxis()->SetLabelSize(0.04);
441 <             first_to_paint->Draw();
442 <             for(int il=1;il<5;il++){
443 <               TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
444 <             }
423 >          bool dodraw=1;
424 >          if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
425 >          if(dodraw){
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();
429 >            for(int il=2;il<5;il++){
430 >              float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
431 >              if(nbmax0>nbmax){
432 >                first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
433 >                nbmax=nbmax0;
434 >              }
435 >              TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
436 >            }
437 >            stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
438 >            first_to_paint->SetTitle(htitle.str().c_str());
439 >            first_to_paint->GetYaxis()->SetLabelSize(0.04);
440 >            first_to_paint->GetXaxis()->SetLabelSize(0.04);
441 >            first_to_paint->Draw();
442 >            for(int il=1;il<5;il++){
443 >              TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
444 >            }
445              
446 <             stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
447 <             createGifFile("Tboxes",(iw-2),isec,fileTag.str(),TboxSL);
448 <             delete TboxSL;
449 <           }
450 <         }//end loop SL      
451 <       }//end loop chambers
479 <     }// End Loop on sectors
480 <   } // End Loop on wheels
481 <
446 >            stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
447 >            createGifFile("Tboxes",(iw-2),isec,fileTag.str(),TboxSL);
448 >            delete TboxSL;
449 >          }
450 >        }//end loop SL      
451 >      }//end loop chambers
452  
453 <   //===================================================================================
454 <   //    Trigger: Summary & BX profile
485 <   //===================================================================================
486 <  
487 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing single chamber BX profiles per Sector" << endl;
488 <   // BX profiles:
489 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
490 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
491 <      
492 <       if(isec <13){
493 <         TCanvas *Trigg = new TCanvas("Trigg", "",201,81,999,699);
494 <         Trigg->Divide(2,2) ;
495 <         for(int ich=1;ich<5;ich++){
496 <           Trigg->cd(ich) ;
497 <           Trigg->cd(ich)->SetLogy();
498 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetTitle("BX id");
499 <           stringstream htitle; htitle << "llHlHH_trig_bxMB"<< ich;
500 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->SetTitle(htitle.str().c_str());
501 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetTitleSize(0.05);
502 <           Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetLabelSize(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]->Draw();
505 <           Correlated_trig_Bx[iw][isec-1][ich-1][1]->SetLineColor(2);
506 <           Correlated_trig_Bx[iw][isec-1][ich-1][1]->Draw("same");
507 <           Correlated_trig_Bx[iw][isec-1][ich-1][0]->SetLineColor(3);
508 <           Correlated_trig_Bx[iw][isec-1][ich-1][0]->Draw("same");
509 <         }// end loop on chambers
510 <         createGifFile("Trigger_Summary",(iw-2),isec,"",Trigg);
511 <         delete Trigg;
512 <       }
513 <     }// end loop on sectors
514 <   }// end loop on wheels
453 >    }
454 >  }//end Loop on sectors/wheels
455  
456  
457 <   //===================================================================================
458 <   //    Trigger: HH&HL efficiencies
459 <   //===================================================================================
460 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing HH&HL efficiencies" << endl;
461 <   TH1F *heffTrgSecMB[5][14][4];
462 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
463 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
464 <       if(isec <13){
465 <         TCanvas *EffTrg = new TCanvas("EffTrg", "",201,81,999,699);
466 <         EffTrg->Divide(2,4); // divide canvas in 2 columns, 4 raws
467 <         for(int ich=1;ich<5;ich++){
468 <           stringstream histoname; histoname << "heffTrgSec" << isec << "MB" << ich;
469 <           heffTrgSecMB[iw][isec-1][ich-1] =(TH1F*)hTrg_effnum_SecMB[iw][isec-1][ich-1]->Clone(histoname.str().c_str());
470 <           heffTrgSecMB[iw][isec-1][ich-1]->Divide(hTrg_effnum_SecMB[iw][isec-1][ich-1]
471 <                                                   ,hTrg_effdenum_SecMB[iw][isec-1][ich-1],1.0,1.0);
472 <           heffTrgSecMB[iw][isec-1][ich-1]->SetMaximum(1.1);
473 <           heffTrgSecMB[iw][isec-1][ich-1]->SetMinimum(0.);
474 <           heffTrgSecMB[iw][isec-1][ich-1]->GetXaxis()->SetLabelSize(0.05);
475 <           heffTrgSecMB[iw][isec-1][ich-1]->GetYaxis()->SetLabelSize(0.05);
476 <           for (int i = 0; i <= hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetNbinsX()+1; i++ ) {
477 <             Float_t tot   = hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetBinContent(i) ;
478 <             Float_t tot_e = hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetBinError(i);
479 <             Float_t eff = heffTrgSecMB[iw][isec-1][ich-1]->GetBinContent(i) ;
480 <             Float_t Err = 0.;
481 <             if (tot > 0) Err = tot_e / tot * sqrt( eff* (1-eff) );
482 <             // if (eff == 1. || isnan(Err) || !isfinite(Err) ) Err=1.e-3;
483 <             heffTrgSecMB[iw][isec-1][ich-1]->SetBinError(i, Err);
484 <           }
485 <        
486 <           EffTrg->cd((ich-1)*2+1);  
487 <           heffTrgSecMB[iw][isec-1][ich-1]->Draw();
488 <           EffTrg->cd((ich-1)*2+2);  
489 <           hPhiHL_SecMB[iw][isec-1][ich-1]->Draw();
490 <         }
457 >  //===================================================================================
458 >  //    Trigger Stuff
459 >  //===================================================================================
460 >  
461 >  TH1F *heffTrgSecMB[5][14][4];
462 >  char * labTriggerMatrix[]={"no trig"," ","MB1","MB2","MB3","MB4"," ","1 & 2","1 & 3","1 & 4","2 & 3","2 & 4",
463 >                             "3 & 4"," ","1 & 2 & 3","1 & 2 & 4","1 & 3 & 4","2 & 3 & 4"," ","1 & 2 & 3 & 4"};
464 >
465 >  whIt  = mySectors.begin();
466 >  whEnd = mySectors.end();
467 >  for(;whIt!=whEnd;++whIt) {
468 >    int iw = (*whIt).first + 2;
469 >    std::vector<int>::const_iterator secIt  = (*whIt).second.begin();
470 >    std::vector<int>::const_iterator secEnd = (*whIt).second.end();
471 >    for(;secIt!=secEnd;++secIt) {
472 >      int isec = (*secIt);
473 >      if(isec <13){
474 >
475 >        //===================================================================================
476 >        // BX profiles:
477 >        //===================================================================================
478 >        edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing single chamber BX profiles per Sector wh"
479 >                                          << (iw-2) << " sec " << isec << endl;
480 >        TCanvas *Trigg = new TCanvas("Trigg", "",201,81,999,699);
481 >        Trigg->Divide(2,2) ;
482 >        for(int ich=1;ich<5;ich++){
483 >          Trigg->cd(ich) ;
484 >          Trigg->cd(ich)->SetLogy();
485 >          Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetTitle("BX id");
486 >          stringstream htitle; htitle << "llHlHH_trig_bxMB"<< ich;
487 >          Correlated_trig_Bx[iw][isec-1][ich-1][2]->SetTitle(htitle.str().c_str());
488 >          Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetTitleSize(0.05);
489 >          Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetLabelSize(0.05);
490 >          Correlated_trig_Bx[iw][isec-1][ich-1][2]->GetXaxis()->SetLabelSize(0.05);
491 >          Correlated_trig_Bx[iw][isec-1][ich-1][2]->Draw();
492 >          Correlated_trig_Bx[iw][isec-1][ich-1][1]->SetLineColor(2);
493 >          Correlated_trig_Bx[iw][isec-1][ich-1][1]->Draw("same");
494 >          Correlated_trig_Bx[iw][isec-1][ich-1][0]->SetLineColor(3);
495 >          Correlated_trig_Bx[iw][isec-1][ich-1][0]->Draw("same");
496 >        }// end loop on chambers
497 >
498 >        createGifFile("Trigger_Summary",(iw-2),isec,"",Trigg);
499 >        delete Trigg;
500 >
501 >        //===================================================================================
502 >        //    Trigger: HH&HL efficiencies
503 >        //===================================================================================
504 >        edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing HH&HL efficiencies wh "
505 >                                          << (iw-2) << " sec " << isec << endl;
506 >        TCanvas *EffTrg = new TCanvas("EffTrg", "",201,81,999,699);
507 >        EffTrg->Divide(2,4); // divide canvas in 2 columns, 4 raws
508 >
509 >        for(int ich=1;ich<5;ich++){
510 >          stringstream histoname; histoname << "heffTrgSec" << isec << "MB" << ich;
511 >          heffTrgSecMB[iw][isec-1][ich-1] =(TH1F*)hTrg_effnum_SecMB[iw][isec-1][ich-1]->Clone(histoname.str().c_str());
512 >          heffTrgSecMB[iw][isec-1][ich-1]->Divide(hTrg_effnum_SecMB[iw][isec-1][ich-1]
513 >                                                  ,hTrg_effdenum_SecMB[iw][isec-1][ich-1],1.0,1.0);
514 >          heffTrgSecMB[iw][isec-1][ich-1]->SetMaximum(1.1);
515 >          heffTrgSecMB[iw][isec-1][ich-1]->SetMinimum(0.);
516 >          heffTrgSecMB[iw][isec-1][ich-1]->GetXaxis()->SetLabelSize(0.05);
517 >          heffTrgSecMB[iw][isec-1][ich-1]->GetYaxis()->SetLabelSize(0.05);
518 >          for (int i = 0; i <= hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetNbinsX()+1; i++ ) {
519 >            Float_t tot   = hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetBinContent(i) ;
520 >            Float_t tot_e = hTrg_effdenum_SecMB[iw][isec-1][ich-1]->GetBinError(i);
521 >            Float_t eff = heffTrgSecMB[iw][isec-1][ich-1]->GetBinContent(i) ;
522 >            Float_t Err = 0.;
523 >            if (tot > 0) Err = tot_e / tot * sqrt( eff* (1-eff) );
524 >            // if (eff == 1. || isnan(Err) || !isfinite(Err) ) Err=1.e-3;
525 >            heffTrgSecMB[iw][isec-1][ich-1]->SetBinError(i, Err);
526 >          }
527          
528 <         createGifFile("TriggEff_HH&HL",(iw-2),isec,"",EffTrg);
529 <         delete EffTrg;
530 <       }
531 <
532 <     }// End loop on sectors
557 <   }// End loop on wheels
528 >          EffTrg->cd((ich-1)*2+1);  
529 >          heffTrgSecMB[iw][isec-1][ich-1]->Draw();
530 >          EffTrg->cd((ich-1)*2+2);  
531 >          hPhiHL_SecMB[iw][isec-1][ich-1]->Draw();
532 >        }
533  
534 +        createGifFile("TriggEff_HH&HL",(iw-2),isec,"",EffTrg);
535 +        delete EffTrg;
536  
537 <   //===================================================================================
538 <   //    Trigger: TriggerMatrix
539 <   //===================================================================================
540 <  
541 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing TriggerMatrix" << endl;
537 >        //===================================================================================
538 >        //    Trigger: TriggerMatrix
539 >        //===================================================================================
540 >        edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing TriggerMatrix wh "
541 >                                          << (iw-2) << " sec " << isec << endl;
542  
543 <   char * labTriggerMatrix[]={"no trig"," ","MB1","MB2","MB3","MB4"," ","1 & 2","1 & 3","1 & 4","2 & 3","2 & 4",
544 <                              "3 & 4"," ","1 & 2 & 3","1 & 2 & 4","1 & 3 & 4","2 & 3 & 4"," ","1 & 2 & 3 & 4"};
545 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
546 <     for(int isec=1;isec<15;isec++){ // Loop on sectors
547 <       if(isec <13){
548 <         for (int ibin=1; ibin<21; ibin++) TriggerMatrix[iw][isec-1]->GetXaxis()->SetBinLabel(ibin,labTriggerMatrix[ibin-1]);
549 <         nbin = TriggerMatrix[iw][isec-1]->GetXaxis()->GetNbins();
550 <         max = 0;
551 <         TCanvas *Trigmatri = new TCanvas("TriggerMatrix", "",201,81,999,699);
552 <         Trigmatri->SetBottomMargin(0.12);
553 <      
554 <         for (int ibin=1; ibin<nbin+1; ibin++)
555 <           max = (max > TriggerMatrix[iw][isec-1]->GetBinContent(ibin) ) ? max : TriggerMatrix[iw][isec-1]->GetBinContent(ibin) ;
556 <         max1=max*1.3;
557 <      
558 <         TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelOffset(0.043);
559 <         // TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelOffset(-0.01);
560 <         // TriggerMatrix[iw][isec-1]->LabelsOption("v");
561 <         // TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelSize(0.04);
562 <      
563 <         TriggerMatrix[iw][isec-1]->SetMaximum(max1);
564 <         TriggerMatrix[iw][isec-1]->Draw();
565 <      
566 <         //sid = new TPaveText (-0.5,max1-(max1-max)/2,5,max1);
567 <         //sprintf (sid1,"YB%i, Sector %u, run %u",wheel, isec, run);
568 <         //sid->AddText(sid1);
569 <         //sid->Draw();
570 <      
571 <         for (int ibin=1; ibin<nbin+1; ibin++) {
572 <           if (ibin == 2 || ibin == 7 ||  ibin == 14 ||  ibin == 19) continue;
573 <           float x1 = TriggerMatrix[iw][isec-1]->GetBinCenter(ibin) - TriggerMatrix[iw][isec-1]->GetBinWidth(ibin)/2;
574 <           float x2 = TriggerMatrix[iw][isec-1]->GetBinCenter(ibin) + TriggerMatrix[iw][isec-1]->GetBinWidth(ibin)/2;
575 <           float y1 = max + (max1-max)/8;
576 <           float y2 = max1 - (max1-max)/2;
577 <           labcont[ibin-1] = new TPaveText (x1,y1,x2,y2);
543 >        for (int ibin=1; ibin<21; ibin++) TriggerMatrix[iw][isec-1]->GetXaxis()->SetBinLabel(ibin,labTriggerMatrix[ibin-1]);
544 >        nbin = TriggerMatrix[iw][isec-1]->GetXaxis()->GetNbins();
545 >        max = 0;
546 >        TCanvas *Trigmatri = new TCanvas("TriggerMatrix", "",201,81,999,699);
547 >        Trigmatri->SetBottomMargin(0.12);
548 >      
549 >        for (int ibin=1; ibin<nbin+1; ibin++)
550 >          max = (max > TriggerMatrix[iw][isec-1]->GetBinContent(ibin) ) ? max : TriggerMatrix[iw][isec-1]->GetBinContent(ibin) ;
551 >        max1=max*1.3;
552 >      
553 >        TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelOffset(0.043);
554 >        // TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelOffset(-0.01);
555 >        // TriggerMatrix[iw][isec-1]->LabelsOption("v");
556 >        // TriggerMatrix[iw][isec-1]->GetXaxis()->SetLabelSize(0.04);
557 >      
558 >        TriggerMatrix[iw][isec-1]->SetMaximum(max1);
559 >        TriggerMatrix[iw][isec-1]->Draw();
560 >      
561 >        //sid = new TPaveText (-0.5,max1-(max1-max)/2,5,max1);
562 >        //sprintf (sid1,"YB%i, Sector %u, run %u",wheel, isec, run);
563 >        //sid->AddText(sid1);
564 >        //sid->Draw();
565 >      
566 >        TPaveText* labcont[50];
567 >        memset(labcont,0,50*sizeof(TPaveText*));
568 >        TText* cont[50];
569 >        memset(cont,0,50*sizeof(TText*));
570 >        
571 >        for (int ibin=1; ibin<nbin+1; ibin++) {
572 >          if (ibin == 2 || ibin == 7 ||  ibin == 14 ||  ibin == 19) continue;
573 >          float x1 = TriggerMatrix[iw][isec-1]->GetBinCenter(ibin) - TriggerMatrix[iw][isec-1]->GetBinWidth(ibin)/2;
574 >          float x2 = TriggerMatrix[iw][isec-1]->GetBinCenter(ibin) + TriggerMatrix[iw][isec-1]->GetBinWidth(ibin)/2;
575 >          float y1 = max + (max1-max)/8;
576 >          float y2 = max1 - (max1-max)/2;
577 >          labcont[ibin-1] = new TPaveText (x1,y1,x2,y2);
578            
579 <           char contbin[6];
580 <           sprintf (contbin,"%u",int(TriggerMatrix[iw][isec-1]->GetBinContent(ibin)));
581 <           //  labcont[ibin-1]->AddText(cont[ibin-1]);
605 <      
606 <           cont[ibin-1] = labcont[ibin-1]->AddText (contbin);
607 <           //    isme.SetTextAngle(90.);
608 <           cont[ibin-1]->SetTextSize(0.02);
609 <           labcont[ibin-1]->Draw();
610 <         }
579 >          char contbin[6];
580 >          sprintf (contbin,"%u",int(TriggerMatrix[iw][isec-1]->GetBinContent(ibin)));
581 >          //  labcont[ibin-1]->AddText(cont[ibin-1]);
582        
583 <         createGifFile("TriggerMatrix",(iw-2),isec,"",Trigmatri);
584 <         delete Trigmatri;
585 <       }
586 <
587 <     }// End loop on sectors
588 <   }// End loop on wheels
589 <
590 <
591 <   //===================================================================================
592 <   //    Trigger: TriggerInclusive
593 <   //===================================================================================
594 <
595 <   //=======   ALL   SECTORS             ===============================================
596 <   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing TriggerInclusive Sector by Sector" << endl;
597 <   for(int iw=0;iw<5;iw++){ //Loop on wheels
627 <     for (int ise=1; ise<13; ise++) { //Set TriggerInclusive Labels
628 <       for (int ibin=1; ibin<5; ibin++) {
629 <         stringstream hlabel; hlabel << "S" << ise << "MB" << ibin;
630 <         TriggerInclusive[iw]->GetXaxis()->SetBinLabel((ise-1)*5+ibin,hlabel.str().c_str());
631 <       }
632 <       TriggerInclusive[iw]->GetXaxis()->SetBinLabel(ise*5," ");
633 <     }
634 <     TCanvas *Trigmatri = new TCanvas("TriggerMatrix", "",201,81,999,699);
635 <     Trigmatri->SetBottomMargin(0.12);
636 <
637 <     nbin = TriggerInclusive[iw]->GetXaxis()->GetNbins();
638 <     max = 0;
583 >          cont[ibin-1] = labcont[ibin-1]->AddText (contbin);
584 >          //    isme.SetTextAngle(90.);
585 >          cont[ibin-1]->SetTextSize(0.02);
586 >          labcont[ibin-1]->Draw();
587 >        }
588 >      
589 >        createGifFile("TriggerMatrix",(iw-2),isec,"",Trigmatri);
590 >        delete Trigmatri;
591 >        for (int i=0;i<50;++i) {
592 >          if (labcont[i]) delete labcont[i];
593 >        }
594 >        
595 >        //===================================================================================
596 >        //    Trigger: TriggerInclusive SECTOR BY SECTOR
597 >        //===================================================================================
598  
640     for (int ibin=1; ibin<nbin+1; ibin++)
641       max = (max > TriggerInclusive[iw]->GetBinContent(ibin) ) ? max : TriggerInclusive[iw]->GetBinContent(ibin) ;
642     max1=max*1.3;
643     TriggerInclusive[iw]->SetMaximum(max1);
644     TriggerInclusive[iw]->GetXaxis()->SetLabelSize(0.035);
645     TriggerInclusive[iw]->Draw();
646    
647     sid = new TPaveText (0,max1-(max1-max)/2,2,max1);
648  
649     //cout <<" --> wheel, sector, run "; cin >>wheel>>sector>>run;
650     stringstream chname; chname << "YB," << (iw-2) <<",";
651     sid->AddText(chname.str().c_str());
652     sid->Draw();
653    
654     createGifFile("TriggerInclusive",(iw-2),"",Trigmatri);
655     delete Trigmatri;
656   }
657
658   //=======   SECTOR By SECTOR             ============================================
659   edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing TriggerInclusive Sector by Sector" << endl;
660   for(int iw=0;iw<5;iw++){ //Loop on wheels
661     for(int isec=1;isec<15;isec++){ // Loop on sectors
662       if(isec<13){
599          TCanvas *TrigmatriSec = new TCanvas("TriggerInclusive[iw]", "",201,81,999,699);
600          TrigmatriSec->SetBottomMargin(0.12);
601          
# Line 676 | Line 612 | void DTDPGCreateAnalyzerSummary::createF
612          TriggerInclusive[iw]->SetMaximum(max1);
613          TriggerInclusive[iw]->Draw();
614          
615 <        sid = new TPaveText (0,max1-(max1-max)/2,2,max1);
615 >        memset(labcont,0,50*sizeof(TPaveText*));
616 >        memset(cont,0,50*sizeof(TText*));  
617          for (int ibin=ibin_init; ibin<ibin_init+4; ibin++) {
618            
619            float x1 = TriggerInclusive[iw]->GetBinCenter(ibin) - TriggerInclusive[iw]->GetBinWidth(ibin)/2;
# Line 698 | Line 635 | void DTDPGCreateAnalyzerSummary::createF
635  
636          createGifFile("TriggerInclusive",(iw-2),isec,"",TrigmatriSec);
637          delete TrigmatriSec;
638 <      }
639 <    }// End loop on sectors
640 <  }// End loop on wheels
638 >        for (int i=0;i<50;++i) {
639 >          if (labcont[i]) delete labcont[i];
640 >        }
641 >        
642 >
643 >      }// if on isec < 13
644 >    }// end loop on sectors
645 >
646 >    //===================================================================================
647 >    //    Trigger: TriggerInclusive FULL WHEEL
648 >    //===================================================================================
649 >    TCanvas *Trigmatri = new TCanvas("TriggerMatrix", "",201,81,999,699);
650 >    Trigmatri->SetBottomMargin(0.12);
651 >
652 >    nbin = TriggerInclusive[iw]->GetXaxis()->GetNbins();
653 >    TriggerInclusive[iw]->GetXaxis()->SetRange(1,nbin);
654 >        
655 >    max = 0;
656 >
657 >    for (int ibin=1; ibin<nbin+1; ibin++)
658 >      max = (max > TriggerInclusive[iw]->GetBinContent(ibin) ) ? max : TriggerInclusive[iw]->GetBinContent(ibin) ;
659 >    max1=max*1.3;
660 >    TriggerInclusive[iw]->SetMaximum(max1);
661 >    TriggerInclusive[iw]->GetXaxis()->SetLabelSize(0.035);
662 >    TriggerInclusive[iw]->Draw();
663 >    
664 >    TPaveText* sid = new TPaveText (0,max1-(max1-max)/2,2,max1);
665    
666 < }
666 >    stringstream chname; chname << "YB," << (iw-2) <<",";
667 >    sid->AddText(chname.str().c_str());
668 >    sid->Draw();
669 >    
670 >    createGifFile("TriggerInclusive",(iw-2),"",Trigmatri);
671 >    delete Trigmatri;
672 >    delete sid;
673 >        
674 >  }// end loop on wheels
675  
676 + }
677  
678   void DTDPGCreateAnalyzerSummary::createSummaryWheelPlots() {
679  
# Line 748 | Line 718 | void DTDPGCreateAnalyzerSummary::createS
718   for(int iw=0;iw<5;iw++){ // Loop in wheels
719  
720     edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Processing Wheel " << iw-2 << endl;
751   //===================================================================================
721     //    Digi scatter plots
753   //===================================================================================
722     TCanvas *DQM1 = new TCanvas("DQM1", "",201,81,999,699);
723     DQM1->Divide(2,3) ;
724     TCanvas *DQM1b = new TCanvas("DQM1b", "",201,81,999,699);
# Line 789 | Line 757 | void DTDPGCreateAnalyzerSummary::createS
757        hDigiXYList[is]->Draw("colz");
758      }
759  
792    stringstream fileDigi; fileDigi <<"Digi_r" << myRunNumber <<"_W" << (iw-2);
760      createGifFile("Digi",(iw-2),"_S1-S6",DQM1);
761      createGifFile("Digi",(iw-2),"_S7_S12",DQM2);
762  
# Line 807 | Line 774 | void DTDPGCreateAnalyzerSummary::createS
774        createGifFile("Digi",(iw-2),"_S7-S12_b",DQM2b);
775      }
776  
777 <    //===================================================================================
811 <    //    Ocupancies per SL
812 <    //===================================================================================
813 <    
777 >    //    Ocupancies per SL    
778      // Get histos to be plotted
779      int nbin;
780      float max, max1;
# Line 872 | Line 836 | void DTDPGCreateAnalyzerSummary::createS
836        }
837      }// end loop sector
838  
875    //===================================================================================
839      //    DIGI's occupancies
877    //===================================================================================
840  
841      TCanvas *Digi1 = new TCanvas("Digi1", "",201,81,999,699);  
842      TCanvas *Digi2 = new TCanvas("Digi2", "",201,81,999,699);  
# Line 913 | Line 875 | void DTDPGCreateAnalyzerSummary::createS
875      createGifFile("Occupancies_LogScale",(iw-2),"_S5-S8",Digi2);
876      createGifFile("Occupancies_LogScale",(iw-2),"_S9-S12",Digi3);
877  
916    //===================================================================================
878      //    TimeBoxes        
918    //===================================================================================
879      DQM1->Clear();
880      DQM1->Divide(6,2) ;
881      for (int ins=1; ins<13;ins++){
# Line 957 | Line 917 | void DTDPGCreateAnalyzerSummary::createS
917      stringstream fileTBox; fileTBox <<"TBox_r" << myRunNumber <<"_W" << (iw-2);
918      createGifFile("TBox",(iw-2),"",DQM1);
919  
960    //===================================================================================
920      //    Hit Residuals        
962    //===================================================================================
921      DQM1->Clear();
922      DQM1->Divide(6,2) ;
923  
# Line 1003 | Line 961 | void DTDPGCreateAnalyzerSummary::createS
961  
962      createGifFile("HitResiduals",(iw-2),"",DQM1);
963      
1006    //===================================================================================
964      //    Angle Phi LOCAL
1008    //===================================================================================
965      DQM1->Clear();
966      DQM1->Divide(6,2) ;
967  
# Line 1049 | Line 1005 | void DTDPGCreateAnalyzerSummary::createS
1005  
1006      createGifFile("PhiLocal",(iw-2),"",DQM1);
1007  
1052    //===================================================================================
1008      //    STA Digis              
1054    //===================================================================================
1009      DQM1->Clear();
1010      
1011      stringstream hnameSTADigi; hnameSTADigi << "hHitsPosXYSA_" << Whname[iw];
# Line 1064 | Line 1018 | void DTDPGCreateAnalyzerSummary::createS
1018      createGifFile("STADigi",(iw-2),"",DQM1);
1019  
1020  
1067    //===================================================================================
1021      //    STA Phi Hits    
1069    //===================================================================================
1022      TCanvas *DQM6 = new TCanvas("DQM6", "",301,81,999,699); // open a large canvas
1023      TH1F *hnHitDT= getHisto<TH1F>("hnHitDT");
1024      Float_t Nevents = hnHitDT->GetEntries();
# Line 1096 | Line 1048 | void DTDPGCreateAnalyzerSummary::createS
1048        
1049      }
1050  
1051 <    TLine * l;
1052 <    l = new TLine(-165, 0, -165, ymax); l->Draw();
1053 <    l = new TLine(-135, 0, -135, ymax); l->Draw();
1054 <    l = new TLine(-105, 0, -105, ymax); l->Draw();
1055 <    l = new TLine( -75, 0,  -75, ymax); l->Draw();
1056 <    l = new TLine( -45, 0,  -45, ymax); l->Draw();
1057 <    l = new TLine( -15, 0,  -15, ymax); l->Draw();
1058 <    l = new TLine(  15, 0,   15, ymax); l->Draw();
1059 <    l = new TLine(  45, 0,   45, ymax); l->Draw();
1060 <    l = new TLine(  75, 0,   75, ymax); l->Draw();
1061 <    l = new TLine( 105, 0,  105, ymax); l->Draw();
1062 <    l = new TLine( 135, 0,  135, ymax); l->Draw();
1063 <    l = new TLine( 165, 0,  165, ymax); l->Draw();
1064 <
1065 <    l = new TLine( -40, 0.8*ymax,  -20, 0.8*ymax); l->Draw();
1066 <    l->SetLineColor(1);
1067 <    l->Draw();
1068 <    TPaveLabel * box = new TPaveLabel(-10,0.8*ymax,5,0.85*ymax,"MB1");
1069 <    box->Draw();
1070 <
1071 <    l = new TLine( -40, 0.7*ymax,  -20, 0.7*ymax); l->Draw();
1072 <    l->SetLineColor(2);
1073 <    l->Draw();
1074 <    box = new TPaveLabel(-10,0.7*ymax,5,0.75*ymax,"MB2");
1075 <    box->Draw();
1076 <
1077 <    l = new TLine( -40, 0.6*ymax,  -20, 0.6*ymax); l->Draw();
1078 <    l->SetLineColor(3);
1079 <    l->Draw();
1080 <    box = new TPaveLabel(-10,0.6*ymax,5,0.65*ymax,"MB3");
1081 <    box->Draw();
1051 >    TLine *l[16];
1052 >    l[0] = new TLine(-165, 0, -165, ymax); l[0]->Draw();
1053 >    l[1] = new TLine(-135, 0, -135, ymax); l[1]->Draw();
1054 >    l[2] = new TLine(-105, 0, -105, ymax); l[2]->Draw();
1055 >    l[3] = new TLine( -75, 0,  -75, ymax); l[3]->Draw();
1056 >    l[4] = new TLine( -45, 0,  -45, ymax); l[4]->Draw();
1057 >    l[5] = new TLine( -15, 0,  -15, ymax); l[5]->Draw();
1058 >    l[6] = new TLine(  15, 0,   15, ymax); l[6]->Draw();
1059 >    l[7] = new TLine(  45, 0,   45, ymax); l[7]->Draw();
1060 >    l[8] = new TLine(  75, 0,   75, ymax); l[8]->Draw();
1061 >    l[9] = new TLine( 105, 0,  105, ymax); l[9]->Draw();
1062 >    l[10] = new TLine( 135, 0,  135, ymax); l[10]->Draw();
1063 >    l[11] = new TLine( 165, 0,  165, ymax); l[11]->Draw();
1064 >
1065 >    l[12] = new TLine( -40, 0.8*ymax,  -20, 0.8*ymax); //l->Draw();
1066 >    l[12]->SetLineColor(1);
1067 >    l[12]->Draw();
1068 >    TPaveLabel * box [4];
1069 >    box[0] = new TPaveLabel(-10,0.8*ymax,5,0.85*ymax,"MB1");
1070 >    box[0]->Draw();
1071 >
1072 >    l[13] = new TLine( -40, 0.7*ymax,  -20, 0.7*ymax); //l->Draw();
1073 >    l[13]->SetLineColor(2);
1074 >    l[13]->Draw();
1075 >    box[1] = new TPaveLabel(-10,0.7*ymax,5,0.75*ymax,"MB2");
1076 >    box[1]->Draw();
1077 >
1078 >    l[14] = new TLine( -40, 0.6*ymax,  -20, 0.6*ymax); //l->Draw();
1079 >    l[14]->SetLineColor(3);
1080 >    l[14]->Draw();
1081 >    box[2] = new TPaveLabel(-10,0.6*ymax,5,0.65*ymax,"MB3");
1082 >    box[2]->Draw();
1083      
1084 <    l = new TLine( -40, 0.5*ymax,  -20, 0.5*ymax); l->Draw();
1085 <    l->SetLineColor(4);
1086 <    l->Draw();
1087 <    box = new TPaveLabel(-10,0.5*ymax,5,0.55*ymax,"MB4");
1088 <    box->Draw();
1084 >    l[15] = new TLine( -40, 0.5*ymax,  -20, 0.5*ymax); //l->Draw();
1085 >    l[15]->SetLineColor(4);
1086 >    l[15]->Draw();
1087 >    box[3] = new TPaveLabel(-10,0.5*ymax,5,0.55*ymax,"MB4");
1088 >    box[3]->Draw();
1089      
1090      createGifFile("STAPhiHits",(iw-2),"",DQM6);
1091  
1092 +    for (int i=0;i<16;++i) delete l[i];
1093 +    for (int i=0;i<4;++i) delete box[i];
1094  
1140    //===================================================================================
1095      //    STA Hits    
1142    //===================================================================================
1096      DQM1->Clear();
1097      DQM1->Divide(6,2) ;
1098  
# Line 1167 | Line 1120 | void DTDPGCreateAnalyzerSummary::createS
1120      createGifFile("STAHits",(iw-2),"",DQM1);
1121  
1122  
1170    //===================================================================================
1123      //    Segment Hits    
1172    //===================================================================================
1124      DQM2->Clear();
1125      DQM2->Divide(6,2);
1126  
# Line 1213 | Line 1164 | void DTDPGCreateAnalyzerSummary::createS
1164  
1165      createGifFile("SegHits",(iw-2),"",DQM2);
1166  
1216    //===================================================================================
1167      //    Segment Hits    
1218    //===================================================================================
1168      DQM1->Clear();
1169      DQM1->Divide(6,2);
1170      TH1F * hNsegsList[12];
# Line 1238 | Line 1187 | void DTDPGCreateAnalyzerSummary::createS
1187      
1188      createGifFile("Segments",(iw-2),"",DQM1);
1189  
1241    //===================================================================================
1190      //    TMAX
1191 <    //===================================================================================
1244 <
1191 >    
1192      TCanvas *DQM11 = new TCanvas("DQM11", "1",101,81,999,699);
1193      TCanvas *DQM12 = new TCanvas("DQM12", "2",101,81,999,699);
1194      TCanvas *DQM13 = new TCanvas("DQM13", "3",101,81,999,699);
# Line 1277 | Line 1224 | void DTDPGCreateAnalyzerSummary::createS
1224          }
1225  
1226          hHisto[0]->SetStats(1);
1227 <        //hHisto[0]->Fit("gaus");  //CB va scommentato e wrappato!!!!
1227 >        hHisto[0]->Draw();
1228 >        try {
1229 >          hHisto[0]->Fit("gaus","Q");
1230 >        } catch(const cms::Exception&) {
1231 >          edm::LogError("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]:  Error fitting " << hname.str() << "_SL1";
1232 >        }
1233          hHisto[1]->SetLineColor(2);
1234          hHisto[1]->Draw("same");
1235        }// end loop on chambers
1236      }// end loop on sectors
1237  
1286    stringstream fileTMax; fileTMax << "TMax_r" << myRunNumber <<"_W" << (iw-2);
1238      createGifFile("TMax",(iw-2),"S1-S3",DQM11);
1239 <    createGifFile("TMax",(iw-2),"S4-S6",DQM11);
1240 <    createGifFile("TMax",(iw-2),"S7-S9",DQM11);
1241 <    createGifFile("TMax",(iw-2),"S10-S12",DQM11);
1239 >    createGifFile("TMax",(iw-2),"S4-S6",DQM12);
1240 >    createGifFile("TMax",(iw-2),"S7-S9",DQM13);
1241 >    createGifFile("TMax",(iw-2),"S10-S12",DQM14);
1242  
1243  
1293    //===================================================================================
1244      //    Phi-Trig Efficiency
1295    //===================================================================================
1245      TCanvas *Eff = new TCanvas("Eff", "",201,81,999,699);
1246      TH1F *hHisto[4];
1247      TH1F *hHistoTr[4];
# Line 1331 | Line 1280 | void DTDPGCreateAnalyzerSummary::createS
1280      }
1281  
1282      ymax = 1.;
1283 <    l = new TLine(-165, 0, -165, ymax); l->Draw();
1284 <    l = new TLine(-135, 0, -135, ymax); l->Draw();
1285 <    l = new TLine(-105, 0, -105, ymax); l->Draw();
1286 <    l = new TLine( -75, 0,  -75, ymax); l->Draw();
1287 <    l = new TLine( -45, 0,  -45, ymax); l->Draw();
1288 <    l = new TLine( -15, 0,  -15, ymax); l->Draw();
1289 <    l = new TLine(  15, 0,   15, ymax); l->Draw();
1290 <    l = new TLine(  45, 0,   45, ymax); l->Draw();
1291 <    l = new TLine(  75, 0,   75, ymax); l->Draw();
1292 <    l = new TLine( 105, 0,  105, ymax); l->Draw();
1293 <    l = new TLine( 135, 0,  135, ymax); l->Draw();
1294 <    l = new TLine( 165, 0,  165, ymax); l->Draw();
1283 >    l[0] = new TLine(-165, 0, -165, ymax); l[0]->Draw();
1284 >    l[1] = new TLine(-135, 0, -135, ymax); l[1]->Draw();
1285 >    l[2] = new TLine(-105, 0, -105, ymax); l[2]->Draw();
1286 >    l[3] = new TLine( -75, 0,  -75, ymax); l[3]->Draw();
1287 >    l[4] = new TLine( -45, 0,  -45, ymax); l[4]->Draw();
1288 >    l[5] = new TLine( -15, 0,  -15, ymax); l[5]->Draw();
1289 >    l[6] = new TLine(  15, 0,   15, ymax); l[6]->Draw();
1290 >    l[7] = new TLine(  45, 0,   45, ymax); l[7]->Draw();
1291 >    l[8] = new TLine(  75, 0,   75, ymax); l[8]->Draw();
1292 >    l[9] = new TLine( 105, 0,  105, ymax); l[9]->Draw();
1293 >    l[10] = new TLine( 135, 0,  135, ymax); l[10]->Draw();
1294 >    l[11] = new TLine( 165, 0,  165, ymax); l[11]->Draw();
1295      
1296      createGifFile("TrigEff",(iw-2),"",Eff);
1348    
1297  
1298 <    //===================================================================================
1298 >    for (int i=0;i<12;++i) delete l[i];
1299 >    
1300      //    Segment Hits    
1352    //===================================================================================
1301      DQM1->Clear();
1302      DQM1->Divide(6,2) ;
1303      
# Line 1395 | Line 1343 | void DTDPGCreateAnalyzerSummary::createS
1343      createGifFile("TrigHighQual",(iw-2),"",DQM1);
1344  
1345  
1346 <    //===================================================================================
1399 <    //   SC BX Summary    
1400 <    //===================================================================================
1346 >    //   SC BX Summary
1347      TCanvas *BX = new TCanvas("BX", "",201,81,999,699);
1348      BX->Divide(6,2);
1349      for(int ins=1;ins<13;ins++){ // Loop in sectors
# Line 1449 | Line 1395 | void DTDPGCreateAnalyzerSummary::createS
1395      
1396      createGifFile("TrigBXhhhl",(iw-2),"",BX);
1397  
1398 <    // CB fai il delete dei vari canvases!
1398 >    delete DQM1;
1399 >    delete DQM2;
1400 >    delete DQM1b;
1401 >    delete DQM2b;
1402 >    delete Digi1;
1403 >    delete Digi2;
1404 >    delete Digi3;
1405 >    delete DQM6;
1406 >    
1407 >    delete DQM11;
1408 >    delete DQM12;
1409 >    delete DQM13;
1410 >    delete DQM14;
1411 >    delete Eff;
1412 >    delete BX;
1413  
1414   }// END loop in wheels
1415      
# Line 1457 | Line 1417 | void DTDPGCreateAnalyzerSummary::createS
1417    
1418  
1419   void DTDPGCreateAnalyzerSummary::createSummaryAllPlots() {
1420 <
1420 >  
1421    string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
1422    
1423    gStyle->SetTitleX(0.01);
# Line 1468 | Line 1428 | void DTDPGCreateAnalyzerSummary::createS
1428    gStyle->SetStatX(0.98);
1429    gStyle->SetStatW(0.35);
1430    gStyle->SetStatH(0.45);
1431 <
1431 >  
1432    gStyle->SetPalette(1);   // set palette for 2D histos
1433    gStyle->SetTitleW(0.97);
1434    gStyle->SetTitleH(0.1);
1435 <
1435 >  
1436    float BXSummary_mean=0.;
1437    float NBXSummary_mean=0.;
1438    TH1F * BXSummary[5][4];
1439    for(int iw=0;iw<5;iw++){ // Loop in wheels
1440      for(int ic=1;ic<5;ic++){
1441 <
1441 >      
1442        stringstream hname, htitle;
1443        hname  << "BX_mean_MB" << ic << "_W" << (iw-2);
1444        htitle << "BX MeanValue (HH,HL) MB" <<  ic << " W" << (iw-2);
# Line 1490 | Line 1450 | void DTDPGCreateAnalyzerSummary::createS
1450      }
1451    }
1452    
1453 <
1494 <  //===================================================================================
1453 >  
1454    //   SC BX Summary    
1496  //===================================================================================
1455    for(int iw=0;iw<5;iw++){ // Loop in wheels
1456      for(int ins=1;ins<13;ins++){ // Loop in sectors
1457 <      
1457 >    
1458        TH1F *hHH[4];
1459        TH1F *hHL[4];
1460        for(int ic=1;ic<5;ic++){ // Loop in chambers
1461 <    
1461 >      
1462          stringstream hname; hname << "hTrigBX_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1463          hHH[ic-1]= getHisto<TH1F>(hname.str()+"_qual6");
1464          hHL[ic-1]= getHisto<TH1F>(hname.str()+"_qual5");
1465 <        
1465 >      
1466          hHH[ic-1]->Add(hHL[ic-1]);
1467          hHH[ic-1]->SetLineColor(ic);
1468          hHH[ic-1]->SetStats(0);
1469 <        
1469 >      
1470          // Compute average for BX summary plot
1471          int nb=hHH[ic-1]->GetNbinsX();
1472          int nbMax=hHH[ic-1]->GetMaximumBin();
# Line 1543 | Line 1501 | void DTDPGCreateAnalyzerSummary::createS
1501    title->SetFillColor(0);
1502    title->SetTextColor(4);
1503    title->Draw();
1504 +  TPaveLabel* wheelName[5];
1505 +  memset(wheelName,0,5*sizeof(TPaveLabel*));
1506  
1507    int BXSummary_min=0;
1508    int BXSummary_max=0;
# Line 1566 | Line 1526 | void DTDPGCreateAnalyzerSummary::createS
1526        else BXSummary[iw][ic-1]->Draw("same");
1527      }
1528      stringstream ptitle; ptitle << "Wheel " << (iw-2);
1529 <    TPaveLabel* WheelName = new TPaveLabel(1.00,0.70,1.12,0.90,ptitle.str().c_str(),"NDC");
1530 <    WheelName->Draw();
1529 >    wheelName[iw] = new TPaveLabel(1.00,0.70,1.12,0.90,ptitle.str().c_str(),"NDC");
1530 >    wheelName[iw]->Draw();
1531    }
1532  
1533    createGifFile("TrigBXhhhl_average","",BXaverage);
1534    delete BXaverage;
1535 +  delete title;
1536 +  for (int i=0;i<5;++i) {
1537 +    if (wheelName[i]) {
1538 +      delete wheelName[i];
1539 +    }
1540 +  }
1541  
1542   }
1543  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines