File indexing completed on 2024-04-06 12:29:30
0001 template <class C>
0002 TrivialAmplitudeAlgo<C>::TrivialAmplitudeAlgo() {
0003
0004
0005 theWeights.reserve(10);
0006 for (int sample = 0; sample < 10; ++sample) {
0007 if (sample < 3) {
0008 theWeights[sample] = -1. / 3.;
0009 } else if (sample == 5) {
0010 theWeights[sample] = 1.;
0011 } else {
0012 theWeights[sample] = 0.;
0013 }
0014 }
0015
0016
0017
0018 theGainFactors.reserve(4);
0019 theGainFactors[0] = 0.;
0020 theGainFactors[1] = 1.;
0021 theGainFactors[2] = 2.;
0022 theGainFactors[3] = 12.;
0023 }
0024
0025 template <class C>
0026 double TrivialAmplitudeAlgo<C>::energy(const C &frame) {
0027 double Erec = 0.;
0028
0029
0030
0031
0032 for (int sample = 0; sample < frame.size(); ++sample) {
0033 int gain = (frame.sample(sample).gainId());
0034 if (gain >= 1 && gain <= 3) {
0035 Erec = Erec + theWeights[sample] * (frame.sample(sample).adc()) * theGainFactors[gain];
0036 } else {
0037 edm::LogWarning("EcalAmplitudeError") << "Wrong gain in frame " << sample << " \n" << frame;
0038 }
0039 }
0040
0041 return Erec;
0042 }
0043
0044 template <class C>
0045 double TrivialAmplitudeAlgo<C>::pedestal(const C &frame) {
0046 double PrePed = 0.;
0047
0048
0049
0050
0051 for (int sample = 0; sample < 3; ++sample) {
0052 int gain = (frame.sample(sample).gainId());
0053 if (gain >= 1 || gain <= 3) {
0054 PrePed = PrePed + theWeights[sample] * (frame.sample(sample).adc()) * theGainFactors[gain];
0055 } else {
0056 edm::LogWarning("EcalAmplitudeError") << "Wrong gain in frame " << sample << " \n" << frame;
0057 }
0058 }
0059
0060 return -1. * PrePed;
0061 }