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 (const std::vector< float > &in) override
 
void setCM (TkCommonMode *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.

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 }

References gather_cfg::cout.

◆ ~MedianCommonModeCalculator()

MedianCommonModeCalculator::~MedianCommonModeCalculator ( )
override

Definition at line 16 of file MedianCommonModeCalculator.cc.

16  {
17  if (false)
18  cout << "Destructing TT6CommonModeCalculator " << endl;
19 }

References gather_cfg::cout.

Member Function Documentation

◆ calculateCommonMode()

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

Definition at line 41 of file MedianCommonModeCalculator.cc.

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 }

References alreadyUsedEvent, setCM(), jetUpdater_cfi::sort, and theCommonModeValues.

Referenced by doIt().

◆ commonMode()

TkCommonMode* MedianCommonModeCalculator::commonMode ( )
inlineoverridevirtual

Get CM value

Implements TkCommonModeCalculator.

Definition at line 21 of file MedianCommonModeCalculator.h.

21 { return theTkCommonMode; }

References theTkCommonMode.

◆ doIt()

ApvAnalysis::PedestalType MedianCommonModeCalculator::doIt ( const ApvAnalysis::PedestalType )
overridevirtual

◆ getCMSlope()

float MedianCommonModeCalculator::getCMSlope ( )
inlineoverridevirtual

Get Slope

Implements TkCommonModeCalculator.

Definition at line 24 of file MedianCommonModeCalculator.h.

24 { return slope; }

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.

65 { alreadyUsedEvent = false; }

References alreadyUsedEvent.

◆ setCM() [1/2]

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

◆ setCM() [2/2]

void MedianCommonModeCalculator::setCM ( TkCommonMode in)
inlineoverridevirtual

Implements TkCommonModeCalculator.

Definition at line 19 of file MedianCommonModeCalculator.h.

19 { theTkCommonMode = in; }

References recoMuon::in, and theTkCommonMode.

Referenced by calculateCommonMode().

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().

mps_fire.i
i
Definition: mps_fire.py:428
MedianCommonModeCalculator::slope
float slope
Definition: MedianCommonModeCalculator.h:32
TkCommonModeTopology::setOfStrip
int setOfStrip(int)
Definition: TkCommonModeTopology.cc:3
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MedianCommonModeCalculator::alreadyUsedEvent
bool alreadyUsedEvent
Definition: MedianCommonModeCalculator.h:31
TkCommonMode::setCommonMode
void setCommonMode(const std::vector< float > &in)
Definition: TkCommonMode.h:21
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
recoMuon::in
Definition: RecoMuonEnumerators.h:6
MedianCommonModeCalculator::setCM
void setCM(TkCommonMode *in) override
Definition: MedianCommonModeCalculator.h:19
MedianCommonModeCalculator::theTkCommonMode
TkCommonMode * theTkCommonMode
Definition: MedianCommonModeCalculator.h:29
MedianCommonModeCalculator::theCommonModeValues
std::vector< float > theCommonModeValues
Definition: MedianCommonModeCalculator.h:30
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ApvAnalysis::PedestalType
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
TkCommonMode::topology
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
MedianCommonModeCalculator::calculateCommonMode
void calculateCommonMode(ApvAnalysis::PedestalType &)
Definition: MedianCommonModeCalculator.cc:41