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 Member Functions | Private Attributes
FromClusterSummaryMultiplicityProducer Class Reference

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

Inheritance diagram for FromClusterSummaryMultiplicityProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 FromClusterSummaryMultiplicityProducer (const edm::ParameterSet &)
 
 ~FromClusterSummaryMultiplicityProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< std::string > m_clustsummvar
 
edm::InputTag m_collection
 
std::map< unsigned int, int > m_subdetenums
 
std::map< unsigned int,
std::string > 
m_subdets
 
std::map< unsigned int,
std::string > 
m_subdetvars
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

Description: EDProducer of multiplicity maps Implementation:

Definition at line 41 of file FromClusterSummaryMultiplicityProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file FromClusterSummaryMultiplicityProducer.cc.

References edm::ParameterSet::getParameter(), m_clustsummvar, m_subdetenums, m_subdets, m_subdetvars, and AlCaHLTBitMon_QueryRunRegistry::string.

74  :
75  m_collection(iConfig.getParameter<edm::InputTag>("clusterSummaryCollection")),
77 {
78 
79  m_clustsummvar.push_back("cHits");
80  m_clustsummvar.push_back("cSize");
81  m_clustsummvar.push_back("cCharge");
82  m_clustsummvar.push_back("pHits");
83  m_clustsummvar.push_back("pSize");
84  m_clustsummvar.push_back("pCharge");
85 
86  produces<std::map<unsigned int,int> >();
87 
88  //now do what ever other initialization is needed
89 
90  std::vector<edm::ParameterSet> wantedsubds(iConfig.getParameter<std::vector<edm::ParameterSet> >("wantedSubDets"));
91 
92  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
93  m_subdets[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
94  m_subdetenums[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int >("subDetEnum");
95  m_subdetvars[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("subDetVariable");
96  }
97 }
T getParameter(std::string const &) const
FromClusterSummaryMultiplicityProducer::~FromClusterSummaryMultiplicityProducer ( )

Definition at line 99 of file FromClusterSummaryMultiplicityProducer.cc.

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

Member Function Documentation

void FromClusterSummaryMultiplicityProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 150 of file FromClusterSummaryMultiplicityProducer.cc.

151 {
152 }
void FromClusterSummaryMultiplicityProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 156 of file FromClusterSummaryMultiplicityProducer.cc.

156  {
157 }
void FromClusterSummaryMultiplicityProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 114 of file FromClusterSummaryMultiplicityProducer.cc.

References edm::Event::getByLabel(), LogDebug, m_clustsummvar, m_collection, m_subdetenums, m_subdets, m_subdetvars, and edm::Event::put().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

115 {
116 
117  LogDebug("Multiplicity") << " Ready to go";
118 
119  using namespace edm;
120 
121  std::auto_ptr<std::map<unsigned int,int> > mults(new std::map<unsigned int,int> );
122 
123 
124  Handle<ClusterSummary> clustsumm;
125  iEvent.getByLabel(m_collection,clustsumm);
126 
127  clustsumm->SetUserContent(m_clustsummvar);
128 
129  for(std::map<unsigned int,std::string>::const_iterator sdet=m_subdets.begin();sdet!=m_subdets.end();++sdet) { (*mults)[sdet->first]=0; }
130 
131  for(std::map<unsigned int,int>::const_iterator detsel=m_subdetenums.begin();detsel!=m_subdetenums.end();++detsel) {
132 
133  // (*mults)[detsel->first] = int(clustsumm->GetGenericVariable(m_subdetvars[detsel->first])[clustsumm->GetModuleLocation(detsel->second)]);
134  (*mults)[detsel->first] = int(clustsumm->GetGenericVariable(m_subdetvars[detsel->first],detsel->second));
135  LogDebug("Multiplicity") << "GetModuleLocation result: " << detsel->second << " " << clustsumm->GetModuleLocation(detsel->second);
136  }
137 
138 
139 
140  for(std::map<unsigned int,int>::const_iterator it=mults->begin();it!=mults->end();++it) {
141  LogDebug("Multiplicity") << " Found " << it->second << " digis/clusters in " << it->first << " " << m_subdets[it->first];
142  }
143 
144  iEvent.put(mults);
145 
146 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390

Member Data Documentation

std::vector<std::string> FromClusterSummaryMultiplicityProducer::m_clustsummvar
private
edm::InputTag FromClusterSummaryMultiplicityProducer::m_collection
private

Definition at line 54 of file FromClusterSummaryMultiplicityProducer.cc.

Referenced by produce().

std::map<unsigned int, int> FromClusterSummaryMultiplicityProducer::m_subdetenums
private
std::map<unsigned int, std::string> FromClusterSummaryMultiplicityProducer::m_subdets
private
std::map<unsigned int, std::string> FromClusterSummaryMultiplicityProducer::m_subdetvars
private