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
EGGainSwitchFlagProducer< C > Class Template Reference
Inheritance diagram for EGGainSwitchFlagProducer< C >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
 EGGainSwitchFlagProducer (const edm::ParameterSet &)
 
template<typename T >
void getToken (edm::EDGetTokenT< T > &token, const edm::ParameterSet &pset, const std::string &label, const std::string &instance="")
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~EGGainSwitchFlagProducer ()
 
- 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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

edm::EDGetTokenT
< EcalRecHitCollection
ebRecHitsToken_
 
std::string hasGainSwitchFlag_
 
edm::EDGetTokenT< C > objectsToken_
 
const CaloTopologytopology_
 

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

template<typename C>
class EGGainSwitchFlagProducer< C >

Definition at line 46 of file EGGainSwitchFlagProducer.cc.

Constructor & Destructor Documentation

template<typename C >
EGGainSwitchFlagProducer< C >::EGGainSwitchFlagProducer ( const edm::ParameterSet iConfig)

Definition at line 76 of file EGGainSwitchFlagProducer.cc.

References EGGainSwitchFlagProducer< C >::ebRecHitsToken_, EGGainSwitchFlagProducer< C >::getToken(), EGGainSwitchFlagProducer< C >::hasGainSwitchFlag_, and EGGainSwitchFlagProducer< C >::objectsToken_.

76  :
77  hasGainSwitchFlag_("hasGainSwitchFlag")
78 
79 {
80 
81  getToken(ebRecHitsToken_,iConfig,"ebRecHits");
82  getToken(objectsToken_,iConfig,"src");
83 
84  produces<intMap>(hasGainSwitchFlag_);
85 
86 }
edm::EDGetTokenT< C > objectsToken_
void getToken(edm::EDGetTokenT< T > &token, const edm::ParameterSet &pset, const std::string &label, const std::string &instance="")
edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsToken_
template<typename C >
EGGainSwitchFlagProducer< C >::~EGGainSwitchFlagProducer ( )

Definition at line 89 of file EGGainSwitchFlagProducer.cc.

89  {
90 }

Member Function Documentation

template<typename C >
void EGGainSwitchFlagProducer< C >::beginLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &  es 
)
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 120 of file EGGainSwitchFlagProducer.cc.

References edm::EventSetup::get(), and edm::ESHandle< class >::product().

121  {
122  edm::ESHandle<CaloTopology> caloTopo ;
123  es.get<CaloTopologyRecord>().get(caloTopo);
124  topology_ = caloTopo.product();
125 }
T const * product() const
Definition: ESHandle.h:86
template<typename C >
template<typename T >
void EGGainSwitchFlagProducer< C >::getToken ( edm::EDGetTokenT< T > &  token,
const edm::ParameterSet pset,
const std::string &  label,
const std::string &  instance = "" 
)
inline

Definition at line 58 of file EGGainSwitchFlagProducer.cc.

References edm::ParameterSet::getParameter(), instance, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by EGGainSwitchFlagProducer< C >::EGGainSwitchFlagProducer().

58  {
59  auto tag(pset.getParameter<edm::InputTag>(label));
60  if (!instance.empty())
61  tag = edm::InputTag(tag.label(), instance, tag.process());
62 
63  token = consumes<T>(tag);
64  }
T getParameter(std::string const &) const
static PFTauRenderPlugin instance
template<typename C >
void EGGainSwitchFlagProducer< C >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 93 of file EGGainSwitchFlagProducer.cc.

References edm::helper::Filler< Map >::fill(), GainSwitchTools::hasEBGainSwitchIn5x5(), edm::helper::Filler< Map >::insert(), eostools::move(), and edm::Event::put().

93  {
94 
95 
96  auto ebRecHits = *getHandle(iEvent, ebRecHitsToken_);
97  auto objects = getHandle(iEvent, objectsToken_);
98 
99  std::vector<int> objectFlags;
100 
101  for(auto& object : *objects){
102 
103  if (GainSwitchTools::hasEBGainSwitchIn5x5(*object.superCluster(), &ebRecHits, topology_)) {
104  objectFlags.emplace_back(1);
105  } else {
106  objectFlags.emplace_back(0);
107  }
108 
109  }
110 
111  std::unique_ptr<intMap> bRefMap(new intMap);
112  intMap::Filler intMapFiller(*bRefMap);
113  intMapFiller.insert(objects, objectFlags.begin(), objectFlags.end());
114  intMapFiller.fill();
115  iEvent.put(std::move(bRefMap),hasGainSwitchFlag_);
116 
117 }
edm::EDGetTokenT< C > objectsToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsToken_
static bool hasEBGainSwitchIn5x5(const reco::SuperCluster &superClus, const EcalRecHitCollection *recHits, const CaloTopology *topology)

Member Data Documentation

template<typename C >
edm::EDGetTokenT<EcalRecHitCollection> EGGainSwitchFlagProducer< C >::ebRecHitsToken_
private
template<typename C >
std::string EGGainSwitchFlagProducer< C >::hasGainSwitchFlag_
private
template<typename C >
edm::EDGetTokenT<C> EGGainSwitchFlagProducer< C >::objectsToken_
private
template<typename C >
const CaloTopology* EGGainSwitchFlagProducer< C >::topology_
private

Definition at line 68 of file EGGainSwitchFlagProducer.cc.