CMS 3D CMS Logo

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

#include <DPGAnalysis/SiStripTools/plugins/MultiplicityProducer.cc>

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

Public Member Functions

 MultiplicityProducer (const edm::ParameterSet &)
 
 ~MultiplicityProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

int detSetMultiplicity (typename T::const_iterator det) const
 
template<>
int detSetMultiplicity (edmNew::DetSetVector< SiStripCluster >::const_iterator det) const
 
template<>
int detSetMultiplicity (edmNew::DetSetVector< SiPixelCluster >::const_iterator det) const
 
int multiplicity (typename T::const_iterator det) const
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

const bool m_clustersize
 
edm::EDGetTokenT< Tm_collectionToken
 
std::map< unsigned int, std::string > m_subdets
 
std::map< unsigned int, DetIdSelectorm_subdetsels
 

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
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

template<class T>
class MultiplicityProducer< T >

Description: EDProducer of multiplicity maps Implementation:

Definition at line 48 of file MultiplicityProducer.cc.

Constructor & Destructor Documentation

◆ MultiplicityProducer()

template<class T >
MultiplicityProducer< T >::MultiplicityProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 78 of file MultiplicityProducer.cc.

References edm::ParameterSet::getParameter(), MultiplicityProducer< T >::m_subdets, MultiplicityProducer< T >::m_subdetsels, and AlCaHLTBitMon_QueryRunRegistry::string.

79  : m_collectionToken(consumes<T>(iConfig.getParameter<edm::InputTag>("clusterdigiCollection"))),
80  m_clustersize(iConfig.getUntrackedParameter<bool>("withClusterSize", false)),
81  m_subdets(),
82  m_subdetsels() {
83  produces<std::map<unsigned int, int> >();
84 
85  //now do what ever other initialization is needed
86 
87  std::vector<edm::ParameterSet> wantedsubds(iConfig.getParameter<std::vector<edm::ParameterSet> >("wantedSubDets"));
88 
89  for (std::vector<edm::ParameterSet>::iterator ps = wantedsubds.begin(); ps != wantedsubds.end(); ++ps) {
90  m_subdets[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
91  m_subdetsels[ps->getParameter<unsigned int>("detSelection")] =
92  DetIdSelector(ps->getUntrackedParameter<std::vector<std::string> >("selection", std::vector<std::string>()));
93  }
94 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< T > m_collectionToken
std::map< unsigned int, DetIdSelector > m_subdetsels
std::map< unsigned int, std::string > m_subdets

◆ ~MultiplicityProducer()

template<class T >
MultiplicityProducer< T >::~MultiplicityProducer ( )
override

Definition at line 97 of file MultiplicityProducer.cc.

97  {
98  // do anything here that needs to be done at desctruction time
99  // (e.g. close files, deallocate resources etc.)
100 }

Member Function Documentation

◆ detSetMultiplicity() [1/3]

template<class T >
int MultiplicityProducer< T >::detSetMultiplicity ( typename T::const_iterator  det) const
private

Definition at line 168 of file MultiplicityProducer.cc.

168  {
169  return det->size();
170 }

◆ detSetMultiplicity() [2/3]

template<>
int MultiplicityProducer< edmNew::DetSetVector< SiStripCluster > >::detSetMultiplicity ( edmNew::DetSetVector< SiStripCluster >::const_iterator  det) const
private

Definition at line 173 of file MultiplicityProducer.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), and VarParsing::mult.

174  {
175  int mult = 0;
176 
177  for (edmNew::DetSet<SiStripCluster>::const_iterator clus = det->begin(); clus != det->end(); ++clus) {
178  // edm::LogInfo("multiplicitywithcustersize") << "sono qua";
179  mult += clus->amplitudes().size();
180  }
181 
182  return mult;
183 }
data_type const * const_iterator
Definition: DetSetNew.h:31
const_iterator end(bool update=false) const
const_iterator begin(bool update=false) const

◆ detSetMultiplicity() [3/3]

template<>
int MultiplicityProducer< edmNew::DetSetVector< SiPixelCluster > >::detSetMultiplicity ( edmNew::DetSetVector< SiPixelCluster >::const_iterator  det) const
private

Definition at line 186 of file MultiplicityProducer.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), and VarParsing::mult.

