CMS 3D CMS Logo

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

#include <PFMETProducer.h>

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

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

reco::METCovMatrix getMETCovMatrix (const edm::Event &event, const edm::EventSetup &, const edm::Handle< edm::View< reco::Candidate >> &input) const
 

Private Attributes

bool applyWeight_
 
bool calculateSignificance_
 
double globalThreshold_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
 
std::string jetResPhiType_
 
std::string jetResPtType_
 
std::string jetSFType_
 
double jetThreshold_
 
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
 
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
 
metsig::METSignificancemetSigAlgo_
 
edm::EDGetTokenT< double > rhoToken_
 
edm::InputTag src_
 
edm::ValueMap< float > const * weights_
 
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 57 of file PFMETProducer.h.

Constructor & Destructor Documentation

◆ PFMETProducer()

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

Definition at line 17 of file PFMETProducer.cc.

18  : src_(iConfig.getParameter<edm::InputTag>("src")),
20  calculateSignificance_(iConfig.getParameter<bool>("calculateSignificance")),
21  globalThreshold_(iConfig.getParameter<double>("globalThreshold")),
22  applyWeight_(iConfig.getParameter<bool>("applyWeight")),
23  weights_(nullptr) {
24  if (applyWeight_) {
25  edm::InputTag srcWeights = iConfig.getParameter<edm::InputTag>("srcWeights");
26  if (srcWeights.label().empty())
27  throw cms::Exception("InvalidInput") << "applyWeight set to True, but no weights given in PFMETProducer\n";
28  if (srcWeights.label() == src_.label())
29  edm::LogWarning("PFMETProducer")
30  << "Particle and weights collection have the same label. You may be applying the same weights twice.\n";
31  weightsToken_ = consumes<edm::ValueMap<float>>(srcWeights);
32  }
34  metSigAlgo_ = new metsig::METSignificance(iConfig);
35 
36  jetToken_ = mayConsume<edm::View<reco::Jet>>(iConfig.getParameter<edm::InputTag>("srcJets"));
37  std::vector<edm::InputTag> srcLeptonsTags = iConfig.getParameter<std::vector<edm::InputTag>>("srcLeptons");
38  for (std::vector<edm::InputTag>::const_iterator it = srcLeptonsTags.begin(); it != srcLeptonsTags.end(); it++) {
39  lepTokens_.push_back(mayConsume<edm::View<reco::Candidate>>(*it));
40  }
41 
42  jetSFType_ = iConfig.getParameter<std::string>("srcJetSF");
43  jetResPtType_ = iConfig.getParameter<std::string>("srcJetResPt");
44  jetResPhiType_ = iConfig.getParameter<std::string>("srcJetResPhi");
45  rhoToken_ = consumes<double>(iConfig.getParameter<edm::InputTag>("srcRho"));
46  }
47 
48  std::string alias = iConfig.exists("alias") ? iConfig.getParameter<std::string>("alias") : "";
49 
50  produces<reco::PFMETCollection>().setBranchAlias(alias);
51  }

References SiStripOfflineCRack_cfg::alias, applyWeight_, calculateSignificance_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), jetResPhiType_, jetResPtType_, jetSFType_, jetToken_, edm::InputTag::label(), lepTokens_, metSigAlgo_, METSignificance_cfi::METSignificance, rhoToken_, src_, HLT_2018_cff::srcWeights, AlCaHLTBitMon_QueryRunRegistry::string, and weightsToken_.

◆ ~PFMETProducer()

cms::PFMETProducer::~PFMETProducer ( )
inlineoverride

Definition at line 60 of file PFMETProducer.h.

60 {}

Member Function Documentation

◆ fillDescriptions()

void PFMETProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 132 of file PFMETProducer.cc.

132  {
134  desc.add<edm::InputTag>("src", edm::InputTag("particleFlow"));
135  desc.add<double>("globalThreshold", 0.);
136  desc.add<std::string>("alias", "@module_label");
137  desc.add<bool>("calculateSignificance", false);
138  desc.addOptional<edm::InputTag>("srcJets");
139  desc.addOptional<std::vector<edm::InputTag>>("srcLeptons");
140  desc.addOptional<std::string>("srcJetSF");
141  desc.addOptional<std::string>("srcJetResPt");
142  desc.addOptional<std::string>("srcJetResPhi");
143  desc.addOptional<edm::InputTag>("srcRho");
145  params.setAllowAnything(); // FIXME: This still needs to be defined in METSignficance
146  desc.addOptional<edm::ParameterSetDescription>("parameters", params);
147  edm::ParameterSetDescription desc1 = desc;
148  edm::ParameterSetDescription desc2 = desc;
149  desc1.add<bool>("applyWeight", false);
150  desc1.add<edm::InputTag>("srcWeights", edm::InputTag(""));
151  descriptions.add("pfMet", desc1);
152  desc2.add<bool>("applyWeight", true);
153  desc2.add<edm::InputTag>("srcWeights", edm::InputTag("puppiNoLep"));
154  descriptions.add("pfMetPuppi", desc2);
155  }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), HLT_2018_cff::InputTag, CalibrationSummaryClient_cfi::params, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ getMETCovMatrix()

