CMS 3D CMS Logo

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::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 }

◆ ~MedianCommonModeCalculator()

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 }

Member Function Documentation

◆ calculateCommonMode()

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

Definition at line 41 of file MedianCommonModeCalculator.cc.

References alreadyUsedEvent, setCM(), jetUpdater_cfi::sort, 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

◆ commonMode()

TkCommonMode* MedianCommonModeCalculator::commonMode ( )
inlineoverridevirtual

Get CM value

Implements TkCommonModeCalculator.

Definition at line 21 of file MedianCommonModeCalculator.h.

References theTkCommonMode.

21 { return theTkCommonMode; }

◆ doIt()

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, MillePedeFileConverter_cfg::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

◆ getCMSlope()

float MedianCommonModeCalculator::getCMSlope ( )
inlineoverridevirtual

Get Slope

Implements TkCommonModeCalculator.

Definition at line 24 of file MedianCommonModeCalculator.h.

References slope.

◆ newEvent()

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.

◆ setCM() [1/2]

void MedianCommonModeCalculator::setCM ( TkCommonMode in)
inlineoverridevirtual

◆ setCM() [2/2]

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

Implements TkCommonModeCalculator.

Definition at line 20 of file MedianCommonModeCalculator.h.

References recoMuon::in, TkCommonMode::setCommonMode(), and theTkCommonMode.

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

Member Data Documentation

◆ alreadyUsedEvent

bool MedianCommonModeCalculator::alreadyUsedEvent
protected

Definition at line 31 of file MedianCommonModeCalculator.h.

Referenced by calculateCommonMode(), and newEvent().

◆ slope

float MedianCommonModeCalculator::slope
protected

Definition at line 32 of file MedianCommonModeCalculator.h.

Referenced by getCMSlope().

◆ theCommonModeValues

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

Definition at line 30 of file MedianCommonModeCalculator.h.

Referenced by calculateCommonMode(), and doIt().

◆ theTkCommonMode

TkCommonMode* MedianCommonModeCalculator::theTkCommonMode
protected

Definition at line 29 of file MedianCommonModeCalculator.h.

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