CMS 3D CMS Logo

MedianCommonModeCalculator Class Reference

Concrete implementation of TkCommonModeCalculator for Median. More...

#include <CalibTracker/SiStripAPVAnalysis/interface/MedianCommonModeCalculator.h>

Inheritance diagram for MedianCommonModeCalculator:

TkCommonModeCalculator

List of all members.

Public Member Functions

TkCommonModecommonMode ()
 Get CM value.
ApvAnalysis::PedestalType doIt (ApvAnalysis::PedestalType)
 Return CM-subtracted data in APV.
float getCMSlope ()
 Get Slope.
 MedianCommonModeCalculator ()
void newEvent ()
 Tell CM calculator that a new event is available.
void setCM (std::vector< float > in)
void setCM (TkCommonMode *in)
virtual ~MedianCommonModeCalculator ()

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 GenMuonPlsPt100GeV_cfg::cout, and lat::endl().

00005                                                        : 
00006   //  theNoiseCalculator(noise_calc),
00007     //  theApvMask(mask_calc),
00008   alreadyUsedEvent(false)
00009 {
00010   if (0) cout << "Constructing MedianCommonMode Calculator ..." << endl;
00011   //  cutToAvoidSignal = sig_cut;
00012 }

MedianCommonModeCalculator::~MedianCommonModeCalculator (  )  [virtual]

Definition at line 16 of file MedianCommonModeCalculator.cc.

References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().

00016                                                         {
00017   if (0) cout << "Destructing TT6CommonModeCalculator " << endl;
00018 }


Member Function Documentation

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

Definition at line 41 of file MedianCommonModeCalculator.cc.

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

Referenced by doIt().

00042 { 
00043   if (alreadyUsedEvent == false) {
00044     alreadyUsedEvent = true;
00045     
00046     theCommonModeValues.clear();
00047     
00048     
00049     double avVal = 0.0;
00050     
00051     sort(indat.begin(),indat.end());
00052         
00053     uint16_t index = indat.size()%2 ? indat.size()/2 : indat.size()/2-1;
00054     if ( !indat.empty() ) { avVal = indat[index]; }
00055     
00056     theCommonModeValues.push_back(static_cast<float>(avVal));
00057        
00058     MedianCommonModeCalculator::setCM(theCommonModeValues);
00059 
00060   }
00061   
00062 }

TkCommonMode* MedianCommonModeCalculator::commonMode (  )  [inline, virtual]

Get CM value.

Implements TkCommonModeCalculator.

Definition at line 22 of file MedianCommonModeCalculator.h.

References theTkCommonMode.

00022 {return 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 calculateCommonMode(), i, out, TkCommonModeTopology::setOfStrip(), theCommonModeValues, theTkCommonMode, and TkCommonMode::topology().

00024 {
00025   ApvAnalysis::PedestalType out;
00026   calculateCommonMode(indat);
00027   int setNumber;
00028   if(theCommonModeValues.size() >0) {
00029     for (unsigned int i=0; i<indat.size(); i++){
00030       setNumber = theTkCommonMode->topology().setOfStrip(i);
00031       out.push_back(indat[i] - theCommonModeValues[setNumber]);
00032     }  
00033   }else{
00034     out = indat;
00035   }
00036   return out;
00037 }

float MedianCommonModeCalculator::getCMSlope (  )  [inline, virtual]

Get Slope.

Implements TkCommonModeCalculator.

Definition at line 25 of file MedianCommonModeCalculator.h.

References slope.

00025 { return 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.

00067                                           {
00068   alreadyUsedEvent = false;
00069 }

void MedianCommonModeCalculator::setCM ( std::vector< float >  in  )  [inline, virtual]

Implements TkCommonModeCalculator.

Definition at line 21 of file MedianCommonModeCalculator.h.

References TkCommonMode::setCommonMode(), and theTkCommonMode.

void MedianCommonModeCalculator::setCM ( TkCommonMode in  )  [inline, virtual]

Implements TkCommonModeCalculator.

Definition at line 20 of file MedianCommonModeCalculator.h.

References theTkCommonMode.

Referenced by calculateCommonMode().

00020 {theTkCommonMode = in;}


Member Data Documentation

bool MedianCommonModeCalculator::alreadyUsedEvent [protected]

Definition at line 33 of file MedianCommonModeCalculator.h.

Referenced by calculateCommonMode(), and newEvent().

float MedianCommonModeCalculator::slope [protected]

Definition at line 34 of file MedianCommonModeCalculator.h.

Referenced by getCMSlope().

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:14 2009 for CMSSW by  doxygen 1.5.4