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) {
173 hists_[
"pvMult_" ] = store_.
book1D(
"PvMult" ,
"N_{pvs}" , 100, 0., 100.);
175 hists_[
"jetMult_" ] = store_.
book1D(
"JetMult" ,
"N_{20}(jet)" , 10, 0., 10.);
179 hists_[
"triggerMon_" ] = store_.
book1D(
"TriggerMon" ,
"Mon(trigger)" , nPaths, 0., nPaths);
181 hists_[
"massW_" ] = store_.
book1D(
"MassW" ,
"M(W)" , 60, 0., 300.);
183 hists_[
"massTop_" ] = store_.
book1D(
"MassTop" ,
"M(Top)" , 50, 0., 500.);
185 hists_[
"mMub_" ] = store_.
book1D(
"mMub" ,
"m_{#mub}" , 50, 0., 500.);
187 hists_[
"MTWm_" ] = store_.
book1D(
"MTWm" ,
"M_{T}^{W}(#mu)" , 60, 0., 300.);
189 hists_[
"mMTT_" ] = store_.
book1D(
"mMTT" ,
"M_{T}^{t}(#mu)" , 50, 0., 500.);
191 hists_[
"mEb_" ] = store_.
book1D(
"mEb" ,
"m_{eb}" , 50, 0., 500.);
193 hists_[
"MTWe_" ] = store_.
book1D(
"MTWe" ,
"M_{T}^{W}(e)" , 60, 0., 300.);
195 hists_[
"eMTT_" ] = store_.
book1D(
"eMTT" ,
"M_{T}^{t}(e)" , 50, 0., 500.);
199 hists_[
"jetMultBEff_"] = store_.
book1D(
"JetMultBProb",
"N_{20}(b/prob)" , 10, 0., 10.);
201 hists_[
"jetBDiscEff_"] = store_.
book1D(
"JetBDiscProb",
"Disc_{b/prob}(jet)", 25, 0., 2.5);
207 hists_[
"jetMultBVtx_"] = store_.
book1D(
"JetMultBVtx",
"N_{20}(b/vtx)" , 10, 0., 10.);
209 hists_[
"jetBDiscVtx_"] = store_.
book1D(
"JetBDiscVtx",
"Disc_{b/vtx}(Jet)", 35, -1., 6.);
211 hists_[
"eventLogger_"] = store_.
book2D(
"EventLogger",
"Logged Events" , 3, 0., 3., 4, 0., 4.);
213 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
214 hists_[
"eventLogger_"]->setBinLabel( 1 ,
"Run" , 1);
215 hists_[
"eventLogger_"]->setBinLabel( 2 ,
"Block" , 1);
216 hists_[
"eventLogger_"]->setBinLabel( 3 ,
"Event" , 1);
217 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts" , 2);
220 hists_[
"leptDeltaREta_"] = store_.
book2D(
"DeltaRMinEtaLepton",
"#Delta R_{min}(leptons) wrt #eta", 30, -3, 3, 10, 0., 0.1);
222 hists_[
"jetDeltaREta_"] = store_.
book2D(
"DeltaRMinEtaJet",
"#Delta R_{min}(jets) wrt #eta", 30, -3, 3, 10, 0., 0.1);
224 hists_[
"leptResolution_"] = store_.
book1D(
"ResIsoLeptons",
"#Delta p_{T}/p_{T}(matched leptons)", 20, 0., 0.1);
226 hists_[
"jetResolution_"] = store_.
book1D(
"ResIsoJets",
"#Delta p_{T}/p_{T}(matched jets)", 20, 0., 0.1);
228 hists_[
"matchingMon_"] = store_.
book1D(
"MatchingMon",
"Mon(matching)", 5, 0., 5.);
230 hists_[
"matchingMon_"]->setBinLabel( 1 ,
"iso lepton" );
231 hists_[
"matchingMon_"]->setBinLabel( 2 ,
"1st jet" );
232 hists_[
"matchingMon_"]->setBinLabel( 3 ,
"2nd jet" );
233 hists_[
"matchingMon_"]->setBinLabel( 4 ,
"3rd jet" );
234 hists_[
"matchingMon_"]->setBinLabel( 5 ,
"all " );
259 <<
"Vertex collection not found \n";
262 unsigned int pvMult = 0;
267 fill(
"pvMult_", pvMult );
282 <<
"Electron collection not found \n";
294 unsigned int eMultIso=0;
295 std::vector<const reco::GsfElectron*> isoElecs;
298 unsigned int idx = elec-elecs->begin();
302 if(!
elecIso_ || (*
elecIso_)(*elec)){
if(eMultIso == 0) e = *elec; isoElecs.push_back(&(*elec)); ++eMultIso;}
316 unsigned int mMultIso=0;
318 std::vector<const reco::Muon*> isoMuons;
321 <<
"Muon collection not found \n";
327 if(
muon->isGlobalMuon() ){
354 if(setup.
find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
360 <<
"------------------------------------------------------------------------------------- \n"
361 <<
" No JetCorrectionsRecord available from EventSetup: \n"
362 <<
" - Jets will not be corrected. \n"
363 <<
" - If you want to change this add the following lines to your cfg file: \n"
365 <<
" ## load jet corrections \n"
366 <<
" process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
367 <<
" process.prefer(\"ak5CaloL2L3\") \n"
369 <<
"------------------------------------------------------------------------------------- \n";
374 std::vector<reco::Jet> correctedJets;
375 unsigned int mult=0, multBEff=0, multBVtx=0;
380 <<
"Jet collection not found \n";
391 unsigned int idx =
jet-jets->begin();
392 if(
jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())){
393 if(!(*
jetIDSelect_)((*jetID)[jets->refAt(idx)]))
continue;
396 if(dynamic_cast<const reco::CaloJet*>(&*
jet)){
400 else if(dynamic_cast<const reco::PFJet*>(&*
jet)){
411 correctedJets.push_back(monitorJet);
417 double btagEffDisc = (*btagEff)[jetRef];
418 fill(
"jetBDiscEff_", btagEffDisc);
419 if( (*btagEff)[jetRef]>
btagEffWP_ ) ++multBEff;
426 double btagVtxDisc = (*btagVtx)[jetRef];
427 fill(
"jetBDiscVtx_", btagVtxDisc);
428 if( (*btagVtx)[jetRef]>
btagVtxWP_ ) {
if(multBVtx == 0) bJetCand = *
jet; ++multBVtx;}
433 fill(
"jetMult_" , mult );
434 fill(
"jetMultBEff_", multBEff);
436 fill(
"jetMultBVtx_", multBVtx);
451 if(met->begin()!=met->end()){
452 mET = *(met->begin());
466 double wMass = eventKinematics.
massWBoson (correctedJets);
467 double topMass = eventKinematics.
massTopQuark(correctedJets);
468 if(wMass>=0 && topMass>=0) {
fill(
"massW_" , wMass );
fill(
"massTop_" , topMass);}
472 if(
logged_<=
hists_.find(
"eventLogger_")->second->getNbinsY()){
476 double runID =
static_cast<double>(
event.eventAuxiliary().run());
477 double luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
478 double eventID =
static_cast<double>(
event.eventAuxiliary().event());
480 fill(
"eventLogger_", 1.5,
logged_+0.5, luminosityBlockID);
485 if(multBVtx != 0 && mMultIso == 1 ){
486 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
if (mtW == mtW)
fill(
"MTWm_",mtW);
487 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
if (Mlb == Mlb)
fill(
"mMub_", Mlb);
488 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
if (MTT == MTT)
fill(
"mMTT_", MTT);
491 if(multBVtx != 0 && eMultIso == 1 ){
492 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
if (mtW == mtW)
fill(
"MTWe_",mtW);
493 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
if (Mlb == Mlb)
fill(
"mEb_", Mlb);
494 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
if (MTT == MTT)
fill(
"eMTT_", MTT);
516 if(!rawTriggerEvent.
isValid()){
533 bool isInteresting =
false;
534 for (
unsigned int j=0;
j<triggerPaths.size();
j++) {
535 if (TString(name.c_str()).Contains(TString(triggerPaths[
j]), TString::kIgnoreCase)) isInteresting =
true;
537 if (!isInteresting)
continue;
539 const unsigned int triggerIndex = triggerNames.
triggerIndex(name);
541 const vector<string>& moduleLabels(hltConfig.
moduleLabels(triggerIndex));
542 const unsigned int moduleIndex(triggerTable->index(triggerIndex));
548 unsigned int kElec=0;
549 unsigned int kMuon=0;
551 for (
unsigned int k=0;
k<=moduleIndex; ++
k) {
552 const string& moduleLabel(moduleLabels[
k]);
553 const string moduleType(hltConfig.
moduleType(moduleLabel));
558 if (filterIndex<rawTriggerEvent->
size()) {
561 if (nElectrons>0) kElec =
k;
564 const unsigned int nMuons(
muonIds_.size());
565 if (nMuons>0) kMuon =
k;
568 const unsigned int nPFJets(
pfjetIds_.size());
569 if (nPFJets>0) kJet =
k;
575 if (filterIndex<aodTriggerEvent->
size()) {
578 if (nElectrons>0) kElec =
k;
581 const unsigned int nMuons(
muonIds_.size());
582 if (nMuons>0) kMuon =
k;
585 const unsigned int nPFJets(
pfjetIds_.size());
586 if (nPFJets>0) kJet =
k;
592 bool lMatched =
false;
593 bool j1Matched =
false;
594 bool j2Matched =
false;
595 bool j3Matched =
false;
598 double eDeltaRMin = 500.;
599 unsigned int eIndMatched = 500;
602 const string& moduleLabelElec(moduleLabels[kElec]);
603 const string moduleTypeElec(hltConfig.
moduleType(moduleLabelElec));
616 for (
unsigned int inde = 0; inde < isoElecs.size(); inde++) {
618 if (deltar < eDeltaRMin) {
623 if (eDeltaRMin <
DRMIN) lMatched =
true;
628 double mDeltaRMin = 500.;
629 unsigned int mIndMatched = 500;
631 const string& moduleLabelMuon(moduleLabels[kMuon]);
632 const string moduleTypeMuon(hltConfig.
moduleType(moduleLabelMuon));
645 for (
unsigned int indm = 0; indm < isoMuons.size(); indm++) {
647 if (deltar < mDeltaRMin) {
652 if (mDeltaRMin <
DRMIN) lMatched =
true;
656 const unsigned int nPFJets(
pfjetIds_.size());
658 double j1DeltaRMin = 500.;
659 double j2DeltaRMin = 500.;
660 double j3DeltaRMin = 500.;
661 unsigned int j1IndMatched = 500;
662 unsigned int j2IndMatched = 500;
663 unsigned int j3IndMatched = 500;
665 const string& moduleLabelJet(moduleLabels[kJet]);
666 const string moduleTypeJet(hltConfig.
moduleType(moduleLabelJet));
679 for (
unsigned int indj = 0; indj < correctedJets.size(); indj++) {
681 if (deltar1 < j1DeltaRMin) {j1DeltaRMin = deltar1; j1IndMatched = indj;}
684 if (deltar2 < j2DeltaRMin) {j2DeltaRMin = deltar2; j2IndMatched = indj;}
687 if (deltar3 < j3DeltaRMin) {j3DeltaRMin = deltar3; j3IndMatched = indj;}
691 if (nPFJets > 0 && j1DeltaRMin <
DRMIN) j1Matched =
true;
692 if (nPFJets > 1 && j2DeltaRMin <
DRMIN) j2Matched =
true;
693 if (nPFJets > 2 && j3DeltaRMin <
DRMIN) j3Matched =
true;
696 if (eIndMatched < 500) {
697 fill(
"leptDeltaREta_", isoElecs[eIndMatched]->
eta(), eDeltaRMin);
698 if (lMatched)
fill(
"leptResolution_", fabs(isoElecs[eIndMatched]->
pt()-
electronRefs_[0]->
pt())/isoElecs[eIndMatched]->
pt() );
701 if (mIndMatched < 500) {
702 fill(
"leptDeltaREta_", isoMuons[mIndMatched]->
eta(), mDeltaRMin);
703 if (lMatched)
fill(
"leptResolution_", fabs(isoMuons[mIndMatched]->
pt()-
muonRefs_[0]->
pt())/isoMuons[mIndMatched]->
pt() );
706 if (lMatched)
fill(
"matchingMon_", 0.5 );
707 else isMatched =
false;
709 if (j1IndMatched < 500) {
710 fill(
"jetDeltaREta_", correctedJets[j1IndMatched].
eta(), j1DeltaRMin);
712 fill(
"jetResolution_", fabs(correctedJets[j1IndMatched].
pt()-
pfjetRefs_[0]->
pt())/correctedJets[j1IndMatched].
pt() );
713 fill(
"matchingMon_", 1.5 );
715 else isMatched =
false;
716 if (j2IndMatched < 500) {
717 fill(
"jetDeltaREta_", correctedJets[j2IndMatched].
eta(), j2DeltaRMin);
719 fill(
"jetResolution_", fabs(correctedJets[j2IndMatched].
pt()-
pfjetRefs_[1]->
pt())/correctedJets[j2IndMatched].
pt() );
720 fill(
"matchingMon_", 2.5 );
722 else isMatched =
false;
723 if (j3IndMatched < 500) {
724 fill(
"jetDeltaREta_", correctedJets[j3IndMatched].
eta(), j3DeltaRMin);
726 fill(
"jetResolution_", fabs(correctedJets[j3IndMatched].
pt()-
pfjetRefs_[2]->
pt())/correctedJets[j3IndMatched].
pt() );
727 fill(
"matchingMon_", 3.5 );
729 else isMatched =
false;
733 if (isMatched)
fill(
"matchingMon_", 4.5 );
765 std::vector<edm::ParameterSet>
sel=cfg.
getParameter<std::vector<edm::ParameterSet> >(
"selection");
766 for(
unsigned int i=0;
i<sel.size(); ++
i){
777 if (
type ==
"muons"){
780 if (
type ==
"elecs"){
786 if (
type ==
"jets/pf"){
789 if (
type ==
"jets/calo"){
807 <<
"Config extraction failure with process name "
825 if(vertex->empty() || !(*vertexSelect_)(vertex->front()))
return;
848 for(std::vector<std::string>::const_iterator selIt2=
selectionOrder_.begin(); selIt2<=selIt; ++selIt2){
852 if(type2==
"Hlt" || type2==
"empty" )
continue;
858 if ( !passSel )
continue;
870 sel.second.second->book(i);
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
T getParameter(std::string const &) const
bool hasRawTriggerSummary
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
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< 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< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
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
tuple size
Write out results.
trigger::Vids electronIds_