25 namespace HLTOfflineDQMTopSingleLepton {
32 static const double WMASS = 80.4;
35 static const double DRMIN = 0.05;
38 label_(label), elecIso_(0), elecSelect_(0), pvSelect_(0), muonIso_(0), muonSelect_(0), jetIDSelect_(0), includeBTag_(
false), lowerEdge_(-1.), upperEdge_(-1.), logged_(0)
46 const auto& mets = sources.
getParameter<std::vector<edm::InputTag>>(
"mets");
47 for (
const auto&
met: mets) {
171 hists_[
"pvMult_" ] = store_.
book1D(
"PvMult" ,
"N_{pvs}" , 100, 0., 100.);
173 hists_[
"jetMult_" ] = store_.
book1D(
"JetMult" ,
"N_{20}(jet)" , 10, 0., 10.);
177 hists_[
"triggerMon_" ] = store_.
book1D(
"TriggerMon" ,
"Mon(trigger)" , nPaths, 0., nPaths);
179 hists_[
"massW_" ] = store_.
book1D(
"MassW" ,
"M(W)" , 60, 0., 300.);
181 hists_[
"massTop_" ] = store_.
book1D(
"MassTop" ,
"M(Top)" , 50, 0., 500.);
183 hists_[
"mMub_" ] = store_.
book1D(
"mMub" ,
"m_{#mub}" , 50, 0., 500.);
185 hists_[
"MTWm_" ] = store_.
book1D(
"MTWm" ,
"M_{T}^{W}(#mu)" , 60, 0., 300.);
187 hists_[
"mMTT_" ] = store_.
book1D(
"mMTT" ,
"M_{T}^{t}(#mu)" , 50, 0., 500.);
189 hists_[
"mEb_" ] = store_.
book1D(
"mEb" ,
"m_{eb}" , 50, 0., 500.);
191 hists_[
"MTWe_" ] = store_.
book1D(
"MTWe" ,
"M_{T}^{W}(e)" , 60, 0., 300.);
193 hists_[
"eMTT_" ] = store_.
book1D(
"eMTT" ,
"M_{T}^{t}(e)" , 50, 0., 500.);
197 hists_[
"jetMultBEff_"] = store_.
book1D(
"JetMultBProb",
"N_{20}(b/prob)" , 10, 0., 10.);
199 hists_[
"jetBDiscEff_"] = store_.
book1D(
"JetBDiscProb",
"Disc_{b/prob}(jet)", 25, 0., 2.5);
201 hists_[
"jetMultBPur_"] = store_.
book1D(
"JetMultBPur",
"N_{20}(b/pur)" , 10, 0., 10.);
203 hists_[
"jetBDiscPur_"] = store_.
book1D(
"JetBDiscPur",
"Disc_{b/pur}(Jet)", 100, 0., 10.);
205 hists_[
"jetMultBVtx_"] = store_.
book1D(
"JetMultBVtx",
"N_{20}(b/vtx)" , 10, 0., 10.);
207 hists_[
"jetBDiscVtx_"] = store_.
book1D(
"JetBDiscVtx",
"Disc_{b/vtx}(Jet)", 35, -1., 6.);
209 hists_[
"eventLogger_"] = store_.
book2D(
"EventLogger",
"Logged Events" , 3, 0., 3., 4, 0., 4.);
211 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
212 hists_[
"eventLogger_"]->setBinLabel( 1 ,
"Run" , 1);
213 hists_[
"eventLogger_"]->setBinLabel( 2 ,
"Block" , 1);
214 hists_[
"eventLogger_"]->setBinLabel( 3 ,
"Event" , 1);
215 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts" , 2);
218 hists_[
"leptDeltaREta_"] = store_.
book2D(
"DeltaRMinEtaLepton",
"#Delta R_{min}(leptons) wrt #eta", 30, -3, 3, 10, 0., 0.1);
220 hists_[
"jetDeltaREta_"] = store_.
book2D(
"DeltaRMinEtaJet",
"#Delta R_{min}(jets) wrt #eta", 30, -3, 3, 10, 0., 0.1);
222 hists_[
"leptResolution_"] = store_.
book1D(
"ResIsoLeptons",
"#Delta p_{T}/p_{T}(matched leptons)", 20, 0., 0.1);
224 hists_[
"jetResolution_"] = store_.
book1D(
"ResIsoJets",
"#Delta p_{T}/p_{T}(matched jets)", 20, 0., 0.1);
226 hists_[
"matchingMon_"] = store_.
book1D(
"MatchingMon",
"Mon(matching)", 5, 0., 5.);
228 hists_[
"matchingMon_"]->setBinLabel( 1 ,
"iso lepton" );
229 hists_[
"matchingMon_"]->setBinLabel( 2 ,
"1st jet" );
230 hists_[
"matchingMon_"]->setBinLabel( 3 ,
"2nd jet" );
231 hists_[
"matchingMon_"]->setBinLabel( 4 ,
"3rd jet" );
232 hists_[
"matchingMon_"]->setBinLabel( 5 ,
"all " );
257 <<
"Vertex collection not found \n";
260 unsigned int pvMult = 0;
265 fill(
"pvMult_", pvMult );
279 <<
"Electron collection not found \n";
290 unsigned int eMultIso=0;
291 std::vector<const reco::GsfElectron*> isoElecs;
294 unsigned int idx = elec-elecs->begin();
298 if(!
elecIso_ || (*
elecIso_)(*elec)){
if(eMultIso == 0) e = *elec; isoElecs.push_back(&(*elec)); ++eMultIso;}
312 unsigned int mMultIso=0;
314 std::vector<const reco::Muon*> isoMuons;
317 <<
"Muon collection not found \n";
323 if(
muon->isGlobalMuon() ){
350 if(setup.
find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
356 <<
"------------------------------------------------------------------------------------- \n"
357 <<
" No JetCorrectionsRecord available from EventSetup: \n"
358 <<
" - Jets will not be corrected. \n"
359 <<
" - If you want to change this add the following lines to your cfg file: \n"
361 <<
" ## load jet corrections \n"
362 <<
" process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
363 <<
" process.prefer(\"ak5CaloL2L3\") \n"
365 <<
"------------------------------------------------------------------------------------- \n";
370 std::vector<reco::Jet> correctedJets;
371 unsigned int mult=0, multBEff=0, multBPur=0, multBVtx=0;
376 <<
"Jet collection not found \n";
387 unsigned int idx =
jet-jets->begin();
388 if(
jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())){
389 if(!(*
jetIDSelect_)((*jetID)[jets->refAt(idx)]))
continue;
392 if(dynamic_cast<const reco::CaloJet*>(&*
jet)){
396 else if(dynamic_cast<const reco::PFJet*>(&*
jet)){
407 correctedJets.push_back(monitorJet);
413 double btagEffDisc = (*btagEff)[jetRef];
414 fill(
"jetBDiscEff_", btagEffDisc);
415 if( (*btagEff)[jetRef]>
btagEffWP_ ) ++multBEff;
417 double btagPurDisc = (*btagPur)[jetRef];
418 fill(
"jetBDiscPur_", btagPurDisc);
419 if( (*btagPur)[jetRef]>
btagPurWP_ ) {
if(multBPur == 0) bJetCand = *
jet; ++multBPur;}
421 double btagVtxDisc = (*btagVtx)[jetRef];
422 fill(
"jetBDiscVtx_", btagVtxDisc);
423 if( (*btagVtx)[jetRef]>
btagVtxWP_ ) ++multBVtx;
426 fill(
"jetMult_" , mult );
427 fill(
"jetMultBEff_", multBEff);
428 fill(
"jetMultBPur_", multBPur);
429 fill(
"jetMultBVtx_", multBVtx);
444 if(met->begin()!=met->end()){
445 mET = *(met->begin());
459 double wMass = eventKinematics.
massWBoson (correctedJets);
460 double topMass = eventKinematics.
massTopQuark(correctedJets);
461 if(wMass>=0 && topMass>=0) {
fill(
"massW_" , wMass );
fill(
"massTop_" , topMass);}
465 if(
logged_<=
hists_.find(
"eventLogger_")->second->getNbinsY()){
469 double runID =
static_cast<double>(
event.eventAuxiliary().run());
470 double luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
471 double eventID =
static_cast<double>(
event.eventAuxiliary().event());
473 fill(
"eventLogger_", 1.5,
logged_+0.5, luminosityBlockID);
478 if(multBPur != 0 && mMultIso == 1 ){
479 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
if (mtW == mtW)
fill(
"MTWm_",mtW);
480 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
if (Mlb == Mlb)
fill(
"mMub_", Mlb);
481 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
if (MTT == MTT)
fill(
"mMTT_", MTT);
484 if(multBPur != 0 && eMultIso == 1 ){
485 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
if (mtW == mtW)
fill(
"MTWe_",mtW);
486 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
if (Mlb == Mlb)
fill(
"mEb_", Mlb);
487 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
if (MTT == MTT)
fill(
"eMTT_", MTT);
507 bool isInteresting =
false;
508 for (
unsigned int j=0;
j<triggerPaths.size();
j++) {
509 if (TString(name.c_str()).Contains(TString(triggerPaths[
j]), TString::kIgnoreCase)) isInteresting =
true;
511 if (!isInteresting)
continue;
513 const unsigned int triggerIndex = triggerNames.
triggerIndex(name);
515 const vector<string>& moduleLabels(hltConfig.
moduleLabels(triggerIndex));
516 const unsigned int moduleIndex(triggerTable->index(triggerIndex));
522 unsigned int kElec=0;
523 unsigned int kMuon=0;
525 for (
unsigned int k=0;
k<=moduleIndex; ++
k) {
526 const string& moduleLabel(moduleLabels[
k]);
527 const string moduleType(hltConfig.
moduleType(moduleLabel));
530 if (filterIndex<triggerEventWithRefsHandle->
size()) {
533 if (nElectrons>0) kElec =
k;
536 const unsigned int nMuons(
muonIds_.size());
537 if (nMuons>0) kMuon =
k;
540 const unsigned int nPFJets(
pfjetIds_.size());
541 if (nPFJets>0) kJet =
k;
545 bool lMatched =
false;
546 bool j1Matched =
false;
547 bool j2Matched =
false;
548 bool j3Matched =
false;
550 double eDeltaRMin = 500.;
551 unsigned int eIndMatched = 500;
554 const string& moduleLabelElec(moduleLabels[kElec]);
555 const string moduleTypeElec(hltConfig.
moduleType(moduleLabelElec));
556 const unsigned int filterIndexElec(triggerEventWithRefsHandle->filterIndex(
edm::InputTag(moduleLabelElec,
"",
processName_)));
558 for (
unsigned int inde = 0; inde < isoElecs.size(); inde++) {
560 if (deltar < eDeltaRMin) {
565 if (eDeltaRMin <
DRMIN) lMatched =
true;
569 double mDeltaRMin = 500.;
570 unsigned int mIndMatched = 500;
572 const string& moduleLabelMuon(moduleLabels[kMuon]);
573 const string moduleTypeMuon(hltConfig.
moduleType(moduleLabelMuon));
574 const unsigned int filterIndexMuon(triggerEventWithRefsHandle->filterIndex(
edm::InputTag(moduleLabelMuon,
"",
processName_)));
576 for (
unsigned int indm = 0; indm < isoMuons.size(); indm++) {
578 if (deltar < mDeltaRMin) {
583 if (mDeltaRMin <
DRMIN) lMatched =
true;
586 const unsigned int nPFJets(
pfjetIds_.size());
588 double j1DeltaRMin = 500.;
589 double j2DeltaRMin = 500.;
590 double j3DeltaRMin = 500.;
591 unsigned int j1IndMatched = 500;
592 unsigned int j2IndMatched = 500;
593 unsigned int j3IndMatched = 500;
595 const string& moduleLabelJet(moduleLabels[kJet]);
596 const string moduleTypeJet(hltConfig.
moduleType(moduleLabelJet));
597 const unsigned int filterIndexJet(triggerEventWithRefsHandle->filterIndex(
edm::InputTag(moduleLabelJet,
"",
processName_)));
599 for (
unsigned int indj = 0; indj < correctedJets.size(); indj++) {
601 if (deltar1 < j1DeltaRMin) {j1DeltaRMin = deltar1; j1IndMatched = indj;}
604 if (deltar2 < j2DeltaRMin) {j2DeltaRMin = deltar2; j2IndMatched = indj;}
607 if (deltar3 < j3DeltaRMin) {j3DeltaRMin = deltar3; j3IndMatched = indj;}
611 if (nPFJets > 0 && j1DeltaRMin <
DRMIN) j1Matched =
true;
612 if (nPFJets > 1 && j2DeltaRMin <
DRMIN) j2Matched =
true;
613 if (nPFJets > 2 && j3DeltaRMin <
DRMIN) j3Matched =
true;
615 if (eIndMatched < 500) {
616 fill(
"leptDeltaREta_", isoElecs[eIndMatched]->
eta(), eDeltaRMin);
617 if (lMatched)
fill(
"leptResolution_", fabs(isoElecs[eIndMatched]->
pt()-
electronRefs_[0]->
pt())/isoElecs[eIndMatched]->
pt() );
619 if (mIndMatched < 500) {
620 fill(
"leptDeltaREta_", isoMuons[mIndMatched]->
eta(), mDeltaRMin);
621 if (lMatched)
fill(
"leptResolution_", fabs(isoMuons[mIndMatched]->
pt()-
muonRefs_[0]->
pt())/isoMuons[mIndMatched]->
pt() );
623 if (lMatched)
fill(
"matchingMon_", 0.5 );
624 else isMatched =
false;
625 if (j1IndMatched < 500) {
626 fill(
"jetDeltaREta_", correctedJets[j1IndMatched].
eta(), j1DeltaRMin);
628 fill(
"jetResolution_", fabs(correctedJets[j1IndMatched].
pt()-
pfjetRefs_[0]->
pt())/correctedJets[j1IndMatched].
pt() );
629 fill(
"matchingMon_", 1.5 );
631 else isMatched =
false;
632 if (j2IndMatched < 500) {
633 fill(
"jetDeltaREta_", correctedJets[j2IndMatched].
eta(), j2DeltaRMin);
635 fill(
"jetResolution_", fabs(correctedJets[j2IndMatched].
pt()-
pfjetRefs_[1]->
pt())/correctedJets[j2IndMatched].
pt() );
636 fill(
"matchingMon_", 2.5 );
638 else isMatched =
false;
639 if (j3IndMatched < 500) {
640 fill(
"jetDeltaREta_", correctedJets[j3IndMatched].
eta(), j3DeltaRMin);
642 fill(
"jetResolution_", fabs(correctedJets[j3IndMatched].
pt()-
pfjetRefs_[2]->
pt())/correctedJets[j3IndMatched].
pt() );
643 fill(
"matchingMon_", 3.5 );
645 else isMatched =
false;
649 if (isMatched)
fill(
"matchingMon_", 4.5 );
681 std::vector<edm::ParameterSet>
sel=cfg.
getParameter<std::vector<edm::ParameterSet> >(
"selection");
682 for(
unsigned int i=0;
i<sel.size(); ++
i){
693 if (
type ==
"muons"){
696 if (
type ==
"elecs"){
702 if (
type ==
"jets/pf"){
705 if (
type ==
"jets/calo"){
723 <<
"Config extraction failure with process name "
741 if(vertex->empty() || !(*vertexSelect_)(vertex->front()))
return;
764 for(std::vector<std::string>::const_iterator selIt2=
selectionOrder_.begin(); selIt2<=selIt; ++selIt2){
768 if(type2==
"Hlt" || type2==
"empty" )
continue;
774 if ( !passSel )
continue;
786 sel.second.second->book(i);
T getParameter(std::string const &) const
const std::string moduleType(const std::string &module) const
C++ class name of module.
HLTConfigProvider hltConfig_
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Jets made from CaloTowers.
virtual void scaleEnergy(double fScale)
scale energy of the jet
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
std::map< std::string, SelectionStepHLTBase * > selectmap_
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
double masslb(reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
calculate mlb estimate
double massTopQuark(const std::vector< reco::Jet > &jets)
calculate top quark mass estimate
static const double WMASS
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int logged_
number of logged interesting events
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
std::string jetCorrector_
jetCorrector
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
Base class for all types of Jets.
double tmassTopQuark(reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
calculate top quark transverse mass estimate
StringCutObjectSelector< reco::Vertex > * pvSelect_
extra selection on primary vertices; meant to investigate the pile-up effect
std::map< std::string, MonitorElement * > hists_
histogram container
double massWBoson(const std::vector< reco::Jet > &jets)
calculate W boson mass estimate
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
trigger::VRelectron electronRefs_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
std::string selectionStep(const std::string &label)
double lowerEdge_
mass window upper and lower edge
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
void book(DQMStore::IBooker &store_)
book histograms in subdirectory directory
std::vector< std::string > selectionOrder_
Strings const & triggerNames() const
Jets made from PFObjects.
static const double DRMIN
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
static const unsigned int MAXJETS
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerEventWithRefsTag_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
unsigned int triggerIndex(std::string const &name) const
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
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
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
std::map< std::string, std::pair< edm::ParameterSet, HLTOfflineDQMTopSingleLepton::MonitorSingleLepton * > > selection_
std::vector< std::string > triggerPaths_
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
MonitorElement * book1D(Args &&...args)
std::string label_
instance label
bool isMatched(TrackingRecHit const &hit)
void triggerBinLabels(std::string channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
trigger::VRpfjet pfjetRefs_
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
double tmassWBoson(reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
calculate W boson transverse mass estimate
const std::string & processName() const
process name
std::vector< std::string > triggerPaths_
trigger paths
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c)
do this during the event loop
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)
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
void setCurrentFolder(const std::string &fullpath)
std::string processName_
hlt objects
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
MonitorElement * book2D(Args &&...args)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
double btagEffWP_
btag working points
static const double DRMIN
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
std::string objectType(const std::string &label)
TopSingleLeptonHLTOfflineDQM(const edm::ParameterSet &cfg)
default constructor
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
trigger::VRmuon muonRefs_
bool isUninitialized() const
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
volatile std::atomic< bool > shutdown_flag false
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
static std::string const triggerPaths
static const double WMASS
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
trigger::Vids electronIds_