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 14 of file LASProfileJudge.h.

Constructor & Destructor Documentation

◆ LASProfileJudge()

LASProfileJudge::LASProfileJudge ( )

Definition at line 14 of file LASProfileJudge.cc.

References isZeroFilter.

14  : overdriveThreshold(0) {
15  // switch on the zero filter by default
16  isZeroFilter = true;
17 }
unsigned int overdriveThreshold

Member Function Documentation

◆ EnableZeroFilter()

void LASProfileJudge::EnableZeroFilter ( bool  zeroFilter)

toggle the zero filter (passed from cfg file)

Definition at line 79 of file LASProfileJudge.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, and isZeroFilter.

Referenced by LaserAlignment::LaserAlignment().

79  {
80  if (!zeroFilter) {
81  std::cerr << " [LASProfileJudge::EnableZeroFilter] ** WARNING: Zero filter has been disabled." << std::endl;
82  }
83 
84  isZeroFilter = zeroFilter;
85 }

◆ GetNegativity()

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 97 of file LASProfileJudge.cc.

References LASModuleProfile::GetValue(), mps_fire::i, hltrates_dqm_sourceclient-live_cfg::offset, and profile.

Referenced by IsSignalIn(), and JudgeProfile().

97  {
98  // here we could later run the sum only on the affected (pair of) APV
99 
100  // expected beam position (in strips)
101  const unsigned int meanPosition = 256 + offset;
102  // backplane "alignment hole" (="signal region") approx. half size
103  const unsigned int halfWindowSize = 33;
104  // half size of range over which is summed (must be > halfWindowSize)
105  const unsigned int sumHalfRange = 128;
106 
107  double neg = 0;
108 
109  // need only x values, so cast here
110  for (unsigned int i = meanPosition - sumHalfRange; i < meanPosition - halfWindowSize; ++i) {
111  neg += profile.GetValue(i);
112  }
113 
114  for (unsigned int i = meanPosition + halfWindowSize; i < meanPosition + sumHalfRange; ++i) {
115  neg += profile.GetValue(i);
116  }
117 
118  return (neg);
119 }
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile

◆ IsNegativePeaksInProfile()

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 161 of file LASProfileJudge.cc.

References LASModuleProfile::GetValue(), fftjetproducer_cfi::noiseLevel, hltrates_dqm_sourceclient-live_cfg::offset, profile, digitizers_cfi::strip, and thePeak.

Referenced by IsSignalIn(), and JudgeProfile().

161  {
162  // expected beam position in middle of module (in strips)
163  const unsigned int meanPosition = 256 + offset;
164  // backplane "alignment hole" approx. half size (in strips)
165  const unsigned int halfWindowSize = 33;
166 
167  bool returnValue = false;
168 
169  // calculate average out-of-signal
170  double average = 0., counterD = 0.;
171  for (unsigned int strip = 0; strip < 512; ++strip) {
172  if (strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize) {
174  counterD += 1.;
175  }
176  }
177  average /= counterD;
178 
179  // find strips with negative amplitude way above noise level
180  const double noiseLevel = 2.;
181  for (unsigned int strip = 0; strip < 512; ++strip) {
182  if (profile.GetValue(strip) < (average - 10. * noiseLevel)) {
183  returnValue = true;
184  thePeak.first = strip;
185  thePeak.second = profile.GetValue(strip);
186  break;
187  }
188  }
189 
190  return (returnValue);
191 }
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile
std::pair< unsigned int, double > thePeak

◆ IsOverdrive()

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 197 of file LASProfileJudge.cc.

References LASModuleProfile::GetValue(), hltrates_dqm_sourceclient-live_cfg::offset, overdriveThreshold, profile, and digitizers_cfi::strip.

Referenced by JudgeProfile().

197  {
198  // expected beam position in middle of module (in strips)
199  const unsigned int meanPosition = 256 + offset;
200  // backplane "alignment hole" approx. half size (in strips)
201  const unsigned int halfWindowSize = 33;
202 
203  // find maximum strip amplitude in range
204  for (unsigned int strip = meanPosition - halfWindowSize; strip < meanPosition + halfWindowSize; ++strip) {
206  return true;
207  }
208 
209  return false;
210 }
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile
unsigned int overdriveThreshold

◆ IsPeaksInProfile()

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 125 of file LASProfileJudge.cc.

References LASModuleProfile::GetValue(), fftjetproducer_cfi::noiseLevel, hltrates_dqm_sourceclient-live_cfg::offset, profile, digitizers_cfi::strip, and thePeak.

Referenced by IsSignalIn(), and JudgeProfile().

