00001 // This is CSCPeakBinOfStripPulse 00002 00003 #include <RecoLocalMuon/CSCRecHitD/src/CSCPeakBinOfStripPulse.h> 00004 00005 #include <DataFormats/CSCDigi/interface/CSCStripDigi.h> 00006 00007 #include <FWCore/ParameterSet/interface/ParameterSet.h> 00008 00009 #include <vector> 00010 00011 00012 CSCPeakBinOfStripPulse::CSCPeakBinOfStripPulse( const edm::ParameterSet& ps ) { 00013 00014 00015 } 00016 00017 00018 CSCPeakBinOfStripPulse::~CSCPeakBinOfStripPulse() { 00019 00020 } 00021 00022 00023 /* peakAboveBaseline 00024 * 00025 * This finds the seed for the cluster, 00026 * 00027 */ 00028 bool CSCPeakBinOfStripPulse::peakAboveBaseline( const CSCStripDigi& digi, float& hmax, int& tmax, float* height ) const { 00029 00030 std::vector<int> sca = digi.getADCCounts(); 00031 00032 // Initialize parameters, just in case... 00033 tmax = 0; 00034 hmax = 0; 00035 if ( sca.empty() ) return false; 00036 00037 00038 // First find maximum time bin 00039 for (int i = 0; i < 8; ++i ) { 00040 if (sca[i] > sca[tmax] ) tmax = i; 00041 } 00042 00043 // Find pedestal 00044 float ped = baseline( digi ); 00045 00046 // Store ADC signal for time bins [2-7] 00047 int i = 0; 00048 for ( int t = 2; t < 8; ++t ) { 00049 height[i] = sca[t] - ped; 00050 i++; 00051 } 00052 00053 // Maximum cannot occur in first 3 time bins or in last time bin. 00054 if ( tmax < 2 || tmax > 6) return false; 00055 hmax = height[tmax-2]; 00056 return true; 00057 } 00058 00059 00060 00061 /* baseline 00062 * 00063 */ 00064 float CSCPeakBinOfStripPulse::baseline(const CSCStripDigi& digi) const { 00065 std::vector<int> sca = digi.getADCCounts(); 00066 00067 float ped = ( sca[0]+sca[1] ) / 2.; 00068 00069 return ped; 00070 } 00071 00072