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

Public Member Functions

 PFMETProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~PFMETProducer ()
 
- 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
 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 Member Functions

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

Private Attributes

bool calculateSignificance_
 
double globalThreshold_
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
inputToken_
 
double jetThreshold_
 
edm::EDGetTokenT< edm::View
< reco::Jet > > 
jetToken_
 
std::vector< edm::EDGetTokenT
< edm::View< reco::Candidate > > > 
lepTokens_
 
metsig::METSignificancemetSigAlgo_
 

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
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 58 of file PFMETProducer.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file PFMETProducer.cc.

References HLT_25ns14e33_v1_cff::alias, calculateSignificance_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), jetToken_, lepTokens_, edm::EDConsumerBase::mayConsume(), metSigAlgo_, METSignificance_cfi::METSignificance, and AlCaHLTBitMon_QueryRunRegistry::string.

18  , calculateSignificance_(iConfig.getParameter<bool>("calculateSignificance"))
19  , globalThreshold_(iConfig.getParameter<double>("globalThreshold"))
20  {
22  {
23  metSigAlgo_ = new metsig::METSignificance(iConfig);
24 
25  jetToken_ = mayConsume<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>("srcJets"));
26  std::vector<edm::InputTag> srcLeptonsTags = iConfig.getParameter< std::vector<edm::InputTag> >("srcLeptons");
27  for(std::vector<edm::InputTag>::const_iterator it=srcLeptonsTags.begin();it!=srcLeptonsTags.end();it++) {
28  lepTokens_.push_back( mayConsume<edm::View<reco::Candidate> >( *it ) );
29  }
30 
31  }
32 
33  std::string alias = iConfig.exists("alias") ? iConfig.getParameter<std::string>("alias") : "";
34 
35  produces<reco::PFMETCollection>().setBranchAlias(alias);
36  }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
Definition: PFMETProducer.h:79
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
tuple METSignificance
____________________________________________________________________________||
metsig::METSignificance * metSigAlgo_
Definition: PFMETProducer.h:74
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
Definition: PFMETProducer.h:80
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: PFMETProducer.h:71
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
virtual cms::PFMETProducer::~PFMETProducer ( )
inlinevirtual

Definition at line 62 of file PFMETProducer.h.

62 { }

Member Function Documentation

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

Definition at line 70 of file PFMETProducer.cc.

References metsig::METSignificance::getCovariance(), HLT_25ns14e33_v1_cff::inputJets, jetToken_, lepTokens_, HLT_25ns14e33_v1_cff::leptons, and metSigAlgo_.

Referenced by produce().

70  {
71 
72  // leptons
73  std::vector< edm::Handle<reco::CandidateView> > leptons;
74  for ( std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > >::const_iterator srcLeptons_i = lepTokens_.begin();
75  srcLeptons_i != lepTokens_.end(); ++srcLeptons_i ) {
77  event.getByToken(*srcLeptons_i, leptons_i);
78  leptons.push_back( leptons_i );
79  /*
80  for ( reco::CandidateView::const_iterator lepton = leptons_i->begin();
81  lepton != leptons_i->end(); ++lepton ) {
82  leptons.push_back(*lepton);
83  }
84  */
85  }
86 
87  // jets
89  event.getByToken( jetToken_, inputJets );
90 
91  //Compute the covariance matrix and fill it
92  reco::METCovMatrix cov = metSigAlgo_->getCovariance( *inputJets, leptons, candInput);
93 
94  return cov;
95  }
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:40
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
Definition: PFMETProducer.h:79
metsig::METSignificance * metSigAlgo_
Definition: PFMETProducer.h:74
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
Definition: PFMETProducer.h:80
reco::METCovMatrix getCovariance(const edm::View< reco::Jet > &jets, const std::vector< edm::Handle< reco::CandidateView > > &leptons, const edm::View< reco::Candidate > &pfCandidates)
void PFMETProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 39 of file PFMETProducer.cc.

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

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 
50  PFSpecificAlgo pf;
51  SpecificPFMETData specific = pf.run(*input.product());
52 
53  reco::PFMET pfmet(specific, commonMETdata.sumet, p4, vtx);
54 
56  {
57  reco::METCovMatrix sigcov = getMETCovMatrix(event, *input);
58  pfmet.setSignificanceMatrix(sigcov);
59  }
60 
61  std::auto_ptr<reco::PFMETCollection> pfmetcoll;
62  pfmetcoll.reset(new reco::PFMETCollection);
63 
64  pfmetcoll->push_back(pfmet);
65  event.put(pfmetcoll);
66  }
dictionary specific
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:40
static std::string const input
Definition: EdmProvDump.cc:43
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:81
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: PFMETProducer.h:71
reco::METCovMatrix getMETCovMatrix(const edm::Event &event, const edm::View< reco::Candidate > &input) const

Member Data Documentation

bool cms::PFMETProducer::calculateSignificance_
private

Definition at line 73 of file PFMETProducer.h.

Referenced by PFMETProducer(), and produce().

double cms::PFMETProducer::globalThreshold_
private

Definition at line 76 of file PFMETProducer.h.

Referenced by produce().

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

Definition at line 71 of file PFMETProducer.h.

Referenced by produce().

double cms::PFMETProducer::jetThreshold_
private

Definition at line 77 of file PFMETProducer.h.

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

Definition at line 79 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

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

Definition at line 80 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().

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

Definition at line 74 of file PFMETProducer.h.

Referenced by getMETCovMatrix(), and PFMETProducer().