CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopSingleLeptonDQM.cc
Go to the documentation of this file.
7 
8 namespace TopSingleLepton {
9 
10  // maximal number of leading jets
11  // to be used for top mass estimate
12  static const unsigned int MAXJETS = 4;
13  // nominal mass of the W boson to
14  // be used for the top mass estimate
15  static const double WMASS = 80.4;
16 
18  label_(label), elecIso_(0), elecSelect_(0), muonIso_(0), muonSelect_(0), jetIDSelect_(0), includeBTag_(false), lowerEdge_(-1.), upperEdge_(-1.), logged_(0)
19  {
20  // sources have to be given; this PSet is not optional
21  edm::ParameterSet sources=cfg.getParameter<edm::ParameterSet>("sources");
22  muons_= sources.getParameter<edm::InputTag>("muons");
23  elecs_= sources.getParameter<edm::InputTag>("elecs");
24  jets_ = sources.getParameter<edm::InputTag>("jets" );
25  mets_ = sources.getParameter<std::vector<edm::InputTag> >("mets" );
26 
27  // electronExtras are optional; they may be omitted or
28  // empty
29  if( cfg.existsAs<edm::ParameterSet>("elecExtras") ){
30  edm::ParameterSet elecExtras=cfg.getParameter<edm::ParameterSet>("elecExtras");
31  // select is optional; in case it's not found no
32  // selection will be applied
33  if( elecExtras.existsAs<std::string>("select") ){
34  elecSelect_= new StringCutObjectSelector<reco::GsfElectron>(elecExtras.getParameter<std::string>("select"));
35  }
36  // isolation is optional; in case it's not found no
37  // isolation will be applied
38  if( elecExtras.existsAs<std::string>("isolation") ){
39  elecIso_= new StringCutObjectSelector<reco::GsfElectron>(elecExtras.getParameter<std::string>("isolation"));
40  }
41  // electronId is optional; in case it's not found the
42  // InputTag will remain empty
43  if( elecExtras.existsAs<edm::ParameterSet>("electronId") ){
44  edm::ParameterSet elecId=elecExtras.getParameter<edm::ParameterSet>("electronId");
45  electronId_= elecId.getParameter<edm::InputTag>("src");
46  eidPattern_= elecId.getParameter<int>("pattern");
47  }
48  }
49 
50  // muonExtras are optional; they may be omitted or empty
51  if( cfg.existsAs<edm::ParameterSet>("muonExtras") ){
52  edm::ParameterSet muonExtras=cfg.getParameter<edm::ParameterSet>("muonExtras");
53  // select is optional; in case it's not found no
54  // selection will be applied
55  if( muonExtras.existsAs<std::string>("select") ){
56  muonSelect_= new StringCutObjectSelector<reco::Muon>(muonExtras.getParameter<std::string>("select"));
57  }
58  // isolation is optional; in case it's not found no
59  // isolation will be applied
60  if( muonExtras.existsAs<std::string>("isolation") ){
61  muonIso_= new StringCutObjectSelector<reco::Muon>(muonExtras.getParameter<std::string>("isolation"));
62  }
63  }
64 
65  // jetExtras are optional; they may be omitted or
66  // empty
67  if( cfg.existsAs<edm::ParameterSet>("jetExtras") ){
68  edm::ParameterSet jetExtras=cfg.getParameter<edm::ParameterSet>("jetExtras");
69  // jetCorrector is optional; in case it's not found
70  // the InputTag will remain empty
71  if( jetExtras.existsAs<std::string>("jetCorrector") ){
72  jetCorrector_= jetExtras.getParameter<std::string>("jetCorrector");
73  }
74  // read jetID information if it exists
75  if(jetExtras.existsAs<edm::ParameterSet>("jetID")){
76  edm::ParameterSet jetID=jetExtras.getParameter<edm::ParameterSet>("jetID");
77  jetIDLabel_ =jetID.getParameter<edm::InputTag>("label");
78  jetIDSelect_= new StringCutObjectSelector<reco::JetID>(jetID.getParameter<std::string>("select"));
79  }
80  // select is optional; in case it's not found no
81  // selection will be applied (only implemented for
82  // CaloJets at the moment)
83  if( jetExtras.existsAs<std::string>("select") ){
84  jetSelect_= jetExtras.getParameter<std::string>("select");
85  }
86  // jetBDiscriminators are optional; in case they are
87  // not found the InputTag will remain empty; they
88  // consist of pairs of edm::JetFlavorAssociation's &
89  // corresponding working points
90  includeBTag_=jetExtras.existsAs<edm::ParameterSet>("jetBTaggers");
91  if( includeBTag_ ){
92  edm::ParameterSet btagEff=jetExtras.getParameter<edm::ParameterSet>("jetBTaggers").getParameter<edm::ParameterSet>("trackCountingEff");
93  btagEff_= btagEff.getParameter<edm::InputTag>("label"); btagEffWP_= btagEff.getParameter<double>("workingPoint");
94  edm::ParameterSet btagPur=jetExtras.getParameter<edm::ParameterSet>("jetBTaggers").getParameter<edm::ParameterSet>("trackCountingPur");
95  btagPur_= btagPur.getParameter<edm::InputTag>("label"); btagPurWP_= btagPur.getParameter<double>("workingPoint");
96  edm::ParameterSet btagVtx=jetExtras.getParameter<edm::ParameterSet>("jetBTaggers").getParameter<edm::ParameterSet>("secondaryVertex" );
97  btagVtx_= btagVtx.getParameter<edm::InputTag>("label"); btagVtxWP_= btagVtx.getParameter<double>("workingPoint");
98  }
99  }
100 
101  // triggerExtras are optional; they may be omitted or empty
102  if( cfg.existsAs<edm::ParameterSet>("triggerExtras") ){
103  edm::ParameterSet triggerExtras=cfg.getParameter<edm::ParameterSet>("triggerExtras");
104  triggerTable_=triggerExtras.getParameter<edm::InputTag>("src");
105  triggerPaths_=triggerExtras.getParameter<std::vector<std::string> >("paths");
106  }
107 
108  // massExtras is optional; in case it's not found no mass
109  // window cuts are applied for the same flavor monitor
110  // histograms
111  if( cfg.existsAs<edm::ParameterSet>("massExtras") ){
112  edm::ParameterSet massExtras=cfg.getParameter<edm::ParameterSet>("massExtras");
113  lowerEdge_= massExtras.getParameter<double>("lowerEdge");
114  upperEdge_= massExtras.getParameter<double>("upperEdge");
115  }
116 
117  // setup the verbosity level for booking histograms;
118  // per default the verbosity level will be set to
119  // STANDARD. This will also be the chosen level in
120  // the case when the monitoring PSet is not found
122  if( cfg.existsAs<edm::ParameterSet>("monitoring") ){
123  edm::ParameterSet monitoring=cfg.getParameter<edm::ParameterSet>("monitoring");
124  if(monitoring.getParameter<std::string>("verbosity") == "DEBUG" )
125  verbosity_= DEBUG;
126  if(monitoring.getParameter<std::string>("verbosity") == "VERBOSE" )
128  if(monitoring.getParameter<std::string>("verbosity") == "STANDARD")
130  }
131  // and don't forget to do the histogram booking
132  book(cfg.getParameter<std::string>("directory"));
133  }
134 
135  void
137  {
138  //set up the current directory path
139  std::string current(directory); current+=label_;
141  store_->setCurrentFolder(current);
142 
143  // determine number of bins for trigger monitoring
144  unsigned int nPaths=triggerPaths_.size();
145 
146  // --- [STANDARD] --- //
147  // pt of the leading muon
148  hists_["muonPt_" ] = store_->book1D("MuonPt" , "pt(#mu)" , 50, 0., 250.);
149  // muon multiplicity before std isolation
150  hists_["muonMult_" ] = store_->book1D("MuonMult" , "N_{All}(#mu)" , 10, 0., 10.);
151  // muon multiplicity after std isolation
152  hists_["muonMultIso_"] = store_->book1D("MuonMultIso", "N_{Iso}(#mu)" , 10, 0., 10.);
153  // pt of the leading electron
154  hists_["elecPt_" ] = store_->book1D("ElecPt" , "pt(e)" , 50, 0., 250.);
155  // electron multiplicity before std isolation
156  hists_["elecMult_" ] = store_->book1D("ElecMult" , "N_{All}(e)" , 10, 0., 10.);
157  // electron multiplicity after std isolation
158  hists_["elecMultIso_"] = store_->book1D("ElecMultIso", "N_{Iso}(e)" , 10, 0., 10.);
159  // multiplicity of jets with pt>20 (corrected to L2+L3)
160  hists_["jetMult_" ] = store_->book1D("JetMult" , "N_{30}(jet)" , 10, 0., 10.);
161  // trigger efficiency estimates for single lepton triggers
162  hists_["triggerEff_" ] = store_->book1D("TriggerEff" , "Eff(trigger)" , nPaths, 0., nPaths);
163  // monitored trigger occupancy for single lepton triggers
164  hists_["triggerMon_" ] = store_->book1D("TriggerMon" , "Mon(trigger)" , nPaths, 0., nPaths);
165  // MET (calo)
166  hists_["metCalo_" ] = store_->book1D("METCalo" , "MET_{Calo}" , 50, 0., 200.);
167  // W mass estimate
168  hists_["massW_" ] = store_->book1D("MassW" , "M(W)" , 60, 0., 300.);
169  // Top mass estimate
170  hists_["massTop_" ] = store_->book1D("MassTop" , "M(Top)" , 50, 0., 500.);
171 
172  // set bin labels for trigger monitoring
173  triggerBinLabels(std::string("trigger"), triggerPaths_);
174 
175  if( verbosity_==STANDARD) return;
176 
177  // --- [VERBOSE] --- //
178  // eta of the leading muon
179  hists_["muonEta_" ] = store_->book1D("MuonEta" , "#eta(#mu)" , 30, -3., 3.);
180  // std isolation variable of the leading muon
181  hists_["muonRelIso_" ] = store_->book1D("MuonRelIso" , "Iso_{Rel}(#mu)" , 50, 0., 1.);
182  // eta of the leading electron
183  hists_["elecEta_" ] = store_->book1D("ElecEta" , "#eta(e)" , 30, -3., 3.);
184  // std isolation variable of the leading electron
185  hists_["elecRelIso_" ] = store_->book1D("ElecRelIso" , "Iso_{Rel}(e)" , 50, 0., 1.);
186  // multiplicity of btagged jets (for track counting high efficiency) with pt(L2L3)>30
187  hists_["jetMultBEff_"] = store_->book1D("JetMultBEff", "N_{30}(b/eff)" , 10, 0., 10.);
188  // btag discriminator for track counting high efficiency for jets with pt(L2L3)>30
189  hists_["jetBDiscEff_"] = store_->book1D("JetBDiscEff", "Disc_{b/eff}(jet)", 100, 0., 10.);
190  // pt of the 1. leading jet (corrected to L2+L3)
191  hists_["jet1Pt_" ] = store_->book1D("Jet1Pt" , "pt_{L2L3}(jet1)" , 60, 0., 300.);
192  // pt of the 2. leading jet (corrected to L2+L3)
193  hists_["jet2Pt_" ] = store_->book1D("Jet2Pt" , "pt_{L2L3}(jet2)" , 60, 0., 300.);
194  // pt of the 3. leading jet (corrected to L2+L3)
195  hists_["jet3Pt_" ] = store_->book1D("Jet3Pt" , "pt_{L2L3}(jet3)" , 60, 0., 300.);
196  // pt of the 4. leading jet (corrected to L2+L3)
197  hists_["jet4Pt_" ] = store_->book1D("Jet4Pt" , "pt_{L2L3}(jet4)" , 60, 0., 300.);
198  // MET (tc)
199  hists_["metTC_" ] = store_->book1D("METTC" , "MET_{TC}" , 50, 0., 200.);
200  // MET (pflow)
201  hists_["metPflow_" ] = store_->book1D("METPflow" , "MET_{Pflow}" , 50, 0., 200.);
202  // dz for muons (to suppress cosmis)
203  hists_["muonDelZ_" ] = store_->book1D("MuonDelZ" , "d_{z}(#mu)" , 50, -25., 25.);
204  // dxy for muons (to suppress cosmics)
205  hists_["muonDelXY_" ] = store_->book2D("MuonDelXY" , "d_{xy}(#mu)" , 50, -0.1, 0.1, 50, -0.1, 0.1);
206 
207  // set axes titles for dxy for muons
208  hists_["muonDelXY_" ]->setAxisTitle( "x [cm]", 1); hists_["muonDelXY_" ]->setAxisTitle( "y [cm]", 2);
209 
210  if( verbosity_==VERBOSE) return;
211 
212  // --- [DEBUG] --- //
213  // relative muon isolation in tracker for the leading muon
214  hists_["muonTrkIso_" ] = store_->book1D("MuonTrkIso" , "Iso_{Trk}(#mu)" , 50, 0., 1.);
215  // relative muon isolation in ecal+hcal for the leading muon
216  hists_["muonCalIso_" ] = store_->book1D("MuonCalIso" , "Iso_{Ecal}(#mu)" , 50, 0., 1.);
217  // relative electron isolation in tracker for the leading electron
218  hists_["elecTrkIso_" ] = store_->book1D("ElecTrkIso" , "Iso_{Trk}(e)" , 50, 0., 1.);
219  // relative electron isolation in ecal+hcal for the leading electron
220  hists_["elecCalIso_" ] = store_->book1D("ElecCalIso" , "Iso_{Ecal}(e)" , 50, 0., 1.);
221  // multiplicity of btagged jets (for track counting high purity) with pt(L2L3)>30
222  hists_["jetMultBPur_"] = store_->book1D("JetMultBPur", "N_{30}(b/pur)" , 10, 0., 10.);
223  // btag discriminator for track counting high purity
224  hists_["jetBDiscPur_"] = store_->book1D("JetBDiscPur", "Disc_{b/pur}(Jet)", 100, 0., 10.);
225  // multiplicity of btagged jets (for simple secondary vertex) with pt(L2L3)>30
226  hists_["jetMultBVtx_"] = store_->book1D("JetMultBVtx", "N_{30}(b/vtx)" , 10, 0., 10.);
227  // btag discriminator for simple secondary vertex
228  hists_["jetBDiscVtx_"] = store_->book1D("JetBDiscVtx", "Disc_{b/vtx}(Jet)", 35, -1., 6.);
229  // pt of the 1. leading jet (uncorrected)
230  hists_["jet1PtRaw_" ] = store_->book1D("Jet1PtRaw" , "pt_{Raw}(jet1)" , 60, 0., 300.);
231  // pt of the 2. leading jet (uncorrected)
232  hists_["jet2PtRaw_" ] = store_->book1D("Jet2PtRaw" , "pt_{Raw}(jet2)" , 60, 0., 300.);
233  // pt of the 3. leading jet (uncorrected)
234  hists_["jet3PtRaw_" ] = store_->book1D("Jet3PtRaw" , "pt_{Raw}(jet3)" , 60, 0., 300.);
235  // pt of the 4. leading jet (uncorrected)
236  hists_["jet4PtRaw_" ] = store_->book1D("Jet4PtRaw" , "pt_{Raw}(jet4)" , 60, 0., 300.);
237  // selected events
238  hists_["eventLogger_"] = store_->book2D("EventLogger", "Logged Events" , 9, 0., 9., 10, 0., 10.);
239 
240  // set axes titles for selected events
241  hists_["eventLogger_"]->getTH1()->SetOption("TEXT");
242  hists_["eventLogger_"]->setBinLabel( 1 , "Run" , 1);
243  hists_["eventLogger_"]->setBinLabel( 2 , "Block" , 1);
244  hists_["eventLogger_"]->setBinLabel( 3 , "Event" , 1);
245  hists_["eventLogger_"]->setBinLabel( 4 , "pt_{L2L3}(jet1)" , 1);
246  hists_["eventLogger_"]->setBinLabel( 5 , "pt_{L2L3}(jet2)" , 1);
247  hists_["eventLogger_"]->setBinLabel( 6 , "pt_{L2L3}(jet3)" , 1);
248  hists_["eventLogger_"]->setBinLabel( 7 , "pt_{L2L3}(jet4)" , 1);
249  hists_["eventLogger_"]->setBinLabel( 8 , "M_{W}" , 1);
250  hists_["eventLogger_"]->setBinLabel( 9 , "M_{Top}" , 1);
251  hists_["eventLogger_"]->setAxisTitle("logged evts" , 2);
252  return;
253  }
254 
255  void
257  {
258  // fetch trigger event if configured such
260  if(!triggerTable_.label().empty()) {
261  if( !event.getByLabel(triggerTable_, triggerTable) ) return;
262  }
263 
264  /*
265  ------------------------------------------------------------
266 
267  Electron Monitoring
268 
269  ------------------------------------------------------------
270  */
271 
272  // fill monitoring plots for electrons
274  if( !event.getByLabel(elecs_, elecs) ) return;
275 
276  // check availability of electron id
277  edm::Handle<edm::ValueMap<float> > electronId;
278  if(!electronId_.label().empty()) {
279  if( !event.getByLabel(electronId_, electronId) ) return;
280  }
281 
282  // loop electron collection
283  unsigned int eMult=0, eMultIso=0;
284  std::vector<const reco::GsfElectron*> isoElecs;
285  for(edm::View<reco::GsfElectron>::const_iterator elec=elecs->begin(); elec!=elecs->end(); ++elec){
286  unsigned int idx = elec-elecs->begin();
287  // restrict to electrons with good electronId
288  if( electronId_.label().empty() ? true : ((int)(*electronId)[elecs->refAt(idx)] & eidPattern_) ){
289  if(!elecSelect_ || (*elecSelect_)(*elec)){
290  double isolationTrk = elec->pt()/(elec->pt()+elec->dr03TkSumPt());
291  double isolationCal = elec->pt()/(elec->pt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt());
292  double isolationRel = (elec->dr03TkSumPt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt())/elec->pt();
293  if( eMult==0 ){
294  // restrict to the leading electron
295  fill("elecPt_" , elec->pt() );
296  fill("elecEta_", elec->eta());
297  fill("elecRelIso_" , isolationRel );
298  fill("elecTrkIso_" , isolationTrk );
299  fill("elecCalIso_" , isolationCal );
300  }
301  // in addition to the multiplicity counter buffer the iso
302  // electron candidates for later overlap check with jets
303  ++eMult; if(!elecIso_ || (*elecIso_)(*elec)){ isoElecs.push_back(&(*elec)); ++eMultIso;}
304  }
305  }
306  }
307  fill("elecMult_", eMult );
308  fill("elecMultIso_", eMultIso);
309 
310  /*
311  ------------------------------------------------------------
312 
313  Muon Monitoring
314 
315  ------------------------------------------------------------
316  */
317 
318  // fill monitoring plots for muons
319  unsigned int mMult=0, mMultIso=0;
320 
322  if( !event.getByLabel(muons_, muons) ) return;
323 
324  for(edm::View<reco::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
325  // restrict to globalMuons
326  if( muon->isGlobalMuon() ){
327  fill("muonDelZ_" , muon->globalTrack()->vz());
328  fill("muonDelXY_", muon->globalTrack()->vx(), muon->globalTrack()->vy());
329  // apply preselection
330  if(!muonSelect_ || (*muonSelect_)(*muon)){
331  double isolationTrk = muon->pt()/(muon->pt()+muon->isolationR03().sumPt);
332  double isolationCal = muon->pt()/(muon->pt()+muon->isolationR03().emEt+muon->isolationR03().hadEt);
333  double isolationRel = (muon->isolationR03().sumPt+muon->isolationR03().emEt+muon->isolationR03().hadEt)/muon->pt();
334  if( mMult==0 ){
335  // restrict to leading muon
336  fill("muonPt_" , muon->pt() );
337  fill("muonEta_" , muon->eta());
338  fill("muonRelIso_" , isolationRel );
339  fill("muonTrkIso_" , isolationTrk );
340  fill("muonCalIso_" , isolationCal );
341  }
342  ++mMult; if(!muonIso_ || (*muonIso_)(*muon)) ++mMultIso;
343  }
344  }
345  }
346  fill("muonMult_", mMult );
347  fill("muonMultIso_", mMultIso);
348 
349  /*
350  ------------------------------------------------------------
351 
352  Jet Monitoring
353 
354  ------------------------------------------------------------
355  */
356 
357  // check availability of the btaggers
358  edm::Handle<reco::JetTagCollection> btagEff, btagPur, btagVtx;
359  if( includeBTag_ ){
360  if( !event.getByLabel(btagEff_, btagEff) ) return;
361  if( !event.getByLabel(btagPur_, btagPur) ) return;
362  if( !event.getByLabel(btagVtx_, btagVtx) ) return;
363  }
364  // load jet corrector if configured such
365  const JetCorrector* corrector=0;
366  if(!jetCorrector_.empty()){
367  // check whether a jet correcto is in the event setup or not
368  if(setup.find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
369  corrector = JetCorrector::getJetCorrector(jetCorrector_, setup);
370  }
371  else{
372  edm::LogVerbatim( "TopSingleLeptonDQM" )
373  << "\n"
374  << "------------------------------------------------------------------------------------- \n"
375  << " No JetCorrectionsRecord available from EventSetup: \n"
376  << " - Jets will not be corrected. \n"
377  << " - If you want to change this add the following lines to your cfg file: \n"
378  << " \n"
379  << " ## load jet corrections \n"
380  << " process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
381  << " process.prefer(\"ak5CaloL2L3\") \n"
382  << " \n"
383  << "------------------------------------------------------------------------------------- \n";
384  }
385  }
386 
387  // loop jet collection
388  std::vector<reco::Jet> correctedJets;
389  unsigned int mult=0, multBEff=0, multBPur=0, multBVtx=0;
390 
392  if( !event.getByLabel(jets_, jets) ) return;
393 
395  if(jetIDSelect_){
396  if( !event.getByLabel(jetIDLabel_, jetID) ) return;
397  }
398 
399  for(edm::View<reco::Jet>::const_iterator jet=jets->begin(); jet!=jets->end(); ++jet){
400  // check jetID for calo jets
401  unsigned int idx = jet-jets->begin();
402  if( jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())){
403  if(!(*jetIDSelect_)((*jetID)[jets->refAt(idx)])) continue;
404  }
405  // chekc additional jet selection for calo, pf and bare reco jets
406  if(dynamic_cast<const reco::CaloJet*>(&*jet)){
407  reco::CaloJet sel = dynamic_cast<const reco::CaloJet&>(*jet); sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
408  StringCutObjectSelector<reco::CaloJet> jetSelect(jetSelect_); if(!jetSelect(sel)){ continue;}
409  }
410  else if(dynamic_cast<const reco::PFJet*>(&*jet)){
411  reco::PFJet sel= dynamic_cast<const reco::PFJet&>(*jet); sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
412  StringCutObjectSelector<reco::PFJet> jetSelect(jetSelect_); if(!jetSelect(sel)) continue;
413  }
414  else{
415  reco::Jet sel = *jet; sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
416  StringCutObjectSelector<reco::Jet> jetSelect(jetSelect_); if(!jetSelect(sel)) continue;
417  }
418  // check for overlaps -- comment this to be synchronous with the selection
419  //bool overlap=false;
420  //for(std::vector<const reco::GsfElectron*>::const_iterator elec=isoElecs.begin(); elec!=isoElecs.end(); ++elec){
421  // if(reco::deltaR((*elec)->eta(), (*elec)->phi(), jet->eta(), jet->phi())<0.4){overlap=true; break;}
422  //} if(overlap){continue;}
423 
424  // prepare jet to fill monitor histograms
425  reco::Jet monitorJet = *jet; monitorJet.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
426  correctedJets.push_back(monitorJet);
427  ++mult; // determine jet multiplicity
428  if( includeBTag_ ){
429  // fill b-discriminators
430  edm::RefToBase<reco::Jet> jetRef = jets->refAt(idx);
431  fill("jetBDiscEff_", (*btagEff)[jetRef]); if( (*btagEff)[jetRef]>btagEffWP_ ) ++multBEff;
432  fill("jetBDiscPur_", (*btagPur)[jetRef]); if( (*btagPur)[jetRef]>btagPurWP_ ) ++multBPur;
433  fill("jetBDiscVtx_", (*btagVtx)[jetRef]); if( (*btagVtx)[jetRef]>btagVtxWP_ ) ++multBVtx;
434  }
435  // fill pt (raw or L2L3) for the leading four jets
436  if(idx==0) {fill("jet1Pt_" , monitorJet.pt()); fill("jet1PtRaw_", jet->pt() );}
437  if(idx==1) {fill("jet2Pt_" , monitorJet.pt()); fill("jet2PtRaw_", jet->pt() );}
438  if(idx==2) {fill("jet3Pt_" , monitorJet.pt()); fill("jet3PtRaw_", jet->pt() );}
439  if(idx==3) {fill("jet4Pt_" , monitorJet.pt()); fill("jet4PtRaw_", jet->pt() );}
440  }
441  fill("jetMult_" , mult );
442  fill("jetMultBEff_", multBEff);
443  fill("jetMultBPur_", multBPur);
444  fill("jetMultBVtx_", multBVtx);
445 
446  /*
447  ------------------------------------------------------------
448 
449  MET Monitoring
450 
451  ------------------------------------------------------------
452  */
453 
454  // fill monitoring histograms for met
455  for(std::vector<edm::InputTag>::const_iterator met_=mets_.begin(); met_!=mets_.end(); ++met_){
457  if( !event.getByLabel(*met_, met) ) continue;
458  if(met->begin()!=met->end()){
459  unsigned int idx=met_-mets_.begin();
460  if(idx==0) fill("metCalo_" , met->begin()->et());
461  if(idx==1) fill("metTC_" , met->begin()->et());
462  if(idx==2) fill("metPflow_", met->begin()->et());
463  }
464  }
465 
466  /*
467  ------------------------------------------------------------
468 
469  Event Monitoring
470 
471  ------------------------------------------------------------
472  */
473 
474  // fill W boson and top mass estimates
475  Calculate eventKinematics(MAXJETS, WMASS);
476  double wMass = eventKinematics.massWBoson (correctedJets);
477  double topMass = eventKinematics.massTopQuark(correctedJets);
478  if(wMass>=0 && topMass>=0) {fill("massW_" , wMass ); fill("massTop_" , topMass);}
479  // fill plots for trigger monitoring
480  if((lowerEdge_==-1. && upperEdge_==-1.) || (lowerEdge_<wMass && wMass<upperEdge_) ){
481  if(!triggerTable_.label().empty()) fill(event, *triggerTable, "trigger", triggerPaths_);
482  if(logged_<=hists_.find("eventLogger_")->second->getNbinsY()){
483  // log runnumber, lumi block, event number & some
484  // more pysics infomation for interesting events
485  fill("eventLogger_", 0.5, logged_+0.5, event.eventAuxiliary().run());
486  fill("eventLogger_", 1.5, logged_+0.5, event.eventAuxiliary().luminosityBlock());
487  fill("eventLogger_", 2.5, logged_+0.5, event.eventAuxiliary().event());
488  if(correctedJets.size()>0) fill("eventLogger_", 3.5, logged_+0.5, correctedJets[0].pt());
489  if(correctedJets.size()>1) fill("eventLogger_", 4.5, logged_+0.5, correctedJets[1].pt());
490  if(correctedJets.size()>2) fill("eventLogger_", 5.5, logged_+0.5, correctedJets[2].pt());
491  if(correctedJets.size()>3) fill("eventLogger_", 6.5, logged_+0.5, correctedJets[3].pt());
492  fill("eventLogger_", 7.5, logged_+0.5, wMass );
493  fill("eventLogger_", 8.5, logged_+0.5, topMass);
494  ++logged_;
495  }
496  }
497  }
498 
499 }
500 
501 
502 TopSingleLeptonDQM::TopSingleLeptonDQM(const edm::ParameterSet& cfg): triggerTable_(""), beamspot_("")
503 {
504  // configure preselection
505  edm::ParameterSet presel=cfg.getParameter<edm::ParameterSet>("preselection");
506  if( presel.existsAs<edm::ParameterSet>("trigger") ){
507  edm::ParameterSet trigger=presel.getParameter<edm::ParameterSet>("trigger");
508  triggerTable_=trigger.getParameter<edm::InputTag>("src");
509  triggerPaths_=trigger.getParameter<std::vector<std::string> >("select");
510  }
511  if( presel.existsAs<edm::ParameterSet>("vertex" ) ){
512  edm::ParameterSet vertex=presel.getParameter<edm::ParameterSet>("vertex");
513  vertex_= vertex.getParameter<edm::InputTag>("src");
514  vertexSelect_= new StringCutObjectSelector<reco::Vertex>(vertex.getParameter<std::string>("select"));
515  }
516  if( presel.existsAs<edm::ParameterSet>("beamspot" ) ){
517  edm::ParameterSet beamspot=presel.getParameter<edm::ParameterSet>("beamspot");
518  beamspot_= beamspot.getParameter<edm::InputTag>("src");
519  beamspotSelect_= new StringCutObjectSelector<reco::BeamSpot>(beamspot.getParameter<std::string>("select"));
520  }
521 
522  // conifgure the selection
523  std::vector<edm::ParameterSet> sel=cfg.getParameter<std::vector<edm::ParameterSet> >("selection");
524  for(unsigned int i=0; i<sel.size(); ++i){
525  selectionOrder_.push_back(sel.at(i).getParameter<std::string>("label"));
526  selection_[selectionStep(selectionOrder_.back())] = std::make_pair(sel.at(i), new TopSingleLepton::MonitorEnsemble(selectionStep(selectionOrder_.back()).c_str(), cfg.getParameter<edm::ParameterSet>("setup")));
527  }
528 }
529 
530 void
532 {
533  if(!triggerTable_.label().empty()){
535  if( !event.getByLabel(triggerTable_, triggerTable) ) return;
536  if(!accept(event, *triggerTable, triggerPaths_)) return;
537  }
538  if(!beamspot_.label().empty()){
540  if( !event.getByLabel(beamspot_, beamspot) ) return;
541  if(!(*beamspotSelect_)(*beamspot)) return;
542  }
543  // apply selection steps
544  unsigned int passed=0;
545  for(std::vector<std::string>::const_iterator selIt=selectionOrder_.begin(); selIt!=selectionOrder_.end(); ++selIt){
546  std::string key = selectionStep(*selIt), type = objectType(*selIt);
547  if(selection_.find(key)!=selection_.end()){
548  if(type=="empty"){
549  selection_[key].second->fill(event, setup);
550  }
551  if(type=="muons"){
553  if(step.select(event)){ ++passed;
554  selection_[key].second->fill(event, setup);
555  } else break;
556  }
557  if(type=="elecs"){
559  if(step.select(event)){ ++passed;
560  selection_[key].second->fill(event, setup);
561  } else break;
562  }
563  if(type=="jets" ){
565  if(step.select(event, setup)){ ++passed;
566  selection_[key].second->fill(event, setup);
567  } else break;
568  }
569  if(type=="jets/pf" ){
571  if(step.select(event, setup)){ ++passed;
572  selection_[key].second->fill(event, setup);
573  } else break;
574  }
575  if(type=="jets/calo" ){
577  if(step.select(event, setup)){ ++passed;
578  selection_[key].second->fill(event, setup);
579  } else break;
580  }
581  if(type=="met" ){
583  if(step.select(event)){ ++passed;
584  selection_[key].second->fill(event, setup);
585  } else break;
586  }
587  }
588  }
589 }
590 
591 
std::map< std::string, MonitorElement * > hists_
histogram container
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
int logged_
number of logged interesting events
int i
Definition: DBlmapReader.cc:9
double btagEffWP_
btag working points
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:181
Jets made from CaloTowers.
Definition: CaloJet.h:30
bool select(const edm::Event &event)
apply selection
const std::string & label
Definition: MVAComputer.cc:186
edm::InputTag elecs_
input sources for monitoring
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
list step
Definition: launcher.py:15
edm::InputTag triggerTable_
trigger table
std::vector< edm::InputTag > mets_
considers a vector of METs
std::vector< std::string > triggerPaths_
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
Base class for all types of Jets.
Definition: Jet.h:21
double massTopQuark(const std::vector< reco::Jet > &jets)
calculate W boson mass estimate
RunNumber_t run() const
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
TopSingleLeptonDQM(const edm::ParameterSet &cfg)
default constructor
virtual void scaleEnergy(double fScale)
scale energy of the jet
Definition: Jet.cc:386
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:21
Jets made from PFObjects.
Definition: PFJet.h:22
std::vector< std::string > triggerPaths_
trigger paths
double massWBoson(const std::vector< reco::Jet > &jets)
calculate W boson mass estimate
Definition: TopDQMHelpers.cc:9
std::vector< std::string > selectionOrder_
std::string selectionStep(const std::string &label)
LuminosityBlockNumber_t luminosityBlock() const
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:90
Level verbosity_
verbosity level for booking
edm::InputTag vertex_
primary vertex
static const double WMASS
double lowerEdge_
mass window upper and lower edge
edm::InputTag btagEff_
btag discriminator labels
Helper class for the calculation of a top and a W boson mass estime.
Definition: TopDQMHelpers.h:64
std::map< std::string, std::pair< edm::ParameterSet, TopSingleLepton::MonitorEnsemble * > > selection_
edm::InputTag beamspot_
beamspot
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
void book(std::string directory)
book histograms in subdirectory directory
edm::InputTag triggerTable_
trigger table
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool first
Definition: L1TdeRCT.cc:79
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
EventAuxiliary const & eventAuxiliary() const
Definition: Event.h:55
edm::InputTag jetIDLabel_
jetID as an extra selection type
std::string label_
instance label
virtual double pt() const
transverse momentum
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:40
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
Templated helper class to allow a selection on a certain object collection.
std::string const & label() const
Definition: InputTag.h:25
std::string objectType(const std::string &label)
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
list key
Definition: combine.py:13
tuple muons
Definition: patZpeak.py:38
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
edm::InputTag electronId_
electronId label
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
std::string jetCorrector_
jetCorrector
static const unsigned int MAXJETS
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:642
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg)
default contructor
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
EventNumber_t event() const
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
DQMStore * store_
storage manager