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...
 
const DetGeomDescgetRP (unsigned int id) const
 returns geometry of a RP box More...
 
const DetGeomDescgetRPNoThrow (unsigned int id) const
 
const std::set< unsigned int > & getRPsInStation (unsigned int) const
 after checks returns set of RP ids corresponding to the given station id More...
 
CLHEP::Hep3Vector getRPTranslation (unsigned int id) const
 
const DetGeomDescgetSensor (unsigned int id) const
 returns geometry of a detector performs necessary checks, returns NULL if fails More...
 
const DetGeomDescgetSensorNoThrow (unsigned int id) const
 
const std::set< unsigned int > & getSensorsInRP (unsigned int) const
 after checks returns set of sensor ids corresponding to the given RP id More...
 
CLHEP::Hep3Vector getSensorTranslation (unsigned int id) const
 
const std::set< unsigned int > & getStationsInArm (unsigned int) const
 after checks returns set of station ids corresponding to the given arm id 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
 
 ~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 38 of file CTPPSGeometry.h.

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

Definition at line 36 of file CTPPSGeometry.h.

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

Definition at line 37 of file CTPPSGeometry.h.

Constructor & Destructor Documentation

CTPPSGeometry::CTPPSGeometry ( )
inline

Definition at line 40 of file CTPPSGeometry.h.

40 {}
CTPPSGeometry::~CTPPSGeometry ( )
inline

Definition at line 41 of file CTPPSGeometry.h.

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

build up from DetGeomDesc

Definition at line 44 of file CTPPSGeometry.h.

References addRP(), addSensor(), build(), getRP(), getRPNoThrow(), getSensor(), getSensorNoThrow(), and noexcept.

