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
 

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...
 
CLHEP::Hep3Vector globalToLocal (const DetGeomDesc *, const CLHEP::Hep3Vector &) const
 
CLHEP::Hep3Vector globalToLocal (unsigned int, const CLHEP::Hep3Vector &) const
 
CLHEP::Hep3Vector globalToLocalDirection (unsigned int id, const CLHEP::Hep3Vector &) const
 
CLHEP::Hep3Vector localToGlobal (const DetGeomDesc *, const CLHEP::Hep3Vector &) const
 
CLHEP::Hep3Vector localToGlobal (unsigned int, const CLHEP::Hep3Vector &) const
 
CLHEP::Hep3Vector localToGlobalDirection (unsigned int id, const CLHEP::Hep3Vector &) const
 
const DetGeomDescrp (unsigned int id) const
 returns geometry of a RP box More...
 
const DetGeomDescrpNoThrow (unsigned int id) const
 
const std::set< unsigned int > & rpsInStation (unsigned int) const
 after checks returns set of RP ids corresponding to the given station id More...
 
CLHEP::Hep3Vector 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
 
const std::set< unsigned int > & sensorsInRP (unsigned int) const
 after checks returns set of sensor ids corresponding to the given RP id More...
 
CLHEP::Hep3Vector 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 33 of file CTPPSGeometry.h.

Member Typedef Documentation

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

Definition at line 37 of file CTPPSGeometry.h.

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

Definition at line 35 of file CTPPSGeometry.h.

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

Definition at line 36 of file CTPPSGeometry.h.

Constructor & Destructor Documentation

CTPPSGeometry::CTPPSGeometry ( )
inline

Definition at line 39 of file CTPPSGeometry.h.

39 {}
CTPPSGeometry::~CTPPSGeometry ( )
inline

Definition at line 40 of file CTPPSGeometry.h.

40 {}
CTPPSGeometry::CTPPSGeometry ( const DetGeomDesc gd)
inline

build up from DetGeomDesc

Definition at line 43 of file CTPPSGeometry.h.

References addRP(), addSensor(), build(), noexcept, rp(), rpNoThrow(), sensor(), and sensorNoThrow().

43 { build(gd); }
void build(const DetGeomDesc *)
build up from DetGeomDesc structure

Member Function Documentation

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

References triggerObjects_cff::id, and rps_map_.

Referenced by build(), and CTPPSGeometry().

70  {
71  if (rps_map_.find(id) != rps_map_.end())
72  return false;
73 
74  rps_map_[id] = gD;
75  return true;
76 }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc
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 60 of file CTPPSGeometry.cc.

References triggerObjects_cff::id, and sensors_map_.

Referenced by build(), and CTPPSGeometry().

60  {
61  if (sensors_map_.find(id) != sensors_map_.end())
62  return false;
63 
64  sensors_map_[id] = gD;
65  return true;
66 }
mapType sensors_map_
map: sensor id –> DetGeomDesc
RPDeviceMapType::const_iterator CTPPSGeometry::beginRP ( ) const
inline

begin iterator over RPs

Definition at line 76 of file CTPPSGeometry.h.

References rps_map_.

Referenced by CTPPSGeometryInfo::printGeometry().

76 { return rps_map_.begin(); }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc
mapType::const_iterator CTPPSGeometry::beginSensor ( ) const
inline

begin iterator over sensors

Definition at line 71 of file CTPPSGeometry.h.

References sensors_map_.

Referenced by CTPPSGeometryInfo::printGeometry().

71 { return sensors_map_.begin(); }
mapType sensors_map_
map: sensor id –> DetGeomDesc
void CTPPSGeometry::build ( const DetGeomDesc gD)

build up from DetGeomDesc structure

Definition at line 14 of file CTPPSGeometry.cc.

References addRP(), addSensor(), CTPPSDetId::armId(), edmScanValgrind::buffer, AlCaHLTBitMon_QueryRunRegistry::comp, DetGeomDesc::components(), 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_, DetGeomDesc::geographicalID(), DetGeomDesc::name(), CTPPSDetId::rpId(), rps_in_station_, rps_map_, sensors_map_, CTPPSDetId::stationId(), and stations_in_arm_.

