CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GlobalTrackingGeometry Class Reference

#include <GlobalTrackingGeometry.h>

Inheritance diagram for GlobalTrackingGeometry:
TrackingGeometry

Public Member Functions

const DetIdContainerdetIds () const override
 Returm a vector of all GeomDet DetIds (including those of GeomDetUnits) More...
 
const DetContainerdets () const override
 Returm a vector of all GeomDet (including all GeomDetUnits) More...
 
const DetTypeContainerdetTypes () const override
 Return a vector of all det types. More...
 
const DetIdContainerdetUnitIds () const override
 Returm a vector of all GeomDetUnit DetIds. More...
 
const DetContainerdetUnits () const override
 Returm a vector of all GeomDet. More...
 
 GlobalTrackingGeometry (std::vector< const TrackingGeometry * > &geos)
 
const GeomDetidToDet (DetId) const override
 
const GeomDetidToDetUnit (DetId) const override
 Return the pointer to the GeomDetUnit corresponding to a given DetId. More...
 
const TrackingGeometryslaveGeometry (DetId id) const
 Return the pointer to the actual geometry for a given DetId. More...
 
 ~GlobalTrackingGeometry () override
 
- Public Member Functions inherited from TrackingGeometry
virtual ~TrackingGeometry ()
 Destructor. More...
 

Private Attributes

std::atomic< DetIdContainer * > theDetIds
 
std::atomic< DetContainer * > theDets
 
std::atomic< DetTypeContainer * > theDetTypes
 
std::atomic< DetIdContainer * > theDetUnitIds
 
std::atomic< DetContainer * > theDetUnits
 
std::vector< const TrackingGeometry * > theGeometries
 

Additional Inherited Members

- Public Types inherited from TrackingGeometry
using DetContainer = std::vector< const GeomDet * >
 
using DetIdContainer = std::vector< DetId >
 
using DetTypeContainer = std::vector< const GeomDetType * >
 
using mapIdToDet = std::unordered_map< unsigned int, const GeomDet * >
 
using mapIdToDetUnit = std::unordered_map< unsigned int, const GeomDet * >
 

Detailed Description

Single entry point to the tracker and muon geometries. The main purpose is to provide the methods idToDetUnit(DetId) and idToDet(DetId) that allow to get an element of the geometry given its DetId, regardless of wich subdetector it belongs.

The slave geometries (TrackerGeometry, MTDGeometry, DTGeometry, CSCGeometry, RPCGeometry, GEMGeometry, ME0Geometry) are accessible with the method slaveGeometry(DetId).

Author
M. Sani

ESProducer for GlobalTrackingGeometry in MuonGeometryRecord

Author
Matteo Sani

Definition at line 20 of file GlobalTrackingGeometry.h.

Constructor & Destructor Documentation

◆ GlobalTrackingGeometry()

GlobalTrackingGeometry::GlobalTrackingGeometry ( std::vector< const TrackingGeometry * > &  geos)

Definition at line 13 of file GlobalTrackingGeometry.cc.

14  : theGeometries(geos),
15  theDetTypes(nullptr),
16  theDetUnits(nullptr),
17  theDets(nullptr),
18  theDetUnitIds(nullptr),
19  theDetIds(nullptr) {}

◆ ~GlobalTrackingGeometry()

GlobalTrackingGeometry::~GlobalTrackingGeometry ( )
override

Definition at line 21 of file GlobalTrackingGeometry.cc.

21  {
22  delete theDetTypes.load();
23  theDetTypes = nullptr;
24  delete theDetUnits.load();
25  theDetUnits = nullptr;
26  delete theDets.load();
27  theDets = nullptr;
28  delete theDetUnitIds.load();
29  theDetUnitIds = nullptr;
30  delete theDetIds.load();
31  theDetIds = nullptr;
32 }

References theDetIds, theDets, theDetTypes, theDetUnitIds, and theDetUnits.

Member Function Documentation

◆ detIds()

const TrackingGeometry::DetIdContainer & GlobalTrackingGeometry::detIds ( ) const
overridevirtual

Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)

Implements TrackingGeometry.

Definition at line 149 of file GlobalTrackingGeometry.cc.

