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
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.
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
PTrackerAdditionalParametersPerDet::getGeographicalId
int getGeographicalId(int theIndex) const
Definition: PTrackerAdditionalParametersPerDet.cc:30
PTrackerAdditionalParametersPerDet::intParams_
std::vector< std::vector< int > > intParams_
Definition: PTrackerAdditionalParametersPerDet.h:30
PTrackerAdditionalParametersPerDet::GEOGRAPHICAL_ID
Definition: PTrackerAdditionalParametersPerDet.h:18
PTrackerAdditionalParametersPerDet::setGeographicalId
void setGeographicalId(int geographicalId)
Definition: PTrackerAdditionalParametersPerDet.cc:46
PTrackerAdditionalParametersPerDet::getAllBricked
std::vector< bool > getAllBricked() const
Definition: PTrackerAdditionalParametersPerDet.cc:42
value
Definition: value.py:1
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
PTrackerAdditionalParametersPerDet::getAllGeographicalIds
std::vector< int > getAllGeographicalIds() const
Definition: PTrackerAdditionalParametersPerDet.cc:34
PTrackerAdditionalParametersPerDet::setBricked
void setBricked(bool isBricked)
Definition: PTrackerAdditionalParametersPerDet.cc:50
PTrackerAdditionalParametersPerDet.h
T
long double T
Definition: Basic3DVectorLD.h:48
PTrackerAdditionalParametersPerDet::BRICKEDNESS
Definition: PTrackerAdditionalParametersPerDet.h:19
PTrackerAdditionalParametersPerDet::boolParams_
std::vector< std::vector< bool > > boolParams_
Definition: PTrackerAdditionalParametersPerDet.h:31
PTrackerAdditionalParametersPerDet::getBricked
bool getBricked(int theIndex) const
Definition: PTrackerAdditionalParametersPerDet.cc:38
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443