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) {}
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetIdContainer * > theDetUnitIds
std::atomic< DetContainer * > theDets
std::atomic< DetIdContainer * > theDetIds
std::atomic< DetTypeContainer * > theDetTypes
std::atomic< DetContainer * > theDetUnits

◆ ~GlobalTrackingGeometry()

GlobalTrackingGeometry::~GlobalTrackingGeometry ( )
override

Definition at line 21 of file GlobalTrackingGeometry.cc.

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

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 }
std::atomic< DetIdContainer * > theDetUnitIds
std::atomic< DetContainer * > theDets
std::atomic< DetIdContainer * > theDetIds
std::atomic< DetTypeContainer * > theDetTypes
std::atomic< DetContainer * > 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.

References hcalRecHitTable_cff::detId, theDetIds, and theGeometries.

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 }
std::vector< const TrackingGeometry * > theGeometries
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
std::atomic< DetIdContainer * > theDetIds
std::vector< DetId > DetIdContainer

◆ 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.

References theDets, and theGeometries.

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 }
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetContainer * > theDets
std::vector< const GeomDet * > DetContainer

◆ 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.

References theDetTypes, and theGeometries.

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 }
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetTypeContainer * > theDetTypes
std::vector< const GeomDetType * > DetTypeContainer
const DetTypeContainer & detTypes() const override
Return a vector of all det types.

◆ 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.

References theDetUnitIds, and theGeometries.

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 }
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetIdContainer * > theDetUnitIds
std::vector< DetId > DetIdContainer
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.

◆ detUnits()

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

Returm a vector of all GeomDet.

Implements TrackingGeometry.

Definition at line 89 of file GlobalTrackingGeometry.cc.

References theDetUnits, and theGeometries.

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 }
std::vector< const TrackingGeometry * > theGeometries
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
std::vector< const GeomDet * > DetContainer
std::atomic< DetContainer * > theDetUnits

◆ 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.

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

Referenced by MuonDT2ChamberResidual::addResidual(), MuonCSCChamberResidual::addResidual(), MuonDT13ChamberResidual::addResidual(), MuonAlignmentAnalyzer::analyze(), MuonIdVal::analyze(), SegmentToTrackAssociator::associate(), SegmentsTrackAssociator::associate(), MuonTransientTrackingRecHitBuilder::build(), TrackTransformer::checkRecHitsOrdering(), ResidualRefitting::CollectTrackHits(), JetCoreMCtruthSeedGenerator::coreHitsFilling(), JetCoreMCtruthSeedGenerator::DetectorSelector(), DeepCoreSeedGenerator::DetectorSelector(), OutsideInMuonSeeder::doDebug(), MuonAlignmentAnalyzer::doMatching(), MuDTSegmentExtTableProducer::fillTable(), CSCTimingExtractor::fillTiming(), DTTimingExtractor::fillTiming(), MuonDetIdAssociator::getDetIdPoints(), MuonDetIdAssociator::getGeomDet(), TrackTransformerForGlobalCosmicMuons::getTransientRecHits(), TrackTransformerForCosmicMuons::getTransientRecHits(), GlobalTrajectoryBuilderBase::getTransientRecHits(), MuonChamberResidual::hitposition(), MuonDetIdAssociator::insideElement(), 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(), DynamicTruncation::preliminaryFit(), GlobalMuonToMuonProducer::printTrackRecHits(), TrackFromSeedProducer::produce(), DeepCoreSeedGenerator::produce(), MuonSeedCleaner::SeedCandidates(), MuonSeedCleaner::SeedMomentum(), MuonSeedCleaner::SeedPosition(), SeedToTrackProducer::seedTransientState(), TrackTransformerForCosmicMuons::SlopeSum(), JetCoreMCtruthSeedGenerator::splittedClusterDirections(), DeepCoreSeedGenerator::splittedClusterDirections(), TrackTransformerForCosmicMuons::SumDy(), DynamicTruncation::testCSCstation(), DynamicTruncation::testDTstation(), ExhaustiveMuonTrajectoryBuilder::trajectories(), TrackTransformerForCosmicMuons::transform(), ResidualRefitting::trkExtrap(), and DynamicTruncation::updateWithDThits().

44  {
45  const TrackingGeometry* tg = slaveGeometry(id);
46 
47  if (tg != nullptr) {
48  return tg->idToDet(id);
49  } else {
50  return nullptr;
51  }
52 }
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
virtual const GeomDet * idToDet(DetId) const =0

◆ 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.

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

Referenced by DeepCoreSeedGenerator::produce(), JetCoreMCtruthSeedGenerator::splittedClusterDirections(), and DeepCoreSeedGenerator::splittedClusterDirections().

34  {
35  const TrackingGeometry* tg = slaveGeometry(id);
36 
37  if (tg != nullptr) {
38  return tg->idToDetUnit(id);
39  } else {
40  return nullptr;
41  }
42 }
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
virtual const GeomDet * idToDetUnit(DetId) const =0
Return the pointer to the GeomDetUnit corresponding to a given DetId.

◆ slaveGeometry()

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

Return the pointer to the actual geometry for a given DetId.

Definition at line 54 of file GlobalTrackingGeometry.cc.

References Exception, FastTime, DetId::Forward, heavyIonCSV_trainingSettings::idx, DetId::Muon, and theGeometries.

Referenced by FWRecoGeometryESProducer::addCSCGeometry(), FWTGeoRecoGeometryESProducer::addCSCGeometry(), FWRecoGeometryESProducer::addDTGeometry(), FWTGeoRecoGeometryESProducer::addDTGeometry(), FWRecoGeometryESProducer::addGEMGeometry(), FWTGeoRecoGeometryESProducer::addGEMGeometry(), FWRecoGeometryESProducer::addME0Geometry(), FWTGeoRecoGeometryESProducer::addME0Geometry(), MuonCSCChamberResidual::addResidual(), FWRecoGeometryESProducer::addRPCGeometry(), FWTGeoRecoGeometryESProducer::addRPCGeometry(), MuonDetIdAssociator::getValidDetIds(), idToDet(), idToDetUnit(), FWRecoGeometryESProducer::produce(), and FWTGeoRecoGeometryESProducer::produce().

54  {
55  int idx = id.det() - 1;
56  if (id.det() == DetId::Muon) {
57  idx += id.subdetId(); //-1; // remove the -1 from before since MTD is there
58  }
59  if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::FastTime) {
60  idx = 1;
61  }
62 
63  if (theGeometries[idx] == nullptr)
64  throw cms::Exception("NoGeometry") << "No Tracking Geometry is available for DetId " << id.rawId() << std::endl;
65 
66  return theGeometries[idx];
67 }
std::vector< const TrackingGeometry * > theGeometries

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