CMS 3D CMS Logo

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