#include <Alignment/LaserAlignment/src/LASProfileJudge.h>
Public Member Functions | |
void | EnableZeroFilter (bool) |
toggle the zero filter (passed from cfg file) | |
bool | IsSignalIn (const LASModuleProfile &, int) |
Check if a LASModuleProfile indicates that the module has been hit, i.e. | |
bool | JudgeProfile (const LASModuleProfile &, int) |
Check if a LASModuleProfile is usable for being stored, i.e. | |
LASProfileJudge () | |
Private Member Functions | |
double | GetNegativity (int) |
In case of too high laser intensities, the APV baselines tend to drop down. | |
bool | IsNegativePeaksInProfile (int) |
sometimes when the laser intensity is too high the APVs get confused and a negative peak (dip) shows up. | |
bool | IsPeaksInProfile (int) |
If the laser intensity is too small, there's no peak at all. | |
Private Attributes | |
bool | isZeroFilter |
LASModuleProfile | profile |
std::pair< unsigned int, double > | thePeak |
Definition at line 15 of file LASProfileJudge.h.
LASProfileJudge::LASProfileJudge | ( | ) |
Definition at line 16 of file LASProfileJudge.cc.
References isZeroFilter.
00016 { 00017 00018 // switch on the zero filter by default 00019 isZeroFilter = true; 00020 00021 }
toggle the zero filter (passed from cfg file)
Definition at line 87 of file LASProfileJudge.cc.
References isZeroFilter.
00087 { 00088 00089 isZeroFilter = zeroFilter; 00090 00091 }
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 102 of file LASProfileJudge.cc.
References LASModuleProfile::GetValue(), i, and profile.
Referenced by IsSignalIn(), and JudgeProfile().
00102 { 00103 00104 // here we could later run the sum only on the affected (pair of) APV 00105 00106 // expected beam position (in strips) 00107 const unsigned int meanPosition = 256 + offset; 00108 // backplane "alignment hole" (="signal region") approx. half size 00109 const unsigned int halfWindowSize = 33; 00110 // half size of range over which is summed (must be > halfWindowSize) 00111 const unsigned int sumHalfRange = 128; 00112 00113 double neg = 0; 00114 00115 for( unsigned int i = meanPosition - sumHalfRange; i < meanPosition - halfWindowSize; ++i ) { 00116 neg += profile.GetValue( i ); 00117 } 00118 00119 for( unsigned int i = meanPosition + halfWindowSize; i < meanPosition + sumHalfRange; ++i ) { 00120 neg += profile.GetValue( i ); 00121 } 00122 00123 return( neg ); 00124 00125 }
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 174 of file LASProfileJudge.cc.
References average(), LASModuleProfile::GetValue(), profile, strip(), and thePeak.
Referenced by IsSignalIn(), and JudgeProfile().
00174 { 00175 00176 // expected beam position in middle of module (in strips) 00177 const unsigned int meanPosition = 256 + offset; 00178 // backplane "alignment hole" approx. half size (in strips) 00179 const unsigned int halfWindowSize = 33; 00180 00181 bool returnValue = false; 00182 00183 // calculate average out-of-signal 00184 double average = 0., counterD = 0.; 00185 for( unsigned int strip = 0; strip < 512; ++strip ) { 00186 if( strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize ) { 00187 average += profile.GetValue( strip ); 00188 counterD += 1.; 00189 } 00190 } 00191 average /= counterD; 00192 00193 // find strips with negative amplitude way above noise level 00194 const double noiseLevel = 2.; 00195 for( unsigned int strip = 0; strip < 512; ++strip ) { 00196 if( profile.GetValue( strip ) < ( average - 10. * noiseLevel ) ) { 00197 returnValue = true; 00198 thePeak.first = strip; thePeak.second = profile.GetValue( strip ); 00199 break; 00200 } 00201 } 00202 00203 return( returnValue ); 00204 00205 }
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 134 of file LASProfileJudge.cc.
References average(), LASModuleProfile::GetValue(), profile, strip(), and thePeak.
Referenced by IsSignalIn(), and JudgeProfile().
00134 { 00135 00136 // expected beam position (in strips) 00137 const unsigned int meanPosition = 256 + offset; 00138 // backplane "alignment hole" approx. half size (in strips) 00139 const unsigned int halfWindowSize = 33; 00140 00141 bool returnValue = false; 00142 00143 // calculate average out-of-signal 00144 double average = 0., counterD = 0.; 00145 for( unsigned int strip = 0; strip < 512; ++strip ) { 00146 if( strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize ) { 00147 average += profile.GetValue( strip ); 00148 counterD += 1.; 00149 } 00150 } 00151 average /= counterD; 00152 00153 // find peaks well above noise level 00154 const double noiseLevel = 2.; // to be softcoded.. 00155 for( unsigned int strip = meanPosition - halfWindowSize; strip < meanPosition + halfWindowSize; ++strip ) { 00156 if( profile.GetValue( strip ) > ( average + 10. * noiseLevel ) ) { 00157 returnValue = true; 00158 thePeak.first = strip; thePeak.second = profile.GetValue( strip ); 00159 break; 00160 } 00161 } 00162 00163 return( returnValue ); 00164 00165 }
bool LASProfileJudge::IsSignalIn | ( | const LASModuleProfile & | aProfile, | |
int | 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(), profile, and HLT_VtxMuL3::result.
Referenced by LaserAlignment::produce().
00032 { 00033 00034 profile = aProfile; 00035 00036 double negativity = GetNegativity( offset ); 00037 bool isPeaks = IsPeaksInProfile( offset ); 00038 bool isNegativePeaks = IsNegativePeaksInProfile( offset ); 00039 00040 bool result = 00041 ( negativity < -1000. ) || // if we see negativity, there was laser.. 00042 ( isPeaks ) || // if we see a peak, " " " 00043 ( isNegativePeaks ); // same here 00044 00045 return( result ); 00046 00047 00048 }
bool LASProfileJudge::JudgeProfile | ( | const LASModuleProfile & | aProfile, | |
int | offset = 0 | |||
) |
Check if a LASModuleProfile is usable for being stored, i.e.
contains a visible signal & no baseline distortions
Definition at line 58 of file LASProfileJudge.cc.
References GetNegativity(), IsNegativePeaksInProfile(), IsPeaksInProfile(), isZeroFilter, offset, profile, and HLT_VtxMuL3::result.
Referenced by LaserAlignment::produce().
00058 { 00059 00060 profile = aProfile; 00061 00062 // run the tests 00063 double negativity = GetNegativity( offset ); 00064 00065 bool isPeaks; 00066 if( isZeroFilter ) isPeaks = true; // disable this test if set in cfg 00067 else isPeaks = IsPeaksInProfile( offset ); 00068 00069 bool isNegativePeaks = IsNegativePeaksInProfile( offset ); 00070 00071 bool result = 00072 ( negativity > -1000. ) && // < 1000. = distorted profile 00073 ( isPeaks ) && // want to see a peak (zero filter) 00074 !( isNegativePeaks ); // no negative peaks 00075 00076 return( result ); 00077 00078 }
bool LASProfileJudge::isZeroFilter [private] |
Definition at line 29 of file LASProfileJudge.h.
Referenced by EnableZeroFilter(), JudgeProfile(), and LASProfileJudge().
LASModuleProfile LASProfileJudge::profile [private] |
Definition at line 27 of file LASProfileJudge.h.
Referenced by GetNegativity(), IsNegativePeaksInProfile(), IsPeaksInProfile(), IsSignalIn(), and JudgeProfile().
std::pair<unsigned int, double> LASProfileJudge::thePeak [private] |
Definition at line 28 of file LASProfileJudge.h.
Referenced by IsNegativePeaksInProfile(), and IsPeaksInProfile().