CMS 3D CMS Logo

TotemGeometry.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Author:
5 * Laurent Forthomme
6 *
7 ****************************************************************************/
8 
10 
11 TotemGeometry::TotemGeometry(const DetGeomDesc* dgd) { browse(dgd, false); }
12 
13 void TotemGeometry::browse(const DetGeomDesc* parent, bool in_t2) {
14  if (parent->name() == "TotemT2")
15  in_t2 = true; // define the mother volume for all children
16  if (in_t2)
18  // start the recursive browsing
19  for (const auto& child : parent->components())
20  browse(child, in_t2);
21 }
22 
24  const unsigned short arm = parent->parentZPosition() > 0. ? 0 : 1;
25  if (parent->name() == "TotemT2SupportBox")
26  addT2Plane(TotemT2DetId(arm, parent->copyno() - 1), parent);
27  else if (parent->name() == "TotemT2Scint") {
28  unsigned short plane = 2 * (parent->copyno() / 10);
29  unsigned short tile = parent->copyno() % 10;
30  if (tile % 2 == 0)
31  plane += 1;
32  tile = (tile + 1) / 2 - 1;
34  }
35 }
36 
37 bool TotemGeometry::addT2Plane(const TotemT2DetId& detid, const DetGeomDesc*& dgd) {
38  if (nt2_planes_.count(detid) != 0)
39  return true;
40  nt2_planes_[detid] = dgd;
41  return true;
42 }
43 
44 const DetGeomDesc* TotemGeometry::plane(const TotemT2DetId& detid) const { return nt2_planes_.at(detid); }
45 
46 bool TotemGeometry::addT2Tile(const TotemT2DetId& detid, const DetGeomDesc*& dgd) {
47  if (nt2_tiles_.count(detid) != 0)
48  return false;
49  nt2_tiles_[detid] = TotemT2Tile(dgd);
50  return true;
51 }
52 
53 const TotemT2Tile& TotemGeometry::tile(const TotemT2DetId& detid) const { return nt2_tiles_.at(detid); }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
std::map< TotemT2DetId, const DetGeomDesc * > nt2_planes_
Definition: TotemGeometry.h:31
bool addT2Plane(const TotemT2DetId &, const DetGeomDesc *&)
void browseT2(const DetGeomDesc *&)
const DetGeomDesc * plane(const TotemT2DetId &) const
std::map< TotemT2DetId, TotemT2Tile > nt2_tiles_
Definition: TotemGeometry.h:32
const TotemT2Tile & tile(const TotemT2DetId &) const
TotemGeometry(const DetGeomDesc *)
void browse(const DetGeomDesc *, bool in_t2)
bool addT2Tile(const TotemT2DetId &, const DetGeomDesc *&)