CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoLocalMuon/CSCRecHitD/src/CSCPedestalChoice.h

Go to the documentation of this file.
00001 #ifndef CSCRecHitD_CSCPedestalChoice_h
00002 #define CSCRecHitD_CSCPedestalChoice_h
00003 
00010 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00011 #include "RecoLocalMuon/CSCRecHitD/src/CSCRecoConditions.h"
00012 #include <vector>
00013 
00014 class CSCPedestalChoice {
00015 public:
00016         CSCPedestalChoice() : defaultPed( 0. ){}
00017         virtual ~CSCPedestalChoice(){};
00019         float getDefault() const { return defaultPed; } 
00021         void setDefault( float ped ) { defaultPed = ped; }
00027         virtual float pedestal( const std::vector<float>& sca, 
00028            const CSCRecoConditions* cond=0, const CSCDetId id=0, int ichan=0 ) = 0;
00029 private:
00030         float defaultPed;
00031 };
00032 
00040 class CSCDynamicPedestal2 : public CSCPedestalChoice {
00041 public:
00042         CSCDynamicPedestal2(){}
00043         ~CSCDynamicPedestal2(){}
00044         float pedestal( const std::vector<float>& sca, 
00045             const CSCRecoConditions*, const CSCDetId, int ){
00046                 float ped = getDefault();
00047                 if ( !sca.empty() ){
00048                         ped = ( sca[0]+sca[1] )/2.;
00049                 }
00050                 return ped;
00051         }
00052 };
00053 
00061 class CSCDynamicPedestal1 : public CSCPedestalChoice {
00062 public:
00063         CSCDynamicPedestal1(){}
00064         ~CSCDynamicPedestal1(){}
00065         float pedestal( const std::vector<float>& sca,
00066             const CSCRecoConditions*, const CSCDetId, int ){
00067                 float ped = getDefault();
00068                 if ( !sca.empty() ){
00069                         ped = sca[0];
00070                 }
00071           return ped;
00072         }
00073 };
00074 
00082 class CSCStaticPedestal : public CSCPedestalChoice {
00083 public:
00084         CSCStaticPedestal(){}
00085         ~CSCStaticPedestal(){}
00086         float pedestal( const std::vector<float>& sca,
00087             const CSCRecoConditions* cond, const CSCDetId id, int ichan ){
00088                 float ped = cond->pedestal(id, ichan );
00089                 return ped;
00090         }
00091 };
00092 
00100 class CSCSubtractPedestal {
00101   public:
00102     CSCSubtractPedestal( float ped ): ped_(ped) {}
00103     void operator()( float& elem ) const {
00104       elem -= ped_;
00105     }
00106     void operator()( int& elem ) const {
00107       elem -= static_cast<int>(ped_); // not strictly correct but OK for the typical large pedestals
00108     }
00109 
00110   private:
00111      float ped_;
00112 };
00113 
00114 #endif