reco::METCovMatrix PFMETProducer::getMETCovMatrix ( const edm::Event event,
const edm::EventSetup setup,
const edm::Handle< edm::View< reco::Candidate >> &  input 
) const
private

Definition at line 86 of file PFMETProducer.cc.

88  {
89  // leptons
90  std::vector<edm::Handle<reco::CandidateView>> leptons;
91  for (std::vector<edm::EDGetTokenT<edm::View<reco::Candidate>>>::const_iterator srcLeptons_i = lepTokens_.begin();
92  srcLeptons_i != lepTokens_.end();
93  ++srcLeptons_i) {
95  event.getByToken(*srcLeptons_i, leptons_i);
96  leptons.push_back(leptons_i);
97  /*
98  for ( reco::CandidateView::const_iterator lepton = leptons_i->begin();
99  lepton != leptons_i->end(); ++lepton ) {
100  leptons.push_back(*lepton);
101  }
102  */
103  }
104 
105  // jets
107  event.getByToken(jetToken_, inputJets);
108 
112 
114  event.getByToken(rhoToken_, rho);
115 
116  //Compute the covariance matrix and fill it
117  double sumPtUnclustered = 0;
119  leptons,
120  candInput,
121  *rho,
122  resPtObj,
123  resPhiObj,
124  resSFObj,
125  event.isRealData(),
127  weights_);
128 
129  return cov;
130  }

References JME::JetResolution::get(), JME::JetResolutionScaleFactor::get(), metsig::METSignificance::getCovariance(), HLT_2018_cff::inputJets, jetResPhiType_, jetResPtType_, jetSFType_, jetToken_, lepTokens_, HLT_2018_cff::leptons, metSigAlgo_, rhoToken_, singleTopDQM_cfi::setup, met_cff::sumPtUnclustered, and weights_.

Referenced by produce().

◆ produce()

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

Definition at line 54 of file PFMETProducer.cc.

54  {
56  event.getByToken(inputToken_, input);
57 
58  if (applyWeight_)
59  weights_ = &event.get(weightsToken_);
60 
61  METAlgo algo;
62  CommonMETData commonMETdata;
63  commonMETdata = algo.run(*input.product(), globalThreshold_, weights_);
64 
65  const math::XYZTLorentzVector p4(commonMETdata.mex, commonMETdata.mey, 0.0, commonMETdata.met);
66  const math::XYZPoint vtx(0.0, 0.0, 0.0);
67 
70  specific = pf.run(*input.product(), weights_);
71 
72  reco::PFMET pfmet(specific, commonMETdata.sumet, p4, vtx);
73  pfmet.setIsWeighted(applyWeight_);
74 
77  pfmet.setSignificanceMatrix(sigcov);
78  }
79 
80  auto pfmetcoll = std::make_unique<reco::PFMETCollection>();
81 
82  pfmetcoll->push_back(pfmet);
83  event.put(std::move(pfmetcoll));
84  }

References applyWeight_, calculateSignificance_, edm::ValueMap< T >::get(), getMETCovMatrix(), globalThreshold_, input, inputToken_, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, eostools::move(), p4, packedPFCandidateRefMixer_cfi::pf, reco::MET::setIsWeighted(), reco::MET::setSignificanceMatrix(), singleTopDQM_cfi::setup, timingPdfMaker::specific, CommonMETData::sumet, badGlobalMuonTaggersAOD_cff::vtx, weights_, and weightsToken_.

Member Data Documentation

◆ applyWeight_

bool cms::PFMETProducer::applyWeight_
private

Definition at line 83 of file PFMETProducer.h.

Referenced by PFMETProducer(), and produce().

◆ calculateSignificance_

bool cms::PFMETProducer::calculateSignificance_
private

Definition at line 71 of file PFMETProducer.h.

Referenced by PFMETProducer(), and produce().

◆ globalThreshold_

double cms::PFMETProducer::globalThreshold_
private

Definition at line 74 of file PFMETProducer.h.

Referenced by produce().

◆ inputToken_

edm::EDGetTokenT<edm::View<reco::Candidate> > cms::PFMETProducer::inputToken_
private

Definition at line 69 of file PFMETProducer.h.

Referenced by produce().

◆ jetResPhiType_

std::string cms::PFMETProducer::jetResPhiType_
private

Definition at line 81 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

◆ jetResPtType_

std::string cms::PFMETProducer::jetResPtType_
private

Definition at line 80 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

◆ jetSFType_

std::string cms::PFMETProducer::jetSFType_
private

Definition at line 79 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

◆ jetThreshold_

double cms::PFMETProducer::jetThreshold_
private

