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...
 
using LorentzVector = reco::LeafCandidate::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
 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, const 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 (const 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 (const 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_
 
std::unique_ptr< 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...
 
std::unique_ptr< 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...
 
std::unique_ptr< 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_
 
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonIso_
 extra isolation criterion on muon More...
 
trigger::VRmuon muonRefs_
 
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
 
std::unique_ptr< 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 47 of file TopDiLeptonHLTOfflineDQM.h.

Member Typedef Documentation

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

Definition at line 51 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  :
29  label_(label), eidPattern_(0), elecIso_(nullptr), elecSelect_(nullptr), muonIso_(nullptr), muonSelect_(nullptr), jetIDSelect_(nullptr),
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") ){
49  elecSelect_= std::make_unique<StringCutObjectSelector<reco::GsfElectron>>(elecExtras.getParameter<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") ){
54  elecIso_= std::make_unique<StringCutObjectSelector<reco::GsfElectron>>(elecExtras.getParameter<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") ){
70  muonSelect_= std::make_unique<StringCutObjectSelector<reco::Muon>>(muonExtras.getParameter<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") ){
75  muonIso_= std::make_unique<StringCutObjectSelector<reco::Muon>>(muonExtras.getParameter<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_= std::make_unique<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
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecSelect_
extra selection on electrons
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
int elecMuLogged_
number of logged interesting events
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
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::unique_ptr< StringCutObjectSelector< reco::Muon > > muonSelect_
extra selection on muons
std::vector< std::string > diElecPaths_
trigger paths for di electron channel
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecIso_
extra isolation criterion on electron
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
met
===> hadronic RAZOR
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonIso_
extra isolation criterion on muon
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
HLTOfflineDQMTopDiLepton::MonitorDiLepton::~MonitorDiLepton ( )
default

default destructor

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().

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 triggerBinLabels(const std::string &channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
void loggerBinLabels(const 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 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 82 of file TopDiLeptonHLTOfflineDQM.h.

References hists_.

Referenced by fill().

82 { 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(), PVValHelper::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(), and selectionPath().

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=nullptr;
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(auto 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(auto 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(auto name : triggerNames.triggerNames()){
386  bool elecmu = false;
387  bool dielec = false;
388  bool dimuon = false;
389  // consider only path from triggerPaths
390  for (auto const & triggerPath : triggerPaths) {
391  if (TString(name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString("ele"), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString("mu"), TString::kIgnoreCase)) elecmu = true;
392  else {
393  if (TString(name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString("ele"), TString::kIgnoreCase)) dielec = true;
394  if (TString(name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString("mu"), TString::kIgnoreCase)) dimuon = true;
395  }
396  }
397 
398  // ELECMU channel
399  if( elecmu ){
400  fill("decayChannel_", 0.5);
401  if( isoElecs.size()>0 && isoMuons.size()>0 ) {
402  double mass = (isoElecs[0]->p4()+isoMuons[0]->p4()).mass();
403  if( (lowerEdge_==-1. && upperEdge_==-1.) || (lowerEdge_<mass && mass<upperEdge_) ){
404  // fill plots for trigger monitoring
405  if(!triggerTable_.isUninitialized()) fill(event, *triggerTable, "elecMu", elecMuPaths_);
406  if(elecMuLogged_<=hists_.find("elecMuLogger_")->second->getNbinsY()){
407  // log runnumber, lumi block, event number & some
408  // more pysics infomation for interesting events
409  // We're doing a static_cast here to denote the explicity of the cast
410  auto runID = static_cast<double>(event.eventAuxiliary().run());
411  auto luminosityBlockID = static_cast<double>(event.eventAuxiliary().luminosityBlock());
412  auto eventID = static_cast<double>(event.eventAuxiliary().event());
413  fill("elecMuLogger_", 0.5, elecMuLogged_+0.5, runID);
414  fill("elecMuLogger_", 1.5, elecMuLogged_+0.5, luminosityBlockID);
415  fill("elecMuLogger_", 2.5, elecMuLogged_+0.5, eventID);
416  fill("elecMuLogger_", 3.5, elecMuLogged_+0.5, isoMuons[0]->pt());
417  fill("elecMuLogger_", 4.5, elecMuLogged_+0.5, isoElecs[0]->pt());
418  if(leadingJets.size()>0) fill("elecMuLogger_", 5.5, elecMuLogged_+0.5, leadingJets[0].pt());
419  if(leadingJets.size()>1) fill("elecMuLogger_", 6.5, elecMuLogged_+0.5, leadingJets[1].pt());
420  fill("elecMuLogger_", 7.5, elecMuLogged_+0.5, caloMET.et());
421  ++elecMuLogged_;
422  }
423  }
424  }
425  }
426 
427  // DIMUON channel
428  if( dimuon ){
429  fill("decayChannel_", 1.5);
430  if (isoMuons.size()>1) {
431  int charge = isoMuons[0]->charge()*isoMuons[1]->charge();
432  double mass = (isoMuons[0]->p4()+isoMuons[1]->p4()).mass();
433  fill(charge<0 ? "invMass_" : "invMassWC_" , mass );
434  if((lowerEdge_==-1. && upperEdge_==-1.) || (lowerEdge_<mass && mass<upperEdge_) ){
435  // fill plots for trigger monitoring
436  if(!triggerTable_.isUninitialized()) fill(event, *triggerTable, "diMuon", diMuonPaths_);
437  if(diMuonLogged_<=hists_.find("diMuonLogger_")->second->getNbinsY()){
438  // log runnumber, lumi block, event number & some
439  // more pysics infomation for interesting events
440  // We're doing a static_cast here to denote the explicity of the cast
441  auto runID = static_cast<double>(event.eventAuxiliary().run());
442  auto luminosityBlockID = static_cast<double>(event.eventAuxiliary().luminosityBlock());
443  auto eventID = static_cast<double>(event.eventAuxiliary().event());
444  fill("diMuonLogger_", 0.5, diMuonLogged_+0.5, runID);
445  fill("diMuonLogger_", 1.5, diMuonLogged_+0.5, luminosityBlockID);
446  fill("diMuonLogger_", 2.5, diMuonLogged_+0.5, eventID);
447  fill("diMuonLogger_", 3.5, diMuonLogged_+0.5, isoMuons[0]->pt());
448  fill("diMuonLogger_", 4.5, diMuonLogged_+0.5, isoMuons[1]->pt());
449  if(leadingJets.size()>0) fill("diMuonLogger_", 5.5, diMuonLogged_+0.5, leadingJets[0].pt());
450  if(leadingJets.size()>1) fill("diMuonLogger_", 6.5, diMuonLogged_+0.5, leadingJets[1].pt());
451  fill("diMuonLogger_", 7.5, diMuonLogged_+0.5, caloMET.et());
452  ++diMuonLogged_;
453  }
454  }
455  }
456  }
457 
458  // DIELEC channel
459  if( dielec ){
460  fill("decayChannel_", 2.5);
461  if( dielec && isoElecs.size()>1 ){
462  int charge = isoElecs[0]->charge()*isoElecs[1]->charge();
463  double mass = (isoElecs[0]->p4()+isoElecs[1]->p4()).mass();
464  fill(charge<0 ? "invMass_" : "invMassWC_" , mass );
465  if((lowerEdge_==-1. && upperEdge_==-1.) || (lowerEdge_<mass && mass<upperEdge_) ){
466  // fill plots for trigger monitoring
467  if(!triggerTable_.isUninitialized()) fill(event, *triggerTable, "diElec", diElecPaths_);
468  if(diElecLogged_<=hists_.find("diElecLogger_")->second->getNbinsY()){
469  // log runnumber, lumi block, event number & some
470  // more pysics infomation for interesting events
471  // We're doing a static_cast here to denote the explicity of the cast
472  auto runID = static_cast<double>(event.eventAuxiliary().run());
473  auto luminosityBlockID = static_cast<double>(event.eventAuxiliary().luminosityBlock());
474  auto eventID = static_cast<double>(event.eventAuxiliary().event());
475  fill("diElecLogger_", 0.5, diElecLogged_+0.5, runID);
476  fill("diElecLogger_", 1.5, diElecLogged_+0.5, luminosityBlockID);
477  fill("diElecLogger_", 2.5, diElecLogged_+0.5, eventID);
478  fill("diElecLogger_", 3.5, diElecLogged_+0.5, isoElecs[0]->pt());
479  fill("diElecLogger_", 4.5, diElecLogged_+0.5, isoElecs[1]->pt());
480  if(leadingJets.size()>0) fill("diElecLogger_", 5.5, diElecLogged_+0.5, leadingJets[0].pt());
481  if(leadingJets.size()>1) fill("diElecLogger_", 6.5, diElecLogged_+0.5, leadingJets[1].pt());
482  fill("diElecLogger_", 7.5, diElecLogged_+0.5, caloMET.et());
483  ++diElecLogged_;
484  }
485  }
486  }
487  }
488  }
489 
490  /*
491  ------------------------------------------------------------
492 
493  HLT Objects Monitoring
494 
495  ------------------------------------------------------------
496  */
497 
498 // if(event.getByToken(triggerEventWithRefsTag_,triggerEventWithRefsHandle)) {
499 
500 
502  event.getByToken(triggerSummaryTokenRAW,rawTriggerEvent);
503 
505  event.getByToken(triggerSummaryTokenAOD,aodTriggerEvent);
506 
508  if(!rawTriggerEvent.isValid()){
509  hasRawTriggerSummary=false;
510 // edm::LogWarning( "TopDiLeptonHLTOfflineDQM" )
511 // << "No RAW trigger summary found! Returning... \n";
512 
513  if(!aodTriggerEvent.isValid()){
514 // edm::LogWarning( "TopDiLeptonHLTOfflineDQM" )
515 // << "No AOD trigger summary found! Returning... \n";
516 
517  return;
518  }
519  }
520 
521 
522 
523  // loop over trigger paths
524  for(unsigned int i=0; i<triggerNames.triggerNames().size(); ++i){
525  // consider only path from triggerPaths
526  string name = triggerNames.triggerNames()[i].c_str();
527  bool isInteresting = false;
528  for (auto const & triggerPath : triggerPaths) {
529  if (TString(name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase)) isInteresting = true;
530  }
531  if (!isInteresting) continue;
532  // dump infos on the considered trigger path
533  const unsigned int triggerIndex = triggerNames.triggerIndex(name);
534  // get modules for the considered trigger path
535  const vector<string>& moduleLabels(hltConfig.moduleLabels(triggerIndex));
536  const unsigned int moduleIndex(triggerTable->index(triggerIndex));
537  // Results from TriggerEvent product
538  electronIds_.clear(); electronRefs_.clear();
539  muonIds_.clear(); muonRefs_.clear();
540  // look only for modules actually run in this path
541  unsigned int kElec=0;
542  unsigned int kMuon=0;
543  for (unsigned int k=0; k<=moduleIndex; ++k) {
544  const string& moduleLabel(moduleLabels[k]);
545  const string moduleType(hltConfig.moduleType(moduleLabel));
546  // check whether the module is packed up in TriggerEventWithRef product
547 
548 // const unsigned int filterIndex(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabel,"",processName_)));
549 // if (filterIndex<triggerEventWithRefsHandle->size()) {
550 
552  const unsigned int filterIndex(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabel,"",processName_)));
553  if (filterIndex<rawTriggerEvent->size()) {
554  rawTriggerEvent->getObjects(filterIndex,electronIds_,electronRefs_);
555  const unsigned int nElectrons(electronIds_.size());
556  if (nElectrons>0) kElec = k;
557 
558  rawTriggerEvent->getObjects(filterIndex,muonIds_,muonRefs_);
559  const unsigned int nMuons(muonIds_.size());
560  if (nMuons>0) kMuon = k;
561  }
562  }
563 
564  else{
565  const unsigned int filterIndex(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabel,"",processName_)));
566  if (filterIndex<aodTriggerEvent->size()) {
567 
568  aodTriggerEvent->getObjects(filterIndex,electronIds_,electronRefs_);
569  const unsigned int nElectrons(electronIds_.size());
570  if (nElectrons>0) kElec = k;
571 
572  aodTriggerEvent->getObjects(filterIndex,muonIds_,muonRefs_);
573  const unsigned int nMuons(muonIds_.size());
574  if (nMuons>0) kMuon = k;
575  }
576  }
577  }
578 
579  bool l1Matched = false;
580  bool l2Matched = false;
581  double l1DeltaRMin = 500.;
582  double l2DeltaRMin = 500.;
583  unsigned int l1IndMatched = 500;
584  unsigned int l2IndMatched = 500;
585  // access to hlt dielecs
586  electronIds_.clear(); electronRefs_.clear();
587  if (kElec > 0 && kMuon < 1 && isoElecs.size()>0) {
588  const string& moduleLabelElec(moduleLabels[kElec]);
589  const string moduleTypeElec(hltConfig.moduleType(moduleLabelElec));
590 
591 // const unsigned int filterIndexElec(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
592 // triggerEventWithRefsHandle->getObjects(filterIndexElec,electronIds_,electronRefs_);
593 
595  const unsigned int filterIndexElec(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
596  rawTriggerEvent->getObjects(filterIndexElec,electronIds_,electronRefs_);
597  }
598  else{
599  const unsigned int filterIndexElec(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
600  aodTriggerEvent->getObjects(filterIndexElec,electronIds_,electronRefs_);
601 
602  }
603  const unsigned int nElectrons(electronIds_.size());
604  double deltar1 = 600.;
605  double deltar2 = 600.;
606  for (unsigned int inde = 0; inde < isoElecs.size(); inde++) {
607  if (nElectrons > 0) deltar1 = deltaR(*electronRefs_[0],*isoElecs[inde]);
608  if (nElectrons > 1) deltar2 = deltaR(*electronRefs_[1],*isoElecs[inde]);
609  if (deltar1 < deltar2 && deltar1 < l1DeltaRMin) {
610  l1DeltaRMin = deltar1;
611  l1IndMatched = inde;
612  }
613  if (deltar2 < deltar1 && deltar2 < l2DeltaRMin) {
614  l2DeltaRMin = deltar2;
615  l2IndMatched = inde;
616  }
617  }
618  if (nElectrons > 0 && l1IndMatched < 500) fill("leptDeltaREta_", isoElecs[l1IndMatched]->eta(), l1DeltaRMin);
619  if (nElectrons > 1 && l2IndMatched < 500) fill("leptDeltaREta_", isoElecs[l2IndMatched]->eta(), l2DeltaRMin);
620  if (l1DeltaRMin < DRMIN) {
621  l1Matched = true;
622  fill("matchingMon_", 0.5 );
623  fill("leptResolution_", fabs(isoElecs[l1IndMatched]->pt()-electronRefs_[0]->pt())/isoElecs[l1IndMatched]->pt() );
624  }
625  if (l2DeltaRMin < DRMIN) {
626  l2Matched = true;
627  fill("matchingMon_", 1.5 );
628  fill("leptResolution_", fabs(isoElecs[l2IndMatched]->pt()-electronRefs_[1]->pt())/isoElecs[l2IndMatched]->pt() );
629  }
630  }
631  // access to hlt dimuons
632  muonIds_.clear(); muonRefs_.clear();
633  l1DeltaRMin = 500.; l2DeltaRMin = 500.; double l3DeltaRMin = 500.;
634  l1IndMatched = 500; l2IndMatched = 500; double l3IndMatched = 500;
635  if (kMuon > 0 && kElec < 1 && isoMuons.size()>0) {
636  const string& moduleLabelMuon(moduleLabels[kMuon]);
637  const string moduleTypeMuon(hltConfig.moduleType(moduleLabelMuon));
638 
639 // const unsigned int filterIndexMuon(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
640 // triggerEventWithRefsHandle->getObjects(filterIndexMuon,muonIds_,muonRefs_);
641 
643  const unsigned int filterIndexMuon(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
644  rawTriggerEvent->getObjects(filterIndexMuon,muonIds_,muonRefs_);
645  }
646 
647  else{
648  const unsigned int filterIndexMuon(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
649  aodTriggerEvent->getObjects(filterIndexMuon,muonIds_,muonRefs_);
650  }
651 
652  trigger::VRmuon myMuonRefs;
653  const unsigned int nMuons(muonIds_.size());
654  for (unsigned int l=0; l<nMuons; l++) {
655  bool isNew = true;
656  for (auto & myMuonRef : myMuonRefs) {
657  if (fabs((myMuonRef->pt()-muonRefs_[l]->pt())/muonRefs_[l]->pt()) < 1e-5) isNew = false;
658  }
659  if (isNew) myMuonRefs.push_back(muonRefs_[l]);
660  }
661  const unsigned int nMyMuons(myMuonRefs.size());
662  double deltar1 = 600.;
663  double deltar2 = 600.;
664  double deltar3 = 600.;
665  for (unsigned int indm = 0; indm < isoMuons.size(); indm++) {
666  if (nMyMuons > 0) deltar1 = deltaR(*myMuonRefs[0],*isoMuons[indm]);
667  if (nMyMuons > 1) deltar2 = deltaR(*myMuonRefs[1],*isoMuons[indm]);
668  if (nMyMuons > 2) deltar3 = deltaR(*myMuonRefs[2],*isoMuons[indm]);
669  if (nMyMuons > 0 && (nMyMuons<1 || deltar1 < deltar2) && (nMyMuons<2 || deltar1<deltar3) && deltar1 < l1DeltaRMin) {
670  l1DeltaRMin = deltar1;
671  l1IndMatched = indm;
672  }
673  if (nMyMuons > 1 && deltar2 < deltar1 && (nMyMuons<3 || deltar2<deltar3) && deltar2 < l2DeltaRMin) {
674  l2DeltaRMin = deltar2;
675  l2IndMatched = indm;
676  }
677  if (nMyMuons > 2 && deltar3 < deltar1 && deltar3 < deltar2 && deltar3 < l3DeltaRMin) {
678  l3DeltaRMin = deltar3;
679  l3IndMatched = indm;
680  }
681  }
682  if (nMyMuons > 0 && l1IndMatched < 500) fill("leptDeltaREta_", isoMuons[l1IndMatched]->eta(), l1DeltaRMin);
683  if (nMyMuons > 1 && l2IndMatched < 500) fill("leptDeltaREta_", isoMuons[l2IndMatched]->eta(), l2DeltaRMin);
684  if (nMyMuons > 2 && l3IndMatched < 500) fill("leptDeltaREta_", isoMuons[l3IndMatched]->eta(), l3DeltaRMin);
685  if (l1DeltaRMin < DRMIN) {
686  l1Matched = true;
687  fill("matchingMon_", 0.5 );
688  fill("leptResolution_", fabs(isoMuons[l1IndMatched]->pt()-myMuonRefs[0]->pt())/isoMuons[l1IndMatched]->pt() );
689  if (l2DeltaRMin < DRMIN) {
690  l2Matched = true;
691  fill("matchingMon_", 1.5 );
692  fill("leptResolution_", fabs(isoMuons[l2IndMatched]->pt()-myMuonRefs[1]->pt())/isoMuons[l2IndMatched]->pt() );
693  } else if (l3DeltaRMin < DRMIN) {
694  l2Matched = true;
695  fill("matchingMon_", 1.5 );
696  fill("leptResolution_", fabs(isoMuons[l3IndMatched]->pt()-myMuonRefs[2]->pt())/isoMuons[l3IndMatched]->pt() );
697  }
698  } else {
699  if (l2DeltaRMin < DRMIN) {
700  l1Matched = true;
701  fill("matchingMon_", 0.5 );
702  fill("leptResolution_", fabs(isoMuons[l2IndMatched]->pt()-myMuonRefs[1]->pt())/isoMuons[l2IndMatched]->pt() );
703  if (l3DeltaRMin < DRMIN) {
704  l2Matched = true;
705  fill("matchingMon_", 1.5 );
706  fill("leptResolution_", fabs(isoMuons[l3IndMatched]->pt()-myMuonRefs[2]->pt())/isoMuons[l3IndMatched]->pt() );
707  }
708  }
709  if (l3DeltaRMin < DRMIN) {
710  l1Matched = true;
711  fill("matchingMon_", 0.5 );
712  fill("leptResolution_", fabs(isoMuons[l3IndMatched]->pt()-myMuonRefs[2]->pt())/isoMuons[l3IndMatched]->pt() );
713  }
714  }
715  }
716  // access to hlt elec-muon
717  electronIds_.clear(); electronRefs_.clear();
718  muonIds_.clear(); muonRefs_.clear();
719  l1DeltaRMin = 500.; l2DeltaRMin = 500.;
720  l1IndMatched = 500; l2IndMatched = 500;
721  if (kElec > 0 && kMuon > 0 && isoElecs.size()>0) {
722  const string& moduleLabelElec(moduleLabels[kElec]);
723  const string moduleTypeElec(hltConfig.moduleType(moduleLabelElec));
724 
725 // const unsigned int filterIndexElec(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
726 // triggerEventWithRefsHandle->getObjects(filterIndexElec,electronIds_,electronRefs_);
727 
729  const unsigned int filterIndexElec(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
730  rawTriggerEvent->getObjects(filterIndexElec,electronIds_,electronRefs_);
731  }
732  else{
733  const unsigned int filterIndexElec(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabelElec,"",processName_)));
734  aodTriggerEvent->getObjects(filterIndexElec,electronIds_,electronRefs_);
735  }
736 
737  const unsigned int nElectrons(electronIds_.size());
738  double deltar = 600.;
739  for (unsigned int inde = 0; inde < isoElecs.size(); inde++) {
740  if (nElectrons > 0) deltar = deltaR(*electronRefs_[0],*isoElecs[inde]);
741  if (deltar < l1DeltaRMin) {
742  l1DeltaRMin = deltar;
743  l1IndMatched = inde;
744  }
745  }
746  if (nElectrons > 0 && l1IndMatched < 500) fill("leptDeltaREta_", isoElecs[l1IndMatched]->eta(), l1DeltaRMin);
747  if (l1DeltaRMin < DRMIN) {
748  l1Matched = true;
749  fill("matchingMon_", 0.5 );
750  fill("leptResolution_", fabs(isoElecs[l1IndMatched]->pt()-electronRefs_[0]->pt())/isoElecs[l1IndMatched]->pt() );
751  }
752  }
753  if (kElec > 0 && kMuon > 0 && isoMuons.size()>0) {
754  const string& moduleLabelMuon(moduleLabels[kMuon]);
755  const string moduleTypeMuon(hltConfig.moduleType(moduleLabelMuon));
756 
757 // const unsigned int filterIndexMuon(triggerEventWithRefsHandle->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
758 // triggerEventWithRefsHandle->getObjects(filterIndexMuon,muonIds_,muonRefs_);
759 
761  const unsigned int filterIndexMuon(rawTriggerEvent->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
762  rawTriggerEvent->getObjects(filterIndexMuon,muonIds_,muonRefs_);
763  }
764  else{
765  const unsigned int filterIndexMuon(aodTriggerEvent->filterIndex(edm::InputTag(moduleLabelMuon,"",processName_)));
766  aodTriggerEvent->getObjects(filterIndexMuon,muonIds_,muonRefs_);
767  }
768 
769  const unsigned int nMuons(muonIds_.size());
770  if (isoMuons.size()<1) continue;
771  double deltar = 600.;
772  for (unsigned int indm = 0; indm < isoMuons.size(); indm++) {
773  if (nMuons > 0) deltar = deltaR(*muonRefs_[0],*isoMuons[indm]);
774  if (deltar < l2DeltaRMin) {
775  l2DeltaRMin = deltar;
776  l2IndMatched = indm;
777  }
778  }
779  if (nMuons > 0 && l2IndMatched < 500) fill("leptDeltaREta_", isoMuons[l2IndMatched]->eta(), l2DeltaRMin);
780  if (l2DeltaRMin < DRMIN) {
781  l2Matched = true;
782  fill("matchingMon_", 1.5 );
783  fill("leptResolution_", fabs(isoMuons[l2IndMatched]->pt()-muonRefs_[0]->pt())/isoMuons[l2IndMatched]->pt() );
784  }
785  }
786  if (l1Matched && l2Matched) fill("matchingMon_", 2.5 );
787  }
788 // }
789 
790  }
size
Write out results.
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:78
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
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecSelect_
extra selection on electrons
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
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
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::unique_ptr< StringCutObjectSelector< reco::Muon > > muonSelect_
extra selection on muons
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
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecIso_
extra isolation criterion on electron
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
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
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
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
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonIso_
extra isolation criterion on muon
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
static std::string const triggerPaths
Definition: EdmProvDump.cc:42
void MonitorDiLepton::fill ( const edm::Event event,
const edm::TriggerResults triggerTable,
const std::string &  channel,
const std::vector< std::string > &  labels 
) const
inlineprivate

fill trigger monitoring histograms

Definition at line 200 of file TopDiLeptonHLTOfflineDQM.h.

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

201  {
202  for(unsigned int idx=0; idx<labels.size(); ++idx){
203  if( acceptHLT(event, triggerTable, monitorPath(labels[idx])) ){
204  fill((channel+"Mon_").c_str(), idx+0.5 );
205  }
206  }
207  }
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 84 of file TopDiLeptonHLTOfflineDQM.h.

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

84 { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
U second(std::pair< T, U > const &p)
bool booked(const std::string &histName) const
check if histogram was booked
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 86 of file TopDiLeptonHLTOfflineDQM.h.

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

86 { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(xValue, yValue); };
U second(std::pair< T, U > const &p)
bool booked(const std::string &histName) const
check if histogram was booked
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 88 of file TopDiLeptonHLTOfflineDQM.h.

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

set labels for event logging histograms

Definition at line 165 of file TopDiLeptonHLTOfflineDQM.h.

References hists_.

Referenced by book(), and selectionPath().

166  {
167  // set axes titles for selected events
168  hists_[hist.c_str()]->getTH1()->SetOption("TEXT");
169  hists_[hist.c_str()]->setBinLabel( 1 , "Run" , 1);
170  hists_[hist.c_str()]->setBinLabel( 2 , "Block" , 1);
171  hists_[hist.c_str()]->setBinLabel( 3 , "Event" , 1);
172  hists_[hist.c_str()]->setBinLabel( 6 , "pt_{L2L3}(jet1)" , 1);
173  hists_[hist.c_str()]->setBinLabel( 7 , "pt_{L2L3}(jet2)" , 1);
174  hists_[hist.c_str()]->setBinLabel( 8 , "MET_{Calo}" , 1);
175  hists_[hist.c_str()]->setAxisTitle("logged evts" , 2);
176 
177  if(hist=="diMuonLogger_"){
178  hists_[hist.c_str()]->setBinLabel( 4 , "pt(muon)" , 1);
179  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
180  }
181  if(hist=="diElecLogger_"){
182  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
183  hists_[hist.c_str()]->setBinLabel( 5 , "pt(elec)" , 1);
184  }
185  if(hist=="elecMuLogger_"){
186  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
187  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
188  }
189  }
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 69 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and triggerBinLabels().

69 { 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 72 of file TopDiLeptonHLTOfflineDQM.h.

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

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

set configurable labels for trigger monitoring histograms

Definition at line 192 of file TopDiLeptonHLTOfflineDQM.h.

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

Referenced by book(), and selectionPath().

193  {
194  for(unsigned int idx=0; idx<labels.size(); ++idx){
195  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
196  }
197  }
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 152 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

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

trigger paths for di electron channel

Definition at line 114 of file TopDiLeptonHLTOfflineDQM.h.

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

int HLTOfflineDQMTopDiLepton::MonitorDiLepton::diMuonLogged_
private

Definition at line 152 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

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

trigger paths for di muon channel

Definition at line 112 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 128 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

std::unique_ptr<StringCutObjectSelector<reco::GsfElectron> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::elecIso_
private

extra isolation criterion on electron

Definition at line 130 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

int HLTOfflineDQMTopDiLepton::MonitorDiLepton::elecMuLogged_
private

number of logged interesting events

Definition at line 152 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 110 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 95 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

std::unique_ptr<StringCutObjectSelector<reco::GsfElectron> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::elecSelect_
private

extra selection on electrons

Definition at line 132 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

electronId label

Definition at line 117 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

Definition at line 158 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

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

Definition at line 159 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

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

Definition at line 88 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by book(), and MonitorDiLepton().

bool HLTOfflineDQMTopDiLepton::MonitorDiLepton::hasRawTriggerSummary
private

Definition at line 106 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

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

histogram container

Definition at line 154 of file TopDiLeptonHLTOfflineDQM.h.

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

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

jetCorrector

Definition at line 140 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 142 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

std::unique_ptr<StringCutObjectSelector<reco::JetID> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::jetIDSelect_
private

extra jetID selection on calo jets

Definition at line 144 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

Definition at line 97 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 147 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 149 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 99 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

Definition at line 160 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

std::unique_ptr<StringCutObjectSelector<reco::Muon> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::muonIso_
private

extra isolation criterion on muon

Definition at line 135 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

Definition at line 161 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill().

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

Definition at line 96 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

std::unique_ptr<StringCutObjectSelector<reco::Muon> > HLTOfflineDQMTopDiLepton::MonitorDiLepton::muonSelect_
private

extra selection on muons

Definition at line 137 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

hlt objects

Definition at line 157 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

Definition at line 105 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

Definition at line 104 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

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

trigger table

Definition at line 102 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().

double HLTOfflineDQMTopDiLepton::MonitorDiLepton::upperEdge_
private

Definition at line 149 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by fill(), and MonitorDiLepton().