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, const CSCDetId id=0, int ichan=0 ) = 0;
29 private:
30  float defaultPed;
31 };
32 
41 public:
43  ~CSCDynamicPedestal2() override{}
44  float pedestal( const std::vector<float>& sca,
45  const CSCRecoConditions*, const CSCDetId, int ) override{
46  float ped = getDefault();
47  if ( !sca.empty() ){
48  ped = ( sca[0]+sca[1] )/2.;
49  }
50  return ped;
51  }
52 };
53 
62 public:
64  ~CSCDynamicPedestal1() override{}
65  float pedestal( const std::vector<float>& sca,
66  const CSCRecoConditions*, const CSCDetId, int ) override{
67  float ped = getDefault();
68  if ( !sca.empty() ){
69  ped = sca[0];
70  }
71  return ped;
72  }
73 };
74 
83 public:
85  ~CSCStaticPedestal() override{}
86  float pedestal( const std::vector<float>& sca,
87  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 {
104  elem -= ped_;
105  }
106  void operator()( int& elem ) const {
107  elem -= static_cast<int>(ped_); // not strictly correct but OK for the typical large pedestals
108  }
109 
110  private:
111  float ped_;
112 };
113 
114 #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
virtual float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond=0, const CSCDetId id=0, int ichan=0)=0
void operator()(int &elem) const
~CSCDynamicPedestal2() override
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
void setDefault(float ped)
Allow reseting of default pedestal (not currently used)
Definition: plugin.cc:24
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()
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond, const CSCDetId id, int ichan) override