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 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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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(), lepTokens_, metSigAlgo_, METSignificance_cfi::METSignificance, metToken_, pfCandidatesToken_, and pfjetsToken_.

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  metSigAlgo_ = new metsig::METSignificance(iConfig);
31 
32  produces<double>("METSignificance");
33  produces<math::Error<2>::type>("METCovariance");
34 
35  }
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)
tuple METSignificance
____________________________________________________________________________||
metsig::METSignificance * metSigAlgo_
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
virtual cms::METSignificanceProducer::~METSignificanceProducer ( )
inlinevirtual

Definition at line 51 of file METSignificanceProducer.h.

51 { }

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 38 of file METSignificanceProducer.cc.

References metsig::METSignificance::getCovariance(), metsig::METSignificance::getSignificance(), fwrapper::jets, lepTokens_, HLT_25ns14e33_v1_cff::leptons, objects.METAnalyzer::met, metSigAlgo_, metToken_, reco::tau::pfCandidates(), pfCandidatesToken_, and pfjetsToken_.

39  {
40  //
41  // met
42  //
44  event.getByToken(metToken_, metHandle);
45  const reco::MET& met = (*metHandle)[0];
46 
47  //
48  // candidates
49  //
51  event.getByToken( pfCandidatesToken_, pfCandidates );
52 
53  //
54  // leptons
55  //
56  std::vector< edm::Handle<reco::CandidateView> > leptons;
57  for ( std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > >::const_iterator srcLeptons_i = lepTokens_.begin();
58  srcLeptons_i != lepTokens_.end(); ++srcLeptons_i ) {
59 
61  event.getByToken(*srcLeptons_i, leptons_i);
62  leptons.push_back( leptons_i );
63 
64  }
65 
66  //
67  // jets
68  //
70  event.getByToken( pfjetsToken_, jets );
71 
72  //
73  // compute the significance
74  //
75  const reco::METCovMatrix cov = metSigAlgo_->getCovariance( *jets, leptons, *pfCandidates);
76  double sig = metSigAlgo_->getSignificance(cov, met);
77 
78  std::auto_ptr<double> significance (new double);
79  (*significance) = sig;
80 
82  (*covPtr)(0,0) = cov(0,0);
83  (*covPtr)(1,0) = cov(1,0);
84  (*covPtr)(1,1) = cov(1,1);
85 
86  event.put( covPtr, "METCovariance" );
87  event.put( significance, "METSignificance" );
88 
89  }
type
Definition: HCALResponse.h:21
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:40
ErrorD< N >::type type
Definition: Error.h:39
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
Definition: MET.h:42
vector< PseudoJet > jets
reco::METCovMatrix getCovariance(const edm::View< reco::Jet > &jets, const std::vector< edm::Handle< reco::CandidateView > > &leptons, const edm::View< reco::Candidate > &pfCandidates)
metsig::METSignificance * metSigAlgo_
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
double getSignificance(const reco::METCovMatrix &cov, const reco::MET &met) const
edm::EDGetTokenT< edm::View< reco::MET > > metToken_

Member Data Documentation

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

Definition at line 63 of file METSignificanceProducer.h.

Referenced by METSignificanceProducer(), and produce().

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