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 
11 
12 using namespace edm;
13 
14 GlobalTrackingGeometry::GlobalTrackingGeometry(std::vector<const TrackingGeometry*>& geos) : theGeometries(geos) {}
15 
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 
55 
56  static DetTypeContainer result;
57  if ( ! result.empty() ) return result;
58  for(std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin();
59  geom != theGeometries.end(); geom++)
60  {
61  if (*geom == 0) continue;
62  DetTypeContainer detTypes((*geom)->detTypes());
63  if ( detTypes.size()+result.size()<result.capacity() ) result.resize(detTypes.size()+result.size());
64  for( DetTypeContainer::const_iterator detType = detTypes.begin(); detType!=detTypes.end(); detType++)
65  result.push_back(*detType);
66  }
67  return result;
68 }
69 
71 
72  static DetUnitContainer result;
73  if ( ! result.empty() ) return result;
74  for(std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin();
75  geom != theGeometries.end(); geom++)
76  {
77  if (*geom == 0) continue;
78  DetUnitContainer detUnits((*geom)->detUnits());
79  if ( detUnits.size()+result.size()<result.capacity() ) result.resize(detUnits.size()+result.size());
80  for( DetUnitContainer::const_iterator detUnit = detUnits.begin(); detUnit!=detUnits.end(); detUnit++)
81  result.push_back(*detUnit);
82  }
83  return result;
84 }
85 
87 
88  static DetContainer result;
89  if ( ! result.empty() ) return result;
90  for(std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin();
91  geom != theGeometries.end(); geom++)
92  {
93  if (*geom == 0) continue;
94  DetContainer dets((*geom)->dets());
95  if ( dets.size()+result.size()<result.capacity() ) result.resize(dets.size()+result.size());
96  for( DetContainer::const_iterator det = dets.begin(); det!=dets.end(); det++)
97  result.push_back(*det);
98  }
99  return result;
100 }
101 
103 
104  static DetIdContainer result;
105  if ( ! result.empty() ) return result;
106  for(std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin();
107  geom != theGeometries.end(); geom++)
108  {
109  if (*geom == 0) continue;
110  DetIdContainer detUnitIds((*geom)->detUnitIds());
111  if ( detUnitIds.size()+result.size()<result.capacity() ) result.resize(detUnitIds.size()+result.size());
112  for( DetIdContainer::const_iterator detUnitId = detUnitIds.begin(); detUnitId!=detUnitIds.end(); detUnitId++)
113  result.push_back(*detUnitId);
114  }
115  return result;
116 }
117 
119 
120  static DetIdContainer result;
121  if ( ! result.empty() ) return result;
122  for(std::vector<const TrackingGeometry*>::const_iterator geom = theGeometries.begin();
123  geom != theGeometries.end(); geom++)
124  {
125  if (*geom == 0) continue;
126  DetIdContainer detIds((*geom)->detIds());
127  if ( detIds.size()+result.size()<result.capacity() ) result.resize(detIds.size()+result.size());
128  for( DetIdContainer::const_iterator detId = detIds.begin(); detId!=detIds.end(); detId++)
129  result.push_back(*detId);
130  }
131  return result;
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
tuple result
Definition: query.py:137
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
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