#include <TT6CommonModeCalculator.h>
Public Member Functions | |
TkCommonMode * | commonMode () |
ApvAnalysis::PedestalType | doIt (ApvAnalysis::PedestalType) |
float | getCMSlope () |
void | newEvent () |
void | setCM (std::vector< float > in) |
void | setCM (TkCommonMode *in) |
TT6CommonModeCalculator (TkNoiseCalculator *noise_calc, TkApvMask *mask_calc, float sig_cut) | |
virtual | ~TT6CommonModeCalculator () |
Protected Member Functions | |
void | calculateCMSlope (ApvAnalysis::PedestalType &) |
void | calculateCommonMode (ApvAnalysis::PedestalType &) |
Protected Attributes | |
bool | alreadyUsedEvent |
float | cutToAvoidSignal |
float | slope |
TkApvMask * | theApvMask |
std::vector< float > | theCommonModeValues |
TkNoiseCalculator * | theNoiseCalculator |
TkCommonMode * | theTkCommonMode |
Concrete implementation of TkCommonModeCalculator for TT6.
Definition at line 11 of file TT6CommonModeCalculator.h.
TT6CommonModeCalculator::TT6CommonModeCalculator | ( | TkNoiseCalculator * | noise_calc, |
TkApvMask * | mask_calc, | ||
float | sig_cut | ||
) |
Definition at line 5 of file TT6CommonModeCalculator.cc.
References gather_cfg::cout, and cutToAvoidSignal.
: theNoiseCalculator(noise_calc), theApvMask(mask_calc), alreadyUsedEvent(false) { if (0) cout << "Constructing TT6CommonMode Calculator ..." << endl; cutToAvoidSignal = sig_cut; }
TT6CommonModeCalculator::~TT6CommonModeCalculator | ( | ) | [virtual] |
Definition at line 16 of file TT6CommonModeCalculator.cc.
References gather_cfg::cout.
{ if (0) cout << "Destructing TT6CommonModeCalculator " << endl; }
void TT6CommonModeCalculator::calculateCMSlope | ( | ApvAnalysis::PedestalType & | indat | ) | [protected] |
Definition at line 84 of file TT6CommonModeCalculator.cc.
References alignCSCRings::s, slope, and python::multivaluedict::sort().
Referenced by calculateCommonMode().
void TT6CommonModeCalculator::calculateCommonMode | ( | ApvAnalysis::PedestalType & | indat | ) | [protected] |
Definition at line 41 of file TT6CommonModeCalculator.cc.
References alreadyUsedEvent, calculateCMSlope(), cutToAvoidSignal, TkCommonModeTopology::finalStrips(), i, TkCommonModeTopology::initialStrips(), j, TkApvMask::mask(), TkNoiseCalculator::noise(), TkCommonModeTopology::numberOfSets(), TkApvMask::ok, setCM(), theApvMask, theCommonModeValues, theNoiseCalculator, theTkCommonMode, and TkCommonMode::topology().
{ if (alreadyUsedEvent == false) { alreadyUsedEvent = true; // cout<< "I am inside the calculateCommonMode"<<endl; TkApvMask::MaskType strip_mask = theApvMask->mask(); ApvAnalysis::PedestalType strip_noise = theNoiseCalculator->noise(); theCommonModeValues.clear(); if(strip_noise.size() > 0) { int nSet = theTkCommonMode->topology().numberOfSets(); for (int i=0; i<nSet; i++){ int initial = theTkCommonMode->topology().initialStrips()[i]; int final = theTkCommonMode->topology().finalStrips()[i]; double sumVal = 0.0; double sumWt = 0.0; for (int j = initial; j <= final; j++) { if (strip_mask[j] == TkApvMask::ok ) { if(fabs(indat[j]) < cutToAvoidSignal*strip_noise[j]) { double nWeight = 1/(strip_noise[j]*strip_noise[j]); sumVal += (indat[j]*nWeight); sumWt += nWeight; } } } double avVal = (sumWt) ? sumVal/sumWt :0.0; theCommonModeValues.push_back(static_cast<float>(avVal)); //cout <<"Setting CM values"<<endl; } } } TT6CommonModeCalculator::setCM(theCommonModeValues); calculateCMSlope(indat); }
TkCommonMode* TT6CommonModeCalculator::commonMode | ( | ) | [inline, virtual] |
Get CM value
Implements TkCommonModeCalculator.
Definition at line 23 of file TT6CommonModeCalculator.h.
References theTkCommonMode.
{return theTkCommonMode;}
ApvAnalysis::PedestalType TT6CommonModeCalculator::doIt | ( | ApvAnalysis::PedestalType | ) | [virtual] |
Return CM-subtracted data in APV
Implements TkCommonModeCalculator.
Definition at line 23 of file TT6CommonModeCalculator.cc.
References i, and dbtoconf::out.
{ ApvAnalysis::PedestalType out; calculateCommonMode(indat); int setNumber; if(theCommonModeValues.size() >0) { for (unsigned int i=0; i<indat.size(); i++){ setNumber = theTkCommonMode->topology().setOfStrip(i); out.push_back(indat[i] - theCommonModeValues[setNumber]); } }else{ out = indat; } return out; }
float TT6CommonModeCalculator::getCMSlope | ( | ) | [inline, virtual] |
Get Slope
Implements TkCommonModeCalculator.
Definition at line 26 of file TT6CommonModeCalculator.h.
References slope.
{ return slope;}
void TT6CommonModeCalculator::newEvent | ( | ) | [virtual] |
Tell CM calculator that a new event is available
Reimplemented from TkCommonModeCalculator.
Definition at line 78 of file TT6CommonModeCalculator.cc.
References alreadyUsedEvent.
{ alreadyUsedEvent = false; }
void TT6CommonModeCalculator::setCM | ( | std::vector< float > | in | ) | [inline, virtual] |
Implements TkCommonModeCalculator.
Definition at line 22 of file TT6CommonModeCalculator.h.
References TkCommonMode::setCommonMode(), and theTkCommonMode.
void TT6CommonModeCalculator::setCM | ( | TkCommonMode * | in | ) | [inline, virtual] |
Implements TkCommonModeCalculator.
Definition at line 21 of file TT6CommonModeCalculator.h.
References recoMuon::in, and theTkCommonMode.
Referenced by calculateCommonMode().
{theTkCommonMode = in;}
bool TT6CommonModeCalculator::alreadyUsedEvent [protected] |
Definition at line 37 of file TT6CommonModeCalculator.h.
Referenced by calculateCommonMode(), and newEvent().
float TT6CommonModeCalculator::cutToAvoidSignal [protected] |
Definition at line 41 of file TT6CommonModeCalculator.h.
Referenced by calculateCommonMode(), and TT6CommonModeCalculator().
float TT6CommonModeCalculator::slope [protected] |
Definition at line 38 of file TT6CommonModeCalculator.h.
Referenced by calculateCMSlope(), and getCMSlope().
TkApvMask* TT6CommonModeCalculator::theApvMask [protected] |
Definition at line 36 of file TT6CommonModeCalculator.h.
Referenced by calculateCommonMode().
std::vector<float> TT6CommonModeCalculator::theCommonModeValues [protected] |
Definition at line 34 of file TT6CommonModeCalculator.h.
Referenced by calculateCommonMode().
Definition at line 35 of file TT6CommonModeCalculator.h.
Referenced by calculateCommonMode().
TkCommonMode* TT6CommonModeCalculator::theTkCommonMode [protected] |
Definition at line 33 of file TT6CommonModeCalculator.h.
Referenced by calculateCommonMode(), commonMode(), and setCM().