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,
61  // PixelV4021Barrel=301, PixelV4021EndCap=302 } GeometricEnumType;
65 #ifdef GEOMETRICDETDEBUG
66  GeometricDet(DDnav_type const & navtype, GeometricEnumType dd);
68 #endif
71 
72  /*
73  GeometricDet(const GeometricDet &);
74 
75  GeometricDet & operator=( const GeometricDet & );
76  */
77 
83  //std::cout <<"setGeographicalID " << int(id) << std::endl;
84  }
85 #ifdef GEOMETRICDETDEBUG
86  void setComponents(GeometricDetContainer const & cont) {
87  _container = cont;
88  //std::cout <<"setComponents" << std::endl;
89  }
90 #endif
91  void addComponents(GeometricDetContainer const & cont);
92  void addComponents(ConstGeometricDetContainer const & cont);
97  void clearComponents() {
98  _container.clear();
99  //std::cout<<"clearComponents"<<std::endl;
100  }
101 
106  void deleteComponents();
107 
108  bool isLeaf() const {
109  //std::cout <<"isLeaf() ==" <<_container.empty()<<std::endl;
110  return _container.empty();
111  }
112 
114  return const_cast<GeometricDet*>(_container[index]);
115  }
116 
120  DDRotationMatrix const & rotation() const {
121  //std::cout<<"rotation" <<std::endl;
122  return _rot;
123  }
124  DDTranslation const & translation() const {
125  //std::cout<<"translation" <<std::endl;
126  return _trans;
127  }
128  double phi() const {
129  //std::cout<<"phi"<<std::endl;
130  return _phi;
131  }
132  double rho() const {
133  //std::cout << "rho" <<std::endl;
134  return _rho;
135  }
136 
137  DDSolidShape const & shape() const {
138  //std::cout<<"shape"<<std::endl;
139  return _shape;
140  }
142  //std::cout<<"type"<<std::endl;
143  return _type;
144  }
145  DDName const & name() const {
146  //std::cout<<"name"<<std::endl;
147  return _ddname;
148  }
149  // internal representaion
150  nav_type const & navType() const {
151  //std::cout<<"navType"<<std::endl;
152  return _ddd;
153  }
154  // representation neutral interface
155  NavRange navRange() const {
156  //std::cout<<"navRange"<<std::endl;
157  return NavRange(&_ddd.front(),_ddd.size());
158  }
159  // more meaningfull name (maybe)
160  NavRange navpos() const {
161  //std::cout<<"navpos"<<std::endl;
162  return NavRange(&_ddd.front(),_ddd.size());
163  }
164  std::vector<double> const & params() const {
165  //std::cout<<"params"<<std::endl;
166  return _params;
167  }
168 
169  ~GeometricDet();
170 
175  ConstGeometricDetContainer & components() {
176  //std::cout << "components1" <<std::endl;
177  return _container;
178  }
179  ConstGeometricDetContainer const & components() const {
180  //std::cout<<"const components2 "<<std::endl;
181  return _container;
182  }
183 
189  ConstGeometricDetContainer deepComponents() const;
190  void deepComponents(ConstGeometricDetContainer & cont) const;
191 
192 #ifdef GEOMETRICDETDEBUG
193  //rr
197  GeoHistory const & parents() const {
198  //std::cout<<"parents"<<std::endl;
199  return _parents;
200  }
201  //rr
202 #endif
203 
208  //std::cout<<"geographicalID"<<std::endl;
209  return _geographicalID;
210  }
212  //std::cout<<"geographicalId"<<std::endl;
213  return _geographicalID;
214  }
215 
219  Position positionBounds() const;
220 
224  Rotation rotationBounds() const;
225 
229  std::unique_ptr<Bounds> bounds() const;
230 #ifdef GEOMETRICDETDEBUG
231  int copyno() const {
232  //std::cout<<"copyno"<<std::endl;
233  return _copy;
234  }
235  double volume() const {
236  //std::cout<<"volume"<<std::endl;
237  return _volume;
238  }
239  double density() const {
240  //std::cout<<"density"<<std::endl;
241  return _density;
242  }
243  double weight() const {
244  //std::cout<<"weight"<<std::endl;
245  return _weight;
246  }
247  std::string const & material() const {
248  //std::cout<<"material"<<std::endl;
249  return _material;
250  }
251 #endif
252  double radLength() const {
253  //std::cout<<"radLength"<<std::endl;
254  return _radLength;
255  }
256  double xi() const {
257  //std::cout<<"xi - chi"<<std::endl;
258  return _xi;
259  }
263  double pixROCRows() const {
264  //std::cout<<"pixROCRows"<<std::endl;
265  return _pixROCRows;
266  }
267  double pixROCCols() const {
268  //std::cout<<"pixROCCols"<<std::endl;
269  return _pixROCCols;
270  }
271  double pixROCx() const {
272  //std::cout<<"pixROCx"<<std::endl;
273  return _pixROCx;
274  }
275  double pixROCy() const {
276  //std::cout<<"pixROCy"<<std::endl;
277  return _pixROCy;
278  }
279 
283  bool stereo() const {
284  //std::cout<<"stereo"<<std::endl;
285  return _stereo;
286  }
287  double siliconAPVNum() const {
288  //std::cout<<"siliconAPVNum"<<std::endl;
289  return _siliconAPVNum;
290  }
291 
295 #ifdef GEOMETRICDETDEBUG
296  bool wasBuiltFromDD() const {
297  //std::cout<<"wasBuildFromDD"<<std::endl;
298  return _fromDD;
299  }
300 #endif
301 
302  private:
303 
304  ConstGeometricDetContainer _container;
306  double _phi;
307  double _rho;
310  nav_type _ddd;
313  std::vector<double> _params;
314 
316 #ifdef GEOMETRICDETDEBUG
317  GeoHistory _parents;
318  double _volume;
319  double _density;
320  double _weight;
321  int _copy;
322  std::string _material;
323 #endif
324  double _radLength;
325  double _xi;
326  double _pixROCRows;
327  double _pixROCCols;
328  double _pixROCx;
329  double _pixROCy;
330  bool _stereo;
332 #ifdef GEOMETRICDETDEBUG
333  bool _fromDD;
334 #endif
335 
336 };
337 
338 #undef PoolAlloc
339 #endif
340 
ConstGeometricDetContainer _container
Definition: GeometricDet.h:304
double pixROCy() const
Definition: GeometricDet.h:275
double _pixROCCols
Definition: GeometricDet.h:327
double radLength() const
Definition: GeometricDet.h:252
TPRegexp parents
Definition: eve_filter.cc:21
DDName _ddname
Definition: GeometricDet.h:311
double _pixROCRows
Definition: GeometricDet.h:326
void addComponent(GeometricDet *)
nav_type const & navType() const
Definition: GeometricDet.h:150
double _pixROCy
Definition: GeometricDet.h:329
void clearComponents()
Definition: GeometricDet.h:97
DDSolidShape
Definition: DDSolidShapes.h:6
DDSolidShape const & shape() const
Definition: GeometricDet.h:137
double _siliconAPVNum
Definition: GeometricDet.h:331
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
void setGeographicalID(DetId id)
Definition: GeometricDet.h:81
Surface::RotationType Rotation
Definition: GeometricDet.h:47
bool isLeaf() const
Definition: GeometricDet.h:108
bool ev
DDTranslation _trans
Definition: GeometricDet.h:305
GeometricEnumType _type
Definition: GeometricDet.h:312
DetId geographicalID() const
Definition: GeometricDet.h:207
std::vector< GeometricDet * > GeometricDetContainer
Definition: GeometricDet.h:37
Surface::PositionType Position
Definition: GeometricDet.h:46
double _pixROCx
Definition: GeometricDet.h:328
std::pair< int const *, size_t > NavRange
enum GeometricDet::GDEnumType GeometricEnumType
nav_type _ddd
Definition: GeometricDet.h:310
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:175
std::vector< double > const & params() const
Definition: GeometricDet.h:164
DDName const & name() const
Definition: GeometricDet.h:145
Position positionBounds() const
NavRange navRange() const
Definition: GeometricDet.h:155
std::vector< double > _params
Definition: GeometricDet.h:313
GeometricDet(DDFilteredView *fv, GeometricEnumType dd)
std::unique_ptr< Bounds > bounds() const
DDTranslation const & translation() const
Definition: GeometricDet.h:124
double pixROCCols() const
Definition: GeometricDet.h:267
DDRotationMatrix const & rotation() const
Definition: GeometricDet.h:120
GeometricDet * component(size_t index)
Definition: GeometricDet.h:113
DetId _geographicalID
Definition: GeometricDet.h:315
void deleteComponents()
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:36
DDSolidShape _shape
Definition: GeometricDet.h:309
Definition: DetId.h:18
ConstGeometricDetContainer const & components() const
Definition: GeometricDet.h:179
double xi() const
Definition: GeometricDet.h:256
DetId geographicalId() const
Definition: GeometricDet.h:211
double pixROCx() const
Definition: GeometricDet.h:271
double _radLength
Definition: GeometricDet.h:324
NavRange navpos() const
Definition: GeometricDet.h:160
double phi() const
Definition: GeometricDet.h:128
ConstGeometricDetContainer deepComponents() const
void addComponents(GeometricDetContainer const &cont)
Rotation rotationBounds() const
DDRotationMatrix _rot
Definition: GeometricDet.h:308
double siliconAPVNum() const
Definition: GeometricDet.h:287
DDExpandedView::nav_type nav_type
Definition: GeometricDet.h:44
bool stereo() const
Definition: GeometricDet.h:283
DDExpandedView::nav_type DDnav_type
Definition: GeometricDet.h:33
double pixROCRows() const
Definition: GeometricDet.h:263
Provides an exploded view of the detector (tree-view)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
GeometricEnumType type() const
Definition: GeometricDet.h:141
DDExpandedView::NavRange NavRange
Definition: GeometricDet.h:34
double rho() const
Definition: GeometricDet.h:132
std::vector< int > nav_type
std::vector of sibling numbers
std::vector< DDExpandedNode > GeoHistory
Definition: GeometricDet.h:43