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

virtual const DetIdContainerdetIds () const
 Returm a vector of all GeomDet DetIds (including those of GeomDetUnits) More...
 
virtual const DetContainerdets () const
 Returm a vector of all GeomDet (including all GeomDetUnits) More...
 
virtual const DetTypeContainerdetTypes () const
 Return a vector of all det types. More...
 
virtual const DetIdContainerdetUnitIds () const
 Returm a vector of all GeomDetUnit DetIds. More...
 
virtual const DetUnitContainerdetUnits () const
 Returm a vector of all GeomDetUnit. More...
 
 GlobalTrackingGeometry (std::vector< const TrackingGeometry * > &geos)
 Constructor. More...
 
virtual const GeomDetidToDet (DetId) const
 
virtual const GeomDetUnitidToDetUnit (DetId) const
 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...
 
virtual ~GlobalTrackingGeometry ()
 Destructor. More...
 
- 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< DetUnitContainer * > theDetUnits
 
std::vector< const TrackingGeometry * > theGeometries
 

Additional Inherited Members

- Public Types inherited from TrackingGeometry
typedef std::vector< GeomDet const * > DetContainer
 
typedef std::vector< DetIdDetIdContainer
 
typedef std::vector< GeomDetType const * > DetTypeContainer
 
typedef std::vector< GeomDetUnit const * > DetUnitContainer
 
typedef std::unordered_map< unsigned int, GeomDet const * > mapIdToDet
 
typedef std::unordered_map< unsigned int, GeomDetUnit const * > mapIdToDetUnit
 

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)

Constructor.

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< DetUnitContainer * > theDetUnits
std::atomic< DetIdContainer * > theDetIds
std::atomic< DetTypeContainer * > theDetTypes
GlobalTrackingGeometry::~GlobalTrackingGeometry ( )
virtual

Destructor.

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< DetUnitContainer * > theDetUnits
std::atomic< DetIdContainer * > theDetIds
std::atomic< DetTypeContainer * > theDetTypes

Member Function Documentation

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

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

Implements TrackingGeometry.

Definition at line 151 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDetIds, and theGeometries.

