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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MultiplicityProducer (const edm::ParameterSet &)
 
 ~MultiplicityProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

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::EDProducer
typedef EDProducer 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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 80 of file MultiplicityProducer.cc.

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

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

◆ ~MultiplicityProducer()

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

Definition at line 99 of file MultiplicityProducer.cc.

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

Member Function Documentation

◆ beginJob()

template<class T >
void MultiplicityProducer< T >::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 155 of file MultiplicityProducer.cc.

155 {}

◆ detSetMultiplicity() [1/3]

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

Definition at line 194 of file MultiplicityProducer.cc.

195  {
196  int mult = 0;
197 
198  for (edmNew::DetSet<SiPixelCluster>::const_iterator clus = det->begin(); clus != det->end(); ++clus) {
199  mult += clus->size();
200  }
201 
202  return mult;
203 }

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

◆ detSetMultiplicity() [2/3]

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

Definition at line 181 of file MultiplicityProducer.cc.

182  {
183  int mult = 0;
184 
185  for (edmNew::DetSet<SiStripCluster>::const_iterator clus = det->begin(); clus != det->end(); ++clus) {
186  // edm::LogInfo("multiplicitywithcustersize") << "sono qua";
187  mult += clus->amplitudes().size();
188  }
189 
190  return mult;
191 }

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

◆ detSetMultiplicity() [3/3]

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

Definition at line 176 of file MultiplicityProducer.cc.

176  {
177  return det->size();
178 }

◆ endJob()

template<class T >
void MultiplicityProducer< T >::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 159 of file MultiplicityProducer.cc.

159 {}

◆ multiplicity()

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

Definition at line 162 of file MultiplicityProducer.cc.

162  {
163  int mult = 0;
164  if (m_clustersize) {
165  // edm::LogInfo("multiplicitywithcustersize") << "sono qua: with size";
166  mult = detSetMultiplicity(det);
167 
168  } else {
169  mult = det->size();
170  // edm::LogInfo("multiplicitywithcustersize") << "sono qua senza size";
171  }
172  return mult;
173 }

References VarParsing::mult.

◆ produce()

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

Implements edm::EDProducer.

Definition at line 110 of file MultiplicityProducer.cc.

110  {
111  LogDebug("Multiplicity") << " Ready to loop";
112 
113  using namespace edm;
114 
115  std::unique_ptr<std::map<unsigned int, int> > mults(new std::map<unsigned int, int>);
116 
117  Handle<T> digis;
118  iEvent.getByToken(m_collectionToken, digis);
119 
120  for (std::map<unsigned int, std::string>::const_iterator sdet = m_subdets.begin(); sdet != m_subdets.end(); ++sdet) {
121  (*mults)[sdet->first] = 0;
122  }
123 
124  for (typename T::const_iterator det = digis->begin(); det != digis->end(); ++det) {
125  // if(m_subdets.find(0)!=m_subdets.end()) (*mults)[0]+= det->size();
126  if (m_subdets.find(0) != m_subdets.end())
127  (*mults)[0] += multiplicity(det);
128 
129  DetId detid(det->detId());
130  unsigned int subdet = detid.subdetId();
131 
132  // if(m_subdets.find(subdet)!=m_subdets.end() && !m_subdetsels[subdet].isValid() ) (*mults)[subdet] += det->size();
133  if (m_subdets.find(subdet) != m_subdets.end() && !m_subdetsels[subdet].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[it->first];
148  }
149 
150  iEvent.put(std::move(mults));
151 }

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

Member Data Documentation

◆ m_clustersize

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

Definition at line 63 of file MultiplicityProducer.cc.

◆ m_collectionToken

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

Definition at line 62 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
MultiplicityProducer::multiplicity
int multiplicity(typename T::const_iterator det) const
Definition: MultiplicityProducer.cc:162
MultiplicityProducer::m_subdetsels
std::map< unsigned int, DetIdSelector > m_subdetsels
Definition: MultiplicityProducer.cc:65
edm
HLT enums.
Definition: AlignableModifier.h:19
MultiplicityProducer::m_collectionToken
edm::EDGetTokenT< T > m_collectionToken
Definition: MultiplicityProducer.cc:62
edmNew::DetSetVector::begin
const_iterator begin(bool update=false) const
Definition: DetSetVectorNew.h:530
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
MultiplicityProducer::detSetMultiplicity
int detSetMultiplicity(typename T::const_iterator det) const
Definition: MultiplicityProducer.cc:176
edm::Handle
Definition: AssociativeIterator.h:50
DetId
Definition: DetId.h:17
MultiplicityProducer::m_subdets
std::map< unsigned int, std::string > m_subdets
Definition: MultiplicityProducer.cc:64
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
iEvent
int iEvent
Definition: GenABIO.cc:224
eostools.move
def move(src, dest)
Definition: eostools.py:511
edmNew::DetSetVector::end
const_iterator end(bool update=false) const
Definition: DetSetVectorNew.h:535
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
VarParsing.mult
mult
Definition: VarParsing.py:659
MultiplicityProducer::m_clustersize
bool m_clustersize
Definition: MultiplicityProducer.cc:63
edm::InputTag
Definition: InputTag.h:15
DetIdSelector
Definition: DetIdSelector.h:12
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31