CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Multiplicities.h
Go to the documentation of this file.
1 #ifndef DPGAnalysis_SiStripTools_Multiplicities_H
2 #define DPGAnalysis_SiStripTools_Multiplicities_H
3 
8 
12 
17 
19 
23 
24 namespace edm {
25  class EventSetup;
26 };
27 
28 #include <string>
29 
31 public:
35 
36  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
37  int mult() const;
38 
39 private:
42  int m_mult;
44 };
45 
46 template <class T>
48 public:
52 
53  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
54  int mult() const;
55  // int mult;
56 
57 private:
58  int m_modthr;
61  int m_mult;
63 };
64 
65 template <class T>
66 SingleMultiplicity<T>::SingleMultiplicity() : m_modthr(-1), m_useQuality(false), m_mult(0), m_collection() {}
67 
68 template <class T>
70  : m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
71  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality", false)),
72  m_qualityToken(m_useQuality
73  ? decltype(m_qualityToken){iC.esConsumes<SiStripQuality, SiStripQualityRcd>(
74  edm::ESInputTag{"", iConfig.getUntrackedParameter<std::string>("qualityLabel", "")})}
75  : decltype(m_qualityToken){}),
76  m_mult(0),
77  m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))) {}
78 template <class T>
80  : m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
81  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality", false)),
84  edm::ESInputTag(iConfig.getUntrackedParameter<std::string>("qualityLabel", "")))}
85  : decltype(m_qualityToken){}),
86  m_mult(0),
87  m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))) {}
88 
89 template <class T>
91  m_mult = 0;
92 
93  const SiStripQuality* quality = nullptr;
94  if (m_useQuality) {
95  quality = &iSetup.getData(m_qualityToken);
96  }
97 
98  edm::Handle<T> digis;
99  iEvent.getByToken(m_collection, digis);
100 
101  for (typename T::const_iterator it = digis->begin(); it != digis->end(); it++) {
102  if (!m_useQuality || !quality->IsModuleBad(it->detId())) {
103  if (m_modthr < 0 || int(it->size()) < m_modthr) {
104  m_mult += it->size();
105  // mult += it->size();
106  }
107  }
108  }
109 }
110 
111 template <class T>
113  return m_mult;
114 }
115 
116 template <class T1, class T2>
118 public:
122 
123  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
124  int mult1() const;
125  int mult2() const;
126 
127 private:
130 };
131 
132 template <class T1, class T2>
133 MultiplicityPair<T1, T2>::MultiplicityPair() : m_multiplicity1(), m_multiplicity2() {}
134 
135 template <class T1, class T2>
137  : m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"), iC),
138  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"), iC) {}
139 template <class T1, class T2>
141  : m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"), iC),
142  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"), iC) {}
143 
144 template <class T1, class T2>
146  m_multiplicity1.getEvent(iEvent, iSetup);
147  m_multiplicity2.getEvent(iEvent, iSetup);
148 }
149 
150 template <class T1, class T2>
152  return m_multiplicity1.mult();
153 }
154 
155 template <class T1, class T2>
157  return m_multiplicity2.mult();
158 }
159 
168 
169 #endif // DPGAnalysis_SiStripTools_Multiplicities_H
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
int mult2() const
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > m_qualityToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
m_mult(0)
int mult1() const
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::EDGetTokenT< T > m_collection
MultiplicityPair< ClusterSummarySingleMultiplicity, ClusterSummarySingleMultiplicity > ClusterSummaryMultiplicityPair
MultiplicityPair< SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > >, SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > > SiPixelClusterSiStripClusterMultiplicityPair
string quality
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
int iEvent
Definition: GenABIO.cc:224
SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > > SingleSiPixelClusterMultiplicity
SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > SingleSiStripClusterMultiplicity
ClusterSummary::VariablePlacement m_varenum
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool IsModuleBad(uint32_t detid) const
ClusterSummary::CMSTracker m_subdetenum
m_collection(iC.consumes< T >(iConfig.getParameter< edm::InputTag >("collectionName")))
long double T
SingleMultiplicity< edm::DetSetVector< SiStripDigi > > SingleSiStripDigiMultiplicity
edm::EDGetTokenT< ClusterSummary > m_collection