CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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=0, const CSCDetId id=0, int ichan=0 ) = 0;
29 private:
30  float defaultPed;
31 };
32 
41 public:
44  float pedestal( const std::vector<float>& sca,
45  const CSCRecoConditions*, const CSCDetId, int ){
46  float ped = getDefault();
47  if ( !sca.empty() ){
48  ped = ( sca[0]+sca[1] )/2.;
49  }
50  return ped;
51  }
52 };
53 
62 public:
65  float pedestal( const std::vector<float>& sca,
66  const CSCRecoConditions*, const CSCDetId, int ){
67  float ped = getDefault();
68  if ( !sca.empty() ){
69  ped = sca[0];
70  }
71  return ped;
72  }
73 };
74 
83 public:
86  float pedestal( const std::vector<float>& sca,
87  const CSCRecoConditions* cond, const CSCDetId id, int ichan ){
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)
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond, const CSCDetId id, int ichan)
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *, const CSCDetId, int)
void operator()(float &elem) const
float pedestal(const std::vector< float > &sca, const CSCRecoConditions *, const CSCDetId, int)
CSCSubtractPedestal(float ped)
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
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
virtual ~CSCPedestalChoice()