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

Definition at line 5 of file MedianCommonModeCalculator.cc.

References gather_cfg::cout.

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

Definition at line 16 of file MedianCommonModeCalculator.cc.

References gather_cfg::cout, and doIt().

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

Member Function Documentation

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

Definition at line 42 of file MedianCommonModeCalculator.cc.

References alreadyUsedEvent, diffTreeTool::index, setCM(), and theCommonModeValues.

Referenced by doIt(), and getCMSlope().

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

Get CM value

Implements TkCommonModeCalculator.

Definition at line 22 of file MedianCommonModeCalculator.h.

References newEvent(), and 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, MillePedeFileConverter_cfg::out, TkCommonModeTopology::setOfStrip(), theCommonModeValues, theTkCommonMode, and TkCommonMode::topology().

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

24 {
25  ApvAnalysis::PedestalType indat = _indat;
27  calculateCommonMode(indat);
28  int setNumber;
29  if(!theCommonModeValues.empty()) {
30  for (unsigned int i=0; i<indat.size(); i++){
31  setNumber = theTkCommonMode->topology().setOfStrip(i);
32  out.push_back(indat[i] - theCommonModeValues[setNumber]);
33  }
34  }else{
35  out = indat;
36  }
37  return out;
38 }
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
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 25 of file MedianCommonModeCalculator.h.

References calculateCommonMode(), and slope.

void MedianCommonModeCalculator::newEvent ( )
overridevirtual

Tell CM calculator that a new event is available

Reimplemented from TkCommonModeCalculator.

Definition at line 68 of file MedianCommonModeCalculator.cc.

References alreadyUsedEvent.

Referenced by commonMode().

68  {
69  alreadyUsedEvent = false;
70 }
void MedianCommonModeCalculator::setCM ( TkCommonMode in)
inlineoverridevirtual
void MedianCommonModeCalculator::setCM ( const std::vector< float > &  in)
inlineoverridevirtual

Implements TkCommonModeCalculator.

Definition at line 21 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 33 of file MedianCommonModeCalculator.h.

Referenced by calculateCommonMode(), and newEvent().

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

Definition at line 32 of file MedianCommonModeCalculator.h.

Referenced by calculateCommonMode(), and doIt().

TkCommonMode* MedianCommonModeCalculator::theTkCommonMode
protected

Definition at line 31 of file MedianCommonModeCalculator.h.

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