CMS 3D CMS Logo

SiStripFakeAPVParameters.h
Go to the documentation of this file.
5 
10 public:
11  using index = std::pair<int,int>;
12 
14 
17  {
18  const int layersTIB = 4;
19  const int ringsTID = 3;
20  const int layersTOB = 6;
21  const int ringsTEC = 7;
22 
23  fillSubDetParameter(pset.getParameter<std::vector<double>>(parameterName+"TIB"), int(StripSubdetector::TIB), layersTIB );
24  fillSubDetParameter(pset.getParameter<std::vector<double>>(parameterName+"TID"), int(StripSubdetector::TID), ringsTID );
25  fillSubDetParameter(pset.getParameter<std::vector<double>>(parameterName+"TOB"), int(StripSubdetector::TOB), layersTOB );
26  fillSubDetParameter(pset.getParameter<std::vector<double>>(parameterName+"TEC"), int(StripSubdetector::TEC), ringsTEC );
27  }
28 
29  inline double get(const index& idx) const
30  {
31  return m_data.at(idx.first)[idx.second];
32  }
33 
34  static index getIndex(const TrackerTopology* tTopo, DetId id)
35  {
36  int layerId{0};
37  const int subId = StripSubdetector(id).subdetId();
38  switch(subId) {
40  layerId = tTopo->tibLayer(id) - 1;
41  break;
43  layerId = tTopo->tobLayer(id) - 1;
44  break;
46  layerId = tTopo->tidRing(id) - 1;
47  break;
49  layerId = tTopo->tecRing(id) - 1;
50  break;
51  default:
52  break;
53  }
54  return std::make_pair(subId, layerId);
55  }
56 private:
57  using LayerParameters = std::vector<double>;
58  using SubdetParameters = std::map<int,LayerParameters>;
60 
68  void fillSubDetParameter(const std::vector<double>& v, const int subDet, const unsigned short layers)
69  {
70  if( v.size() == layers ) {
71  m_data.insert(std::make_pair( subDet, v ));
72  }
73  else if( v.size() == 1 ) {
74  LayerParameters parV(layers, v[0]);
75  m_data.insert(std::make_pair( subDet, parV ));
76  }
77  else {
78  throw cms::Exception("Configuration") << "ERROR: number of parameters for subDet " << subDet << " are " << v.size() << ". They must be either 1 or " << layers << std::endl;
79  }
80  }
81 };
T getParameter(std::string const &) const
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
std::vector< double > LayerParameters
static index getIndex(const TrackerTopology *tTopo, DetId id)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Definition: DetId.h:18
void fillSubDetParameter(const std::vector< double > &v, const int subDet, const unsigned short layers)
SiStripFakeAPVParameters(const edm::ParameterSet &pset, const std::string &parameterName)
Fills the parameters read from cfg and matching the name in the map.
std::map< int, LayerParameters > SubdetParameters
unsigned int tobLayer(const DetId &id) const