149  {
150  if (!theDetIds.load(std::memory_order_acquire)) {
151  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
152  for (auto theGeometrie : theGeometries) {
153  if (theGeometrie == nullptr)
154  continue;
155  DetIdContainer detIds(theGeometrie->detIds());
156  if (detIds.size() + ptr->size() < ptr->capacity())
157  ptr->resize(detIds.size() + ptr->size());
158  for (auto detId : detIds)
159  ptr->emplace_back(detId);
160  }
161  DetIdContainer* expect = nullptr;
162  if (theDetIds.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
163  ptr.release();
164  }
165  }
166  return *theDetIds.load(std::memory_order_acquire);
167 }

References theDetIds, and theGeometries.

◆ dets()

const TrackingGeometry::DetContainer & GlobalTrackingGeometry::dets ( ) const
overridevirtual

Returm a vector of all GeomDet (including all GeomDetUnits)

Implements TrackingGeometry.

Definition at line 109 of file GlobalTrackingGeometry.cc.

109  {
110  if (!theDets.load(std::memory_order_acquire)) {
111  std::unique_ptr<DetContainer> ptr{new DetContainer()};
112  for (auto theGeometrie : theGeometries) {
113  if (theGeometrie == nullptr)
114  continue;
115  DetContainer dets(theGeometrie->dets());
116  if (dets.size() + ptr->size() < ptr->capacity())
117  ptr->resize(dets.size() + ptr->size());
118  for (auto det : dets)
119  ptr->emplace_back(det);
120  }
121  DetContainer* expect = nullptr;
122  if (theDets.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
123  ptr.release();
124  }
125  }
126  return *theDets.load(std::memory_order_acquire);
127 }

References theDets, and theGeometries.

◆ detTypes()

const TrackingGeometry::DetTypeContainer & GlobalTrackingGeometry::detTypes ( ) const
overridevirtual

Return a vector of all det types.

Implements TrackingGeometry.

Definition at line 69 of file GlobalTrackingGeometry.cc.

69  {
70  if (!theDetTypes.load(std::memory_order_acquire)) {
71  std::unique_ptr<DetTypeContainer> ptr{new DetTypeContainer()};
72  for (auto theGeometrie : theGeometries) {
73  if (theGeometrie == nullptr)
74  continue;
75  DetTypeContainer detTypes(theGeometrie->detTypes());
76  if (detTypes.size() + ptr->size() < ptr->capacity())
77  ptr->resize(detTypes.size() + ptr->size());
78  for (auto detType : detTypes)
79  ptr->emplace_back(detType);
80  }
81  DetTypeContainer* expect = nullptr;
82  if (theDetTypes.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
83  ptr.release();
84  }
85  }
86  return *theDetTypes.load(std::memory_order_acquire);
87 }

References theDetTypes, and theGeometries.

◆ detUnitIds()

const TrackingGeometry::DetIdContainer & GlobalTrackingGeometry::detUnitIds ( ) const
overridevirtual

Returm a vector of all GeomDetUnit DetIds.

Implements TrackingGeometry.

Definition at line 129 of file GlobalTrackingGeometry.cc.

129  {
130  if (!theDetUnitIds.load(std::memory_order_acquire)) {
131  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
132  for (auto theGeometrie : theGeometries) {
133  if (theGeometrie == nullptr)
134  continue;
135  DetIdContainer detUnitIds(theGeometrie->detUnitIds());
136  if (detUnitIds.size() + ptr->size() < ptr->capacity())
137  ptr->resize(detUnitIds.size() + ptr->size());
138  for (auto detUnitId : detUnitIds)
139  ptr->emplace_back(detUnitId);
140  }
141  DetIdContainer* expect = nullptr;
142  if (theDetUnitIds.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
143  ptr.release();
144  }
145  }
146  return *theDetUnitIds.load(std::memory_order_acquire);
147 }

References theDetUnitIds, and theGeometries.

◆ detUnits()

const TrackingGeometry::DetContainer & GlobalTrackingGeometry::detUnits ( ) const
overridevirtual

Returm a vector of all GeomDet.

Implements TrackingGeometry.

Definition at line 89 of file GlobalTrackingGeometry.cc.

