#include <CalibTracker/SiStripAPVAnalysis/interface/MedianCommonModeCalculator.h>
Public Member Functions | |
TkCommonMode * | commonMode () |
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 |
TkCommonMode * | theTkCommonMode |
Definition at line 11 of file MedianCommonModeCalculator.h.
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().
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.
00021 {theTkCommonMode->setCommonMode(in);}
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;}
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().