CMS 3D CMS Logo

Multiplicities.h
Go to the documentation of this file.
1 #ifndef DPGAnalysis_SiStripTools_Multiplicities_H
2 #define DPGAnalysis_SiStripTools_Multiplicities_H
3 
4 #ifndef __ROOTCLING__
10 #endif
11 
15 
20 
22 
26 
27 namespace edm {
28  class EventSetup;
29 };
30 
31 #include <string>
32 
34 public:
36 #ifndef __ROOTCLING__
39 #endif
40 
41  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
42  int mult() const;
43 
44 private:
47  int m_mult;
48 #ifndef __ROOTCLING__
50 #endif
51 };
52 
53 template <class T>
55 public:
57 #ifndef __ROOTCLING__
60 #endif
61 
62  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
63  int mult() const;
64  // int mult;
65 
66 private:
67  int m_modthr;
70  int m_mult;
71 #ifndef __ROOTCLING__
73 #endif
74 };
75 
76 template <class T>
78  : m_modthr(-1),
79  m_useQuality(false),
80  m_qualityLabel(),
81  m_mult(0)
82 #ifndef __ROOTCLING__
83  ,
84  m_collection()
85 #endif
86 {
87 }
88 
89 #ifndef __ROOTCLING__
90 template <class T>
92  : m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
93  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality", false)),
94  m_qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel", "")),
95  m_mult(0),
96  m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))) {}
97 template <class T>
99  : m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
100  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality", false)),
101  m_qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel", "")),
102  m_mult(0),
103  m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))) {}
104 #endif
105 
106 #ifndef __ROOTCLING__
107 template <class T>
109  m_mult = 0;
110 
111  edm::ESHandle<SiStripQuality> qualityHandle;
112  if (m_useQuality) {
113  iSetup.get<SiStripQualityRcd>().get(m_qualityLabel, qualityHandle);
114  }
115 
116  edm::Handle<T> digis;
117  iEvent.getByToken(m_collection, digis);
118 
119  for (typename T::const_iterator it = digis->begin(); it != digis->end(); it++) {
120  if (!m_useQuality || !qualityHandle->IsModuleBad(it->detId())) {
121  if (m_modthr < 0 || int(it->size()) < m_modthr) {
122  m_mult += it->size();
123  // mult += it->size();
124  }
125  }
126  }
127 }
128 #endif
129 
130 template <class T>
132  return m_mult;
133 }
134 
135 template <class T1, class T2>
137 public:
139 #ifndef __ROOTCLING__
142 #endif
143 
144  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
145  int mult1() const;
146  int mult2() const;
147 
148 private:
151 };
152 
153 template <class T1, class T2>
154 MultiplicityPair<T1, T2>::MultiplicityPair() : m_multiplicity1(), m_multiplicity2() {}
155 
156 #ifndef __ROOTCLING__
157 template <class T1, class T2>
159  : m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"), iC),
160  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"), iC) {}
161 template <class T1, class T2>
163  : m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"), iC),
164  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"), iC) {}
165 #endif
166 
167 template <class T1, class T2>
169  m_multiplicity1.getEvent(iEvent, iSetup);
170  m_multiplicity2.getEvent(iEvent, iSetup);
171 }
172 
173 template <class T1, class T2>
175  return m_multiplicity1.mult();
176 }
177 
178 template <class T1, class T2>
180  return m_multiplicity2.mult();
181 }
182 
191 
192 #endif // DPGAnalysis_SiStripTools_Multiplicities_H
std::string m_qualityLabel
int mult2() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
int mult1() const
edm::EDGetTokenT< T > m_collection
MultiplicityPair< ClusterSummarySingleMultiplicity, ClusterSummarySingleMultiplicity > ClusterSummaryMultiplicityPair
MultiplicityPair< SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > >, SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > > SiPixelClusterSiStripClusterMultiplicityPair
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
int iEvent
Definition: GenABIO.cc:224
SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > > SingleSiPixelClusterMultiplicity
SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > SingleSiStripClusterMultiplicity
bool IsModuleBad(const uint32_t &detid) const
ClusterSummary::VariablePlacement m_varenum
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
ClusterSummary::CMSTracker m_subdetenum
HLT enums.
T get() const
Definition: EventSetup.h:73
long double T
SingleMultiplicity< edm::DetSetVector< SiStripDigi > > SingleSiStripDigiMultiplicity
edm::EDGetTokenT< ClusterSummary > m_collection