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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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_
 

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 47 of file METSignificanceProducer.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file METSignificanceProducer.cc.

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

18  {
19 
20  std::vector<edm::InputTag> srcLeptonsTags = iConfig.getParameter< std::vector<edm::InputTag> >("srcLeptons");
21  for(std::vector<edm::InputTag>::const_iterator it=srcLeptonsTags.begin();it!=srcLeptonsTags.end();it++) {
22  lepTokens_.push_back( consumes<edm::View<reco::Candidate> >( *it ) );
23  }
24 
25  pfjetsToken_ = consumes<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>("srcPfJets"));
26 
27  metToken_ = consumes<edm::View<reco::MET> >(iConfig.getParameter<edm::InputTag>("srcMet"));
28  pfCandidatesToken_ = consumes<edm::View<reco::Candidate> >(iConfig.getParameter<edm::InputTag>("srcPFCandidates"));
29 
30  jetSFType_ = iConfig.getParameter<std::string>("srcJetSF");
31  jetResPtType_ = iConfig.getParameter<std::string>("srcJetResPt");
32  jetResPhiType_ = iConfig.getParameter<std::string>("srcJetResPhi");
33  rhoToken_ = consumes<double>(iConfig.getParameter<edm::InputTag>("srcRho"));
34 
35  metSigAlgo_ = new metsig::METSignificance(iConfig);
36 
37  produces<double>("METSignificance");
38  produces<math::Error<2>::type>("METCovariance");
39 
40  }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
edm::EDGetTokenT< double > rhoToken_
METSignificance
____________________________________________________________________________||
metsig::METSignificance * metSigAlgo_
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
METSignificanceProducer::~METSignificanceProducer ( )
override

Definition at line 42 of file METSignificanceProducer.cc.

References metSigAlgo_.

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

Member Function Documentation

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

Definition at line 48 of file METSignificanceProducer.cc.

References DEFINE_FWK_MODULE, JME::JetResolution::get(), JME::JetResolutionScaleFactor::get(), metsig::METSignificance::getCovariance(), metsig::METSignificance::getSignificance(), edm::EventBase::isRealData(), jetResPhiType_, jetResPtType_, fwrapper::jets, jetSFType_, lepTokens_, AK4GenJetFlavourInfos_cfi::leptons, RazorAnalyzer::met, metSigAlgo_, metToken_, eostools::move(), slimmedMuons_cfi::pfCandidates, pfCandidatesToken_, pfjetsToken_, rhoToken_, and met_cff::significance.

49  {
50  //
51  // met
52  //
54  event.getByToken(metToken_, metHandle);
55  const reco::MET& met = (*metHandle)[0];
56 
57  //
58  // candidates
59  //
61  event.getByToken( pfCandidatesToken_, pfCandidates );
62 
63  //
64  // leptons
65  //
66  std::vector< edm::Handle<reco::CandidateView> > leptons;
67  for ( std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > >::const_iterator srcLeptons_i = lepTokens_.begin();
68  srcLeptons_i != lepTokens_.end(); ++srcLeptons_i ) {
69 
71  event.getByToken(*srcLeptons_i, leptons_i);
72  leptons.push_back( leptons_i );
73 
74  }
75 
76  //
77  // jets
78  //
80  event.getByToken( pfjetsToken_, jets );
81 
83  event.getByToken(rhoToken_, rho);
84 
88 
89  //
90  // compute the significance
91  //
92  const reco::METCovMatrix cov = metSigAlgo_->getCovariance( *jets, leptons, pfCandidates, *rho, resPtObj, resPhiObj, resSFObj, event.isRealData() );
93  double sig = metSigAlgo_->getSignificance(cov, met);
94 
95  auto significance = std::make_unique<double>();
96  (*significance) = sig;
97 
99  (*covPtr)(0,0) = cov(0,0);
100  (*covPtr)(1,0) = cov(1,0);
101  (*covPtr)(1,1) = cov(1,1);
102 
103  event.put(std::move(covPtr), "METCovariance" );
104  event.put(std::move(significance), "METSignificance" );
105 
106  }
type
Definition: HCALResponse.h:21
static double getSignificance(const reco::METCovMatrix &cov, const reco::MET &met)
static const JetResolution get(const edm::EventSetup &, const std::string &)
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:40
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)
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
bool isRealData() const
Definition: EventBase.h:64
edm::EDGetTokenT< double > rhoToken_
Definition: MET.h:42
vector< PseudoJet > jets
met
===> hadronic RAZOR
static const JetResolutionScaleFactor get(const edm::EventSetup &, const std::string &)
significance
Definition: met_cff.py:30
metsig::METSignificance * metSigAlgo_
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 65 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

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

Definition at line 64 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

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

Definition at line 63 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

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

Definition at line 61 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

metsig::METSignificance* cms::METSignificanceProducer::metSigAlgo_
private
edm::EDGetTokenT<edm::View<reco::MET> > cms::METSignificanceProducer::metToken_
private

Definition at line 59 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

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

Definition at line 60 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

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

Definition at line 58 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

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

Definition at line 62 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().