CMS 3D CMS Logo

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::ProductRegistryHelper

List of all members.

Public Member Functions

 FromClusterSummaryMultiplicityProducer (const edm::ParameterSet &)
 ~FromClusterSummaryMultiplicityProducer ()

Private Member Functions

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

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

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, and m_subdetvars.

                                                                                                            :
  m_collection(iConfig.getParameter<edm::InputTag>("clusterSummaryCollection")),
  m_subdets(),m_subdetenums(),m_subdetvars(),m_clustsummvar()
{

  m_clustsummvar.push_back("cHits");
  m_clustsummvar.push_back("cSize");
  m_clustsummvar.push_back("cCharge");
  m_clustsummvar.push_back("pHits");
  m_clustsummvar.push_back("pSize");
  m_clustsummvar.push_back("pCharge");

  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_subdetenums[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int >("subDetEnum");
    m_subdetvars[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("subDetVariable");
  }
}
FromClusterSummaryMultiplicityProducer::~FromClusterSummaryMultiplicityProducer ( )

Definition at line 99 of file FromClusterSummaryMultiplicityProducer.cc.

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

}

Member Function Documentation

void FromClusterSummaryMultiplicityProducer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 150 of file FromClusterSummaryMultiplicityProducer.cc.

{
}
void FromClusterSummaryMultiplicityProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 156 of file FromClusterSummaryMultiplicityProducer.cc.

                                               {
}
void FromClusterSummaryMultiplicityProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

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().

{

  LogDebug("Multiplicity") << " Ready to go";

  using namespace edm;

  std::auto_ptr<std::map<unsigned int,int> > mults(new std::map<unsigned int,int> );
  
  
  Handle<ClusterSummary> clustsumm;
  iEvent.getByLabel(m_collection,clustsumm);

  clustsumm->SetUserContent(m_clustsummvar);
  
  for(std::map<unsigned int,std::string>::const_iterator sdet=m_subdets.begin();sdet!=m_subdets.end();++sdet) { (*mults)[sdet->first]=0; }

  for(std::map<unsigned int,int>::const_iterator detsel=m_subdetenums.begin();detsel!=m_subdetenums.end();++detsel) {

    //    (*mults)[detsel->first] = int(clustsumm->GetGenericVariable(m_subdetvars[detsel->first])[clustsumm->GetModuleLocation(detsel->second)]);
    (*mults)[detsel->first] = int(clustsumm->GetGenericVariable(m_subdetvars[detsel->first],detsel->second));
    LogDebug("Multiplicity") << "GetModuleLocation result: " << detsel->second << " " << clustsumm->GetModuleLocation(detsel->second);
  }

  
  
  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);
  
}

Member Data Documentation

std::vector<std::string> FromClusterSummaryMultiplicityProducer::m_clustsummvar [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]