00001 #include "SimMuon/CSCDigitizer/src/CSCCrosstalkGenerator.h" 00002 #include "SimMuon/CSCDigitizer/src/CSCAnalogSignal.h" 00003 00004 CSCAnalogSignal CSCCrosstalkGenerator::getCrosstalk(const CSCAnalogSignal & inputSignal) const { 00005 int nBins = inputSignal.getSize(); 00006 float binSize = inputSignal.getBinSize(); 00007 std::vector<float> binValues(nBins); 00008 00009 for(int outputBin = 0; outputBin < nBins; ++outputBin) { 00010 float aTime = outputBin*binSize - theDelay; 00011 float slope = inputSignal.getValue(aTime) - inputSignal.getValue(aTime-1.); 00012 binValues[outputBin] = slope * theCrosstalk 00013 + theResistiveFraction * inputSignal.getValue(aTime); 00014 } 00015 00016 return CSCAnalogSignal(0, binSize, binValues, 0., inputSignal.getTimeOffset()); 00017 } 00018 00019 00020 float CSCCrosstalkGenerator::ratio(const CSCAnalogSignal & crosstalkSignal, const CSCAnalogSignal & signal) const 00021 { 00022 00023 float maxFirst = 0., maxSecond = 0.; 00024 int nbins = signal.getSize(); 00025 for(int i = 1; i < nbins; ++i) 00026 { 00027 float v1 = signal.getBinValue(i); 00028 float v2 = crosstalkSignal.getBinValue(i); 00029 00030 if(v1 > maxFirst) maxFirst = v1; 00031 if(v2 > maxSecond) maxSecond = v2; 00032 00033 } 00034 00035 return maxSecond/maxFirst; 00036 } 00037