CMS 3D CMS Logo

PedestalSub.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cmath>
3 #include <climits>
5 
6 using namespace std;
7 
9 }
10 
12 }
13 
14 
15 void PedestalSub::calculate(const std::vector<double> & inputCharge, const std::vector<double> & inputPedestal, const std::vector<double> & inputNoise, std::vector<double> & corrCharge, int soi, int nTS) const {
16 
17  double bseCorr=PedestalSub::getCorrection(inputCharge, inputPedestal, inputNoise, soi, nTS);
18  for (auto i=0; i<nTS; i++) {
19  corrCharge.push_back(inputCharge[i]-inputPedestal[i]-bseCorr);
20  }
21 }
22 
23 double PedestalSub::getCorrection(const std::vector<double> & inputCharge, const std::vector<double> & inputPedestal, const std::vector<double> & inputNoise, int soi, int nTS) const {
24 
25  double baseline=0;
26 
27  for (auto i=0; i<nTS; i++) {
28  if (i==soi || i==(soi+1)) continue;
29  if ( (inputCharge[i]-inputPedestal[i])<3*inputNoise[i]) {
30  baseline+=(inputCharge[i]-inputPedestal[i]);
31  }
32  else {
33  baseline+=3*inputNoise[i];
34  }
35  }
36  baseline/=(nTS-2);
37  return baseline;
38 
39 }
double getCorrection(const std::vector< double > &inputCharge, const std::vector< double > &inputPedestal, const std::vector< double > &inputNoise, int soi, int nSample) const
Definition: PedestalSub.cc:23
void calculate(const std::vector< double > &inputCharge, const std::vector< double > &inputPedestal, const std::vector< double > &inputNoise, std::vector< double > &corrCharge, int soi, int nSample) const
Definition: PedestalSub.cc:15