#include <CalibTracker/SiStripAPVAnalysis/interface/TT6CommonModeCalculator.h>
Public Member Functions | |
TkCommonMode * | commonMode () |
Get CM value. | |
ApvAnalysis::PedestalType | doIt (ApvAnalysis::PedestalType) |
Return CM-subtracted data in APV. | |
float | getCMSlope () |
Get Slope. | |
void | newEvent () |
Tell CM calculator that a new event is available. | |
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 |
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 GenMuonPlsPt100GeV_cfg::cout, cutToAvoidSignal, and lat::endl().
00005 : 00006 theNoiseCalculator(noise_calc), 00007 theApvMask(mask_calc), 00008 alreadyUsedEvent(false) 00009 { 00010 if (0) cout << "Constructing TT6CommonMode Calculator ..." << endl; 00011 cutToAvoidSignal = sig_cut; 00012 }
TT6CommonModeCalculator::~TT6CommonModeCalculator | ( | ) | [virtual] |
Definition at line 16 of file TT6CommonModeCalculator.cc.
References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().
void TT6CommonModeCalculator::calculateCMSlope | ( | ApvAnalysis::PedestalType & | indat | ) | [protected] |
Definition at line 84 of file TT6CommonModeCalculator.cc.
References s, slope, and python::multivaluedict::sort().
Referenced by calculateCommonMode().
00084 { 00085 if (indat.size() != 128) { 00086 slope = -100.0; 00087 return; 00088 } 00089 ApvAnalysis::PedestalType diffVec; 00090 diffVec.clear(); 00091 for(int s=0;s<64;s++) diffVec.push_back(indat[s+64]-indat[s]); 00092 std::sort(diffVec.begin(),diffVec.end()); 00093 slope = (diffVec[31]+diffVec[32])/2./64.; 00094 }
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().
Referenced by doIt().
00042 { 00043 if (alreadyUsedEvent == false) { 00044 alreadyUsedEvent = true; 00045 // cout<< "I am inside the calculateCommonMode"<<endl; 00046 TkApvMask::MaskType strip_mask = theApvMask->mask(); 00047 ApvAnalysis::PedestalType strip_noise = theNoiseCalculator->noise(); 00048 theCommonModeValues.clear(); 00049 00050 if(strip_noise.size() > 0) { 00051 int nSet = theTkCommonMode->topology().numberOfSets(); 00052 for (int i=0; i<nSet; i++){ 00053 int initial = theTkCommonMode->topology().initialStrips()[i]; 00054 int final = theTkCommonMode->topology().finalStrips()[i]; 00055 double sumVal = 0.0; 00056 double sumWt = 0.0; 00057 for (int j = initial; j <= final; j++) { 00058 if (strip_mask[j] == TkApvMask::ok ) { 00059 if(fabs(indat[j]) < cutToAvoidSignal*strip_noise[j]) { 00060 double nWeight = 1/(strip_noise[j]*strip_noise[j]); 00061 sumVal += (indat[j]*nWeight); 00062 sumWt += nWeight; 00063 } 00064 } 00065 } 00066 double avVal = (sumWt) ? sumVal/sumWt :0.0; 00067 theCommonModeValues.push_back(static_cast<float>(avVal)); 00068 //cout <<"Setting CM values"<<endl; 00069 } 00070 } 00071 } 00072 TT6CommonModeCalculator::setCM(theCommonModeValues); 00073 calculateCMSlope(indat); 00074 }
TkCommonMode* TT6CommonModeCalculator::commonMode | ( | ) | [inline, virtual] |
Get CM value.
Implements TkCommonModeCalculator.
Definition at line 23 of file TT6CommonModeCalculator.h.
References theTkCommonMode.
00023 {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 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 TT6CommonModeCalculator::getCMSlope | ( | ) | [inline, virtual] |
Get Slope.
Implements TkCommonModeCalculator.
Definition at line 26 of file TT6CommonModeCalculator.h.
References slope.
00026 { 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.
00078 { 00079 alreadyUsedEvent = false; 00080 }
void TT6CommonModeCalculator::setCM | ( | std::vector< float > | in | ) | [inline, virtual] |
Implements TkCommonModeCalculator.
Definition at line 22 of file TT6CommonModeCalculator.h.
References TkCommonMode::setCommonMode(), and theTkCommonMode.
00022 {theTkCommonMode->setCommonMode(in);}
void TT6CommonModeCalculator::setCM | ( | TkCommonMode * | in | ) | [inline, virtual] |
Implements TkCommonModeCalculator.
Definition at line 21 of file TT6CommonModeCalculator.h.
References theTkCommonMode.
Referenced by calculateCommonMode().
00021 {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] |
std::vector<float> TT6CommonModeCalculator::theCommonModeValues [protected] |
Definition at line 34 of file TT6CommonModeCalculator.h.
Referenced by calculateCommonMode(), and doIt().
TkCommonMode* TT6CommonModeCalculator::theTkCommonMode [protected] |
Definition at line 33 of file TT6CommonModeCalculator.h.
Referenced by calculateCommonMode(), commonMode(), doIt(), and setCM().