32 static const double WMASS = 80.4;
35 static const double DRMIN = 0.05;
38 label_(label), elecIso_(
nullptr), elecSelect_(
nullptr), pvSelect_(
nullptr), muonIso_(
nullptr), muonSelect_(
nullptr), jetIDSelect_(
nullptr), includeBTag_(
false), lowerEdge_(-1.), upperEdge_(-1.), logged_(0)
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;
425 double btagVtxDisc = (*btagVtx)[jetRef];
426 fill(
"jetBDiscVtx_", btagVtxDisc);
427 if( (*btagVtx)[jetRef]>
btagVtxWP_ ) {
if(multBVtx == 0) bJetCand= *
jet; ++multBVtx;}
431 fill(
"jetMult_" , mult );
432 fill(
"jetMultBEff_", multBEff);
434 fill(
"jetMultBVtx_", multBVtx);
446 for(
auto met_=
mets_.begin(); met_!=
mets_.end(); ++met_){
449 if(met->begin()!=met->end()){
450 mET = *(met->begin());
465 double topMass = eventKinematics.
massTopQuark(correctedJets);
466 if(wMass>=0 && topMass>=0) {
fill(
"massW_" , wMass );
fill(
"massTop_" , topMass);}
470 if(
logged_<=
hists_.find(
"eventLogger_")->second->getNbinsY()){
474 auto runID =
static_cast<double>(
event.eventAuxiliary().run());
475 auto luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
476 auto eventID =
static_cast<double>(
event.eventAuxiliary().event());
478 fill(
"eventLogger_", 1.5,
logged_+0.5, luminosityBlockID);
483 if(multBVtx != 0 && mMultIso == 1 ){
484 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
if (mtW == mtW)
fill(
"MTWm_",mtW);
485 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
if (Mlb == Mlb)
fill(
"mMub_", Mlb);
486 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
if (MTT == MTT)
fill(
"mMTT_", MTT);
489 if(multBVtx != 0 && eMultIso == 1 ){
490 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
if (mtW == mtW)
fill(
"MTWe_",mtW);
491 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
if (Mlb == Mlb)
fill(
"mEb_", Mlb);
492 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
if (MTT == MTT)
fill(
"eMTT_", MTT);
514 if(!rawTriggerEvent.
isValid()){
519 if(!aodTriggerEvent.
isValid()){
531 bool isInteresting =
false;
532 for (
auto const & triggerPath : triggerPaths) {
533 if (TString(name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase)) isInteresting =
true;
535 if (!isInteresting)
continue;
537 const unsigned int triggerIndex = triggerNames.
triggerIndex(name);
539 const vector<string>& moduleLabels(hltConfig.
moduleLabels(triggerIndex));
540 const unsigned int moduleIndex(triggerTable->
index(triggerIndex));
546 unsigned int kElec=0;
547 unsigned int kMuon=0;
549 for (
unsigned int k=0;
k<=moduleIndex; ++
k) {
550 const string& moduleLabel(moduleLabels[
k]);
551 const string moduleType(hltConfig.
moduleType(moduleLabel));
556 if (filterIndex<rawTriggerEvent->
size()) {
566 const unsigned int nPFJets(
pfjetIds_.size());
567 if (nPFJets>0) kJet =
k;
573 if (filterIndex<aodTriggerEvent->
size()) {
583 const unsigned int nPFJets(
pfjetIds_.size());
584 if (nPFJets>0) kJet =
k;
590 bool lMatched =
false;
591 bool j1Matched =
false;
592 bool j2Matched =
false;
593 bool j3Matched =
false;
596 double eDeltaRMin = 500.;
597 unsigned int eIndMatched = 500;
600 const string& moduleLabelElec(moduleLabels[kElec]);
601 const string moduleTypeElec(hltConfig.
moduleType(moduleLabelElec));
614 for (
unsigned int inde = 0; inde < isoElecs.size(); inde++) {
616 if (deltar < eDeltaRMin) {
621 if (eDeltaRMin < DRMIN) lMatched =
true;
626 double mDeltaRMin = 500.;
627 unsigned int mIndMatched = 500;
629 const string& moduleLabelMuon(moduleLabels[kMuon]);
630 const string moduleTypeMuon(hltConfig.
moduleType(moduleLabelMuon));
643 for (
unsigned int indm = 0; indm < isoMuons.size(); indm++) {
645 if (deltar < mDeltaRMin) {
650 if (mDeltaRMin < DRMIN) lMatched =
true;
654 const unsigned int nPFJets(
pfjetIds_.size());
656 double j1DeltaRMin = 500.;
657 double j2DeltaRMin = 500.;
658 double j3DeltaRMin = 500.;
659 unsigned int j1IndMatched = 500;
660 unsigned int j2IndMatched = 500;
661 unsigned int j3IndMatched = 500;
663 const string& moduleLabelJet(moduleLabels[kJet]);
664 const string moduleTypeJet(hltConfig.
moduleType(moduleLabelJet));
677 for (
unsigned int indj = 0; indj < correctedJets.size(); indj++) {
679 if (deltar1 < j1DeltaRMin) {j1DeltaRMin = deltar1; j1IndMatched = indj;}
682 if (deltar2 < j2DeltaRMin) {j2DeltaRMin = deltar2; j2IndMatched = indj;}
685 if (deltar3 < j3DeltaRMin) {j3DeltaRMin = deltar3; j3IndMatched = indj;}
689 if (nPFJets > 0 && j1DeltaRMin < DRMIN) j1Matched =
true;
690 if (nPFJets > 1 && j2DeltaRMin < DRMIN) j2Matched =
true;
691 if (nPFJets > 2 && j3DeltaRMin < DRMIN) j3Matched =
true;
694 if (eIndMatched < 500) {
695 fill(
"leptDeltaREta_", isoElecs[eIndMatched]->
eta(), eDeltaRMin);
696 if (lMatched)
fill(
"leptResolution_", fabs(isoElecs[eIndMatched]->
pt()-
electronRefs_[0]->
pt())/isoElecs[eIndMatched]->
pt() );
699 if (mIndMatched < 500) {
700 fill(
"leptDeltaREta_", isoMuons[mIndMatched]->
eta(), mDeltaRMin);
701 if (lMatched)
fill(
"leptResolution_", fabs(isoMuons[mIndMatched]->
pt()-
muonRefs_[0]->
pt())/isoMuons[mIndMatched]->
pt() );
704 if (lMatched)
fill(
"matchingMon_", 0.5 );
705 else isMatched =
false;
707 if (j1IndMatched < 500) {
708 fill(
"jetDeltaREta_", correctedJets[j1IndMatched].
eta(), j1DeltaRMin);
710 fill(
"jetResolution_", fabs(correctedJets[j1IndMatched].
pt()-
pfjetRefs_[0]->
pt())/correctedJets[j1IndMatched].
pt() );
711 fill(
"matchingMon_", 1.5 );
713 else isMatched =
false;
714 if (j2IndMatched < 500) {
715 fill(
"jetDeltaREta_", correctedJets[j2IndMatched].
eta(), j2DeltaRMin);
717 fill(
"jetResolution_", fabs(correctedJets[j2IndMatched].
pt()-
pfjetRefs_[1]->
pt())/correctedJets[j2IndMatched].
pt() );
718 fill(
"matchingMon_", 2.5 );
720 else isMatched =
false;
721 if (j3IndMatched < 500) {
722 fill(
"jetDeltaREta_", correctedJets[j3IndMatched].
eta(), j3DeltaRMin);
724 fill(
"jetResolution_", fabs(correctedJets[j3IndMatched].
pt()-
pfjetRefs_[2]->
pt())/correctedJets[j3IndMatched].
pt() );
725 fill(
"matchingMon_", 3.5 );
727 else isMatched =
false;
731 if (isMatched)
fill(
"matchingMon_", 4.5 );
763 std::vector<edm::ParameterSet>
sel=cfg.
getParameter<std::vector<edm::ParameterSet> >(
"selection");
775 if (
type ==
"muons"){
778 if (
type ==
"elecs"){
784 if (
type ==
"jets/pf"){
787 if (
type ==
"jets/calo"){
805 <<
"Config extraction failure with process name " 823 if(vertex->empty() || !(*vertexSelect_)(vertex->front()))
return;
850 if(type2==
"Hlt" || type2==
"empty" )
continue;
856 if ( !passSel )
continue;
868 sel.second.second->book(i);
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecSelect_
extra selection on electrons
T getParameter(std::string const &) const
bool hasRawTriggerSummary
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
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
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int logged_
number of logged interesting events
std::string jetCorrector_
jetCorrector
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
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
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
def setup(process, global_tag, zero_tesla=False)
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)
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
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
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonIso_
extra isolation criterion on muon
static const unsigned int MAXJETS
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
unsigned int triggerIndex(std::string const &name) const
void triggerBinLabels(const std::string &channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
do this during the event loop
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
std::vector< std::string > triggerPaths_
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
MonitorElement * book1D(Args &&...args)
std::string label_
instance label
bool isMatched(TrackingRecHit const &hit)
trigger::VRpfjet pfjetRefs_
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
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
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
const std::string & processName() const
process name
std::vector< std::string > triggerPaths_
trigger paths
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
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)
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)
double btagEffWP_
btag working points
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
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::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopSingleLepton::MonitorSingleLepton > > > selection_
std::string objectType(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonSelect_
extra selection on muons
TopSingleLeptonHLTOfflineDQM(const edm::ParameterSet &cfg)
default constructor
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
boost::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &) const
trigger::VRmuon muonRefs_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
extra selection on primary vertices; meant to investigate the pile-up effect
bool isUninitialized() const
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecIso_
extra isolation criterion on electron
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
static std::string const triggerPaths
static const double WMASS
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
trigger::Vids electronIds_