CMS 3D CMS Logo

MultiplicityAlgorithms.h
Go to the documentation of this file.
1 #ifndef DPGAnalysis_SiStripTools_MultiplicityAlgorithms_H
2 #define DPGAnalysis_SiStripTools_MultiplicityAlgorithms_H
3 
8 
12 
17 
19 
23 
25 
26 namespace edm {
27  class EventSetup;
28 };
29 
30 #include <string>
31 
34  public:
38 
39  value_t getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup) const;
40 
41  private:
45  };
46 
47  template <class T>
49  public:
53 
54  value_t getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup) const;
55 
56  private:
57  int m_modthr;
61  };
62 
63  template <class T>
65  : m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
66  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality", false)),
67  m_qualityToken(m_useQuality
68  ? decltype(m_qualityToken){iC.esConsumes<SiStripQuality, SiStripQualityRcd>(
69  edm::ESInputTag{"", iConfig.getUntrackedParameter<std::string>("qualityLabel", "")})}
70  : decltype(m_qualityToken){}),
71  m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))) {}
72  template <class T>
74  : m_modthr(iConfig.getUntrackedParameter<int>("moduleThreshold")),
75  m_useQuality(iConfig.getUntrackedParameter<bool>("useQuality", false)),
76  m_qualityToken(m_useQuality
77  ? decltype(m_qualityToken){iC.esConsumes<SiStripQuality, SiStripQualityRcd>(
78  edm::ESInputTag(iConfig.getUntrackedParameter<std::string>("qualityLabel", "")))}
79  : decltype(m_qualityToken){}),
80  m_collection(iC.consumes<T>(iConfig.getParameter<edm::InputTag>("collectionName"))) {}
81 
82  template <class T>
84  const edm::EventSetup& iSetup) const {
85  int mult = 0;
86 
87  const SiStripQuality* quality = nullptr;
88  if (m_useQuality) {
89  quality = &iSetup.getData(m_qualityToken);
90  }
91 
92  edm::Handle<T> digis;
93  iEvent.getByToken(m_collection, digis);
94 
95  for (typename T::const_iterator it = digis->begin(); it != digis->end(); it++) {
96  if (!m_useQuality || !quality->IsModuleBad(it->detId())) {
97  if (m_modthr < 0 || int(it->size()) < m_modthr) {
98  mult += it->size();
99  // mult += it->size();
100  }
101  }
102  }
103  return value_t(mult);
104  }
105 
106  template <class T1, class T2>
108  public:
113 
114  value_t getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup) const;
115 
116  private:
119  };
120 
121  template <class T1, class T2>
122  MultiplicityPair<T1, T2>::MultiplicityPair() : m_multiplicity1(), m_multiplicity2() {}
123 
124  template <class T1, class T2>
126  : m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"), iC),
127  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"), iC) {}
128  template <class T1, class T2>
130  : m_multiplicity1(iConfig.getParameter<edm::ParameterSet>("firstMultiplicityConfig"), iC),
131  m_multiplicity2(iConfig.getParameter<edm::ParameterSet>("secondMultiplicityConfig"), iC) {}
132 
133  template <class T1, class T2>
135  const edm::EventSetup& iSetup) const {
136  auto m1 = m_multiplicity1.getEvent(iEvent, iSetup);
137  auto m2 = m_multiplicity2.getEvent(iEvent, iSetup);
138  return value_t(m1, m2);
139  }
140 
149 } // namespace sistriptools::algorithm
150 
151 #endif // DPGAnalysis_SiStripTools_Multiplicities_H
value_t getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) const
SingleMultiplicity(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > m_qualityToken
value_t getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) const
T getUntrackedParameter(std::string const &, T const &) const
string quality
int iEvent
Definition: GenABIO.cc:224
ClusterSummarySingleMultiplicity(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
value_t getEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) const
SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > > SingleSiPixelClusterMultiplicity
HLT enums.
SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > SingleSiStripClusterMultiplicity
MultiplicityPair< SingleMultiplicity< edmNew::DetSetVector< SiPixelCluster > >, SingleMultiplicity< edmNew::DetSetVector< SiStripCluster > > > SiPixelClusterSiStripClusterMultiplicityPair
SingleMultiplicity< edm::DetSetVector< SiStripDigi > > SingleSiStripDigiMultiplicity
MultiplicityPair< ClusterSummarySingleMultiplicity, ClusterSummarySingleMultiplicity > ClusterSummaryMultiplicityPair
long double T