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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 METSignificanceProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~METSignificanceProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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::EDConsumerBase::consumes(), 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_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< double > rhoToken_
METSignificance
____________________________________________________________________________||
metsig::METSignificance * metSigAlgo_
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
METSignificanceProducer::~METSignificanceProducer ( )
virtual

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 
)
overridevirtual

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_, AK4PFJetsMCFlavourInfos_cfi::leptons, RazorAnalyzer::met, metSigAlgo_, metToken_, eostools::move(), slimmedMuons_cfi::pfCandidates, pfCandidatesToken_, pfjetsToken_, and rhoToken_.

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 &)
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().