CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackerGeometry.cc
Go to the documentation of this file.
1 #include <typeinfo>
2 
7 
11 
12 #include <algorithm>
13 #include <iostream>
14 #include <map>
15 
16 TrackerGeometry::TrackerGeometry(GeometricDet const* gd) : theTrackerDet(gd){}
17 
19  for (DetContainer::iterator it = theDets.begin(), ed = theDets.end(); it != ed; ++it) delete *it;
20  for (DetTypeContainer::iterator it = theDetTypes.begin(), ed = theDetTypes.end(); it != ed; ++it) delete *it;
21 }
22 
24  return theTrackerDet;
25 }
26 
27 
29  theDetTypes.push_back(p); // add to vector
30 }
31 
33  theDetUnits.push_back(p); // add to vector
34  theMapUnit.insert(std::make_pair(p->geographicalId().rawId(),p));
35 }
36 
38  theDetUnitIds.push_back(p);
39 }
40 
42  theDets.push_back(p); // add to vector
43  theMap.insert(std::make_pair(p->geographicalId().rawId(),p));
44  DetId id(p->geographicalId());
45  switch(id.subdetId()){
47  thePXBDets.push_back(p);
48  break;
50  thePXFDets.push_back(p);
51  break;
53  theTIBDets.push_back(p);
54  break;
56  theTIDDets.push_back(p);
57  break;
59  theTOBDets.push_back(p);
60  break;
62  theTECDets.push_back(p);
63  break;
64  default:
65  edm::LogError("TrackerGeometry")<<"ERROR - I was expecting a Tracker Subdetector, I got a "<<id.subdetId();
66  }
67 
68 
69 }
70 
72  theDetIds.push_back(p);
73 }
74 
77 {
78  return theDetUnits;
79 }
80 
83 {
84  return theDets;
85 }
86 
89 {
90  return thePXBDets;
91 }
92 
95 {
96  return thePXFDets;
97 }
98 
101 {
102  return theTIBDets;
103 }
104 
107 {
108  return theTIDDets;
109 }
110 
113 {
114  return theTOBDets;
115 }
116 
119 {
120  return theTECDets;
121 }
122 
123 const GeomDetUnit*
125 {
126  mapIdToDetUnit::const_iterator p=theMapUnit.find(s.rawId());
127  if (p != theMapUnit.end())
128  return (p)->second;
129  edm::LogError("TrackerGeometry")<<"Invalid DetID: no GeomDetUnit associated";
130  GeomDetUnit* geom = 0;
131  return geom;
132 }
133 
134 const GeomDet*
136 {
137  mapIdToDet::const_iterator p=theMap.find(s.rawId());
138  if (p != theMap.end())
139  return (p)->second;
140  edm::LogError("TrackerGeometry")<<"Invalid DetID: no GeomDet associated";
141  GeomDet* geom = 0;
142  return geom;
143 }
144 
147 {
148  return theDetTypes;
149 }
150 
151 
154 {
155  return theDetUnitIds;
156 }
157 
160 {
161  return theDetIds;
162 }
163 
164 
mapIdToDet theMap
TrackerGeometry(GeometricDet const *gd=0)
std::vector< GeomDet * > DetContainer
DetIdContainer theDetIds
DetIdContainer theDetUnitIds
DetContainer theTECDets
DetContainer theDets
void addDetId(DetId p)
DetUnitContainer theDetUnits
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
virtual const DetIdContainer & detIds() const
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
mapIdToDetUnit theMapUnit
const DetContainer & detsTEC() const
DetTypeContainer theDetTypes
virtual ~TrackerGeometry()
std::vector< GeomDetUnit * > DetUnitContainer
virtual const DetTypeContainer & detTypes() const
Return a vector of all det types.
const DetContainer & detsPXB() const
GeometricDet const * trackerDet() const
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:74
virtual const GeomDet * idToDet(DetId) const
DetContainer theTIDDets
const DetContainer & detsTIB() const
std::vector< GeomDetType * > DetTypeContainer
Definition: DetId.h:20
DetContainer thePXBDets
DetContainer thePXFDets
void addDetUnitId(DetId p)
DetContainer theTIBDets
void addType(GeomDetType *p)
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
DetContainer theTOBDets
virtual const DetIdContainer & detUnitIds() const
Returm a vector of all GeomDetUnit DetIds.
const DetContainer & detsPXF() const
const DetContainer & detsTOB() const
string s
Definition: asciidump.py:422
void addDetUnit(GeomDetUnit *p)
GeometricDet const * theTrackerDet
virtual const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
void addDet(GeomDet *p)
const DetContainer & detsTID() const
std::vector< DetId > DetIdContainer