CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCPedestalChoice.h
Go to the documentation of this file.
1 #ifndef CSCRecHitD_CSCPedestalChoice_h
2 #define CSCRecHitD_CSCPedestalChoice_h
3 
12 #include <vector>
13 
15 public:
17  virtual ~CSCPedestalChoice(){};
19  float getDefault() const { return defaultPed; }
21  void setDefault(float ped) { defaultPed = ped; }
27  virtual float pedestal(const std::vector<float>& sca,
28  const CSCRecoConditions* cond = nullptr,
29  const CSCDetId id = 0,
30  int ichan = 0) = 0;
31 
32 private:
33  float defaultPed;
34 };
35 
44 public:
46  ~CSCDynamicPedestal2() override {}
47  float pedestal(const std::vector<float>& sca, const CSCRecoConditions*, const CSCDetId, int) override {
48  float ped = getDefault();
49  if (!sca.empty()) {
50  ped = (sca[0] + sca[1]) / 2.;
51  }
52  return ped;
53  }
54 };
55 
64 public:
66  ~CSCDynamicPedestal1() override {}
67  float pedestal(const std::vector<float>& sca, const CSCRecoConditions*, const CSCDetId, int) override {
68  float ped = getDefault();
69  if (!sca.empty()) {
70  ped = sca[0];
71  }
72  return ped;
73  }
74 };
75 
84 public:
86  ~CSCStaticPedestal() override {}
87  float pedestal(const std::vector<float>& sca, const CSCRecoConditions* cond, const CSCDetId id, int ichan) override {
88  float ped = cond->pedestal(id, ichan);
89  return ped;
90  }
91 };
92 
101 public:
102  CSCSubtractPedestal(float ped) : ped_(ped) {}
103  void operator()(float& elem) const { elem -= ped_; }
104  void operator()(int& elem) const {
105  elem -= static_cast<int>(ped_); // not strictly correct but OK for the typical large pedestals
106  }
107 
108 private:
109  float ped_;
110 };
111 
112 #endif
float getDefault() const
Return default pedestal (typically zero)
~CSCStaticPedestal() override
void operator()(float &elem) const
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *, const CSCDetId, int) override
CSCSubtractPedestal(float ped)
~CSCDynamicPedestal1() override
void operator()(int &elem) const
~CSCDynamicPedestal2() override
void setDefault(float ped)
Allow reseting of default pedestal (not currently used)
float pedestal(const CSCDetId &id, int channel) const
static pedestal in ADC counts for strip channel (e.g. 1-16 for ganged ME1a, 1-48 for unganged ME1a) ...
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *, const CSCDetId, int) override
virtual ~CSCPedestalChoice()
virtual float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond=nullptr, const CSCDetId id=0, int ichan=0)=0
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond, const CSCDetId id, int ichan) override