CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTMuonDQMSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTMuonDQMSource
4 // Class: HLTMuonDQMSource
5 //
13 //
14 // Original Author: Muriel VANDER DONCKT *:0
15 // Created: Wed Dec 12 09:55:42 CET 2007
16 // $Id: HLTMuonDQMSource.cc,v 1.39 2010/05/02 08:13:06 dellaric Exp $
17 // Modification: Hwidong Yoo (Purdue University)
18 // contact: hdyoo@cern.ch
19 //
20 //
21 
22 
23 
26 
46 
53 
61 
65 
67 
68 #include "TMath.h"
69 
70 //using namespace std;
71 //using namespace edm;
72 //using namespace reco;
73 //using namespace l1extra;
74 //
75 // constructors and destructor
76 //
77 HLTMuonDQMSource::HLTMuonDQMSource( const edm::ParameterSet& ps ) :counterEvt_(0), nTrig_(0)
78 {
79  parameters_ = ps;
80  verbose_ = parameters_.getUntrackedParameter < bool > ("verbose", false);
81  monitorName_ = parameters_.getUntrackedParameter<std::string>("monitorName","HLT/HLTMonMuon");
82  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
83  coneSize_ = parameters_.getUntrackedParameter<double>("coneSize", 0.24);
85  l3seedscollectionTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonSeedTag",edm::InputTag("hltL3TrajectorySeed"));
86  l2collectionTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l2MuonTag",edm::InputTag("hltL2MuonCandidates"));
87  l3collectionTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTag",edm::InputTag("hltL3MuonCandidates"));
88  l2isolationTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l2IsolationTag",edm::InputTag("hltL2MuonIsolations"));
89  l3isolationTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l3IsolationTag",edm::InputTag("hltL3MuonIsolations"));
90 
91  TrigResultInput = parameters_.getUntrackedParameter<edm::InputTag>("TrigResultInputTag", edm::InputTag("TriggerResults"));
92 
93  dbe_ = 0 ;
94  dbe_ = edm::Service < DQMStore > ().operator->();
95  dbe_->setVerbose(0);
96 
97  outputFile_ =
98  parameters_.getUntrackedParameter < std::string > ("outputFile", "");
99  if (outputFile_.size() != 0) {
100  edm::LogWarning("HLTMuonDQMSource") << "Muon HLT Monitoring histograms will be saved to "
101  << outputFile_ << std::endl;
102  }
103  else {
104  outputFile_ = "HLTMuonDQM.root";
105  }
106 
107  bool disable =
108  parameters_.getUntrackedParameter < bool > ("disableROOToutput", false);
109  if (disable) {
110  outputFile_ = "";
111  }
112 
113  if (dbe_ != NULL) {
114  dbe_->setCurrentFolder(monitorName_);
115  }
116 
117  std::vector<edm::ParameterSet> filters = parameters_.getParameter<std::vector<edm::ParameterSet> >("filters");
118 
119  for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++){
120  theDirectoryName.push_back(filterconf->getParameter<std::string>("directoryName"));
121  //theHLTCollectionLevel.push_back(filterconf->getParameter<std::string>("level"));
122  //theTriggerBits.push_back(filterconf->getParameter<std::vector<std::string> >("triggerBits"));
123  std::string _tmp_level = filterconf->getParameter<std::string>("directoryName");
124  std::vector<std::string> _tmp_bits = filterconf->getParameter<std::vector<std::string> >("triggerBits");
125  for( size_t i = 0; i < _tmp_bits.size(); ++i ) {
126  theTriggerBits.push_back(_tmp_bits[i]);
127  theHLTCollectionLevel.push_back(_tmp_level);
128  }
129  }
130 
131  // L1PassThrough, L2PassThrough, L3PassThrough
132  nTrigs = theDirectoryName.size();
133 
134  for( int trig = 0; trig < nTrigs; trig++ ) striggers_[trig] = "";
135 }
136 
137 
139 {
140 
141  // do anything here that needs to be done at desctruction time
142  // (e.g. close files, deallocate resources etc.)
143 
144 }
145 
146 
147 //--------------------------------------------------------
149 {
150  if (dbe_) {
151  //dbe_->setCurrentFolder("monitorName_");
152  if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
153  edm::LogInfo("HLTMuonDQMSource") << "===>DQM event prescale = " << prescaleEvt_ << " events "<< std::endl;
154 
155 
157  int NBINS = 50; XMIN = 0; XMAX = 50;
158 
159  // create and cd into new folder
160  char name[512], title[512];
161  double pt_max;
162  std::string dirname;
163 
164  for( int trig = 0; trig < nTrigs; trig++ ) {
165  dirname = theDirectoryName[trig]+"/";
166 
167  for(unsigned int i = 0; i < theHLTCollectionLevel.size(); ++i){
169  if(!strcmp(striggers_[trig].c_str(), "")) striggers_[trig] = theTriggerBits[i];
170  else striggers_[trig] += ", " + theTriggerBits[i];
171  }
172  }
173  dbe_->setCurrentFolder(monitorName_ + dirname);
174  sprintf(name,"%s triggers",theDirectoryName[trig].c_str());
175  dbe_->bookString(name,striggers_[trig]);
176 
177  for ( int level = 1; level < 7; ++level ) {
178  if( level < 4 ) sprintf(name,"Level%i",level);
179  else if (level == 4 ) sprintf(name,"Level%iSeed", level-2);
180  else if (level == 5 ) sprintf(name,"Level%iSeed", level-2);
181  else if (level == 6 ) sprintf(name,"Level2Isolation");
182 
183  if( level == 1 ) pt_max = 145;
184  else pt_max = 200;
185  dbe_->setCurrentFolder(monitorName_+dirname+name);
186  if( level == 1 ) hl1quality[trig] = dbe_->book1D("h1L1Quality","GMT quality Flag", 8, 0., 8.);
187  if( level == 2 ) {
188  hnHits[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 100.);
189  hnValidHits[trig] = dbe_->book1D("HLTMuonL2_nValidHits", "L2 Number of Valid Hits", NBINS, 0., 100.);
190  hnValidHits[trig]->setAxisTitle("Number of Valid Hits", 1);
191  }
192  if( level == 3 ) {
193  hnTkValidHits[trig] = dbe_->book1D("HLTMuonL3_nTkValidHits", "L3 Number of Valid Tracker Hits", NBINS, 0., 100.);
194  hnTkValidHits[trig]->setAxisTitle("Number of Valid Tracker Hits", 1);
195  hnMuValidHits[trig] = dbe_->book1D("HLTMuonL3_nMuValidHits", "L3 Number of Valid Muon Hits", NBINS, 0., 100.);
196  hnMuValidHits[trig]->setAxisTitle("Number of Valid Muon Hits", 1);
197  }
198  if( level == 1 ) {
199  int eta_nbin = 62;
200  float eta_bins[63] = {
201  -2.40, -2.35, -2.30, -2.25, -2.20, -2.15, -2.10, -2.05,
202  -2.00, -1.95, -1.90, -1.85, -1.80, -1.75, -1.70, -1.60,
203  -1.50, -1.40, -1.30, -1.20, -1.10, -1.00, -0.90, -0.80,
204  -0.70, -0.60, -0.50, -0.40, -0.30, -0.20, -0.10, -0.00,
205  0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80,
206  0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60,
207  1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05,
208  2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40
209  };
210  int phi_nbin = 144;
211  float phi_bins[145];
212  for( int ibin = 0; ibin < 145; ibin++ ) {
213  phi_bins[ibin] = -3.15 + (ibin)*(6.30/144);
214  }
215  float pt_bins[51];
216  for( int ibin = 0; ibin < 51; ibin++ ) {
217  pt_bins[ibin] = ibin*(145./50.);
218  }
219  sprintf(name,"HLTMuonL%i_NMu",level);
220  sprintf(title,"L%i number of muons",level);
221  hNMu[trig][level-1] = dbe_->book1D(name,title, 5, -0.5, 4.5);
222  hNMu[trig][level-1]->setAxisTitle("Number of muons", 1);
223  sprintf(name,"HLTMuonL%i_pt",level);
224  sprintf(title,"L%i Pt",level);
225  hpt[trig][level-1] = dbe_->book1D(name,title, NBINS, pt_bins);
226  hpt[trig][level-1]->setAxisTitle("Pt", 1);
227  sprintf(name,"HLTMuonL%i_eta",level);
228  sprintf(title,"L%i Muon #eta",level);
229  heta[trig][level-1] = dbe_->book1D(name,title, eta_nbin, eta_bins);
230  heta[trig][level-1]->setAxisTitle("#eta", 1);
231  sprintf(name,"HLTMuonL%i_phi",level);
232  sprintf(title,"L%i Muon #phi",level);
233  hphi[trig][level-1] = dbe_->book1D(name,title, phi_nbin, phi_bins);
234  hphi[trig][level-1]->setAxisTitle("#phi", 1);
235  sprintf(name,"HLTMuonL%i_phi_norm",level);
236  sprintf(title,"L%i Muon #phi_norm",level);
237  hphi_norm[trig][level-1] = dbe_->book1D(name,title, phi_nbin, phi_bins);
238  hphi_norm[trig][level-1]->setAxisTitle("#phi", 1);
239  sprintf(name,"HLTMuonL%i_etaphi",level);
240  sprintf(title,"L%i Muon #eta vs #phi",level);
241  hetaphi[trig][level-1] = dbe_->book2D(name,title, phi_nbin, phi_bins, eta_nbin, eta_bins);
242  hetaphi[trig][level-1]->setAxisTitle("#phi", 1);
243  hetaphi[trig][level-1]->setAxisTitle("#eta", 2);
244  sprintf(name,"HLTMuonL%i_ptphi",level);
245  sprintf(title,"L%i Muon pt vs #phi",level);
246  hptphi[trig][level-1] = dbe_->book2D(name,title, NBINS, pt_bins, phi_nbin, phi_bins);
247  hptphi[trig][level-1]->setAxisTitle("pt", 1);
248  hptphi[trig][level-1]->setAxisTitle("#phi", 2);
249  sprintf(name,"HLTMuonL%i_pteta",level);
250  sprintf(title,"L%i Muon pt vs #eta",level);
251  hpteta[trig][level-1] = dbe_->book2D(name,title, NBINS, pt_bins, eta_nbin, eta_bins);
252  hpteta[trig][level-1]->setAxisTitle("pt", 1);
253  hpteta[trig][level-1]->setAxisTitle("#eta", 2);
254  sprintf(name,"HLTMuonL%i_charge",level);
255  sprintf(title,"L%i Muon Charge",level);
256  hcharge[trig][level-1] = dbe_->book1D(name,title, 3, -1.5, 1.5);
257  hcharge[trig][level-1]->setAxisTitle("Charge", 1);
258  }
259  if( level > 1 && level < 4 ) {
260  sprintf(name,"HLTMuonL%i_NMu",level);
261  sprintf(title,"L%i number of muons",level);
262  hNMu[trig][level-1] = dbe_->book1D(name,title, 5, -0.5, 4.5);
263  hNMu[trig][level-1]->setAxisTitle("Number of muons", 1);
264  sprintf(name,"HLTMuonL%i_pt",level);
265  sprintf(title,"L%i Pt",level);
266  hpt[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., pt_max);
267  hpt[trig][level-1]->setAxisTitle("Pt", 1);
268  sprintf(name,"HLTMuonL%i_eta",level);
269  sprintf(title,"L%i Muon #eta",level);
270  heta[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
271  heta[trig][level-1]->setAxisTitle("#eta", 1);
272  sprintf(name,"HLTMuonL%i_phi",level);
273  sprintf(title,"L%i Muon #phi",level);
274  hphi[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
275  hphi[trig][level-1]->setAxisTitle("#phi", 1);
276  sprintf(name,"HLTMuonL%i_phi_norm",level);
277  sprintf(title,"L%i Muon #phi_norm",level);
278  hphi_norm[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
279  hphi_norm[trig][level-1]->setAxisTitle("#phi", 1);
280  sprintf(name,"HLTMuonL%i_etaphi",level);
281  sprintf(title,"L%i Muon #eta vs #phi",level);
282  hetaphi[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15,NBINS,-2.5, 2.5);
283  hetaphi[trig][level-1]->setAxisTitle("#phi", 1);
284  hetaphi[trig][level-1]->setAxisTitle("#eta", 2);
285  sprintf(name,"HLTMuonL%i_ptphi",level);
286  sprintf(title,"L%i Muon pt vs #phi",level);
287  hptphi[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max,NBINS,-3.15, 3.15);
288  hptphi[trig][level-1]->setAxisTitle("pt", 1);
289  hptphi[trig][level-1]->setAxisTitle("#phi", 2);
290  sprintf(name,"HLTMuonL%i_pteta",level);
291  sprintf(title,"L%i Muon pt vs #eta",level);
292  hpteta[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max,NBINS,-2.5, 2.5);
293  hpteta[trig][level-1]->setAxisTitle("pt", 1);
294  hpteta[trig][level-1]->setAxisTitle("#eta", 2);
295  sprintf(name,"HLTMuonL%i_nHits",level);
296  sprintf(title,"L%i Number of Hits",level);
297  hnHits[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 100.);
298  hnHits[trig][level-1]->setAxisTitle("Number of Hits", 1);
299  sprintf(name,"HLTMuonL%i_charge",level);
300  sprintf(title,"L%i Muon Charge",level);
301  hcharge[trig][level-1] = dbe_->book1D(name,title, 3, -1.5, 1.5);
302  hcharge[trig][level-1]->setAxisTitle("Charge", 1);
303  }
304  else if( level == 4 || level == 5 ) {
305  sprintf(name,"HLTMuonL%iSeed_NMu",level-2);
306  sprintf(title,"L%iSeed number of muons",level-2);
307  hNMu[trig][level-1] = dbe_->book1D(name,title, 5, -0.5, 4.5);
308  hNMu[trig][level-1]->setAxisTitle("Number of muons", 1);
309  sprintf(name,"HLTMuonL%iSeed_pt",level-2);
310  sprintf(title,"L%iSeed Pt",level-2);
311  hpt[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., pt_max);
312  hpt[trig][level-1]->setAxisTitle("Pt", 1);
313  sprintf(name,"HLTMuonL%iSeed_eta",level-2);
314  sprintf(title,"L%iSeed Muon #eta",level-2);
315  heta[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
316  heta[trig][level-1]->setAxisTitle("#eta", 1);
317  sprintf(name,"HLTMuonL%iSeed_phi",level-2);
318  sprintf(title,"L%iSeed Muon #phi",level-2);
319  hphi[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
320  hphi[trig][level-1]->setAxisTitle("#phi", 1);
321  sprintf(name,"HLTMuonL%iSeed_etaphi",level-2);
322  sprintf(title,"L%iSeed Muon #eta vs #phi",level-2);
323  hetaphi[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15,NBINS,-2.5, 2.5);
324  hetaphi[trig][level-1]->setAxisTitle("#phi", 1);
325  hetaphi[trig][level-1]->setAxisTitle("#eta", 2);
326  sprintf(name,"HLTMuonL%iSeed_ptphi",level-2);
327  sprintf(title,"L%iSeed Muon pt vs #phi",level-2);
328  hptphi[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max,NBINS,-3.15, 3.15);
329  hptphi[trig][level-1]->setAxisTitle("pt", 1);
330  hptphi[trig][level-1]->setAxisTitle("#phi", 2);
331  sprintf(name,"HLTMuonL%iSeed_pteta",level-2);
332  sprintf(title,"L%iSeed Muon pt vs #eta",level-2);
333  hpteta[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max,NBINS,-2.5, 2.5);
334  hpteta[trig][level-1]->setAxisTitle("pt", 1);
335  hpteta[trig][level-1]->setAxisTitle("#eta", 2);
336  sprintf(name,"HLTMuonL%iSeed_charge",level-2);
337  sprintf(title,"L%iSeed Muon Charge",level-2);
338  hcharge[trig][level-1] = dbe_->book1D(name,title, 3, -1.5, 1.5);
339  hcharge[trig][level-1]->setAxisTitle("Charge", 1);
340  // pt
341  sprintf(name,"HLTMuonL%iSeedtoL%i_ptres",level-2,level-3);
342  sprintf(title,"L%iSeed1/Pt - L%iMuon1/Pt",level-2,level-3);
343  hseedptres[trig][level-4] = dbe_->book1D(name,title, NBINS, -0.1, 0.1);
344  sprintf(title,"1/PtL%iSeed - 1/PtL%i",level-2,level-3);
345  hseedptres[trig][level-4]->setAxisTitle(title, 1);
346  sprintf(name,"HLTMuonL%iSeedtoL%i_ptrelres",level-2,level-3);
347  sprintf(title,"(L%iSeed1/Pt - L%iMuon1/Pt)/(L%iMuon1/Pt)",level-2,level-3,level-3);
348  hseedptrelres[trig][level-4] = dbe_->book1D(name,title, NBINS, -1.0, 1.0);
349  sprintf(title,"(1/PtL%iSeed - 1/PtL%i)/(1/PtL%i)",level-2,level-3,level-3);
350  hseedptrelres[trig][level-4]->setAxisTitle(title, 1);
351  // eta
352  sprintf(name,"HLTMuonL%iSeedtoL%i_etares",level-2,level-3);
353  sprintf(title,"L%iSeed#eta - L%iMuon#eta",level-2,level-3);
354  hseedetares[trig][level-4] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
355  sprintf(title,"L%iSeed #eta - L%i #eta",level-2,level-3);
356  hseedetares[trig][level-4]->setAxisTitle(title, 1);
357  sprintf(name,"HLTMuonL%iSeedtoL%i_etarelres",level-2,level-3);
358  sprintf(title,"(L%iSeed#eta - L%iMuon#eta)/L%iMuon#eta",level-2,level-3,level-3);
359  hseedetarelres[trig][level-4] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
360  sprintf(title,"(L%iSeed #eta - L%i #eta)/L%i #eta",level-2,level-3,level-3);
361  hseedetarelres[trig][level-4]->setAxisTitle(title, 1);
362  // phi
363  sprintf(name,"HLTMuonL%iSeedtoL%i_phires",level-2,level-3);
364  sprintf(title,"L%iSeed#phi - L%iMuon#phi",level-2,level-3);
365  hseedphires[trig][level-4] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
366  sprintf(title,"L%iSeed #phi - L%i #phi",level-2,level-3);
367  hseedphires[trig][level-4]->setAxisTitle(title, 1);
368  sprintf(name,"HLTMuonL%iSeedtoL%i_phirelres",level-2,level-3);
369  sprintf(title,"(L%iSeed#phi - L%iMuon#phi)/L%iMuon#phi",level-2,level-3,level-3);
370  hseedphirelres[trig][level-4] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
371  sprintf(title,"(L%iSeed #phi - L%i #phi)/L%i #phi",level-2,level-3,level-3);
372  hseedphirelres[trig][level-4]->setAxisTitle(title, 1);
373 
374  sprintf(name,"HLTMuonL%iSeed_NMuperL%i",level-2,level-3);
375  sprintf(title,"L%iSeedNMu per L%i",level-2,level-3);
376  hseedNMuper[trig][level-4] = dbe_->book1D(name, title, 5, -0.5, 4.5);
377  hseedNMuper[trig][level-4]->setAxisTitle(title, 1);
378  }
379  else if( level == 6 ) {
380  double max_energy = 1.0;
381  sprintf(name,"HLTMuonL2_driso");
382  sprintf(title,"dR Cone Size");
383  hL2muonIsoDR[trig] = dbe_->book2D(name, title, 10, 0, 0.24, NBINS, 0, 5.0);
384  hL2muonIsoDR[trig]->setAxisTitle(title, 1);
385  hL2muonIsoDR[trig]->setAxisTitle("Calo Energy in Iso Cone (GeV)", 2);
386 
387  sprintf(name,"HLTCaloTower_dRwithL2");
388  sprintf(title,"#Delta R(L2muon, CaloTower)");
389  htowerdRL2[trig] = dbe_->book1D(name, title, NBINS, 0, 0.5);
390  htowerdRL2[trig]->setAxisTitle(title, 1);
391  sprintf(name,"HLTCaloTower_dRwithL3");
392  sprintf(title,"#Delta R(L3muon, CaloTower)");
393  htowerdRL3[trig] = dbe_->book1D(name, title, NBINS, 0, 0.5);
394  htowerdRL3[trig]->setAxisTitle(title, 1);
395 
396  sprintf(name,"HLTCaloTower_Et");
397  sprintf(title,"HLT CaloTower Et");
398  htowerEt[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
399  htowerEt[trig]->setAxisTitle(title, 1);
400  sprintf(name,"HLTCaloTower_Eta");
401  sprintf(title,"HLT CaloTower #eta");
402  htowerEta[trig] = dbe_->book1D(name, title, NBINS, -2.5, 2.5);
403  htowerEta[trig]->setAxisTitle(title, 1);
404  sprintf(name,"HLTCaloTower_Phi");
405  sprintf(title,"HLT CaloTower #phi");
406  htowerPhi[trig] = dbe_->book1D(name, title, NBINS, -3.14, 3.14);
407  htowerPhi[trig]->setAxisTitle(title, 1);
408 
409  sprintf(name,"HLTCaloTower_HadEnergy");
410  sprintf(title,"HLT CaloTower hadEnergy");
411  htowerHadEnergy[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
412  htowerHadEnergy[trig]->setAxisTitle(title, 1);
413  sprintf(name,"HLTCaloTower_EmEnergy");
414  sprintf(title,"HLT CaloTower emEnergy");
415  htowerEmEnergy[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
416  htowerEmEnergy[trig]->setAxisTitle(title, 1);
417  sprintf(name,"HLTCaloTower_OuterEnergy");
418  sprintf(title,"HLT CaloTower outerEnergy");
419  htowerOuterEnergy[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
420  htowerOuterEnergy[trig]->setAxisTitle(title, 1);
421 
422  sprintf(name,"HLTCaloTower_HadEt");
423  sprintf(title,"HLT CaloTower hadEt");
424  htowerHadEt[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
425  htowerHadEt[trig]->setAxisTitle(title, 1);
426  sprintf(name,"HLTCaloTower_EmEt");
427  sprintf(title,"HLT CaloTower emEt");
428  htowerEmEt[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
429  htowerEmEt[trig]->setAxisTitle(title, 1);
430  sprintf(name,"HLTCaloTower_OuterEt");
431  sprintf(title,"HLT CaloTower outerEt");
432  htowerOuterEt[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
433  htowerOuterEt[trig]->setAxisTitle(title, 1);
434 
435  sprintf(name,"HLTCaloTower_EtaHadEt");
436  sprintf(title,"HLT CaloTower hadEt");
437  htowerEtaHadEt[trig] = dbe_->book2D(name, title, NBINS, -2.5, 2.5, NBINS, 0, max_energy);
438  htowerEtaHadEt[trig]->setAxisTitle("CaloTower #eta", 1);
439  htowerEtaHadEt[trig]->setAxisTitle(title, 2);
440  sprintf(name,"HLTCaloTower_EtaEmEt");
441  sprintf(title,"HLT CaloTower emEt");
442  htowerEtaEmEt[trig] = dbe_->book2D(name, title, NBINS, -2.5, 2.5, NBINS, 0, max_energy);
443  htowerEtaEmEt[trig]->setAxisTitle("CaloTower #eta", 1);
444  htowerEtaEmEt[trig]->setAxisTitle(title, 2);
445  sprintf(name,"HLTCaloTower_EtaOuterEt");
446  sprintf(title,"HLT CaloTower outerEt");
447  htowerEtaOuterEt[trig] = dbe_->book2D(name, title, NBINS, -2.5, 2.5, NBINS, 0, max_energy);
448  htowerEtaOuterEt[trig]->setAxisTitle("CaloTower #eta", 1);
449  htowerEtaOuterEt[trig]->setAxisTitle(title, 2);
450 
451  sprintf(name,"HLTCaloTower_PhiHadEt");
452  sprintf(title,"HLT CaloTower hadEt");
453  htowerPhiHadEt[trig] = dbe_->book2D(name, title, NBINS, -3.15, 3.15, NBINS, 0, max_energy);
454  htowerPhiHadEt[trig]->setAxisTitle("CaloTower #phi", 1);
455  htowerPhiHadEt[trig]->setAxisTitle(title, 2);
456  sprintf(name,"HLTCaloTower_PhiEmEt");
457  sprintf(title,"HLT CaloTower emEt");
458  htowerPhiEmEt[trig] = dbe_->book2D(name, title, NBINS, -3.15, 3.15, NBINS, 0, max_energy);
459  htowerPhiEmEt[trig]->setAxisTitle("CaloTower #phi", 1);
460  htowerPhiEmEt[trig]->setAxisTitle(title, 2);
461  sprintf(name,"HLTCaloTower_PhiOuterEt");
462  sprintf(title,"HLT CaloTower outerEt");
463  htowerPhiOuterEt[trig] = dbe_->book2D(name, title, NBINS, -3.15, 3.15, NBINS, 0, max_energy);
464  htowerPhiOuterEt[trig]->setAxisTitle("CaloTower #phi", 1);
465  htowerPhiOuterEt[trig]->setAxisTitle(title, 2);
466  }
467 
468  if (level>1&&level<4){
469  sprintf(name,"HLTMuonL%i_dr",level);
470  sprintf(title,"L%i Muon radial impact vs BeamSpot",level);
471  hdr[trig][level-2] = dbe_->book1D(name,title, NBINS, -0.3, 0.3);
472  hdr[trig][level-2]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
473  sprintf(name,"HLTMuonL%i_d0",level);
474  sprintf(title,"L%i Muon radial impact vs (0,0)",level);
475  hd0[trig][level-2] = dbe_->book1D(name,title, NBINS, -0.3, 0.3);
476  hd0[trig][level-2]->setAxisTitle("R Impact (cm) vs 0,0", 1);
477  sprintf(name,"HLTMuonL%i_dz0",level);
478  sprintf(title,"L%i Muon Z impact vs (0)",level);
479  hdz0[trig][level-2] = dbe_->book1D(name,title, NBINS, -25., 25.);
480  hdz0[trig][level-2]->setAxisTitle("Z impact (cm) vs 0", 1);
481  sprintf(name,"HLTMuonL%i_dz",level);
482  sprintf(title,"L%i Muon Z impact vs BeamSpot",level);
483  hdz[trig][level-2] = dbe_->book1D(name,title, NBINS, -25., 25.);
484  hdz[trig][level-2]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
485  sprintf(name,"HLTMuonL%i_err0",level);
486  sprintf(title,"L%i Muon Error on Pt",level);
487  herr0[trig][level-2] = dbe_->book1D(name,title,NBINS, 0., 0.03);
488  herr0[trig][level-2]->setAxisTitle("Error on Pt", 1);
489  sprintf(name,"HLTMuonL%i_iso",level);
490  if (level==2)sprintf(title,"L%i Muon Energy in Isolation cone",level);
491  else if (level==3)sprintf(title,"L%i Muon SumPt in Isolation cone",level);
492  hiso[trig][level-2] = dbe_->book1D(name,title, NBINS, 0., 5./(level-1));
493  if ( level==2)hiso[trig][level-2]->setAxisTitle("Calo Energy in Iso Cone (GeV)", 1);
494  else if ( level==3)hiso[trig][level-2]->setAxisTitle("Sum Pt in Iso Cone (GeV)", 1);
495  sprintf(name,"HLTMuonL%i_DiMuMass",level);
496  sprintf(title,"L%i Opposite charge DiMuon invariant Mass",level);
497  hdimumass[trig][level-2]= dbe_->book1D(name,title, NBINS, 0., 150.);
498  hdimumass[trig][level-2]->setAxisTitle("Di Muon Invariant Mass (GeV)");
499 
500  sprintf(name,"HLTMuonL%i_drphi",level);
501  sprintf(title,"L%i #Deltar vs #phi",level);
502  hdrphi[trig][level-2] = dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
503  hdrphi[trig][level-2]->setAxisTitle("#phi", 1);
504  sprintf(title,"L%i Muon radial impact vs BeamSpot",level);
505  hdrphi[trig][level-2]->setAxisTitle(title, 2);
506 
507  sprintf(name,"HLTMuonL%i_d0phi",level);
508  sprintf(title,"L%i #Delta0 vs #phi",level);
509  hd0phi[trig][level-2] = dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
510  hd0phi[trig][level-2]->setAxisTitle("#phi", 1);
511  sprintf(title,"L%i Muon radial impact vs (0,0)",level);
512  hd0phi[trig][level-2]->setAxisTitle(title, 2);
513 
514  sprintf(name,"HLTMuonL%i_dz0eta",level);
515  sprintf(title,"L%i #Deltaz0 vs #eta",level);
516  hdz0eta[trig][level-2] = dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
517  hdz0eta[trig][level-2]->setAxisTitle("#eta", 1);
518  sprintf(title,"L%i Muon Z impact vs (0)",level);
519  hdz0eta[trig][level-2]->setAxisTitle(title, 2);
520 
521  sprintf(name,"HLTMuonL%i_dzeta",level);
522  sprintf(title,"L%i #Deltaz vs #eta",level);
523  hdzeta[trig][level-2] = dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
524  hdzeta[trig][level-2]->setAxisTitle("#eta", 1);
525  sprintf(title,"L%i Muon Z impact vs BeamSpot",level);
526  hdzeta[trig][level-2]->setAxisTitle(title, 2);
527  }
528  if(level == 2 ) {
529  sprintf(name,"HLTMuonL%itoL%i_ptpull",level,level+1);
530  sprintf(title,"(L%iMuon1/Pt - L%iMuon1/Pt)/#sigma_{pt}^{L2}",level,level+1);
531  hptpull[trig] = dbe_->book1D(name,title, NBINS, -10.0, 10.0);
532  sprintf(title,"(1/PtL%i - 1/PtL%i)/#sigma_{pt}^{L2}",level,level+1);
533  hptpull[trig]->setAxisTitle(title, 1);
534  sprintf(name,"HLTMuonL%itoL%i_etapull",level,level+1);
535  sprintf(title,"(L%iMuon#eta - L%iMuon#eta)/#sigma_{#eta}^{L2}",level,level+1);
536  hetapull[trig] =dbe_->book1D(name,title, NBINS, -10.0, 10.0);
537  sprintf(title,"(L%i #eta - L%i #eta)/#sigma_{#eta}^{L2}",level,level+1);
538  hetapull[trig]->setAxisTitle(title, 1);
539  sprintf(name,"HLTMuonL%itoL%i_phipull",level,level+1);
540  sprintf(title,"(L%iMuon#phi - L%iMuon#phi)/#sigma_{#phi}^{L2}",level,level+1);
541  hphipull[trig] =dbe_->book1D(name,title, NBINS, -10.0, 10.0);
542  sprintf(title,"(L%i #phi - L%i #phi)/#sigma_{#phi}^{L2}",level,level+1);
543  hphipull[trig]->setAxisTitle(title, 1);
544 
545  sprintf(name,"HLTMuonL%itoL%i_ptpullpt",level,level+1);
546  sprintf(title,"L%i Muon #Delta Pt/#sigma_{pt}^{L2} vs Pt ",level);
547  hptpullpt[trig] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
548  sprintf(title,"(1/PtL%i - 1/PtL%i)/#sigma_{pt}^{L2}",level,level+1);
549  hptpullpt[trig]->setAxisTitle(title, 2);
550  hptpullpt[trig]->setAxisTitle("Pt", 1);
551  sprintf(name,"HLTMuonL%itoL%i_etapulleta",level,level+1);
552  sprintf(title,"L%i Muon #Delta#eta/#sigma_{#eta}^{L2} vs #eta ",level);
553  hetapulleta[trig] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
554  sprintf(title,"(L%i #eta - L%i #eta)/#sigma_{#eta}^{L2}",level,level+1);
555  hetapulleta[trig]->setAxisTitle(title, 2);
556  hetapulleta[trig]->setAxisTitle("#eta", 1);
557  sprintf(name,"HLTMuonL%itoL%i_phipullphi",level,level+1);
558  sprintf(title,"L%i Muon #Delta#phi/#sigma_{#phi}^{L2} vs #phi ",level);
559  hphipullphi[trig] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
560  sprintf(title,"(L%i #phi - L%i #phi)/#sigma_{#phi}^{L2}",level,level+1);
561  hphipullphi[trig]->setAxisTitle(title, 2);
562  hphipullphi[trig]->setAxisTitle("#phi", 1);
563  }
564  if (level < 3 ) {
565  // res
566  sprintf(name,"HLTMuonL%itoL%i_ptres",level,level+1);
567  sprintf(title,"L%iMuon1/Pt - L%iMuon1/Pt",level,level+1);
568  hptres[trig][level-1] = dbe_->book1D(name,title, NBINS, -0.1, 0.1);
569  sprintf(title,"1/PtL%i - 1/PtL%i",level,level+1);
570  hptres[trig][level-1]->setAxisTitle(title, 1);
571  sprintf(name,"HLTMuonL%itoL%i_etares",level,level+1);
572  sprintf(title,"L%iMuon#eta - L%iMuon#eta",level,level+1);
573  hetares[trig][level-1] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
574  sprintf(title,"L%i #eta - L%i #eta",level,level+1);
575  hetares[trig][level-1]->setAxisTitle(title, 1);
576  sprintf(name,"HLTMuonL%itoL%i_phires",level,level+1);
577  sprintf(title,"L%iMuon#phi - L%iMuon#phi",level,level+1);
578  hphires[trig][level-1] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
579  sprintf(title,"L%i #phi - L%i #phi",level,level+1);
580  hphires[trig][level-1]->setAxisTitle(title, 1);
581 
582  sprintf(name,"HLTMuonL%itoL%i_ptrespt",level,level+1);
583  sprintf(title,"L%i Muon #Delta Pt vs Pt ",level);
584  hptrespt[trig][level-1] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
585  sprintf(title,"1/PtL%i - 1/PtL%i",level,level+1);
586  hptrespt[trig][level-1]->setAxisTitle(title, 2);
587  hptrespt[trig][level-1]->setAxisTitle("Pt", 1);
588  sprintf(name,"HLTMuonL%itoL%i_phiresphi",level,level+1);
589  sprintf(title,"L%i Muon #Delta#phi vs #phi ",level);
590  hphiresphi[trig][level-1] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
591  sprintf(title,"L%i #phi - L%i #phi",level,level+1);
592  hphiresphi[trig][level-1]->setAxisTitle(title, 2);
593  hphiresphi[trig][level-1]->setAxisTitle("#phi", 1);
594  sprintf(name,"HLTMuonL%itoL%i_etareseta",level,level+1);
595  sprintf(title,"L%i Muon #Delta#eta vs #eta ",level);
596  hetareseta[trig][level-1] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
597  sprintf(title,"L%i #eta - L%i #eta",level,level+1);
598  hetareseta[trig][level-1]->setAxisTitle(title, 2);
599  hetareseta[trig][level-1]->setAxisTitle("#eta", 1);
600 
601  // relres
602  sprintf(name,"HLTMuonL%itoL%i_ptrelres",level,level+1);
603  sprintf(title,"(L%iMuon1/Pt - L%iMuon1/Pt)/(L%iMuon1/Pt)",level,level+1,level+1);
604  hptrelres[trig][level-1] = dbe_->book1D(name,title, NBINS, -1.0, 1.0);
605  sprintf(title,"(1/PtL%i - 1/PtL%i)/(1/PtL%i)",level,level+1,level+1);
606  hptrelres[trig][level-1]->setAxisTitle(title, 1);
607  sprintf(name,"HLTMuonL%itoL%i_etarelres",level,level+1);
608  sprintf(title,"(L%iMuon#eta - L%iMuon#eta)/L%iMuon#eta",level,level+1,level+1);
609  hetarelres[trig][level-1] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
610  sprintf(title,"(L%i #eta - L%i #eta)/L%i #eta",level,level+1,level+1);
611  hetarelres[trig][level-1]->setAxisTitle(title, 1);
612  sprintf(name,"HLTMuonL%itoL%i_phirelres",level,level+1);
613  sprintf(title,"(L%iMuon#phi - L%iMuon#phi)/L%iMuon#phi",level,level+1,level+1);
614  hphirelres[trig][level-1] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
615  sprintf(title,"(L%i #phi - L%i #phi)/L%i #phi",level,level+1,level+1);
616  hphirelres[trig][level-1]->setAxisTitle(title, 1);
617 
618  sprintf(name,"HLTMuonL%itoL%i_ptrelrespt",level,level+1);
619  sprintf(title,"L%i Muon #DeltaPt/Pt vs Pt ",level);
620  hptrelrespt[trig][level-1] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
621  sprintf(title,"(1/PtL%i - 1/PtL%i)/(1/PtL%i)",level,level+1,level+1);
622  hptrelrespt[trig][level-1]->setAxisTitle(title, 2);
623  hptrelrespt[trig][level-1]->setAxisTitle("Pt", 1);
624  sprintf(name,"HLTMuonL%itoL%i_phirelresphi",level,level+1);
625  sprintf(title,"L%i Muon #Delta#phi/#phi vs #phi ",level);
626  hphirelresphi[trig][level-1] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
627  sprintf(title,"(L%i #phi - L%i #phi)/L%i #phi",level,level+1,level+1);
628  hphirelresphi[trig][level-1]->setAxisTitle(title, 2);
629  hphirelresphi[trig][level-1]->setAxisTitle("#phi", 1);
630  sprintf(name,"HLTMuonL%itoL%i_etarelreseta",level,level+1);
631  sprintf(title,"L%i Muon #Delta#eta/#eta vs #eta ",level);
632  hetarelreseta[trig][level-1] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
633  sprintf(title,"(L%i #eta - L%i #eta)/L%i #eta",level,level+1,level+1);
634  hetarelreseta[trig][level-1]->setAxisTitle(title, 2);
635  hetarelreseta[trig][level-1]->setAxisTitle("#eta", 1);
636  // charge conversion
637  sprintf(name,"HLTMuonL%itoL%i_chargeconvers",level,level+1);
638  sprintf(title,"L%i Muon charge #rightarrow L%i Muon charge",level,level+1);
639  hchargeconv[trig][level-1] =dbe_->book1D(name,title, 4, 0, 4);
640  hchargeconv[trig][level-1]->setAxisTitle(title, 1);
641  hchargeconv[trig][level-1]->setBinLabel(1, "- #rightarrow -", 1);
642  hchargeconv[trig][level-1]->setBinLabel(2, "- #rightarrow +", 1);
643  hchargeconv[trig][level-1]->setBinLabel(3, "+ #rightarrow -", 1);
644  hchargeconv[trig][level-1]->setBinLabel(4, "+ #rightarrow +", 1);
645  // reconstruction fraction with dependence
646  sprintf(name,"HLTMuonL%itoL%i_fracpt",level,level+1);
647  sprintf(title,"#ofL%iMuon/#ofL%iMuon",level+1,level);
648  hptfrac[trig][level-1] = dbe_->book1D(name,title, 40, 0, pt_max);
649  hptfrac[trig][level-1]->setAxisTitle("Pt", 1);
650  sprintf(name,"HLTMuonL%itoL%i_fraceta",level,level+1);
651  sprintf(title,"#ofL%iMuon/#ofL%iMuon",level+1,level);
652  hetafrac[trig][level-1] = dbe_->book1D(name,title, 40, -2.5, 2.5);
653  hetafrac[trig][level-1]->setAxisTitle("#eta", 1);
654  sprintf(name,"HLTMuonL%itoL%i_fracphi",level,level+1);
655  sprintf(title,"#ofL%iMuon/#ofL%iMuon",level+1,level);
656  hphifrac[trig][level-1] = dbe_->book1D(name,title, 40, -3.15, 3.15);
657  hphifrac[trig][level-1]->setAxisTitle("#phi", 1);
658  if (level == 1 ){
659  // res
660  sprintf(name,"HLTMuonL%itoL3_ptres",level);
661  sprintf(title,"L%iMuon1/Pt - L%iMuon1/Pt",level,level+2);
662  hptres[trig][level+1] = dbe_->book1D(name,title, NBINS, -0.1, 0.1);
663  sprintf(title,"1/PtL%i - 1/PtL%i",level,level+2);
664  hptres[trig][level+1]->setAxisTitle(title, 1);
665  sprintf(name,"HLTMuonL%itoL3_etares",level);
666  sprintf(title,"L%iMuon#eta - L3Muon#eta",level);
667  hetares[trig][level+1] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
668  sprintf(title,"L%i #eta - L3 #eta",level);
669  hetares[trig][level+1]->setAxisTitle(title, 1);
670  sprintf(name,"HLTMuonL%itoL3_phires",level);
671  sprintf(title,"L%iMuon#phi - L3Muon#phi",level);
672  hphires[trig][level+1] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
673  sprintf(title,"L%i #phi - L3 #phi",level);
674  hphires[trig][level+1]->setAxisTitle(title, 1);
675 
676  sprintf(name,"HLTMuonL%itoL3_ptrespt",level);
677  sprintf(title,"L%i Muon #Delta Pt vs Pt (wrt L3) ",level);
678  hptrespt[trig][level+1] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
679  sprintf(title,"1/PtL%i - 1/PtL3",level);
680  hptrespt[trig][level+1]->setAxisTitle(title, 2);
681  hptrespt[trig][level+1]->setAxisTitle("Pt", 1);
682  sprintf(name,"HLTMuonL%itoL3_phiresphi",level);
683  sprintf(title,"L%i Muon #Delta#phi vs #phi (wrt L3) ",level);
684  hphiresphi[trig][level+1] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
685  sprintf(title,"L%i #phi - L3 #phi",level);
686  hphiresphi[trig][level+1]->setAxisTitle(title, 2);
687  hphiresphi[trig][level+1]->setAxisTitle("#phi", 1);
688  sprintf(name,"HLTMuonL%itoL3_etareseta",level);
689  sprintf(title,"L%i Muon #Delta#eta vs #eta (wrt L3) ",level);
690  hetareseta[trig][level+1] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
691  sprintf(title,"L%i #eta - L3 #eta",level);
692  hetareseta[trig][level+1]->setAxisTitle(title, 2);
693  hetareseta[trig][level+1]->setAxisTitle("#eta", 1);
694 
695  // relres
696  sprintf(name,"HLTMuonL%itoL3_ptrelres",level);
697  sprintf(title,"(L%iMuon1/Pt - L%iMuon1/Pt)/(L%iMuon1/Pt)",level,level+2,level+2);
698  hptrelres[trig][level+1] = dbe_->book1D(name,title, NBINS, -1.0, 1.0);
699  sprintf(title,"(1/PtL%i - 1/PtL3)/(1/PtL3)",level);
700  hptrelres[trig][level+1]->setAxisTitle(title, 1);
701  sprintf(name,"HLTMuonL%itoL3_etarelres",level);
702  sprintf(title,"(L%iMuon#eta - L3Muon#eta)/L3Muon#eta",level);
703  hetarelres[trig][level+1] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
704  sprintf(title,"(L%i #eta - L3 #eta)/L3 #eta",level);
705  hetarelres[trig][level+1]->setAxisTitle(title, 1);
706  sprintf(name,"HLTMuonL%itoL3_phirelres",level);
707  sprintf(title,"(L%iMuon#phi - L3Muon#phi)/L3Muon#phi",level);
708  hphirelres[trig][level+1] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
709  sprintf(title,"(L%i #phi - L3 #phi)/L3 #phi",level);
710  hphirelres[trig][level+1]->setAxisTitle(title, 1);
711 
712  sprintf(name,"HLTMuonL%itoL3_ptrelrespt",level);
713  sprintf(title,"L%i Muon #DeltaPt/Pt vs Pt (wrt L3) ",level);
714  hptrelrespt[trig][level+1] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
715  sprintf(title,"(1/PtL%i - 1/PtL3)/(1/PtL3)",level);
716  hptrelrespt[trig][level+1]->setAxisTitle(title, 2);
717  hptrelrespt[trig][level+1]->setAxisTitle("Pt", 1);
718  sprintf(name,"HLTMuonL%itoL3_phirelresphi",level);
719  sprintf(title,"L%i Muon #Delta#phi/#phi vs #phi (wrt L3) ",level);
720  hphirelresphi[trig][level+1] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
721  sprintf(title,"(L%i #phi - L3 #phi)/L3 #phi",level);
722  hphirelresphi[trig][level+1]->setAxisTitle(title, 2);
723  hphirelresphi[trig][level+1]->setAxisTitle("#phi", 1);
724  sprintf(name,"HLTMuonL%itoL3_etarelreseta",level);
725  sprintf(title,"L%i Muon #Delta#eta/#eta vs #eta (wrt L3) ",level);
726  hetarelreseta[trig][level+1] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
727  sprintf(title,"(L%i #eta - L3 #eta)/L3 #eta",level);
728  hetarelreseta[trig][level+1]->setAxisTitle(title, 2);
729  hetarelreseta[trig][level+1]->setAxisTitle("#eta", 1);
730 
731  sprintf(name,"HLTMuonL%itoL3_chargeconvers",level);
732  sprintf(title,"L%i Muon charge #rightarrow L3 Muon charge",level);
733  hchargeconv[trig][level+1] =dbe_->book1D(name,title, 4, 0, 4);
734  hchargeconv[trig][level+1]->setAxisTitle(title, 1);
735  hchargeconv[trig][level+1]->setBinLabel(1, "- #rightarrow -", 1);
736  hchargeconv[trig][level+1]->setBinLabel(2, "- #rightarrow +", 1);
737  hchargeconv[trig][level+1]->setBinLabel(3, "+ #rightarrow -", 1);
738  hchargeconv[trig][level+1]->setBinLabel(4, "+ #rightarrow +", 1);
739  }
740  }
741  }
743  }
744  // Muon det id is 2 pushed in bits 28:31
745  const unsigned int detector_id = 2<<28;
746  dbe_->tagContents(monitorName_, detector_id);
747  }
748 
749  for( int trig = 0; trig < nTrigs; trig++ ) {
750  for( int level = 1; level < 3; ++level ) {
751  char name[512];
752  sprintf(name, "DenominatorL%iptTrig%i", level, trig);
753  _hpt1[trig][level-1] = new TH1D(name, name, 40, 0, 145);
754  sprintf(name, "NumeratorL%iptTrig%i", level, trig);
755  _hpt2[trig][level-1] = new TH1D(name, name, 40, 0, 145);
756  sprintf(name, "DenominatorL%ietaTrig%i", level, trig);
757  _heta1[trig][level-1] = new TH1D(name, name, 40, -2.5, 2.5);
758  sprintf(name, "NumeratorL%ietaTrig%i", level, trig);
759  _heta2[trig][level-1] = new TH1D(name, name, 40, -2.5, 2.5);
760  sprintf(name, "DenominatorL%iphiTrig%i", level, trig);
761  _hphi1[trig][level-1] = new TH1D(name, name, 40, -3.15, 3.15);
762  sprintf(name, "NumeratorL%iphiTrig%i", level, trig);
763  _hphi2[trig][level-1] = new TH1D(name, name, 40, -3.15, 3.15);
764  }
765  }
766 }
767 
768 //--------------------------------------------------------
769 void HLTMuonDQMSource::beginRun(const edm::Run& r, const edm::EventSetup& context) {
770 
771 }
772 
773 //--------------------------------------------------------
775  const edm::EventSetup& context) {
776 
777 }
778 
779 // ----------------------------------------------------------
781  const edm::EventSetup& iSetup )
782 {
783  if ( !dbe_) return;
784  counterEvt_++;
785  if (prescaleEvt_ > 0 && counterEvt_%prescaleEvt_!=0) return;
786  LogDebug("HLTMuonDQMSource") << " processing conterEvt_: " << counterEvt_ <<std::endl;
787 
788  bool trigFired = false;
789  bool FiredTriggers[NTRIG] = {false};
791  iEvent.getByLabel(TrigResultInput, trigResult);
792  if( !trigResult.failedToGet() ) {
793  int ntrigs = trigResult->size();
794  const edm::TriggerNames & trigName = iEvent.triggerNames(*trigResult);
795  for( int itrig = 0; itrig != ntrigs; ++itrig) {
796  //std::cout << "trigName = " << trigName.triggerName(itrig) << " " << itrig << std::endl;
797  for( unsigned int n = 0; n < (unsigned int)theTriggerBits.size(); n++) {
798  if( trigName.triggerIndex(theTriggerBits[n]) == (unsigned int)ntrigs ) continue;
799  if( trigResult->accept(trigName.triggerIndex(theTriggerBits[n])) ) {
800  for( unsigned int j = 0; j < (unsigned int)theDirectoryName.size(); j++ ) {
801  if( theHLTCollectionLevel[n] == theDirectoryName[j] ) FiredTriggers[j] = true;
802  }
803  trigFired = true;
804  }
805  }
806  }
807  }
808  //else std::cout << "failed to get trigResult!!" << std::endl;
809  // trigger fired
810  if( !trigFired ) return;
811  nTrig_++;
812 
813  //get the field
815  iSetup.get<IdealMagneticFieldRecord>().get(magField);
816 
817  //get the geometry
818  edm::ESHandle<GlobalTrackingGeometry> glbTrackingGeometry;
819  iSetup.get<GlobalTrackingGeometryRecord>().get(glbTrackingGeometry);
820 
824  reco::RecoChargedCandidateCollection::const_iterator cand, cand2, cand3;
825 
826  iEvent.getByLabel (l2seedscollectionTag_,l2seeds);
827  iEvent.getByLabel (l3seedscollectionTag_,l3seeds);
828  iEvent.getByLabel (l2collectionTag_,l2mucands);
829  iEvent.getByLabel (l3collectionTag_,l3mucands);
830 
831  if( !l2seeds.failedToGet() && l2seeds.isValid() ) {
832  iEvent.getByLabel (l2collectionTag_,l2mucands);
833  if( !l2mucands.failedToGet() && l2mucands->size() != 0 ) {
834  iEvent.getByLabel (l3seedscollectionTag_,l3seeds);
835  if( !l3seeds.failedToGet() && l3seeds.isValid() ) iEvent.getByLabel (l3collectionTag_,l3mucands);
836  }
837  }
838 
839  for( int ntrig = 0; ntrig < nTrigs; ntrig++ ) {
840  if( !FiredTriggers[ntrig] ) continue;
841  //std::cout << "trigger fired!" << std::endl;
842  if( !l2seeds.failedToGet() && l2seeds.isValid() ) {
843  hNMu[ntrig][3]->Fill(l2seeds->size());
844  L2MuonTrajectorySeedCollection::const_iterator l2seed;
845  std::map<l1extra::L1MuonParticleRef, int> l1map;
846  for (l2seed=l2seeds->begin() ; l2seed != l2seeds->end();++l2seed){
847  PTrajectoryStateOnDet state=l2seed->startingState();
848  // Transform Trajectory State on Det to a TSOS
849  TrajectoryStateTransform tsTransform;
850  DetId seedDetId(state.detId());
851  const GeomDet* gdet = glbTrackingGeometry->idToDet( seedDetId );
852  TrajectoryStateOnSurface tsos = tsTransform.transientState(state, &(gdet->surface()), magField.product());
853  float pt = tsos.globalMomentum().perp();
854  float eta = tsos.globalPosition().eta();
855  float phi = tsos.globalPosition().phi();
856  hcharge[ntrig][3]->Fill(tsos.charge());
857  hpt[ntrig][3]->Fill(pt);
858  hphi[ntrig][3]->Fill(phi);
859  heta[ntrig][3]->Fill(eta);
860  hetaphi[ntrig][3]->Fill(phi,eta);
861  hptphi[ntrig][3]->Fill(pt,phi);
862  hpteta[ntrig][3]->Fill(pt,eta);
863  l1extra::L1MuonParticleRef l1ref = l2seed->l1Particle();
864  l1map[l1ref]++;
865  hseedptres[ntrig][0]->Fill(1/pt - 1/l1ref->pt());
866  hseedetares[ntrig][0]->Fill(eta - l1ref->eta());
867  hseedphires[ntrig][0]->Fill(phi - l1ref->phi());
868  hseedptrelres[ntrig][0]->Fill((1/pt - 1/l1ref->pt())/(1/l1ref->pt()));
869  hseedetarelres[ntrig][0]->Fill((eta - l1ref->eta())/l1ref->eta());
870  hseedphirelres[ntrig][0]->Fill((phi - l1ref->phi())/l1ref->phi());
871 
872  hcharge[ntrig][0]->Fill(l1ref->charge());
873  hpt[ntrig][0]->Fill(l1ref->pt());
874  hphi[ntrig][0]->Fill(l1ref->phi());
875 
876  if(hphi[ntrig][0]->getEntries()){
877  for(int ibin = 1; ibin <= hphi[ntrig][0]->getNbinsX(); ++ibin)
878  hphi_norm[ntrig][0]->setBinContent(ibin,
879  hphi[ntrig][0]->getBinContent(ibin)/hphi[ntrig][0]->getEntries());
880  }
881 
882  heta[ntrig][0]->Fill(l1ref->eta());
883  hetaphi[ntrig][0]->Fill(l1ref->phi(),l1ref->eta());
884  hptphi[ntrig][0]->Fill(l1ref->pt(),l1ref->phi());
885  hpteta[ntrig][0]->Fill(l1ref->pt(),l1ref->eta());
886  hl1quality[ntrig]->Fill(l1ref->gmtMuonCand().quality());
887  _hpt1[ntrig][0]->Fill(l1ref->pt());
888  _heta1[ntrig][0]->Fill(l1ref->eta());
889  _hphi1[ntrig][0]->Fill(l1ref->phi());
890  if ( !l2mucands.failedToGet() && l2mucands.isValid() ) {
891  for (cand=l2mucands->begin(); cand!=l2mucands->end(); ++cand) {
892  reco::TrackRef tk = cand->get<reco::TrackRef>();
893  edm::RefToBase<TrajectorySeed> seed=tk->seedRef();
894  if ( (l2seed->startingState()).detId() == (seed->startingState()).detId() ) {
895  if(tk->pt()*l1ref->pt() != 0 ) {
896  hptres[ntrig][0]->Fill(1/l1ref->pt() - 1/tk->pt());
897  hptrespt[ntrig][0]->Fill(tk->pt(), 1/l1ref->pt() - 1/tk->pt());
898  hptrelres[ntrig][0]->Fill((1/l1ref->pt() - 1/tk->pt())/(1/tk->pt()));
899  hptrelrespt[ntrig][0]->Fill(tk->pt(), (1/l1ref->pt() - 1/tk->pt())/(1/tk->pt()));
900  }
901  _hpt2[ntrig][0]->Fill(l1ref->pt());
902  _heta2[ntrig][0]->Fill(l1ref->eta());
903  _hphi2[ntrig][0]->Fill(l1ref->phi());
904  hetares[ntrig][0]->Fill(l1ref->eta()-tk->eta());
905  hetareseta[ntrig][0]->Fill(tk->eta(),l1ref->eta()-tk->eta());
906  hetarelres[ntrig][0]->Fill((l1ref->eta()-tk->eta())/tk->eta());
907  hetarelreseta[ntrig][0]->Fill(tk->eta(),(l1ref->eta()-tk->eta())/tk->eta());
908  hphires[ntrig][0]->Fill(l1ref->phi()-tk->phi());
909  double dphi=l1ref->phi()-tk->phi();
910  if (dphi>TMath::TwoPi())dphi-=2*TMath::TwoPi();
911  else if (dphi<-TMath::TwoPi()) dphi+=TMath::TwoPi();
912  hphiresphi[ntrig][0]->Fill(tk->phi(),dphi);
913  hphirelres[ntrig][0]->Fill((l1ref->phi()-tk->phi())/tk->phi());
914  hphirelresphi[ntrig][0]->Fill(tk->phi(),dphi/tk->phi());
915  // charge conversion
916  int chargeconv = -1;
917  int l1charge = l1ref->charge();
918  int l2charge = tk->charge();
919  if( l1charge == -1 && l2charge == -1 ) chargeconv = 0;
920  else if( l1charge == -1 && l2charge == 1 ) chargeconv = 1;
921  else if( l1charge == 1 && l2charge == -1 ) chargeconv = 2;
922  else if( l1charge == 1 && l2charge == 1 ) chargeconv = 3;
923  hchargeconv[ntrig][0]->Fill(chargeconv);
924  _hpt1[ntrig][1]->Fill(tk->pt());
925  _heta1[ntrig][1]->Fill(tk->eta());
926  _hphi1[ntrig][1]->Fill(tk->phi());
927  //find the L3 build from this L2
928  if (!l3mucands.failedToGet() && l3mucands.isValid() ) {
929  for (cand=l3mucands->begin(); cand!=l3mucands->end(); ++cand) {
930  reco::TrackRef l3tk= cand->get<reco::TrackRef>();
931  if( l3tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> > ().isAvailable() ) {
932  if (l3tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> >()->l2Track() == tk){
933  if(l1ref->pt()*l3tk->pt() != 0 ) {
934  hptres[ntrig][2]->Fill(1/l1ref->pt() - 1/l3tk->pt());
935  hptrespt[ntrig][2]->Fill(l3tk->pt(), 1/l1ref->pt() - 1/l3tk->pt());
936  hptrelres[ntrig][2]->Fill((1/l1ref->pt() - 1/l3tk->pt())/(1/l3tk->pt()));
937  hptrelrespt[ntrig][2]->Fill(l3tk->pt(), (1/l1ref->pt() - 1/l3tk->pt())/(1/l3tk->pt()));
938  }
939  hetares[ntrig][2]->Fill(l1ref->eta()-l3tk->eta());
940  hetareseta[ntrig][2]->Fill(l1ref->eta(),l1ref->eta()-l3tk->eta());
941  hetarelres[ntrig][2]->Fill((l1ref->eta()-l3tk->eta())/l3tk->eta());
942  hetarelreseta[ntrig][2]->Fill(l1ref->eta(),(l1ref->eta()-l3tk->eta())/l3tk->eta());
943  hphires[ntrig][2]->Fill(l1ref->phi()-l3tk->phi());
944  double dphi=l1ref->phi()-l3tk->phi();
945  if (dphi>TMath::TwoPi())dphi-=2*TMath::TwoPi();
946  else if (dphi<-TMath::TwoPi()) dphi+=TMath::TwoPi();
947  hphiresphi[ntrig][2]->Fill(l3tk->phi(),dphi);
948  hphirelres[ntrig][2]->Fill((l1ref->phi()-l3tk->phi())/l3tk->phi());
949  hphirelresphi[ntrig][2]->Fill(l3tk->phi(),(dphi)/l3tk->phi());
950  // charge conversion
951  int chargeconv = -1;
952  int l1charge = l1ref->charge();
953  int l3charge = l3tk->charge();
954  if( l1charge == -1 && l3charge == -1 ) chargeconv = 0;
955  else if( l1charge == -1 && l3charge == 1 ) chargeconv = 1;
956  else if( l1charge == 1 && l3charge == -1 ) chargeconv = 2;
957  else if( l1charge == 1 && l3charge == 1 ) chargeconv = 3;
958  hchargeconv[ntrig][2]->Fill(chargeconv);
959  _hpt2[ntrig][1]->Fill(tk->pt());
960  _heta2[ntrig][1]->Fill(tk->eta());
961  _hphi2[ntrig][1]->Fill(tk->phi());
962  //break; //plot only once per L2?
963  }//if
964  }
965  }//for
966  }
967  break;
968  }
969  }
970  }
971  }
972  // mapping
973  std::map<l1extra::L1MuonParticleRef, int>::iterator it;
974  for( it = l1map.begin(); it != l1map.end(); it++ ) {
975  hseedNMuper[ntrig][0]->Fill(it->second);
976  }
977  hNMu[ntrig][0]->Fill(l1map.size());
978  }
979  //else std::cout << "failed to get l2seed!" << std::endl;
980 
981  if (!l3seeds.failedToGet() && l3seeds.isValid() ) {
982  hNMu[ntrig][4]->Fill(l3seeds->size());
983  L3MuonTrajectorySeedCollection::const_iterator l3seed;
984  std::map<reco::TrackRef, int> l2map;
985  for (l3seed=l3seeds->begin() ; l3seed != l3seeds->end();++l3seed){
986  PTrajectoryStateOnDet state=l3seed->startingState();
987  // Transform Trajectory State on Det to a TSOS
988  TrajectoryStateTransform tsTransform;
989  DetId seedDetId(state.detId());
990  const GeomDet* gdet = glbTrackingGeometry->idToDet( seedDetId );
991  TrajectoryStateOnSurface tsos = tsTransform.transientState(state, &(gdet->surface()), magField.product());
992 
993  float pt = tsos.globalMomentum().perp();
994  float eta = tsos.globalPosition().eta();
995  float phi = tsos.globalPosition().phi();
996  hcharge[ntrig][4]->Fill(tsos.charge());
997  hpt[ntrig][4]->Fill(pt);
998  hphi[ntrig][4]->Fill(phi);
999  heta[ntrig][4]->Fill(eta);
1000  hetaphi[ntrig][4]->Fill(phi,eta);
1001  hptphi[ntrig][4]->Fill(pt,phi);
1002  hpteta[ntrig][4]->Fill(pt,eta);
1003 
1004  reco::TrackRef l2tkRef = l3seed->l2Track();
1005  l2map[l2tkRef]++;
1006  hseedptres[ntrig][1]->Fill(1/pt - 1/l2tkRef->pt());
1007  hseedetares[ntrig][1]->Fill(eta - l2tkRef->eta());
1008  hseedphires[ntrig][1]->Fill(phi - l2tkRef->phi());
1009  hseedptrelres[ntrig][1]->Fill((1/pt - 1/l2tkRef->pt())/(1/l2tkRef->pt()));
1010  hseedetarelres[ntrig][1]->Fill((eta - l2tkRef->eta())/l2tkRef->eta());
1011  hseedphirelres[ntrig][1]->Fill((phi - l2tkRef->phi())/l2tkRef->phi());
1012  }
1013  // mapping
1014  std::map<reco::TrackRef, int>::iterator it;
1015  for( it = l2map.begin(); it != l2map.end(); it++ ) {
1016  hseedNMuper[ntrig][1]->Fill(it->second);
1017  }
1018  }
1019 
1020  //else std::cout << "failed to get l3seed!" << std::endl;
1021 
1023  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
1024  iEvent.getByLabel("hltOfflineBeamSpot",recoBeamSpotHandle);
1025  if (!recoBeamSpotHandle.failedToGet()) beamSpot = *recoBeamSpotHandle;
1026 
1027  if (!l2mucands.failedToGet() && l2mucands.isValid() ) {
1028  LogDebug("HLTMuonDQMSource") << " filling L2 stuff " << std::endl;
1030  if( l2mucands->size() != 0 ) iEvent.getByLabel (l2isolationTag_,l2depMap);
1031  hNMu[ntrig][1]->Fill(l2mucands->size());
1032  for (cand=l2mucands->begin(); cand!=l2mucands->end(); ++cand) {
1033  reco::TrackRef tk = cand->get<reco::TrackRef>();
1034  if (!l2depMap.failedToGet() && l2depMap.isValid() ) {
1035  LogDebug("HLTMuonDQMSource") << " filling L2 Iso stuff " << std::endl;
1036  if ( l2depMap->contains(tk.id()) ){
1037  reco::IsoDepositMap::value_type calDeposit = (*l2depMap)[tk];
1038  double dephlt = calDeposit.depositWithin(coneSize_);
1039  if( dephlt != 0 ) hiso[ntrig][0]->Fill(dephlt);
1040  // 2D plot: cone size vs. dep
1041  double depL2[10];
1042  for( int idep = 0; idep < 10; idep++ ) {
1043  double conesize = (idep + 1)*coneSize_/10.0;
1044  depL2[idep] = calDeposit.depositWithin(conesize);
1045  if( depL2[idep] != 0 ) hL2muonIsoDR[ntrig]->Fill(conesize, depL2[idep]);
1046  }
1047  }
1048  }
1049 
1050  // eta cut
1051  hpt[ntrig][1]->Fill(tk->pt());
1052  hcharge[ntrig][1]->Fill(tk->charge());
1053  if ( tk->charge() != 0 ) {
1054  heta[ntrig][1]->Fill(tk->eta());
1055  hphi[ntrig][1]->Fill(tk->phi());
1056 
1057  if(hphi[ntrig][1]->getEntries()){
1058  for(int ibin = 1; ibin <= hphi[ntrig][1]->getNbinsX(); ++ibin)
1059  hphi_norm[ntrig][1]->setBinContent(ibin,
1060  hphi[ntrig][1]->getBinContent(ibin)/hphi[ntrig][1]->getEntries());
1061  }
1062 
1063  hetaphi[ntrig][1]->Fill(tk->phi(),tk->eta());
1064  hptphi[ntrig][1]->Fill(tk->pt(),tk->phi());
1065  hpteta[ntrig][1]->Fill(tk->pt(),tk->eta());
1066  const reco::HitPattern& hitp = tk->hitPattern();
1067  hnHits[ntrig][1]->Fill(hitp.numberOfHits());
1069  hd0[ntrig][0]->Fill(tk->d0());
1070  if (!recoBeamSpotHandle.failedToGet()){
1071  hdr[ntrig][0]->Fill(tk->dxy(beamSpot.position()));
1072  hdrphi[ntrig][0]->Fill(tk->phi(),tk->dxy(beamSpot.position()));
1073  }
1074  hd0phi[ntrig][0]->Fill(tk->phi(),tk->d0());
1075  hdz0[ntrig][0]->Fill(tk->dz());
1076  hdz0eta[ntrig][0]->Fill(tk->eta(),tk->dz());
1077  hdz[ntrig][0]->Fill(tk->dz(beamSpot.position()));
1078  hdzeta[ntrig][0]->Fill(tk->eta(),tk->dz(beamSpot.position()));
1079  herr0[ntrig][0]->Fill(tk->error(0));
1080  cand2=cand;
1081  ++cand2;
1082  for (; cand2!=l2mucands->end(); cand2++) {
1083  reco::TrackRef tk2=cand2->get<reco::TrackRef>();
1084  if ( tk->charge()*tk2->charge() == -1 ){
1085  double mass=(cand->p4()+cand2->p4()).M();
1086  hdimumass[ntrig][0]->Fill(mass);
1087  }
1088  }
1089  } else edm::LogWarning("HLTMonMuon")<<"stop filling candidate with update@Vtx failure";
1090  }
1091  }
1092  if (!l3mucands.failedToGet() && l3mucands.isValid() ) {
1093  LogDebug("HLTMuonDQMSource") << " filling L3 stuff " << std::endl;
1094  hNMu[ntrig][2]->Fill(l3mucands->size());
1096  if( l3mucands->size() != 0 ) iEvent.getByLabel (l3isolationTag_,l3depMap);
1097  for (cand=l3mucands->begin(); cand!=l3mucands->end(); ++cand) {
1098  reco::TrackRef tk = cand->get<reco::TrackRef>();
1099  if (!l3depMap.failedToGet() && l3depMap.isValid() ) {
1100  if ( l3depMap->contains(tk.id()) ){
1101  reco::IsoDepositMap::value_type calDeposit= (*l3depMap)[tk];
1102  double dephlt = calDeposit.depositWithin(coneSize_);
1103  if( dephlt != 0 ) hiso[ntrig][1]->Fill(dephlt);
1104  }
1105  }
1106  // eta cut
1107  hpt[ntrig][2]->Fill(tk->pt());
1108  heta[ntrig][2]->Fill(tk->eta());
1109  hphi[ntrig][2]->Fill(tk->phi());
1110 
1111  if(hphi[ntrig][2]->getEntries()){
1112  for(int ibin = 1; ibin <= hphi[ntrig][2]->getNbinsX(); ++ibin)
1113  hphi_norm[ntrig][2]->setBinContent(ibin,
1114  hphi[ntrig][2]->getBinContent(ibin)/hphi[ntrig][2]->getEntries());
1115  }
1116 
1117  hetaphi[ntrig][2]->Fill(tk->phi(),tk->eta());
1118  hptphi[ntrig][2]->Fill(tk->pt(),tk->phi());
1119  hpteta[ntrig][2]->Fill(tk->pt(),tk->eta());
1120  const reco::HitPattern& hitp = tk->hitPattern();
1121  hnHits[ntrig][2]->Fill(hitp.numberOfHits());
1124  hd0[ntrig][1]->Fill(tk->d0());
1125  if (!recoBeamSpotHandle.failedToGet()) {
1126  hdr[ntrig][1]->Fill(tk->dxy(beamSpot.position()));
1127  hdrphi[ntrig][1]->Fill(tk->phi(),tk->dxy(beamSpot.position()));
1128  }
1129  hd0phi[ntrig][1]->Fill(tk->phi(),tk->d0());
1130  hdz0[ntrig][1]->Fill(tk->dz());
1131  hdz0eta[ntrig][1]->Fill(tk->eta(),tk->dz());
1132  hdz[ntrig][1]->Fill(tk->dz(beamSpot.position()));
1133  hdzeta[ntrig][1]->Fill(tk->eta(),tk->dz(beamSpot.position()));
1134  herr0[ntrig][1]->Fill(tk->error(0));
1135  hcharge[ntrig][2]->Fill(tk->charge());
1136  cand2=cand;
1137  ++cand2;
1138 
1139  for (; cand2!=l3mucands->end(); cand2++) {
1140  reco::TrackRef tk2=cand2->get<reco::TrackRef>();
1141  if ( tk->charge()*tk2->charge() == -1 ){
1142  double mass=(cand->p4()+cand2->p4()).M();
1143  hdimumass[ntrig][1]->Fill(mass);
1144  }
1145  }
1146  if( tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> >().isAvailable() ) {
1147  reco::TrackRef l2tk = tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> >()->l2Track();
1148  if(tk->pt()*l2tk->pt() != 0 ) {
1149  hptres[ntrig][1]->Fill(1/l2tk->pt() - 1/tk->pt());
1150  hptrespt[ntrig][1]->Fill(tk->pt(), 1/l2tk->pt() - 1/tk->pt());
1151  hptrelres[ntrig][1]->Fill((1/l2tk->pt() - 1/tk->pt())/(1/tk->pt()));
1152  hptrelrespt[ntrig][1]->Fill(tk->pt(), (1/l2tk->pt() - 1/tk->pt())/(1/tk->pt()));
1153  double pterr = (tk->ptError()/(tk->pt()*tk->pt()));
1154  hptpull[ntrig]->Fill((1/l2tk->pt() - 1/tk->pt())/pterr);
1155  hptpullpt[ntrig]->Fill(tk->pt(), (1/l2tk->pt() - 1/tk->pt())/pterr);
1156  }
1157  hphires[ntrig][1]->Fill(l2tk->phi()-tk->phi());
1158  double dphi=l2tk->phi()-tk->phi();
1159  if (dphi>TMath::TwoPi())dphi-=2*TMath::TwoPi();
1160  else if (dphi<-TMath::TwoPi()) dphi+=TMath::TwoPi();
1161  hphiresphi[ntrig][1]->Fill(tk->phi(),dphi);
1162  hphirelres[ntrig][1]->Fill((l2tk->phi()-tk->phi())/tk->phi());
1163  hphirelresphi[ntrig][1]->Fill(tk->phi(),dphi/tk->phi());
1164  hphipull[ntrig]->Fill(dphi/tk->phiError());
1165  hphipullphi[ntrig]->Fill(tk->phi(), dphi/tk->phiError());
1166  hetares[ntrig][1]->Fill(l2tk->eta()-tk->eta());
1167  hetareseta[ntrig][1]->Fill(tk->eta(),l2tk->eta()-tk->eta());
1168  hetarelres[ntrig][1]->Fill((l2tk->eta()-tk->eta())/tk->eta());
1169  hetarelreseta[ntrig][1]->Fill(tk->eta(),(l2tk->eta()-tk->eta())/tk->eta());
1170  hetapull[ntrig]->Fill((l2tk->eta()-tk->eta())/tk->etaError());
1171  hetapulleta[ntrig]->Fill(tk->eta(),(l2tk->eta()-tk->eta())/tk->etaError());
1172  // charge conversion
1173  int chargeconv = -1;
1174  int l2charge = l2tk->charge();
1175  int l3charge = tk->charge();
1176  if( l2charge == -1 && l3charge == -1 ) chargeconv = 0;
1177  else if( l2charge == -1 && l3charge == 1 ) chargeconv = 1;
1178  else if( l2charge == 1 && l3charge == -1 ) chargeconv = 2;
1179  else if( l2charge == 1 && l3charge == 1 ) chargeconv = 3;
1180  hchargeconv[ntrig][1]->Fill(chargeconv);
1181  }
1182  }
1183  }
1184 
1185  for( int level = 0; level < 2; level++ ) {
1186  for( int nbin = 1; nbin < _hpt1[ntrig][level]->GetNbinsX()+1; nbin++ ) {
1187  if( _hpt1[ntrig][level]->GetBinContent(nbin) != 0 ) {
1188  double frac = _hpt2[ntrig][level]->GetBinContent(nbin)/_hpt1[ntrig][level]->GetBinContent(nbin);
1189  double err = sqrt(frac*fabs(1 - frac)/_hpt1[ntrig][level]->GetBinContent(nbin));
1190  hptfrac[ntrig][level]->setBinContent(nbin, frac);
1191  hptfrac[ntrig][level]->setBinError(nbin, err);
1192  }
1193  if( _heta1[ntrig][level]->GetBinContent(nbin) != 0 ) {
1194  double frac = _heta2[ntrig][level]->GetBinContent(nbin)/_heta1[ntrig][level]->GetBinContent(nbin);
1195  double err = sqrt(frac*fabs(1 - frac)/_heta1[ntrig][level]->GetBinContent(nbin));
1196  hetafrac[ntrig][level]->setBinContent(nbin, frac);
1197  hetafrac[ntrig][level]->setBinError(nbin, err);
1198  }
1199  if( _hphi1[ntrig][level]->GetBinContent(nbin) != 0 ) {
1200  double frac = _hphi2[ntrig][level]->GetBinContent(nbin)/_hphi1[ntrig][level]->GetBinContent(nbin);
1201  double err = sqrt(frac*fabs(1 - frac)/_hphi1[ntrig][level]->GetBinContent(nbin));
1202  hphifrac[ntrig][level]->setBinContent(nbin, frac);
1203  hphifrac[ntrig][level]->setBinError(nbin, err);
1204  }
1205  else {
1206  hptfrac[ntrig][level]->setBinContent(nbin, 0.0);
1207  hetafrac[ntrig][level]->setBinContent(nbin, 0.0);
1208  hphifrac[ntrig][level]->setBinContent(nbin, 0.0);
1209  hptfrac[ntrig][level]->setBinError(nbin, 0.0);
1210  hetafrac[ntrig][level]->setBinError(nbin, 0.0);
1211  hphifrac[ntrig][level]->setBinError(nbin, 0.0);
1212  }
1213  }
1214  }
1215  }
1216 
1217 
1218  // Tower
1220  if( !l2mucands.failedToGet() && l2mucands->size() != 0 )
1221  iEvent.getByLabel(edm::InputTag("hltTowerMakerForMuons"), caloTower);
1222  for( int ntrig = 0; ntrig < nTrigs; ntrig++ ) {
1223  if( !FiredTriggers[ntrig] ) continue;
1224  if( caloTower.isValid() ) {
1226  for( itower = caloTower->begin(); itower != caloTower->end(); ++itower ) {
1227  if( (*itower).et() == 0 ) continue;
1228 
1229  // deltaR with l2muon
1230  if (!l2mucands.failedToGet() && l2mucands.isValid() ) {
1231  for (cand=l2mucands->begin(); cand!=l2mucands->end(); ++cand) {
1232  reco::TrackRef l2tk= cand->get<reco::TrackRef>();
1233  double deltaR_l2 = reco::deltaR(*l2tk, (*itower));
1234  htowerdRL2[ntrig]->Fill(deltaR_l2);
1235  }
1236  }
1237  // deltaR with l3muon
1238  if (!l3mucands.failedToGet() && l3mucands.isValid() ) {
1239  for (cand=l3mucands->begin(); cand!=l3mucands->end(); ++cand) {
1240  reco::TrackRef l3tk= cand->get<reco::TrackRef>();
1241  double deltaR_l3 = reco::deltaR(*l3tk, (*itower));
1242  htowerdRL3[ntrig]->Fill(deltaR_l3);
1243  }
1244  }
1245  htowerEt[ntrig]->Fill((*itower).et());
1246  htowerPhi[ntrig]->Fill((*itower).phi());
1247  htowerEta[ntrig]->Fill((*itower).eta());
1248 
1249  // energy contributions from different detectors
1250  // energy in HO ("outerEnergy")is not included in "hadEnergy"
1251  htowerOuterEnergy[ntrig]->Fill((*itower).outerEnergy());
1252  htowerHadEnergy[ntrig]->Fill((*itower).hadEnergy());
1253  htowerEmEnergy[ntrig]->Fill((*itower).emEnergy());
1254 
1255  htowerOuterEt[ntrig]->Fill((*itower).outerEt());
1256  htowerHadEt[ntrig]->Fill((*itower).hadEt());
1257  htowerEmEt[ntrig]->Fill((*itower).emEt());
1258 
1259  // 2D plots
1260  htowerPhiOuterEt[ntrig]->Fill((*itower).phi(), (*itower).outerEt());
1261  htowerPhiHadEt[ntrig]->Fill((*itower).phi(), (*itower).hadEt());
1262  htowerPhiEmEt[ntrig]->Fill((*itower).phi(), (*itower).emEt());
1263  htowerEtaOuterEt[ntrig]->Fill((*itower).eta(), (*itower).outerEt());
1264  htowerEtaHadEt[ntrig]->Fill((*itower).eta(), (*itower).hadEt());
1265  htowerEtaEmEt[ntrig]->Fill((*itower).eta(), (*itower).emEt());
1266  }
1267  }
1268  }
1269 
1270 }
1271 
1272 
1273 
1274 
1275 //--------------------------------------------------------
1277  const edm::EventSetup& context) {
1278 }
1279 //--------------------------------------------------------
1281 }
1282 //--------------------------------------------------------
1284  edm::LogInfo("HLTMonMuon") << "analyzed " << counterEvt_ << " events";
1285  //std::cout << "analyzed = " << counterEvt_ << " , triggered = " << nTrig_ << std::endl;
1286 
1287 
1288  //if (outputFile_.size() != 0 && dbe_)
1289  //dbe_->save(outputFile_);
1290 
1291  return;
1292 }
#define LogDebug(id)
MonitorElement * hseedptrelres[NTRIG][2]
const double TwoPi
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * hptpullpt[NTRIG]
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:208
void setBinContent(int binx, double content)
set content of bin (1-D)
edm::InputTag l2collectionTag_
MonitorElement * htowerEtaHadEt[NTRIG]
std::string outputFile_
int numberOfValidHits() const
Definition: HitPattern.cc:321
edm::InputTag l3seedscollectionTag_
MonitorElement * htowerHadEt[NTRIG]
T perp() const
Definition: PV3DBase.h:66
MonitorElement * hnHits[NTRIG][4]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
MonitorElement * hL2muonIsoDR[NTRIG]
int numberOfValidMuonHits() const
Definition: HitPattern.cc:346
MonitorElement * htowerdRL3[NTRIG]
MonitorElement * hetares[NTRIG][3]
MonitorElement * hetapulleta[NTRIG]
MonitorElement * hnTkValidHits[NTRIG]
MonitorElement * hNMu[NTRIG][5]
edm::InputTag l3collectionTag_
MonitorElement * hdrphi[NTRIG][2]
MonitorElement * hseedphirelres[NTRIG][2]
MonitorElement * hptrelrespt[NTRIG][3]
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
std::vector< CaloTower >::const_iterator const_iterator
MonitorElement * hdimumass[NTRIG][2]
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * hphipull[NTRIG]
GlobalPoint globalPosition() const
#define NULL
Definition: scimark2.h:8
TH1D * _hphi1[NTRIG][2]
MonitorElement * hphifrac[NTRIG][2]
double coneSize_
every n events
double getEntries(void) const
get # of entries
MonitorElement * hetafrac[NTRIG][2]
MonitorElement * hphipullphi[NTRIG]
MonitorElement * htowerEta[NTRIG]
MonitorElement * htowerEtaOuterEt[NTRIG]
MonitorElement * hphirelresphi[NTRIG][3]
T eta() const
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
MonitorElement * htowerPhiEmEt[NTRIG]
void endJob()
Endjob.
MonitorElement * hphiresphi[NTRIG][3]
MonitorElement * hseedptres[NTRIG][2]
int numberOfValidTrackerHits() const
Definition: HitPattern.cc:333
MonitorElement * hptphi[NTRIG][5]
MonitorElement * hseedNMuper[NTRIG][2]
MonitorElement * htowerEt[NTRIG]
MonitorElement * hnMuValidHits[NTRIG]
double deltaR(double eta1, double phi1, double eta2, double phi2)
Definition: deltaR.h:19
void Fill(long long x)
MonitorElement * htowerdRL2[NTRIG]
int nTrig_
counter
MonitorElement * htowerHadEnergy[NTRIG]
MonitorElement * hdz0eta[NTRIG][2]
MonitorElement * hl1quality[NTRIG]
MonitorElement * hdr[NTRIG][2]
MonitorElement * hd0phi[NTRIG][2]
int iEvent
Definition: GenABIO.cc:243
MonitorElement * hetareseta[NTRIG][3]
MonitorElement * hptpull[NTRIG]
TH1D * _hpt1[NTRIG][2]
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
std::string striggers_[20]
TH1D * _heta1[NTRIG][2]
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:485
T sqrt(T t)
Definition: SSEVec.h:28
MonitorElement * htowerOuterEnergy[NTRIG]
std::string monitorName_
MonitorElement * hptrespt[NTRIG][3]
int ntrig
Definition: AMPTWrapper.h:163
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
MonitorElement * hchargeconv[NTRIG][3]
TH1D * _hphi2[NTRIG][2]
void analyze(const edm::Event &e, const edm::EventSetup &c)
Fake Analyze.
MonitorElement * hphi_norm[NTRIG][5]
MonitorElement * hcharge[NTRIG][5]
int prescaleEvt_
mutriggered events
int numberOfHits() const
Definition: HitPattern.cc:312
MonitorElement * hpt[NTRIG][5]
int j
Definition: DBlmapReader.cc:9
edm::InputTag l2seedscollectionTag_
MonitorElement * htowerEmEt[NTRIG]
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field) const
edm::ParameterSet parameters_
edm::InputTag l3isolationTag_
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * htowerEtaEmEt[NTRIG]
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:833
MonitorElement * hiso[NTRIG][2]
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
MonitorElement * hptres[NTRIG][3]
bool failedToGet() const
Definition: HandleBase.h:80
Definition: DetId.h:20
MonitorElement * hseedetares[NTRIG][2]
MonitorElement * hseedetarelres[NTRIG][2]
MonitorElement * htowerPhiHadEt[NTRIG]
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
MonitorElement * hnValidHits[NTRIG]
MonitorElement * hphi[NTRIG][5]
void beginJob()
BeginJob.
const T & get() const
Definition: EventSetup.h:55
MonitorElement * hseedphires[NTRIG][2]
const unsigned int detId() const
#define NBINS
Definition: FineDelayTask.cc:8
T const * product() const
Definition: ESHandle.h:62
MonitorElement * hd0[NTRIG][2]
TH1D * _heta2[NTRIG][2]
MonitorElement * hptrelres[NTRIG][3]
MonitorElement * hphirelres[NTRIG][3]
char state
Definition: procUtils.cc:75
MonitorElement * hetapull[NTRIG]
std::vector< std::string > theDirectoryName
static const int NTRIG
T eta() const
Definition: PV3DBase.h:70
void tagContents(const std::string &path, unsigned int myTag)
tag all children of folder (does NOT include subfolders)
Definition: DQMStore.cc:1187
GlobalVector globalMomentum() const
MonitorElement * hphires[NTRIG][3]
MonitorElement * hdzeta[NTRIG][2]
HLTMuonDQMSource(const edm::ParameterSet &)
MonitorElement * hptfrac[NTRIG][2]
MonitorElement * htowerOuterEt[NTRIG]
MonitorElement * heta[NTRIG][5]
int getNbinsX(void) const
get # of bins in X-axis
MonitorElement * htowerEmEnergy[NTRIG]
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
DQM Client Diagnostic.
MonitorElement * htowerPhi[NTRIG]
MonitorElement * hdz0[NTRIG][2]
std::vector< std::string > theHLTCollectionLevel
const Point & position() const
position
Definition: BeamSpot.h:63
tuple level
Definition: testEve_cfg.py:34
ProductID id() const
Accessor for product ID.
Definition: Ref.h:254
void showDirStructure(void) const
Definition: DQMStore.cc:2539
edm::InputTag l2isolationTag_
MonitorElement * hetaphi[NTRIG][5]
MonitorElement * herr0[NTRIG][2]
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:647
MonitorElement * htowerPhiOuterEt[NTRIG]
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:239
MonitorElement * hpteta[NTRIG][5]
edm::InputTag TrigResultInput
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::vector< std::string > theTriggerBits
MonitorElement * hetarelres[NTRIG][3]
MonitorElement * hdz[NTRIG][2]
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
TH1D * _hpt2[NTRIG][2]
Definition: Run.h:31
MonitorElement * hetarelreseta[NTRIG][3]
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
Definition: DDAxes.h:10