#include <TT6NoiseCalculator.h>
Public Member Functions | |
int | nevents () const |
void | newEvent () |
ApvAnalysis::PedestalType | noise () const |
void | resetNoise () |
void | setStripNoise (ApvAnalysis::PedestalType &in) |
ApvAnalysis::PedestalType | stripCMPSubtractedSignal () const |
float | stripNoise (int in) const |
TT6NoiseCalculator (int evnt_ini, int evnt_iter, float sig_cut) | |
TT6NoiseCalculator () | |
void | updateNoise (ApvAnalysis::PedestalType &in) |
void | updateStatus () |
virtual | ~TT6NoiseCalculator () |
Protected Member Functions | |
void | init () |
Protected Attributes | |
bool | alreadyUsedEvent |
float | cutToAvoidSignal_ |
int | eventsRequiredToCalibrate_ |
int | eventsRequiredToUpdate_ |
int | numberOfEvents |
ApvAnalysis::PedestalType | theCMPSubtractedSignal |
std::vector< unsigned short > | theEventPerStrip |
ApvAnalysis::PedestalType | theNoise |
std::vector< double > | theNoiseSqSum |
std::vector< double > | theNoiseSum |
Concrete implementation of TkNoiseCalculator for TT6.
Definition at line 9 of file TT6NoiseCalculator.h.
TT6NoiseCalculator::TT6NoiseCalculator | ( | ) |
Definition at line 10 of file TT6NoiseCalculator.cc.
References gather_cfg::cout, and init().
: numberOfEvents(0) , alreadyUsedEvent(false) { if (0) cout << "Constructing TT6NoiseCalculator " << endl; init(); }
TT6NoiseCalculator::TT6NoiseCalculator | ( | int | evnt_ini, |
int | evnt_iter, | ||
float | sig_cut | ||
) |
Definition at line 18 of file TT6NoiseCalculator.cc.
References gather_cfg::cout, cutToAvoidSignal_, eventsRequiredToCalibrate_, eventsRequiredToUpdate_, and init().
: numberOfEvents(0) , alreadyUsedEvent(false) { if (0) cout << "Constructing TT6NoiseCalculator " << endl; eventsRequiredToCalibrate_ = evnt_ini; eventsRequiredToUpdate_ = evnt_iter; cutToAvoidSignal_ = sig_cut; init(); }
TT6NoiseCalculator::~TT6NoiseCalculator | ( | ) | [virtual] |
Definition at line 43 of file TT6NoiseCalculator.cc.
References gather_cfg::cout.
{ if (0) cout << "Destructing TT6NoiseCalculator " << endl; }
void TT6NoiseCalculator::init | ( | void | ) | [protected] |
Definition at line 32 of file TT6NoiseCalculator.cc.
References TkStateMachine::setCalibrating(), theCMPSubtractedSignal, theEventPerStrip, theNoise, theNoiseSqSum, theNoiseSum, and TkNoiseCalculator::theStatus.
Referenced by TT6NoiseCalculator().
{ theCMPSubtractedSignal.clear(); theNoise.clear(); theNoiseSum.clear(); theNoiseSqSum.clear(); theEventPerStrip.clear(); theStatus.setCalibrating(); }
int TT6NoiseCalculator::nevents | ( | ) | const [inline] |
Definition at line 22 of file TT6NoiseCalculator.h.
References numberOfEvents.
{return numberOfEvents;}
void TT6NoiseCalculator::newEvent | ( | ) | [virtual] |
Tell noise calculator that a new event is available
Reimplemented from TkNoiseCalculator.
Definition at line 124 of file TT6NoiseCalculator.cc.
References alreadyUsedEvent.
{ alreadyUsedEvent = false; }
ApvAnalysis::PedestalType TT6NoiseCalculator::noise | ( | ) | const [inline, virtual] |
Return reconstructed noise
Implements TkNoiseCalculator.
Definition at line 20 of file TT6NoiseCalculator.h.
References theNoise.
{return theNoise;}
void TT6NoiseCalculator::resetNoise | ( | ) | [inline, virtual] |
Implements TkNoiseCalculator.
Definition at line 25 of file TT6NoiseCalculator.h.
References theNoise.
{theNoise.clear();}
void TT6NoiseCalculator::setStripNoise | ( | ApvAnalysis::PedestalType & | in | ) | [inline, virtual] |
Implements TkNoiseCalculator.
Definition at line 19 of file TT6NoiseCalculator.h.
References recoMuon::in, and theNoise.
ApvAnalysis::PedestalType TT6NoiseCalculator::stripCMPSubtractedSignal | ( | ) | const [inline] |
Definition at line 29 of file TT6NoiseCalculator.h.
References theCMPSubtractedSignal.
{return theCMPSubtractedSignal;}
float TT6NoiseCalculator::stripNoise | ( | int | in | ) | const [inline, virtual] |
Implements TkNoiseCalculator.
Definition at line 21 of file TT6NoiseCalculator.h.
References recoMuon::in, and theNoise.
void TT6NoiseCalculator::updateNoise | ( | ApvAnalysis::PedestalType & | ) | [virtual] |
Update noise with current event
Implements TkNoiseCalculator.
Definition at line 58 of file TT6NoiseCalculator.cc.
References alreadyUsedEvent, gather_cfg::cout, cutToAvoidSignal_, eventsRequiredToCalibrate_, eventsRequiredToUpdate_, i, TkStateMachine::isCalibrating(), TkStateMachine::isUpdating(), numberOfEvents, mathSSE::sqrt(), theCMPSubtractedSignal, theEventPerStrip, theNoise, theNoiseSqSum, theNoiseSum, TkNoiseCalculator::theStatus, and updateStatus().
{ if (alreadyUsedEvent == false) { alreadyUsedEvent = true; numberOfEvents++; if (numberOfEvents == 1 && theNoise.size() != in.size()) { edm::LogError("TT6NoiseCalculator:updateNoise") << " You did not initialize the Noise correctly prior to noise calibration."; } // Initialize sums used for estimating noise. if ((theStatus.isCalibrating() && numberOfEvents == 1) || (theStatus.isUpdating() && (numberOfEvents - eventsRequiredToCalibrate_)%eventsRequiredToUpdate_ == 1)) { theNoiseSum.clear(); theNoiseSqSum.clear(); theEventPerStrip.clear(); theNoiseSum.resize(in.size(),0.0); theNoiseSqSum.resize(in.size(),0.0); theEventPerStrip.resize(in.size(),0); } unsigned int i; // Update sums used for estimating noise. for (i = 0; i < in.size(); i++) { if (fabs(in[i]) < cutToAvoidSignal_*theNoise[i]) { theNoiseSum[i] += in[i]; theNoiseSqSum[i] += in[i]*in[i]; theEventPerStrip[i]++; } } // Calculate noise. if ((theStatus.isCalibrating() && numberOfEvents == eventsRequiredToCalibrate_) || (theStatus.isUpdating() && (numberOfEvents - eventsRequiredToCalibrate_)%eventsRequiredToUpdate_ == 0)) { theCMPSubtractedSignal.clear(); theNoise.clear(); for (i = 0; i < in.size(); i++) { double avVal = (theEventPerStrip[i]) ? theNoiseSum[i]/(theEventPerStrip[i]):0.0; double sqAvVal = (theEventPerStrip[i]) ? theNoiseSqSum[i]/(theEventPerStrip[i]):0.0; double corr_fac = (theEventPerStrip[i] > 1) ? (theEventPerStrip[i]/(theEventPerStrip[i]-1)) : 1.0; double rmsVal = (sqAvVal - avVal*avVal > 0.0) ? sqrt(corr_fac * (sqAvVal - avVal*avVal)) : 0.0; theCMPSubtractedSignal.push_back(static_cast<float>(avVal)); theNoise.push_back(static_cast<float>(rmsVal)); if (0) cout << " TT6NoiseCalculator::updateNoise " << theNoiseSum[i] << " " << theNoiseSqSum[i] << " " << theEventPerStrip[i] << " " << avVal << " " << sqAvVal << " " << (sqAvVal - avVal*avVal) << " " << rmsVal << endl; } } updateStatus(); } }
void TT6NoiseCalculator::updateStatus | ( | ) | [virtual] |
Request that status flag be updated
Implements TkNoiseCalculator.
Definition at line 49 of file TT6NoiseCalculator.cc.
References eventsRequiredToCalibrate_, TkStateMachine::isCalibrating(), numberOfEvents, TkStateMachine::setUpdating(), and TkNoiseCalculator::theStatus.
Referenced by updateNoise().
{ if (theStatus.isCalibrating() && numberOfEvents >= eventsRequiredToCalibrate_) { theStatus.setUpdating(); } }
bool TT6NoiseCalculator::alreadyUsedEvent [protected] |
Definition at line 41 of file TT6NoiseCalculator.h.
Referenced by newEvent(), and updateNoise().
float TT6NoiseCalculator::cutToAvoidSignal_ [protected] |
Definition at line 45 of file TT6NoiseCalculator.h.
Referenced by TT6NoiseCalculator(), and updateNoise().
int TT6NoiseCalculator::eventsRequiredToCalibrate_ [protected] |
Definition at line 43 of file TT6NoiseCalculator.h.
Referenced by TT6NoiseCalculator(), updateNoise(), and updateStatus().
int TT6NoiseCalculator::eventsRequiredToUpdate_ [protected] |
Definition at line 44 of file TT6NoiseCalculator.h.
Referenced by TT6NoiseCalculator(), and updateNoise().
int TT6NoiseCalculator::numberOfEvents [protected] |
Definition at line 40 of file TT6NoiseCalculator.h.
Referenced by nevents(), updateNoise(), and updateStatus().
Definition at line 37 of file TT6NoiseCalculator.h.
Referenced by init(), stripCMPSubtractedSignal(), and updateNoise().
std::vector<unsigned short> TT6NoiseCalculator::theEventPerStrip [protected] |
Definition at line 39 of file TT6NoiseCalculator.h.
Referenced by init(), and updateNoise().
Definition at line 36 of file TT6NoiseCalculator.h.
Referenced by init(), noise(), resetNoise(), setStripNoise(), stripNoise(), and updateNoise().
std::vector<double> TT6NoiseCalculator::theNoiseSqSum [protected] |
Definition at line 38 of file TT6NoiseCalculator.h.
Referenced by init(), and updateNoise().
std::vector<double> TT6NoiseCalculator::theNoiseSum [protected] |
Definition at line 38 of file TT6NoiseCalculator.h.
Referenced by init(), and updateNoise().