CMS 3D CMS Logo

FWRecoGeometryESProducer.cc
Go to the documentation of this file.
1 #include <fstream>
2 #include <streambuf>
3 
8 
38 
39 #include "TNamed.h"
41 
43  const GeomDet* detUnit,
44  FWRecoGeometry& fwRecoGeometry) {
45  const PixelGeomDetUnit* det = dynamic_cast<const PixelGeomDetUnit*>(detUnit);
46  if (det) {
47  const PixelTopology* topo = &det->specificTopology();
48 
49  std::pair<float, float> pitch = topo->pitch();
50  fwRecoGeometry.idToName[rawid].topology[0] = pitch.first;
51  fwRecoGeometry.idToName[rawid].topology[1] = pitch.second;
52 
53  fwRecoGeometry.idToName[rawid].topology[2] = topo->localX(0.f); // offsetX
54  fwRecoGeometry.idToName[rawid].topology[3] = topo->localY(0.f); // offsetY
55 
56  // big pixels layout
57  fwRecoGeometry.idToName[rawid].topology[4] = topo->isItBigPixelInX(80) ? 0 : 1;
58  }
59 }
60 
63 
64 #define ADD_SISTRIP_TOPOLOGY(rawid, detUnit) \
65  const StripGeomDetUnit* det = dynamic_cast<const StripGeomDetUnit*>(detUnit); \
66  if (det) { \
67  if (const StripTopology* topo = dynamic_cast<const StripTopology*>(&det->specificTopology())) { \
68  fwRecoGeometry.idToName[rawid].topology[0] = 0; \
69  fwRecoGeometry.idToName[rawid].topology[1] = topo->nstrips(); \
70  fwRecoGeometry.idToName[rawid].topology[2] = topo->stripLength(); \
71  } \
72  if (const RadialStripTopology* rtop = \
73  dynamic_cast<const RadialStripTopology*>(&(det->specificType().specificTopology()))) { \
74  fwRecoGeometry.idToName[rawid].topology[0] = 1; \
75  fwRecoGeometry.idToName[rawid].topology[3] = rtop->yAxisOrientation(); \
76  fwRecoGeometry.idToName[rawid].topology[4] = rtop->originToIntersection(); \
77  fwRecoGeometry.idToName[rawid].topology[5] = rtop->phiOfOneEdge(); \
78  fwRecoGeometry.idToName[rawid].topology[6] = rtop->angularWidth(); \
79  } else if (const RectangularStripTopology* topo = \
80  dynamic_cast<const RectangularStripTopology*>(&(det->specificType().specificTopology()))) { \
81  fwRecoGeometry.idToName[rawid].topology[0] = 2; \
82  fwRecoGeometry.idToName[rawid].topology[3] = topo->pitch(); \
83  } else if (const TrapezoidalStripTopology* topo = \
84  dynamic_cast<const TrapezoidalStripTopology*>(&(det->specificType().specificTopology()))) { \
85  fwRecoGeometry.idToName[rawid].topology[0] = 3; \
86  fwRecoGeometry.idToName[rawid].topology[3] = topo->pitch(); \
87  } \
88  } else { \
89  const Phase2TrackerGeomDetUnit* det = dynamic_cast<const Phase2TrackerGeomDetUnit*>(detUnit); \
90  if (det) { \
91  if (const Phase2TrackerTopology* topo = \
92  dynamic_cast<const Phase2TrackerTopology*>(&(det->specificTopology()))) { \
93  fwRecoGeometry.idToName[rawid].topology[0] = topo->pitch().first; \
94  fwRecoGeometry.idToName[rawid].topology[1] = topo->pitch().second; \
95  } \
96  } \
97  }
98 
99 namespace {
100  const std::array<std::string, 3> hgcal_geom_names = {
101  {"HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive"}};
102 }
103 
105  m_tracker = pset.getUntrackedParameter<bool>("Tracker", true);
106  m_muon = pset.getUntrackedParameter<bool>("Muon", true);
107  m_gem = pset.getUntrackedParameter<bool>("GEM", false);
108  m_calo = pset.getUntrackedParameter<bool>("Calo", true);
109  m_timing = pset.getUntrackedParameter<bool>("Timing", false);
110  auto cc = setWhatProduced(this);
111 
112  if (m_muon)
113  m_gem = true;
114  if (m_tracker or m_muon or m_gem) {
115  m_trackingGeomToken = cc.consumes();
116  }
117  if (m_timing) {
118  m_ftlBarrelGeomToken = cc.consumes(edm::ESInputTag{"", "FastTimeBarrel"});
119  m_ftlEndcapGeomToken = cc.consumes(edm::ESInputTag{"", "SFBX"});
120  }
121  if (m_calo) {
122  m_caloGeomToken = cc.consumes();
123  }
124 }
125 
127 
128 std::unique_ptr<FWRecoGeometry> FWRecoGeometryESProducer::produce(const FWRecoGeometryRecord& record) {
129  using namespace edm;
130 
131  auto fwRecoGeometry = std::make_unique<FWRecoGeometry>();
132 
133  if (m_tracker || m_muon || m_gem) {
135  }
136 
137  if (m_tracker) {
138  DetId detId(DetId::Tracker, 0);
139  m_trackerGeom = static_cast<const TrackerGeometry*>(m_trackingGeom->slaveGeometry(detId));
140  addPixelBarrelGeometry(*fwRecoGeometry);
141  addPixelForwardGeometry(*fwRecoGeometry);
142  addTIBGeometry(*fwRecoGeometry);
143  addTIDGeometry(*fwRecoGeometry);
144  addTOBGeometry(*fwRecoGeometry);
145  addTECGeometry(*fwRecoGeometry);
146  writeTrackerParametersXML(*fwRecoGeometry);
147  }
148  if (m_muon) {
149  addDTGeometry(*fwRecoGeometry);
150  addCSCGeometry(*fwRecoGeometry);
151  addRPCGeometry(*fwRecoGeometry);
152  addME0Geometry(*fwRecoGeometry);
153  }
154  if (m_gem) {
155  addGEMGeometry(*fwRecoGeometry);
156  }
157  if (m_calo) {
159  addCaloGeometry(*fwRecoGeometry);
160  }
161 
162  if (m_timing) {
165  addFTLGeometry(*fwRecoGeometry);
166  }
167 
168  fwRecoGeometry->idToName.resize(m_current + 1);
169  std::vector<FWRecoGeom::Info>(fwRecoGeometry->idToName).swap(fwRecoGeometry->idToName);
170  std::sort(fwRecoGeometry->idToName.begin(), fwRecoGeometry->idToName.end());
171 
172  return fwRecoGeometry;
173 }
174 
176  DetId detId(DetId::Muon, 2);
177  const CSCGeometry* cscGeometry = static_cast<const CSCGeometry*>(m_trackingGeom->slaveGeometry(detId));
178  for (auto it = cscGeometry->chambers().begin(), end = cscGeometry->chambers().end(); it != end; ++it) {
179  const CSCChamber* chamber = *it;
180 
181  if (chamber) {
182  unsigned int rawid = chamber->geographicalId();
183  unsigned int current = insert_id(rawid, fwRecoGeometry);
184  fillShapeAndPlacement(current, chamber, fwRecoGeometry);
185  //
186  // CSC layers geometry
187  //
188  for (std::vector<const CSCLayer*>::const_iterator lit = chamber->layers().begin(), lend = chamber->layers().end();
189  lit != lend;
190  ++lit) {
191  const CSCLayer* layer = *lit;
192 
193  if (layer) {
194  unsigned int rawid = layer->geographicalId();
195  unsigned int current = insert_id(rawid, fwRecoGeometry);
196  fillShapeAndPlacement(current, layer, fwRecoGeometry);
197 
198  const CSCStripTopology* stripTopology = layer->geometry()->topology();
199  fwRecoGeometry.idToName[current].topology[0] = stripTopology->yAxisOrientation();
200  fwRecoGeometry.idToName[current].topology[1] = stripTopology->centreToIntersection();
201  fwRecoGeometry.idToName[current].topology[2] = stripTopology->yCentreOfStripPlane();
202  fwRecoGeometry.idToName[current].topology[3] = stripTopology->phiOfOneEdge();
203  fwRecoGeometry.idToName[current].topology[4] = stripTopology->stripOffset();
204  fwRecoGeometry.idToName[current].topology[5] = stripTopology->angularWidth();
205 
206  const CSCWireTopology* wireTopology = layer->geometry()->wireTopology();
207  fwRecoGeometry.idToName[current].topology[6] = wireTopology->wireSpacing();
208  fwRecoGeometry.idToName[current].topology[7] = wireTopology->wireAngle();
209  }
210  }
211  }
212  }
213 }
214 
216  DetId detId(DetId::Muon, 1);
217  const DTGeometry* dtGeometry = static_cast<const DTGeometry*>(m_trackingGeom->slaveGeometry(detId));
218 
219  //
220  // DT chambers geometry
221  //
222  for (auto it = dtGeometry->chambers().begin(), end = dtGeometry->chambers().end(); it != end; ++it) {
223  const DTChamber* chamber = *it;
224 
225  if (chamber) {
226  unsigned int rawid = chamber->geographicalId().rawId();
227  unsigned int current = insert_id(rawid, fwRecoGeometry);
228  fillShapeAndPlacement(current, chamber, fwRecoGeometry);
229  }
230  }
231 
232  // Fill in DT layer parameters
233  for (auto it = dtGeometry->layers().begin(), end = dtGeometry->layers().end(); it != end; ++it) {
234  const DTLayer* layer = *it;
235 
236  if (layer) {
237  unsigned int rawid = layer->id().rawId();
238  unsigned int current = insert_id(rawid, fwRecoGeometry);
239  fillShapeAndPlacement(current, layer, fwRecoGeometry);
240 
241  const DTTopology& topo = layer->specificTopology();
242  const BoundPlane& surf = layer->surface();
243  // Topology W/H/L:
244  fwRecoGeometry.idToName[current].topology[0] = topo.cellWidth();
245  fwRecoGeometry.idToName[current].topology[1] = topo.cellHeight();
246  fwRecoGeometry.idToName[current].topology[2] = topo.cellLenght();
247  fwRecoGeometry.idToName[current].topology[3] = topo.firstChannel();
248  fwRecoGeometry.idToName[current].topology[4] = topo.lastChannel();
249  fwRecoGeometry.idToName[current].topology[5] = topo.channels();
250 
251  // Bounds W/H/L:
252  fwRecoGeometry.idToName[current].topology[6] = surf.bounds().width();
253  fwRecoGeometry.idToName[current].topology[7] = surf.bounds().thickness();
254  fwRecoGeometry.idToName[current].topology[8] = surf.bounds().length();
255  }
256  }
257 }
258 
260  //
261  // RPC rolls geometry
262  //
263  DetId detId(DetId::Muon, 3);
264  const RPCGeometry* rpcGeom = static_cast<const RPCGeometry*>(m_trackingGeom->slaveGeometry(detId));
265  for (auto it = rpcGeom->rolls().begin(), end = rpcGeom->rolls().end(); it != end; ++it) {
266  const RPCRoll* roll = (*it);
267  if (roll) {
268  unsigned int rawid = roll->geographicalId().rawId();
269  unsigned int current = insert_id(rawid, fwRecoGeometry);
270  fillShapeAndPlacement(current, roll, fwRecoGeometry);
271 
272  const StripTopology& topo = roll->specificTopology();
273  fwRecoGeometry.idToName[current].topology[0] = topo.nstrips();
274  fwRecoGeometry.idToName[current].topology[1] = topo.stripLength();
275  fwRecoGeometry.idToName[current].topology[2] = topo.pitch();
276  }
277  }
278 
279  try {
280  RPCDetId id(1, 1, 4, 1, 1, 1, 1);
282  fwRecoGeometry.extraDet.Add(new TNamed("RE4", "RPC endcap station 4"));
283  } catch (std::runtime_error& e) {
284  std::cerr << e.what() << std::endl;
285  }
286 }
287 
289  //
290  // GEM geometry
291  //
292 
293  try {
294  DetId detId(DetId::Muon, 4);
295  const GEMGeometry* gemGeom = static_cast<const GEMGeometry*>(m_trackingGeom->slaveGeometry(detId));
296 
297  // add in superChambers - gem Segments are based on superChambers
298  for (auto sc : gemGeom->superChambers()) {
299  if (sc) {
300  unsigned int rawid = sc->geographicalId().rawId();
301  unsigned int current = insert_id(rawid, fwRecoGeometry);
302  fillShapeAndPlacement(current, sc, fwRecoGeometry);
303  }
304  }
305  // add in chambers
306  for (auto ch : gemGeom->chambers()) {
307  if (ch) {
308  unsigned int rawid = ch->geographicalId().rawId();
309  unsigned int current = insert_id(rawid, fwRecoGeometry);
310  fillShapeAndPlacement(current, ch, fwRecoGeometry);
311  }
312  }
313  // add in etaPartitions - gem rechits are based on etaPartitions
314  for (auto roll : gemGeom->etaPartitions()) {
315  if (roll) {
316  unsigned int rawid = roll->geographicalId().rawId();
317  unsigned int current = insert_id(rawid, fwRecoGeometry);
318  fillShapeAndPlacement(current, roll, fwRecoGeometry);
319 
320  const StripTopology& topo = roll->specificTopology();
321  fwRecoGeometry.idToName[current].topology[0] = topo.nstrips();
322  fwRecoGeometry.idToName[current].topology[1] = topo.stripLength();
323  fwRecoGeometry.idToName[current].topology[2] = topo.pitch();
324 
325  float height = topo.stripLength() / 2;
326  LocalPoint lTop(0., height, 0.);
327  LocalPoint lBottom(0., -height, 0.);
328  fwRecoGeometry.idToName[current].topology[3] = roll->localPitch(lTop);
329  fwRecoGeometry.idToName[current].topology[4] = roll->localPitch(lBottom);
330  fwRecoGeometry.idToName[current].topology[5] = roll->npads();
331  }
332  }
333 
334  fwRecoGeometry.extraDet.Add(new TNamed("GEM", "GEM muon detector"));
335  try {
336  GEMDetId id(1, 1, 2, 1, 1, 1);
338  fwRecoGeometry.extraDet.Add(new TNamed("GE2", "GEM endcap station 2"));
339  } catch (std::runtime_error& e) {
340  std::cerr << e.what() << std::endl;
341  }
342 
343  } catch (cms::Exception& exception) {
344  edm::LogError("FWRecoGeometry") << " GEM geometry not found " << exception.what() << std::endl;
345  }
346 }
347 
349  //
350  // ME0 geometry
351  //
352 
353  DetId detId(DetId::Muon, 5);
354  try {
355  const ME0Geometry* me0Geom = static_cast<const ME0Geometry*>(m_trackingGeom->slaveGeometry(detId));
356  for (auto roll : me0Geom->etaPartitions()) {
357  if (roll) {
358  unsigned int rawid = roll->geographicalId().rawId();
359  unsigned int current = insert_id(rawid, fwRecoGeometry);
360  fillShapeAndPlacement(current, roll, fwRecoGeometry);
361 
362  const StripTopology& topo = roll->specificTopology();
363  fwRecoGeometry.idToName[current].topology[0] = topo.nstrips();
364  fwRecoGeometry.idToName[current].topology[1] = topo.stripLength();
365  fwRecoGeometry.idToName[current].topology[2] = topo.pitch();
366 
367  float height = topo.stripLength() / 2;
368  LocalPoint lTop(0., height, 0.);
369  LocalPoint lBottom(0., -height, 0.);
370  fwRecoGeometry.idToName[current].topology[3] = roll->localPitch(lTop);
371  fwRecoGeometry.idToName[current].topology[4] = roll->localPitch(lBottom);
372  fwRecoGeometry.idToName[current].topology[5] = roll->npads();
373  }
374  }
375  fwRecoGeometry.extraDet.Add(new TNamed("ME0", "ME0 muon detector"));
376  } catch (cms::Exception& exception) {
377  edm::LogError("FWRecoGeometry") << " ME0 geometry not found " << exception.what() << std::endl;
378  }
379 }
380 
382  for (TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsPXB().begin(),
383  end = m_trackerGeom->detsPXB().end();
384  it != end;
385  ++it) {
386  const GeomDet* det = *it;
387 
388  if (det) {
389  DetId detid = det->geographicalId();
390  unsigned int rawid = detid.rawId();
391  unsigned int current = insert_id(rawid, fwRecoGeometry);
392  fillShapeAndPlacement(current, det, fwRecoGeometry);
393 
394  ADD_PIXEL_TOPOLOGY(current, m_trackerGeom->idToDetUnit(detid), fwRecoGeometry);
395  }
396  }
397 }
398 
400  for (TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsPXF().begin(),
401  end = m_trackerGeom->detsPXF().end();
402  it != end;
403  ++it) {
404  const GeomDet* det = *it;
405 
406  if (det) {
407  DetId detid = det->geographicalId();
408  unsigned int rawid = detid.rawId();
409  unsigned int current = insert_id(rawid, fwRecoGeometry);
410  fillShapeAndPlacement(current, det, fwRecoGeometry);
411 
412  ADD_PIXEL_TOPOLOGY(current, m_trackerGeom->idToDetUnit(detid), fwRecoGeometry);
413  }
414  }
415 }
416 
418  for (TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTIB().begin(),
419  end = m_trackerGeom->detsTIB().end();
420  it != end;
421  ++it) {
422  const GeomDet* det = *it;
423 
424  if (det) {
425  DetId detid = det->geographicalId();
426  unsigned int rawid = detid.rawId();
427  unsigned int current = insert_id(rawid, fwRecoGeometry);
428  fillShapeAndPlacement(current, det, fwRecoGeometry);
429 
430  ADD_SISTRIP_TOPOLOGY(current, m_trackerGeom->idToDet(detid));
431  }
432  }
433 }
434 
436  for (TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTOB().begin(),
437  end = m_trackerGeom->detsTOB().end();
438  it != end;
439  ++it) {
440  const GeomDet* det = *it;
441 
442  if (det) {
443  DetId detid = det->geographicalId();
444  unsigned int rawid = detid.rawId();
445  unsigned int current = insert_id(rawid, fwRecoGeometry);
446  fillShapeAndPlacement(current, det, fwRecoGeometry);
447 
448  ADD_SISTRIP_TOPOLOGY(current, m_trackerGeom->idToDet(detid));
449  }
450  }
451 }
452 
454  for (TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTID().begin(),
455  end = m_trackerGeom->detsTID().end();
456  it != end;
457  ++it) {
458  const GeomDet* det = *it;
459 
460  if (det) {
461  DetId detid = det->geographicalId();
462  unsigned int rawid = detid.rawId();
463  unsigned int current = insert_id(rawid, fwRecoGeometry);
464  fillShapeAndPlacement(current, det, fwRecoGeometry);
465 
466  ADD_SISTRIP_TOPOLOGY(current, m_trackerGeom->idToDet(detid));
467  }
468  }
469 }
470 
472  for (TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTEC().begin(),
473  end = m_trackerGeom->detsTEC().end();
474  it != end;
475  ++it) {
476  const GeomDet* det = *it;
477 
478  if (det) {
479  DetId detid = det->geographicalId();
480  unsigned int rawid = detid.rawId();
481  unsigned int current = insert_id(rawid, fwRecoGeometry);
482  fillShapeAndPlacement(current, det, fwRecoGeometry);
483 
484  ADD_SISTRIP_TOPOLOGY(current, m_trackerGeom->idToDet(detid));
485  }
486  }
487 }
488 
490  std::vector<DetId> vid = m_caloGeom->getValidDetIds(); // Calo
491  for (std::vector<DetId>::const_iterator it = vid.begin(), end = vid.end(); it != end; ++it) {
492  unsigned int id = insert_id(it->rawId(), fwRecoGeometry);
493  if (!((DetId::Forward == it->det()) || (DetId::HGCalEE == it->det()) || (DetId::HGCalHSi == it->det()) ||
494  (DetId::HGCalHSc == it->det()))) {
495  const CaloCellGeometry::CornersVec& cor = m_caloGeom->getGeometry(*it)->getCorners();
496  fillPoints(id, cor.begin(), cor.end(), fwRecoGeometry);
497  } else {
498  DetId::Detector det = it->det();
499  int subdet = (((DetId::HGCalEE == det) || (DetId::HGCalHSi == det) || (DetId::HGCalHSc == det)) ? ForwardEmpty
500  : it->subdetId());
501  const HGCalGeometry* geom = dynamic_cast<const HGCalGeometry*>(m_caloGeom->getSubdetectorGeometry(det, subdet));
502  hgcal::RecHitTools rhtools;
503  rhtools.setGeometry(*m_caloGeom);
504  const auto cor = geom->getNewCorners(*it);
505 
506  // roll = yaw = pitch = 0
507  fwRecoGeometry.idToName[id].matrix[0] = 1.0;
508  fwRecoGeometry.idToName[id].matrix[4] = 1.0;
509  fwRecoGeometry.idToName[id].matrix[8] = 1.0;
510 
511  // corners of the front face
512  for (uint i = 0; i < (cor.size() - 1); ++i) {
513  fwRecoGeometry.idToName[id].points[i * 3 + 0] = cor[i].x();
514  fwRecoGeometry.idToName[id].points[i * 3 + 1] = cor[i].y();
515  fwRecoGeometry.idToName[id].points[i * 3 + 2] = cor[i].z();
516  }
517 
518  // center
519  auto center = geom->getPosition(*it);
520  fwRecoGeometry.idToName[id].points[(cor.size() - 1) * 3 + 0] = center.x();
521  fwRecoGeometry.idToName[id].points[(cor.size() - 1) * 3 + 1] = center.y();
522  fwRecoGeometry.idToName[id].points[(cor.size() - 1) * 3 + 2] = center.z();
523 
524  // thickness
525  fwRecoGeometry.idToName[id].shape[3] = cor[cor.size() - 1].z();
526 
527  // total points
528  fwRecoGeometry.idToName[id].topology[0] = cor.size() - 1;
529 
530  // Layer with Offset
531  fwRecoGeometry.idToName[id].topology[1] = rhtools.getLayerWithOffset(it->rawId());
532 
533  // Zside, +/- 1
534  fwRecoGeometry.idToName[id].topology[2] = rhtools.zside(it->rawId());
535 
536  // Is Silicon
537  fwRecoGeometry.idToName[id].topology[3] = rhtools.isSilicon(it->rawId());
538 
539  // Silicon index
540  fwRecoGeometry.idToName[id].topology[4] =
541  rhtools.isSilicon(it->rawId()) ? rhtools.getSiThickIndex(it->rawId()) : -1.;
542 
543  // Last EE layer
544  fwRecoGeometry.idToName[id].topology[5] = rhtools.lastLayerEE();
545  }
546  }
547 }
548 
550  // do the barrel
551  for (const auto& detid : m_ftlBarrelGeom->getValidDetIds()) {
552  unsigned int id = insert_id(detid.rawId(), fwRecoGeometry);
553  const auto& cor = m_ftlBarrelGeom->getCorners(detid);
554  fillPoints(id, cor.begin(), cor.end(), fwRecoGeometry);
555  }
556  // do the endcap
557  for (const auto& detid : m_ftlEndcapGeom->getValidDetIds()) {
558  unsigned int id = insert_id(detid.rawId(), fwRecoGeometry);
559  const auto& cor = m_ftlEndcapGeom->getCorners(detid);
560  fillPoints(id, cor.begin(), cor.end(), fwRecoGeometry);
561  }
562 }
563 
564 unsigned int FWRecoGeometryESProducer::insert_id(unsigned int rawid, FWRecoGeometry& fwRecoGeometry) {
565  ++m_current;
566  fwRecoGeometry.idToName.push_back(FWRecoGeom::Info());
567  fwRecoGeometry.idToName.back().id = rawid;
568 
569  return m_current;
570 }
571 
573  std::vector<GlobalPoint>::const_iterator begin,
574  std::vector<GlobalPoint>::const_iterator end,
575  FWRecoGeometry& fwRecoGeometry) {
576  unsigned int index(0);
577  for (std::vector<GlobalPoint>::const_iterator i = begin; i != end; ++i) {
579  fwRecoGeometry.idToName[id].points[index] = i->x();
580  fwRecoGeometry.idToName[id].points[++index] = i->y();
581  fwRecoGeometry.idToName[id].points[++index] = i->z();
582  ++index;
583  }
584 }
585 
588  const GeomDet* det,
589  FWRecoGeometry& fwRecoGeometry) {
590  // Trapezoidal
591  const Bounds* b = &((det->surface()).bounds());
592  if (const TrapezoidalPlaneBounds* b2 = dynamic_cast<const TrapezoidalPlaneBounds*>(b)) {
593  std::array<const float, 4> const& par = b2->parameters();
594 
595  // These parameters are half-lengths, as in CMSIM/GEANT3
596  fwRecoGeometry.idToName[id].shape[0] = 1;
597  fwRecoGeometry.idToName[id].shape[1] = par[0]; // hBottomEdge
598  fwRecoGeometry.idToName[id].shape[2] = par[1]; // hTopEdge
599  fwRecoGeometry.idToName[id].shape[3] = par[2]; // thickness
600  fwRecoGeometry.idToName[id].shape[4] = par[3]; // apothem
601  }
602  if (const RectangularPlaneBounds* b2 = dynamic_cast<const RectangularPlaneBounds*>(b)) {
603  // Rectangular
604  fwRecoGeometry.idToName[id].shape[0] = 2;
605  fwRecoGeometry.idToName[id].shape[1] = b2->width() * 0.5; // half width
606  fwRecoGeometry.idToName[id].shape[2] = b2->length() * 0.5; // half length
607  fwRecoGeometry.idToName[id].shape[3] = b2->thickness() * 0.5; // half thickness
608  }
609 
610  // Position of the DetUnit's center
611  GlobalPoint pos = det->surface().position();
612  fwRecoGeometry.idToName[id].translation[0] = pos.x();
613  fwRecoGeometry.idToName[id].translation[1] = pos.y();
614  fwRecoGeometry.idToName[id].translation[2] = pos.z();
615 
616  // Add the coeff of the rotation matrix
617  // with a projection on the basis vectors
618  TkRotation<float> detRot = det->surface().rotation();
619  fwRecoGeometry.idToName[id].matrix[0] = detRot.xx();
620  fwRecoGeometry.idToName[id].matrix[1] = detRot.yx();
621  fwRecoGeometry.idToName[id].matrix[2] = detRot.zx();
622  fwRecoGeometry.idToName[id].matrix[3] = detRot.xy();
623  fwRecoGeometry.idToName[id].matrix[4] = detRot.yy();
624  fwRecoGeometry.idToName[id].matrix[5] = detRot.zy();
625  fwRecoGeometry.idToName[id].matrix[6] = detRot.xz();
626  fwRecoGeometry.idToName[id].matrix[7] = detRot.yz();
627  fwRecoGeometry.idToName[id].matrix[8] = detRot.zz();
628 }
629 
631  std::string path = "Geometry/TrackerCommonData/data/";
633  path += "PhaseI/";
636  path += "PhaseII/";
637  }
638  path += "trackerParameters.xml";
640  std::ifstream t(fullPath);
641  std::stringstream buffer;
642  buffer << t.rdbuf();
643  fwRecoGeometry.trackerTopologyXML = buffer.str();
644 }
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_caloGeomToken
const DetContainer & detsTIB() const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
virtual int nstrips() const =0
std::string trackerTopologyXML
float centreToIntersection() const override
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const FastTimeGeometry * m_ftlBarrelGeom
T xx() const
void fillShapeAndPlacement(unsigned int id, const GeomDet *det, FWRecoGeometry &)
void addFTLGeometry(FWRecoGeometry &)
std::string fullPath() const
Definition: FileInPath.cc:161
const DetContainer & detsPXB() const
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
void addTOBGeometry(FWRecoGeometry &)
float cellLenght() const
Definition: DTTopology.h:74
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell&#39;s volume.
FWRecoGeometryESProducer(const edm::ParameterSet &)
void addTIBGeometry(FWRecoGeometry &)
T xy() const
float phiOfOneEdge() const override
static const int maxPoints_
T zz() const
const DetContainer & detsPXF() const
T yy() const
const GlobalTrackingGeometry * m_trackingGeom
T yz() const
Log< level::Error, false > LogError
void addRPCGeometry(FWRecoGeometry &)
assert(be >=bs)
const TrackerGeometry * m_trackerGeom
int zside(const DetId &id) const
Definition: RecHitTools.cc:163
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
std::unique_ptr< FWRecoGeometry > produce(const FWRecoGeometryRecord &)
constexpr std::array< uint8_t, layerIndexSize > layer
float yAxisOrientation() const override
void fillPoints(unsigned int id, std::vector< GlobalPoint >::const_iterator begin, std::vector< GlobalPoint >::const_iterator end, FWRecoGeometry &)
FWRecoGeom::InfoMap idToName
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:79
void addCaloGeometry(FWRecoGeometry &)
virtual float localX(float mpX) const =0
T zx() const
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:38
float wireAngle() const override
virtual float stripLength() const =0
const_iterator end() const
Definition: EZArrayFL.h:53
const FastTimeGeometry * m_ftlEndcapGeom
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:69
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_trackingGeomToken
const DetContainer & detsTOB() const
virtual float stripOffset(void) const
virtual bool isItBigPixelInX(int ixbin) const =0
bool isThere(GeomDetEnumerators::SubDetector subdet) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void addPixelForwardGeometry(FWRecoGeometry &)
const_iterator begin() const
Definition: EZArrayFL.h:52
void writeTrackerParametersXML(FWRecoGeometry &)
T zy() const
bool isSilicon(const DetId &) const
Definition: RecHitTools.cc:428
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
double f[11][100]
float angularWidth() const override
double wireSpacing() const
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
void ADD_PIXEL_TOPOLOGY(unsigned int rawid, const GeomDet *detUnit, FWRecoGeometry &)
const TrackerGeomDet * idToDet(DetId) const override
const StripTopology & specificTopology() const
Definition: RPCRoll.cc:49
void addCSCGeometry(FWRecoGeometry &)
void addTECGeometry(FWRecoGeometry &)
edm::ESGetToken< FastTimeGeometry, IdealGeometryRecord > m_ftlBarrelGeomToken
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
float yCentreOfStripPlane() const override
const PositionType & position() const
virtual float localY(float mpY) const =0
const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const override
Get a list of valid detector ids (for the given subdetector)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
Detector
Definition: DetId.h:24
#define ADD_SISTRIP_TOPOLOGY(rawid, detUnit)
double b
Definition: hdecay.h:118
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
TObjArray extraDet
HLT enums.
void addGEMGeometry(FWRecoGeometry &)
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
virtual float pitch() const =0
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:81
void addTIDGeometry(FWRecoGeometry &)
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:44
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
const DetContainer & detsTEC() const
const RotationType & rotation() const
Definition: Bounds.h:18
void addPixelBarrelGeometry(FWRecoGeometry &)
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
virtual std::pair< float, float > pitch() const =0
unsigned int insert_id(unsigned int id, FWRecoGeometry &)
static constexpr float b2
const ChamberContainer & chambers() const
Return a vector of all chambers.
Definition: CSCGeometry.cc:96
edm::ESGetToken< FastTimeGeometry, IdealGeometryRecord > m_ftlEndcapGeomToken
int getSiThickIndex(const DetId &) const
Definition: RecHitTools.cc:205
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
T xz() const
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
void addDTGeometry(FWRecoGeometry &)
const std::vector< const GEMSuperChamber * > & superChambers() const
Return a vector of all GEM super chambers.
Definition: GEMGeometry.cc:36
T yx() const
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
Definition: ME0Geometry.cc:33
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:75
void addME0Geometry(FWRecoGeometry &)
const DetContainer & detsTID() const
float cellHeight() const
Returns the cell height.
Definition: DTTopology.h:71
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:365
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40