CMS 3D CMS Logo

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
30  return getThisParam(intParams_, GEOGRAPHICAL_ID, theIndex);
31 }
32 
34  return getAllParams(intParams_, GEOGRAPHICAL_ID);
35 }
36 
38  setThisParam(intParams_, GEOGRAPHICAL_ID, geographicalId);
39 }
40 //
42  return getThisParam(intParams_, BIGPIXELS_X, theIndex);
43 }
44 
46  return getAllParams(intParams_, BIGPIXELS_X);
47 }
48 
50  setThisParam(intParams_, BIGPIXELS_X, bigpixelsX);
51 }
52 //
54  return getThisParam(intParams_, BIGPIXELS_Y, theIndex);
55 }
56 
58  return getAllParams(intParams_, BIGPIXELS_Y);
59 }
60 
62  setThisParam(intParams_, BIGPIXELS_Y, bigpixelsY);
63 }
64 //
66  return getThisParam(floatParams_, BIGPIXELS_PITCH_X, theIndex);
67 }
68 
70  return getAllParams(floatParams_, BIGPIXELS_PITCH_X);
71 }
72 
74  setThisParam(floatParams_, BIGPIXELS_PITCH_X, bigpixelspitchX);
75 }
76 //
78  return getThisParam(floatParams_, BIGPIXELS_PITCH_Y, theIndex);
79 }
80 
82  return getAllParams(floatParams_, BIGPIXELS_PITCH_Y);
83 }
84 
86  setThisParam(floatParams_, BIGPIXELS_PITCH_Y, bigpixelspitchY);
87 }
88 
89 //
90 
91 //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.
size
Write out results.
static std::string to_string(const XMLCh *ch)
Definition: value.py:1
long double T
std::vector< std::vector< float > > floatParams_