CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::METSignificanceProducer Class Reference

#include <METSignificanceProducer.h>

Inheritance diagram for cms::METSignificanceProducer:
edm::stream::EDProducer<>

Public Member Functions

 METSignificanceProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~METSignificanceProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

std::string jetResPhiType_
 
JME::JetResolution::Token jetResPhiTypeToken_
 
std::string jetResPtType_
 
JME::JetResolution::Token jetResPtTypeToken_
 
std::string jetSFType_
 
JME::JetResolutionScaleFactor::Token jetSFTypeToken_
 
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
 
metsig::METSignificancemetSigAlgo_
 
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
 
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
 
edm::EDGetTokenT< double > rhoToken_
 
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 46 of file METSignificanceProducer.h.

Constructor & Destructor Documentation

◆ METSignificanceProducer()

METSignificanceProducer::METSignificanceProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 15 of file METSignificanceProducer.cc.

References deDxTools::esConsumes(), edm::ParameterSet::getParameter(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, jetResPhiType_, jetResPhiTypeToken_, jetResPtType_, jetResPtTypeToken_, jetSFType_, jetSFTypeToken_, lepTokens_, metSigAlgo_, METSignificance_cfi::METSignificance, metToken_, pfCandidatesToken_, pfjetsToken_, rhoToken_, HLT_2024v14_cff::srcWeights, AlCaHLTBitMon_QueryRunRegistry::string, and weightsToken_.

15  {
16  std::vector<edm::InputTag> srcLeptonsTags = iConfig.getParameter<std::vector<edm::InputTag>>("srcLeptons");
17  for (std::vector<edm::InputTag>::const_iterator it = srcLeptonsTags.begin(); it != srcLeptonsTags.end(); it++) {
18  lepTokens_.push_back(consumes<edm::View<reco::Candidate>>(*it));
19  }
20 
21  pfjetsToken_ = consumes<edm::View<reco::Jet>>(iConfig.getParameter<edm::InputTag>("srcPfJets"));
22 
23  metToken_ = consumes<edm::View<reco::MET>>(iConfig.getParameter<edm::InputTag>("srcMet"));
24  pfCandidatesToken_ = consumes<edm::View<reco::Candidate>>(iConfig.getParameter<edm::InputTag>("srcPFCandidates"));
25 
26  jetSFType_ = iConfig.getParameter<std::string>("srcJetSF");
27  jetResPtType_ = iConfig.getParameter<std::string>("srcJetResPt");
28  jetResPhiType_ = iConfig.getParameter<std::string>("srcJetResPhi");
32  rhoToken_ = consumes<double>(iConfig.getParameter<edm::InputTag>("srcRho"));
33 
34  edm::InputTag srcWeights = iConfig.getParameter<edm::InputTag>("srcWeights");
35  if (!srcWeights.label().empty())
37 
38  metSigAlgo_ = new metsig::METSignificance(iConfig);
39 
40  produces<double>("METSignificance");
41  produces<math::Error<2>::type>("METCovariance");
42  }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
JME::JetResolution::Token jetResPhiTypeToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
edm::EDGetTokenT< double > rhoToken_
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
METSignificance
____________________________________________________________________________||
metsig::METSignificance * metSigAlgo_
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
JME::JetResolutionScaleFactor::Token jetSFTypeToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
JME::JetResolution::Token jetResPtTypeToken_

◆ ~METSignificanceProducer()

METSignificanceProducer::~METSignificanceProducer ( )
override

Definition at line 44 of file METSignificanceProducer.cc.

References metSigAlgo_.

44 { delete metSigAlgo_; }
metsig::METSignificance * metSigAlgo_

Member Function Documentation

◆ produce()

void METSignificanceProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 47 of file METSignificanceProducer.cc.

References JME::JetResolution::get(), JME::JetResolutionScaleFactor::get(), metsig::METSignificance::getCovariance(), metsig::METSignificance::getSignificance(), edm::EDGetTokenT< T >::isUninitialized(), jetResPhiTypeToken_, jetResPtTypeToken_, PDWG_EXODelayedJetMET_cff::jets, jetSFTypeToken_, lepTokens_, HLT_2024v14_cff::leptons, BTaggingMonitor_cfi::met, metSigAlgo_, metToken_, eostools::move(), zmumugammaAnalyzer_cfi::pfCandidates, pfCandidatesToken_, pfjetsToken_, rhoToken_, singleTopDQM_cfi::setup, met_cff::significance, met_cff::sumPtUnclustered, trackerHitRTTI::vector, hltDeepSecondaryVertexTagInfosPFPuppi_cfi::weights, and weightsToken_.

47  {
48  //
49  // met
50  //
52  event.getByToken(metToken_, metHandle);
53  const reco::MET& met = (*metHandle)[0];
54 
55  //
56  // candidates
57  //
59  event.getByToken(pfCandidatesToken_, pfCandidates);
60 
61  //
62  // leptons
63  //
64  std::vector<edm::Handle<reco::CandidateView>> leptons;
65  for (std::vector<edm::EDGetTokenT<edm::View<reco::Candidate>>>::const_iterator srcLeptons_i = lepTokens_.begin();
66  srcLeptons_i != lepTokens_.end();
67  ++srcLeptons_i) {
69  event.getByToken(*srcLeptons_i, leptons_i);
70  leptons.push_back(leptons_i);
71  }
72 
73  //
74  // jets
75  //
77  event.getByToken(pfjetsToken_, jets);
78 
80  event.getByToken(rhoToken_, rho);
81 
84  event.getByToken(weightsToken_, weights);
85 
89 
90  //
91  // compute the significance
92  //
93  double sumPtUnclustered = 0;
94  const edm::ValueMap<float>* weightsPtr = nullptr;
95  if (met.isWeighted()) {
97  throw cms::Exception("InvalidInput")
98  << "MET is weighted (e.g. PUPPI), but no weights given in METSignificanceProducer\n";
99  weightsPtr = &*weights;
100  }
102  leptons,
103  pfCandidates,
104  *rho,
105  resPtObj,
106  resPhiObj,
107  resSFObj,
108  event.isRealData(),
110  weightsPtr);
111  double sig = metSigAlgo_->getSignificance(cov, met);
112 
113  auto significance = std::make_unique<double>();
114  (*significance) = sig;
115 
116  auto covPtr = std::make_unique<math::Error<2>::type>();
117  (*covPtr)(0, 0) = cov(0, 0);
118  (*covPtr)(1, 0) = cov(1, 0);
119  (*covPtr)(1, 1) = cov(1, 1);
120 
121  event.put(std::move(covPtr), "METCovariance");
122  event.put(std::move(significance), "METSignificance");
123  }
static const JetResolutionScaleFactor get(const edm::EventSetup &, const Token &)
reco::METCovMatrix getCovariance(const edm::View< reco::Jet > &jets, const std::vector< edm::Handle< reco::CandidateView > > &leptons, const edm::Handle< edm::View< reco::Candidate > > &pfCandidates, double rho, JME::JetResolution &resPtObj, JME::JetResolution &resPhiObj, JME::JetResolutionScaleFactor &resSFObj, bool isRealData, double &sumPtUnclustered, edm::ValueMap< float > const *weights=nullptr)
static double getSignificance(const reco::METCovMatrix &cov, const reco::MET &met)
JME::JetResolution::Token jetResPhiTypeToken_
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:39
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:98
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
edm::EDGetTokenT< double > rhoToken_
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
Definition: MET.h:41
significance
Definition: met_cff.py:20
metsig::METSignificance * metSigAlgo_
sumPtUnclustered
Definition: met_cff.py:22
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
JME::JetResolutionScaleFactor::Token jetSFTypeToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
static const JetResolution get(const edm::EventSetup &, const Token &)
JME::JetResolution::Token jetResPtTypeToken_

