File indexing completed on 2024-04-06 12:30:42
0001 #include "SimMuon/CSCDigitizer/src/CSCAnalogSignal.h"
0002 #include "SimMuon/CSCDigitizer/src/CSCCrosstalkGenerator.h"
0003
0004 CSCAnalogSignal CSCCrosstalkGenerator::getCrosstalk(const CSCAnalogSignal &inputSignal) const {
0005 int nBins = inputSignal.getSize();
0006 float binSize = inputSignal.getBinSize();
0007 std::vector<float> binValues(nBins);
0008
0009 for (int outputBin = 0; outputBin < nBins; ++outputBin) {
0010 float aTime = outputBin * binSize - theDelay;
0011 float slope = inputSignal.getValue(aTime) - inputSignal.getValue(aTime - 1.);
0012 binValues[outputBin] = slope * theCrosstalk + theResistiveFraction * inputSignal.getValue(aTime);
0013 }
0014
0015 return CSCAnalogSignal(0, binSize, binValues, 0., inputSignal.getTimeOffset());
0016 }
0017
0018 float CSCCrosstalkGenerator::ratio(const CSCAnalogSignal &crosstalkSignal, const CSCAnalogSignal &signal) const {
0019 float maxFirst = 0., maxSecond = 0.;
0020 int nbins = signal.getSize();
0021 for (int i = 1; i < nbins; ++i) {
0022 float v1 = signal.getBinValue(i);
0023 float v2 = crosstalkSignal.getBinValue(i);
0024
0025 if (v1 > maxFirst)
0026 maxFirst = v1;
0027 if (v2 > maxSecond)
0028 maxSecond = v2;
0029 }
0030
0031 return maxSecond / maxFirst;
0032 }