CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
TT6NoiseCalculator Class Reference

#include <TT6NoiseCalculator.h>

Inheritance diagram for TT6NoiseCalculator:
TkNoiseCalculator

Public Member Functions

int nevents () const
 
void newEvent () override
 
ApvAnalysis::PedestalType noise () const override
 
void resetNoise () override
 
void setStripNoise (ApvAnalysis::PedestalType &in) override
 
ApvAnalysis::PedestalType stripCMPSubtractedSignal () const
 
float stripNoise (int in) const override
 
 TT6NoiseCalculator ()
 
 TT6NoiseCalculator (int evnt_ini, int evnt_iter, float sig_cut)
 
void updateNoise (ApvAnalysis::PedestalType &in) override
 
void updateStatus () override
 
 ~TT6NoiseCalculator () override
 
- Public Member Functions inherited from TkNoiseCalculator
TkStateMachinestatus ()
 
virtual ~TkNoiseCalculator ()
 

Protected Member Functions

void init ()
 

Protected Attributes

bool alreadyUsedEvent
 
float cutToAvoidSignal_
 
int eventsRequiredToCalibrate_
 
int eventsRequiredToUpdate_
 
int numberOfEvents
 
ApvAnalysis::PedestalType theCMPSubtractedSignal
 
std::vector< unsigned short > theEventPerStrip
 
ApvAnalysis::PedestalType theNoise
 
std::vector< double > theNoiseSqSum
 
std::vector< double > theNoiseSum
 
- Protected Attributes inherited from TkNoiseCalculator
TkStateMachine theStatus
 

Detailed Description

Concrete implementation of TkNoiseCalculator for TT6.

Definition at line 9 of file TT6NoiseCalculator.h.

Constructor & Destructor Documentation

◆ TT6NoiseCalculator() [1/2]

TT6NoiseCalculator::TT6NoiseCalculator ( )

Definition at line 10 of file TT6NoiseCalculator.cc.

10  : numberOfEvents(0), alreadyUsedEvent(false) {
11  if (false)
12  cout << "Constructing TT6NoiseCalculator " << endl;
13  init();
14 }

References gather_cfg::cout, and init().

◆ TT6NoiseCalculator() [2/2]

TT6NoiseCalculator::TT6NoiseCalculator ( int  evnt_ini,
int  evnt_iter,
float  sig_cut 
)

Definition at line 16 of file TT6NoiseCalculator.cc.

17  : numberOfEvents(0), alreadyUsedEvent(false) {
18  if (false)
19  cout << "Constructing TT6NoiseCalculator " << endl;
20  eventsRequiredToCalibrate_ = evnt_ini;
21  eventsRequiredToUpdate_ = evnt_iter;
22  cutToAvoidSignal_ = sig_cut;
23  init();
24 }

References gather_cfg::cout, cutToAvoidSignal_, eventsRequiredToCalibrate_, eventsRequiredToUpdate_, and init().

◆ ~TT6NoiseCalculator()

TT6NoiseCalculator::~TT6NoiseCalculator ( )
override

Definition at line 39 of file TT6NoiseCalculator.cc.

39  {
40  if (false)
41  cout << "Destructing TT6NoiseCalculator " << endl;
42 }

References gather_cfg::cout.

Member Function Documentation

◆ init()

void TT6NoiseCalculator::init ( void  )
protected

◆ nevents()

int TT6NoiseCalculator::nevents ( ) const
inline

Definition at line 23 of file TT6NoiseCalculator.h.

23 { return numberOfEvents; }

References numberOfEvents.

◆ newEvent()

void TT6NoiseCalculator::newEvent ( )
overridevirtual

Tell noise calculator that a new event is available

Reimplemented from TkNoiseCalculator.

Definition at line 115 of file TT6NoiseCalculator.cc.

115 { alreadyUsedEvent = false; }

References alreadyUsedEvent.

◆ noise()

ApvAnalysis::PedestalType TT6NoiseCalculator::noise ( ) const
inlineoverridevirtual

Return reconstructed noise

Implements TkNoiseCalculator.

Definition at line 21 of file TT6NoiseCalculator.h.

21 { return theNoise; }

References theNoise.

◆ resetNoise()

void TT6NoiseCalculator::resetNoise ( )
inlineoverridevirtual

Implements TkNoiseCalculator.

Definition at line 26 of file TT6NoiseCalculator.h.

26 { theNoise.clear(); }

References theNoise.

◆ setStripNoise()

void TT6NoiseCalculator::setStripNoise ( ApvAnalysis::PedestalType in)
inlineoverridevirtual

