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, 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 ( std::vector< const TrackingGeometry * > &  geos)

Definition at line 11 of file GlobalTrackingGeometry.cc.

12  : theGeometries(geos),
13  theDetTypes(nullptr), theDetUnits(nullptr), theDets(nullptr), theDetUnitIds(nullptr), theDetIds(nullptr)
14 {}
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 ( )
override

Definition at line 16 of file GlobalTrackingGeometry.cc.

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

17 {
18  delete theDetTypes.load();
19  theDetTypes = nullptr;
20  delete theDetUnits.load();
21  theDetUnits = nullptr;
22  delete theDets.load();
23  theDets = nullptr;
24  delete theDetUnitIds.load();
25  theDetUnitIds = nullptr;
26  delete theDetIds.load();
27  theDetIds = nullptr;
28 }
std::atomic< DetIdContainer * > theDetUnitIds
std::atomic< DetContainer * > theDets
std::atomic< DetIdContainer * > theDetIds
std::atomic< DetTypeContainer * > theDetTypes
std::atomic< DetContainer * > theDetUnits

Member Function Documentation

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

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

Implements TrackingGeometry.

Definition at line 151 of file GlobalTrackingGeometry.cc.

References theDetIds, and theGeometries.

152 {
153  if (!theDetIds.load(std::memory_order_acquire)) {
154  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
155  for(auto theGeometrie : theGeometries)
156  {
157  if( theGeometrie == nullptr ) continue;
158  DetIdContainer detIds(theGeometrie->detIds());
159  if( detIds.size() + ptr->size() < ptr->capacity()) ptr->resize( detIds.size() + ptr->size());
160  for(auto detId : detIds)
161  ptr->emplace_back( detId );
162  }
163  DetIdContainer* expect = nullptr;
164  if(theDetIds.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
165  ptr.release();
166  }
167  }
168  return *theDetIds.load(std::memory_order_acquire);
169 }
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetIdContainer * > theDetIds
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
std::vector< DetId > DetIdContainer
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.

110 {
111  if (!theDets.load(std::memory_order_acquire)) {
112  std::unique_ptr<DetContainer> ptr{new DetContainer()};
113  for(auto theGeometrie : theGeometries)
114  {
115  if( theGeometrie == nullptr ) continue;
116  DetContainer dets(theGeometrie->dets());
117  if( dets.size() + ptr->size() < ptr->capacity()) 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 }
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetContainer * > theDets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
std::vector< const GeomDet * > DetContainer
const TrackingGeometry::DetTypeContainer & GlobalTrackingGeometry::detTypes ( ) const
overridevirtual

Return a vector of all det types.

Implements TrackingGeometry.

Definition at line 67 of file GlobalTrackingGeometry.cc.

References theDetTypes, and theGeometries.

68 {
69  if (!theDetTypes.load(std::memory_order_acquire)) {
70  std::unique_ptr<DetTypeContainer> ptr{new DetTypeContainer()};
71  for(auto theGeometrie : theGeometries)
72  {
73  if( theGeometrie == nullptr ) continue;
74  DetTypeContainer detTypes(theGeometrie->detTypes());
75  if( detTypes.size() + ptr->size() < ptr->capacity()) ptr->resize( detTypes.size() + ptr->size());
76  for(auto detType : detTypes)
77  ptr->emplace_back( detType );
78  }
79  DetTypeContainer* expect = nullptr;
80  if(theDetTypes.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
81  ptr.release();
82  }
83  }
84  return *theDetTypes.load(std::memory_order_acquire);
85 }
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetTypeContainer * > theDetTypes
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
std::vector< const GeomDetType * > DetTypeContainer
const TrackingGeometry::DetIdContainer & GlobalTrackingGeometry::detUnitIds ( ) const
overridevirtual

Returm a vector of all GeomDetUnit DetIds.

Implements TrackingGeometry.

Definition at line 130 of file GlobalTrackingGeometry.cc.

References theDetUnitIds, and theGeometries.

131 {
132  if (!theDetUnitIds.load(std::memory_order_acquire)) {
133  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
134  for(auto theGeometrie : theGeometries)
135  {
136  if( theGeometrie == nullptr ) continue;
137  DetIdContainer detUnitIds(theGeometrie->detUnitIds());
138  if( detUnitIds.size() + ptr->size() < ptr->capacity()) ptr->resize( detUnitIds.size() + ptr->size());
139  for(auto detUnitId : detUnitIds)
140  ptr->emplace_back( detUnitId );
141  }
142  DetIdContainer* expect = nullptr;
143  if(theDetUnitIds.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
144  ptr.release();
145  }
146  }
147  return *theDetUnitIds.load(std::memory_order_acquire);
148 }
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetIdContainer * > theDetUnitIds
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
std::vector< DetId > DetIdContainer
const TrackingGeometry::DetContainer & GlobalTrackingGeometry::detUnits ( ) const
overridevirtual

Returm a vector of all GeomDet.

Implements TrackingGeometry.

Definition at line 88 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  {
94  if( theGeometrie == nullptr ) continue;
95  DetContainer detUnits(theGeometrie->detUnits());
96  if( detUnits.size() + ptr->size() < ptr->capacity()) ptr->resize( detUnits.size() + ptr->size());
97  for(auto detUnit : detUnits)
98  ptr->emplace_back( detUnit );
99  }
100  DetContainer* expect = nullptr;
101  if(theDetUnits.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
102  ptr.release();
103  }
104  }
105  return *theDetUnits.load(std::memory_order_acquire);
106 }
std::vector< const TrackingGeometry * > theGeometries
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
std::atomic< DetContainer * > theDetUnits
std::vector< const GeomDet * > DetContainer
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 42 of file GlobalTrackingGeometry.cc.

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

