CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
EGMEnergyVarProducer< T > Class Template Reference

#include <PhysicsTools/NanoAOD/plugins/EGMEnergyVarProducer.cc>

Inheritance diagram for EGMEnergyVarProducer< T >:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EGMEnergyVarProducer (const edm::ParameterSet &iConfig)
 
 ~EGMEnergyVarProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< edm::View< T > > srcCorr_
 
edm::EDGetTokenT< edm::View< T > > srcRaw_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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

template<typename T>
class EGMEnergyVarProducer< T >

Description: [one line class summary] Implementation: [Notes on implementation]

Definition at line 44 of file EGMEnergyVarProducer.cc.

Constructor & Destructor Documentation

template<typename T >
EGMEnergyVarProducer< T >::EGMEnergyVarProducer ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 46 of file EGMEnergyVarProducer.cc.

46  :
49  {
50  produces<edm::ValueMap<float>>("eCorr");
51  }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< T > > srcRaw_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< T > > srcCorr_
template<typename T >
EGMEnergyVarProducer< T >::~EGMEnergyVarProducer ( )
inlineoverride

Member Function Documentation

template<typename T >
void EGMEnergyVarProducer< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 115 of file EGMEnergyVarProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EGMEnergyVarProducer< T >::~EGMEnergyVarProducer().

115  {
117  desc.add<edm::InputTag>("srcRaw")->setComment("input raw physics object collection");
118  desc.add<edm::InputTag>("srcCorr")->setComment("input corrected physics object collection");
119  std::string modname;
120  if (typeid(T) == typeid(pat::Electron)) modname+="Electron";
121  else if (typeid(T) == typeid(pat::Photon)) modname+="Photon";
122  modname+="EnergyVarProducer";
123  descriptions.add(modname,desc);
124 }
Analysis-level Photon class.
Definition: Photon.h:47
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Analysis-level electron class.
Definition: Electron.h:52
void add(std::string const &label, ParameterSetDescription const &psetDescription)
long double T
template<typename T >
void EGMEnergyVarProducer< T >::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 81 of file EGMEnergyVarProducer.cc.

References electrons_cff::eCorr, edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), edm::helper::Filler< Map >::insert(), matchByCommonParentSuperClusterRef(), eostools::move(), edm::Event::put(), electrons_cff::srcCorr, EGMEnergyVarProducer< T >::srcCorr_, electrons_cff::srcRaw, and EGMEnergyVarProducer< T >::srcRaw_.

Referenced by EGMEnergyVarProducer< T >::~EGMEnergyVarProducer().

82 {
84  iEvent.getByToken(srcRaw_, srcRaw);
86  iEvent.getByToken(srcCorr_, srcCorr);
87 
88  unsigned nSrcRaw = srcRaw->size();
89  unsigned nSrcCorr = srcCorr->size();
90 
91  std::vector<float> eCorr(nSrcCorr,-1);
92 
93  for (unsigned int ir = 0; ir<nSrcRaw; ir++){
94  auto egm_raw = srcRaw->ptrAt(ir);
95  for (unsigned int ic = 0; ic<nSrcCorr; ic++){
96  auto egm_corr = srcCorr->ptrAt(ic);
97  if(matchByCommonParentSuperClusterRef(*egm_raw,*egm_corr)){
98  eCorr[ir] = egm_corr->energy()/egm_raw->energy();
99  break;
100  }
101  }
102  }
103 
104  std::unique_ptr<edm::ValueMap<float>> eCorrV(new edm::ValueMap<float>());
105  edm::ValueMap<float>::Filler fillerCorr(*eCorrV);
106  fillerCorr.insert(srcRaw,eCorr.begin(),eCorr.end());
107  fillerCorr.fill();
108  iEvent.put(std::move(eCorrV),"eCorr");
109 
110 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
edm::EDGetTokenT< edm::View< T > > srcRaw_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
bool matchByCommonParentSuperClusterRef(const C1 &c1, const C2 &c2)
Definition: MatchingUtils.h:20
edm::EDGetTokenT< edm::View< T > > srcCorr_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<typename T >
edm::EDGetTokenT<edm::View<T> > EGMEnergyVarProducer< T >::srcCorr_
private

Definition at line 62 of file EGMEnergyVarProducer.cc.

Referenced by EGMEnergyVarProducer< T >::produce().

template<typename T >
edm::EDGetTokenT<edm::View<T> > EGMEnergyVarProducer< T >::srcRaw_
private

Definition at line 61 of file EGMEnergyVarProducer.cc.

Referenced by EGMEnergyVarProducer< T >::produce().