89  {
90  if (!theDetUnits.load(std::memory_order_acquire)) {
91  std::unique_ptr<DetContainer> ptr{new DetContainer()};
92  for (auto theGeometrie : theGeometries) {
93  if (theGeometrie == nullptr)
94  continue;
95  DetContainer detUnits(theGeometrie->detUnits());
96  if (detUnits.size() + ptr->size() < ptr->capacity())
97  ptr->resize(detUnits.size() + ptr->size());
98  for (auto detUnit : detUnits)
99  ptr->emplace_back(detUnit);
100  }
101  DetContainer* expect = nullptr;
102  if (theDetUnits.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
103  ptr.release();
104  }
105  }
106  return *theDetUnits.load(std::memory_order_acquire);
107 }

References theDetUnits, and theGeometries.

◆ idToDet()

const GeomDet * GlobalTrackingGeometry::idToDet ( DetId  ) const
overridevirtual

Return the pointer to the GeomDet corresponding to a given DetId (valid also for GeomDetUnits)

Implements TrackingGeometry.

Definition at line 44 of file GlobalTrackingGeometry.cc.

44  {
45  const TrackingGeometry* tg = slaveGeometry(id);
46 
47  if (tg != nullptr) {
48  return tg->idToDet(id);
49  } else {
50  return nullptr;
51  }
52 }

References TrackingGeometry::idToDet(), and slaveGeometry().

Referenced by MuonDT2ChamberResidual::addResidual(), MuonCSCChamberResidual::addResidual(), MuonDT13ChamberResidual::addResidual(), MuonAlignmentAnalyzer::analyze(), MuonIdVal::analyze(), SegmentToTrackAssociator::associate(), SegmentsTrackAssociator::associate(), MuonTransientTrackingRecHitBuilder::build(), reco::helper::JetMuonHitsIDHelper::calculate(), TrackTransformer::checkRecHitsOrdering(), ResidualRefitting::CollectTrackHits(), OutsideInMuonSeeder::doDebug(), MuonAlignmentAnalyzer::doMatching(), CSCTimingExtractor::fillTiming(), DTTimingExtractor::fillTiming(), MuonDetIdAssociator::getDetIdPoints(), MuonDetIdAssociator::getGeomDet(), GlobalTrajectoryBuilderBase::getTransientRecHits(), MuonChamberResidual::hitposition(), MuonDetIdAssociator::insideElement(), MuonCosmicCompatibilityFiller::isOverlappingMuon(), CosmicParametersDefinerForTP::momentum(), MuonCSCChamberResidual::MuonCSCChamberResidual(), MuonDT13ChamberResidual::MuonDT13ChamberResidual(), MuonDT2ChamberResidual::MuonDT2ChamberResidual(), MuonResidualsFromTrack::MuonResidualsFromTrack(), MuonTrackCSCChamberResidual::MuonTrackCSCChamberResidual(), MuonTrackDT13ChamberResidual::MuonTrackDT13ChamberResidual(), MuonTrackDT2ChamberResidual::MuonTrackDT2ChamberResidual(), MuonSeedCleaner::NChi2OfSegment(), ResidualRefitting::NewTrackMeasurements(), MuonSeedCleaner::NRecHitsFromSegment(), CosmicTrackingParticleSelector::operator()(), MuonTrackResidualAnalyzer::RadiusComparatorInOut::operator()(), MuonSeedCleaner::OverlapSegments(), GlobalMuonToMuonProducer::printTrackRecHits(), MuonMillepedeTrackRefitter::produce(), MuonSeedCleaner::SeedCandidates(), MuonSeedCleaner::SeedMomentum(), MuonSeedCleaner::SeedPosition(), SeedToTrackProducer::seedTransientState(), ExhaustiveMuonTrajectoryBuilder::trajectories(), ResidualRefitting::trkExtrap(), and CosmicParametersDefinerForTP::vertex().

◆ idToDetUnit()

const GeomDet * GlobalTrackingGeometry::idToDetUnit ( DetId  ) const
overridevirtual

Return the pointer to the GeomDetUnit corresponding to a given DetId.

Implements TrackingGeometry.

Definition at line 34 of file GlobalTrackingGeometry.cc.

34  {
35  const TrackingGeometry* tg = slaveGeometry(id);
36 
37  if (tg != nullptr) {
38  return tg->idToDetUnit(id);
39  } else {
40  return nullptr;
41  }
42 }

