CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
LASProfileJudge Class Reference

#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
 

Detailed Description

check if a LASModuleProfile is usable for being stored and fitted

Definition at line 15 of file LASProfileJudge.h.

Constructor & Destructor Documentation

LASProfileJudge::LASProfileJudge ( )

Definition at line 16 of file LASProfileJudge.cc.

References isZeroFilter.

16  {
17 
18  // switch on the zero filter by default
19  isZeroFilter = true;
20 
21 }

Member Function Documentation

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().

98  {
99 
100  if( !zeroFilter ) {
101  std::cerr << " [LASProfileJudge::EnableZeroFilter] ** WARNING: Zero filter has been disabled." << std::endl;
102  }
103 
104  isZeroFilter = zeroFilter;
105 
106 }
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().

130  {
131 
132  // here we could later run the sum only on the affected (pair of) APV
133 
134  // expected beam position (in strips)
135  const unsigned int meanPosition = 256 + offset;
136  // backplane "alignment hole" (="signal region") approx. half size
137  const unsigned int halfWindowSize = 33;
138  // half size of range over which is summed (must be > halfWindowSize)
139  const unsigned int sumHalfRange = 128;
140 
141  double neg = 0;
142 
143  // need only x values, so cast here
144  for( unsigned int i = meanPosition - sumHalfRange; i < meanPosition - halfWindowSize; ++i ) {
145  neg += profile.GetValue( i );
146  }
147 
148  for( unsigned int i = meanPosition + halfWindowSize; i < meanPosition + sumHalfRange; ++i ) {
149  neg += profile.GetValue( i );
150  }
151 
152  return( neg );
153 
154 }
int i
Definition: DBlmapReader.cc:9
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile
unsigned int offset(bool)
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().

203  {
204 
205  // expected beam position in middle of module (in strips)
206  const unsigned int meanPosition = 256 + offset;
207  // backplane "alignment hole" approx. half size (in strips)
208  const unsigned int halfWindowSize = 33;
209 
210  bool returnValue = false;
211 
212  // calculate average out-of-signal
213  double average = 0., counterD = 0.;
214  for( unsigned int strip = 0; strip < 512; ++strip ) {
215  if( strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize ) {
216  average += profile.GetValue( strip );
217  counterD += 1.;
218  }
219  }
220  average /= counterD;
221 
222  // find strips with negative amplitude way above noise level
223  const double noiseLevel = 2.;
224  for( unsigned int strip = 0; strip < 512; ++strip ) {
225  if( profile.GetValue( strip ) < ( average - 10. * noiseLevel ) ) {
226  returnValue = true;
227  thePeak.first = strip; thePeak.second = profile.GetValue( strip );
228  break;
229  }
230  }
231 
232  return( returnValue );
233 
234 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile
std::pair< unsigned int, double > thePeak
unsigned int offset(bool)
int average
Definition: PDRates.py:137
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().

244  {
245 
246 
247  // expected beam position in middle of module (in strips)
248  const unsigned int meanPosition = 256 + offset;
249  // backplane "alignment hole" approx. half size (in strips)
250  const unsigned int halfWindowSize = 33;
251 
252  // find maximum strip amplitude in range
253  for( unsigned int strip = meanPosition - halfWindowSize; strip < meanPosition + halfWindowSize; ++strip ) {
254  if( profile.GetValue( strip ) > overdriveThreshold ) return true;
255  }
256 
257  return false;
258 
259 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile
unsigned int offset(bool)
unsigned int overdriveThreshold
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().

163  {
164 
165  // expected beam position (in strips)
166  const unsigned int meanPosition = 256 + offset;
167  // backplane "alignment hole" approx. half size (in strips)
168  const unsigned int halfWindowSize = 33;
169 
170  bool returnValue = false;
171 
172  // calculate average out-of-signal
173  double average = 0., counterD = 0.;
174  for( unsigned int strip = 0; strip < 512; ++strip ) {
175  if( strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize ) {
176  average += profile.GetValue( strip );
177  counterD += 1.;
178  }
179  }
180  average /= counterD;
181 
182  // find peaks well above noise level
183  const double noiseLevel = 2.; // to be softcoded..
184  for( unsigned int strip = meanPosition - halfWindowSize; strip < meanPosition + halfWindowSize; ++strip ) {
185  if( profile.GetValue( strip ) > ( average + 10. * noiseLevel ) ) {
186  returnValue = true;
187  thePeak.first = strip; thePeak.second = profile.GetValue( strip );
188  break;
189  }
190  }
191 
192  return( returnValue );
193 
194 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile
std::pair< unsigned int, double > thePeak
unsigned int offset(bool)
int average
Definition: PDRates.py:137
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().

32  {
33 
34  profile = aProfile;
35 
36  // need only approx values, so cast here to use integers throughout
37  const int approxOffset = static_cast<int>( offset );
38 
39  const double negativity = GetNegativity( approxOffset );
40  const bool isPeaks = IsPeaksInProfile( approxOffset );
41  const bool isNegativePeaks = IsNegativePeaksInProfile( approxOffset );
42 
43  bool result =
44  ( negativity < -1000. ) || // if we see negativity, there was laser..
45  ( isPeaks ) || // if we see a peak, " " "
46  ( isNegativePeaks ); // same here
47 
48  return( result );
49 
50 
51 }
bool IsNegativePeaksInProfile(int)
LASModuleProfile profile
bool IsPeaksInProfile(int)
tuple result
Definition: query.py:137
unsigned int offset(bool)
double GetNegativity(int)
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().

61  {
62 
63  profile = aProfile;
64 
65  // need only approx values, so cast here to use integers throughout
66  const int approxOffset = static_cast<int>( offset );
67 
68  // run the tests
69  const double negativity = GetNegativity( approxOffset );
70 
71  bool isPeaks;
72  if( !isZeroFilter ) isPeaks = true; // disable this test if set in cfg
73  else isPeaks = IsPeaksInProfile( approxOffset );
74 
75  const bool isNegativePeaks = IsNegativePeaksInProfile( approxOffset );
76 
77  bool isOverdrive; // disable this test if set in cfg
78  if( !isZeroFilter ) isOverdrive = false;
79  else isOverdrive = IsOverdrive( approxOffset );
80 
81  bool result =
82  ( negativity > -1000. ) && // < 1000. = distorted profile
83  ( isPeaks ) && // want to see a peak (zero filter)
84  !( isNegativePeaks ) && // no negative peaks
85  !( isOverdrive ); // no overdrive
86 
87  return( result );
88 
89 }
bool IsNegativePeaksInProfile(int)
LASModuleProfile profile
bool IsPeaksInProfile(int)
tuple result
Definition: query.py:137
unsigned int offset(bool)
double GetNegativity(int)
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().

115  {
116 
117  overdriveThreshold = aThreshold;
118 
119 }
unsigned int overdriveThreshold

Member Data Documentation

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
std::pair<unsigned int, double> LASProfileJudge::thePeak
private

Definition at line 31 of file LASProfileJudge.h.

Referenced by IsNegativePeaksInProfile(), and IsPeaksInProfile().