125  {
126  // expected beam position (in strips)
127  const unsigned int meanPosition = 256 + offset;
128  // backplane "alignment hole" approx. half size (in strips)
129  const unsigned int halfWindowSize = 33;
130 
131  bool returnValue = false;
132 
133  // calculate average out-of-signal
134  double average = 0., counterD = 0.;
135  for (unsigned int strip = 0; strip < 512; ++strip) {
136  if (strip < meanPosition - halfWindowSize || strip > meanPosition + halfWindowSize) {
138  counterD += 1.;
139  }
140  }
141  average /= counterD;
142 
143  // find peaks well above noise level
144  const double noiseLevel = 2.; // to be softcoded..
145  for (unsigned int strip = meanPosition - halfWindowSize; strip < meanPosition + halfWindowSize; ++strip) {
146  if (profile.GetValue(strip) > (average + 10. * noiseLevel)) {
147  returnValue = true;
148  thePeak.first = strip;
149  thePeak.second = profile.GetValue(strip);
150  break;
151  }
152  }
153 
154  return (returnValue);
155 }
double GetValue(unsigned int theStripNumber) const
LASModuleProfile profile
std::pair< unsigned int, double > thePeak

◆ IsSignalIn()

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 24 of file LASProfileJudge.cc.

References GetNegativity(), IsNegativePeaksInProfile(), IsPeaksInProfile(), hltrates_dqm_sourceclient-live_cfg::offset, profile, and mps_fire::result.

Referenced by LaserAlignment::produce().

24  {
25  profile = aProfile;
26 
27  // need only approx values, so cast here to use integers throughout
28  const int approxOffset = static_cast<int>(offset);
29 
30  const double negativity = GetNegativity(approxOffset);
31  const bool isPeaks = IsPeaksInProfile(approxOffset);
32  const bool isNegativePeaks = IsNegativePeaksInProfile(approxOffset);
33 
34  bool result = (negativity < -1000.) || // if we see negativity, there was laser..
35  (isPeaks) || // if we see a peak, " " "
36  (isNegativePeaks); // same here
37 
38  return (result);
39 }
bool IsNegativePeaksInProfile(int)
LASModuleProfile profile
bool IsPeaksInProfile(int)
double GetNegativity(int)

◆ JudgeProfile()

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 45 of file LASProfileJudge.cc.

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

Referenced by LaserAlignment::produce().

45  {
46  profile = aProfile;
47 
48  // need only approx values, so cast here to use integers throughout
49  const int approxOffset = static_cast<int>(offset);
50 
51  // run the tests
52  const double negativity = GetNegativity(approxOffset);
53 
54  bool isPeaks;
55  if (!isZeroFilter)
56  isPeaks = true; // disable this test if set in cfg
57  else
58  isPeaks = IsPeaksInProfile(approxOffset);
59 
60  const bool isNegativePeaks = IsNegativePeaksInProfile(approxOffset);
61 
62  bool isOverdrive; // disable this test if set in cfg
63  if (!isZeroFilter)
64  isOverdrive = false;
65  else
66  isOverdrive = IsOverdrive(approxOffset);
67 
68  bool result = (negativity > -1000.) && // < 1000. = distorted profile
69  (isPeaks) && // want to see a peak (zero filter)
70  !(isNegativePeaks) && // no negative peaks
71  !(isOverdrive); // no overdrive
72 
73  return (result);
74 }
bool IsNegativePeaksInProfile(int)
LASModuleProfile profile
bool IsPeaksInProfile(int)
double GetNegativity(int)

◆ SetOverdriveThreshold()

void LASProfileJudge::SetOverdriveThreshold ( unsigned int  aThreshold)

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

Definition at line 90 of file LASProfileJudge.cc.

References overdriveThreshold.

Referenced by LaserAlignment::LaserAlignment().

90 { overdriveThreshold = aThreshold; }
unsigned int overdriveThreshold

Member Data Documentation

◆ isZeroFilter

bool LASProfileJudge::isZeroFilter
private

Definition at line 30 of file LASProfileJudge.h.

Referenced by EnableZeroFilter(), JudgeProfile(), and LASProfileJudge().

◆ overdriveThreshold

unsigned int LASProfileJudge::overdriveThreshold
private

Definition at line 31 of file LASProfileJudge.h.

Referenced by IsOverdrive(), and SetOverdriveThreshold().

◆ profile

LASModuleProfile LASProfileJudge::profile
private

◆ thePeak

std::pair<unsigned int, double> LASProfileJudge::thePeak
private

Definition at line 29 of file LASProfileJudge.h.

Referenced by IsNegativePeaksInProfile(), and IsPeaksInProfile().