CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CorrectedPatMETProducer Class Reference
Inheritance diagram for CorrectedPatMETProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CorrectedPatMETProducer (const edm::ParameterSet &cfg)
 
 ~CorrectedPatMETProducer ()
 
- 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
 
 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 Types

typedef std::vector< pat::METpatMETCollection
 
typedef std::vector< reco::PFMETpfMETCollection
 

Private Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es) override
 

Private Attributes

AddCorrectionsToGenericMET corrector
 
bool isMiniAod
 
edm::EDGetTokenT< patMETCollectionpatToken_
 
edm::EDGetTokenT< pfMETCollectionpfToken_
 

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 22 of file CorrectedPatMETProducer.cc.

Member Typedef Documentation

Definition at line 60 of file CorrectedPatMETProducer.cc.

Definition at line 61 of file CorrectedPatMETProducer.cc.

Constructor & Destructor Documentation

CorrectedPatMETProducer::CorrectedPatMETProducer ( const edm::ParameterSet cfg)
inlineexplicit

Definition at line 27 of file CorrectedPatMETProducer.cc.

References corrector, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), HiClusterCompatibility_cfi::inputTag, isMiniAod, patToken_, pfToken_, and AddCorrectionsToGenericMET::setCorTokens().

28  : corrector()
29  //token_(consumes<METCollection>(cfg.getParameter<edm::InputTag>("src")))
30  {
31  isMiniAod = (cfg.exists("isMiniAod") ) ? cfg.getParameter<bool>("isMiniAod"): true;
32  if(isMiniAod)
33  {
34  patToken_=consumes<patMETCollection>(cfg.getParameter<edm::InputTag>("src"));
35  }else{
36  pfToken_=consumes<pfMETCollection>(cfg.getParameter<edm::InputTag>("src"));
37  }
38 
39 
40 
41  std::vector<edm::InputTag> corrInputTags = cfg.getParameter<std::vector<edm::InputTag> >("srcCorrections");
42  std::vector<edm::EDGetTokenT<CorrMETData> > corrTokens;
43  for (std::vector<edm::InputTag>::const_iterator inputTag = corrInputTags.begin(); inputTag != corrInputTags.end(); ++inputTag) {
44  corrTokens.push_back(consumes<CorrMETData>(*inputTag));
45  }
46 
47  corrector.setCorTokens(corrTokens);
48 
49  produces<patMETCollection>("");
50  }
T getParameter(std::string const &) const
AddCorrectionsToGenericMET corrector
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< patMETCollection > patToken_
edm::EDGetTokenT< pfMETCollection > pfToken_
void setCorTokens(std::vector< edm::EDGetTokenT< CorrMETData > > const &corrTokens)
CorrectedPatMETProducer::~CorrectedPatMETProducer ( )
inline

Definition at line 52 of file CorrectedPatMETProducer.cc.

52 { }

Member Function Documentation

void CorrectedPatMETProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlineoverrideprivate

Definition at line 67 of file CorrectedPatMETProducer.cc.

References DEFINE_FWK_MODULE, edm::Event::getByToken(), AddCorrectionsToGenericMET::getCorrectedMET(), AddCorrectionsToGenericMET::getCorrectedPFMET(), eostools::move(), edm::Event::put(), and patCaloMETCorrections_cff::srcMET.

68  {
69  edm::Handle<patMETCollection> srcPatMETCollection;
70  edm::Handle<pfMETCollection> srcPfMETCollection;
71  if(isMiniAod)
72  {
73  evt.getByToken(patToken_, srcPatMETCollection);
74  }else{
75  evt.getByToken(pfToken_, srcPfMETCollection);
76  }
77 
78 
79 
80  if(isMiniAod){
81  //std::auto_ptr<patMETCollection> product(new patMETCollection);
82  std::unique_ptr<patMETCollection> product(new patMETCollection);
83  const reco::MET& srcMET = (*srcPatMETCollection)[0];
84  pat::MET outMEtPat = corrector.getCorrectedMET(srcMET, evt, es);
85  product->push_back(outMEtPat);
86  evt.put(std::move(product));
87  }else{
88  std::unique_ptr<pfMETCollection> product(new pfMETCollection);
89  const reco::PFMET& srcMET = (*srcPfMETCollection)[0];
90  reco::PFMET outPfMEtReco = corrector.getCorrectedPFMET(srcMET, evt, es);
91  product->push_back(outPfMEtReco);
92  evt.put(std::move(product));
93  }
94 
95  }
Analysis-level MET class.
Definition: MET.h:43
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
reco::MET getCorrectedMET(const reco::MET &srcMET, edm::Event &evt, const edm::EventSetup &es)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
AddCorrectionsToGenericMET corrector
reco::PFMET getCorrectedPFMET(const reco::PFMET &srcMET, edm::Event &evt, const edm::EventSetup &es)
std::vector< reco::PFMET > pfMETCollection
Definition: MET.h:42
edm::EDGetTokenT< patMETCollection > patToken_
edm::EDGetTokenT< pfMETCollection > pfToken_
std::vector< pat::MET > patMETCollection
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

AddCorrectionsToGenericMET CorrectedPatMETProducer::corrector
private

Definition at line 58 of file CorrectedPatMETProducer.cc.

Referenced by CorrectedPatMETProducer().

bool CorrectedPatMETProducer::isMiniAod
private

Definition at line 56 of file CorrectedPatMETProducer.cc.

Referenced by CorrectedPatMETProducer().

edm::EDGetTokenT<patMETCollection> CorrectedPatMETProducer::patToken_
private

Definition at line 63 of file CorrectedPatMETProducer.cc.

Referenced by CorrectedPatMETProducer().

edm::EDGetTokenT<pfMETCollection> CorrectedPatMETProducer::pfToken_
private

Definition at line 64 of file CorrectedPatMETProducer.cc.

Referenced by CorrectedPatMETProducer().