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 const_cast<GeomDet*>(*it);
20  for (DetTypeContainer::iterator it = theDetTypes.begin(), ed = theDetTypes.end(); it != ed; ++it) delete const_cast<GeomDetType*>(*it);
21 }
22 
24  return theTrackerDet;
25 }
26 
27 
29  theDetTypes.push_back(p); // add to vector
30 }
31 
33  // set index
34  const_cast<GeomDetUnit *>(p)->setIndex(theDetUnits.size());
35  theDetUnits.push_back(p); // add to vector
36  theMapUnit.insert(std::make_pair(p->geographicalId().rawId(),p));
37 }
38 
40  theDetUnitIds.push_back(p);
41 }
42 
44  theDets.push_back(p); // add to vector
45  theMap.insert(std::make_pair(p->geographicalId().rawId(),p));
46  DetId id(p->geographicalId());
47  switch(id.subdetId()){
49  thePXBDets.push_back(p);
50  break;
52  thePXFDets.push_back(p);
53  break;
55  theTIBDets.push_back(p);
56  break;
58  theTIDDets.push_back(p);
59  break;
61  theTOBDets.push_back(p);
62  break;
64  theTECDets.push_back(p);
65  break;
66  default:
67  edm::LogError("TrackerGeometry")<<"ERROR - I was expecting a Tracker Subdetector, I got a "<<id.subdetId();
68  }
69 
70 
71 }
72 
74  theDetIds.push_back(p);
75 }
76 
79 {
80  return theDetUnits;
81 }
82 
85 {
86  return theDets;
87 }
88 
91 {
92  return thePXBDets;
93 }
94 
97 {
98  return thePXFDets;
99 }
100 
103 {
104  return theTIBDets;
105 }
106 
109 {
110  return theTIDDets;
111 }
112 
115 {
116  return theTOBDets;
117 }
118 
121 {
122  return theTECDets;
123 }
124 
125 const GeomDetUnit*
127 {
128  mapIdToDetUnit::const_iterator p=theMapUnit.find(s.rawId());
129  if (p != theMapUnit.end())
130  return (p)->second;
131  edm::LogError("TrackerGeometry")<<"Invalid DetID: no GeomDetUnit associated";
132  GeomDetUnit* geom = 0;
133  return geom;
134 }
135 
136 const GeomDet*
138 {
139  mapIdToDet::const_iterator p=theMap.find(s.rawId());
140  if (p != theMap.end())
141  return (p)->second;
142  edm::LogError("TrackerGeometry")<<"Invalid DetID: no GeomDet associated";
143  GeomDet* geom = 0;
144  return geom;
145 }
146 
149 {
150  return theDetTypes;
151 }
152 
153 
156 {
157  return theDetUnitIds;
158 }
159 
162 {
163  return theDetIds;
164 }
165 
166 
std::vector< GeomDetType const * > DetTypeContainer
void addDet(GeomDet const *p)
mapIdToDet theMap
TrackerGeometry(GeometricDet const *gd=0)
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:43
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
void addDetUnit(GeomDetUnit const *p)
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()
void addType(GeomDetType const *p)
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:72
virtual const GeomDet * idToDet(DetId) const
DetContainer theTIDDets
const DetContainer & detsTIB() const
Definition: DetId.h:18
DetContainer thePXBDets
DetContainer thePXFDets
void addDetUnitId(DetId p)
DetContainer theTIBDets
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
std::vector< GeomDet const * > DetContainer
std::vector< GeomDetUnit const * > DetUnitContainer
GeometricDet const * theTrackerDet
virtual const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
const DetContainer & detsTID() const
std::vector< DetId > DetIdContainer