CMS 3D CMS Logo

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

Public Member Functions

 ElectronRegressionValueMapProducer (const edm::ParameterSet &)
 
 ~ElectronRegressionValueMapProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
template<typename T >
void writeValueMap (edm::Event &iEvent, const edm::Handle< edm::View< reco::GsfElectron > > &handle, const std::vector< T > &values, const std::string &label) const
 

Private Attributes

edm::EDGetTokenT< EcalRecHitCollectionebReducedRecHitCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionebReducedRecHitCollectionMiniAOD_
 
edm::EDGetTokenT< EcalRecHitCollectioneeReducedRecHitCollection_
 
edm::EDGetTokenT< EcalRecHitCollectioneeReducedRecHitCollectionMiniAOD_
 
edm::EDGetTokenT< EcalRecHitCollectionesReducedRecHitCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionesReducedRecHitCollectionMiniAOD_
 
std::unique_ptr< EcalClusterLazyToolsBaselazyTools
 
edm::EDGetToken src_
 
edm::EDGetToken srcMiniAOD_
 
const bool use_full5x5_
 

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

Definition at line 62 of file ElectronRegressionValueMapProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 98 of file ElectronRegressionValueMapProducer.cc.

References ebReducedRecHitCollection_, ebReducedRecHitCollectionMiniAOD_, eeReducedRecHitCollection_, eeReducedRecHitCollectionMiniAOD_, esReducedRecHitCollection_, esReducedRecHitCollectionMiniAOD_, edm::ParameterSet::getParameter(), dataset::name, src_, srcMiniAOD_, and AlCaHLTBitMon_QueryRunRegistry::string.

98  :
99  use_full5x5_(iConfig.getParameter<bool>("useFull5x5")) {
100 
101  //
102  // Declare consummables, handle both AOD and miniAOD case
103  //
104  ebReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
105  ("ebReducedRecHitCollection"));
106  ebReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
107  ("ebReducedRecHitCollectionMiniAOD"));
108 
109  eeReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
110  ("eeReducedRecHitCollection"));
111  eeReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
112  ("eeReducedRecHitCollectionMiniAOD"));
113 
114  esReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
115  ("esReducedRecHitCollection"));
116  esReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
117  ("esReducedRecHitCollectionMiniAOD"));
118 
119  src_ = mayConsume<edm::View<reco::GsfElectron> >(iConfig.getParameter<edm::InputTag>("src"));
120  srcMiniAOD_ = mayConsume<edm::View<reco::GsfElectron> >(iConfig.getParameter<edm::InputTag>("srcMiniAOD"));
121 
122  for( const std::string& name : float_var_names ) {
123  produces<edm::ValueMap<float> >(name);
124  }
125 
126  for( const std::string& name : integer_var_names ) {
127  produces<edm::ValueMap<int> >(name);
128  }
129 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
ElectronRegressionValueMapProducer::~ElectronRegressionValueMapProducer ( )
override

Definition at line 131 of file ElectronRegressionValueMapProducer.cc.

131  {
132 }

Member Function Documentation

void ElectronRegressionValueMapProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 236 of file ElectronRegressionValueMapProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

236  {
237  //The following says we do not know what parameters are allowed so do no validation
238  // Please change this to state exactly what you do use, even if it is no parameters
240  desc.setUnknown();
241  descriptions.addDefault(desc);
242 }
void addDefault(ParameterSetDescription const &psetDescription)
void ElectronRegressionValueMapProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 134 of file ElectronRegressionValueMapProducer.cc.

References ebReducedRecHitCollection_, ebReducedRecHitCollectionMiniAOD_, eeReducedRecHitCollection_, eeReducedRecHitCollectionMiniAOD_, esReducedRecHitCollection_, esReducedRecHitCollectionMiniAOD_, edm::Event::getByToken(), mps_fire::i, iEvent, edm::HandleBase::isValid(), lazyTools, TrackRefitter_38T_cff::src, src_, srcMiniAOD_, use_full5x5_, and writeValueMap().

