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 
35  public:
37 #ifndef __ROOTCLING__
40 #endif
41 
42  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
43  int mult() const;
44 
45  private:
46 #ifndef __ROOTCLING__
48 #endif
51  int m_mult;
52 
53 };
54 
55 
56 
57 template <class T>
59 
60  public:
62 #ifndef __ROOTCLING__
65 #endif
66 
67  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
68  int mult() const;
69  // int mult;
70 
71  private:
72 
73 #ifndef __ROOTCLING__
75 #endif
76  int m_modthr;
79  int m_mult;
80 };
81 
82 template <class T>
84  // mult(0),
85 #ifndef __ROOTCLING__
86 m_collection(),
87 #endif
88  m_modthr(-1), m_useQuality(false), m_qualityLabel(),
89  m_mult(0)
90 { }
91 
92 #ifndef __ROOTCLING__
93 template <class T>
95  // mult(0),
96 m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))),
97  m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
98  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality",false)),
99  m_qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel","")),
100  m_mult(0)
101 { }
102 template <class T>
104  // mult(0),
105 m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))),
106  m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
107  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality",false)),
108  m_qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel","")),
109  m_mult(0)
110 { }
111 #endif
112 
113 #ifndef __ROOTCLING__
114 template <class T>
115 void
117 
118  m_mult = 0;
119  // mult = 0;
120 
121  edm::ESHandle<SiStripQuality> qualityHandle;
122  if( m_useQuality) {
123  iSetup.get<SiStripQualityRcd>().get(m_qualityLabel,qualityHandle);
124  }
125 
126  edm::Handle<T> digis;
127  iEvent.getByToken(m_collection,digis);
128 
129 
130  for(typename T::const_iterator it = digis->begin();it!=digis->end();it++) {
131 
132  if(!m_useQuality || !qualityHandle->IsModuleBad(it->detId()) ) {
133  if(m_modthr < 0 || int(it->size()) < m_modthr ) {
134  m_mult += it->size();
135  // mult += it->size();
136  }
137  }
138  }
139 }
140 #endif
141 
142 
143 template<class T>
144 int SingleMultiplicity<T>::mult() const { return m_mult; }
145 
146 template <class T1, class T2>
148 
149  public:
151 #ifndef __ROOTCLING__
154 #endif
155 
156  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
157  int mult1() const;
158  int mult2() const;
159  // int mult1;
160  // int mult2;
161 
162  private:
163 
166 
167  };
168 
169 template <class T1, class T2>
171  // mult1(0),mult2(0),
172  m_multiplicity1(), m_multiplicity2()
173 { }
174 
175 #ifndef __ROOTCLING__
176 template <class T1, class T2>
178  // mult1(0),mult2(0),
179  m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"),iC),
180  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"),iC)
181 { }
182 template <class T1, class T2>
184  // mult1(0),mult2(0),
185  m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"),iC),
186  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"),iC)
187 { }
188 #endif
189 
190 template <class T1, class T2>
191  void
193 
194  m_multiplicity1.getEvent(iEvent,iSetup);
195  m_multiplicity2.getEvent(iEvent,iSetup);
196 
197  // mult1=m_multiplicity1.mult;
198  // mult2=m_multiplicity2.mult;
199 
200 }
201 
202 template<class T1, class T2>
203  int MultiplicityPair<T1,T2>::mult1() const { return m_multiplicity1.mult(); }
204 
205 template<class T1, class T2>
206  int MultiplicityPair<T1,T2>::mult2() const { return m_multiplicity2.mult(); }
207 
214 
215 
216 #endif // DPGAnalysis_SiStripTools_Multiplicities_H
std::string m_qualityLabel
int mult2() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
int mult1() const
MultiplicityPair< ClusterSummarySingleMultiplicity, ClusterSummarySingleMultiplicity > ClusterSummaryMultiplicityPair
edm::EDGetTokenT< T > m_collection
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
int iEvent
Definition: GenABIO.cc:230
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)
const T & get() const
Definition: EventSetup.h:56
ClusterSummary::CMSTracker m_subdetenum
HLT enums.
MultiplicityPair< SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > >,SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > > SiPixelClusterSiStripClusterMultiplicityPair
long double T
SingleMultiplicity< edm::DetSetVector< SiStripDigi > > SingleSiStripDigiMultiplicity
edm::EDGetTokenT< ClusterSummary > m_collection