References TrackingGeometry::idToDetUnit(), and slaveGeometry().

◆ slaveGeometry()

const TrackingGeometry * GlobalTrackingGeometry::slaveGeometry ( DetId  id) const

Member Data Documentation

◆ theDetIds

std::atomic<DetIdContainer*> GlobalTrackingGeometry::theDetIds
mutableprivate

Definition at line 61 of file GlobalTrackingGeometry.h.

Referenced by detIds(), and ~GlobalTrackingGeometry().

◆ theDets

std::atomic<DetContainer*> GlobalTrackingGeometry::theDets
mutableprivate

Definition at line 59 of file GlobalTrackingGeometry.h.

Referenced by dets(), and ~GlobalTrackingGeometry().

◆ theDetTypes

std::atomic<DetTypeContainer*> GlobalTrackingGeometry::theDetTypes
mutableprivate

Definition at line 57 of file GlobalTrackingGeometry.h.

Referenced by detTypes(), and ~GlobalTrackingGeometry().

◆ theDetUnitIds

std::atomic<DetIdContainer*> GlobalTrackingGeometry::theDetUnitIds
mutableprivate

Definition at line 60 of file GlobalTrackingGeometry.h.

Referenced by detUnitIds(), and ~GlobalTrackingGeometry().

◆ theDetUnits

std::atomic<DetContainer*> GlobalTrackingGeometry::theDetUnits
mutableprivate

Definition at line 58 of file GlobalTrackingGeometry.h.

Referenced by detUnits(), and ~GlobalTrackingGeometry().

◆ theGeometries

std::vector<const TrackingGeometry*> GlobalTrackingGeometry::theGeometries
private

Definition at line 52 of file GlobalTrackingGeometry.h.

Referenced by detIds(), dets(), detTypes(), detUnitIds(), detUnits(), and slaveGeometry().

GlobalTrackingGeometry::theDetUnitIds
std::atomic< DetIdContainer * > theDetUnitIds
Definition: GlobalTrackingGeometry.h:60
GlobalTrackingGeometry::detIds
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: GlobalTrackingGeometry.cc:149
TrackingGeometry
Definition: TrackingGeometry.h:26
GlobalTrackingGeometry::theGeometries
std::vector< const TrackingGeometry * > theGeometries
Definition: GlobalTrackingGeometry.h:52
GlobalTrackingGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: GlobalTrackingGeometry.cc:109
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
GlobalTrackingGeometry::theDetIds
std::atomic< DetIdContainer * > theDetIds
Definition: GlobalTrackingGeometry.h:61
GlobalTrackingGeometry::theDets
std::atomic< DetContainer * > theDets
Definition: GlobalTrackingGeometry.h:59
GlobalTrackingGeometry::theDetTypes
std::atomic< DetTypeContainer * > theDetTypes
Definition: GlobalTrackingGeometry.h:57
TrackingGeometry::idToDet
virtual const GeomDet * idToDet(DetId) const =0
GlobalTrackingGeometry::detUnitIds
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: GlobalTrackingGeometry.cc:129
TrackingGeometry::DetTypeContainer
std::vector< const GeomDetType * > DetTypeContainer
Definition: TrackingGeometry.h:28
TrackingGeometry::DetIdContainer
std::vector< DetId > DetIdContainer
Definition: TrackingGeometry.h:30
TrackingGeometry::DetContainer
std::vector< const GeomDet * > DetContainer
Definition: TrackingGeometry.h:29
FastTime
Definition: ForwardSubdetector.h:6
GlobalTrackingGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: GlobalTrackingGeometry.cc:89
GlobalTrackingGeometry::theDetUnits
std::atomic< DetContainer * > theDetUnits
Definition: GlobalTrackingGeometry.h:58
GlobalTrackingGeometry::slaveGeometry
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
Definition: GlobalTrackingGeometry.cc:54
GlobalTrackingGeometry::detTypes
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: GlobalTrackingGeometry.cc:69
Exception
Definition: hltDiff.cc:246
TrackingGeometry::idToDetUnit
virtual const GeomDet * idToDetUnit(DetId) const =0
Return the pointer to the GeomDetUnit corresponding to a given DetId.
DetId::Muon
Definition: DetId.h:26
DetId::Forward
Definition: DetId.h:30