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 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()

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

build up from DetGeomDesc

Definition at line 42 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 81 of file CTPPSGeometry.cc.

82  {
83  if (rps_map_.find(id) != rps_map_.end())
84  return false;
85 
86  rps_map_[id] = gD;
87  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 71 of file CTPPSGeometry.cc.

72  {
73  if (sensors_map_.find(id) != sensors_map_.end())
74  return false;
75 
76  sensors_map_[id] = gD;
77  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 75 of file CTPPSGeometry.h.

◆ beginSensor()

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

begin iterator over sensors

Definition at line 70 of file CTPPSGeometry.h.

◆ build()

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

build up from DetGeomDesc structure

Definition at line 14 of file CTPPSGeometry.cc.

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  }

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_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, dets_in_rp_, year_2016_postTS2_cff::rpId, CTPPSDetId::rpId(), rps_in_station_, rps_map_, sensors_map_, CTPPSDetId::stationId(), stations_in_arm_, and HIPAlignmentAlgorithm_cfi::verbosity.

◆ endRP()

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

end iterator over RPs

Definition at line 77 of file CTPPSGeometry.h.

◆ endSensor()

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

end iterator over sensors

Definition at line 72 of file CTPPSGeometry.h.

72 { return rps_map_.begin(); }

References rps_map_.

◆ globalToLocal() [1/2]

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

Definition at line 170 of file CTPPSGeometry.cc.

171  {
172  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 176 of file CTPPSGeometry.cc.

177  {
178  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 188 of file CTPPSGeometry.cc.

189  {
190  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 158 of file CTPPSGeometry.cc.

159  {
160  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 164 of file CTPPSGeometry.cc.

165  {
166  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 182 of file CTPPSGeometry.cc.

183  {
184  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 111 of file CTPPSGeometry.cc.

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;

References Exception, and rpNoThrow().

Referenced by rpTranslation().

◆ rpNoThrow()

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

Definition at line 121 of file CTPPSGeometry.cc.

122  {
123  auto it = rps_map_.find(id);
124  if (it == rps_map_.end()) {
125  return nullptr;
126  }
127 
128  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 140 of file CTPPSGeometry.cc.

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;

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

202  {
203  auto gd = rp(id);
204  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 91 of file CTPPSGeometry.cc.

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;

References Exception, g, and sensorNoThrow().

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

◆ sensorNoThrow()

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

Definition at line 101 of file CTPPSGeometry.cc.

102  {
103  auto it = sensors_map_.find(id);
104  if (it == sensors_map_.end()) {
105  return nullptr;
106  }
107  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 149 of file CTPPSGeometry.cc.

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;

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

195  {
196  auto gd = sensor(id);
197  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 131 of file CTPPSGeometry.cc.

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;

References stations_in_arm_.

Member Data Documentation

◆ dets_in_rp_

mapSetType CTPPSGeometry::dets_in_rp_
protected

Definition at line 122 of file CTPPSGeometry.h.

Referenced by build(), and sensorsInRP().

◆ rps_in_station_

mapSetType CTPPSGeometry::rps_in_station_
protected

Definition at line 122 of file CTPPSGeometry.h.

Referenced by build(), and rpsInStation().

◆ rps_map_

RPDeviceMapType CTPPSGeometry::rps_map_
protected

map: rp id --> DetGeomDesc

Definition at line 118 of file CTPPSGeometry.h.

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

◆ sensors_map_

mapType CTPPSGeometry::sensors_map_
protected

map: sensor id --> DetGeomDesc

Definition at line 115 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 122 of file CTPPSGeometry.h.

Referenced by build(), and stationsInArm().

HIPAlignmentAlgorithm_cfi.verbosity
verbosity
Definition: HIPAlignmentAlgorithm_cfi.py:7
CTPPSGeometry::globalToLocal
Vector globalToLocal(const DetGeomDesc *, const Vector &) const
Definition: CTPPSGeometry.cc:170
DDD_CTPPS_UFSD_SEGMENT_NAME
const std::string DDD_CTPPS_UFSD_SEGMENT_NAME
Definition: CTPPSDDDNames.h:18
DDD_CTPPS_PIXELS_SENSOR_NAME
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME
Definition: CTPPSDDDNames.h:14
DetGeomDesc::translation
const Translation & translation() const
Definition: DetGeomDesc.h:73
DDD_CTPPS_PIXELS_RP_NAME
const std::string DDD_CTPPS_PIXELS_RP_NAME
Definition: CTPPSDDDNames.h:23
DDD_TOTEM_TIMING_RP_NAME
const std::string DDD_TOTEM_TIMING_RP_NAME
Definition: CTPPSDDDNames.h:26
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:17
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:122
CTPPSGeometry::sensors_map_
mapType sensors_map_
map: sensor id --> DetGeomDesc
Definition: CTPPSGeometry.h:115
DDD_CTPPS_PIXELS_SENSOR_NAME_2x2
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME_2x2
Definition: CTPPSDDDNames.h:15
CTPPSGeometry::sensorNoThrow
const DetGeomDesc * sensorNoThrow(unsigned int id) const noexcept
Definition: CTPPSGeometry.cc:101
CTPPSGeometry::dets_in_rp_
mapSetType dets_in_rp_
Definition: CTPPSGeometry.h:122
DDD_CTPPS_DIAMONDS_RP_NAME
const std::string DDD_CTPPS_DIAMONDS_RP_NAME
Definition: CTPPSDDDNames.h:25
CTPPSGeometry::rps_map_
RPDeviceMapType rps_map_
map: rp id --> DetGeomDesc
Definition: CTPPSGeometry.h:118
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:19
DetGeomDesc
Definition: DetGeomDesc.h:49
CTPPSGeometry::rpNoThrow
const DetGeomDesc * rpNoThrow(unsigned int id) const noexcept
Definition: CTPPSGeometry.cc:121
DDD_TOTEM_RP_RP_NAME
const std::string DDD_TOTEM_RP_RP_NAME
DDD names of RP volumes.
Definition: CTPPSDDDNames.h:22
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:81
CTPPSGeometry::addSensor
bool addSensor(unsigned int, const DetGeomDesc *&)
adds an item to the map (detector ID --> DetGeomDesc) performs necessary checks
Definition: CTPPSGeometry.cc:71
CTPPSDetId::stationId
CTPPSDetId stationId() const
Definition: CTPPSDetId.h:80
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
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:111
ztail.d
d
Definition: ztail.py:151
cms::Exception
Definition: Exception.h:70
DetGeomDesc::rotation
const RotationMatrix & rotation() const
Definition: DetGeomDesc.h:74
CTPPSGeometry::localToGlobal
Vector localToGlobal(const DetGeomDesc *, const Vector &) const
Definition: CTPPSGeometry.cc:158
CTPPSGeometry::rps_in_station_
mapSetType rps_in_station_
Definition: CTPPSGeometry.h:122
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:91
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23