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

Definition at line 13 of file GlobalTrackingGeometry.cc.

14  : theGeometries(geos),
15  theDetTypes(nullptr), theDetUnits(nullptr), theDets(nullptr), theDetUnitIds(nullptr), theDetIds(nullptr)
16 {}
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 18 of file GlobalTrackingGeometry.cc.

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

19 {
20  delete theDetTypes.load();
21  theDetTypes = nullptr;
22  delete theDetUnits.load();
23  theDetUnits = nullptr;
24  delete theDets.load();
25  theDets = nullptr;
26  delete theDetUnitIds.load();
27  theDetUnitIds = nullptr;
28  delete theDetIds.load();
29  theDetIds = nullptr;
30 }
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 157 of file GlobalTrackingGeometry.cc.

References theDetIds, and theGeometries.

158 {
159  if (!theDetIds.load(std::memory_order_acquire)) {
160  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
161  for(auto theGeometrie : theGeometries)
162  {
163  if( theGeometrie == nullptr ) continue;
164  DetIdContainer detIds(theGeometrie->detIds());
165  if( detIds.size() + ptr->size() < ptr->capacity()) ptr->resize( detIds.size() + ptr->size());
166  for(auto detId : detIds)
167  ptr->emplace_back( detId );
168  }
169  DetIdContainer* expect = nullptr;
170  if(theDetIds.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
171  ptr.release();
172  }
173  }
174  return *theDetIds.load(std::memory_order_acquire);
175 }
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 115 of file GlobalTrackingGeometry.cc.

References theDets, and theGeometries.

116 {
117  if (!theDets.load(std::memory_order_acquire)) {
118  std::unique_ptr<DetContainer> ptr{new DetContainer()};
119  for(auto theGeometrie : theGeometries)
120  {
121  if( theGeometrie == nullptr ) continue;
122  DetContainer dets(theGeometrie->dets());
123  if( dets.size() + ptr->size() < ptr->capacity()) ptr->resize( dets.size() + ptr->size());
124  for(auto det : dets)
125  ptr->emplace_back( det );
126  }
127  DetContainer* expect = nullptr;
128  if(theDets.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
129  ptr.release();
130  }
131  }
132  return *theDets.load(std::memory_order_acquire);
133 }
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 73 of file GlobalTrackingGeometry.cc.

References theDetTypes, and theGeometries.

74 {
75  if (!theDetTypes.load(std::memory_order_acquire)) {
76  std::unique_ptr<DetTypeContainer> ptr{new DetTypeContainer()};
77  for(auto theGeometrie : theGeometries)
78  {
79  if( theGeometrie == nullptr ) continue;
80  DetTypeContainer detTypes(theGeometrie->detTypes());
81  if( detTypes.size() + ptr->size() < ptr->capacity()) ptr->resize( detTypes.size() + ptr->size());
82  for(auto detType : detTypes)
83  ptr->emplace_back( detType );
84  }
85  DetTypeContainer* expect = nullptr;
86  if(theDetTypes.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
87  ptr.release();
88  }
89  }
90  return *theDetTypes.load(std::memory_order_acquire);
91 }
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 136 of file GlobalTrackingGeometry.cc.

References theDetUnitIds, and theGeometries.

137 {
138  if (!theDetUnitIds.load(std::memory_order_acquire)) {
139  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
140  for(auto theGeometrie : theGeometries)
141  {
142  if( theGeometrie == nullptr ) continue;
143  DetIdContainer detUnitIds(theGeometrie->detUnitIds());
144  if( detUnitIds.size() + ptr->size() < ptr->capacity()) ptr->resize( detUnitIds.size() + ptr->size());
145  for(auto detUnitId : detUnitIds)
146  ptr->emplace_back( detUnitId );
147  }
148  DetIdContainer* expect = nullptr;
149  if(theDetUnitIds.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
150  ptr.release();
151  }
152  }
153  return *theDetUnitIds.load(std::memory_order_acquire);
154 }
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 94 of file GlobalTrackingGeometry.cc.

References theDetUnits, and theGeometries.

95 {
96  if (!theDetUnits.load(std::memory_order_acquire)) {
97  std::unique_ptr<DetContainer> ptr{new DetContainer()};
98  for(auto theGeometrie : theGeometries)
99  {
100  if( theGeometrie == nullptr ) continue;
101  DetContainer detUnits(theGeometrie->detUnits());
102  if( detUnits.size() + ptr->size() < ptr->capacity()) ptr->resize( detUnits.size() + ptr->size());
103  for(auto detUnit : detUnits)
104  ptr->emplace_back( detUnit );
105  }
106  DetContainer* expect = nullptr;
107  if(theDetUnits.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
108  ptr.release();
109  }
110  }
111  return *theDetUnits.load(std::memory_order_acquire);
112 }
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 44 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(), TrackExtenderWithMTDT< TrackCollection >::buildTrackExtra(), 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().

44  {
45 
46  const TrackingGeometry* tg = slaveGeometry(id);
47 
48  if (tg != nullptr) {
49  return tg->idToDet(id);
50  } else {
51  return nullptr;
52  }
53 }
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 32 of file GlobalTrackingGeometry.cc.

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

Referenced by JetCoreClusterSplitter::produce().

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

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

Definition at line 55 of file GlobalTrackingGeometry.cc.

References Exception, FastTime, DetId::Forward, training_settings::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().

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

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