#include <LASProfileJudge.h>
Public Member Functions | |
void | EnableZeroFilter (bool) |
bool | IsSignalIn (const LASModuleProfile &, double) |
bool | JudgeProfile (const LASModuleProfile &, double) |
LASProfileJudge () | |
void | SetOverdriveThreshold (unsigned int) |
Private Member Functions | |
double | GetNegativity (int) |
bool | IsNegativePeaksInProfile (int) |
bool | IsOverdrive (int) |
bool | IsPeaksInProfile (int) |
Private Attributes | |
bool | isZeroFilter |
unsigned int | overdriveThreshold |
LASModuleProfile | profile |
std::pair< unsigned int, double > | thePeak |
check if a LASModuleProfile is usable for being stored and fitted
Definition at line 15 of file LASProfileJudge.h.
LASProfileJudge::LASProfileJudge | ( | ) |
Definition at line 16 of file LASProfileJudge.cc.
References isZeroFilter.
{ // switch on the zero filter by default isZeroFilter = true; }
void LASProfileJudge::EnableZeroFilter | ( | bool | zeroFilter | ) |
toggle the zero filter (passed from cfg file)
Definition at line 98 of file LASProfileJudge.cc.
References benchmark_cfg::cerr, and isZeroFilter.
Referenced by LaserAlignment::LaserAlignment().
{ if( !zeroFilter ) { std::cerr << " [LASProfileJudge::EnableZeroFilter] ** WARNING: Zero filter has been disabled." << std::endl; } isZeroFilter = zeroFilter; }
double LASProfileJudge::GetNegativity | ( | int | offset | ) | [private] |
In case of too high laser intensities, the APV baselines tend to drop down. here, the strip amplitudes in the area around the signal region are summed to return a variable which can indicate this.
Definition at line 130 of file LASProfileJudge.cc.
References LASModuleProfile::GetValue(), i, neg, evf::evtn::offset(), and profile.
Referenced by IsSignalIn(), and JudgeProfile().
{ // here we could later run the sum only on the affected (pair of) APV // expected beam position (in strips) const unsigned int meanPosition = 256 + offset; // backplane "alignment hole" (="signal region") approx. half size const unsigned int halfWindowSize = 33; // half size of range over which is summed (must be > halfWindowSize) const unsigned int sumHalfRange = 128; double neg = 0; // need only x values, so cast here for( unsigned int i = meanPosition - sumHalfRange; i < meanPosition - halfWindowSize; ++i ) { neg += profile.GetValue( i ); } for( unsigned int i = meanPosition + halfWindowSize; i < meanPosition + sumHalfRange; ++i ) { neg += profile.GetValue( i ); } return( neg ); }
bool LASProfileJudge::IsNegativePeaksInProfile | ( | int | offset | ) | [private] |
sometimes when the laser intensity is too high the APVs get confused and a negative peak (dip) shows up. this is filtered here.
Definition at line 203 of file LASProfileJudge.cc.
References PDRates::average, LASModuleProfile::GetValue(), evf::evtn::offset(), profile, strip(), and thePeak.
Referenced by IsSignalIn(), and JudgeProfile().
{ // expected beam position in middle of module (in strips) const unsigned int meanPosition = 256 + offset; // backplane "alignment hole" approx. half size (in strips) const unsigned int halfWindowSize = 33; bool returnValue = false; // calculate average out-of-signal double average = 0., counterD = 0.; for( unsigned int strip = 0; strip < 512; ++strip ) { if( strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize ) { average += profile.GetValue( strip ); counterD += 1.; } } average /= counterD; // find strips with negative amplitude way above noise level const double noiseLevel = 2.; for( unsigned int strip = 0; strip < 512; ++strip ) { if( profile.GetValue( strip ) < ( average - 10. * noiseLevel ) ) { returnValue = true; thePeak.first = strip; thePeak.second = profile.GetValue( strip ); break; } } return( returnValue ); }
bool LASProfileJudge::IsOverdrive | ( | int | offset | ) | [private] |
check if peak in signal region is too high; this can cause baseline distortions and therefore position bias
Definition at line 244 of file LASProfileJudge.cc.
References LASModuleProfile::GetValue(), evf::evtn::offset(), overdriveThreshold, profile, and strip().
Referenced by JudgeProfile().
{ // expected beam position in middle of module (in strips) const unsigned int meanPosition = 256 + offset; // backplane "alignment hole" approx. half size (in strips) const unsigned int halfWindowSize = 33; // find maximum strip amplitude in range for( unsigned int strip = meanPosition - halfWindowSize; strip < meanPosition + halfWindowSize; ++strip ) { if( profile.GetValue( strip ) > overdriveThreshold ) return true; } return false; }
bool LASProfileJudge::IsPeaksInProfile | ( | int | offset | ) | [private] |
If the laser intensity is too small, there's no peak at all. Here we look if any strip is well above noise level.
Definition at line 163 of file LASProfileJudge.cc.
References PDRates::average, LASModuleProfile::GetValue(), evf::evtn::offset(), profile, strip(), and thePeak.
Referenced by IsSignalIn(), and JudgeProfile().
{ // expected beam position (in strips) const unsigned int meanPosition = 256 + offset; // backplane "alignment hole" approx. half size (in strips) const unsigned int halfWindowSize = 33; bool returnValue = false; // calculate average out-of-signal double average = 0., counterD = 0.; for( unsigned int strip = 0; strip < 512; ++strip ) { if( strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize ) { average += profile.GetValue( strip ); counterD += 1.; } } average /= counterD; // find peaks well above noise level const double noiseLevel = 2.; // to be softcoded.. for( unsigned int strip = meanPosition - halfWindowSize; strip < meanPosition + halfWindowSize; ++strip ) { if( profile.GetValue( strip ) > ( average + 10. * noiseLevel ) ) { returnValue = true; thePeak.first = strip; thePeak.second = profile.GetValue( strip ); break; } } return( returnValue ); }
bool LASProfileJudge::IsSignalIn | ( | const LASModuleProfile & | aProfile, |
double | offset | ||
) |
Check if a LASModuleProfile indicates that the module has been hit, i.e. contains a visible signal or is even distorted by too high laser amplitude. This method doesn't care if the profile is usable for analysis.
Definition at line 32 of file LASProfileJudge.cc.
References GetNegativity(), IsNegativePeaksInProfile(), IsPeaksInProfile(), evf::evtn::offset(), profile, and query::result.
Referenced by LaserAlignment::produce().
{ profile = aProfile; // need only approx values, so cast here to use integers throughout const int approxOffset = static_cast<int>( offset ); const double negativity = GetNegativity( approxOffset ); const bool isPeaks = IsPeaksInProfile( approxOffset ); const bool isNegativePeaks = IsNegativePeaksInProfile( approxOffset ); bool result = ( negativity < -1000. ) || // if we see negativity, there was laser.. ( isPeaks ) || // if we see a peak, " " " ( isNegativePeaks ); // same here return( result ); }
bool LASProfileJudge::JudgeProfile | ( | const LASModuleProfile & | aProfile, |
double | offset = 0. |
||
) |
Check if a LASModuleProfile is usable for being stored, i.e. contains a visible signal & no baseline distortions
Definition at line 61 of file LASProfileJudge.cc.
References GetNegativity(), IsNegativePeaksInProfile(), IsOverdrive(), IsPeaksInProfile(), isZeroFilter, evf::evtn::offset(), profile, and query::result.
Referenced by LaserAlignment::produce().
{ profile = aProfile; // need only approx values, so cast here to use integers throughout const int approxOffset = static_cast<int>( offset ); // run the tests const double negativity = GetNegativity( approxOffset ); bool isPeaks; if( !isZeroFilter ) isPeaks = true; // disable this test if set in cfg else isPeaks = IsPeaksInProfile( approxOffset ); const bool isNegativePeaks = IsNegativePeaksInProfile( approxOffset ); bool isOverdrive; // disable this test if set in cfg if( !isZeroFilter ) isOverdrive = false; else isOverdrive = IsOverdrive( approxOffset ); bool result = ( negativity > -1000. ) && // < 1000. = distorted profile ( isPeaks ) && // want to see a peak (zero filter) !( isNegativePeaks ) && // no negative peaks !( isOverdrive ); // no overdrive return( result ); }
void LASProfileJudge::SetOverdriveThreshold | ( | unsigned int | aThreshold | ) |
set the threshold for overdriven profiles (passed from cfg file)
Definition at line 115 of file LASProfileJudge.cc.
References overdriveThreshold.
Referenced by LaserAlignment::LaserAlignment().
{ overdriveThreshold = aThreshold; }
bool LASProfileJudge::isZeroFilter [private] |
Definition at line 32 of file LASProfileJudge.h.
Referenced by EnableZeroFilter(), JudgeProfile(), and LASProfileJudge().
unsigned int LASProfileJudge::overdriveThreshold [private] |
Definition at line 33 of file LASProfileJudge.h.
Referenced by IsOverdrive(), and SetOverdriveThreshold().
LASModuleProfile LASProfileJudge::profile [private] |
Definition at line 30 of file LASProfileJudge.h.
Referenced by GetNegativity(), IsNegativePeaksInProfile(), IsOverdrive(), IsPeaksInProfile(), IsSignalIn(), and JudgeProfile().
std::pair<unsigned int, double> LASProfileJudge::thePeak [private] |
Definition at line 31 of file LASProfileJudge.h.
Referenced by IsNegativePeaksInProfile(), and IsPeaksInProfile().