CMS 3D CMS Logo

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  :
18 {
19 
20  // switch on the zero filter by default
21  isZeroFilter = true;
22 
23 }
unsigned int overdriveThreshold

Member Function Documentation

void LASProfileJudge::EnableZeroFilter ( bool  zeroFilter)

toggle the zero filter (passed from cfg file)

Definition at line 100 of file LASProfileJudge.cc.

References MessageLogger_cfi::cerr, and isZeroFilter.

Referenced by LaserAlignment::LaserAlignment().

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

References LASModuleProfile::GetValue(), i, PFRecoTauDiscriminationByIsolation_cfi::offset, and profile.

Referenced by IsSignalIn(), and JudgeProfile().

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

References LASModuleProfile::GetValue(), fftjetproducer_cfi::noiseLevel, PFRecoTauDiscriminationByIsolation_cfi::offset, profile, digi_MixPreMix_cfi::strip, and thePeak.

Referenced by IsSignalIn(), and JudgeProfile().

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

References LASModuleProfile::GetValue(), PFRecoTauDiscriminationByIsolation_cfi::offset, overdriveThreshold, profile, and digi_MixPreMix_cfi::strip.

Referenced by JudgeProfile().

246  {
247 
248 
249  // expected beam position in middle of module (in strips)
250  const unsigned int meanPosition = 256 + offset;
251  // backplane "alignment hole" approx. half size (in strips)
252  const unsigned int halfWindowSize = 33;
253 
254  // find maximum strip amplitude in range
255  for( unsigned int strip = meanPosition - halfWindowSize; strip < meanPosition + halfWindowSize; ++strip ) {
256  if( profile.GetValue( strip ) > overdriveThreshold ) return true;
257  }
258 
259  return false;
260 
261 }
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile
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 165 of file LASProfileJudge.cc.

References LASModuleProfile::GetValue(), fftjetproducer_cfi::noiseLevel, PFRecoTauDiscriminationByIsolation_cfi::offset, profile, digi_MixPreMix_cfi::strip, and thePeak.

Referenced by IsSignalIn(), and JudgeProfile().

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

References GetNegativity(), IsNegativePeaksInProfile(), IsPeaksInProfile(), PFRecoTauDiscriminationByIsolation_cfi::offset, profile, and mps_fire::result.

Referenced by LaserAlignment::produce().

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

References GetNegativity(), IsNegativePeaksInProfile(), IsOverdrive(), IsPeaksInProfile(), isZeroFilter, PFRecoTauDiscriminationByIsolation_cfi::offset, profile, and mps_fire::result.

Referenced by LaserAlignment::produce().

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

set the threshold for overdriven profiles (passed from cfg file)

Definition at line 117 of file LASProfileJudge.cc.

References overdriveThreshold.

Referenced by LaserAlignment::LaserAlignment().

117  {
118 
119  overdriveThreshold = aThreshold;
120 
121 }
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().