FWTGeoRecoGeometry

Info

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#ifndef GEOMETRY_FWTGEO_RECO_GEOMETRY_H
#define GEOMETRY_FWTGEO_RECO_GEOMETRY_H

#include <cassert>
#include <map>
#include <string>
#include <vector>

#include "DataFormats/GeometryVector/interface/GlobalPoint.h"

class TGeoManager;

class FWTGeoRecoGeometry {
public:
  FWTGeoRecoGeometry(void);
  virtual ~FWTGeoRecoGeometry(void);

  static const int maxCorner_ = 8;
  static const int maxPoints_ = 3 * maxCorner_;
  struct Info {
    std::string name;
    float points[maxPoints_];  // x1,y1,z1...x8,y8,z8,...,x12,y12,z12
    float topology[9];
    Info(const std::string& iname) : name(iname) { init(); }
    Info(void) { init(); }
    void init(void) {
      for (unsigned int i = 0; i < maxPoints_; ++i)
        points[i] = 0;
      for (unsigned int i = 0; i < 9; ++i)
        topology[i] = 0;
    }
    void fillPoints(std::vector<GlobalPoint>::const_iterator begin, std::vector<GlobalPoint>::const_iterator end) {
      unsigned int index(0);
      for (std::vector<GlobalPoint>::const_iterator i = begin; i != end; ++i) {
        assert(index < maxCorner_);
        points[index * 3] = i->x();
        points[index * 3 + 1] = i->y();
        points[index * 3 + 2] = i->z();
        ++index;
      }
    }
  };
  typedef std::map<unsigned int, FWTGeoRecoGeometry::Info> InfoMap;

  InfoMap idToName;

  TGeoManager* manager(void) const { return m_manager; }
  void manager(TGeoManager* geom) { m_manager = geom; }

private:
  TGeoManager* m_manager;
};

#endif  // GEOMETRY_FWTGEO_RECO_GEOMETRY_H