CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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
 

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 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_
 

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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 15 of file PFMETProducer.cc.

References SiStripOfflineCRack_cfg::alias, calculateSignificance_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), jetResPhiType_, jetResPtType_, jetSFType_, jetToken_, lepTokens_, metSigAlgo_, METSignificance_cfi::METSignificance, rhoToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

17  calculateSignificance_(iConfig.getParameter<bool>("calculateSignificance")),
18  globalThreshold_(iConfig.getParameter<double>("globalThreshold")) {
20  metSigAlgo_ = new metsig::METSignificance(iConfig);
21 
22  jetToken_ = mayConsume<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>("srcJets"));
23  std::vector<edm::InputTag> srcLeptonsTags = iConfig.getParameter<std::vector<edm::InputTag> >("srcLeptons");
24  for (std::vector<edm::InputTag>::const_iterator it = srcLeptonsTags.begin(); it != srcLeptonsTags.end(); it++) {
25  lepTokens_.push_back(mayConsume<edm::View<reco::Candidate> >(*it));
26  }
27 
28  jetSFType_ = iConfig.getParameter<std::string>("srcJetSF");
29  jetResPtType_ = iConfig.getParameter<std::string>("srcJetResPt");
30  jetResPhiType_ = iConfig.getParameter<std::string>("srcJetResPhi");
31  rhoToken_ = consumes<double>(iConfig.getParameter<edm::InputTag>("srcRho"));
32  }
33 
34  std::string alias = iConfig.exists("alias") ? iConfig.getParameter<std::string>("alias") : "";
35 
36  produces<reco::PFMETCollection>().setBranchAlias(alias);
37  }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
Definition: PFMETProducer.h:77
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string jetResPtType_
Definition: PFMETProducer.h:79
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
Definition: PFMETProducer.h:76
metsig::METSignificance * metSigAlgo_
Definition: PFMETProducer.h:71
std::string jetSFType_
Definition: PFMETProducer.h:78
std::string jetResPhiType_
Definition: PFMETProducer.h:80
METSignificance
____________________________________________________________________________||
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: PFMETProducer.h:68
edm::EDGetTokenT< double > rhoToken_
Definition: PFMETProducer.h:81
cms::PFMETProducer::~PFMETProducer ( )
inlineoverride

Definition at line 60 of file PFMETProducer.h.

References input.

60 {}

Member Function Documentation

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 66 of file PFMETProducer.cc.

References DEFINE_FWK_MODULE, JME::JetResolution::get(), JME::JetResolutionScaleFactor::get(), metsig::METSignificance::getCovariance(), HLT_2018_cff::inputJets, edm::EventBase::isRealData(), jetResPhiType_, jetResPtType_, jetSFType_, jetToken_, lepTokens_, HLT_2018_cff::leptons, metSigAlgo_, and rhoToken_.

Referenced by produce().

68  {
69  // leptons
70  std::vector<edm::Handle<reco::CandidateView> > leptons;
71  for (std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > >::const_iterator srcLeptons_i = lepTokens_.begin();
72  srcLeptons_i != lepTokens_.end();
73  ++srcLeptons_i) {
75  event.getByToken(*srcLeptons_i, leptons_i);
76  leptons.push_back(leptons_i);
77  /*
78  for ( reco::CandidateView::const_iterator lepton = leptons_i->begin();
79  lepton != leptons_i->end(); ++lepton ) {
80  leptons.push_back(*lepton);
81  }
82  */
83  }
84 
85  // jets
87  event.getByToken(jetToken_, inputJets);
88 
92 
94  event.getByToken(rhoToken_, rho);
95 
96  //Compute the covariance matrix and fill it
97  double sumPtUnclustered = 0;
99  *inputJets, leptons, candInput, *rho, resPtObj, resPhiObj, resSFObj, event.isRealData(), sumPtUnclustered);
100 
101  return cov;
102  }
static const JetResolution get(const edm::EventSetup &, const std::string &)
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:39
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
Definition: PFMETProducer.h:77
std::string jetResPtType_
Definition: PFMETProducer.h:79
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
Definition: PFMETProducer.h:76
bool isRealData() const
Definition: EventBase.h:62
metsig::METSignificance * metSigAlgo_
Definition: PFMETProducer.h:71
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)
std::string jetSFType_
Definition: PFMETProducer.h:78
std::string jetResPhiType_
Definition: PFMETProducer.h:80
static const JetResolutionScaleFactor get(const edm::EventSetup &, const std::string &)
edm::EDGetTokenT< double > rhoToken_
Definition: PFMETProducer.h:81
void PFMETProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 40 of file PFMETProducer.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, calculateSignificance_, getMETCovMatrix(), globalThreshold_, input, inputToken_, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, eostools::move(), p4, packedPFCandidateRefMixer_cfi::pf, edm::Handle< T >::product(), PFSpecificAlgo::run(), METAlgo::run(), reco::MET::setSignificanceMatrix(), timingPdfMaker::specific, CommonMETData::sumet, and badGlobalMuonTaggersAOD_cff::vtx.

40  {
42  event.getByToken(inputToken_, input);
43 
44  METAlgo algo;
45  CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold_);
46 
47  const math::XYZTLorentzVector p4(commonMETdata.mex, commonMETdata.mey, 0.0, commonMETdata.met);
48  const math::XYZPoint vtx(0.0, 0.0, 0.0);
49 
51  SpecificPFMETData specific = pf.run(*input.product());
52 
53  reco::PFMET pfmet(specific, commonMETdata.sumet, p4, vtx);
54 
56  reco::METCovMatrix sigcov = getMETCovMatrix(event, setup, input);
57  pfmet.setSignificanceMatrix(sigcov);
58  }
59 
60  auto pfmetcoll = std::make_unique<reco::PFMETCollection>();
61 
62  pfmetcoll->push_back(pfmet);
63  event.put(std::move(pfmetcoll));
64  }
reco::METCovMatrix getMETCovMatrix(const edm::Event &event, const edm::EventSetup &, const edm::Handle< edm::View< reco::Candidate > > &input) const
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:39
static std::string const input
Definition: EdmProvDump.cc:48
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
CommonMETData run(const edm::View< reco::Candidate > &candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
double p4[4]
Definition: TauolaWrapper.h:92
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
MET made from Particle Flow Candidates.
SpecificPFMETData run(const edm::View< reco::Candidate > &pfCands)
T const * product() const
Definition: Handle.h:69
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: PFMETProducer.h:68
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

bool cms::PFMETProducer::calculateSignificance_
private

Definition at line 70 of file PFMETProducer.h.

Referenced by PFMETProducer(), and produce().

double cms::PFMETProducer::globalThreshold_
private

Definition at line 73 of file PFMETProducer.h.

Referenced by produce().

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

Definition at line 68 of file PFMETProducer.h.

Referenced by produce().

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

Definition at line 80 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

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

Definition at line 79 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

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

Definition at line 78 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

double cms::PFMETProducer::jetThreshold_
private

Definition at line 74 of file PFMETProducer.h.

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

Definition at line 76 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

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

Definition at line 77 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

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

Definition at line 71 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

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

Definition at line 81 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().