152 {
153  if (!theDetIds.load(std::memory_order_acquire)) {
154  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
155  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
156  {
157  if( *geom == 0 ) continue;
158  DetIdContainer detIds(( *geom )->detIds());
159  if( detIds.size() + ptr->size() < ptr->capacity()) ptr->resize( detIds.size() + ptr->size());
160  for( auto detId = detIds.cbegin(), detIdEnd = detIds.cend(); detId != detIdEnd; ++detId )
161  ptr->push_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
virtual const DetIdContainer & detIds() const
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
std::vector< DetId > DetIdContainer
const TrackingGeometry::DetContainer & GlobalTrackingGeometry::dets ( ) const
virtual

Returm a vector of all GeomDet (including all GeomDetUnits)

Implements TrackingGeometry.

Definition at line 109 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDets, and theGeometries.

110 {
111  if (!theDets.load(std::memory_order_acquire)) {
112  std::unique_ptr<DetContainer> ptr{new DetContainer()};
113  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
114  {
115  if( *geom == 0 ) continue;
116  DetContainer dets(( *geom )->dets());
117  if( dets.size() + ptr->size() < ptr->capacity()) ptr->resize( dets.size() + ptr->size());
118  for( auto det = dets.cbegin(), detEnd = dets.cend(); det != detEnd; ++det )
119  ptr->push_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
virtual const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
std::vector< GeomDet const * > DetContainer
const TrackingGeometry::DetTypeContainer & GlobalTrackingGeometry::detTypes ( ) const
virtual

Return a vector of all det types.

Implements TrackingGeometry.

Definition at line 67 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDetTypes, and theGeometries.

68 {
69  if (!theDetTypes.load(std::memory_order_acquire)) {
70  std::unique_ptr<DetTypeContainer> ptr{new DetTypeContainer()};
71  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
72  {
73  if( *geom == 0 ) continue;
74  DetTypeContainer detTypes(( *geom )->detTypes());
75  if( detTypes.size() + ptr->size() < ptr->capacity()) ptr->resize( detTypes.size() + ptr->size());
76  for( auto detType = detTypes.cbegin(), detTypeEnd = detTypes.cend(); detType != detTypeEnd; ++detType )
77  ptr->push_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< GeomDetType const * > DetTypeContainer
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetTypeContainer * > theDetTypes
virtual const DetTypeContainer & detTypes() const
Return a vector of all det types.
const TrackingGeometry::DetIdContainer & GlobalTrackingGeometry::detUnitIds ( ) const
virtual

Returm a vector of all GeomDetUnit DetIds.

Implements TrackingGeometry.

Definition at line 130 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDetUnitIds, and theGeometries.

131 {
132  if (!theDetUnitIds.load(std::memory_order_acquire)) {
133  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
134  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
135  {
136  if( *geom == 0 ) continue;
137  DetIdContainer detUnitIds(( *geom )->detUnitIds());
138  if( detUnitIds.size() + ptr->size() < ptr->capacity()) ptr->resize( detUnitIds.size() + ptr->size());
139  for( auto detUnitId = detUnitIds.cbegin(), detUnitIdEnd = detUnitIds.cend(); detUnitId != detUnitIdEnd; ++detUnitId )
140  ptr->push_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
virtual const DetIdContainer & detUnitIds() const
Returm a vector of all GeomDetUnit DetIds.
std::vector< DetId > DetIdContainer
const TrackingGeometry::DetUnitContainer & GlobalTrackingGeometry::detUnits ( ) const
virtual

Returm a vector of all GeomDetUnit.

Implements TrackingGeometry.

Definition at line 88 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDetUnits, and theGeometries.

89 {
90  if (!theDetUnits.load(std::memory_order_acquire)) {
91  std::unique_ptr<DetUnitContainer> ptr{new DetUnitContainer()};
92  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
93  {
94  if( *geom == 0 ) continue;
95  DetUnitContainer detUnits(( *geom )->detUnits());
96  if( detUnits.size() + ptr->size() < ptr->capacity()) ptr->resize( detUnits.size() + ptr->size());
97  for( auto detUnit = detUnits.cbegin(), detUnitEnd = detUnits.cend(); detUnit != detUnitEnd; ++detUnit )
98  ptr->push_back( *detUnit );
99  }
100  DetUnitContainer* 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
std::atomic< DetUnitContainer * > theDetUnits
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
std::vector< GeomDetUnit const * > DetUnitContainer
const GeomDet * GlobalTrackingGeometry::idToDet ( DetId  ) const
virtual

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(), MuonIdTruthInfo::checkSimHitForBestMatch(), ResidualRefitting::CollectTrackHits(), OutsideInMuonSeeder::doDebug(), MuonAlignmentAnalyzer::doMatching(), MuonAlignment::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()(), MuonSeedCleaner::OverlapSegments(), GlobalMuonToMuonProducer::printTrackRecHits(), JetCoreClusterSplitter::produce(), MuonMillepedeTrackRefitter::produce(), TrackClusterSplitter::produce(), MuonSeedCleaner::SeedCandidates(), MuonSeedCleaner::SeedMomentum(), MuonSeedCleaner::SeedPosition(), SeedToTrackProducer::seedTransientState(), TrackClusterSplitter::splitClusters(), ExhaustiveMuonTrajectoryBuilder::trajectories(), ResidualRefitting::trkExtrap(), and CosmicParametersDefinerForTP::vertex().

42  {
43 
44  const TrackingGeometry* tg = slaveGeometry(id);
45 
46  if (tg != 0) {
47  return tg->idToDet(id);
48  } else {
49  return 0;
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 GeomDetUnit * GlobalTrackingGeometry::idToDetUnit ( DetId  ) const
virtual

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(), and TrackClusterSplitter::splitCluster().

30  {
31 
32  const TrackingGeometry* tg = slaveGeometry(id);
33 
34  if (tg != 0) {
35  return tg->idToDetUnit(id);
36  } else {
37  return 0;
38  }
39 }
virtual const GeomDetUnit * idToDetUnit(DetId) const =0
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
const TrackingGeometry * GlobalTrackingGeometry::slaveGeometry ( DetId  id) const

Member Data Documentation

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

Definition at line 65 of file GlobalTrackingGeometry.h.

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

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

Definition at line 63 of file GlobalTrackingGeometry.h.

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

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

Definition at line 61 of file GlobalTrackingGeometry.h.

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

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

Definition at line 64 of file GlobalTrackingGeometry.h.

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

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

Definition at line 62 of file GlobalTrackingGeometry.h.

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

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

Definition at line 56 of file GlobalTrackingGeometry.h.

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