Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-22 04:02:46

0001 #include "CondFormats/GeometryObjects/interface/PTrackerAdditionalParametersPerDet.h"
0002 #include <iostream>
0003 
0004 namespace {
0005   template <typename T>
0006   const T getThisParam(const std::vector<std::vector<T>>& params, size_t index_outer, size_t index_inner) {
0007     if (index_outer >= params.size())
0008       throw std::out_of_range("Parameter with index " + std::to_string(index_outer) + " is out of range.");
0009     if (index_inner >= params[index_outer].size())
0010       throw std::out_of_range("Parameter with index " + std::to_string(index_inner) + " is out of range.");
0011     return params[index_outer][index_inner];
0012   }
0013 
0014   template <typename T>
0015   void setThisParam(std::vector<std::vector<T>>& params, size_t index_outer, const T& value) {
0016     if (index_outer >= params.size())
0017       throw std::out_of_range("Parameter with index " + std::to_string(index_outer) + " is out of range.");
0018     params[index_outer].push_back(value);
0019   }
0020 
0021   template <typename T>
0022   const std::vector<T>& getAllParams(const std::vector<std::vector<T>>& params, size_t index_outer) {
0023     if (index_outer >= params.size())
0024       throw std::out_of_range("Parameter with index " + std::to_string(index_outer) + " is out of range.");
0025     return params[index_outer];
0026   }
0027 
0028 }  // namespace
0029 int PTrackerAdditionalParametersPerDet::getGeographicalId(int theIndex) const {
0030   return getThisParam(intParams_, GEOGRAPHICAL_ID, theIndex);
0031 }
0032 
0033 std::vector<int> PTrackerAdditionalParametersPerDet::getAllGeographicalIds() const {
0034   return getAllParams(intParams_, GEOGRAPHICAL_ID);
0035 }
0036 
0037 void PTrackerAdditionalParametersPerDet::setGeographicalId(int geographicalId) {
0038   setThisParam(intParams_, GEOGRAPHICAL_ID, geographicalId);
0039 }
0040 //
0041 int PTrackerAdditionalParametersPerDet::bigPixelsX(int theIndex) const {
0042   return getThisParam(intParams_, BIGPIXELS_X, theIndex);
0043 }
0044 
0045 std::vector<int> PTrackerAdditionalParametersPerDet::allBigPixelsXs() const {
0046   return getAllParams(intParams_, BIGPIXELS_X);
0047 }
0048 
0049 void PTrackerAdditionalParametersPerDet::setBigPixelsX(int bigpixelsX) {
0050   setThisParam(intParams_, BIGPIXELS_X, bigpixelsX);
0051 }
0052 //
0053 int PTrackerAdditionalParametersPerDet::bigPixelsY(int theIndex) const {
0054   return getThisParam(intParams_, BIGPIXELS_Y, theIndex);
0055 }
0056 
0057 std::vector<int> PTrackerAdditionalParametersPerDet::allBigPixelsYs() const {
0058   return getAllParams(intParams_, BIGPIXELS_Y);
0059 }
0060 
0061 void PTrackerAdditionalParametersPerDet::setBigPixelsY(int bigpixelsY) {
0062   setThisParam(intParams_, BIGPIXELS_Y, bigpixelsY);
0063 }
0064 //
0065 float PTrackerAdditionalParametersPerDet::bigPixelsPitchX(int theIndex) const {
0066   return getThisParam(floatParams_, BIGPIXELS_PITCH_X, theIndex);
0067 }
0068 
0069 std::vector<float> PTrackerAdditionalParametersPerDet::allBigPixelsPitchXs() const {
0070   return getAllParams(floatParams_, BIGPIXELS_PITCH_X);
0071 }
0072 
0073 void PTrackerAdditionalParametersPerDet::setBigPixelsPitchX(float bigpixelspitchX) {
0074   setThisParam(floatParams_, BIGPIXELS_PITCH_X, bigpixelspitchX);
0075 }
0076 //
0077 float PTrackerAdditionalParametersPerDet::bigPixelsPitchY(int theIndex) const {
0078   return getThisParam(floatParams_, BIGPIXELS_PITCH_Y, theIndex);
0079 }
0080 
0081 std::vector<float> PTrackerAdditionalParametersPerDet::allBigPixelsPitchYs() const {
0082   return getAllParams(floatParams_, BIGPIXELS_PITCH_Y);
0083 }
0084 
0085 void PTrackerAdditionalParametersPerDet::setBigPixelsPitchY(float bigpixelspitchY) {
0086   setThisParam(floatParams_, BIGPIXELS_PITCH_Y, bigpixelspitchY);
0087 }
0088 
0089 //
0090 
0091 //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.