Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:24

0001 #ifndef GEOMETRY_FWTGEO_RECO_GEOMETRY_H
0002 #define GEOMETRY_FWTGEO_RECO_GEOMETRY_H
0003 
0004 #include <cassert>
0005 #include <map>
0006 #include <string>
0007 #include <vector>
0008 
0009 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0010 
0011 class TGeoManager;
0012 
0013 class FWTGeoRecoGeometry {
0014 public:
0015   FWTGeoRecoGeometry(void);
0016   virtual ~FWTGeoRecoGeometry(void);
0017 
0018   static const int maxCorner_ = 8;
0019   static const int maxPoints_ = 3 * maxCorner_;
0020   struct Info {
0021     std::string name;
0022     float points[maxPoints_];  // x1,y1,z1...x8,y8,z8,...,x12,y12,z12
0023     float topology[9];
0024     Info(const std::string& iname) : name(iname) { init(); }
0025     Info(void) { init(); }
0026     void init(void) {
0027       for (unsigned int i = 0; i < maxPoints_; ++i)
0028         points[i] = 0;
0029       for (unsigned int i = 0; i < 9; ++i)
0030         topology[i] = 0;
0031     }
0032     void fillPoints(std::vector<GlobalPoint>::const_iterator begin, std::vector<GlobalPoint>::const_iterator end) {
0033       unsigned int index(0);
0034       for (std::vector<GlobalPoint>::const_iterator i = begin; i != end; ++i) {
0035         assert(index < maxCorner_);
0036         points[index * 3] = i->x();
0037         points[index * 3 + 1] = i->y();
0038         points[index * 3 + 2] = i->z();
0039         ++index;
0040       }
0041     }
0042   };
0043   typedef std::map<unsigned int, FWTGeoRecoGeometry::Info> InfoMap;
0044 
0045   InfoMap idToName;
0046 
0047   TGeoManager* manager(void) const { return m_manager; }
0048   void manager(TGeoManager* geom) { m_manager = geom; }
0049 
0050 private:
0051   TGeoManager* m_manager;
0052 };
0053 
0054 #endif  // GEOMETRY_FWTGEO_RECO_GEOMETRY_H