CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalTrackingGeometry.cc
Go to the documentation of this file.
1 
10 
11 GlobalTrackingGeometry::GlobalTrackingGeometry(std::vector<const TrackingGeometry*>& geos)
12  : theGeometries(geos)
13 {}
14 
16 {}
17 
19 
20  const TrackingGeometry* tg = slaveGeometry(id);
21 
22  if (tg != 0) {
23  return tg->idToDetUnit(id);
24  } else {
25  return 0;
26  }
27 }
28 
29 
31 
32  const TrackingGeometry* tg = slaveGeometry(id);
33 
34  if (tg != 0) {
35  return tg->idToDet(id);
36  } else {
37  return 0;
38  }
39 }
40 
42 
43  int idx = id.det()-1;
44  if (id.det() == DetId::Muon) {
45 
46  idx+=id.subdetId()-1;
47  }
48 
49  if (theGeometries[idx]==0) throw cms::Exception("NoGeometry") << "No Tracking Geometry is available for DetId " << id.rawId() << std::endl;
50 
51  return theGeometries[idx];
52 }
53 
56 {
57  if ( ! theDetTypes.empty() ) return theDetTypes;
58  for( std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin(), geomEnd = theGeometries.end();
59  geom != geomEnd; ++geom )
60  {
61  if( *geom == 0 ) continue;
62  DetTypeContainer detTypes(( *geom )->detTypes());
63  if( detTypes.size() + theDetTypes.size() < theDetTypes.capacity()) theDetTypes.resize( detTypes.size() + theDetTypes.size());
64  for( DetTypeContainer::const_iterator detType = detTypes.begin(), detTypeEnd = detTypes.end(); detType != detTypeEnd; ++detType )
65  theDetTypes.push_back( *detType );
66  }
67  return theDetTypes;
68 }
69 
72 {
73  if( ! theDetUnits.empty()) return theDetUnits;
74  for( std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin(), geomEnd = theGeometries.end();
75  geom != geomEnd; ++geom )
76  {
77  if( *geom == 0 ) continue;
78  DetUnitContainer detUnits(( *geom )->detUnits());
79  if( detUnits.size() + theDetUnits.size() < theDetUnits.capacity()) theDetUnits.resize( detUnits.size() + theDetUnits.size());
80  for( DetUnitContainer::const_iterator detUnit = detUnits.begin(), detUnitEnd = detUnits.end(); detUnit != detUnitEnd; ++detUnit )
81  theDetUnits.push_back( *detUnit );
82  }
83  return theDetUnits;
84 }
85 
88 {
89  if( ! theDets.empty()) return theDets;
90  for( std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin(), geomEnd = theGeometries.end();
91  geom != geomEnd; ++geom )
92  {
93  if( *geom == 0 ) continue;
94  DetContainer dets(( *geom )->dets());
95  if( dets.size() + theDets.size() < theDets.capacity()) theDets.resize( dets.size() + theDets.size());
96  for( DetContainer::const_iterator det = dets.begin(), detEnd = dets.end(); det != detEnd; ++det )
97  theDets.push_back( *det );
98  }
99  return theDets;
100 }
101 
104 {
105  if( ! theDetUnitIds.empty()) return theDetUnitIds;
106  for( std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin(), geomEnd = theGeometries.end();
107  geom != geomEnd; ++geom )
108  {
109  if( *geom == 0 ) continue;
110  DetIdContainer detUnitIds(( *geom )->detUnitIds());
111  if( detUnitIds.size() + theDetUnitIds.size() < theDetUnitIds.capacity()) theDetUnitIds.resize( detUnitIds.size() + theDetUnitIds.size());
112  for( DetIdContainer::const_iterator detUnitId = detUnitIds.begin(), detUnitIdEnd = detUnitIds.end(); detUnitId != detUnitIdEnd; ++detUnitId )
113  theDetUnitIds.push_back( *detUnitId );
114  }
115  return theDetUnitIds;
116 }
117 
120 {
121  if( ! theDetIds.empty() ) return theDetIds;
122  for( std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin(), geomEnd = theGeometries.end();
123  geom != geomEnd; ++geom )
124  {
125  if( *geom == 0 ) continue;
126  DetIdContainer detIds(( *geom )->detIds());
127  if( detIds.size() + theDetIds.size() < theDetIds.capacity()) theDetIds.resize( detIds.size() + theDetIds.size());
128  for( DetIdContainer::const_iterator detId = detIds.begin(), detIdEnd = detIds.end(); detId != detIdEnd; ++detId )
129  theDetIds.push_back( *detId );
130  }
131  return theDetIds;
132 }
std::vector< const TrackingGeometry * > theGeometries
std::vector< GeomDet * > DetContainer
virtual const GeomDet * idToDet(DetId) const
virtual const GeomDetUnit * idToDetUnit(DetId) const =0
Return the pointer to the GeomDetUnit corresponding to a given DetId.
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::vector< GeomDetUnit * > DetUnitContainer
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
virtual ~GlobalTrackingGeometry()
Destructor.
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
std::vector< GeomDetType * > DetTypeContainer
virtual const DetIdContainer & detIds() const
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
virtual const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DetId.h:20
GlobalTrackingGeometry(std::vector< const TrackingGeometry * > &geos)
Constructor.
virtual const GeomDet * idToDet(DetId) const =0
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
virtual const DetTypeContainer & detTypes() const
Return a vector of all det types.
virtual const DetIdContainer & detUnitIds() const
Returm a vector of all GeomDetUnit DetIds.
std::vector< DetId > DetIdContainer