CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 28 of file PixelDigitizerAlgorithm.h.

Constructor & Destructor Documentation

◆ TimewalkModel()

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

Definition at line 211 of file PixelDigitizerAlgorithm.cc.

References muonDTDigis_cfi::pset.

211  {
212  threshold_values = pset.getParameter<std::vector<double>>("ThresholdValues");
213  const auto& curve_psetvec = pset.getParameter<std::vector<edm::ParameterSet>>("Curves");
214  if (threshold_values.size() != curve_psetvec.size())
215  throw cms::Exception("Configuration")
216  << "Timewalk model error: the number of threshold values does not match the number of curves.";
217  for (const auto& curve_pset : curve_psetvec)
218  curves.emplace_back(curve_pset);
219 }

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 226 of file PixelDigitizerAlgorithm.cc.

References pv::closest(), HLT_2024v14_cff::distance, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, and relativeConstraints::value.

227  {
228  auto it = std::lower_bound(vec.begin(), vec.end(), value);
229  if (it == vec.begin())
230  return 0;
231  else if (it == vec.end())
232  return vec.size() - 1;
233  else {
234  auto it_upper = it;
235  auto it_lower = --it;
236  auto closest = (value - *it_lower > *it_upper - value) ? it_upper : it_lower;
237  return std::distance(vec.begin(), closest);
238  }
239 }
int closest(std::vector< int > const &vec, int value)
Definition: value.py:1

◆ operator()()

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

Definition at line 221 of file PixelDigitizerAlgorithm.cc.

221  {
222  auto index = find_closest_index(threshold_values, q_threshold);
223  return curves[index](q_in);
224 }
std::size_t find_closest_index(const std::vector< double > &vec, double value) const

Member Data Documentation

◆ curves

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

Definition at line 39 of file PixelDigitizerAlgorithm.h.

◆ threshold_values

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

Definition at line 38 of file PixelDigitizerAlgorithm.h.