Referenced by CTPPSGeometry().

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 ||
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  }
56 }
const std::string DDD_CTPPS_PIXELS_RP_NAME
Definition: CTPPSDDDNames.h:22
DetId geographicalID() const
Definition: DetGeomDesc.h:53
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:25
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:78
const std::string DDD_CTPPS_DIAMONDS_SEGMENT_NAME
Definition: CTPPSDDDNames.h:16
CTPPSDetId stationId() const
Definition: CTPPSDetId.h:76
Geometrical description of a sensor.
Definition: DetGeomDesc.h:35
Container components() const
access to the tree structure
Definition: DetGeomDesc.cc:54
const std::string DDD_TOTEM_TIMING_SENSOR_TMPL
Definition: CTPPSDDDNames.h:18
CTPPSDetId armId() const
Definition: CTPPSDetId.h:74
d
Definition: ztail.py:151
const std::string & name() const
Definition: DetGeomDesc.h:66
const std::string DDD_TOTEM_RP_RP_NAME
DDD names of RP volumes.
Definition: CTPPSDDDNames.h:21
mapSetType rps_in_station_
const std::string DDD_CTPPS_DIAMONDS_RP_NAME
Definition: CTPPSDDDNames.h:24
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:17
RPDeviceMapType::const_iterator CTPPSGeometry::endRP ( ) const
inline

end iterator over RPs

Definition at line 78 of file CTPPSGeometry.h.

References globalToLocal(), globalToLocalDirection(), localToGlobal(), localToGlobalDirection(), rps_map_, rpsInStation(), rpTranslation(), sensorsInRP(), sensorTranslation(), and stationsInArm().

Referenced by CTPPSGeometryInfo::printGeometry().

78 { return rps_map_.end(); }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc
mapType::const_iterator CTPPSGeometry::endSensor ( ) const
inline

end iterator over sensors

Definition at line 73 of file CTPPSGeometry.h.

References sensors_map_.

Referenced by CTPPSGeometryInfo::printGeometry().

73 { return sensors_map_.end(); }
mapType sensors_map_
map: sensor id –> DetGeomDesc
CLHEP::Hep3Vector CTPPSGeometry::globalToLocal ( const DetGeomDesc gd,
const CLHEP::Hep3Vector &  r 
) const

Definition at line 159 of file CTPPSGeometry.cc.

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

Referenced by TotemRPDQMSource::analyze(), endRP(), globalToLocal(), and CTPPSDirectProtonSimulation::processProton().

159  {
160  return gd->rotation().Inverse() *
161  (r - CLHEP::Hep3Vector(gd->translation().x(), gd->translation().y(), gd->translation().z()));
162 }
Translation translation() const
Definition: DetGeomDesc.h:65
RotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:64
CLHEP::Hep3Vector CTPPSGeometry::globalToLocal ( unsigned int  id,
const CLHEP::Hep3Vector &  r 
) const

Definition at line 166 of file CTPPSGeometry.cc.

References globalToLocal(), and sensor().

166  {
167  return globalToLocal(sensor(id), r);
168 }
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
CLHEP::Hep3Vector globalToLocal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
CLHEP::Hep3Vector CTPPSGeometry::globalToLocalDirection ( unsigned int  id,
const CLHEP::Hep3Vector &  dir 
) const

direction transformations between global and local reference frames

Parameters
idsensor id

Definition at line 178 of file CTPPSGeometry.cc.

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

Referenced by endRP().

178  {
179  return sensor(id)->rotation().Inverse() * dir;
180 }
RotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:64
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
CLHEP::Hep3Vector CTPPSGeometry::localToGlobal ( const DetGeomDesc gd,
const CLHEP::Hep3Vector &  r 
) const

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

Definition at line 147 of file CTPPSGeometry.cc.

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

Referenced by RPixPlaneCombinatoryTracking::calculatePointOnDetector(), endRP(), RPixRoadFinder::findPattern(), localToGlobal(), CTPPSGeometryInfo::printGeometry(), and CTPPSDirectProtonSimulation::processProton().

147  {
148  return gd->rotation() * r + CLHEP::Hep3Vector(gd->translation().x(), gd->translation().y(), gd->translation().z());
149 }
Translation translation() const
Definition: DetGeomDesc.h:65
RotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:64
CLHEP::Hep3Vector CTPPSGeometry::localToGlobal ( unsigned int  id,
const CLHEP::Hep3Vector &  r 
) const

Definition at line 153 of file CTPPSGeometry.cc.

References localToGlobal(), and sensor().

153  {
154  return localToGlobal(sensor(id), r);
155 }
CLHEP::Hep3Vector localToGlobal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
CLHEP::Hep3Vector CTPPSGeometry::localToGlobalDirection ( unsigned int  id,
const CLHEP::Hep3Vector &  dir 
) const

direction transformations between local and global reference frames

Parameters
idsensor id

Definition at line 172 of file CTPPSGeometry.cc.

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

Referenced by TotemRPDQMSource::analyze(), endRP(), and TotemRPLocalTrackFitterAlgorithm::prepareReconstAlgebraData().

172  {
173  return sensor(id)->rotation() * dir;
174 }
RotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:64
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
const DetGeomDesc * CTPPSGeometry::rp ( unsigned int  id) const

