CMS 3D CMS Logo

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:
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
~CSCStaticPedestal() override
float getDefault() const
Return default pedestal (typically zero)
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *, const CSCDetId, int) override
void operator()(float &elem) const
CSCSubtractPedestal(float ped)
~CSCDynamicPedestal1() override
~CSCDynamicPedestal2() override
void setDefault(float ped)
Allow reseting of default pedestal (not currently used)
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *, const CSCDetId, int) override
virtual ~CSCPedestalChoice()
void operator()(int &elem) const
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