Implements TkNoiseCalculator.

Definition at line 17 of file TT6NoiseCalculator.h.

17  {
18  theNoise.clear();
19  theNoise = in;
20  }

References recoMuon::in, and theNoise.

◆ stripCMPSubtractedSignal()

ApvAnalysis::PedestalType TT6NoiseCalculator::stripCMPSubtractedSignal ( ) const
inline

Definition at line 30 of file TT6NoiseCalculator.h.

30 { return theCMPSubtractedSignal; }

References theCMPSubtractedSignal.

◆ stripNoise()

float TT6NoiseCalculator::stripNoise ( int  in) const
inlineoverridevirtual

Implements TkNoiseCalculator.

Definition at line 22 of file TT6NoiseCalculator.h.

22 { return theNoise[in]; }

References recoMuon::in, and theNoise.

◆ updateNoise()

void TT6NoiseCalculator::updateNoise ( ApvAnalysis::PedestalType )
overridevirtual

Update noise with current event

Implements TkNoiseCalculator.

Definition at line 54 of file TT6NoiseCalculator.cc.

54  {
55  if (alreadyUsedEvent == false) {
56  alreadyUsedEvent = true;
58 
59  if (numberOfEvents == 1 && theNoise.size() != in.size()) {
60  edm::LogError("TT6NoiseCalculator:updateNoise")
61  << " You did not initialize the Noise correctly prior to noise calibration.";
62  }
63 
64  // Initialize sums used for estimating noise.
65  if ((theStatus.isCalibrating() && numberOfEvents == 1) ||
67  theNoiseSum.clear();
68  theNoiseSqSum.clear();
69  theEventPerStrip.clear();
70 
71  theNoiseSum.resize(in.size(), 0.0);
72  theNoiseSqSum.resize(in.size(), 0.0);
73  theEventPerStrip.resize(in.size(), 0);
74  }
75 
76  unsigned int i;
77 
78  // Update sums used for estimating noise.
79  for (i = 0; i < in.size(); i++) {
80  if (fabs(in[i]) < cutToAvoidSignal_ * theNoise[i]) {
81  theNoiseSum[i] += in[i];
82  theNoiseSqSum[i] += in[i] * in[i];
84  }
85  }
86 
87  // Calculate noise.
90  theCMPSubtractedSignal.clear();
91  theNoise.clear();
92 
93  for (i = 0; i < in.size(); i++) {
94  double avVal = (theEventPerStrip[i]) ? theNoiseSum[i] / (theEventPerStrip[i]) : 0.0;
95  double sqAvVal = (theEventPerStrip[i]) ? theNoiseSqSum[i] / (theEventPerStrip[i]) : 0.0;
96  double corr_fac = (theEventPerStrip[i] > 1) ? (theEventPerStrip[i] / (theEventPerStrip[i] - 1)) : 1.0;
97  double rmsVal = (sqAvVal - avVal * avVal > 0.0) ? sqrt(corr_fac * (sqAvVal - avVal * avVal)) : 0.0;
98 
99  theCMPSubtractedSignal.push_back(static_cast<float>(avVal));
100 
101  theNoise.push_back(static_cast<float>(rmsVal));
102 
103  if (false)
104  cout << " TT6NoiseCalculator::updateNoise " << theNoiseSum[i] << " " << theNoiseSqSum[i] << " "
105  << theEventPerStrip[i] << " " << avVal << " " << sqAvVal << " " << (sqAvVal - avVal * avVal) << " "
106  << rmsVal << endl;
107  }
108  }
109  updateStatus();
110  }
111 }

References alreadyUsedEvent, gather_cfg::cout, cutToAvoidSignal_, eventsRequiredToCalibrate_, eventsRequiredToUpdate_, mps_fire::i, recoMuon::in, TkStateMachine::isCalibrating(), TkStateMachine::isUpdating(), numberOfEvents, mathSSE::sqrt(), theCMPSubtractedSignal, theEventPerStrip, theNoise, theNoiseSqSum, theNoiseSum, TkNoiseCalculator::theStatus, and updateStatus().

◆ updateStatus()

void TT6NoiseCalculator::updateStatus ( )
overridevirtual

Member Data Documentation

◆ alreadyUsedEvent

bool TT6NoiseCalculator::alreadyUsedEvent
protected

Definition at line 41 of file TT6NoiseCalculator.h.

Referenced by newEvent(), and updateNoise().

◆ cutToAvoidSignal_