returns geometry of a RP box

Definition at line 100 of file CTPPSGeometry.cc.

References Exception, and rpNoThrow().

Referenced by CTPPSGeometry(), TotemRPUVPatternFinder::produce(), and rpTranslation().

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;
106 }
const DetGeomDesc * rpNoThrow(unsigned int id) const
const DetGeomDesc * rp(unsigned int id) const
returns geometry of a RP box
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
const DetGeomDesc * CTPPSGeometry::rpNoThrow ( unsigned int  id) const

Definition at line 110 of file CTPPSGeometry.cc.

References rps_map_.

Referenced by CTPPSGeometry(), and rp().

110  {
111  auto it = rps_map_.find(id);
112  if (it == rps_map_.end()) {
113  return nullptr;
114  }
115 
116  return it->second;
117 }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc
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 129 of file CTPPSGeometry.cc.

References rps_in_station_.

Referenced by endRP().

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;
134 }
mapSetType rps_in_station_
CLHEP::Hep3Vector CTPPSGeometry::rpTranslation ( unsigned int  id) const

returns position of a RP box

Parameters
idRP id

Definition at line 191 of file CTPPSGeometry.cc.

References rp().

Referenced by TotemRPDQMSource::analyze(), endRP(), TotemRPLocalTrackFitter::produce(), CTPPSProtonProducer::produce(), and CTPPSPixelLocalTrackProducer::produce().

191  {
192  auto gd = rp(id);
193  return CLHEP::Hep3Vector(gd->translation().x(), gd->translation().y(), gd->translation().z());
194 }
const DetGeomDesc * rp(unsigned int id) const
returns geometry of a RP box
const DetGeomDesc * CTPPSGeometry::sensor ( unsigned int  id) const

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

Definition at line 80 of file CTPPSGeometry.cc.

References Exception, g, and sensorNoThrow().

Referenced by TotemRPDQMSource::analyze(), TotemTimingDQMSource::analyze(), CTPPSDiamondRecHitProducerAlgorithm::build(), RPixPlaneCombinatoryTracking::calculatePointOnDetector(), channelAlignedWithTrack(), CTPPSGeometry(), CTPPSDiamondDQMSource::dqmBeginRun(), RPixRoadFinder::findPattern(), RPixPlaneCombinatoryTracking::findTracks(), globalToLocal(), globalToLocalDirection(), localToGlobal(), localToGlobalDirection(), RPDisplacementGenerator::RPDisplacementGenerator(), and sensorTranslation().

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;
86 }
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
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
const DetGeomDesc * sensorNoThrow(unsigned int id) const
const DetGeomDesc * CTPPSGeometry::sensorNoThrow ( unsigned int  id) const

Definition at line 90 of file CTPPSGeometry.cc.

References sensors_map_.

Referenced by TotemTimingRecHitProducerAlgorithm::build(), CTPPSGeometry(), TotemTimingDQMSource::dqmBeginRun(), and sensor().

90  {
91  auto it = sensors_map_.find(id);
92  if (it == sensors_map_.end()) {
93  return nullptr;
94  }
95  return it->second;
96 }
mapType sensors_map_
map: sensor id –> DetGeomDesc
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 138 of file CTPPSGeometry.cc.

References dets_in_rp_.

Referenced by endRP(), and CTPPSDirectProtonSimulation::processProton().

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;
143 }
mapSetType dets_in_rp_
CLHEP::Hep3Vector CTPPSGeometry::sensorTranslation ( unsigned int  id) const

returns translation (position) of a detector

Parameters
idsensor id

Definition at line 184 of file CTPPSGeometry.cc.

References sensor().

Referenced by endRP(), and TotemRPLocalTrackFitterAlgorithm::prepareReconstAlgebraData().

184  {
185  auto gd = sensor(id);
186  return CLHEP::Hep3Vector(gd->translation().x(), gd->translation().y(), gd->translation().z());
187 }
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
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 120 of file CTPPSGeometry.cc.

References stations_in_arm_.

Referenced by endRP().

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;
125 }
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

mapSetType CTPPSGeometry::dets_in_rp_
protected

Definition at line 123 of file CTPPSGeometry.h.

Referenced by build(), and sensorsInRP().

mapSetType CTPPSGeometry::rps_in_station_
protected

Definition at line 123 of file CTPPSGeometry.h.

Referenced by build(), and rpsInStation().

RPDeviceMapType CTPPSGeometry::rps_map_
protected

map: rp id –> DetGeomDesc

Definition at line 119 of file CTPPSGeometry.h.

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

mapType CTPPSGeometry::sensors_map_
protected

map: sensor id –> DetGeomDesc

Definition at line 116 of file CTPPSGeometry.h.

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

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

Referenced by build(), and stationsInArm().