CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
MedianCommonModeCalculator Class Reference

#include <MedianCommonModeCalculator.h>

Inheritance diagram for MedianCommonModeCalculator:
TkCommonModeCalculator

Public Member Functions

TkCommonModecommonMode () override
 
ApvAnalysis::PedestalType doIt (const ApvAnalysis::PedestalType &) override
 
float getCMSlope () override
 
 MedianCommonModeCalculator ()
 
void newEvent () override
 
void setCM (TkCommonMode *in) override
 
void setCM (const std::vector< float > &in) override
 
 ~MedianCommonModeCalculator () override
 
- Public Member Functions inherited from TkCommonModeCalculator
virtual ~TkCommonModeCalculator ()
 

Protected Member Functions

void calculateCommonMode (ApvAnalysis::PedestalType &)
 

Protected Attributes

bool alreadyUsedEvent
 
float slope
 
std::vector< float > theCommonModeValues
 
TkCommonModetheTkCommonMode
 

Detailed Description

Concrete implementation of TkCommonModeCalculator for Median.

Definition at line 11 of file MedianCommonModeCalculator.h.

Constructor & Destructor Documentation

MedianCommonModeCalculator::MedianCommonModeCalculator ( )

Definition at line 5 of file MedianCommonModeCalculator.cc.

References gather_cfg::cout.

6  : // theNoiseCalculator(noise_calc),
7  // theApvMask(mask_calc),
8  alreadyUsedEvent(false) {
9  if (false)
10  cout << "Constructing MedianCommonMode Calculator ..." << endl;
11  // cutToAvoidSignal = sig_cut;
12 }
tuple cout
Definition: gather_cfg.py:144
MedianCommonModeCalculator::~MedianCommonModeCalculator ( )
override

Definition at line 16 of file MedianCommonModeCalculator.cc.

References gather_cfg::cout.

16  {
17  if (false)
18  cout << "Destructing TT6CommonModeCalculator " << endl;
19 }
tuple cout
Definition: gather_cfg.py:144

Member Function Documentation

void MedianCommonModeCalculator::calculateCommonMode ( ApvAnalysis::PedestalType indat)
protected

Definition at line 41 of file MedianCommonModeCalculator.cc.

References alreadyUsedEvent, setCM(), and theCommonModeValues.

Referenced by doIt().

41  {
42  if (alreadyUsedEvent == false) {
43  alreadyUsedEvent = true;
44 
45  theCommonModeValues.clear();
46 
47  double avVal = 0.0;
48 
49  sort(indat.begin(), indat.end());
50 
51  uint16_t index = indat.size() % 2 ? indat.size() / 2 : indat.size() / 2 - 1;
52  if (!indat.empty()) {
53  avVal = indat[index];
54  }
55 
56  theCommonModeValues.push_back(static_cast<float>(avVal));
57 
59  }
60 }
std::vector< float > theCommonModeValues
void setCM(TkCommonMode *in) override
TkCommonMode* MedianCommonModeCalculator::commonMode ( )
inlineoverridevirtual

Get CM value

Implements TkCommonModeCalculator.

Definition at line 21 of file MedianCommonModeCalculator.h.

References theTkCommonMode.

21 { return theTkCommonMode; }
ApvAnalysis::PedestalType MedianCommonModeCalculator::doIt ( const ApvAnalysis::PedestalType )
overridevirtual

Return CM-subtracted data in APV

Implements TkCommonModeCalculator.

Definition at line 23 of file MedianCommonModeCalculator.cc.

References calculateCommonMode(), mps_fire::i, submitPVResolutionJobs::out, TkCommonModeTopology::setOfStrip(), theCommonModeValues, theTkCommonMode, and TkCommonMode::topology().

Referenced by MassReplace.MassSearchReplaceAnyInputTagVisitor::doIt(), ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::doIt(), MassReplace.MassSearchReplaceAnyInputTagVisitor::enter(), MassReplace.MassSearchReplaceParamVisitor::enter(), and ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::enter().

23  {
24  ApvAnalysis::PedestalType indat = _indat;
26  calculateCommonMode(indat);
27  int setNumber;
28  if (!theCommonModeValues.empty()) {
29  for (unsigned int i = 0; i < indat.size(); i++) {
30  setNumber = theTkCommonMode->topology().setOfStrip(i);
31  out.push_back(indat[i] - theCommonModeValues[setNumber]);
32  }
33  } else {
34  out = indat;
35  }
36  return out;
37 }
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
void calculateCommonMode(ApvAnalysis::PedestalType &)
std::vector< float > theCommonModeValues
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
float MedianCommonModeCalculator::getCMSlope ( )
inlineoverridevirtual

Get Slope

Implements TkCommonModeCalculator.

Definition at line 24 of file MedianCommonModeCalculator.h.

References slope.

void MedianCommonModeCalculator::newEvent ( )
overridevirtual

Tell CM calculator that a new event is available

Reimplemented from TkCommonModeCalculator.

Definition at line 65 of file MedianCommonModeCalculator.cc.

References alreadyUsedEvent.

void MedianCommonModeCalculator::setCM ( TkCommonMode in)
inlineoverridevirtual
void MedianCommonModeCalculator::setCM ( const std::vector< float > &  in)
inlineoverridevirtual

Implements TkCommonModeCalculator.

Definition at line 20 of file MedianCommonModeCalculator.h.

References TkCommonMode::setCommonMode(), and theTkCommonMode.

void setCommonMode(const std::vector< float > &in)
Definition: TkCommonMode.h:21

Member Data Documentation

bool MedianCommonModeCalculator::alreadyUsedEvent
protected

Definition at line 31 of file MedianCommonModeCalculator.h.

Referenced by calculateCommonMode(), and newEvent().

float MedianCommonModeCalculator::slope
protected

Definition at line 32 of file MedianCommonModeCalculator.h.

Referenced by getCMSlope().

std::vector<float> MedianCommonModeCalculator::theCommonModeValues
protected

Definition at line 30 of file MedianCommonModeCalculator.h.

Referenced by calculateCommonMode(), and doIt().

TkCommonMode* MedianCommonModeCalculator::theTkCommonMode
protected

Definition at line 29 of file MedianCommonModeCalculator.h.

Referenced by commonMode(), doIt(), and setCM().