44 { 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 77 of file CTPPSGeometry.cc.

References triggerObjects_cff::id, and rps_map_.

Referenced by build(), and CTPPSGeometry().

78 {
79  if ( rps_map_.find( id ) != rps_map_.end() ) return false;
80 
81  rps_map_[id] = const_cast<DetGeomDesc*>( gD );
82  return true;
83 }
Geometrical description of a sensor.
Definition: DetGeomDesc.h:37
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 66 of file CTPPSGeometry.cc.

References triggerObjects_cff::id, and sensors_map_.

Referenced by build(), and CTPPSGeometry().

67 {
68  if ( sensors_map_.find( id ) != sensors_map_.end() ) return false;
69 
70  sensors_map_[id] = gD;
71  return true;
72 }
mapType sensors_map_
map: sensor id –> DetGeomDesc
RPDeviceMapType::const_iterator CTPPSGeometry::beginRP ( ) const
inline

begin iterator over RPs

Definition at line 77 of file CTPPSGeometry.h.

References rps_map_.

Referenced by CTPPSGeometryInfo::printGeometry().

77 { 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 72 of file CTPPSGeometry.h.

References sensors_map_.

Referenced by CTPPSGeometryInfo::printGeometry().

72 { 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 15 of file CTPPSGeometry.cc.

References addRP(), addSensor(), edmScanValgrind::buffer, AlCaHLTBitMon_QueryRunRegistry::comp, DetGeomDesc::components(), edmIntegrityCheck::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(), CTPPSDetId::getArmId(), CTPPSDetId::getRPId(), CTPPSDetId::getStationId(), DDName::name(), DetGeomDesc::name(), rps_in_station_, rps_map_, sensors_map_, and stations_in_arm_.

Referenced by CTPPSGeometry().

16 {
17  // reset
18  sensors_map_.clear();
19  rps_map_.clear();
20  stations_in_arm_.clear();
21  rps_in_station_.clear();
22  dets_in_rp_.clear();
23 
24  // propagate through the GeometricalDet structure and add all detectors to 'sensors_map_'
25  std::deque<const DetGeomDesc *> buffer;
26  buffer.emplace_back(gD);
27  while ( !buffer.empty() ) {
28  const DetGeomDesc *d = buffer.front();
29  buffer.pop_front();
30 
31  // check if it is a sensor
32  if ( d->name().name() == DDD_TOTEM_RP_SENSOR_NAME
33  || std::regex_match( d->name().name(), std::regex( DDD_TOTEM_TIMING_SENSOR_TMPL ) )
37  addSensor( d->geographicalID(), d );
38 
39  // check if it is a RP
40  if ( d->name().name() == DDD_TOTEM_RP_RP_NAME
43  || d->name().name() == DDD_CTPPS_PIXELS_RP_NAME )
44  addRP( d->geographicalID(), d );
45 
46  for ( const auto& comp : d->components() )
47  buffer.emplace_back( comp );
48  }
49 
50  // build sets
51  for ( const auto& it : sensors_map_ ) {
52  const CTPPSDetId detId( it.first );
53  const CTPPSDetId rpId = detId.getRPId();
54  const CTPPSDetId stId = detId.getStationId();
55  const CTPPSDetId armId = detId.getArmId();
56 
57  stations_in_arm_[armId].insert( armId );
58  rps_in_station_[stId].insert( rpId );
59  dets_in_rp_[rpId].insert( detId );
60  }
61 }
const std::string DDD_CTPPS_PIXELS_RP_NAME
Definition: CTPPSDDDNames.h:22
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...
CTPPSDetId getStationId() const
Definition: CTPPSDetId.h:92
const std::string DDD_TOTEM_TIMING_RP_NAME
Definition: CTPPSDDDNames.h:24
const std::string DDD_CTPPS_DIAMONDS_SEGMENT_NAME
Definition: CTPPSDDDNames.h:16
virtual ConstContainer components() const
access to the tree structure
Definition: DetGeomDesc.cc:123
Geometrical description of a sensor.
Definition: DetGeomDesc.h:37
CTPPSDetId getRPId() const
Definition: CTPPSDetId.h:97
DDName name() const
Definition: DetGeomDesc.h:87
const std::string DDD_TOTEM_TIMING_SENSOR_TMPL
Definition: CTPPSDDDNames.h:18
CTPPSDetId getArmId() const
Definition: CTPPSDetId.h:87
const std::string DDD_TOTEM_RP_RP_NAME
DDD names of RP volumes.
Definition: CTPPSDDDNames.h:21
mapSetType rps_in_station_
virtual DetId geographicalID() const
Definition: DetGeomDesc.h:61
const std::string DDD_CTPPS_DIAMONDS_RP_NAME
Definition: CTPPSDDDNames.h:23
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
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
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 79 of file CTPPSGeometry.h.

References getRPsInStation(), getRPTranslation(), getSensorsInRP(), getSensorTranslation(), getStationsInArm(), globalToLocal(), globalToLocalDirection(), localToGlobal(), localToGlobalDirection(), and rps_map_.

Referenced by CTPPSGeometryInfo::printGeometry().

79 { 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 74 of file CTPPSGeometry.h.

References sensors_map_.

Referenced by CTPPSGeometryInfo::printGeometry().

74 { return sensors_map_.end(); }
mapType sensors_map_
map: sensor id –> DetGeomDesc
const DetGeomDesc * CTPPSGeometry::getRP ( unsigned int  id) const

returns geometry of a RP box

Definition at line 113 of file CTPPSGeometry.cc.

References Exception, and getRPNoThrow().

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

114 {
115  auto rp = getRPNoThrow(id);
116  if(nullptr == rp) {
117  throw cms::Exception("CTPPSGeometry") << "Not found RP device with ID " << id << ", i.e. "
118  << CTPPSDetId( id );
119  }
120  return rp;
121 }
const DetGeomDesc * getRPNoThrow(unsigned int id) const
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
const DetGeomDesc * CTPPSGeometry::getRPNoThrow ( unsigned int  id) const

Definition at line 126 of file CTPPSGeometry.cc.

References rps_map_.

Referenced by CTPPSGeometry(), and getRP().

127 {
128  auto it = rps_map_.find( id );
129  if ( it == rps_map_.end() ) {
130  return nullptr;
131  }
132 
133  return it->second;
134 }
RPDeviceMapType rps_map_
map: rp id –> DetGeomDesc
const std::set< unsigned int > & CTPPSGeometry::getRPsInStation ( unsigned int  id) const

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

Definition at line 149 of file CTPPSGeometry.cc.

References rps_in_station_.

Referenced by endRP().

150 {
151  auto it = rps_in_station_.find( id );
152  if ( it == rps_in_station_.end() )
153  throw cms::Exception("CTPPSGeometry") << "Station with ID " << id << " not found.";
154  return it->second;
155 }
mapSetType rps_in_station_
CLHEP::Hep3Vector CTPPSGeometry::getRPTranslation ( unsigned int  id) const

returns position of a RP box

Parameters
idRP id

Definition at line 228 of file CTPPSGeometry.cc.

References getRP().

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

229 {
230  auto gd = getRP( id );
231  return CLHEP::Hep3Vector( gd->translation().x(), gd->translation().y(), gd->translation().z() );
232 }
const DetGeomDesc * getRP(unsigned int id) const
returns geometry of a RP box
const DetGeomDesc * CTPPSGeometry::getSensor ( unsigned int  id) const

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

Definition at line 88 of file CTPPSGeometry.cc.

References Exception, g, and getSensorNoThrow().

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

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

Definition at line 101 of file CTPPSGeometry.cc.

References sensors_map_.

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

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
const std::set< unsigned int > & CTPPSGeometry::getSensorsInRP ( unsigned int  id) const

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

Definition at line 160 of file CTPPSGeometry.cc.

References dets_in_rp_.

Referenced by endRP().

161 {
162  auto it = dets_in_rp_.find( id );
163  if ( it == dets_in_rp_.end() )
164  throw cms::Exception("CTPPSGeometry") << "RP with ID " << id << " not found.";
165  return it->second;
166 }
mapSetType dets_in_rp_
CLHEP::Hep3Vector CTPPSGeometry::getSensorTranslation ( unsigned int  id) const

returns translation (position) of a detector

Parameters
idsensor id

Definition at line 219 of file CTPPSGeometry.cc.

References getSensor().

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

220 {
221  auto gd = getSensor( id );
222  return CLHEP::Hep3Vector( gd->translation().x(), gd->translation().y(), gd->translation().z() );
223 }
const DetGeomDesc * getSensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
const std::set< unsigned int > & CTPPSGeometry::getStationsInArm ( unsigned int  id) const

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

Definition at line 138 of file CTPPSGeometry.cc.

References stations_in_arm_.

Referenced by endRP().

139 {
140  auto it = stations_in_arm_.find( id );
141  if ( it == stations_in_arm_.end() )
142  throw cms::Exception("CTPPSGeometry") << "Arm with ID " << id << " not found.";
143  return it->second;
144 }
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...
CLHEP::Hep3Vector CTPPSGeometry::globalToLocal ( const DetGeomDesc gd,
const CLHEP::Hep3Vector &  r 
) const

Definition at line 187 of file CTPPSGeometry.cc.

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

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

188 {
189  return gd->rotation().Inverse() * ( r - CLHEP::Hep3Vector( gd->translation().x(), gd->translation().y(), gd->translation().z() ) );
190 }
DDRotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:83
DDTranslation translation() const
Definition: DetGeomDesc.h:84
CLHEP::Hep3Vector CTPPSGeometry::globalToLocal ( unsigned int  id,
const CLHEP::Hep3Vector &  r 
) const

Definition at line 195 of file CTPPSGeometry.cc.

References getSensor(), and globalToLocal().

196 {
197  return globalToLocal( getSensor( id ), r );
198 }
const DetGeomDesc * getSensor(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 211 of file CTPPSGeometry.cc.

References dir, getSensor(), and DetGeomDesc::rotation().

Referenced by endRP().

212 {
213  return getSensor( id )->rotation().Inverse() * dir;
214 }
DDRotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:83
const DetGeomDesc * getSensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
dbl *** dir
Definition: mlp_gen.cc:35
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 171 of file CTPPSGeometry.cc.

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

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

172 {
173  return gd->rotation() * r + CLHEP::Hep3Vector( gd->translation().x(), gd->translation().y(), gd->translation().z() );
174 }
DDRotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:83
DDTranslation translation() const
Definition: DetGeomDesc.h:84
CLHEP::Hep3Vector CTPPSGeometry::localToGlobal ( unsigned int  id,
const CLHEP::Hep3Vector &  r 
) const

Definition at line 179 of file CTPPSGeometry.cc.

References getSensor(), and localToGlobal().

180 {
181  return localToGlobal( getSensor( id ), r );
182 }
const DetGeomDesc * getSensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
CLHEP::Hep3Vector localToGlobal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
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 203 of file CTPPSGeometry.cc.

References dir, getSensor(), and DetGeomDesc::rotation().

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

204 {
205  return getSensor( id )->rotation() * dir;
206 }
DDRotationMatrix rotation() const
geometry information
Definition: DetGeomDesc.h:83
const DetGeomDesc * getSensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
dbl *** dir
Definition: mlp_gen.cc:35

Member Data Documentation

mapSetType CTPPSGeometry::dets_in_rp_
protected

Definition at line 124 of file CTPPSGeometry.h.

Referenced by build(), and getSensorsInRP().

mapSetType CTPPSGeometry::rps_in_station_
protected

Definition at line 124 of file CTPPSGeometry.h.

Referenced by build(), and getRPsInStation().

RPDeviceMapType CTPPSGeometry::rps_map_
protected

map: rp id –> DetGeomDesc

Definition at line 120 of file CTPPSGeometry.h.

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

mapType CTPPSGeometry::sensors_map_
protected

map: sensor id –> DetGeomDesc

Definition at line 117 of file CTPPSGeometry.h.

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

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

Referenced by build(), and getStationsInArm().