CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PTrackerAdditionalParametersPerDet.cc
Go to the documentation of this file.
2 #include <iostream>
3 
4 namespace {
5  template <typename T>
6  const T getThisParam(const std::vector<std::vector<T>>& params, size_t index_outer, size_t index_inner) {
7  if (index_outer >= params.size())
8  throw std::out_of_range("Parameter with index " + std::to_string(index_outer) + " is out of range.");
9  if (index_inner >= params[index_outer].size())
10  throw std::out_of_range("Parameter with index " + std::to_string(index_inner) + " is out of range.");
11  return params[index_outer][index_inner];
12  }
13 
14  template <typename T>
15  void setThisParam(std::vector<std::vector<T>>& params, size_t index_outer, const T& value) {
16  if (index_outer >= params.size())
17  throw std::out_of_range("Parameter with index " + std::to_string(index_outer) + " is out of range.");
18  params[index_outer].push_back(value);
19  }
20 
21  template <typename T>
22  const std::vector<T>& getAllParams(const std::vector<std::vector<T>>& params, size_t index_outer) {
23  if (index_outer >= params.size())
24  throw std::out_of_range("Parameter with index " + std::to_string(index_outer) + " is out of range.");
25  return params[index_outer];
26  }
27 
28 } // namespace
29 
31  return getThisParam(intParams_, GEOGRAPHICAL_ID, theIndex);
32 }
33 
35  return getAllParams(intParams_, GEOGRAPHICAL_ID);
36 }
37 
39  return getThisParam(boolParams_, BRICKEDNESS, theIndex);
40 }
41 
43  return getAllParams(boolParams_, BRICKEDNESS);
44 }
45 
47  setThisParam(intParams_, GEOGRAPHICAL_ID, geographicalId);
48 }
49 
51  setThisParam(boolParams_, BRICKEDNESS, isBricked);
52 }
53 //This doesn't work properly because intParams_ and boolParams_ are vectors of vecotrs - the outer vector should be the number of parameters and the inner vector the number of geometricDets.
std::string to_string(const V &value)
Definition: OMSAccess.h:71
theIndex(0)
std::vector< std::vector< bool > > boolParams_
long double T
tuple size
Write out results.