float TT6NoiseCalculator::cutToAvoidSignal_
protected

Definition at line 45 of file TT6NoiseCalculator.h.

Referenced by TT6NoiseCalculator(), and updateNoise().

◆ eventsRequiredToCalibrate_

int TT6NoiseCalculator::eventsRequiredToCalibrate_
protected

Definition at line 43 of file TT6NoiseCalculator.h.

Referenced by TT6NoiseCalculator(), updateNoise(), and updateStatus().

◆ eventsRequiredToUpdate_

int TT6NoiseCalculator::eventsRequiredToUpdate_
protected

Definition at line 44 of file TT6NoiseCalculator.h.

Referenced by TT6NoiseCalculator(), and updateNoise().

◆ numberOfEvents

int TT6NoiseCalculator::numberOfEvents
protected

Definition at line 40 of file TT6NoiseCalculator.h.

Referenced by nevents(), updateNoise(), and updateStatus().

◆ theCMPSubtractedSignal

ApvAnalysis::PedestalType TT6NoiseCalculator::theCMPSubtractedSignal
protected

Definition at line 37 of file TT6NoiseCalculator.h.

Referenced by init(), stripCMPSubtractedSignal(), and updateNoise().

◆ theEventPerStrip

std::vector<unsigned short> TT6NoiseCalculator::theEventPerStrip
protected

Definition at line 39 of file TT6NoiseCalculator.h.

Referenced by init(), and updateNoise().

◆ theNoise

ApvAnalysis::PedestalType TT6NoiseCalculator::theNoise
protected

Definition at line 36 of file TT6NoiseCalculator.h.

Referenced by init(), noise(), resetNoise(), setStripNoise(), stripNoise(), and updateNoise().

◆ theNoiseSqSum

std::vector<double> TT6NoiseCalculator::theNoiseSqSum
protected

Definition at line 38 of file TT6NoiseCalculator.h.

Referenced by init(), and updateNoise().

◆ theNoiseSum

std::vector<double> TT6NoiseCalculator::theNoiseSum
protected

Definition at line 38 of file TT6NoiseCalculator.h.

Referenced by init(), and updateNoise().

mps_fire.i
i
Definition: mps_fire.py:355
TkStateMachine::setUpdating
void setUpdating()
Definition: TkStateMachine.h:20
TT6NoiseCalculator::theCMPSubtractedSignal
ApvAnalysis::PedestalType theCMPSubtractedSignal
Definition: TT6NoiseCalculator.h:37
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TT6NoiseCalculator::eventsRequiredToCalibrate_
int eventsRequiredToCalibrate_
Definition: TT6NoiseCalculator.h:43
TT6NoiseCalculator::theNoiseSum
std::vector< double > theNoiseSum
Definition: TT6NoiseCalculator.h:38
TT6NoiseCalculator::eventsRequiredToUpdate_
int eventsRequiredToUpdate_
Definition: TT6NoiseCalculator.h:44
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TkStateMachine::isCalibrating
bool isCalibrating() const
Definition: TkStateMachine.h:29
TkNoiseCalculator::theStatus
TkStateMachine theStatus
Definition: TkNoiseCalculator.h:34
edm::LogError
Definition: MessageLogger.h:183
TT6NoiseCalculator::numberOfEvents
int numberOfEvents
Definition: TT6NoiseCalculator.h:40
recoMuon::in
Definition: RecoMuonEnumerators.h:6
TkStateMachine::isUpdating
bool isUpdating() const
Definition: TkStateMachine.h:28
TT6NoiseCalculator::theEventPerStrip
std::vector< unsigned short > theEventPerStrip
Definition: TT6NoiseCalculator.h:39
TT6NoiseCalculator::theNoise
ApvAnalysis::PedestalType theNoise
Definition: TT6NoiseCalculator.h:36
TkStateMachine::setCalibrating
void setCalibrating()
Definition: TkStateMachine.h:21
TT6NoiseCalculator::updateStatus
void updateStatus() override
Definition: TT6NoiseCalculator.cc:46
TT6NoiseCalculator::alreadyUsedEvent
bool alreadyUsedEvent
Definition: TT6NoiseCalculator.h:41
TT6NoiseCalculator::theNoiseSqSum
std::vector< double > theNoiseSqSum
Definition: TT6NoiseCalculator.h:38
TT6NoiseCalculator::cutToAvoidSignal_
float cutToAvoidSignal_
Definition: TT6NoiseCalculator.h:45
TT6NoiseCalculator::init
void init()
Definition: TT6NoiseCalculator.cc:28