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:
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
CSCSubtractPedestal::operator()
void operator()(float &elem) const
Definition: CSCPedestalChoice.h:103
CSCDynamicPedestal2::pedestal
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *, const CSCDetId, int) override
Definition: CSCPedestalChoice.h:47
CSCRecoConditions.h
CSCStaticPedestal::pedestal
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond, const CSCDetId id, int ichan) override
Definition: CSCPedestalChoice.h:87
CSCDynamicPedestal1::CSCDynamicPedestal1
CSCDynamicPedestal1()
Definition: CSCPedestalChoice.h:65
CSCStaticPedestal::~CSCStaticPedestal
~CSCStaticPedestal() override
Definition: CSCPedestalChoice.h:86
CSCSubtractPedestal::ped_
float ped_
Definition: CSCPedestalChoice.h:109
CSCDynamicPedestal1::pedestal
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *, const CSCDetId, int) override
Definition: CSCPedestalChoice.h:67
CSCDetId.h
CSCPedestalChoice::CSCPedestalChoice
CSCPedestalChoice()
Definition: CSCPedestalChoice.h:16
CSCDynamicPedestal2::CSCDynamicPedestal2
CSCDynamicPedestal2()
Definition: CSCPedestalChoice.h:45
cond
Definition: plugin.cc:23
CSCPedestalChoice::defaultPed
float defaultPed
Definition: CSCPedestalChoice.h:33
CSCDynamicPedestal1
Definition: CSCPedestalChoice.h:63
CSCPedestalChoice
Definition: CSCPedestalChoice.h:14
CSCDetId
Definition: CSCDetId.h:26
CSCDynamicPedestal2::~CSCDynamicPedestal2
~CSCDynamicPedestal2() override
Definition: CSCPedestalChoice.h:46
CSCStaticPedestal
Definition: CSCPedestalChoice.h:83
CSCSubtractPedestal
Definition: CSCPedestalChoice.h:100
CSCPedestalChoice::setDefault
void setDefault(float ped)
Allow reseting of default pedestal (not currently used)
Definition: CSCPedestalChoice.h:21
CSCSubtractPedestal::operator()
void operator()(int &elem) const
Definition: CSCPedestalChoice.h:104
CSCDynamicPedestal1::~CSCDynamicPedestal1
~CSCDynamicPedestal1() override
Definition: CSCPedestalChoice.h:66
CSCPedestalChoice::pedestal
virtual float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond=nullptr, const CSCDetId id=0, int ichan=0)=0
CSCDynamicPedestal2
Definition: CSCPedestalChoice.h:43
CSCRecoConditions
Definition: CSCRecoConditions.h:24
CSCPedestalChoice::~CSCPedestalChoice
virtual ~CSCPedestalChoice()
Definition: CSCPedestalChoice.h:17
CSCSubtractPedestal::CSCSubtractPedestal
CSCSubtractPedestal(float ped)
Definition: CSCPedestalChoice.h:102
CSCPedestalChoice::getDefault
float getDefault() const
Return default pedestal (typically zero)
Definition: CSCPedestalChoice.h:19
CSCStaticPedestal::CSCStaticPedestal
CSCStaticPedestal()
Definition: CSCPedestalChoice.h:85