RawDigitAdder_35t.cxx
Go to the documentation of this file.
1 #ifndef OVERLAY_DATAOVERLAY_RAWDIGITADDER_35T_CXX
2 #define OVERLAY_DATAOVERLAY_RAWDIGITADDER_35T_CXX
3 
4 #include "RawDigitAdder_35t.h"
5 #include <limits>
6 #include <stdexcept>
7 #include <cmath>
9 
11  RawDigitAdder(t),
12  _forceStuckBitRetention(false),
13  _scale1(1),
14  _scale2(1)
15 {}
16 
17 void mix::RawDigitAdder_35t::SetScaleInput(float f, float& _scale)
18 {
19  if(f<0){
20  if(_throw)
21  throw std::runtime_error("Error in RawDigitAdder_35t::SetScaleInput : scale < 0");
22  return;
23  }
24  _scale = f;
25 }
26 
27 void mix::RawDigitAdder_35t::AddRawDigit(short const& d1, short const& d2, short& d_out)
28 {
29  // d1 ==> MC
30  // d2 ==> Real Data
31  AdcCodeHelper ach;
32  if (ach.hasStickyBits(d2) && _forceStuckBitRetention) d_out = (short)(std::round((float)d2 * _scale2));
33  else d_out = (short)(std::round((float)d1 * _scale1)) + (short)(std::round((float)d2 * _scale2));
34  FixOverflow(d_out);
35 }
36 
37 #endif
Defintion for a class to add two vectors together, and give an "added" waveform.
void SetScaleInput(float f, float &_scale)
void AddRawDigit(short const &, short const &, short &)
bool hasStickyBits(AdcCount sig)
void FixOverflow(short &)