CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HLTOfflineDQMTopDiLepton::MonitorDiLepton Class Reference

#include <TopDiLeptonHLTOfflineDQM.h>

Public Types

enum  DecayChannel { NONE, DIMUON, DIELEC, ELECMU }
 different decay channels More...
 
typedef reco::LeafCandidate::LorentzVector LorentzVector
 

Public Member Functions

void book (DQMStore::IBooker &store_)
 book histograms in subdirectory directory More...
 
void fill (const edm::Event &event, const edm::EventSetup &setup, const HLTConfigProvider &hltConfig, const std::vector< std::string > triggerPaths)
 fill monitor histograms with electronId and jetCorrections More...
 
 MonitorDiLepton (const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 default contructor More...
 
 ~MonitorDiLepton ()
 default destructor More...
 

Private Member Functions

bool booked (const std::string histName) const
 check if histogram was booked More...
 
void fill (const edm::Event &event, const edm::TriggerResults &triggerTable, std::string channel, const std::vector< std::string > &labels) const
 fill trigger monitoring histograms More...
 
void fill (const std::string histName, double value) const
 fill histogram if it had been booked before More...
 
void fill (const std::string histName, double xValue, double yValue) const
 fill histogram if it had been booked before (2-dim version) More...
 
void fill (const std::string histName, double xValue, double yValue, double zValue) const
 fill histogram if it had been booked before (2-dim version) More...
 
void loggerBinLabels (std::string hist)
 set labels for event logging histograms More...
 
std::string monitorPath (const std::string &label) const
 
std::string selectionPath (const std::string &label) const
 
void triggerBinLabels (std::string channel, const std::vector< std::string > &labels)
 set configurable labels for trigger monitoring histograms More...
 

Private Attributes

int diElecLogged_
 
std::vector< std::string > diElecPaths_
 trigger paths for di electron channel More...
 
int diMuonLogged_
 
std::vector< std::string > diMuonPaths_
 trigger paths for di muon channel More...
 
int eidPattern_
 
StringCutObjectSelector< reco::GsfElectron > * elecIso_
 extra isolation criterion on electron More...
 
int elecMuLogged_
 number of logged interesting events More...
 
std::vector< std::string > elecMuPaths_
 
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
 input sources for monitoring More...
 
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
 extra selection on electrons More...
 
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
 electronId label More...
 
trigger::Vids electronIds_
 
trigger::VRelectron electronRefs_
 
std::string folder_
 
bool hasRawTriggerSummary
 
std::map< std::string, MonitorElement * > hists_
 histogram container More...
 
std::string jetCorrector_
 jetCorrector More...
 
edm::EDGetTokenT< reco::JetIDValueMapjetIDLabel_
 jetID as an extra selection type More...
 
StringCutObjectSelector< reco::JetID > * jetIDSelect_
 extra jetID selection on calo jets More...
 
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
 
std::string jetSelect_
 
std::string label_
 instance label More...
 
double lowerEdge_
 mass window upper and lower edge More...
 
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
 considers a vector of METs More...
 
trigger::Vids muonIds_
 
StringCutObjectSelector< reco::Muon > * muonIso_
 extra isolation criterion on muon More...
 
trigger::VRmuon muonRefs_
 
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
 
StringCutObjectSelector< reco::Muon > * muonSelect_
 extra selection on muons More...
 
std::string processName_
 hlt objects More...
 
edm::EDGetTokenT< trigger::TriggerEventWithRefstriggerSummaryTokenAOD
 
edm::EDGetTokenT< trigger::TriggerEventWithRefstriggerSummaryTokenRAW
 
edm::EDGetTokenT< edm::TriggerResultstriggerTable_
 trigger table More...
 
double upperEdge_
 

Detailed Description

Definition at line 46 of file TopDiLeptonHLTOfflineDQM.h.

Member Typedef Documentation

make clear which LorentzVector to use for jet, electrons and muon buffering

Definition at line 50 of file TopDiLeptonHLTOfflineDQM.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

MonitorDiLepton::MonitorDiLepton ( const char *  label,
const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)

default contructor

Definition at line 28 of file TopDiLeptonHLTOfflineDQM.cc.

References diElecPaths_, diMuonPaths_, eidPattern_, elecIso_, elecMuPaths_, elecs_, elecSelect_, electronId_, edm::ParameterSet::existsAs(), folder_, edm::ParameterSet::getParameter(), jetCorrector_, jetIDLabel_, jetIDSelect_, jets_, jetSelect_, lowerEdge_, RazorAnalyzer::met, TtSemiLepSignalSelMVAComputer_cfi::mets, mets_, muonIso_, muons_, muonSelect_, LaserDQM_cfg::process, processName_, AlCaHLTBitMon_QueryRunRegistry::string, triggerSummaryTokenAOD, triggerSummaryTokenRAW, triggerTable_, and upperEdge_.

28  :
31  {
32  // sources have to be given; this PSet is not optional
33  edm::ParameterSet sources=cfg.getParameter<edm::ParameterSet>("sources");
35  elecs_= iC.consumes< edm::View<reco::GsfElectron> >(sources.getParameter<edm::InputTag>("elecs"));
36  jets_ = iC.consumes< edm::View<reco::Jet> >(sources.getParameter<edm::InputTag>("jets" ));
37 
38  const auto& mets = sources.getParameter<std::vector<edm::InputTag>>("mets");
39  for (const auto& met: mets) {
40  mets_.push_back(iC.consumes<edm::View<reco::MET>>(met));
41  }
42 
43  // elecExtras are optional; they may be omitted or empty
44  if( cfg.existsAs<edm::ParameterSet>("elecExtras") ){
45  edm::ParameterSet elecExtras=cfg.getParameter<edm::ParameterSet>("elecExtras");
46  // select is optional; in case it's not found no
47  // selection will be applied
48  if( elecExtras.existsAs<std::string>("select") ){
50  }
51  // isolation is optional; in case it's not found no
52  // isolation will be applied
53  if( elecExtras.existsAs<std::string>("isolation") ){
55  }
56  // electronId is optional; in case it's not found the
57  // InputTag will remain empty
58  if( elecExtras.existsAs<edm::ParameterSet>("electronId") ){
59  edm::ParameterSet elecId=elecExtras.getParameter<edm::ParameterSet>("electronId");
61  eidPattern_= elecId.getParameter<int>("pattern");
62  }
63  }
64  // muonExtras are optional; they may be omitted or empty
65  if( cfg.existsAs<edm::ParameterSet>("muonExtras") ){
66  edm::ParameterSet muonExtras=cfg.getParameter<edm::ParameterSet>("muonExtras");
67  // select is optional; in case it's not found no
68  // selection will be applied
69  if( muonExtras.existsAs<std::string>("select") ){
71  }
72  // isolation is optional; in case it's not found no
73  // isolation will be applied
74  if( muonExtras.existsAs<std::string>("isolation") ){
76  }
77  }
78  // jetExtras are optional; they may be omitted or empty
79  if( cfg.existsAs<edm::ParameterSet>("jetExtras") ){
80  edm::ParameterSet jetExtras=cfg.getParameter<edm::ParameterSet>("jetExtras");
81  // jetCorrector is optional; in case it's not found
82  // the InputTag will remain empty
83  if( jetExtras.existsAs<std::string>("jetCorrector") ){
84  jetCorrector_= jetExtras.getParameter<std::string>("jetCorrector");
85  }
86  // read jetID information if it exists
87  if(jetExtras.existsAs<edm::ParameterSet>("jetID")){
88  edm::ParameterSet jetID=jetExtras.getParameter<edm::ParameterSet>("jetID");
90  jetIDSelect_= new StringCutObjectSelector<reco::JetID>(jetID.getParameter<std::string>("select"));
91  }
92  // select is optional; in case it's not found no
93  // selection will be applied (only implemented for
94  // CaloJets at the moment)
95  if( jetExtras.existsAs<std::string>("select") ){
96  jetSelect_= jetExtras.getParameter<std::string>("select");
97  }
98  }
99  // triggerExtras are optional; they may be omitted or empty
100  processName_ = "HLT";
101  if( cfg.existsAs<edm::ParameterSet>("triggerExtras") ){
102  edm::ParameterSet triggerExtras=cfg.getParameter<edm::ParameterSet>("triggerExtras");
104  processName_ = triggerExtras.getParameter<edm::InputTag>("src").process();
105  elecMuPaths_ = triggerExtras.getParameter<std::vector<std::string> >("pathsELECMU");
106  diMuonPaths_ = triggerExtras.getParameter<std::vector<std::string> >("pathsDIMUON");
107  diElecPaths_ = triggerExtras.getParameter<std::vector<std::string> >("pathsDIELEC");
108  }
109  // massExtras is optional; in case it's not found no mass
110  // window cuts are applied for the same flavor monitor
111  // histograms
112  if( cfg.existsAs<edm::ParameterSet>("massExtras") ){
113  edm::ParameterSet massExtras=cfg.getParameter<edm::ParameterSet>("massExtras");
114  lowerEdge_= massExtras.getParameter<double>("lowerEdge");
115  upperEdge_= massExtras.getParameter<double>("upperEdge");
116  }
117 
118  // and don't forget to do the histogram booking
119  folder_=cfg.getParameter<std::string>("directory");
120 
121 // triggerEventWithRefsTag_ = iC.consumes< trigger::TriggerEventWithRefs >(edm::InputTag("hltTriggerSummaryRAW","",processName_));
122  triggerSummaryTokenRAW = iC.consumes <trigger::TriggerEventWithRefs>(edm::InputTag("hltTriggerSummaryRAW","",processName_));
123  triggerSummaryTokenAOD = iC.consumes <trigger::TriggerEventWithRefs> (edm::InputTag("hltTriggerSummaryAOD","",processName_));
124 
125  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
double lowerEdge_
mass window upper and lower edge
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
int elecMuLogged_
number of logged interesting events
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
std::vector< std::string > diElecPaths_
trigger paths for di electron channel
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
met
===> hadronic RAZOR
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
HLTOfflineDQMTopDiLepton::MonitorDiLepton::~MonitorDiLepton ( )
inline

default destructor

Definition at line 58 of file TopDiLeptonHLTOfflineDQM.h.

References book(), fill(), GeneralSetup::setup(), and triggerPaths.

58 {};

Member Function Documentation

void MonitorDiLepton::book ( DQMStore::IBooker store_)

book histograms in subdirectory directory

Definition at line 128 of file TopDiLeptonHLTOfflineDQM.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), diElecPaths_, diMuonPaths_, elecMuPaths_, folder_, hists_, label_, loggerBinLabels(), DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and triggerBinLabels().

Referenced by ~MonitorDiLepton().

129  {
130  //set up the current directory path
131  std::string current(folder_); current+=label_;
132  store_.setCurrentFolder(current);
133 
134  // determine number of bins for trigger monitoring
135  unsigned int nElecMu=elecMuPaths_.size();
136  unsigned int nDiMuon=diMuonPaths_.size();
137  unsigned int nDiElec=diElecPaths_.size();
138 
139  // invariant mass of opposite charge lepton pair (only filled for same flavor)
140  hists_["invMass_" ] = store_.book1D("InvMass" , "M(lep1, lep2)" , 80, 0., 320.);
141  // invariant mass of same charge lepton pair (only filled for same flavor)
142  hists_["invMassWC_" ] = store_.book1D("InvMassWC" , "M_{WC}(L1, L2)" , 80, 0., 320.);
143  // decay channel [1]: muon/muon, [2]:elec/elec, [3]:elec/muon
144  hists_["decayChannel_"] = store_.book1D("DecayChannel", "Decay Channel" , 3, 0, 3);
145  // // trigger efficiency estimates for the electron muon channel
146  // hists_["elecMuEff_" ] = store_.book1D("ElecMuEff" , "Eff(e/#mu paths)" , nElecMu, 0., nElecMu);
147  // monitored trigger occupancy for the electron muon channel
148  hists_["elecMuMon_" ] = store_.book1D("ElecMuMon" , "Mon(e/#mu paths)" , nElecMu, 0., nElecMu);
149  // // trigger efficiency estimates for the di muon channel
150  // hists_["diMuonEff_" ] = store_.book1D("DiMuonEff" , "Eff(#mu/#mu paths)" , nDiMuon, 0., nDiMuon);
151  // monitored trigger occupancy for the di muon channel
152  hists_["diMuonMon_" ] = store_.book1D("DiMuonMon" , "Mon(#mu/#mu paths)" , nDiMuon, 0., nDiMuon);
153  // // trigger efficiency estimates for the di electron channel
154  // hists_["diElecEff_" ] = store_.book1D("DiElecEff" , "Eff(e/e paths)" , nDiElec, 0., nDiElec);
155  // monitored trigger occupancy for the di electron channel
156  hists_["diElecMon_" ] = store_.book1D("DiElecMon" , "Mon(e/e paths)" , nDiElec, 0., nDiElec);
157  // multiplicity of jets with pt>30 (corrected to L2+L3)
158  hists_["jetMult_" ] = store_.book1D("JetMult" , "N_{30}(jet)" , 20, 0., 20.);
159 
160  // set bin labels for trigger monitoring
164  // set bin labels for decayChannel_
165  hists_["decayChannel_"]->setBinLabel( 1, "#mu e" , 1);
166  hists_["decayChannel_"]->setBinLabel( 2, "#mu #mu", 1);
167  hists_["decayChannel_"]->setBinLabel( 3, "e e" , 1);
168 
169  // selected dimuon events
170  hists_["diMuonLogger_"] = store_.book2D("DiMuonLogger", "Logged DiMuon Events" , 8, 0., 8., 10, 0., 10.); //OK
171  // selected dielec events
172  hists_["diElecLogger_"] = store_.book2D("DiElecLogger", "Logged DiElec Events" , 8, 0., 8., 10, 0., 10.); //OK
173  // selected elemu events
174  hists_["elecMuLogger_"] = store_.book2D("ElecMuLogger", "Logged ElecMu Events" , 8, 0., 8., 10, 0., 10.); //OK
175 
176  // set bin labels for trigger monitoring
177  loggerBinLabels(std::string("diMuonLogger_"));
178  loggerBinLabels(std::string("diElecLogger_"));
179  loggerBinLabels(std::string("elecMuLogger_"));
180 
181  // deltaR min between hlt iso lepton and reco iso lepton wrt eta
182  hists_["leptDeltaREta_"] = store_.book2D("DeltaRMinEtaLepton", "#Delta R_{min}(leptons) wrt #eta", 30, -3, 3, 10, 0., 0.1);
183  // resolution in pT for matched isolated leptons
184  hists_["leptResolution_"] = store_.book1D("ResIsoLeptons", "#Delta p_{T}/p_{T}(matched leptons)", 20, 0., 0.1);
185  // matching monitoring
186  hists_["matchingMon_"] = store_.book1D("MatchingMon", "Mon(matching)", 3, 0., 3.);
187  // set axes titles for matching monitoring
188  hists_["matchingMon_"]->setBinLabel( 1 , "1st lepton" );
189  hists_["matchingMon_"]->setBinLabel( 2 , "2nd lepton" );
190  hists_["matchingMon_"]->setBinLabel( 3 , "both " );
191 
192  return;
193  }
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
void loggerBinLabels(std::string hist)
set labels for event logging histograms
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::vector< std::string > diElecPaths_
trigger paths for di electron channel
std::map< std::string, MonitorElement * > hists_
histogram container
void triggerBinLabels(std::string channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
bool HLTOfflineDQMTopDiLepton::MonitorDiLepton::booked ( const std::string  histName) const
inlineprivate

check if histogram was booked

Definition at line 81 of file TopDiLeptonHLTOfflineDQM.h.

References hists_.

Referenced by fill().

81 { return hists_.find(histName.c_str())!=hists_.end(); };
std::map< std::string, MonitorElement * > hists_
histogram container
void MonitorDiLepton::fill ( const edm::Event event,
const edm::EventSetup setup,
const HLTConfigProvider hltConfig,
const std::vector< std::string >  triggerPaths 
)

fill monitor histograms with electronId and jetCorrections

Definition at line 196 of file TopDiLeptonHLTOfflineDQM.cc.

References slimmedMETs_cfi::caloMET, ALCARECOTkAlJpsiMuMu_cff::charge, JetCorrector::correction(), mitigatedMETSequence_cff::corrector, deltaR(), reco::deltaR(), diElecLogged_, diElecPaths_, diMuonLogged_, diMuonPaths_, MillePedeFileConverter_cfg::e, eidPattern_, elecIso_, elecMuLogged_, elecMuPaths_, PatTopSelectionAnalyzer_cfi::elecs, elecs_, elecSelect_, electronId_, electronIds_, electronRefs_, reco::LeafCandidate::et(), stringResolutionProvider_cfi::eta, edm::Event::eventAuxiliary(), trigger::TriggerEventWithRefs::filterIndex(), edm::EventSetup::find(), edm::Event::getByToken(), JetCorrector::getJetCorrector(), trigger::TriggerEventWithRefs::getObjects(), hasRawTriggerSummary, hists_, mps_fire::i, training_settings::idx, edm::HLTGlobalStatus::index(), createfilelist::int, edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), metsig::jet, jetCorrector_, jetIDLabel_, jetIDSelect_, fwrapper::jets, jets_, jetSelect_, gen::k, WDecay::kElec, WDecay::kMuon, checklumidiff::l, lowerEdge_, ResonanceBuilder::mass, RazorAnalyzer::met, mets_, HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), metsig::muon, muonIds_, muonIso_, muonRefs_, electronCleaner_cfi::muons, muons_, muonSelect_, dataset::name, muon::overlap(), processName_, EnergyCorrector::pt, edm::EventAuxiliary::run(), reco::Jet::scaleEnergy(), findQualityFiles::size, edm::TriggerNames::triggerIndex(), edm::TriggerNames::triggerNames(), triggerSummaryTokenAOD, triggerSummaryTokenRAW, triggerTable_, and upperEdge_.