134  {
135 
136  using namespace edm;
137 
139 
140  // Retrieve the collection of electrons from the event.
141  // If we fail to retrieve the collection with the standard AOD
142  // name, we next look for the one with the stndard miniAOD name.
143  bool isAOD = true;
144  iEvent.getByToken(src_, src);
145 
146  if( !src.isValid() ) {
147  isAOD = false;
148  iEvent.getByToken(srcMiniAOD_,src);
149  }
150 
151  // configure lazy tools
153 
154  if( isAOD ) {
158  } else {
162  }
163 
164  if( use_full5x5_ ) {
165  lazyTools = std::make_unique<noZS::EcalClusterLazyTools>(iEvent, iSetup,
166  ebrh, eerh, esrh );
167  } else {
168  lazyTools = std::make_unique<EcalClusterLazyTools>(iEvent, iSetup,
169  ebrh, eerh, esrh );
170  }
171 
172  std::vector<std::vector<float> > float_vars(k_NFloatVars);
173  std::vector<std::vector<int> > int_vars(k_NIntVars);
174 
175  std::unordered_map<std::string,float> float_vars_map;
176  std::unordered_map<std::string,int> int_vars_map;
177 
178  // reco::GsfElectron::superCluster() is virtual so we can exploit polymorphism
179  for (size_t i = 0; i < src->size(); ++i){
180  auto iEle = src->ptrAt(i);
181 
182  if( use_full5x5_ ) {
183  calculateValues<noZS::EcalClusterLazyTools>(lazyTools.get(),
184  iEle,
185  iSetup,
186  float_vars_map,
187  int_vars_map);
188  } else {
189  calculateValues<EcalClusterLazyTools>(lazyTools.get(),
190  iEle,
191  iSetup,
192  float_vars_map,
193  int_vars_map);
194  }
195 
196  check_map(float_vars_map, k_NFloatVars);
197  check_map(int_vars_map, k_NIntVars);
198 
199  for( unsigned i = 0; i < float_vars.size(); ++i ) {
200  float_vars[i].emplace_back(float_vars_map.at(float_var_names[i]));
201  }
202 
203  for( unsigned i = 0; i < int_vars.size(); ++i ) {
204  int_vars[i].emplace_back(int_vars_map.at(integer_var_names[i]));
205  }
206  }
207 
208  for( unsigned i = 0; i < float_vars.size(); ++i ) {
209  writeValueMap(iEvent, src, float_vars[i], float_var_names[i]);
210  }
211 
212  for( unsigned i = 0; i < int_vars.size(); ++i ) {
213  writeValueMap(iEvent, src, int_vars[i], integer_var_names[i]);
214  }
215 
216  lazyTools.reset();
217 }
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::GsfElectron > > &handle, const std::vector< T > &values, const std::string &label) const
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
std::unique_ptr< EcalClusterLazyToolsBase > lazyTools
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
HLT enums.
template<typename T >
void ElectronRegressionValueMapProducer::writeValueMap ( edm::Event iEvent,
const edm::Handle< edm::View< reco::GsfElectron > > &  handle,
const std::vector< T > &  values,
const std::string &  label 
) const
private

Definition at line 220 of file ElectronRegressionValueMapProducer.cc.

References objects.autophobj::filler, cmsBatch::handle, eostools::move(), and edm::Event::put().

Referenced by produce().

224 {
225  using namespace edm;
226  using namespace std;
227  typedef ValueMap<T> TValueMap;
228 
229  auto valMap = std::make_unique<TValueMap>();
230  typename TValueMap::Filler filler(*valMap);
231  filler.insert(handle, values.begin(), values.end());
232  filler.fill();
233  iEvent.put(std::move(valMap), label);
234 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
HLT enums.
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionValueMapProducer::ebReducedRecHitCollection_
private
edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionValueMapProducer::ebReducedRecHitCollectionMiniAOD_
private
edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionValueMapProducer::eeReducedRecHitCollection_
private
edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionValueMapProducer::eeReducedRecHitCollectionMiniAOD_
private
edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionValueMapProducer::esReducedRecHitCollection_
private
edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionValueMapProducer::esReducedRecHitCollectionMiniAOD_
private
std::unique_ptr<EcalClusterLazyToolsBase> ElectronRegressionValueMapProducer::lazyTools
private

Definition at line 81 of file ElectronRegressionValueMapProducer.cc.

Referenced by produce().

edm::EDGetToken ElectronRegressionValueMapProducer::src_
private
edm::EDGetToken ElectronRegressionValueMapProducer::srcMiniAOD_
private
const bool ElectronRegressionValueMapProducer::use_full5x5_
private

Definition at line 95 of file ElectronRegressionValueMapProducer.cc.

Referenced by produce().