test
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 (const ApvAnalysis::PedestalType &)
 
float getCMSlope ()
 
 MedianCommonModeCalculator ()
 
void newEvent ()
 
void setCM (TkCommonMode *in)
 
void setCM (const 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:145
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:145

Member Function Documentation

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

Definition at line 42 of file MedianCommonModeCalculator.cc.

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

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
TkCommonMode* MedianCommonModeCalculator::commonMode ( )
inlinevirtual

Get CM value

Implements TkCommonModeCalculator.

Definition at line 22 of file MedianCommonModeCalculator.h.

References theTkCommonMode.

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

Return CM-subtracted data in APV

Implements TkCommonModeCalculator.

Definition at line 23 of file MedianCommonModeCalculator.cc.

References i, and GenerateHcalLaserBadRunList::out.

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

24 {
25  ApvAnalysis::PedestalType indat = _indat;
27  calculateCommonMode(indat);
28  int setNumber;
29  if(theCommonModeValues.size() >0) {
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 }
int i
Definition: DBlmapReader.cc:9
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 ( )
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 68 of file MedianCommonModeCalculator.cc.

References alreadyUsedEvent.

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

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

TkCommonMode* MedianCommonModeCalculator::theTkCommonMode
protected

Definition at line 31 of file MedianCommonModeCalculator.h.

Referenced by commonMode(), and setCM().