Definition at line 75 of file PFMETProducer.h.

◆ jetToken_

edm::EDGetTokenT<edm::View<reco::Jet> > cms::PFMETProducer::jetToken_
private

Definition at line 77 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

◆ lepTokens_

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

Definition at line 78 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

◆ metSigAlgo_

metsig::METSignificance* cms::PFMETProducer::metSigAlgo_
private

Definition at line 72 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

◆ rhoToken_

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

Definition at line 82 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

◆ src_

edm::InputTag cms::PFMETProducer::src_
private

Definition at line 68 of file PFMETProducer.h.

Referenced by PFMETProducer().

◆ weights_

edm::ValueMap<float> const* cms::PFMETProducer::weights_
private

Definition at line 85 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and produce().

◆ weightsToken_

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

Definition at line 84 of file PFMETProducer.h.

Referenced by PFMETProducer(), and produce().

CommonMETData::met
double met
Definition: CommonMETData.h:14
met_cff.sumPtUnclustered
sumPtUnclustered
Definition: met_cff.py:20
JME::JetResolution
Definition: JetResolution.h:17
METAlgo
Definition: METAlgo.h:29
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
input
static const std::string input
Definition: EdmProvDump.cc:48
cms::PFMETProducer::globalThreshold_
double globalThreshold_
Definition: PFMETProducer.h:74
SpecificPFMETData
MET made from Particle Flow Candidates.
Definition: SpecificPFMETData.h:12
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm::EDGetTokenT
Definition: EDGetToken.h:33
cms::PFMETProducer::lepTokens_
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
Definition: PFMETProducer.h:78
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::PFMETProducer::applyWeight_
bool applyWeight_
Definition: PFMETProducer.h:83
cms::PFMETProducer::metSigAlgo_
metsig::METSignificance * metSigAlgo_
Definition: PFMETProducer.h:72
CommonMETData
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
METSignificance_cfi.METSignificance
METSignificance
____________________________________________________________________________||
Definition: METSignificance_cfi.py:6
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
cmsdt::algo
algo
Definition: constants.h:164
cms::PFMETProducer::weightsToken_
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
Definition: PFMETProducer.h:84
CommonMETData::mex
double mex
Definition: CommonMETData.h:15
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
timingPdfMaker.specific
specific
Definition: timingPdfMaker.py:78
cms::PFMETProducer::inputToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: PFMETProducer.h:69
cms::PFMETProducer::jetResPhiType_
std::string jetResPhiType_
Definition: PFMETProducer.h:81
HLT_2018_cff.srcWeights
srcWeights
Definition: HLT_2018_cff.py:7335
cms::PFMETProducer::jetSFType_
std::string jetSFType_
Definition: PFMETProducer.h:79
DDAxes::rho
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::PFMETProducer::rhoToken_
edm::EDGetTokenT< double > rhoToken_
Definition: PFMETProducer.h:82
edm::LogWarning
Definition: MessageLogger.h:141
CommonMETData::sumet
double sumet
Definition: CommonMETData.h:18
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
edm::View
Definition: CaloClusterFwd.h:14
reco::PFMET
Definition: PFMET.h:18
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
cms::PFMETProducer::weights_
edm::ValueMap< float > const * weights_
Definition: PFMETProducer.h:85
HLT_2018_cff.leptons
leptons
Definition: HLT_2018_cff.py:24820
p4
double p4[4]
Definition: TauolaWrapper.h:92
cms::PFMETProducer::getMETCovMatrix
reco::METCovMatrix getMETCovMatrix(const edm::Event &event, const edm::EventSetup &, const edm::Handle< edm::View< reco::Candidate >> &input) const
Definition: PFMETProducer.cc:86
JME::JetResolutionScaleFactor
Definition: JetResolution.h:40
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::ValueMap::get
const_reference_type get(ProductID id, size_t idx) const
Definition: ValueMap.h:144
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
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:129
HLT_2018_cff.inputJets
inputJets
Definition: HLT_2018_cff.py:86469
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
PFSpecificAlgo
Definition: PFSpecificAlgo.h:28
JME::JetResolution::get
static const JetResolution get(const edm::EventSetup &, const std::string &)
Definition: JetResolution.cc:23
cms::Exception
Definition: Exception.h:70
cms::PFMETProducer::src_
edm::InputTag src_
Definition: PFMETProducer.h:68
cms::PFMETProducer::jetToken_
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
Definition: PFMETProducer.h:77
cms::PFMETProducer::calculateSignificance_
bool calculateSignificance_
Definition: PFMETProducer.h:71
event
Definition: event.py:1
CommonMETData::mey
double mey
Definition: CommonMETData.h:16
edm::InputTag
Definition: InputTag.h:15
cms::PFMETProducer::jetResPtType_
std::string jetResPtType_
Definition: PFMETProducer.h:80
reco::METCovMatrix
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:39