CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
ApvAnalysis::PedestalType doIt (ApvAnalysis::PedestalType)
 
float getCMSlope ()
 
 MedianCommonModeCalculator ()
 
void newEvent ()
 
void setCM (TkCommonMode *in)
 
void setCM (std::vector< float > in)
 
virtual ~MedianCommonModeCalculator ()
 
- 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 (0) cout << "Constructing MedianCommonMode Calculator ..." << endl;
11  // cutToAvoidSignal = sig_cut;
12 }
tuple cout
Definition: gather_cfg.py:121
MedianCommonModeCalculator::~MedianCommonModeCalculator ( )
virtual

Definition at line 16 of file MedianCommonModeCalculator.cc.

References gather_cfg::cout.

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

Member Function Documentation

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

Definition at line 41 of file MedianCommonModeCalculator.cc.

References alreadyUsedEvent, getHLTprescales::index, setCM(), python.multivaluedict::sort(), and theCommonModeValues.

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

Get CM value

Implements TkCommonModeCalculator.

Definition at line 22 of file MedianCommonModeCalculator.h.

References theTkCommonMode.

ApvAnalysis::PedestalType MedianCommonModeCalculator::doIt ( ApvAnalysis::PedestalType  )
virtual

Return CM-subtracted data in APV

Implements TkCommonModeCalculator.

Definition at line 23 of file MedianCommonModeCalculator.cc.

References i, and dbtoconf::out.

Referenced by helpers.MassSearchReplaceAnyInputTagVisitor::doIt(), HiHelperTools.MassSearchReplaceAnyInputTagVisitor::doIt(), ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::doIt(), HiHelperTools.MassSearchReplaceAnyInputTagVisitor::enter(), helpers.MassSearchReplaceAnyInputTagVisitor::enter(), and ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::enter().

24 {
26  calculateCommonMode(indat);
27  int setNumber;
28  if(theCommonModeValues.size() >0) {
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 }
int i
Definition: DBlmapReader.cc:9
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
void calculateCommonMode(ApvAnalysis::PedestalType &)
std::vector< float > theCommonModeValues
tuple out
Definition: dbtoconf.py:99
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
float MedianCommonModeCalculator::getCMSlope ( )
inlinevirtual

Get Slope

Implements TkCommonModeCalculator.

Definition at line 25 of file MedianCommonModeCalculator.h.

References slope.

void MedianCommonModeCalculator::newEvent ( )
virtual

Tell CM calculator that a new event is available

Reimplemented from TkCommonModeCalculator.

Definition at line 67 of file MedianCommonModeCalculator.cc.

References alreadyUsedEvent.

67  {
68  alreadyUsedEvent = false;
69 }
void MedianCommonModeCalculator::setCM ( TkCommonMode in)
inlinevirtual
void MedianCommonModeCalculator::setCM ( std::vector< float >  in)
inlinevirtual

Implements TkCommonModeCalculator.

Definition at line 21 of file MedianCommonModeCalculator.h.

References TkCommonMode::setCommonMode(), and theTkCommonMode.

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

TkCommonMode* MedianCommonModeCalculator::theTkCommonMode
protected

Definition at line 31 of file MedianCommonModeCalculator.h.

Referenced by commonMode(), and setCM().