Member Data Documentation

◆ jetResPhiType_

std::string cms::METSignificanceProducer::jetResPhiType_
private

Definition at line 62 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer().

◆ jetResPhiTypeToken_

JME::JetResolution::Token cms::METSignificanceProducer::jetResPhiTypeToken_
private

Definition at line 65 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

◆ jetResPtType_

std::string cms::METSignificanceProducer::jetResPtType_
private

Definition at line 61 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer().

◆ jetResPtTypeToken_

JME::JetResolution::Token cms::METSignificanceProducer::jetResPtTypeToken_
private

Definition at line 64 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

◆ jetSFType_

std::string cms::METSignificanceProducer::jetSFType_
private

Definition at line 60 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer().

◆ jetSFTypeToken_

JME::JetResolutionScaleFactor::Token cms::METSignificanceProducer::jetSFTypeToken_
private

Definition at line 63 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

◆ lepTokens_

std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > > cms::METSignificanceProducer::lepTokens_
private

Definition at line 58 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

◆ metSigAlgo_

metsig::METSignificance* cms::METSignificanceProducer::metSigAlgo_
private

◆ metToken_

edm::EDGetTokenT<edm::View<reco::MET> > cms::METSignificanceProducer::metToken_
private

Definition at line 56 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

◆ pfCandidatesToken_

edm::EDGetTokenT<edm::View<reco::Candidate> > cms::METSignificanceProducer::pfCandidatesToken_
private

Definition at line 57 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

◆ pfjetsToken_

edm::EDGetTokenT<edm::View<reco::Jet> > cms::METSignificanceProducer::pfjetsToken_
private

Definition at line 55 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

◆ rhoToken_

edm::EDGetTokenT<double> cms::METSignificanceProducer::rhoToken_
private

Definition at line 59 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

◆ weightsToken_

edm::EDGetTokenT<edm::ValueMap<float> > cms::METSignificanceProducer::weightsToken_
private

Definition at line 66 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().