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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

std::string jetResPhiType_
 
std::string jetResPtType_
 
std::string jetSFType_
 
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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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.

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");
29  rhoToken_ = consumes<double>(iConfig.getParameter<edm::InputTag>("srcRho"));
30 
31  edm::InputTag srcWeights = iConfig.getParameter<edm::InputTag>("srcWeights");
32  if (!srcWeights.label().empty())
34 
35  metSigAlgo_ = new metsig::METSignificance(iConfig);
36 
37  produces<double>("METSignificance");
38  produces<math::Error<2>::type>("METCovariance");
39  }

References edm::ParameterSet::getParameter(), jetResPhiType_, jetResPtType_, jetSFType_, lepTokens_, metSigAlgo_, METSignificance_cfi::METSignificance, metToken_, pfCandidatesToken_, pfjetsToken_, rhoToken_, HLT_FULL_cff::srcWeights, AlCaHLTBitMon_QueryRunRegistry::string, and weightsToken_.

◆ ~METSignificanceProducer()

METSignificanceProducer::~METSignificanceProducer ( )
override

Definition at line 41 of file METSignificanceProducer.cc.

41 { delete metSigAlgo_; }

References metSigAlgo_.

Member Function Documentation

◆ produce()

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

Definition at line 44 of file METSignificanceProducer.cc.

44  {
45  //
46  // met
47  //
49  event.getByToken(metToken_, metHandle);
50  const reco::MET& met = (*metHandle)[0];
51 
52  //
53  // candidates
54  //
56  event.getByToken(pfCandidatesToken_, pfCandidates);
57 
58  //
59  // leptons
60  //
61  std::vector<edm::Handle<reco::CandidateView>> leptons;
62  for (std::vector<edm::EDGetTokenT<edm::View<reco::Candidate>>>::const_iterator srcLeptons_i = lepTokens_.begin();
63  srcLeptons_i != lepTokens_.end();
64  ++srcLeptons_i) {
66  event.getByToken(*srcLeptons_i, leptons_i);
67  leptons.push_back(leptons_i);
68  }
69 
70  //
71  // jets
72  //
74  event.getByToken(pfjetsToken_, jets);
75 
77  event.getByToken(rhoToken_, rho);
78 
81  event.getByToken(weightsToken_, weights);
82 
86 
87  //
88  // compute the significance
89  //
90  double sumPtUnclustered = 0;
91  const edm::ValueMap<float>* weightsPtr = nullptr;
92  if (met.isWeighted()) {
94  throw cms::Exception("InvalidInput")
95  << "MET is weighted (e.g. PUPPI), but no weights given in METSignificanceProducer\n";
96  weightsPtr = &*weights;
97  }
99  leptons,
100  pfCandidates,
101  *rho,
102  resPtObj,
103  resPhiObj,
104  resSFObj,
105  event.isRealData(),
107  weightsPtr);
108  double sig = metSigAlgo_->getSignificance(cov, met);
109 
110  auto significance = std::make_unique<double>();
111  (*significance) = sig;
112 
113  auto covPtr = std::make_unique<math::Error<2>::type>();
114  (*covPtr)(0, 0) = cov(0, 0);
115  (*covPtr)(1, 0) = cov(1, 0);
116  (*covPtr)(1, 1) = cov(1, 1);
117 
118  event.put(std::move(covPtr), "METCovariance");
119  event.put(std::move(significance), "METSignificance");
120  }

References JME::JetResolution::get(), JME::JetResolutionScaleFactor::get(), metsig::METSignificance::getCovariance(), metsig::METSignificance::getSignificance(), edm::EDGetTokenT< T >::isUninitialized(), jetResPhiType_, jetResPtType_, singleTopDQM_cfi::jets, jetSFType_, lepTokens_, HLT_FULL_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, HLT_FULL_cff::weights, and weightsToken_.

Member Data Documentation

◆ jetResPhiType_

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

Definition at line 62 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(), and produce().

◆ jetSFType_

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

Definition at line 60 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 63 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

met_cff.sumPtUnclustered
sumPtUnclustered
Definition: met_cff.py:19
JME::JetResolution
Definition: JetResolution.h:17
zmumugammaAnalyzer_cfi.pfCandidates
pfCandidates
Definition: zmumugammaAnalyzer_cfi.py:11
HLT_FULL_cff.leptons
leptons
Definition: HLT_FULL_cff.py:26281
cms::METSignificanceProducer::jetResPhiType_
std::string jetResPhiType_
Definition: METSignificanceProducer.h:62
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm::EDGetTokenT::isUninitialized
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
cms::METSignificanceProducer::lepTokens_
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
Definition: METSignificanceProducer.h:58
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
cms::METSignificanceProducer::metToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
Definition: METSignificanceProducer.h:56
METSignificance_cfi.METSignificance
METSignificance
____________________________________________________________________________||
Definition: METSignificance_cfi.py:6
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
reco::MET
Definition: MET.h:41
cms::METSignificanceProducer::pfCandidatesToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
Definition: METSignificanceProducer.h:57
cms::METSignificanceProducer::jetResPtType_
std::string jetResPtType_
Definition: METSignificanceProducer.h:61
cms::METSignificanceProducer::jetSFType_
std::string jetSFType_
Definition: METSignificanceProducer.h:60
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99170
cms::METSignificanceProducer::rhoToken_
edm::EDGetTokenT< double > rhoToken_
Definition: METSignificanceProducer.h:59
DDAxes::rho
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::METSignificanceProducer::pfjetsToken_
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
Definition: METSignificanceProducer.h:55
edm::View
Definition: CaloClusterFwd.h:14
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
cms::METSignificanceProducer::metSigAlgo_
metsig::METSignificance * metSigAlgo_
Definition: METSignificanceProducer.h:65
JME::JetResolutionScaleFactor
Definition: JetResolution.h:40
HLT_FULL_cff.srcWeights
srcWeights
Definition: HLT_FULL_cff.py:8647
JME::JetResolutionScaleFactor::get
static const JetResolutionScaleFactor get(const edm::EventSetup &, const std::string &)
Definition: JetResolution.cc:48
eostools.move
def move(src, dest)
Definition: eostools.py:511
cms::METSignificanceProducer::weightsToken_
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
Definition: METSignificanceProducer.h:63
edm::ValueMap< float >
metsig::METSignificance::getCovariance
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)
Definition: METSignificance.cc:46
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
metsig::METSignificance::getSignificance
static double getSignificance(const reco::METCovMatrix &cov, const reco::MET &met)
Definition: METSignificance.cc:183
JME::JetResolution::get
static const JetResolution get(const edm::EventSetup &, const std::string &)
Definition: JetResolution.cc:23
cms::Exception
Definition: Exception.h:70
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15
reco::METCovMatrix
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:39
met_cff.significance
significance
Definition: met_cff.py:18