CMS 3D CMS Logo

GeometricDet.h
Go to the documentation of this file.
1 #ifndef Geometry_TrackerNumberingBuilder_GeometricDet_H
2 #define Geometry_TrackerNumberingBuilder_GeometricDet_H
3 
12 
13 #include <vector>
14 #include <memory>
16 
17 #include <ext/pool_allocator.h>
18 // waiting for template-alias
19 //#define PoolAlloc __gnu_cxx::__pool_alloc
20 // MEC: testing whether we need all bits-and-pieces. Setting this makes GeometricDet like it used to be.
21 //#define GEOMETRICDETDEBUG
22 //class DetId;
23 class DDFilteredView;
24 
30 class GeometricDet {
31  public:
32 
35 
36  typedef std::vector< GeometricDet const *> ConstGeometricDetContainer;
37  typedef std::vector< GeometricDet *> GeometricDetContainer;
38 
39 #ifdef PoolAlloc
40  typedef std::vector< DDExpandedNode, PoolAlloc<DDExpandedNode> > GeoHistory;
41  typedef std::vector<int, PoolAlloc<int> > nav_type;
42 #else
43  typedef std::vector<DDExpandedNode> GeoHistory;
45 #endif
48 
49  //
50  // more can be added; please add at the end!
51  //
52  typedef enum GDEnumType {unknown=100, Tracker=0, PixelBarrel=1, PixelEndCap=2,
53  TIB=3, TID=4, TOB=5, TEC=6,
54  layer=8, wheel=9, strng=10, rod=11, petal=12, ring=13,
55  ladder=14, mergedDet=15, DetUnit=16, disk=17, panel=18,
62  // PixelV4021Barrel=301, PixelV4021EndCap=302 } GeometricEnumType;
66 #ifdef GEOMETRICDETDEBUG
67  GeometricDet(DDnav_type const & navtype, GeometricEnumType dd);
69 #endif
72 
73  /*
74  GeometricDet(const GeometricDet &);
75 
76  GeometricDet & operator=( const GeometricDet & );
77  */
78 
84  //std::cout <<"setGeographicalID " << int(id) << std::endl;
85  }
86 #ifdef GEOMETRICDETDEBUG
87  void setComponents(GeometricDetContainer const & cont) {
88  _container = cont;
89  //std::cout <<"setComponents" << std::endl;
90  }
91 #endif
92  void addComponents(GeometricDetContainer const & cont);
93  void addComponents(ConstGeometricDetContainer const & cont);
98  void clearComponents() {
99  _container.clear();
100  //std::cout<<"clearComponents"<<std::endl;
101  }
102 
107  void deleteComponents();
108 
109  bool isLeaf() const {
110  //std::cout <<"isLeaf() ==" <<_container.empty()<<std::endl;
111  return _container.empty();
112  }
113 
115  return const_cast<GeometricDet*>(_container[index]);
116  }
117 
121  DDRotationMatrix const & rotation() const {
122  //std::cout<<"rotation" <<std::endl;
123  return _rot;
124  }
125  DDTranslation const & translation() const {
126  //std::cout<<"translation" <<std::endl;
127  return _trans;
128  }
129  double phi() const {
130  //std::cout<<"phi"<<std::endl;
131  return _phi;
132  }
133  double rho() const {
134  //std::cout << "rho" <<std::endl;
135  return _rho;
136  }
137 
138  DDSolidShape const & shape() const {
139  //std::cout<<"shape"<<std::endl;
140  return _shape;
141  }
143  //std::cout<<"type"<<std::endl;
144  return _type;
145  }
146  DDName const & name() const {
147  //std::cout<<"name"<<std::endl;
148  return _ddname;
149  }
150  // internal representaion
151  nav_type const & navType() const {
152  //std::cout<<"navType"<<std::endl;
153  return _ddd;
154  }
155  // representation neutral interface
156  NavRange navRange() const {
157  //std::cout<<"navRange"<<std::endl;
158  return NavRange(&_ddd.front(),_ddd.size());
159  }
160  // more meaningfull name (maybe)
161  NavRange navpos() const {
162  //std::cout<<"navpos"<<std::endl;
163  return NavRange(&_ddd.front(),_ddd.size());
164  }
165  std::vector<double> const & params() const {
166  //std::cout<<"params"<<std::endl;
167  return _params;
168  }
169 
170  ~GeometricDet();
171 
176  ConstGeometricDetContainer & components() {
177  //std::cout << "components1" <<std::endl;
178  return _container;
179  }
180  ConstGeometricDetContainer const & components() const {
181  //std::cout<<"const components2 "<<std::endl;
182  return _container;
183  }
184 
190  ConstGeometricDetContainer deepComponents() const;
191  void deepComponents(ConstGeometricDetContainer & cont) const;
192 
193 #ifdef GEOMETRICDETDEBUG
194  //rr
198  GeoHistory const & parents() const {
199  //std::cout<<"parents"<<std::endl;
200  return _parents;
201  }
202  //rr
203 #endif
204 
209  //std::cout<<"geographicalID"<<std::endl;
210  return _geographicalID;
211  }
213  //std::cout<<"geographicalId"<<std::endl;
214  return _geographicalID;
215  }
216 
220  Position positionBounds() const;
221 
225  Rotation rotationBounds() const;
226 
230  std::unique_ptr<Bounds> bounds() const;
231 #ifdef GEOMETRICDETDEBUG
232  int copyno() const {
233  //std::cout<<"copyno"<<std::endl;
234  return _copy;
235  }
236  double volume() const {
237  //std::cout<<"volume"<<std::endl;
238  return _volume;
239  }
240  double density() const {
241  //std::cout<<"density"<<std::endl;
242  return _density;
243  }
244  double weight() const {
245  //std::cout<<"weight"<<std::endl;
246  return _weight;
247  }
248  std::string const & material() const {
249  //std::cout<<"material"<<std::endl;
250  return _material;
251  }
252 #endif
253  double radLength() const {
254  //std::cout<<"radLength"<<std::endl;
255  return _radLength;
256  }
257  double xi() const {
258  //std::cout<<"xi - chi"<<std::endl;
259  return _xi;
260  }
264  double pixROCRows() const {
265  //std::cout<<"pixROCRows"<<std::endl;
266  return _pixROCRows;
267  }
268  double pixROCCols() const {
269  //std::cout<<"pixROCCols"<<std::endl;
270  return _pixROCCols;
271  }
272  double pixROCx() const {
273  //std::cout<<"pixROCx"<<std::endl;
274  return _pixROCx;
275  }
276  double pixROCy() const {
277  //std::cout<<"pixROCy"<<std::endl;
278  return _pixROCy;
279  }
280 
284  bool stereo() const {
285  //std::cout<<"stereo"<<std::endl;
286  return _stereo;
287  }
288  double siliconAPVNum() const {
289  //std::cout<<"siliconAPVNum"<<std::endl;
290  return _siliconAPVNum;
291  }
292 
296 #ifdef GEOMETRICDETDEBUG
297  bool wasBuiltFromDD() const {
298  //std::cout<<"wasBuildFromDD"<<std::endl;
299  return _fromDD;
300  }
301 #endif
302 
303  private:
304 
305  ConstGeometricDetContainer _container;
307  double _phi;
308  double _rho;
311  nav_type _ddd;
314  std::vector<double> _params;
315 
317 #ifdef GEOMETRICDETDEBUG
318  GeoHistory _parents;
319  double _volume;
320  double _density;
321  double _weight;
322  int _copy;
323  std::string _material;
324 #endif
325  double _radLength;
326  double _xi;
327  double _pixROCRows;
328  double _pixROCCols;
329  double _pixROCx;
330  double _pixROCy;
331  bool _stereo;
333 #ifdef GEOMETRICDETDEBUG
334  bool _fromDD;
335 #endif
336 
337 };
338 
339 #undef PoolAlloc
340 #endif
341 
ConstGeometricDetContainer _container
Definition: GeometricDet.h:305
double pixROCy() const
Definition: GeometricDet.h:276
double _pixROCCols
Definition: GeometricDet.h:328
double radLength() const
Definition: GeometricDet.h:253
TPRegexp parents
Definition: eve_filter.cc:21
DDName _ddname
Definition: GeometricDet.h:312
double _pixROCRows
Definition: GeometricDet.h:327
void addComponent(GeometricDet *)
nav_type const & navType() const
Definition: GeometricDet.h:151
double _pixROCy
Definition: GeometricDet.h:330
void clearComponents()
Definition: GeometricDet.h:98
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
DDSolidShape
Definition: DDSolidShapes.h:4
DDSolidShape const & shape() const
Definition: GeometricDet.h:138
double _siliconAPVNum
Definition: GeometricDet.h:332
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
void setGeographicalID(DetId id)
Definition: GeometricDet.h:82
Surface::RotationType Rotation
Definition: GeometricDet.h:47
bool isLeaf() const
Definition: GeometricDet.h:109
bool ev
DDTranslation _trans
Definition: GeometricDet.h:306
GeometricEnumType _type
Definition: GeometricDet.h:313
DetId geographicalID() const
Definition: GeometricDet.h:208
std::vector< GeometricDet * > GeometricDetContainer
Definition: GeometricDet.h:37
Surface::PositionType Position
Definition: GeometricDet.h:46
double _pixROCx
Definition: GeometricDet.h:329
std::pair< int const *, size_t > NavRange
enum GeometricDet::GDEnumType GeometricEnumType
nav_type _ddd
Definition: GeometricDet.h:311
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:176
std::vector< double > const & params() const
Definition: GeometricDet.h:165
DDName const & name() const
Definition: GeometricDet.h:146
Position positionBounds() const
NavRange navRange() const
Definition: GeometricDet.h:156
std::vector< double > _params
Definition: GeometricDet.h:314
GeometricDet(DDFilteredView *fv, GeometricEnumType dd)
std::unique_ptr< Bounds > bounds() const
DDTranslation const & translation() const
Definition: GeometricDet.h:125
double pixROCCols() const
Definition: GeometricDet.h:268
DDRotationMatrix const & rotation() const
Definition: GeometricDet.h:121
GeometricDet * component(size_t index)
Definition: GeometricDet.h:114
DetId _geographicalID
Definition: GeometricDet.h:316
void deleteComponents()
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:36
DDSolidShape _shape
Definition: GeometricDet.h:310
Definition: DetId.h:18
ConstGeometricDetContainer const & components() const
Definition: GeometricDet.h:180
double xi() const
Definition: GeometricDet.h:257
DetId geographicalId() const
Definition: GeometricDet.h:212
double pixROCx() const
Definition: GeometricDet.h:272
double _radLength
Definition: GeometricDet.h:325
NavRange navpos() const
Definition: GeometricDet.h:161
double phi() const
Definition: GeometricDet.h:129
ConstGeometricDetContainer deepComponents() const
void addComponents(GeometricDetContainer const &cont)
Rotation rotationBounds() const
DDRotationMatrix _rot
Definition: GeometricDet.h:309
double siliconAPVNum() const
Definition: GeometricDet.h:288
Definition: DDUnits.h:8
DDExpandedView::nav_type nav_type
Definition: GeometricDet.h:44
bool stereo() const
Definition: GeometricDet.h:284
DDExpandedView::nav_type DDnav_type
Definition: GeometricDet.h:33
double pixROCRows() const
Definition: GeometricDet.h:264
Provides an exploded view of the detector (tree-view)
def _copy(old, new, skip=[])
GeometricEnumType type() const
Definition: GeometricDet.h:142
DDExpandedView::NavRange NavRange
Definition: GeometricDet.h:34
double rho() const
Definition: GeometricDet.h:133
std::vector< int > nav_type
std::vector of sibling numbers
std::vector< DDExpandedNode > GeoHistory
Definition: GeometricDet.h:43