SpacePoint.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////
2 //
3 // Definition of SpacePoint class for LArSoft
4 //
5 // SpacePoints are 3D objects that contain pointers to Hits from multiple
6 // wireplanes that have been identified as matching.
7 //
8 // msoderbe@syr.edu
9 //
10 ////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef SPACEPOINT_H
13 #define SPACEPOINT_H
14 
15 #include <iosfwd>
16 
19 #include <RtypesCore.h>
20 
21 namespace recob {
22 
23  class SpacePoint {
24 
25  public:
26  using ID_t = int; ///< type of spacepoint ID
27 
28  /// Special value for an invalid ID.
29  static constexpr ID_t InvalidID = util::kBogusI;
30 
31 
32  SpacePoint(); ///Default constructor
33 
34  private:
35  ID_t fID; ///< SpacePoint ID
36  Double32_t fXYZ[3]; ///< position of SpacePoint in xyz
37  Double32_t fErrXYZ[6]; ///< Error matrix (lower triangular).
38  Double32_t fChisq; ///< Chisquare.
39 
40  public:
41  SpacePoint(Double32_t const*xyz,
42  Double32_t const*err,
43  Double32_t chisq,
44  int id=InvalidID);
45 
46  ID_t ID() const;
47  const Double32_t* XYZ() const;
48  const Double32_t* ErrXYZ() const;
49  Double32_t Chisq() const;
50 
51  /// Returns the position of the point in world coordinates [cm]
52  geo::Point_t position() const;
53 
54  /// Returns the error matrix element for two position coordinates
55  /// (`0` for _x_, `1` for _y_ and `2` for _z_)
56  double covariance(unsigned int i, unsigned int j) const;
57 
58  /// Returns the internal index of correlation structure for coordinates `i` and `j`.
59  static constexpr std::size_t covIndex(unsigned int i, unsigned int j);
60 
61  friend std::ostream& operator << (std::ostream& o, const SpacePoint & a);
62  friend bool operator < (const SpacePoint & a, const SpacePoint & b);
63 
64 
65  };
66 
67  /// Comparison of a space point with an ID, for sorting and lookup.
68  inline bool operator< (SpacePoint const& s, SpacePoint::ID_t id) { return s.ID() < id; }
69  /// Comparison of a space point with an ID, for sorting and lookup.
70  inline bool operator< (SpacePoint::ID_t id, SpacePoint const& s) { return id < s.ID(); }
71 
72 }
73 
74 
76 inline const Double32_t* recob::SpacePoint::XYZ() const { return fXYZ; }
77 inline const Double32_t* recob::SpacePoint::ErrXYZ() const { return fErrXYZ; }
78 inline Double32_t recob::SpacePoint::Chisq() const { return fChisq; }
79 
80 inline geo::Point_t recob::SpacePoint::position() const { return geo::Point_t{ fXYZ[0], fXYZ[1], fXYZ[2] }; }
81 
82 
83 #endif //SPACEPOINT_H
double covariance(unsigned int i, unsigned int j) const
Definition: SpacePoint.cxx:38
Reconstruction base classes.
int ID_t
type of spacepoint ID
Definition: SpacePoint.h:26
ID_t fID
Default constructor.
Definition: SpacePoint.h:35
constexpr int kBogusI
obviously bogus integer value
Double32_t fXYZ[3]
position of SpacePoint in xyz
Definition: SpacePoint.h:36
const double a
static constexpr std::size_t covIndex(unsigned int i, unsigned int j)
Returns the internal index of correlation structure for coordinates i and j.
Definition: SpacePoint.cxx:46
Double32_t fChisq
Chisquare.
Definition: SpacePoint.h:38
Double32_t Chisq() const
Definition: SpacePoint.h:78
friend bool operator<(const SpacePoint &a, const SpacePoint &b)
Definition: SpacePoint.cxx:74
static constexpr ID_t InvalidID
Special value for an invalid ID.
Definition: SpacePoint.h:29
void err(const char *fmt,...)
Definition: message.cpp:226
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
Double32_t fErrXYZ[6]
Error matrix (lower triangular).
Definition: SpacePoint.h:37
const Double32_t * XYZ() const
Definition: SpacePoint.h:76
static bool * b
Definition: config.cpp:1043
Definitions of geometry vector data types.
ID_t ID() const
Definition: SpacePoint.h:75
friend std::ostream & operator<<(std::ostream &o, const SpacePoint &a)
Definition: SpacePoint.cxx:58
Collection of Physical constants used in LArSoft.
geo::Point_t position() const
Returns the position of the point in world coordinates [cm].
Definition: SpacePoint.h:80
static QCString * s
Definition: config.cpp:1042
const Double32_t * ErrXYZ() const
Definition: SpacePoint.h:77