CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PixelDigitizerAlgorithm::TimewalkModel Class Reference

Public Member Functions

double operator() (double q_in, double q_threshold) const
 
 TimewalkModel (const edm::ParameterSet &pset)
 

Private Member Functions

std::size_t find_closest_index (const std::vector< double > &vec, double value) const
 

Private Attributes

std::vector< TimewalkCurvecurves
 
std::vector< double > threshold_values
 

Detailed Description

Definition at line 23 of file PixelDigitizerAlgorithm.h.

Constructor & Destructor Documentation

◆ TimewalkModel()

PixelDigitizerAlgorithm::TimewalkModel::TimewalkModel ( const edm::ParameterSet pset)

Definition at line 198 of file PixelDigitizerAlgorithm.cc.

198  {
199  threshold_values = pset.getParameter<std::vector<double>>("ThresholdValues");
200  const auto& curve_psetvec = pset.getParameter<std::vector<edm::ParameterSet>>("Curves");
201  if (threshold_values.size() != curve_psetvec.size())
202  throw cms::Exception("Configuration")
203  << "Timewalk model error: the number of threshold values does not match the number of curves.";
204  for (const auto& curve_pset : curve_psetvec)
205  curves.emplace_back(curve_pset);
206 }

References muonDTDigis_cfi::pset.

Member Function Documentation

◆ find_closest_index()

std::size_t PixelDigitizerAlgorithm::TimewalkModel::find_closest_index ( const std::vector< double > &  vec,
double  value 
) const
private

Definition at line 213 of file PixelDigitizerAlgorithm.cc.

214  {
215  auto it = std::lower_bound(vec.begin(), vec.end(), value);
216  if (it == vec.begin())
217  return 0;
218  else if (it == vec.end())
219  return vec.size() - 1;
220  else {
221  auto it_upper = it;
222  auto it_lower = --it;
223  auto closest = (value - *it_lower > *it_upper - value) ? it_upper : it_lower;
224  return std::distance(vec.begin(), closest);
225  }
226 }

References HLT_FULL_cff::distance, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, and relativeConstraints::value.

◆ operator()()

double PixelDigitizerAlgorithm::TimewalkModel::operator() ( double  q_in,
double  q_threshold 
) const

Definition at line 208 of file PixelDigitizerAlgorithm.cc.

208  {
209  auto index = find_closest_index(threshold_values, q_threshold);
210  return curves[index](q_in);
211 }

Member Data Documentation

◆ curves

std::vector<TimewalkCurve> PixelDigitizerAlgorithm::TimewalkModel::curves
private

Definition at line 34 of file PixelDigitizerAlgorithm.h.

◆ threshold_values

std::vector<double> PixelDigitizerAlgorithm::TimewalkModel::threshold_values
private

Definition at line 33 of file PixelDigitizerAlgorithm.h.

PixelDigitizerAlgorithm::TimewalkModel::threshold_values
std::vector< double > threshold_values
Definition: PixelDigitizerAlgorithm.h:33
PixelDigitizerAlgorithm::TimewalkModel::find_closest_index
std::size_t find_closest_index(const std::vector< double > &vec, double value) const
Definition: PixelDigitizerAlgorithm.cc:213
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
PixelDigitizerAlgorithm::TimewalkModel::curves
std::vector< TimewalkCurve > curves
Definition: PixelDigitizerAlgorithm.h:34
value
Definition: value.py:1
relativeConstraints.value
value
Definition: relativeConstraints.py:53
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
cms::Exception
Definition: Exception.h:70
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27