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 
8 PedestalSub::PedestalSub() : fThreshold(2.7),fQuantile(0.0),fCondition(0){
9 }
10 
12 }
13 
14 void PedestalSub::init(int runCond=0, float threshold=0.0, float quantile=0.0) {
16  fQuantile=quantile;
17  fCondition=runCond;
18 }
19 
20 void PedestalSub::calculate(const std::vector<double> & inputCharge, const std::vector<double> & inputPedestal, std::vector<double> & corrCharge) const {
21 
22  double bseCorr=PedestalSub::getCorrection(inputCharge, inputPedestal);
23  for (auto i=0; i<10; i++) {
24  corrCharge.push_back(inputCharge[i]-inputPedestal[i]-bseCorr);
25  }
26 }
27 
28 double PedestalSub::getCorrection(const std::vector<double> & inputCharge, const std::vector<double> & inputPedestal) const {
29 
30  double baseline=0;
31 
32  for (auto i=0; i<10; i++) {
33  if (i==4||i==5) continue;
34  if ( (inputCharge[i]-inputPedestal[i])<fThreshold) {
35  baseline+=(inputCharge[i]-inputPedestal[i]);
36  }
37  else {
38  baseline+=fThreshold;
39  }
40  }
41  baseline/=8;
42  return baseline;
43 
44 }
double getCorrection(const std::vector< double > &inputCharge, const std::vector< double > &inputPedestal) const
Definition: PedestalSub.cc:28
void init(int runCond, float threshold, float quantile)
Definition: PedestalSub.cc:14
float fCondition
Definition: PedestalSub.h:24
void calculate(const std::vector< double > &inputCharge, const std::vector< double > &inputPedestal, std::vector< double > &corrCharge) const
Definition: PedestalSub.cc:20
float fQuantile
Definition: PedestalSub.h:23
float fThreshold
Definition: PedestalSub.h:22