CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes
CTPPSGeometry Class Reference

The manager class for TOTEM RP geometry. More...

#include <CTPPSGeometry.h>

Public Types

typedef std::map< unsigned int, std::set< unsigned int > > mapSetType
 
typedef std::map< unsigned int, const DetGeomDesc * > mapType
 
typedef std::map< int, const DetGeomDesc * > RPDeviceMapType
 
using Vector = DetGeomDesc::Translation
 

Public Member Functions

bool addRP (unsigned int id, const DetGeomDesc *&)
 adds a RP box to a map More...
 
bool addSensor (unsigned int, const DetGeomDesc *&)
 adds an item to the map (detector ID –> DetGeomDesc) performs necessary checks More...
 
RPDeviceMapType::const_iterator beginRP () const
 begin iterator over RPs More...
 
mapType::const_iterator beginSensor () const
 begin iterator over sensors More...
 
void build (const DetGeomDesc *, unsigned int verbosity)
 build up from DetGeomDesc structure More...
 
 CTPPSGeometry (const DetGeomDesc *gd, unsigned int verbosity)
 build up from DetGeomDesc More...
 
RPDeviceMapType::const_iterator endRP () const
 end iterator over RPs More...
 
mapType::const_iterator endSensor () const
 end iterator over sensors More...
 
Vector globalToLocal (const DetGeomDesc *, const Vector &) const
 
Vector globalToLocal (unsigned int, const Vector &) const
 
Vector globalToLocalDirection (unsigned int id, const Vector &) const
 
Vector localToGlobal (const DetGeomDesc *, const Vector &) const
 
Vector localToGlobal (unsigned int, const Vector &) const
 
Vector localToGlobalDirection (unsigned int id, const Vector &) const
 
const DetGeomDescrp (unsigned int id) const
 returns geometry of a RP box More...
 
const DetGeomDescrpNoThrow (unsigned int id) const noexcept
 
const std::set< unsigned int > & rpsInStation (unsigned int) const
 after checks returns set of RP ids corresponding to the given station id More...
 
Vector rpTranslation (unsigned int id) const
 
const DetGeomDescsensor (unsigned int id) const
 returns geometry of a detector performs necessary checks, returns NULL if fails More...
 
const DetGeomDescsensorNoThrow (unsigned int id) const noexcept
 
const std::set< unsigned int > & sensorsInRP (unsigned int) const
 after checks returns set of sensor ids corresponding to the given RP id More...
 
Vector sensorTranslation (unsigned int id) const
 
const std::set< unsigned int > & stationsInArm (unsigned int) const
 after checks returns set of station ids corresponding to the given arm id More...
 

Protected Attributes

mapSetType dets_in_rp_
 
mapSetType rps_in_station_
 
RPDeviceMapType rps_map_
 map: rp id –> DetGeomDesc More...
 
mapType sensors_map_
 map: sensor id –> DetGeomDesc More...
 
mapSetType stations_in_arm_
 map: parent ID -> set of subelements E.g. stations_in_arm_ is map of arm ID -> set of stations (in that arm) More...
 

Detailed Description

The manager class for TOTEM RP geometry.

This is kind of "public relation class" for the tree structure of DetGeomDesc. It provides convenient interface to answer frequently asked questions about the geometry of TOTEM Roman Pots. These questions are of type:

Definition at line 30 of file CTPPSGeometry.h.

Member Typedef Documentation

◆ mapSetType

typedef std::map<unsigned int, std::set<unsigned int> > CTPPSGeometry::mapSetType

Definition at line 34 of file CTPPSGeometry.h.

◆ mapType

typedef std::map<unsigned int, const DetGeomDesc*> CTPPSGeometry::mapType

Definition at line 32 of file CTPPSGeometry.h.

◆ RPDeviceMapType

typedef std::map<int, const DetGeomDesc*> CTPPSGeometry::RPDeviceMapType

Definition at line 33 of file CTPPSGeometry.h.

◆ Vector

Definition at line 36 of file CTPPSGeometry.h.

Constructor & Destructor Documentation

◆ CTPPSGeometry()

CTPPSGeometry::CTPPSGeometry ( const DetGeomDesc gd,
unsigned int  verbosity 
)
inline

build up from DetGeomDesc

Definition at line 39 of file CTPPSGeometry.h.

References build(), and verbosity.

39 { build(gd, verbosity); }
void build(const DetGeomDesc *, unsigned int verbosity)
build up from DetGeomDesc structure
const int verbosity

Member Function Documentation

◆ addRP()

bool CTPPSGeometry::addRP ( unsigned int  id,
const DetGeomDesc *&  gD 
)

adds a RP box to a map

Returns
true if successful, false if the RP is already present

Definition at line 82 of file CTPPSGeometry.cc.

References l1ctLayer2EG_cff::id, and rps_map_.

Referenced by build().

82  {
83  if (rps_map_.find(id) != rps_map_.end())
84  return false;
85 
86  rps_map_[id] = gD;
87  return true;
88 }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc

◆ addSensor()

bool CTPPSGeometry::addSensor ( unsigned int  id,
const DetGeomDesc *&  gD 
)

adds an item to the map (detector ID –> DetGeomDesc) performs necessary checks

Returns
true if successful, false if the sensor is already present

Definition at line 72 of file CTPPSGeometry.cc.

References l1ctLayer2EG_cff::id, and sensors_map_.

Referenced by build().

72  {
73  if (sensors_map_.find(id) != sensors_map_.end())
74  return false;
75 
76  sensors_map_[id] = gD;
77  return true;
78 }
mapType sensors_map_
map: sensor id –> DetGeomDesc

◆ beginRP()

RPDeviceMapType::const_iterator CTPPSGeometry::beginRP ( ) const
inline

begin iterator over RPs

Definition at line 72 of file CTPPSGeometry.h.

References rps_map_.

72 { return rps_map_.begin(); }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc

◆ beginSensor()

mapType::const_iterator CTPPSGeometry::beginSensor ( ) const
inline

begin iterator over sensors

Definition at line 67 of file CTPPSGeometry.h.

References sensors_map_.

67 { return sensors_map_.begin(); }
mapType sensors_map_
map: sensor id –> DetGeomDesc

◆ build()

void CTPPSGeometry::build ( const DetGeomDesc gD,
unsigned int  verbosity 
)

build up from DetGeomDesc structure

Definition at line 15 of file CTPPSGeometry.cc.

References addRP(), addSensor(), edmScanValgrind::buffer, AlCaHLTBitMon_QueryRunRegistry::comp, ztail::d, DDD_CTPPS_DIAMONDS_RP_NAME, DDD_CTPPS_DIAMONDS_SEGMENT_NAME, DDD_CTPPS_PIXELS_RP_NAME, DDD_CTPPS_PIXELS_SENSOR_NAME, DDD_CTPPS_PIXELS_SENSOR_NAME_2x2, DDD_CTPPS_UFSD_SEGMENT_NAME, DDD_TOTEM_RP_RP_NAME, DDD_TOTEM_RP_SENSOR_NAME, DDD_TOTEM_TIMING_RP_NAME, DDD_TOTEM_TIMING_SENSOR_TMPL, hcalRecHitTable_cff::detId, dets_in_rp_, rps_in_station_, rps_map_, sensors_map_, stations_in_arm_, and verbosity.

Referenced by CTPPSGeometry().