Referenced by fill(), selectionPath(), and ~MonitorDiLepton().

197  {
198  // fetch trigger event if configured such
201  if( !event.getByToken(triggerTable_, triggerTable) ) return;
202  }
203  /*
204  ------------------------------------------------------------
205 
206  Run information
207 
208  ------------------------------------------------------------
209  */
210 
211  if (!event.eventAuxiliary().run()) return;
212 
213  /*
214  ------------------------------------------------------------
215 
216  Muon Selection
217 
218  ------------------------------------------------------------
219  */
220 
221  // buffer isolated muons
222  std::vector<const reco::Muon*> isoMuons;
223 
225  if( !event.getByToken(muons_, muons) ) {
226  edm::LogWarning( "TopSingleLeptonHLTOfflineDQM" )
227  << "Muon collection not found \n";
228  return;
229  }
230 
231  for(edm::View<reco::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
232  // restrict to globalMuons
233  if( muon->isGlobalMuon() ){
234  // apply preselection
235  if(!muonSelect_ || (*muonSelect_)(*muon)){
236  if(!muonIso_ || (*muonIso_)(*muon)) isoMuons.push_back(&(*muon));
237  }
238  }
239  }
240 
241  /*
242  ------------------------------------------------------------
243 
244  Electron Selection
245 
246  ------------------------------------------------------------
247  */
248 
249  // buffer isolated electronss
250  std::vector<const reco::GsfElectron*> isoElecs;
251  edm::Handle<edm::ValueMap<float> > electronId;
253  if( !event.getByToken(electronId_, electronId) ) return;
254  }
255 
257  if( !event.getByToken(elecs_, elecs) ) {
258  edm::LogWarning( "TopSingleLeptonHLTOfflineDQM" )
259  << "Electron collection not found \n";
260  return;
261  }
262 
263  for(edm::View<reco::GsfElectron>::const_iterator elec=elecs->begin(); elec!=elecs->end(); ++elec){
264  // restrict to electrons with good electronId
265  int idx = elec-elecs->begin();
266  if( electronId_.isUninitialized() ? true : ((int)(*electronId)[elecs->refAt(idx)] & eidPattern_) ){
267  // apply preselection
268  if(!elecSelect_ || (*elecSelect_)(*elec)){
269  if(!elecIso_ || (*elecIso_)(*elec)) isoElecs.push_back(&(*elec));
270  }
271  }
272  }
273 
274  /*
275  ------------------------------------------------------------
276 
277  Jet Selection
278 
279  ------------------------------------------------------------
280  */
281 
282  const JetCorrector* corrector=0;
283  if(!jetCorrector_.empty()){
284  // check whether a jet correcto is in the event setup or not
285  if(setup.find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
286  corrector = JetCorrector::getJetCorrector(jetCorrector_, setup);
287  }
288  else{
289  edm::LogVerbatim( "TopDiLeptonHLTOfflineDQM" )
290  << "\n"
291  << "------------------------------------------------------------------------------------- \n"
292  << " No JetCorrectionsRecord available from EventSetup: \n"
293  << " - Jets will not be corrected. \n"
294  << " - If you want to change this add the following lines to your cfg file: \n"
295  << " \n"
296  << " ## load jet corrections \n"
297  << " process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
298  << " process.prefer(\"ak5CaloL2L3\") \n"
299  << " \n"
300  << "------------------------------------------------------------------------------------- \n";
301  }
302  }
303 
304  unsigned int mult=0;
305  // buffer leadingJets
306  std::vector<reco::Jet> leadingJets;
308  if( !event.getByToken(jets_, jets) ) {
309  edm::LogWarning( "TopSingleLeptonHLTOfflineDQM" )
310  << "Jet collection not found \n";
311  return;
312  }
313 
315  if(jetIDSelect_){
316  if( !event.getByToken(jetIDLabel_, jetID) ) return;
317  }
318 
319  for(edm::View<reco::Jet>::const_iterator jet=jets->begin(); jet!=jets->end(); ++jet){
320  unsigned int idx=jet-jets->begin();
321  if( jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())){
322  if(!(*jetIDSelect_)((*jetID)[jets->refAt(idx)])) continue;
323  }
324  // chekc additional jet selection for calo, pf and bare reco jets
325  if(dynamic_cast<const reco::CaloJet*>(&*jet)){
326  reco::CaloJet sel = dynamic_cast<const reco::CaloJet&>(*jet); sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
327  StringCutObjectSelector<reco::CaloJet> jetSelect(jetSelect_); if(!jetSelect(sel)){ continue;}
328  }
329  else if(dynamic_cast<const reco::PFJet*>(&*jet)){
330  reco::PFJet sel= dynamic_cast<const reco::PFJet&>(*jet); sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
331  StringCutObjectSelector<reco::PFJet> jetSelect(jetSelect_); if(!jetSelect(sel)) continue;
332  }
333  else{
334  reco::Jet sel = *jet; sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
335  StringCutObjectSelector<reco::Jet> jetSelect(jetSelect_); if(!jetSelect(sel)) continue;
336  }
337  // check for overlaps
338  bool overlap=false;
339  for(std::vector<const reco::GsfElectron*>::const_iterator elec=isoElecs.begin(); elec!=isoElecs.end(); ++elec){
340  if(reco::deltaR((*elec)->eta(), (*elec)->phi(), jet->eta(), jet->phi())<0.4){overlap=true; break;}
341  } if(overlap){continue;}
342  // prepare jet to fill monitor histograms
343  reco::Jet monitorJet=*jet; monitorJet.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
344  ++mult; // determine jet multiplicity
345  if(idx==0) {
346  leadingJets.push_back(monitorJet);
347  }
348  if(idx==1) {
349  leadingJets.push_back(monitorJet);
350  }
351  }
352  fill("jetMult_", mult);
353  /*
354  ------------------------------------------------------------
355 
356  MET Selection
357 
358  ------------------------------------------------------------
359  */
360 
361  // buffer for event logging
363  for(std::vector< edm::EDGetTokenT< edm::View<reco::MET> > >::const_iterator met_=mets_.begin(); met_!=mets_.end(); ++met_){
364 
366  if( !event.getByToken(*met_, met) ) continue;
367 
368  if(met->begin()!=met->end()){
369  unsigned int idx=met_-mets_.begin();
370  if(idx==0){
371  caloMET=*met->begin();
372  }
373  }
374  }
375 
376  /*
377  ------------------------------------------------------------
378 
379  Event Monitoring
380 
381  ------------------------------------------------------------
382  */
383  const edm::TriggerNames& triggerNames = event.triggerNames(*triggerTable);
384  // loop over trigger paths
385  for(unsigned int i=0; i<triggerNames.triggerNames().size(); ++i){
386  bool elecmu = false;
387  bool dielec = false;
388  bool dimuon = false;
389  // consider only path from triggerPaths
390  string name = triggerNames.triggerNames()[i];
391  for (unsigned int j=0; j<triggerPaths.size(); j++) {
392  if (TString(name.c_str()).Contains(TString(triggerPaths[j]), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString("ele"), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString("mu"), TString::kIgnoreCase)) elecmu = true;
393  else {
394  if (TString(name.c_str()).Contains(TString(triggerPaths[j]), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString("ele"), TString::kIgnoreCase)) dielec = true;
395  if (TString(name.c_str()).Contains(TString(triggerPaths[j]), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString("mu"), TString::kIgnoreCase)) dimuon = true;
396  }
397  }
398 
399  // ELECMU channel
400  if( elecmu ){
401  fill("decayChannel_", 0.5);
402  if( isoElecs.size()>0 && isoMuons.size()>0 ) {
403  double mass = (isoElecs[0]->p4()+isoMuons[0]->p4()).mass();
404  if( (lowerEdge_==-1. && upperEdge_==-1.) || (lowerEdge_<mass && mass<upperEdge_) ){
405  // fill plots for trigger monitoring
406  if(!triggerTable_.isUninitialized()) fill(event, *triggerTable, "elecMu", elecMuPaths_);
407  if(elecMuLogged_<=hists_.find("elecMuLogger_")->second->getNbinsY()){
408  // log runnumber, lumi block, event number & some
409  // more pysics infomation for interesting events
410  // We're doing a static_cast here to denote the explicity of the cast
411  double runID = static_cast<double>(event.eventAuxiliary().run());
412  double luminosityBlockID = static_cast<double>(event.eventAuxiliary().luminosityBlock());
413  double eventID = static_cast<double>(event.eventAuxiliary().event());
414  fill("elecMuLogger_", 0.5, elecMuLogged_+0.5, runID);
415  fill("elecMuLogger_", 1.5, elecMuLogged_+0.5, luminosityBlockID);
416  fill("elecMuLogger_", 2.5, elecMuLogged_+0.5, eventID);
417  fill("elecMuLogger_", 3.5, elecMuLogged_+0.5, isoMuons[0]->pt());
418  fill("elecMuLogger_", 4.5, elecMuLogged_+0.5, isoElecs[0]->pt());
419  if(leadingJets.size()>0) fill("elecMuLogger_", 5.5, elecMuLogged_+0.5, leadingJets[0].pt());
420  if(leadingJets.size()>1) fill("elecMuLogger_", 6.5, elecMuLogged_+0.5, leadingJets[1].pt());
421  fill("elecMuLogger_", 7.5, elecMuLogged_+0.5, caloMET.et());
422  ++elecMuLogged_;
423  }
424  }
425  }
426  }
427 
428  // DIMUON channel
429  if( dimuon ){
430  fill("decayChannel_", 1.5);
431  if (isoMuons.size()>1) {
432  int charge = isoMuons[0]->charge()*isoMuons[1]->charge();
433  double mass = (isoMuons[0]->p4()+isoMuons[1]->p4()).mass();
434  fill(charge<0 ? "invMass_" : "invMassWC_" , mass );
435  if((lowerEdge_==-1. && upperEdge_==-1.) || (lowerEdge_<mass && mass<upperEdge_) ){
436  // fill plots for trigger monitoring
437  if(!triggerTable_.isUninitialized()) fill(event, *triggerTable, "diMuon", diMuonPaths_);
438  if(diMuonLogged_<=hists_.find("diMuonLogger_")->second->getNbinsY()){
439  // log runnumber, lumi block, event number & some
440  // more pysics infomation for interesting events
441  // We're doing a static_cast here to denote the explicity of the cast
442  double runID = static_cast<double>(event.eventAuxiliary().run());
443  double luminosityBlockID = static_cast<double>(event.eventAuxiliary().luminosityBlock());
444  double eventID = static_cast<double>(event.eventAuxiliary().event());
445  fill("diMuonLogger_", 0.5, diMuonLogged_+0.5, runID);
446  fill("diMuonLogger_", 1.5, diMuonLogged_+0.5, luminosityBlockID);
447  fill("diMuonLogger_", 2.5, diMuonLogged_+0.5, eventID);
448  fill("diMuonLogger_", 3.5, diMuonLogged_+0.5, isoMuons[0]->pt());
449  fill("diMuonLogger_", 4.5, diMuonLogged_+0.5, isoMuons[1]->pt());
450  if(leadingJets.size()>0) fill("diMuonLogger_", 5.5, diMuonLogged_+0.5, leadingJets[0].pt());
451  if(leadingJets.size()>1) fill("diMuonLogger_", 6.5, diMuonLogged_+0.5, leadingJets[1].pt());
452  fill("diMuonLogger_", 7.5, diMuonLogged_+0.5, caloMET.et());
453  ++diMuonLogged_;
454  }
455  }
456  }
457  }
458 
459  // DIELEC channel
460  if( dielec ){
461  fill("decayChannel_", 2.5);
462  if( dielec && isoElecs.size()>1 ){
463  int charge = isoElecs[0]->charge()*isoElecs[1]->charge();
464  double mass = (isoElecs[0]->p4()+isoElecs[1]->p4()).mass();
465  fill(charge<0 ? "invMass_" : "invMassWC_" , mass );
466  if((lowerEdge_==-1. && upperEdge_==-1.) || (lowerEdge_<mass && mass<upperEdge_) ){
467  // fill plots for trigger monitoring
468  if(!triggerTable_.isUninitialized()) fill(event, *triggerTable, "diElec", diElecPaths_);
469  if(diElecLogged_<=hists_.find("diElecLogger_")->second->getNbinsY()){
470  // log runnumber, lumi block, event number & some
471  // more pysics infomation for interesting events
472  // We're doing a static_cast here to denote the explicity of the cast
473  double runID = static_cast<double>(event.eventAuxiliary().run());
474  double luminosityBlockID = static_cast<double>(event.eventAuxiliary().luminosityBlock());
475  double eventID = static_cast<double>(event.eventAuxiliary().event());
476  fill("diElecLogger_", 0.5, diElecLogged_+0.5, runID);
477  fill("diElecLogger_", 1.5, diElecLogged_+0.5, luminosityBlockID);
478  fill("diElecLogger_", 2.5, diElecLogged_+0.5, eventID);
479  fill("diElecLogger_", 3.5, diElecLogged_+0.5, isoElecs[0]->pt());
480  fill("diElecLogger_", 4.5, diElecLogged_+0.5, isoElecs[1]->pt());
481  if(leadingJets.size()>0) fill("diElecLogger_", 5.5, diElecLogged_+0.5, leadingJets[0].pt());
482  if(leadingJets.size()>1) fill("diElecLogger_", 6.5, diElecLogged_+0.5, leadingJets[1].pt());
483  fill("diElecLogger_", 7.5, diElecLogged_+0.5, caloMET.et());
484  ++diElecLogged_;
485  }
486  }
487  }
488  }
489  }
490 
491  /*
492  ------------------------------------------------------------
493 
494  HLT Objects Monitoring
495 
496  ------------------------------------------------------------
497  */
498 
499 // if(event.getByToken(triggerEventWithRefsTag_,triggerEventWithRefsHandle)) {
500 
501 
503  event.getByToken(triggerSummaryTokenRAW,rawTriggerEvent);
504 
506  event.getByToken(triggerSummaryTokenAOD,aodTriggerEvent);
507 
509  if(!rawTriggerEvent.isValid()){
510  hasRawTriggerSummary=false;
511 // edm::LogWarning( "TopDiLeptonHLTOfflineDQM" )
512 // << "No RAW trigger summary found! Returning... \n";
513 
514  if(!aodTriggerEvent.isValid()){
515 // edm::LogWarning( "TopDiLeptonHLTOfflineDQM" )
516 // << "No AOD trigger summary found! Returning... \n";
517 
518  return;
519  }
520  }
521 
522 
523 
524  // loop over trigger paths
525  for(unsigned int i=0; i<triggerNames.triggerNames().size(); ++i){
526  // consider only path from triggerPaths
527  string name = triggerNames.triggerNames()[i].c_str();
528  bool isInteresting = false;
529  for (unsigned int j=0; j<triggerPaths.size(); j++) {
530  if (TString(name.c_str()).Contains(TString(triggerPaths[j]), TString::kIgnoreCase)) isInteresting = true;
531  }
532  if (!isInteresting) continue;
533  // dump infos on the considered trigger path
534  const unsigned int triggerIndex = triggerNames.triggerIndex(name);
535  // get modules for the considered trigger path
536  const vector<string>& moduleLabels(hltConfig.moduleLabels(triggerIndex));
537  const unsigned int moduleIndex(triggerTable->index(triggerIndex));
538  // Results from TriggerEvent product
539  electronIds_.clear(); electronRefs_.clear();
540  muonIds_.clear(); muonRefs_.clear();
541  // look only for modules actually run in this path
542  unsigned int kElec=0;
543  unsigned int kMuon=0;
544  for (unsigned int k=0; k<=moduleIndex; ++k) {
545  const string& moduleLabel(moduleLabels[k]);
546  const string moduleType(hltConfig.moduleType(moduleLabel));
547  // check whether the module is packed up in TriggerEventWithRef product
548 
549 // const unsigned int filterIndex(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabel,"",processName_)));
550 // if (filterIndex<triggerEventWithRefsHandle->size()) {
551 
553  const unsigned int filterIndex(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabel,"",processName_)));
554  if (filterIndex<rawTriggerEvent->size()) {
555  rawTriggerEvent->getObjects(filterIndex,electronIds_,electronRefs_);
556  const unsigned int nElectrons(electronIds_.size());
557  if (nElectrons>0) kElec = k;
558 
559  rawTriggerEvent->getObjects(filterIndex,muonIds_,muonRefs_);
560  const unsigned int nMuons(muonIds_.size());
561  if (nMuons>0) kMuon = k;
562  }
563  }
564 
565  else{
566  const unsigned int filterIndex(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabel,"",processName_)));
567  if (filterIndex<aodTriggerEvent->size()) {
568 
569  aodTriggerEvent->getObjects(filterIndex,electronIds_,electronRefs_);
570  const unsigned int nElectrons(electronIds_.size());
571  if (nElectrons>0) kElec = k;
572 
573  aodTriggerEvent->getObjects(filterIndex,muonIds_,muonRefs_);
574  const unsigned int nMuons(muonIds_.size());
575  if (nMuons>0) kMuon = k;
576  }
577  }
578  }
579 
580  bool l1Matched = false;
581  bool l2Matched = false;
582  double l1DeltaRMin = 500.;
583  double l2DeltaRMin = 500.;
584  unsigned int l1IndMatched = 500;
585  unsigned int l2IndMatched = 500;
586  // access to hlt dielecs
587  electronIds_.clear(); electronRefs_.clear();
588  if (kElec > 0 && kMuon < 1 && isoElecs.size()>0) {
589  const string& moduleLabelElec(moduleLabels[kElec]);
590  const string moduleTypeElec(hltConfig.moduleType(moduleLabelElec));
591 
592 // const unsigned int filterIndexElec(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
593 // triggerEventWithRefsHandle->getObjects(filterIndexElec,electronIds_,electronRefs_);
594 
596  const unsigned int filterIndexElec(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
597  rawTriggerEvent->getObjects(filterIndexElec,electronIds_,electronRefs_);
598  }
599  else{
600  const unsigned int filterIndexElec(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
601  aodTriggerEvent->getObjects(filterIndexElec,electronIds_,electronRefs_);
602 
603  }
604  const unsigned int nElectrons(electronIds_.size());
605  double deltar1 = 600.;
606  double deltar2 = 600.;
607  for (unsigned int inde = 0; inde < isoElecs.size(); inde++) {
608  if (nElectrons > 0) deltar1 = deltaR(*electronRefs_[0],*isoElecs[inde]);
609  if (nElectrons > 1) deltar2 = deltaR(*electronRefs_[1],*isoElecs[inde]);
610  if (deltar1 < deltar2 && deltar1 < l1DeltaRMin) {
611  l1DeltaRMin = deltar1;
612  l1IndMatched = inde;
613  }
614  if (deltar2 < deltar1 && deltar2 < l2DeltaRMin) {
615  l2DeltaRMin = deltar2;
616  l2IndMatched = inde;
617  }
618  }
619  if (nElectrons > 0 && l1IndMatched < 500) fill("leptDeltaREta_", isoElecs[l1IndMatched]->eta(), l1DeltaRMin);
620  if (nElectrons > 1 && l2IndMatched < 500) fill("leptDeltaREta_", isoElecs[l2IndMatched]->eta(), l2DeltaRMin);
621  if (l1DeltaRMin < DRMIN) {
622  l1Matched = true;
623  fill("matchingMon_", 0.5 );
624  fill("leptResolution_", fabs(isoElecs[l1IndMatched]->pt()-electronRefs_[0]->pt())/isoElecs[l1IndMatched]->pt() );
625  }
626  if (l2DeltaRMin < DRMIN) {
627  l2Matched = true;
628  fill("matchingMon_", 1.5 );
629  fill("leptResolution_", fabs(isoElecs[l2IndMatched]->pt()-electronRefs_[1]->pt())/isoElecs[l2IndMatched]->pt() );
630  }
631  }
632  // access to hlt dimuons
633  muonIds_.clear(); muonRefs_.clear();
634  l1DeltaRMin = 500.; l2DeltaRMin = 500.; double l3DeltaRMin = 500.;
635  l1IndMatched = 500; l2IndMatched = 500; double l3IndMatched = 500;
636  if (kMuon > 0 && kElec < 1 && isoMuons.size()>0) {
637  const string& moduleLabelMuon(moduleLabels[kMuon]);
638  const string moduleTypeMuon(hltConfig.moduleType(moduleLabelMuon));
639 
640 // const unsigned int filterIndexMuon(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
641 // triggerEventWithRefsHandle->getObjects(filterIndexMuon,muonIds_,muonRefs_);
642 
644  const unsigned int filterIndexMuon(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
645  rawTriggerEvent->getObjects(filterIndexMuon,muonIds_,muonRefs_);
646  }
647 
648  else{
649  const unsigned int filterIndexMuon(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
650  aodTriggerEvent->getObjects(filterIndexMuon,muonIds_,muonRefs_);
651  }
652 
653  trigger::VRmuon myMuonRefs;
654  const unsigned int nMuons(muonIds_.size());
655  for (unsigned int l=0; l<nMuons; l++) {
656  bool isNew = true;
657  for (unsigned int ll=0; ll<myMuonRefs.size(); ll++) {
658  if (fabs((myMuonRefs[ll]->pt()-muonRefs_[l]->pt())/muonRefs_[l]->pt()) < 1e-5) isNew = false;
659  }
660  if (isNew) myMuonRefs.push_back(muonRefs_[l]);
661  }
662  const unsigned int nMyMuons(myMuonRefs.size());
663  double deltar1 = 600.;
664  double deltar2 = 600.;
665  double deltar3 = 600.;
666  for (unsigned int indm = 0; indm < isoMuons.size(); indm++) {
667  if (nMyMuons > 0) deltar1 = deltaR(*myMuonRefs[0],*isoMuons[indm]);
668  if (nMyMuons > 1) deltar2 = deltaR(*myMuonRefs[1],*isoMuons[indm]);
669  if (nMyMuons > 2) deltar3 = deltaR(*myMuonRefs[2],*isoMuons[indm]);
670  if (nMyMuons > 0 && (nMyMuons<1 || deltar1 < deltar2) && (nMyMuons<2 || deltar1<deltar3) && deltar1 < l1DeltaRMin) {
671  l1DeltaRMin = deltar1;
672  l1IndMatched = indm;
673  }
674  if (nMyMuons > 1 && deltar2 < deltar1 && (nMyMuons<3 || deltar2<deltar3) && deltar2 < l2DeltaRMin) {
675  l2DeltaRMin = deltar2;
676  l2IndMatched = indm;
677  }
678  if (nMyMuons > 2 && deltar3 < deltar1 && deltar3 < deltar2 && deltar3 < l3DeltaRMin) {
679  l3DeltaRMin = deltar3;
680  l3IndMatched = indm;
681  }
682  }
683  if (nMyMuons > 0 && l1IndMatched < 500) fill("leptDeltaREta_", isoMuons[l1IndMatched]->eta(), l1DeltaRMin);
684  if (nMyMuons > 1 && l2IndMatched < 500) fill("leptDeltaREta_", isoMuons[l2IndMatched]->eta(), l2DeltaRMin);
685  if (nMyMuons > 2 && l3IndMatched < 500) fill("leptDeltaREta_", isoMuons[l3IndMatched]->eta(), l3DeltaRMin);
686  if (l1DeltaRMin < DRMIN) {
687  l1Matched = true;
688  fill("matchingMon_", 0.5 );
689  fill("leptResolution_", fabs(isoMuons[l1IndMatched]->pt()-myMuonRefs[0]->pt())/isoMuons[l1IndMatched]->pt() );
690  if (l2DeltaRMin < DRMIN) {
691  l2Matched = true;
692  fill("matchingMon_", 1.5 );
693  fill("leptResolution_", fabs(isoMuons[l2IndMatched]->pt()-myMuonRefs[1]->pt())/isoMuons[l2IndMatched]->pt() );
694  } else if (l3DeltaRMin < DRMIN) {
695  l2Matched = true;
696  fill("matchingMon_", 1.5 );
697  fill("leptResolution_", fabs(isoMuons[l3IndMatched]->pt()-myMuonRefs[2]->pt())/isoMuons[l3IndMatched]->pt() );
698  }
699  } else {
700  if (l2DeltaRMin < DRMIN) {
701  l1Matched = true;
702  fill("matchingMon_", 0.5 );
703  fill("leptResolution_", fabs(isoMuons[l2IndMatched]->pt()-myMuonRefs[1]->pt())/isoMuons[l2IndMatched]->pt() );
704  if (l3DeltaRMin < DRMIN) {
705  l2Matched = true;
706  fill("matchingMon_", 1.5 );
707  fill("leptResolution_", fabs(isoMuons[l3IndMatched]->pt()-myMuonRefs[2]->pt())/isoMuons[l3IndMatched]->pt() );
708  }
709  }
710  if (l3DeltaRMin < DRMIN) {
711  l1Matched = true;
712  fill("matchingMon_", 0.5 );
713  fill("leptResolution_", fabs(isoMuons[l3IndMatched]->pt()-myMuonRefs[2]->pt())/isoMuons[l3IndMatched]->pt() );
714  }
715  }
716  }
717  // access to hlt elec-muon
718  electronIds_.clear(); electronRefs_.clear();
719  muonIds_.clear(); muonRefs_.clear();
720  l1DeltaRMin = 500.; l2DeltaRMin = 500.;
721  l1IndMatched = 500; l2IndMatched = 500;
722  if (kElec > 0 && kMuon > 0 && isoElecs.size()>0) {
723  const string& moduleLabelElec(moduleLabels[kElec]);
724  const string moduleTypeElec(hltConfig.moduleType(moduleLabelElec));
725 
726 // const unsigned int filterIndexElec(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
727 // triggerEventWithRefsHandle->getObjects(filterIndexElec,electronIds_,electronRefs_);
728 
730  const unsigned int filterIndexElec(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
731  rawTriggerEvent->getObjects(filterIndexElec,electronIds_,electronRefs_);
732  }
733  else{
734  const unsigned int filterIndexElec(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
735  aodTriggerEvent->getObjects(filterIndexElec,electronIds_,electronRefs_);
736  }
737 
738  const unsigned int nElectrons(electronIds_.size());
739  double deltar = 600.;
740  for (unsigned int inde = 0; inde < isoElecs.size(); inde++) {
741  if (nElectrons > 0) deltar = deltaR(*electronRefs_[0],*isoElecs[inde]);
742  if (deltar < l1DeltaRMin) {
743  l1DeltaRMin = deltar;
744  l1IndMatched = inde;
745  }
746  }
747  if (nElectrons > 0 && l1IndMatched < 500) fill("leptDeltaREta_", isoElecs[l1IndMatched]->eta(), l1DeltaRMin);
748  if (l1DeltaRMin < DRMIN) {
749  l1Matched = true;
750  fill("matchingMon_", 0.5 );
751  fill("leptResolution_", fabs(isoElecs[l1IndMatched]->pt()-electronRefs_[0]->pt())/isoElecs[l1IndMatched]->pt() );
752  }
753  }
754  if (kElec > 0 && kMuon > 0 && isoMuons.size()>0) {
755  const string& moduleLabelMuon(moduleLabels[kMuon]);
756  const string moduleTypeMuon(hltConfig.moduleType(moduleLabelMuon));
757 
758 // const unsigned int filterIndexMuon(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
759 // triggerEventWithRefsHandle->getObjects(filterIndexMuon,muonIds_,muonRefs_);
760 
762  const unsigned int filterIndexMuon(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
763  rawTriggerEvent->getObjects(filterIndexMuon,muonIds_,muonRefs_);
764  }
765  else{
766  const unsigned int filterIndexMuon(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
767  aodTriggerEvent->getObjects(filterIndexMuon,muonIds_,muonRefs_);
768  }
769 
770  const unsigned int nMuons(muonIds_.size());
771  if (isoMuons.size()<1) continue;
772  double deltar = 600.;
773  for (unsigned int indm = 0; indm < isoMuons.size(); indm++) {
774  if (nMuons > 0) deltar = deltaR(*muonRefs_[0],*isoMuons[indm]);
775  if (deltar < l2DeltaRMin) {
776  l2DeltaRMin = deltar;
777  l2IndMatched = indm;
778  }
779  }
780  if (nMuons > 0 && l2IndMatched < 500) fill("leptDeltaREta_", isoMuons[l2IndMatched]->eta(), l2DeltaRMin);
781  if (l2DeltaRMin < DRMIN) {
782  l2Matched = true;
783  fill("matchingMon_", 1.5 );
784  fill("leptResolution_", fabs(isoMuons[l2IndMatched]->pt()-muonRefs_[0]->pt())/isoMuons[l2IndMatched]->pt() );
785  }
786  }
787  if (l1Matched && l2Matched) fill("matchingMon_", 2.5 );
788  }
789 // }
790 
791  }
size
Write out results.
const std::string moduleType(const std::string &module) const
C++ class name of module.
double lowerEdge_
mass window upper and lower edge
Jets made from CaloTowers.
Definition: CaloJet.h:29
virtual void scaleEnergy(double fScale)
scale energy of the jet
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
Base class for all types of Jets.
Definition: Jet.h:20
RunNumber_t run() const
int elecMuLogged_
number of logged interesting events
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
Jets made from PFObjects.
Definition: PFJet.h:21
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:91
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
virtual double et() const final
transverse energy
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
Definition: MET.h:42
vector< PseudoJet > jets
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
std::vector< std::string > diElecPaths_
trigger paths for di electron channel
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
bool isValid() const
Definition: HandleBase.h:74
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
std::map< std::string, MonitorElement * > hists_
histogram container
void fill(const edm::Event &event, const edm::EventSetup &setup, const HLTConfigProvider &hltConfig, const std::vector< std::string > triggerPaths)
fill monitor histograms with electronId and jetCorrections
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
int k[5][pyjets_maxn]
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
EventAuxiliary const & eventAuxiliary() const
Definition: Event.h:78
met
===> hadronic RAZOR
Definition: deltar.py:1
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
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:50
std::vector< reco::RecoChargedCandidateRef > VRmuon
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
bool isUninitialized() const
Definition: EDGetToken.h:73
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
static std::string const triggerPaths
Definition: EdmProvDump.cc:42
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
void MonitorDiLepton::fill ( const edm::Event event,
const edm::TriggerResults triggerTable,
std::string  channel,
const std::vector< std::string > &  labels 
) const
inlineprivate

fill trigger monitoring histograms

Definition at line 199 of file TopDiLeptonHLTOfflineDQM.h.

References acceptHLT(), fill(), training_settings::idx, and monitorPath().

200  {
201  for(unsigned int idx=0; idx<labels.size(); ++idx){
202  if( acceptHLT(event, triggerTable, monitorPath(labels[idx])) ){
203  fill((channel+"Mon_").c_str(), idx+0.5 );
204  }
205  }
206  }
std::string monitorPath(const std::string &label) const
void fill(const edm::Event &event, const edm::EventSetup &setup, const HLTConfigProvider &hltConfig, const std::vector< std::string > triggerPaths)
fill monitor histograms with electronId and jetCorrections
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
void HLTOfflineDQMTopDiLepton::MonitorDiLepton::fill ( const std::string  histName,
double  value 
) const
inlineprivate

fill histogram if it had been booked before

Definition at line 83 of file TopDiLeptonHLTOfflineDQM.h.

References booked(), hists_, and edm::second().

83 { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
bool booked(const std::string histName) const
check if histogram was booked
U second(std::pair< T, U > const &p)
Definition: value.py:1
std::map< std::string, MonitorElement * > hists_
histogram container
void HLTOfflineDQMTopDiLepton::MonitorDiLepton::fill ( const std::string  histName,
double  xValue,
double  yValue 
) const
inlineprivate

fill histogram if it had been booked before (2-dim version)

Definition at line 85 of file TopDiLeptonHLTOfflineDQM.h.

References booked(), hists_, and edm::second().

85 { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(xValue, yValue); };
bool booked(const std::string histName) const
check if histogram was booked
U second(std::pair< T, U > const &p)
std::map< std::string, MonitorElement * > hists_
histogram container
void HLTOfflineDQMTopDiLepton::MonitorDiLepton::fill ( const std::string  histName,
double  xValue,
double  yValue,
double  zValue 
) const
inlineprivate

fill histogram if it had been booked before (2-dim version)

Definition at line 87 of file TopDiLeptonHLTOfflineDQM.h.

87 { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(xValue, yValue, zValue); };
bool booked(const std::string histName) const
check if histogram was booked
U second(std::pair< T, U > const &p)
std::map< std::string, MonitorElement * > hists_
histogram container
void MonitorDiLepton::loggerBinLabels ( std::string  hist)
inlineprivate

set labels for event logging histograms

Definition at line 164 of file TopDiLeptonHLTOfflineDQM.h.

References hists_.

Referenced by book(), and selectionPath().

165  {
166  // set axes titles for selected events
167  hists_[hist.c_str()]->getTH1()->SetOption("TEXT");
168  hists_[hist.c_str()]->setBinLabel( 1 , "Run" , 1);
169  hists_[hist.c_str()]->setBinLabel( 2 , "Block" , 1);
170  hists_[hist.c_str()]->setBinLabel( 3 , "Event" , 1);
171  hists_[hist.c_str()]->setBinLabel( 6 , "pt_{L2L3}(jet1)" , 1);
172  hists_[hist.c_str()]->setBinLabel( 7 , "pt_{L2L3}(jet2)" , 1);
173  hists_[hist.c_str()]->setBinLabel( 8 , "MET_{Calo}" , 1);
174  hists_[hist.c_str()]->setAxisTitle("logged evts" , 2);
175 
176  if(hist=="diMuonLogger_"){
177  hists_[hist.c_str()]->setBinLabel( 4 , "pt(muon)" , 1);
178  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
179  }
180  if(hist=="diElecLogger_"){
181  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
182  hists_[hist.c_str()]->setBinLabel( 5 , "pt(elec)" , 1);
183  }
184  if(hist=="elecMuLogger_"){
185  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
186  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
187  }
188  }
std::map< std::string, MonitorElement * > hists_
histogram container
std::string HLTOfflineDQMTopDiLepton::MonitorDiLepton::monitorPath ( const std::string &  label) const
inlineprivate

deduce monitorPath from label, the label is expected to be of type 'selectionPath:monitorPath'

Definition at line 68 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and triggerBinLabels().

68 { return label.substr(label.find(':')+1); };
std::string HLTOfflineDQMTopDiLepton::MonitorDiLepton::selectionPath ( const std::string &  label) const
inlineprivate

deduce selectionPath from label, the label is expected to be of type 'selectionPath:monitorPath'

Definition at line 71 of file TopDiLeptonHLTOfflineDQM.h.

References fill(), create_public_lumi_plots::hist, tablePrinter::labels, loggerBinLabels(), AlCaHLTBitMon_QueryRunRegistry::string, and triggerBinLabels().

71 { return label.substr(0, label.find(':')); };
void MonitorDiLepton::triggerBinLabels ( std::string  channel,
const std::vector< std::string > &  labels 
)
inlineprivate

set configurable labels for trigger monitoring histograms

Definition at line 191 of file TopDiLeptonHLTOfflineDQM.h.

References hists_, training_settings::idx, and monitorPath().

Referenced by book(), and selectionPath().

192  {
193  for(unsigned int idx=0; idx<labels.size(); ++idx){
194  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
195  }
196  }
std::string monitorPath(const std::string &label) const
std::map< std::string, MonitorElement * > hists_
histogram container

Member Data Documentation

int HLTOfflineDQMTopDiLepton::MonitorDiLepton::diElecLogged_
private

Definition at line 151 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

std::vector<std::string> HLTOfflineDQMTopDiLepton::MonitorDiLepton::diElecPaths_
private

trigger paths for di electron channel

Definition at line 113 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by book(), fill(), and MonitorDiLepton().

int HLTOfflineDQMTopDiLepton::MonitorDiLepton::diMuonLogged_
private

Definition at line 151 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

std::vector<std::string> HLTOfflineDQMTopDiLepton::MonitorDiLepton::diMuonPaths_
private

trigger paths for di muon channel

Definition at line 111 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by book(), fill(), and MonitorDiLepton().

int HLTOfflineDQMTopDiLepton::MonitorDiLepton::eidPattern_
private

electronId pattern we expect the following pattern: 0: fails 1: passes electron ID only 2: passes electron Isolation only 3: passes electron ID and Isolation only 4: passes conversion rejection 5: passes conversion rejection and ID 6: passes conversion rejection and Isolation 7: passes the whole selection As described on https://twiki.cern.ch/twiki/bin/view/CMS/SimpleCutBasedEleID

Definition at line 127 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

StringCutObjectSelector<reco::GsfElectron>* HLTOfflineDQMTopDiLepton::MonitorDiLepton::elecIso_
private

extra isolation criterion on electron

Definition at line 129 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

int HLTOfflineDQMTopDiLepton::MonitorDiLepton::elecMuLogged_
private

number of logged interesting events

Definition at line 151 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

std::vector<std::string> HLTOfflineDQMTopDiLepton::MonitorDiLepton::elecMuPaths_
private

trigger paths for monitoring, expected to be of form signalPath:MonitorPath

Definition at line 109 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by book(), fill(), and MonitorDiLepton().

edm::EDGetTokenT< edm::View<reco::GsfElectron> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::elecs_
private

input sources for monitoring

Definition at line 94 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

StringCutObjectSelector<reco::GsfElectron>* HLTOfflineDQMTopDiLepton::MonitorDiLepton::elecSelect_
private

extra selection on electrons

Definition at line 131 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

edm::EDGetTokenT< edm::ValueMap<float> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::electronId_
private

electronId label

Definition at line 116 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

trigger::Vids HLTOfflineDQMTopDiLepton::MonitorDiLepton::electronIds_
private

Definition at line 157 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

trigger::VRelectron HLTOfflineDQMTopDiLepton::MonitorDiLepton::electronRefs_
private

Definition at line 158 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

std::string HLTOfflineDQMTopDiLepton::MonitorDiLepton::folder_
private

Definition at line 87 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by book(), and MonitorDiLepton().

bool HLTOfflineDQMTopDiLepton::MonitorDiLepton::hasRawTriggerSummary
private

Definition at line 105 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

std::map<std::string,MonitorElement*> HLTOfflineDQMTopDiLepton::MonitorDiLepton::hists_
private

histogram container

Definition at line 153 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by book(), booked(), fill(), loggerBinLabels(), and triggerBinLabels().

std::string HLTOfflineDQMTopDiLepton::MonitorDiLepton::jetCorrector_
private

jetCorrector

Definition at line 139 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

edm::EDGetTokenT< reco::JetIDValueMap > HLTOfflineDQMTopDiLepton::MonitorDiLepton::jetIDLabel_
private

jetID as an extra selection type

Definition at line 141 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

StringCutObjectSelector<reco::JetID>* HLTOfflineDQMTopDiLepton::MonitorDiLepton::jetIDSelect_
private

extra jetID selection on calo jets

Definition at line 143 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

edm::EDGetTokenT< edm::View<reco::Jet> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::jets_
private

Definition at line 96 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

std::string HLTOfflineDQMTopDiLepton::MonitorDiLepton::jetSelect_
private

extra selection on jets (here given as std::string as it depends on the the jet type, which selections are valid and which not)

Definition at line 146 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

std::string HLTOfflineDQMTopDiLepton::MonitorDiLepton::label_
private
double HLTOfflineDQMTopDiLepton::MonitorDiLepton::lowerEdge_
private

mass window upper and lower edge

Definition at line 148 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

std::vector< edm::EDGetTokenT< edm::View<reco::MET> > > HLTOfflineDQMTopDiLepton::MonitorDiLepton::mets_
private

considers a vector of METs

Definition at line 98 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

trigger::Vids HLTOfflineDQMTopDiLepton::MonitorDiLepton::muonIds_
private

Definition at line 159 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

StringCutObjectSelector<reco::Muon>* HLTOfflineDQMTopDiLepton::MonitorDiLepton::muonIso_
private

extra isolation criterion on muon

Definition at line 134 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

trigger::VRmuon HLTOfflineDQMTopDiLepton::MonitorDiLepton::muonRefs_
private

Definition at line 160 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

edm::EDGetTokenT< edm::View<reco::Muon> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::muons_
private

Definition at line 95 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

StringCutObjectSelector<reco::Muon>* HLTOfflineDQMTopDiLepton::MonitorDiLepton::muonSelect_
private

extra selection on muons

Definition at line 136 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

std::string HLTOfflineDQMTopDiLepton::MonitorDiLepton::processName_
private

hlt objects

Definition at line 156 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

edm::EDGetTokenT<trigger::TriggerEventWithRefs> HLTOfflineDQMTopDiLepton::MonitorDiLepton::triggerSummaryTokenAOD
private

Definition at line 104 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

edm::EDGetTokenT<trigger::TriggerEventWithRefs> HLTOfflineDQMTopDiLepton::MonitorDiLepton::triggerSummaryTokenRAW
private

Definition at line 103 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

edm::EDGetTokenT< edm::TriggerResults > HLTOfflineDQMTopDiLepton::MonitorDiLepton::triggerTable_
private

trigger table

Definition at line 101 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

double HLTOfflineDQMTopDiLepton::MonitorDiLepton::upperEdge_
private

Definition at line 148 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().