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:
48  int m_mult;
49 #ifndef __ROOTCLING__
51 #endif
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  int m_modthr;
76  int m_mult;
77 #ifndef __ROOTCLING__
79 #endif
80 };
81 
82 template <class T>
84  m_modthr(-1), m_useQuality(false), m_qualityLabel(),
85  m_mult(0)
86 #ifndef __ROOTCLING__
87  ,m_collection()
88 #endif
89 { }
90 
91 #ifndef __ROOTCLING__
92 template <class T>
94  m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
95  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality",false)),
96  m_qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel","")),
97  m_mult(0),
98  m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName")))
99 { }
100 template <class T>
102  m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
103  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality",false)),
104  m_qualityLabel(iConfig.getUntrackedParameter<std::string>("qualityLabel","")),
105  m_mult(0),
106  m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName")))
107 { }
108 #endif
109 
110 #ifndef __ROOTCLING__
111 template <class T>
112 void
114 
115  m_mult = 0;
116 
117  edm::ESHandle<SiStripQuality> qualityHandle;
118  if( m_useQuality) {
119  iSetup.get<SiStripQualityRcd>().get(m_qualityLabel,qualityHandle);
120  }
121 
122  edm::Handle<T> digis;
123  iEvent.getByToken(m_collection,digis);
124 
125 
126  for(typename T::const_iterator it = digis->begin();it!=digis->end();it++) {
127 
128  if(!m_useQuality || !qualityHandle->IsModuleBad(it->detId()) ) {
129  if(m_modthr < 0 || int(it->size()) < m_modthr ) {
130  m_mult += it->size();
131  // mult += it->size();
132  }
133  }
134  }
135 }
136 #endif
137 
138 
139 template<class T>
140 int SingleMultiplicity<T>::mult() const { return m_mult; }
141 
142 template <class T1, class T2>
144 
145  public:
147 #ifndef __ROOTCLING__
150 #endif
151 
152  void getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup);
153  int mult1() const;
154  int mult2() const;
155 
156  private:
157 
160 
161  };
162 
163 template <class T1, class T2>
165  m_multiplicity1(), m_multiplicity2()
166 { }
167 
168 #ifndef __ROOTCLING__
169 template <class T1, class T2>
171  m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"),iC),
172  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"),iC)
173 { }
174 template <class T1, class T2>
176  m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"),iC),
177  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"),iC)
178 { }
179 #endif
180 
181 template <class T1, class T2>
182  void
184 
185  m_multiplicity1.getEvent(iEvent,iSetup);
186  m_multiplicity2.getEvent(iEvent,iSetup);
187 
188 
189 }
190 
191 template<class T1, class T2>
192  int MultiplicityPair<T1,T2>::mult1() const { return m_multiplicity1.mult(); }
193 
194 template<class T1, class T2>
195  int MultiplicityPair<T1,T2>::mult2() const { return m_multiplicity2.mult(); }
196 
203 
204 
205 #endif // DPGAnalysis_SiStripTools_Multiplicities_H
std::string m_qualityLabel
int mult2() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
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:59
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