187  {
188  int mult = 0;
189 
190  for (edmNew::DetSet<SiPixelCluster>::const_iterator clus = det->begin(); clus != det->end(); ++clus) {
191  mult += clus->size();
192  }
193 
194  return mult;
195 }
data_type const * const_iterator
Definition: DetSetNew.h:31
const_iterator end(bool update=false) const
const_iterator begin(bool update=false) const

◆ multiplicity()

template<class T >
int MultiplicityProducer< T >::multiplicity ( typename T::const_iterator  det) const
private

Definition at line 154 of file MultiplicityProducer.cc.

References VarParsing::mult.

154  {
155  int mult = 0;
156  if (m_clustersize) {
157  // edm::LogInfo("multiplicitywithcustersize") << "sono qua: with size";
158  mult = detSetMultiplicity(det);
159 
160  } else {
161  mult = det->size();
162  // edm::LogInfo("multiplicitywithcustersize") << "sono qua senza size";
163  }
164  return mult;
165 }
int detSetMultiplicity(typename T::const_iterator det) const

◆ produce()

template<class T >
void MultiplicityProducer< T >::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 108 of file MultiplicityProducer.cc.

References iEvent, LogDebug, eostools::move(), or, and DetId::subdetId().

108  {
109  LogDebug("Multiplicity") << " Ready to loop";
110 
111  using namespace edm;
112 
113  std::unique_ptr<std::map<unsigned int, int> > mults(new std::map<unsigned int, int>);
114 
115  Handle<T> digis;
116  iEvent.getByToken(m_collectionToken, digis);
117 
118  for (std::map<unsigned int, std::string>::const_iterator sdet = m_subdets.begin(); sdet != m_subdets.end(); ++sdet) {
119  (*mults)[sdet->first] = 0;
120  }
121 
122  for (typename T::const_iterator det = digis->begin(); det != digis->end(); ++det) {
123  // if(m_subdets.find(0)!=m_subdets.end()) (*mults)[0]+= det->size();
124  if (m_subdets.find(0) != m_subdets.end())
125  (*mults)[0] += multiplicity(det);
126 
127  DetId detid(det->detId());
128  unsigned int subdet = detid.subdetId();
129 
130  // if(m_subdets.find(subdet)!=m_subdets.end() && !m_subdetsels[subdet].isValid() ) (*mults)[subdet] += det->size();
131  if (m_subdets.find(subdet) != m_subdets.end()) {
132  auto detsel = m_subdetsels.find(subdet);
133  if (detsel == m_subdetsels.end() or !detsel->second.isValid())
134  (*mults)[subdet] += multiplicity(det);
135  }
136  for (std::map<unsigned int, DetIdSelector>::const_iterator detsel = m_subdetsels.begin();
137  detsel != m_subdetsels.end();
138  ++detsel) {
139  // if(detsel->second.isValid() && detsel->second.isSelected(detid)) (*mults)[detsel->first] += det->size();
140  if (detsel->second.isValid() && detsel->second.isSelected(detid))
141  (*mults)[detsel->first] += multiplicity(det);
142  }
143  }
144 
145  for (std::map<unsigned int, int>::const_iterator it = mults->begin(); it != mults->end(); ++it) {
146  LogDebug("Multiplicity") << " Found " << it->second << " digis/clusters in " << it->first << " "
147  << m_subdets.find(it->first)->second;
148  }
149 
150  iEvent.put(std::move(mults));
151 }
edm::EDGetTokenT< T > m_collectionToken
int iEvent
Definition: GenABIO.cc:224
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
int multiplicity(typename T::const_iterator det) const
Definition: DetId.h:17
std::map< unsigned int, DetIdSelector > m_subdetsels
HLT enums.
std::map< unsigned int, std::string > m_subdets
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ m_clustersize

template<class T >
const bool MultiplicityProducer< T >::m_clustersize
private

Definition at line 61 of file MultiplicityProducer.cc.

◆ m_collectionToken

template<class T >
edm::EDGetTokenT<T> MultiplicityProducer< T >::m_collectionToken
private

Definition at line 60 of file MultiplicityProducer.cc.

◆ m_subdets

template<class T >
std::map<unsigned int, std::string> MultiplicityProducer< T >::m_subdets
private

◆ m_subdetsels

template<class T >
std::map<unsigned int, DetIdSelector> MultiplicityProducer< T >::m_subdetsels
private