CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h

Go to the documentation of this file.
00001 #ifndef Geometry_TrackerNumberingBuilder_GeometricDet_H
00002 #define Geometry_TrackerNumberingBuilder_GeometricDet_H
00003 
00004 #include "CondFormats/GeometryObjects/interface/PGeometricDet.h"
00005 #include "DetectorDescription/Core/interface/DDExpandedView.h"
00006 #include "DetectorDescription/Base/interface/DDRotationMatrix.h"
00007 #include "DetectorDescription/Base/interface/DDTranslation.h"
00008 #include "DetectorDescription/Core/interface/DDSolidShapes.h"
00009 #include "DataFormats/GeometrySurface/interface/Surface.h"
00010 #include "DataFormats/GeometrySurface/interface/Bounds.h"
00011 #include "DataFormats/DetId/interface/DetId.h"
00012 
00013 #include <vector>
00014 #include "FWCore/ParameterSet/interface/types.h"
00015 
00016 #include <ext/pool_allocator.h>
00017 // waiting for template-alias
00018 //#define PoolAlloc  __gnu_cxx::__pool_alloc
00019 // MEC: testing whether we need all bits-and-pieces.  Setting this makes GeometricDet like it used to be.
00020 //#define GEOMETRICDETDEBUG
00021 //class DetId;
00022 class DDFilteredView;
00023 
00029 class GeometricDet {
00030  public:
00031 
00032   typedef DDExpandedView::nav_type DDnav_type;
00033   typedef DDExpandedView::NavRange NavRange;
00034 
00035   typedef std::vector< GeometricDet const *>  ConstGeometricDetContainer;
00036   typedef std::vector< GeometricDet const *>  GeometricDetContainer;
00037 
00038 #ifdef PoolAlloc  
00039   typedef std::vector< DDExpandedNode, PoolAlloc<DDExpandedNode> > GeoHistory;
00040   typedef std::vector<int, PoolAlloc<int> > nav_type;
00041 #else
00042   typedef std::vector<DDExpandedNode> GeoHistory;
00043   typedef DDExpandedView::nav_type nav_type;
00044 #endif
00045   typedef Surface::PositionType Position;
00046   typedef Surface::RotationType Rotation;
00047 
00048   //
00049   // more can be added; please add at the end!
00050   //
00051   typedef enum GDEnumType {unknown=100, Tracker=0, PixelBarrel=1, PixelEndCap=2,
00052                           TIB=3, TID=4, TOB=5, TEC=6,
00053                           layer=8, wheel=9, strng=10, rod=11, petal=12, ring=13,
00054                           ladder=14, mergedDet=15, DetUnit=16, disk=17, panel=18 } GeometricEnumType;
00058 #ifdef GEOMETRICDETDEBUG
00059   GeometricDet(DDnav_type const & navtype, GeometricEnumType dd);
00060   GeometricDet(DDExpandedView* ev, GeometricEnumType dd);
00061 #endif
00062   GeometricDet(DDFilteredView* fv, GeometricEnumType dd);
00063   GeometricDet(const PGeometricDet::Item& onePGD, GeometricEnumType dd);
00064   
00065   /*
00066   GeometricDet(const GeometricDet &);
00067 
00068   GeometricDet & operator=( const GeometricDet & );
00069   */
00070 
00074   void setGeographicalID(DetId id) const {
00075     _geographicalID = id; 
00076     //std::cout <<"setGeographicalID " << int(id) << std::endl;
00077   }
00078 #ifdef GEOMETRICDETDEBUG
00079   void setComponents(GeometricDetContainer const & cont) {
00080     _container = cont; 
00081     //std::cout <<"setComponents" << std::endl;
00082   }
00083 #endif
00084   void addComponents(GeometricDetContainer const & cont);
00085   void addComponent(GeometricDet*);
00089   void clearComponents() {
00090     _container.clear();
00091     //std::cout<<"clearComponents"<<std::endl;
00092   }
00093  
00098   void deleteComponents();
00099 
00100   bool isLeaf() const { 
00101     //std::cout <<"isLeaf() ==" <<_container.empty()<<std::endl; 
00102     return _container.empty(); 
00103   }
00104   
00108   DDRotationMatrix const & rotation() const {
00109     //std::cout<<"rotation" <<std::endl; 
00110     return _rot;
00111   }
00112   DDTranslation const & translation() const {
00113     //std::cout<<"translation" <<std::endl;
00114     return _trans;
00115   }
00116   double phi() const { 
00117     //std::cout<<"phi"<<std::endl; 
00118     return _phi; 
00119   }
00120   double rho() const { 
00121     //std::cout << "rho" <<std::endl; 
00122     return _rho; 
00123   }
00124 
00125   DDSolidShape const & shape() const  {
00126     //std::cout<<"shape"<<std::endl;
00127     return _shape;
00128   }
00129   GeometricEnumType type() const {
00130     //std::cout<<"type"<<std::endl;
00131     return _type;
00132   }
00133   DDName const & name() const {
00134     //std::cout<<"name"<<std::endl;
00135     return _ddname;
00136   }
00137   // internal representaion
00138   nav_type const & navType() const {
00139     //std::cout<<"navType"<<std::endl; 
00140     return _ddd;
00141   }
00142   // representation neutral interface
00143   NavRange navRange() const {
00144     //std::cout<<"navRange"<<std::endl;
00145     return NavRange(&_ddd.front(),_ddd.size());
00146   }
00147   // more meaningfull name (maybe)
00148   NavRange navpos() const {
00149     //std::cout<<"navpos"<<std::endl;
00150     return NavRange(&_ddd.front(),_ddd.size());
00151   }
00152   std::vector<double> const & params() const {
00153     //std::cout<<"params"<<std::endl;
00154     return _params;
00155   }
00156 
00157   ~GeometricDet();
00158   
00163   GeometricDetContainer & components() {
00164     //std::cout << "components1" <<std::endl;
00165     return _container;
00166   }  
00167   GeometricDetContainer const & components() const {
00168     //std::cout<<"const components2 "<<std::endl;
00169     return _container;
00170   }
00171 
00177   ConstGeometricDetContainer deepComponents() const;
00178   void deepComponents(GeometricDetContainer & cont) const;
00179 
00180 #ifdef GEOMETRICDETDEBUG
00181   //rr
00185   GeoHistory const &  parents() const {
00186     //std::cout<<"parents"<<std::endl;
00187     return _parents;
00188   }
00189   //rr  
00190 #endif
00191   
00195   DetId geographicalID() const  { 
00196     //std::cout<<"geographicalID"<<std::endl;
00197     return _geographicalID; 
00198   }
00199   DetId geographicalId() const  { 
00200     //std::cout<<"geographicalId"<<std::endl; 
00201     return _geographicalID; 
00202   }
00203 
00207   Position positionBounds() const; 
00208 
00212   Rotation  rotationBounds() const; 
00213 
00217   const Bounds * bounds() const; 
00218 #ifdef GEOMETRICDETDEBUG
00219   int copyno() const {
00220     //std::cout<<"copyno"<<std::endl;
00221     return _copy;
00222   }
00223   double volume() const {
00224     //std::cout<<"volume"<<std::endl;
00225     return _volume;
00226   }
00227   double density() const {
00228     //std::cout<<"density"<<std::endl;
00229     return _density;
00230   }
00231   double weight() const {
00232     //std::cout<<"weight"<<std::endl;
00233     return _weight;
00234   }
00235   std::string const &  material() const {
00236     //std::cout<<"material"<<std::endl;
00237     return _material;
00238   }
00239 #endif
00240   double radLength() const {
00241     //std::cout<<"radLength"<<std::endl;
00242     return _radLength;
00243   }
00244   double xi() const {
00245     //std::cout<<"xi - chi"<<std::endl;
00246     return _xi;
00247   }
00251   double pixROCRows() const {
00252     //std::cout<<"pixROCRows"<<std::endl;
00253     return _pixROCRows;
00254   }
00255   double pixROCCols() const {
00256     //std::cout<<"pixROCCols"<<std::endl;
00257     return _pixROCCols;
00258   }
00259   double pixROCx() const {
00260     //std::cout<<"pixROCx"<<std::endl;
00261     return _pixROCx;
00262   }
00263   double pixROCy() const {
00264     //std::cout<<"pixROCy"<<std::endl;
00265     return _pixROCy;
00266   }
00267 
00271   bool stereo() const {
00272     //std::cout<<"stereo"<<std::endl;
00273     return _stereo;
00274   }
00275   double siliconAPVNum() const {
00276     //std::cout<<"siliconAPVNum"<<std::endl;
00277     return _siliconAPVNum;
00278   }
00279 
00283 #ifdef GEOMETRICDETDEBUG
00284   bool wasBuiltFromDD() const {
00285     //std::cout<<"wasBuildFromDD"<<std::endl;
00286     return _fromDD;
00287   }
00288 #endif  
00289 
00290  private:
00291 
00292   GeometricDetContainer _container;
00293   DDTranslation _trans;
00294   double _phi;
00295   double _rho;
00296   DDRotationMatrix _rot;
00297   DDSolidShape _shape;
00298   nav_type _ddd;
00299   DDName _ddname;
00300   GeometricEnumType _type;
00301   std::vector<double> _params;
00302   //FIXME
00303   mutable DetId _geographicalID;
00304 #ifdef GEOMETRICDETDEBUG
00305   GeoHistory _parents;
00306   double _volume;
00307   double _density;
00308   double _weight;
00309   int    _copy;
00310   std::string _material;
00311 #endif
00312   double _radLength;
00313   double _xi;
00314   double _pixROCRows;
00315   double _pixROCCols;
00316   double _pixROCx;
00317   double _pixROCy;
00318   bool _stereo;
00319   double _siliconAPVNum;
00320 #ifdef GEOMETRICDETDEBUG
00321   bool _fromDD;
00322 #endif
00323 
00324 };
00325 
00326 #undef PoolAlloc
00327 #endif
00328