CMS 3D CMS Logo

TkDetMapESProducer.cc
Go to the documentation of this file.
5 
7 
9 class TrackerTopology;
10 
12 
14 public:
16  ~TkDetMapESProducer() override {}
17 
18  std::unique_ptr<TkDetMap> produce(const TrackerTopologyRcd&);
19 
20 private:
23 };
24 
26  auto cc = setWhatProduced(this);
27  tTopoToken_ = cc.consumes();
28  geomDetToken_ = cc.consumes();
29 }
30 
31 namespace {
32  TkLayerMap makeTkLayerMap(int layer, const TrackerTopology* tTopo, const std::vector<uint32_t> tkDetIdList) {
33  LogTrace("TkLayerMap") << " TkLayerMap::constructor for layer " << layer;
34  uint32_t nStringExt, nRod;
35  std::vector<uint32_t> SingleExtString;
36  switch (layer) {
37  case TkLayerMap::TIB_L1: //TIBL1
38  nStringExt = 30;
39  SingleExtString.insert(SingleExtString.begin(), 8, 0);
40  SingleExtString.insert(SingleExtString.begin() + 8, 7, 1);
41  SingleExtString.insert(SingleExtString.begin() + 15, 8, 2);
42  SingleExtString.insert(SingleExtString.begin() + 23, 7, 3);
43  return TkLayerMap(layer,
44  12,
45  -6.,
46  6.,
47  2 * (nStringExt + 1),
48  -1. * (nStringExt + 1.),
49  (nStringExt + 1),
50  tTopo,
51  tkDetIdList,
52  SingleExtString,
53  {},
54  {},
55  {},
56  nStringExt);
57  break;
58  case TkLayerMap::TIB_L2:
59  nStringExt = 38;
60  SingleExtString.insert(SingleExtString.begin(), 10, 0);
61  SingleExtString.insert(SingleExtString.begin() + 10, 9, 1);
62  SingleExtString.insert(SingleExtString.begin() + 19, 10, 2);
63  SingleExtString.insert(SingleExtString.begin() + 29, 9, 3);
64  return TkLayerMap(layer,
65  12,
66  -6.,
67  6.,
68  2 * (nStringExt + 1),
69  -1. * (nStringExt + 1.),
70  (nStringExt + 1),
71  tTopo,
72  tkDetIdList,
73  SingleExtString,
74  {},
75  {},
76  {},
77  nStringExt);
78  break;
79  case TkLayerMap::TIB_L3:
80  nStringExt = 46;
81  SingleExtString.insert(SingleExtString.begin(), 23, 0);
82  SingleExtString.insert(SingleExtString.begin() + 23, 23, 1);
83  return TkLayerMap(
84  layer, 12, -6., 6., nStringExt, 0, nStringExt, tTopo, tkDetIdList, SingleExtString, {}, {}, {}, nStringExt);
85  break;
86  case TkLayerMap::TIB_L4:
87  nStringExt = 56;
88  SingleExtString.insert(SingleExtString.begin(), 14, 0);
89  SingleExtString.insert(SingleExtString.begin() + 14, 14, 1);
90  SingleExtString.insert(SingleExtString.begin() + 28, 14, 2);
91  SingleExtString.insert(SingleExtString.begin() + 42, 14, 3);
92  return TkLayerMap(
93  layer, 12, -6., 6., nStringExt, 0, nStringExt, tTopo, tkDetIdList, SingleExtString, {}, {}, {}, nStringExt);
94  break;
95  case TkLayerMap::TIDM_D1: //TID
96  case TkLayerMap::TIDM_D2: //TID
97  case TkLayerMap::TIDM_D3: //TID
98  return TkLayerMap(layer, 7, -7., 0., 40, 0., 40., tTopo, tkDetIdList, {});
99  break;
100  case TkLayerMap::TIDP_D1: //TID
101  case TkLayerMap::TIDP_D2: //TID
102  case TkLayerMap::TIDP_D3: //TID
103  return TkLayerMap(layer, 7, 0., 7., 40, 0., 40., tTopo, tkDetIdList, {});
104  break;
105  case TkLayerMap::TOB_L1: //TOBL1
106  nRod = 42;
107  return TkLayerMap(layer,
108  12,
109  -6.,
110  6.,
111  2 * (nRod + 1),
112  -1. * (nRod + 1.),
113  (nRod + 1.),
114  tTopo,
115  tkDetIdList,
116  {},
117  {},
118  {},
119  {},
120  0,
121  nRod);
122  break;
123  case TkLayerMap::TOB_L2:
124  nRod = 48;
125  return TkLayerMap(layer,
126  12,
127  -6.,
128  6.,
129  2 * (nRod + 1),
130  -1. * (nRod + 1.),
131  (nRod + 1.),
132  tTopo,
133  tkDetIdList,
134  {},
135  {},
136  {},
137  {},
138  0,
139  nRod);
140  break;
141  case TkLayerMap::TOB_L3: //TOBL3
142  nRod = 54;
143  return TkLayerMap(layer, 12, -6., 6., nRod, 0., 1. * nRod, tTopo, tkDetIdList, {}, {}, {}, {}, 0, nRod);
144  break;
145  case TkLayerMap::TOB_L4:
146  nRod = 60;
147  return TkLayerMap(layer, 12, -6., 6., nRod, 0., 1. * nRod, tTopo, tkDetIdList, {}, {}, {}, {}, 0, nRod);
148  break;
149  case TkLayerMap::TOB_L5:
150  nRod = 66;
151  return TkLayerMap(layer, 12, -6., 6., nRod, 0., 1. * nRod, tTopo, tkDetIdList, {}, {}, {}, {}, 0, nRod);
152  break;
153  case TkLayerMap::TOB_L6:
154  nRod = 74;
155  return TkLayerMap(layer, 12, -6., 6., nRod, 0., 1. * nRod, tTopo, tkDetIdList, {}, {}, {}, {}, 0, nRod);
156  break;
157  default: //TEC
158  std::vector<uint32_t> modulesInRingFront = {0, 2, 2, 3, 4, 2, 4, 5};
159  std::vector<uint32_t> modulesInRingBack = {0, 1, 1, 2, 3, 3, 3, 5};
160  switch (layer) {
161  case TkLayerMap::TECM_W1:
162  case TkLayerMap::TECM_W2:
163  case TkLayerMap::TECM_W3:
164  return TkLayerMap(layer,
165  16,
166  -16.,
167  0.,
168  80,
169  0.,
170  80.,
171  tTopo,
172  tkDetIdList,
173  {},
174  modulesInRingFront,
175  modulesInRingBack,
176  {0, 1, 4, 7, 9, 11, 14, 16});
177  break;
178  case TkLayerMap::TECM_W4:
179  case TkLayerMap::TECM_W5:
180  case TkLayerMap::TECM_W6:
181  return TkLayerMap(layer,
182  13,
183  -16.,
184  -3.,
185  80,
186  0.,
187  80.,
188  tTopo,
189  tkDetIdList,
190  {},
191  modulesInRingFront,
192  modulesInRingBack,
193  {0, 0, 1, 4, 6, 8, 11, 13});
194  break;
195  case TkLayerMap::TECM_W7:
196  case TkLayerMap::TECM_W8:
197  return TkLayerMap(layer,
198  10,
199  -16.,
200  -6.,
201  80,
202  0.,
203  80.,
204  tTopo,
205  tkDetIdList,
206  {},
207  modulesInRingFront,
208  modulesInRingBack,
209  {0, 0, 0, 1, 3, 5, 8, 10});
210  break;
211  case TkLayerMap::TECM_W9:
212  return TkLayerMap(layer,
213  8,
214  -16.,
215  -8.,
216  80,
217  0.,
218  80.,
219  tTopo,
220  tkDetIdList,
221  {},
222  modulesInRingFront,
223  modulesInRingBack,
224  {0, 0, 0, 0, 1, 3, 6, 8});
225  break;
226  case TkLayerMap::TECP_W1:
227  case TkLayerMap::TECP_W2:
228  case TkLayerMap::TECP_W3:
229  return TkLayerMap(layer,
230  16,
231  0.,
232  16.,
233  80,
234  0.,
235  80.,
236  tTopo,
237  tkDetIdList,
238  {},
239  modulesInRingFront,
240  modulesInRingBack,
241  {0, 1, 4, 7, 9, 11, 14, 16});
242  break;
243  case TkLayerMap::TECP_W4:
244  case TkLayerMap::TECP_W5:
245  case TkLayerMap::TECP_W6:
246  return TkLayerMap(layer,
247  13,
248  3.,
249  16.,
250  80,
251  0.,
252  80.,
253  tTopo,
254  tkDetIdList,
255  {},
256  modulesInRingFront,
257  modulesInRingBack,
258  {0, 0, 1, 4, 6, 8, 11, 13});
259  break;
260  case TkLayerMap::TECP_W7:
261  case TkLayerMap::TECP_W8:
262  return TkLayerMap(layer,
263  10,
264  6.,
265  16.,
266  80,
267  0.,
268  80.,
269  tTopo,
270  tkDetIdList,
271  {},
272  modulesInRingFront,
273  modulesInRingBack,
274  {0, 0, 0, 1, 3, 5, 8, 10});
275  break;
276  case TkLayerMap::TECP_W9:
277  return TkLayerMap(layer,
278  8,
279  8.,
280  16.,
281  80,
282  0.,
283  80.,
284  tTopo,
285  tkDetIdList,
286  {},
287  modulesInRingFront,
288  modulesInRingBack,
289  {0, 0, 0, 0, 1, 3, 6, 8});
290  }
291  }
292  return TkLayerMap{};
293  }
294 } // namespace
295 
296 std::unique_ptr<TkDetMap> TkDetMapESProducer::produce(const TrackerTopologyRcd& tTopoRcd) {
297  const auto& geomDet = tTopoRcd.getRecord<IdealGeometryRecord>().get(geomDetToken_);
298  const auto TkDetIdList = TrackerGeometryUtils::getSiStripDetIds(geomDet);
299 
300  const auto& tTopo = tTopoRcd.get(tTopoToken_);
301  auto tkDetMap = std::make_unique<TkDetMap>(&tTopo);
302 
303  LogTrace("TkDetMap") << "TkDetMap::constructor ";
304  //Create TkLayerMap for each layer declared in the TkLayerEnum
305  for (int layer = 1; layer < TkLayerMap::NUMLAYERS; ++layer) {
306  tkDetMap->setLayerMap(layer, makeTkLayerMap(layer, &tTopo, TkDetIdList));
307  }
308 
309  return tkDetMap;
310 }
311 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
TkDetMapESProducer(const edm::ParameterSet &)
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Definition: utils.cc:5
edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
std::unique_ptr< TkDetMap > produce(const TrackerTopologyRcd &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
~TkDetMapESProducer() override