CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Multiplicities.h
Go to the documentation of this file.
1 #ifndef DPGAnalysis_SiStripTools_Multiplicities_H
2 #define DPGAnalysis_SiStripTools_Multiplicities_H
3 
4 #ifndef __GCCXML__
10 #endif
11 
15 
20 
22 
26 
27 namespace edm {
28  class EventSetup;
29 };
30 
31 #include <string>
32 
34 
35  public:
37 #ifndef __GCCXML__
40 #endif
41 
42  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
43  int mult() const;
44 
45  private:
46 #ifndef __GCCXML__
48 #endif
51  std::vector<std::string> m_clustsummvar;
52  int m_mult;
53 
54 };
55 
56 
57 
58 template <class T>
60 
61  public:
63 #ifndef __GCCXML__
66 #endif
67 
68  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
69  int mult() const;
70  // int mult;
71 
72  private:
73 
74 #ifndef __GCCXML__
76 #endif
77  int m_modthr;
80  int m_mult;
81 };
82 
83 template <class T>
85  // mult(0),
86 #ifndef __GCCXML__
87 m_collection(),
88 #endif
89  m_modthr(-1), m_useQuality(false), m_qualityLabel(),
90  m_mult(0)
91 { }
92 
93 #ifndef __GCCXML__
94 template <class T>
96  // mult(0),
97 m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))),
98  m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
99  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality",false)),
100  m_qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel","")),
101  m_mult(0)
102 { }
103 template <class T>
105  // mult(0),
106 m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))),
107  m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
108  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality",false)),
109  m_qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel","")),
110  m_mult(0)
111 { }
112 #endif
113 
114 #ifndef __GCCXML__
115 template <class T>
116 void
118 
119  m_mult = 0;
120  // mult = 0;
121 
122  edm::ESHandle<SiStripQuality> qualityHandle;
123  if( m_useQuality) {
124  iSetup.get<SiStripQualityRcd>().get(m_qualityLabel,qualityHandle);
125  }
126 
127  edm::Handle<T> digis;
128  iEvent.getByToken(m_collection,digis);
129 
130 
131  for(typename T::const_iterator it = digis->begin();it!=digis->end();it++) {
132 
133  if(!m_useQuality || !qualityHandle->IsModuleBad(it->detId()) ) {
134  if(m_modthr < 0 || int(it->size()) < m_modthr ) {
135  m_mult += it->size();
136  // mult += it->size();
137  }
138  }
139  }
140 }
141 #endif
142 
143 
144 template<class T>
145 int SingleMultiplicity<T>::mult() const { return m_mult; }
146 
147 template <class T1, class T2>
149 
150  public:
152 #ifndef __GCCXML__
155 #endif
156 
157  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
158  int mult1() const;
159  int mult2() const;
160  // int mult1;
161  // int mult2;
162 
163  private:
164 
167 
168  };
169 
170 template <class T1, class T2>
172  // mult1(0),mult2(0),
173  m_multiplicity1(), m_multiplicity2()
174 { }
175 
176 #ifndef __GCCXML__
177 template <class T1, class T2>
179  // mult1(0),mult2(0),
180  m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"),iC),
181  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"),iC)
182 { }
183 template <class T1, class T2>
185  // mult1(0),mult2(0),
186  m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"),iC),
187  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"),iC)
188 { }
189 #endif
190 
191 template <class T1, class T2>
192  void
194 
195  m_multiplicity1.getEvent(iEvent,iSetup);
196  m_multiplicity2.getEvent(iEvent,iSetup);
197 
198  // mult1=m_multiplicity1.mult;
199  // mult2=m_multiplicity2.mult;
200 
201 }
202 
203 template<class T1, class T2>
204  int MultiplicityPair<T1,T2>::mult1() const { return m_multiplicity1.mult(); }
205 
206 template<class T1, class T2>
207  int MultiplicityPair<T1,T2>::mult2() const { return m_multiplicity2.mult(); }
208 
215 
216 
217 #endif // DPGAnalysis_SiStripTools_Multiplicities_H
std::string m_qualityLabel
int mult2() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
int mult1() const
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
MultiplicityPair< ClusterSummarySingleMultiplicity, ClusterSummarySingleMultiplicity > ClusterSummaryMultiplicityPair
edm::EDGetTokenT< T > m_collection
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< std::string > m_clustsummvar
int iEvent
Definition: GenABIO.cc:230
SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > > SingleSiPixelClusterMultiplicity
SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > SingleSiStripClusterMultiplicity
void getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const T & get() const
Definition: EventSetup.h:55
MultiplicityPair< SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > >,SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > > SiPixelClusterSiStripClusterMultiplicityPair
volatile std::atomic< bool > shutdown_flag false
long double T
SingleMultiplicity< edm::DetSetVector< SiStripDigi > > SingleSiStripDigiMultiplicity
edm::EDGetTokenT< ClusterSummary > m_collection