CMS 3D CMS Logo

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