Referenced by MuonDT2ChamberResidual::addResidual(), MuonCSCChamberResidual::addResidual(), MuonDT13ChamberResidual::addResidual(), MuonAlignmentAnalyzer::analyze(), MuonIdVal::analyze(), MuonAlignment::analyze(), SegmentToTrackAssociator::associate(), SegmentsTrackAssociator::associate(), MuonTransientTrackingRecHitBuilder::build(), reco::helper::JetMuonHitsIDHelper::calculate(), TrackTransformer::checkRecHitsOrdering(), MuonIdTruthInfo::checkSimHitForBestMatch(), ResidualRefitting::CollectTrackHits(), OutsideInMuonSeeder::doDebug(), MuonAlignmentAnalyzer::doMatching(), MuonAlignment::doMatching(), CSCTimingExtractor::fillTiming(), DTTimingExtractor::fillTiming(), MuonDetIdAssociator::getDetIdPoints(), MuonDetIdAssociator::getGeomDet(), pat::PATMuonProducer::getMuonDirection(), 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()(), MuonSeedCleaner::OverlapSegments(), GlobalMuonToMuonProducer::printTrackRecHits(), JetCoreClusterSplitter::produce(), MuonMillepedeTrackRefitter::produce(), MuonSeedCleaner::SeedCandidates(), MuonSeedCleaner::SeedMomentum(), MuonSeedCleaner::SeedPosition(), SeedToTrackProducer::seedTransientState(), ExhaustiveMuonTrajectoryBuilder::trajectories(), ResidualRefitting::trkExtrap(), and CosmicParametersDefinerForTP::vertex().

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

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

Implements TrackingGeometry.

Definition at line 30 of file GlobalTrackingGeometry.cc.

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

Referenced by JetCoreClusterSplitter::produce().

30  {
31 
32  const TrackingGeometry* tg = slaveGeometry(id);
33 
34  if (tg != nullptr) {
35  return tg->idToDetUnit(id);
36  } else {
37  return nullptr;
38  }
39 }
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.
const TrackingGeometry * GlobalTrackingGeometry::slaveGeometry ( DetId  id) const

Member Data Documentation

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

Definition at line 64 of file GlobalTrackingGeometry.h.

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

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

Definition at line 62 of file GlobalTrackingGeometry.h.

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

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

Definition at line 60 of file GlobalTrackingGeometry.h.

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

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

Definition at line 63 of file GlobalTrackingGeometry.h.

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

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

Definition at line 61 of file GlobalTrackingGeometry.h.

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

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

Definition at line 55 of file GlobalTrackingGeometry.h.

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