Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
mix::RawDigitAdder Class Reference

#include <RawDigitAdder.h>

Inheritance diagram for mix::RawDigitAdder:
mix::RawDigitAdder_35t mix::RawDigitAdder_HardSaturate

Public Member Functions

 RawDigitAdder (bool t=true)
 Default constructor. More...
 
void AddRawDigits (std::vector< short > const &, std::vector< short > const &, std::vector< short > &)
 
void AddRawDigits (std::vector< short > const &, std::vector< short > &)
 
void AddRawDigits (std::vector< std::vector< short > > const &, std::vector< short > &)
 
void SetPedestalFirstInput (float f1)
 
void SetPedestalSecondInput (float f2)
 
void SetPedestalInputs (float f1, float f2)
 
virtual std::string Name ()
 
virtual ~RawDigitAdder ()
 Default destructor. More...
 

Protected Member Functions

void FixOverflow (short &)
 

Protected Attributes

bool _throw
 

Private Member Functions

virtual void AddRawDigit (short const &, short const &, short &)
 
void AddRawDigit (short const &, short &)
 
void CheckVectorSize (std::vector< short > const &, std::vector< short > const &)
 
void SetPedestalInput (float f, float &_scale)
 

Private Attributes

float _ped1
 
float _ped2
 

Detailed Description

Definition at line 33 of file RawDigitAdder.h.

Constructor & Destructor Documentation

mix::RawDigitAdder::RawDigitAdder ( bool  t = true)
inline

Default constructor.

Definition at line 38 of file RawDigitAdder.h.

virtual mix::RawDigitAdder::~RawDigitAdder ( )
inlinevirtual

Default destructor.

Definition at line 58 of file RawDigitAdder.h.

58 {};

Member Function Documentation

void RawDigitAdder::AddRawDigit ( short const &  d1,
short const &  d2,
short &  d_out 
)
privatevirtual

Reimplemented in mix::RawDigitAdder_35t, and mix::RawDigitAdder_HardSaturate.

Definition at line 54 of file RawDigitAdder.cxx.

55 {
56  d_out = d1 + d2;
57  FixOverflow(d_out);
58 }
void FixOverflow(short &)
void RawDigitAdder::AddRawDigit ( short const &  d1,
short &  d2 
)
private

Definition at line 60 of file RawDigitAdder.cxx.

61 {
62  AddRawDigit(d1,d2,d2);
63 }
virtual void AddRawDigit(short const &, short const &, short &)
void RawDigitAdder::AddRawDigits ( std::vector< short > const &  inputVec1,
std::vector< short > const &  inputVec2,
std::vector< short > &  outputVec 
)

Definition at line 8 of file RawDigitAdder.cxx.

11 {
12  CheckVectorSize(inputVec1,inputVec2);
13  outputVec.clear(); outputVec.resize(inputVec1.size());
14  for(size_t i=0; i<inputVec1.size(); i++)
15  AddRawDigit(inputVec1[i]-(short)_ped1,inputVec2[i]-(short)_ped2,outputVec[i]);
16 }
void CheckVectorSize(std::vector< short > const &, std::vector< short > const &)
virtual void AddRawDigit(short const &, short const &, short &)
void RawDigitAdder::AddRawDigits ( std::vector< short > const &  inputVec1,
std::vector< short > &  inputVec2 
)

Definition at line 18 of file RawDigitAdder.cxx.

20 {
21  CheckVectorSize(inputVec1,inputVec2);
22  for(size_t i=0; i<inputVec1.size(); i++)
23  AddRawDigit(inputVec1[i]-(short)_ped1,inputVec2[i]-(short)_ped2,inputVec2[i]);
24 }
void CheckVectorSize(std::vector< short > const &, std::vector< short > const &)
virtual void AddRawDigit(short const &, short const &, short &)
void RawDigitAdder::AddRawDigits ( std::vector< std::vector< short > > const &  inputVecList,
std::vector< short > &  outputVec 
)

Definition at line 26 of file RawDigitAdder.cxx.

28 {
29  if(inputVecList.size()==0){
30  if(_throw)
31  throw std::runtime_error("Error in RawDigitAdder::AddRawDigits : Input vector list is empty.");
32  return;
33  }
34  for(auto const& vec : inputVecList)
35  CheckVectorSize(inputVecList[0],vec);
36 
37  outputVec.clear(); outputVec.resize(inputVecList[0].size(),0.0);
38 
39  for(auto const& inputVec : inputVecList)
40  AddRawDigits(inputVec,outputVec);
41 
42 }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
void CheckVectorSize(std::vector< short > const &, std::vector< short > const &)
void AddRawDigits(std::vector< short > const &, std::vector< short > const &, std::vector< short > &)
void RawDigitAdder::CheckVectorSize ( std::vector< short > const &  vec1,
std::vector< short > const &  vec2 
)
private

Definition at line 44 of file RawDigitAdder.cxx.

46 {
47  if(vec1.size() != vec2.size()){
48  if(_throw)
49  throw std::runtime_error("Error in RawDigitAdder: Failed CheckVectorSize()");
50  return;
51  }
52 }
void RawDigitAdder::FixOverflow ( short &  d)
protected

Definition at line 65 of file RawDigitAdder.cxx.

66 {
67  if(d<0)
69 }
static int max(int a, int b)
virtual std::string mix::RawDigitAdder::Name ( )
inlinevirtual

Reimplemented in mix::RawDigitAdder_35t, and mix::RawDigitAdder_HardSaturate.

Definition at line 55 of file RawDigitAdder.h.

55 { return "RawDigitAdder_Base"; }
void mix::RawDigitAdder::SetPedestalFirstInput ( float  f1)
inline

Definition at line 49 of file RawDigitAdder.h.

EmPhysicsFactory f1
void SetPedestalInput(float f, float &_scale)
void RawDigitAdder::SetPedestalInput ( float  f,
float &  _scale 
)
private

Definition at line 72 of file RawDigitAdder.cxx.

73 {
74  _ped = f;
75 }
void mix::RawDigitAdder::SetPedestalInputs ( float  f1,
float  f2 
)
inline

Definition at line 52 of file RawDigitAdder.h.

void SetPedestalFirstInput(float f1)
Definition: RawDigitAdder.h:49
SynchrotronAndGN f2
void SetPedestalSecondInput(float f2)
Definition: RawDigitAdder.h:50
EmPhysicsFactory f1
void mix::RawDigitAdder::SetPedestalSecondInput ( float  f2)
inline

Definition at line 50 of file RawDigitAdder.h.

SynchrotronAndGN f2
void SetPedestalInput(float f, float &_scale)

Member Data Documentation

float mix::RawDigitAdder::_ped1
private

Definition at line 71 of file RawDigitAdder.h.

float mix::RawDigitAdder::_ped2
private

Definition at line 71 of file RawDigitAdder.h.

bool mix::RawDigitAdder::_throw
protected

Definition at line 58 of file RawDigitAdder.h.


The documentation for this class was generated from the following files: