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 *)
 build up from DetGeomDesc structure More...
 
 CTPPSGeometry ()
 
 CTPPSGeometry (const DetGeomDesc *gd)
 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...
 
 ~CTPPSGeometry ()
 

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 29 of file CTPPSGeometry.h.

Member Typedef Documentation

◆ mapSetType

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

Definition at line 37 of file CTPPSGeometry.h.

◆ mapType

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

Definition at line 35 of file CTPPSGeometry.h.

◆ RPDeviceMapType

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

Definition at line 36 of file CTPPSGeometry.h.

◆ Vector

Definition at line 39 of file CTPPSGeometry.h.

Constructor & Destructor Documentation

◆ CTPPSGeometry() [1/2]

CTPPSGeometry::CTPPSGeometry ( )
inline

Definition at line 41 of file CTPPSGeometry.h.

42 { build(gd); }

◆ ~CTPPSGeometry()

CTPPSGeometry::~CTPPSGeometry ( )
inline

Definition at line 42 of file CTPPSGeometry.h.

42 { build(gd); }

References build().

◆ CTPPSGeometry() [2/2]

CTPPSGeometry::CTPPSGeometry ( const DetGeomDesc gd)
inline

build up from DetGeomDesc

Definition at line 45 of file CTPPSGeometry.h.

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 69 of file CTPPSGeometry.cc.

70  {
71  if (rps_map_.find(id) != rps_map_.end())
72  return false;
73 
74  rps_map_[id] = gD;
75  return true;

References triggerObjects_cff::id, and rps_map_.

Referenced by build().

◆ 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 59 of file CTPPSGeometry.cc.

60  {
61  if (sensors_map_.find(id) != sensors_map_.end())
62  return false;
63 
64  sensors_map_[id] = gD;
65  return true;

References triggerObjects_cff::id, and sensors_map_.

Referenced by build().

◆ beginRP()

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

begin iterator over RPs

Definition at line 78 of file CTPPSGeometry.h.

◆ beginSensor()

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

begin iterator over sensors

Definition at line 73 of file CTPPSGeometry.h.

◆ build()

void CTPPSGeometry::build ( const DetGeomDesc gD)

build up from DetGeomDesc structure

Definition at line 13 of file CTPPSGeometry.cc.

14  {
15  // reset
16  sensors_map_.clear();
17  rps_map_.clear();
18  stations_in_arm_.clear();
19  rps_in_station_.clear();
20  dets_in_rp_.clear();
21 
22  // propagate through the GeometricalDet structure and add all detectors to 'sensors_map_'
23  std::deque<const DetGeomDesc*> buffer;
24  buffer.emplace_back(gD);
25  while (!buffer.empty()) {
26  const DetGeomDesc* d = buffer.front();
27  buffer.pop_front();
28 
29  // check if it is a sensor
30  if (d->name() == DDD_TOTEM_RP_SENSOR_NAME ||
31  std::regex_match(d->name(), std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL)) ||
34  addSensor(d->geographicalID(), d);
35 
36  // check if it is a RP
37  if (d->name() == DDD_TOTEM_RP_RP_NAME || d->name() == DDD_TOTEM_TIMING_RP_NAME ||
38  d->name() == DDD_CTPPS_DIAMONDS_RP_NAME || d->name() == DDD_CTPPS_PIXELS_RP_NAME)
39  addRP(d->geographicalID(), d);
40 
41  for (const auto& comp : d->components())
42  buffer.emplace_back(comp);
43  }
44 
45  // build sets
46  for (const auto& it : sensors_map_) {
47  const CTPPSDetId detId(it.first);
48  const CTPPSDetId rpId = detId.rpId();
49  const CTPPSDetId stId = detId.stationId();
50  const CTPPSDetId armId = detId.armId();
51 
52  stations_in_arm_[armId].insert(armId);
53  rps_in_station_[stId].insert(rpId);
54  dets_in_rp_[rpId].insert(detId);
55  }

References addRP(), addSensor(), CTPPSDetId::armId(), 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_UFSD_SEGMENT_NAME, DDD_TOTEM_RP_RP_NAME, DDD_TOTEM_RP_SENSOR_NAME, DDD_TOTEM_TIMING_RP_NAME, DDD_TOTEM_TIMING_SENSOR_TMPL, dets_in_rp_, year_2016_postTS2_cff::rpId, CTPPSDetId::rpId(), rps_in_station_, rps_map_, sensors_map_, CTPPSDetId::stationId(), and stations_in_arm_.

Referenced by ~CTPPSGeometry().

◆ endRP()

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

end iterator over RPs

Definition at line 80 of file CTPPSGeometry.h.

◆ endSensor()

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

end iterator over sensors

Definition at line 75 of file CTPPSGeometry.h.

75 { return rps_map_.begin(); }

References rps_map_.

◆ globalToLocal() [1/2]

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

Definition at line 158 of file CTPPSGeometry.cc.

159  {
160  return gd->rotation().Inverse() * (r - gd->translation());

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

Referenced by globalToLocal().

◆ globalToLocal() [2/2]

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

Definition at line 164 of file CTPPSGeometry.cc.

165  {
166  return globalToLocal(sensor(id), r);

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

◆ 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 176 of file CTPPSGeometry.cc.

177  {
178  return sensor(id)->rotation().Inverse() * dir;

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

◆ 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 146 of file CTPPSGeometry.cc.

147  {
148  return gd->rotation() * r + gd->translation();

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

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

◆ localToGlobal() [2/2]

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

Definition at line 152 of file CTPPSGeometry.cc.

153  {
154  return localToGlobal(sensor(id), r);

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

◆ 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 170 of file CTPPSGeometry.cc.

171  {
172  return sensor(id)->rotation() * dir;

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

Referenced by TotemRPLocalTrackFitterAlgorithm::prepareReconstAlgebraData().

◆ rp()

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

returns geometry of a RP box

Definition at line 99 of file CTPPSGeometry.cc.

100  {
101  auto rp = rpNoThrow(id);
102  if (nullptr == rp) {
103  throw cms::Exception("CTPPSGeometry") << "Not found RP device with ID " << id << ", i.e. " << CTPPSDetId(id);
104  }
105  return rp;

References Exception, and rpNoThrow().

Referenced by rpTranslation().

◆ rpNoThrow()

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

Definition at line 109 of file CTPPSGeometry.cc.

110  {
111  auto it = rps_map_.find(id);
112  if (it == rps_map_.end()) {
113  return nullptr;
114  }
115 
116  return it->second;

Referenced by rp().

◆ 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 128 of file CTPPSGeometry.cc.

129  {
130  auto it = rps_in_station_.find(id);
131  if (it == rps_in_station_.end())
132  throw cms::Exception("CTPPSGeometry") << "Station with ID " << id << " not found.";
133  return it->second;

References rps_in_station_.

◆ rpTranslation()

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

returns position of a RP box

Parameters
idRP id

Definition at line 189 of file CTPPSGeometry.cc.

190  {
191  auto gd = rp(id);
192  return gd->translation();

References rp().

Referenced by CTPPSProtonProducer::produce().

◆ sensor()

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

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

Definition at line 79 of file CTPPSGeometry.cc.

80  {
81  auto g = sensorNoThrow(id);
82  if (nullptr == g) {
83  throw cms::Exception("CTPPSGeometry") << "Not found detector with ID " << id << ", i.e. " << CTPPSDetId(id);
84  }
85  return g;

References Exception, g, and sensorNoThrow().

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

◆ sensorNoThrow()

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

Definition at line 89 of file CTPPSGeometry.cc.

90  {
91  auto it = sensors_map_.find(id);
92  if (it == sensors_map_.end()) {
93  return nullptr;
94  }
95  return it->second;

Referenced by sensor().

◆ 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 137 of file CTPPSGeometry.cc.

138  {
139  auto it = dets_in_rp_.find(id);
140  if (it == dets_in_rp_.end())
141  throw cms::Exception("CTPPSGeometry") << "RP with ID " << id << " not found.";
142  return it->second;

References dets_in_rp_.

◆ sensorTranslation()

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

returns translation (position) of a detector

Parameters
idsensor id

Definition at line 182 of file CTPPSGeometry.cc.

183  {
184  auto gd = sensor(id);
185  return gd->translation();

References sensor().

Referenced by TotemRPLocalTrackFitterAlgorithm::prepareReconstAlgebraData().

◆ 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 119 of file CTPPSGeometry.cc.

120  {
121  auto it = stations_in_arm_.find(id);
122  if (it == stations_in_arm_.end())
123  throw cms::Exception("CTPPSGeometry") << "Arm with ID " << id << " not found.";
124  return it->second;

References stations_in_arm_.

Member Data Documentation

◆ dets_in_rp_

mapSetType CTPPSGeometry::dets_in_rp_
protected

Definition at line 125 of file CTPPSGeometry.h.

Referenced by build(), and sensorsInRP().

◆ rps_in_station_

mapSetType CTPPSGeometry::rps_in_station_
protected

Definition at line 125 of file CTPPSGeometry.h.

Referenced by build(), and rpsInStation().

◆ rps_map_

RPDeviceMapType CTPPSGeometry::rps_map_
protected

map: rp id --> DetGeomDesc

Definition at line 121 of file CTPPSGeometry.h.

Referenced by addRP(), build(), and endSensor().

◆ sensors_map_

mapType CTPPSGeometry::sensors_map_
protected

map: sensor id --> DetGeomDesc

Definition at line 118 of file CTPPSGeometry.h.

Referenced by addSensor(), and build().

◆ 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 125 of file CTPPSGeometry.h.

Referenced by build(), and stationsInArm().

DetGeomDesc::rotation
RotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:63
CTPPSGeometry::globalToLocal
Vector globalToLocal(const DetGeomDesc *, const Vector &) const
Definition: CTPPSGeometry.cc:158
DDD_CTPPS_UFSD_SEGMENT_NAME
const std::string DDD_CTPPS_UFSD_SEGMENT_NAME
Definition: CTPPSDDDNames.h:17
DDD_CTPPS_PIXELS_SENSOR_NAME
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME
Definition: CTPPSDDDNames.h:14
DDD_CTPPS_PIXELS_RP_NAME
const std::string DDD_CTPPS_PIXELS_RP_NAME
Definition: CTPPSDDDNames.h:22
DDD_TOTEM_TIMING_RP_NAME
const std::string DDD_TOTEM_TIMING_RP_NAME
Definition: CTPPSDDDNames.h:25
year_2016_postTS2_cff.rpId
rpId
Definition: year_2016_postTS2_cff.py:23
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
DDD_CTPPS_DIAMONDS_SEGMENT_NAME
const std::string DDD_CTPPS_DIAMONDS_SEGMENT_NAME
Definition: CTPPSDDDNames.h:16
CTPPSDetId::armId
CTPPSDetId armId() const
Definition: CTPPSDetId.h:78
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
CTPPSGeometry::stations_in_arm_
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...
Definition: CTPPSGeometry.h:125
CTPPSGeometry::sensors_map_
mapType sensors_map_
map: sensor id --> DetGeomDesc
Definition: CTPPSGeometry.h:118
CTPPSGeometry::sensorNoThrow
const DetGeomDesc * sensorNoThrow(unsigned int id) const noexcept
Definition: CTPPSGeometry.cc:89
CTPPSGeometry::dets_in_rp_
mapSetType dets_in_rp_
Definition: CTPPSGeometry.h:125
DDD_CTPPS_DIAMONDS_RP_NAME
const std::string DDD_CTPPS_DIAMONDS_RP_NAME
Definition: CTPPSDDDNames.h:24
CTPPSGeometry::rps_map_
RPDeviceMapType rps_map_
map: rp id --> DetGeomDesc
Definition: CTPPSGeometry.h:121
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
DDD_TOTEM_TIMING_SENSOR_TMPL
const std::string DDD_TOTEM_TIMING_SENSOR_TMPL
Definition: CTPPSDDDNames.h:18
DetGeomDesc
Geometrical description of a sensor.
Definition: DetGeomDesc.h:34
CTPPSGeometry::rpNoThrow
const DetGeomDesc * rpNoThrow(unsigned int id) const noexcept
Definition: CTPPSGeometry.cc:109
DDD_TOTEM_RP_RP_NAME
const std::string DDD_TOTEM_RP_RP_NAME
DDD names of RP volumes.
Definition: CTPPSDDDNames.h:21
alignCSCRings.r
r
Definition: alignCSCRings.py:93
CTPPSGeometry::addRP
bool addRP(unsigned int id, const DetGeomDesc *&)
adds a RP box to a map
Definition: CTPPSGeometry.cc:69
CTPPSGeometry::addSensor
bool addSensor(unsigned int, const DetGeomDesc *&)
adds an item to the map (detector ID --> DetGeomDesc) performs necessary checks
Definition: CTPPSGeometry.cc:59
CTPPSDetId::stationId
CTPPSDetId stationId() const
Definition: CTPPSDetId.h:80
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Exception
Definition: hltDiff.cc:246
DDD_TOTEM_RP_SENSOR_NAME
const std::string DDD_TOTEM_RP_SENSOR_NAME
DDD names of sensors.
Definition: CTPPSDDDNames.h:13
CTPPSGeometry::rp
const DetGeomDesc * rp(unsigned int id) const
returns geometry of a RP box
Definition: CTPPSGeometry.cc:99
DetGeomDesc::translation
Translation translation() const
Definition: DetGeomDesc.h:64
ztail.d
d
Definition: ztail.py:151
cms::Exception
Definition: Exception.h:70
CTPPSGeometry::localToGlobal
Vector localToGlobal(const DetGeomDesc *, const Vector &) const
Definition: CTPPSGeometry.cc:146
CTPPSGeometry::rps_in_station_
mapSetType rps_in_station_
Definition: CTPPSGeometry.h:125
CTPPSGeometry::build
void build(const DetGeomDesc *)
build up from DetGeomDesc structure
Definition: CTPPSGeometry.cc:13
g
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
CTPPSGeometry::sensor
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
Definition: CTPPSGeometry.cc:79
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23