test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
PedestalSub Class Reference

#include <PedestalSub.h>

Public Types

enum  Method {
  DoNothing =0, AvgWithThresh =1, AvgWithoutThresh =2, AvgWithThreshNoPedSub =3,
  Percentile =4
}
 

Public Member Functions

void calculate (const std::vector< double > &inputCharge, const std::vector< double > &inputPedestal, std::vector< double > &corrCharge) const
 
double getCorrection (const std::vector< double > &inputCharge, const std::vector< double > &inputPedestal) const
 
void init (Method method, int runCond, float threshold, float quantile)
 
 PedestalSub ()
 
 ~PedestalSub ()
 

Private Attributes

float fCondition
 
Method fMethod
 
float fQuantile
 
float fThreshold
 

Detailed Description

Definition at line 7 of file PedestalSub.h.

Member Enumeration Documentation

Enumerator
DoNothing 
AvgWithThresh 
AvgWithoutThresh 
AvgWithThreshNoPedSub 
Percentile 

Definition at line 10 of file PedestalSub.h.

Constructor & Destructor Documentation

PedestalSub::PedestalSub ( )

Definition at line 8 of file PedestalSub.cc.

PedestalSub::~PedestalSub ( )

Definition at line 11 of file PedestalSub.cc.

11  {
12 }

Member Function Documentation

void PedestalSub::calculate ( const std::vector< double > &  inputCharge,
const std::vector< double > &  inputPedestal,
std::vector< double > &  corrCharge 
) const

Definition at line 21 of file PedestalSub.cc.

References AvgWithoutThresh, AvgWithThresh, fMethod, getCorrection(), i, and Percentile.

Referenced by HcalDeterministicFit::apply().

21  {
22 
23  double bseCorr=PedestalSub::getCorrection(inputCharge, inputPedestal);
24  for (auto i=0; i<10; i++) {
26  corrCharge.push_back(inputCharge[i]-inputPedestal[i]-bseCorr);
27  }
28  else {
29  corrCharge.push_back(inputCharge[i]-bseCorr);
30  }
31  }
32 }
int i
Definition: DBlmapReader.cc:9
double getCorrection(const std::vector< double > &inputCharge, const std::vector< double > &inputPedestal) const
Definition: PedestalSub.cc:34
Method fMethod
Definition: PedestalSub.h:23
double PedestalSub::getCorrection ( const std::vector< double > &  inputCharge,
const std::vector< double > &  inputPedestal 
) const

Definition at line 34 of file PedestalSub.cc.

References AvgWithoutThresh, AvgWithThresh, AvgWithThreshNoPedSub, DoNothing, fMethod, fThreshold, and i.

Referenced by calculate().

34  {
35 
36  double baseline=0;
37 
38  if (fMethod==DoNothing) {
39  baseline=0;
40  }
41  else if (fMethod==AvgWithThresh) {
42  for (auto i=0; i<10; i++) {
43  if (i==4||i==5) continue;
44  if ( (inputCharge[i]-inputPedestal[i])<fThreshold) {
45  baseline+=(inputCharge[i]-inputPedestal[i]);
46  }
47  else {
48  baseline+=fThreshold;
49  }
50  }
51  baseline/=8;
52  }
53  else if (fMethod==AvgWithoutThresh) {
54  for (auto i=0; i<10; i++) {
55  if (i==4||i==5) continue;
56  baseline+=(inputCharge[i]-inputPedestal[i]);
57  }
58  baseline/=8;
59  }
61  for (auto i=0; i<10; i++) {
62  if (i==4||i==5) continue;
63  if ( (inputCharge[i])<fThreshold) {
64  baseline+=(inputCharge[i]);
65  }
66  else baseline+=fThreshold;
67  }
68  baseline/=8;
69  }
70  return baseline;
71 
72 }
int i
Definition: DBlmapReader.cc:9
Method fMethod
Definition: PedestalSub.h:23
float fThreshold
Definition: PedestalSub.h:24
void PedestalSub::init ( Method  method = AvgWithThresh,
int  runCond = 0,
float  threshold = 0.0,
float  quantile = 0.0 
)

Member Data Documentation

float PedestalSub::fCondition
private

Definition at line 26 of file PedestalSub.h.

Referenced by init().

Method PedestalSub::fMethod
private

Definition at line 23 of file PedestalSub.h.

Referenced by calculate(), getCorrection(), and init().

float PedestalSub::fQuantile
private

Definition at line 25 of file PedestalSub.h.

Referenced by init().

float PedestalSub::fThreshold
private

Definition at line 24 of file PedestalSub.h.

Referenced by getCorrection(), and init().