CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 * > DetContainer
 
typedef std::vector< DetIdDetIdContainer
 
typedef std::vector
< GeomDetType * > 
DetTypeContainer
 
typedef std::vector
< GeomDetUnit * > 
DetUnitContainer
 
typedef __gnu_cxx::hash_map
< unsigned int, GeomDet * > 
mapIdToDet
 
typedef __gnu_cxx::hash_map
< unsigned int, GeomDetUnit * > 
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) 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 10 of file GlobalTrackingGeometry.cc.

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

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

16 {
17  delete theDetTypes;
18  theDetTypes = nullptr;
19  delete theDetUnits;
20  theDetUnits = nullptr;
21  delete theDets;
22  theDets = nullptr;
23  delete theDetUnitIds;
24  theDetUnitIds = nullptr;
25  delete theDetIds;
26  theDetIds = nullptr;
27 }
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 150 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDetIds, and theGeometries.

151 {
152  if (!theDetIds.load(std::memory_order_acquire)) {
153  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
154  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
155  {
156  if( *geom == 0 ) continue;
157  DetIdContainer detIds(( *geom )->detIds());
158  if( detIds.size() + ptr->size() < ptr->capacity()) ptr->resize( detIds.size() + ptr->size());
159  for( auto detId = detIds.cbegin(), detIdEnd = detIds.cend(); detId != detIdEnd; ++detId )
160  ptr->push_back( *detId );
161  }
162  DetIdContainer* expect = nullptr;
163  if(theDetIds.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
164  ptr.release();
165  }
166  }
167  return *theDetIds.load(std::memory_order_acquire);
168 }
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 108 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDets, and theGeometries.

109 {
110  if (!theDets.load(std::memory_order_acquire)) {
111  std::unique_ptr<DetContainer> ptr{new DetContainer()};
112  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
113  {
114  if( *geom == 0 ) continue;
115  DetContainer dets(( *geom )->dets());
116  if( dets.size() + ptr->size() < ptr->capacity()) ptr->resize( dets.size() + ptr->size());
117  for( auto det = dets.cbegin(), detEnd = dets.cend(); det != detEnd; ++det )
118  ptr->push_back( *det );
119  }
120  DetContainer* expect = nullptr;
121  if(theDets.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
122  ptr.release();
123  }
124  }
125  return *theDets.load(std::memory_order_acquire);
126 }
std::vector< const TrackingGeometry * > theGeometries
std::vector< GeomDet * > DetContainer
std::atomic< DetContainer * > theDets
virtual const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
const TrackingGeometry::DetTypeContainer & GlobalTrackingGeometry::detTypes ( ) const
virtual

Return a vector of all det types.

Implements TrackingGeometry.

Definition at line 66 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDetTypes, and theGeometries.

67 {
68  if (!theDetTypes.load(std::memory_order_acquire)) {
69  std::unique_ptr<DetTypeContainer> ptr{new DetTypeContainer()};
70  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
71  {
72  if( *geom == 0 ) continue;
73  DetTypeContainer detTypes(( *geom )->detTypes());
74  if( detTypes.size() + ptr->size() < ptr->capacity()) ptr->resize( detTypes.size() + ptr->size());
75  for( auto detType = detTypes.cbegin(), detTypeEnd = detTypes.cend(); detType != detTypeEnd; ++detType )
76  ptr->push_back( *detType );
77  }
78  DetTypeContainer* expect = nullptr;
79  if(theDetTypes.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
80  ptr.release();
81  }
82  }
83  return *theDetTypes.load(std::memory_order_acquire);
84 }
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetTypeContainer * > theDetTypes
std::vector< GeomDetType * > DetTypeContainer
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 129 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDetUnitIds, and theGeometries.

130 {
131  if (!theDetUnitIds.load(std::memory_order_acquire)) {
132  std::unique_ptr<DetIdContainer> ptr{new DetIdContainer()};
133  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
134  {
135  if( *geom == 0 ) continue;
136  DetIdContainer detUnitIds(( *geom )->detUnitIds());
137  if( detUnitIds.size() + ptr->size() < ptr->capacity()) ptr->resize( detUnitIds.size() + ptr->size());
138  for( auto detUnitId = detUnitIds.cbegin(), detUnitIdEnd = detUnitIds.cend(); detUnitId != detUnitIdEnd; ++detUnitId )
139  ptr->push_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
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 87 of file GlobalTrackingGeometry.cc.

References relativeConstraints::geom, theDetUnits, and theGeometries.

88 {
89  if (!theDetUnits.load(std::memory_order_acquire)) {
90  std::unique_ptr<DetUnitContainer> ptr{new DetUnitContainer()};
91  for( auto geom = theGeometries.cbegin(), geomEnd = theGeometries.cend(); geom != geomEnd; ++geom )
92  {
93  if( *geom == 0 ) continue;
94  DetUnitContainer detUnits(( *geom )->detUnits());
95  if( detUnits.size() + ptr->size() < ptr->capacity()) ptr->resize( detUnits.size() + ptr->size());
96  for( auto detUnit = detUnits.cbegin(), detUnitEnd = detUnits.cend(); detUnit != detUnitEnd; ++detUnit )
97  ptr->push_back( *detUnit );
98  }
99  DetUnitContainer* expect = nullptr;
100  if(theDetUnits.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel)) {
101  ptr.release();
102  }
103  }
104  return *theDetUnits.load(std::memory_order_acquire);
105 }
std::vector< const TrackingGeometry * > theGeometries
std::atomic< DetUnitContainer * > theDetUnits
std::vector< GeomDetUnit * > DetUnitContainer
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
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 41 of file GlobalTrackingGeometry.cc.

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

Referenced by CSCTimingExtractor::fillTiming(), DTTimingExtractor::fillTiming(), MuonDetIdAssociator::getDetIdPoints(), MuonDetIdAssociator::getGeomDet(), and MuonDetIdAssociator::insideElement().

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

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

Implements TrackingGeometry.

Definition at line 29 of file GlobalTrackingGeometry.cc.

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

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

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

Definition at line 52 of file GlobalTrackingGeometry.cc.

References edm::hlt::Exception, customizeTrackingMonitorSeedNumber::idx, DetId::Muon, and theGeometries.

Referenced by MuonDetIdAssociator::getValidDetIds(), idToDet(), and idToDetUnit().

52  {
53 
54  int idx = id.det()-1;
55  if (id.det() == DetId::Muon) {
56 
57  idx+=id.subdetId()-1;
58  }
59 
60  if (theGeometries[idx]==0) throw cms::Exception("NoGeometry") << "No Tracking Geometry is available for DetId " << id.rawId() << std::endl;
61 
62  return theGeometries[idx];
63 }
std::vector< const TrackingGeometry * > theGeometries
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...

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