#include <CalibTracker/SiStripAPVAnalysis/interface/TT6NoiseCalculator.h>
Public Member Functions | |
int | nevents () const |
void | newEvent () |
Tell noise calculator that a new event is available. | |
ApvAnalysis::PedestalType | noise () const |
Return reconstructed noise. | |
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) |
Update noise with current event. | |
void | updateStatus () |
Request that status flag be updated. | |
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 |
Definition at line 9 of file TT6NoiseCalculator.h.
TT6NoiseCalculator::TT6NoiseCalculator | ( | ) |
Definition at line 10 of file TT6NoiseCalculator.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and init().
00010 : 00011 numberOfEvents(0) , 00012 alreadyUsedEvent(false) 00013 { 00014 if (0) cout << "Constructing TT6NoiseCalculator " << endl; 00015 init(); 00016 } //
Definition at line 18 of file TT6NoiseCalculator.cc.
References GenMuonPlsPt100GeV_cfg::cout, cutToAvoidSignal_, lat::endl(), eventsRequiredToCalibrate_, eventsRequiredToUpdate_, and init().
00019 : 00020 numberOfEvents(0) , 00021 alreadyUsedEvent(false) 00022 { 00023 if (0) cout << "Constructing TT6NoiseCalculator " << endl; 00024 eventsRequiredToCalibrate_ = evnt_ini; 00025 eventsRequiredToUpdate_ = evnt_iter; 00026 cutToAvoidSignal_ = sig_cut; 00027 init(); 00028 } //
TT6NoiseCalculator::~TT6NoiseCalculator | ( | ) | [virtual] |
Definition at line 43 of file TT6NoiseCalculator.cc.
References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().
void TT6NoiseCalculator::init | ( | ) | [protected] |
Definition at line 32 of file TT6NoiseCalculator.cc.
References TkStateMachine::setCalibrating(), theCMPSubtractedSignal, theEventPerStrip, theNoise, theNoiseSqSum, theNoiseSum, and TkNoiseCalculator::theStatus.
Referenced by TT6NoiseCalculator().
00032 { 00033 theCMPSubtractedSignal.clear(); 00034 theNoise.clear(); 00035 theNoiseSum.clear(); 00036 theNoiseSqSum.clear(); 00037 theEventPerStrip.clear(); 00038 theStatus.setCalibrating(); 00039 }
int TT6NoiseCalculator::nevents | ( | ) | const [inline] |
Definition at line 22 of file TT6NoiseCalculator.h.
References numberOfEvents.
00022 {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.
00124 { 00125 alreadyUsedEvent = false; 00126 }
ApvAnalysis::PedestalType TT6NoiseCalculator::noise | ( | ) | const [inline, virtual] |
Return reconstructed noise.
Implements TkNoiseCalculator.
Definition at line 20 of file TT6NoiseCalculator.h.
References theNoise.
00020 {return theNoise;}
void TT6NoiseCalculator::resetNoise | ( | ) | [inline, virtual] |
Implements TkNoiseCalculator.
Definition at line 25 of file TT6NoiseCalculator.h.
References theNoise.
00025 {theNoise.clear();}
void TT6NoiseCalculator::setStripNoise | ( | ApvAnalysis::PedestalType & | in | ) | [inline, virtual] |
Implements TkNoiseCalculator.
Definition at line 19 of file TT6NoiseCalculator.h.
References theNoise.
ApvAnalysis::PedestalType TT6NoiseCalculator::stripCMPSubtractedSignal | ( | ) | const [inline] |
Definition at line 29 of file TT6NoiseCalculator.h.
References theCMPSubtractedSignal.
00030 {return theCMPSubtractedSignal;}
float TT6NoiseCalculator::stripNoise | ( | int | in | ) | const [inline, virtual] |
Implements TkNoiseCalculator.
Definition at line 21 of file TT6NoiseCalculator.h.
References theNoise.
void TT6NoiseCalculator::updateNoise | ( | ApvAnalysis::PedestalType & | ) | [virtual] |
Update noise with current event.
Implements TkNoiseCalculator.
Definition at line 58 of file TT6NoiseCalculator.cc.
References alreadyUsedEvent, GenMuonPlsPt100GeV_cfg::cout, cutToAvoidSignal_, lat::endl(), eventsRequiredToCalibrate_, eventsRequiredToUpdate_, i, TkStateMachine::isCalibrating(), TkStateMachine::isUpdating(), numberOfEvents, funct::sqrt(), theCMPSubtractedSignal, theEventPerStrip, theNoise, theNoiseSqSum, theNoiseSum, TkNoiseCalculator::theStatus, and updateStatus().
00058 { 00059 if (alreadyUsedEvent == false) { 00060 alreadyUsedEvent = true; 00061 numberOfEvents++; 00062 00063 if (numberOfEvents == 1 && theNoise.size() != in.size()) { 00064 edm::LogError("TT6NoiseCalculator:updateNoise") << " You did not initialize the Noise correctly prior to noise calibration."; 00065 } 00066 00067 // Initialize sums used for estimating noise. 00068 if ((theStatus.isCalibrating() && numberOfEvents == 1) || 00069 (theStatus.isUpdating() && (numberOfEvents - eventsRequiredToCalibrate_)%eventsRequiredToUpdate_ == 1)) 00070 { 00071 theNoiseSum.clear(); 00072 theNoiseSqSum.clear(); 00073 theEventPerStrip.clear(); 00074 00075 theNoiseSum.resize(in.size(),0.0); 00076 theNoiseSqSum.resize(in.size(),0.0); 00077 theEventPerStrip.resize(in.size(),0); 00078 } 00079 00080 unsigned int i; 00081 00082 // Update sums used for estimating noise. 00083 for (i = 0; i < in.size(); i++) { 00084 if (fabs(in[i]) < cutToAvoidSignal_*theNoise[i]) { 00085 theNoiseSum[i] += in[i]; 00086 theNoiseSqSum[i] += in[i]*in[i]; 00087 theEventPerStrip[i]++; 00088 } 00089 } 00090 00091 // Calculate noise. 00092 if ((theStatus.isCalibrating() && numberOfEvents == eventsRequiredToCalibrate_) || 00093 (theStatus.isUpdating() && (numberOfEvents - eventsRequiredToCalibrate_)%eventsRequiredToUpdate_ == 0)) 00094 { 00095 theCMPSubtractedSignal.clear(); 00096 theNoise.clear(); 00097 00098 for (i = 0; i < in.size(); i++) { 00099 double avVal = (theEventPerStrip[i]) ? theNoiseSum[i]/(theEventPerStrip[i]):0.0; 00100 double sqAvVal = (theEventPerStrip[i]) ? theNoiseSqSum[i]/(theEventPerStrip[i]):0.0; 00101 double corr_fac = (theEventPerStrip[i] > 1) ? (theEventPerStrip[i]/(theEventPerStrip[i]-1)) : 1.0; 00102 double rmsVal = (sqAvVal - avVal*avVal > 0.0) ? sqrt(corr_fac * (sqAvVal - avVal*avVal)) : 0.0; 00103 00104 theCMPSubtractedSignal.push_back(static_cast<float>(avVal)); 00105 00106 theNoise.push_back(static_cast<float>(rmsVal)); 00107 00108 if (0) cout << " TT6NoiseCalculator::updateNoise " 00109 << theNoiseSum[i] << " " 00110 << theNoiseSqSum[i] << " " 00111 << theEventPerStrip[i] << " " 00112 << avVal << " " 00113 << sqAvVal << " " 00114 << (sqAvVal - avVal*avVal) << " " 00115 << rmsVal << endl; 00116 } 00117 } 00118 updateStatus(); 00119 } 00120 }
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().
00049 { 00050 if (theStatus.isCalibrating() && 00051 numberOfEvents >= eventsRequiredToCalibrate_) { 00052 theStatus.setUpdating(); 00053 } 00054 }
bool TT6NoiseCalculator::alreadyUsedEvent [protected] |
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 36 of file TT6NoiseCalculator.h.
Referenced by init(), noise(), resetNoise(), setStripNoise(), stripNoise(), and updateNoise().
std::vector<double> TT6NoiseCalculator::theNoiseSqSum [protected] |
std::vector<double> TT6NoiseCalculator::theNoiseSum [protected] |