#include <DPGAnalysis/SiStripTools/plugins/MultiplicityProducer.cc>
Public Member Functions | |
MultiplicityProducer (const edm::ParameterSet &) | |
~MultiplicityProducer () | |
Private Member Functions | |
virtual void | beginJob () |
template<> | |
int | detSetMultiplicity (edmNew::DetSetVector< SiPixelCluster >::const_iterator det) const |
int | detSetMultiplicity (typename T::const_iterator det) const |
template<> | |
int | detSetMultiplicity (edmNew::DetSetVector< SiStripCluster >::const_iterator det) const |
virtual void | endJob () |
int | multiplicity (typename T::const_iterator det) const |
virtual void | produce (edm::Event &, const edm::EventSetup &) override |
Private Attributes | |
bool | m_clustersize |
edm::InputTag | m_collection |
std::map< unsigned int, std::string > | m_subdets |
std::map< unsigned int, DetIdSelector > | m_subdetsels |
Description: EDProducer of multiplicity maps Implementation:
Definition at line 49 of file MultiplicityProducer.cc.
MultiplicityProducer< T >::MultiplicityProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 84 of file MultiplicityProducer.cc.
References edm::ParameterSet::getParameter(), MultiplicityProducer< T >::m_subdets, MultiplicityProducer< T >::m_subdetsels, and AlCaHLTBitMon_QueryRunRegistry::string.
: m_collection(iConfig.getParameter<edm::InputTag>("clusterdigiCollection")), m_clustersize(iConfig.getUntrackedParameter<bool>("withClusterSize",false)), m_subdets(),m_subdetsels() { produces<std::map<unsigned int,int> >(); //now do what ever other initialization is needed std::vector<edm::ParameterSet> wantedsubds(iConfig.getParameter<std::vector<edm::ParameterSet> >("wantedSubDets")); for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) { m_subdets[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel"); m_subdetsels[ps->getParameter<unsigned int>("detSelection")] = DetIdSelector(ps->getUntrackedParameter<std::vector<std::string> >("selection",std::vector<std::string>())); } }
MultiplicityProducer< T >::~MultiplicityProducer | ( | ) |
Definition at line 104 of file MultiplicityProducer.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void MultiplicityProducer< T >::beginJob | ( | void | ) | [private, virtual] |
int MultiplicityProducer< edmNew::DetSetVector< SiPixelCluster > >::detSetMultiplicity | ( | edmNew::DetSetVector< SiPixelCluster >::const_iterator | det | ) | const [private] |
Definition at line 230 of file MultiplicityProducer.cc.
References VarParsing::mult.
{ int mult = 0; for(edmNew::DetSet<SiPixelCluster>::const_iterator clus=det->begin();clus!=det->end();++clus) { mult += clus->size(); } return mult; }
int MultiplicityProducer< T >::detSetMultiplicity | ( | typename T::const_iterator | det | ) | const [private] |
Definition at line 202 of file MultiplicityProducer.cc.
{
return det->size();
}
int MultiplicityProducer< edmNew::DetSetVector< SiStripCluster > >::detSetMultiplicity | ( | edmNew::DetSetVector< SiStripCluster >::const_iterator | det | ) | const [private] |
Definition at line 211 of file MultiplicityProducer.cc.
References VarParsing::mult.
{ int mult = 0; for(edmNew::DetSet<SiStripCluster>::const_iterator clus=det->begin();clus!=det->end();++clus) { // edm::LogInfo("multiplicitywithcustersize") << "sono qua"; mult += clus->amplitudes().size(); } return mult; }
void MultiplicityProducer< T >::endJob | ( | void | ) | [private, virtual] |
int MultiplicityProducer< T >::multiplicity | ( | typename T::const_iterator | det | ) | const [private] |
Definition at line 180 of file MultiplicityProducer.cc.
References VarParsing::mult.
{ int mult = 0; if(m_clustersize) { // edm::LogInfo("multiplicitywithcustersize") << "sono qua: with size"; mult = detSetMultiplicity(det); } else { mult = det->size(); // edm::LogInfo("multiplicitywithcustersize") << "sono qua senza size"; } return mult; }
void MultiplicityProducer< T >::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Implements edm::EDProducer.
Definition at line 120 of file MultiplicityProducer.cc.
References cond::rpcobgas::detid, edm::Event::getByLabel(), LogDebug, and edm::Event::put().
{ LogDebug("Multiplicity") << " Ready to loop"; using namespace edm; std::auto_ptr<std::map<unsigned int,int> > mults(new std::map<unsigned int,int> ); Handle<T> digis; iEvent.getByLabel(m_collection,digis); for(std::map<unsigned int,std::string>::const_iterator sdet=m_subdets.begin();sdet!=m_subdets.end();++sdet) { (*mults)[sdet->first]=0; } for(typename T::const_iterator det = digis->begin();det!=digis->end();++det) { // if(m_subdets.find(0)!=m_subdets.end()) (*mults)[0]+= det->size(); if(m_subdets.find(0)!=m_subdets.end()) (*mults)[0]+= multiplicity(det); DetId detid(det->detId()); unsigned int subdet = detid.subdetId(); // if(m_subdets.find(subdet)!=m_subdets.end() && !m_subdetsels[subdet].isValid() ) (*mults)[subdet] += det->size(); if(m_subdets.find(subdet)!=m_subdets.end() && !m_subdetsels[subdet].isValid() ) (*mults)[subdet] += multiplicity(det); for(std::map<unsigned int,DetIdSelector>::const_iterator detsel=m_subdetsels.begin();detsel!=m_subdetsels.end();++detsel) { // if(detsel->second.isValid() && detsel->second.isSelected(detid)) (*mults)[detsel->first] += det->size(); if(detsel->second.isValid() && detsel->second.isSelected(detid)) (*mults)[detsel->first] += multiplicity(det); } } for(std::map<unsigned int,int>::const_iterator it=mults->begin();it!=mults->end();++it) { LogDebug("Multiplicity") << " Found " << it->second << " digis/clusters in " << it->first << " " << m_subdets[it->first]; } iEvent.put(mults); }
bool MultiplicityProducer< T >::m_clustersize [private] |
Definition at line 65 of file MultiplicityProducer.cc.
edm::InputTag MultiplicityProducer< T >::m_collection [private] |
Definition at line 64 of file MultiplicityProducer.cc.
std::map<unsigned int, std::string> MultiplicityProducer< T >::m_subdets [private] |
Definition at line 66 of file MultiplicityProducer.cc.
Referenced by MultiplicityProducer< T >::MultiplicityProducer().
std::map<unsigned int, DetIdSelector> MultiplicityProducer< T >::m_subdetsels [private] |
Definition at line 67 of file MultiplicityProducer.cc.
Referenced by MultiplicityProducer< T >::MultiplicityProducer().