15  {
16  // reset
17  sensors_map_.clear();
18  rps_map_.clear();
19  stations_in_arm_.clear();
20  rps_in_station_.clear();
21  dets_in_rp_.clear();
22 
23  // propagate through the GeometricalDet structure and add all detectors to 'sensors_map_'
24  std::deque<const DetGeomDesc*> buffer;
25  buffer.emplace_back(gD);
26  while (!buffer.empty()) {
27  const DetGeomDesc* d = buffer.front();
28  buffer.pop_front();
29 
30  // verbosity printout
31  if (verbosity == 2) {
32  d->print();
33  }
34 
35  // check if it is a sensor
36  if (d->name() == DDD_TOTEM_RP_SENSOR_NAME ||
37  std::regex_match(d->name(), std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL)) ||
40  addSensor(d->geographicalID(), d);
41 
42  // check if it is a RP
43  if (d->name() == DDD_TOTEM_RP_RP_NAME || d->name() == DDD_TOTEM_TIMING_RP_NAME ||
44  d->name() == DDD_CTPPS_DIAMONDS_RP_NAME || d->name() == DDD_CTPPS_PIXELS_RP_NAME)
45  addRP(d->geographicalID(), d);
46 
47  for (const auto& comp : d->components())
48  buffer.emplace_back(comp);
49  }
50 
51  // verbosity printout
52  if (verbosity) {
53  edm::LogVerbatim("CTPPSGeometry::build")
54  << "sensors_map_.size() = " << sensors_map_.size() << ", rps_map_.size() = " << rps_map_.size() << std::endl;
55  }
56 
57  // build sets
58  for (const auto& it : sensors_map_) {
59  const CTPPSDetId detId(it.first);
60  const CTPPSDetId rpId = detId.rpId();
61  const CTPPSDetId stId = detId.stationId();
62  const CTPPSDetId armId = detId.armId();
63 
64  stations_in_arm_[armId].insert(armId);
65  rps_in_station_[stId].insert(rpId);
66  dets_in_rp_[rpId].insert(detId);
67  }
68 }
Log< level::Info, true > LogVerbatim
const std::string DDD_CTPPS_PIXELS_RP_NAME
Definition: CTPPSDDDNames.h:24
mapSetType stations_in_arm_
map: parent ID -> set of subelements E.g. stations_in_arm_ is map of arm ID -> set of stations (in th...
const std::string DDD_TOTEM_TIMING_RP_NAME
Definition: CTPPSDDDNames.h:27
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME_2x2
Definition: CTPPSDDDNames.h:16
const std::string DDD_CTPPS_DIAMONDS_SEGMENT_NAME
Definition: CTPPSDDDNames.h:18
const std::string DDD_TOTEM_TIMING_SENSOR_TMPL
Definition: CTPPSDDDNames.h:20
d
Definition: ztail.py:151
const int verbosity
const std::string DDD_TOTEM_RP_RP_NAME
DDD names of RP volumes.
Definition: CTPPSDDDNames.h:23
mapSetType rps_in_station_
const std::string DDD_CTPPS_DIAMONDS_RP_NAME
Definition: CTPPSDDDNames.h:26
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
bool addSensor(unsigned int, const DetGeomDesc *&)
adds an item to the map (detector ID –> DetGeomDesc) performs necessary checks
const std::string DDD_TOTEM_RP_SENSOR_NAME
DDD names of sensors.
Definition: CTPPSDDDNames.h:14
mapSetType dets_in_rp_
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME
Definition: CTPPSDDDNames.h:15
mapType sensors_map_
map: sensor id –> DetGeomDesc
bool addRP(unsigned int id, const DetGeomDesc *&)
adds a RP box to a map
const std::string DDD_CTPPS_UFSD_SEGMENT_NAME
Definition: CTPPSDDDNames.h:19

◆ endRP()

RPDeviceMapType::const_iterator CTPPSGeometry::endRP ( ) const
inline

end iterator over RPs

Definition at line 74 of file CTPPSGeometry.h.

References rps_map_.

74 { return rps_map_.end(); }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc

◆ endSensor()

mapType::const_iterator CTPPSGeometry::endSensor ( ) const
inline

end iterator over sensors

Definition at line 69 of file CTPPSGeometry.h.

References sensors_map_.

69 { return sensors_map_.end(); }
mapType sensors_map_
map: sensor id –> DetGeomDesc

◆ globalToLocal() [1/2]

CTPPSGeometry::Vector CTPPSGeometry::globalToLocal ( const DetGeomDesc gd,
const Vector r 
) const

Definition at line 171 of file CTPPSGeometry.cc.

References alignCSCRings::r, DetGeomDesc::rotation(), and DetGeomDesc::translation().

Referenced by globalToLocal().

171  {
172  return gd->rotation().Inverse() * (r - gd->translation());
173 }
const Translation & translation() const
Definition: DetGeomDesc.h:80
const RotationMatrix & rotation() const
Definition: DetGeomDesc.h:81

◆ globalToLocal() [2/2]

CTPPSGeometry::Vector CTPPSGeometry::globalToLocal ( unsigned int  id,
const Vector r 
) const

Definition at line 177 of file CTPPSGeometry.cc.

References globalToLocal(), alignCSCRings::r, and sensor().

177  {
178  return globalToLocal(sensor(id), r);
179 }
Vector globalToLocal(const DetGeomDesc *, const Vector &) const
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails

◆ globalToLocalDirection()

CTPPSGeometry::Vector CTPPSGeometry::globalToLocalDirection ( unsigned int  id,
const Vector dir 
) const

direction transformations between global and local reference frames

Parameters
idsensor id

Definition at line 189 of file CTPPSGeometry.cc.

References DeadROC_duringRun::dir, DetGeomDesc::rotation(), and sensor().

189  {
190  return sensor(id)->rotation().Inverse() * dir;
191 }
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
const RotationMatrix & rotation() const
Definition: DetGeomDesc.h:81

◆ localToGlobal() [1/2]

CTPPSGeometry::Vector CTPPSGeometry::localToGlobal ( const DetGeomDesc gd,
const Vector r 
) const

coordinate transformations between local<–>global reference frames dimensions in mm sensor id expected

Definition at line 159 of file CTPPSGeometry.cc.

References alignCSCRings::r, DetGeomDesc::rotation(), and DetGeomDesc::translation().

Referenced by RPixPlaneCombinatoryTracking::calculatePointOnDetector(), RPixRoadFinder::findPattern(), and localToGlobal().

159  {
160  return gd->rotation() * r + gd->translation();
161 }
const Translation & translation() const
Definition: DetGeomDesc.h:80
const RotationMatrix & rotation() const
Definition: DetGeomDesc.h:81

◆ localToGlobal() [2/2]

CTPPSGeometry::Vector CTPPSGeometry::localToGlobal ( unsigned int  id,
const Vector r 
) const

Definition at line 165 of file CTPPSGeometry.cc.

References localToGlobal(), alignCSCRings::r, and sensor().

165  {
166  return localToGlobal(sensor(id), r);
167 }
Vector localToGlobal(const DetGeomDesc *, const Vector &) const
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails

◆ localToGlobalDirection()

CTPPSGeometry::Vector CTPPSGeometry::localToGlobalDirection ( unsigned int  id,
const Vector dir 
) const

direction transformations between local and global reference frames

Parameters
idsensor id

Definition at line 183 of file CTPPSGeometry.cc.

References DeadROC_duringRun::dir, DetGeomDesc::rotation(), and sensor().

Referenced by TotemRPLocalTrackFitterAlgorithm::prepareReconstAlgebraData().

183  {
184  return sensor(id)->rotation() * dir;
185 }
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
const RotationMatrix & rotation() const
Definition: DetGeomDesc.h:81

◆ rp()

const DetGeomDesc * CTPPSGeometry::rp ( unsigned int  id) const

returns geometry of a RP box

Definition at line 112 of file CTPPSGeometry.cc.

References Exception, and rpNoThrow().

Referenced by rpTranslation().

112  {
113  auto rp = rpNoThrow(id);
114  if (nullptr == rp) {
115  throw cms::Exception("CTPPSGeometry") << "Not found RP device with ID " << id << ", i.e. " << CTPPSDetId(id);
116  }
117  return rp;
118 }
const DetGeomDesc * rp(unsigned int id) const
returns geometry of a RP box
const DetGeomDesc * rpNoThrow(unsigned int id) const noexcept
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32

◆ rpNoThrow()

const DetGeomDesc * CTPPSGeometry::rpNoThrow ( unsigned int  id) const
noexcept

Definition at line 122 of file CTPPSGeometry.cc.

Referenced by rp().

122  {
123  auto it = rps_map_.find(id);
124  if (it == rps_map_.end()) {
125  return nullptr;
126  }
127 
128  return it->second;
129 }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc

◆ rpsInStation()

const std::set< unsigned int > & CTPPSGeometry::rpsInStation ( unsigned int  id) const

after checks returns set of RP ids corresponding to the given station id

Definition at line 141 of file CTPPSGeometry.cc.

References rps_in_station_.

141  {
142  auto it = rps_in_station_.find(id);
143  if (it == rps_in_station_.end())
144  throw cms::Exception("CTPPSGeometry") << "Station with ID " << id << " not found.";
145  return it->second;
146 }
mapSetType rps_in_station_

◆ rpTranslation()

CTPPSGeometry::Vector CTPPSGeometry::rpTranslation ( unsigned int  id) const

returns position of a RP box

Parameters
idRP id

Definition at line 202 of file CTPPSGeometry.cc.

References rp().

Referenced by RPixPlaneCombinatoryTracking::findTracks(), and CTPPSProtonProducer::produce().

202  {
203  auto gd = rp(id);
204  return gd->translation();
205 }
const DetGeomDesc * rp(unsigned int id) const
returns geometry of a RP box

◆ sensor()

const DetGeomDesc * CTPPSGeometry::sensor ( unsigned int  id) const

returns geometry of a detector performs necessary checks, returns NULL if fails

Definition at line 92 of file CTPPSGeometry.cc.

References Exception, g, and sensorNoThrow().

Referenced by RPixPlaneCombinatoryTracking::calculatePointOnDetector(), RPixRoadFinder::findPattern(), RPixPlaneCombinatoryTracking::findTracks(), globalToLocal(), globalToLocalDirection(), localToGlobal(), localToGlobalDirection(), sensorTranslation(), and IdealResult::solve().

92  {
93  auto g = sensorNoThrow(id);
94  if (nullptr == g) {
95  throw cms::Exception("CTPPSGeometry") << "Not found detector with ID " << id << ", i.e. " << CTPPSDetId(id);
96  }
97  return g;
98 }
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 g
Definition: Activities.doc:4
const DetGeomDesc * sensorNoThrow(unsigned int id) const noexcept
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32

◆ sensorNoThrow()

const DetGeomDesc * CTPPSGeometry::sensorNoThrow ( unsigned int  id) const
noexcept

Definition at line 102 of file CTPPSGeometry.cc.

Referenced by sensor().

102  {
103  auto it = sensors_map_.find(id);
104  if (it == sensors_map_.end()) {
105  return nullptr;
106  }
107  return it->second;
108 }
mapType sensors_map_
map: sensor id –> DetGeomDesc

◆ sensorsInRP()

const std::set< unsigned int > & CTPPSGeometry::sensorsInRP ( unsigned int  id) const

after checks returns set of sensor ids corresponding to the given RP id

Definition at line 150 of file CTPPSGeometry.cc.

References dets_in_rp_.

150  {
151  auto it = dets_in_rp_.find(id);
152  if (it == dets_in_rp_.end())
153  throw cms::Exception("CTPPSGeometry") << "RP with ID " << id << " not found.";
154  return it->second;
155 }
mapSetType dets_in_rp_

◆ sensorTranslation()

CTPPSGeometry::Vector CTPPSGeometry::sensorTranslation ( unsigned int  id) const

returns translation (position) of a detector

Parameters
idsensor id

Definition at line 195 of file CTPPSGeometry.cc.

References sensor().

Referenced by TotemRPLocalTrackFitterAlgorithm::prepareReconstAlgebraData().

195  {
196  auto gd = sensor(id);
197  return gd->translation();
198 }
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails

◆ stationsInArm()

const std::set< unsigned int > & CTPPSGeometry::stationsInArm ( unsigned int  id) const

after checks returns set of station ids corresponding to the given arm id

Definition at line 132 of file CTPPSGeometry.cc.

References stations_in_arm_.

132  {
133  auto it = stations_in_arm_.find(id);
134  if (it == stations_in_arm_.end())
135  throw cms::Exception("CTPPSGeometry") << "Arm with ID " << id << " not found.";
136  return it->second;
137 }
mapSetType stations_in_arm_
map: parent ID -> set of subelements E.g. stations_in_arm_ is map of arm ID -> set of stations (in th...

Member Data Documentation

◆ dets_in_rp_

mapSetType CTPPSGeometry::dets_in_rp_
protected

Definition at line 119 of file CTPPSGeometry.h.

Referenced by build(), and sensorsInRP().

◆ rps_in_station_

mapSetType CTPPSGeometry::rps_in_station_
protected

Definition at line 119 of file CTPPSGeometry.h.

Referenced by build(), and rpsInStation().

◆ rps_map_

RPDeviceMapType CTPPSGeometry::rps_map_
protected

map: rp id –> DetGeomDesc

Definition at line 115 of file CTPPSGeometry.h.

Referenced by addRP(), beginRP(), build(), and endRP().

◆ sensors_map_

mapType CTPPSGeometry::sensors_map_
protected

map: sensor id –> DetGeomDesc

Definition at line 112 of file CTPPSGeometry.h.

Referenced by addSensor(), beginSensor(), build(), and endSensor().

◆ stations_in_arm_

mapSetType CTPPSGeometry::stations_in_arm_
protected

map: parent ID -> set of subelements E.g. stations_in_arm_ is map of arm ID -> set of stations (in that arm)

Definition at line 119 of file CTPPSGeometry.h.

Referenced by build(), and stationsInArm().