CMS 3D CMS Logo

FromClusterSummaryMultiplicityProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FromClusterSummaryMultiplicityProducer
4 // Class: FromClusterSummaryMultiplicityProducer
5 //
12 //
13 // Original Author: Andrea Venturi
14 // Created: Fri Dec 04 2009
15 //
16 //
17 
18 // system include files
19 #include <memory>
20 #include <string>
21 #include <map>
22 #include <vector>
23 
24 // user include files
27 
30 
34 
36 
37 //
38 // class decleration
39 //
41 public:
44 
45 private:
46  void beginJob() override;
47  void produce(edm::Event&, const edm::EventSetup&) override;
48  void endJob() override;
49 
50  // ----------member data ---------------------------
51 
53  std::vector<ClusterSummary::CMSTracker> m_subdetenums;
54  std::vector<int> m_subdetsel;
56 };
57 
58 //
59 // constants, enums and typedefs
60 //
61 
62 //
63 // static data member definitions
64 //
65 
66 //
67 // constructors and destructor
68 //
70  : m_collectionToken(consumes<ClusterSummary>(iConfig.getParameter<edm::InputTag>("clusterSummaryCollection"))),
71  m_subdetenums(),
72  m_subdetsel(),
73  m_subdetvar(ClusterSummary::NCLUSTERS) {
74  produces<std::map<unsigned int, int> >();
75 
76  //now do what ever other initialization is needed
77 
78  std::vector<edm::ParameterSet> wantedsubds(iConfig.getParameter<std::vector<edm::ParameterSet> >("wantedSubDets"));
79  m_subdetenums.reserve(wantedsubds.size());
80  m_subdetsel.reserve(wantedsubds.size());
81 
82  for (std::vector<edm::ParameterSet>::iterator ps = wantedsubds.begin(); ps != wantedsubds.end(); ++ps) {
83  m_subdetenums.push_back((ClusterSummary::CMSTracker)ps->getParameter<int>("subDetEnum"));
84  m_subdetsel.push_back(ps->getParameter<int>("subDetEnum"));
85  }
87 }
88 
90  // do anything here that needs to be done at desctruction time
91  // (e.g. close files, deallocate resources etc.)
92 }
93 
94 //
95 // member functions
96 //
97 
98 // ------------ method called to produce the data ------------
100  LogDebug("Multiplicity") << " Ready to go";
101 
102  using namespace edm;
103 
104  std::unique_ptr<std::map<unsigned int, int> > mults(new std::map<unsigned int, int>);
105 
106  Handle<ClusterSummary> clustsumm;
107  iEvent.getByToken(m_collectionToken, clustsumm);
108 
109  switch (m_subdetvar) {
111  for (unsigned int iS = 0; iS < m_subdetenums.size(); ++iS)
112  (*mults)[m_subdetsel[iS]] = int(clustsumm->getNClus(m_subdetenums[iS]));
113  break;
115  for (unsigned int iS = 0; iS < m_subdetenums.size(); ++iS)
116  (*mults)[m_subdetsel[iS]] = int(clustsumm->getClusSize(m_subdetenums[iS]));
117  break;
119  for (unsigned int iS = 0; iS < m_subdetenums.size(); ++iS)
120  (*mults)[m_subdetsel[iS]] = int(clustsumm->getClusCharge(m_subdetenums[iS]));
121  break;
122  default:
123  for (unsigned int iS = 0; iS < m_subdetenums.size(); ++iS)
124  (*mults)[m_subdetsel[iS]] = -1;
125  }
126 
127  for (unsigned int iS = 0; iS < m_subdetenums.size(); ++iS)
128  LogDebug("Multiplicity") << "GetModuleLocation result: " << m_subdetenums[iS] << " "
129  << clustsumm->getModuleLocation(m_subdetenums[iS]);
130 
131  for (std::map<unsigned int, int>::const_iterator it = mults->begin(); it != mults->end(); ++it) {
132  LogDebug("Multiplicity") << " Found " << it->second << " digis/clusters in " << it->first;
133  }
134 
135  iEvent.put(std::move(mults));
136 }
137 
138 // ------------ method called once each job just before starting event loop ------------
140 
141 // ------------ method called once each job just after ending the event loop ------------
143 
MessageLogger.h
EDProducer.h
edm::EDGetTokenT< ClusterSummary >
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::Handle
Definition: AssociativeIterator.h:50
FromClusterSummaryMultiplicityProducer::beginJob
void beginJob() override
Definition: FromClusterSummaryMultiplicityProducer.cc:139
FromClusterSummaryMultiplicityProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: FromClusterSummaryMultiplicityProducer.cc:99
ClusterSummary::getModuleLocation
int getModuleLocation(int mod, bool warn=true) const
Definition: ClusterSummary.cc:42
ClusterSummary.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
FromClusterSummaryMultiplicityProducer::m_subdetvar
ClusterSummary::VariablePlacement m_subdetvar
Definition: FromClusterSummaryMultiplicityProducer.cc:55
Event.h
ClusterSummary::VariablePlacement
VariablePlacement
Definition: ClusterSummary.h:99
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
ClusterSummary::getClusSize
int getClusSize(const CMSTracker mod) const
Definition: ClusterSummary.h:120
FromClusterSummaryMultiplicityProducer::FromClusterSummaryMultiplicityProducer
FromClusterSummaryMultiplicityProducer(const edm::ParameterSet &)
Definition: FromClusterSummaryMultiplicityProducer.cc:69
ClusterSummary::NCLUSTERS
Definition: ClusterSummary.h:99
ClusterSummary::getClusCharge
float getClusCharge(const CMSTracker mod) const
Definition: ClusterSummary.h:124
edm::EventSetup
Definition: EventSetup.h:57
FromClusterSummaryMultiplicityProducer::m_subdetenums
std::vector< ClusterSummary::CMSTracker > m_subdetenums
Definition: FromClusterSummaryMultiplicityProducer.cc:53
FromClusterSummaryMultiplicityProducer::~FromClusterSummaryMultiplicityProducer
~FromClusterSummaryMultiplicityProducer() override
Definition: FromClusterSummaryMultiplicityProducer.cc:89
ClusterSummary::CLUSTERCHARGE
Definition: ClusterSummary.h:99
InputTag.h
ClusterSummary::CMSTracker
CMSTracker
Definition: ClusterSummary.h:83
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
FromClusterSummaryMultiplicityProducer::m_subdetsel
std::vector< int > m_subdetsel
Definition: FromClusterSummaryMultiplicityProducer.cc:54
eostools.move
def move(src, dest)
Definition: eostools.py:511
ClusterSummary
Definition: ClusterSummary.h:59
FromClusterSummaryMultiplicityProducer::endJob
void endJob() override
Definition: FromClusterSummaryMultiplicityProducer.cc:142
Frameworkfwd.h
ClusterSummary::CLUSTERSIZE
Definition: ClusterSummary.h:99
edm::EDProducer
Definition: EDProducer.h:36
ParameterSet.h
ClusterSummary::getNClus
int getNClus(const CMSTracker mod) const
Definition: ClusterSummary.h:116
edm::Event
Definition: Event.h:73
FromClusterSummaryMultiplicityProducer::m_collectionToken
edm::EDGetTokenT< ClusterSummary > m_collectionToken
Definition: FromClusterSummaryMultiplicityProducer.cc:52
FromClusterSummaryMultiplicityProducer
Definition: FromClusterSummaryMultiplicityProducer.cc:40