LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GFDetPlane.h
Go to the documentation of this file.
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
19 // Description:
20 // Detector plane - a geometric object
31 #ifndef GFDETPLANE_H
32 #define GFDETPLANE_H
33 
34 #include <stdexcept> // std::logic_error
35 #include <string>
36 
37 #include "GFAbsFinitePlane.h"
38 #include "TObject.h"
39 
40 #include "RtypesCore.h"
41 #include "TVector2.h"
42 #include "TVector3.h"
43 
44 class TPolyMarker3D;
45 class TPolyLine3D;
46 
62 namespace genf {
63 
64  class GFDetPlane : public TObject {
65  public:
66  // Constructors/Destructors ---------
67  GFDetPlane(genf::GFAbsFinitePlane* finite = NULL);
68  GFDetPlane(const TVector3& o,
69  const TVector3& u,
70  const TVector3& v,
71  genf::GFAbsFinitePlane* finite = NULL);
72  GFDetPlane(const TVector3& o, const TVector3& n, genf::GFAbsFinitePlane* finite = NULL);
73  virtual ~GFDetPlane();
76  // Accessors -----------------------
77  TVector3 getO() const { return fO; }
78  TVector3 getU() const { return fU; }
79  TVector3 getV() const { return fV; }
80 
81  // Modifiers -----------------------
82  void set(const TVector3& o, const TVector3& u, const TVector3& v);
83 
84  void setO(const TVector3& o);
85  void setO(double, double, double);
86  void setU(const TVector3& u);
87  void setU(double, double, double);
88  void setV(const TVector3& v);
89  void setV(double, double, double);
90  void setUV(const TVector3& u, const TVector3& v);
91  void setON(const TVector3& o, const TVector3& n);
92 
97 
98  // Operations ----------------------
99  TVector3 getNormal() const;
100  void setNormal(TVector3 n);
101  void setNormal(double, double, double);
102  void setNormal(const double& theta, const double& phi);
104  TVector2 project(const TVector3& x) const;
106  TVector2 LabToPlane(const TVector3& x) const;
108  TVector3 toLab(const TVector2& x) const;
109  // get vector from point to plane (normal)
110  TVector3 dist(const TVector3& point) const;
111 
113  TVector2 straightLineToPlane(const TVector3& point, const TVector3& dir) const;
114 
115  void Print(std::ostream& out = std::cout) const;
116 
118  void getGraphics(double mesh,
119  double length,
120  TPolyMarker3D** pl,
121  TPolyLine3D** plLine,
122  TPolyLine3D** u,
123  TPolyLine3D** v,
124  TPolyLine3D** n = NULL);
125 
128  friend bool operator==(const GFDetPlane&, const GFDetPlane&);
130  friend bool operator!=(const GFDetPlane&, const GFDetPlane&);
131 
132  double distance(TVector3&) const;
133  double distance(double, double, double) const;
134 
136  bool inActive(const TVector3& point, const TVector3& dir) const
137  {
138  return this->inActive(this->straightLineToPlane(point, dir));
139  }
140 
142  bool inActive(double u, double v) const
143  {
144  if (fFinitePlane == NULL) return true;
145  return fFinitePlane->inActive(u, v);
146  }
147 
149  bool inActive(const TVector2& v) const { return inActive(v.X(), v.Y()); }
150 
151  //private:
152 
153  // Private Data Members ------------
154  // origin
155  TVector3 fO;
156  // Vectors spanning the plane
157  TVector3 fU;
158  TVector3 fV;
159 
161 
162  // Private Methods -----------------
163 
164  void sane(); // ensures orthnormal coordinates
165 
166  private:
167  virtual void Print(Option_t*) const
168  {
169  throw std::logic_error(std::string(__func__) + "::Print(Option_t*) not available");
170  }
171 
172  //public:
173  //ClassDef(GFDetPlane,2)
174  };
175 
176  bool operator==(const genf::GFDetPlane&, const genf::GFDetPlane&);
177  bool operator!=(const genf::GFDetPlane&, const genf::GFDetPlane&);
178 
179 } // namespace genf
180 
181 #endif
182 
Float_t x
Definition: compare.C:6
void setON(const TVector3 &o, const TVector3 &n)
Definition: GFDetPlane.cxx:140
void setU(const TVector3 &u)
Definition: GFDetPlane.cxx:105
GFDetPlane & operator=(const genf::GFDetPlane &)
Definition: GFDetPlane.cxx:72
void getGraphics(double mesh, double length, TPolyMarker3D **pl, TPolyLine3D **plLine, TPolyLine3D **u, TPolyLine3D **v, TPolyLine3D **n=NULL)
for poor attempts of making an event display. There is a lot of room for improvements.
Definition: GFDetPlane.cxx:271
Generic Interface to magnetic fields in GENFIT.
Definition: GFAbsBField.h:34
TVector3 dist(const TVector3 &point) const
Definition: GFDetPlane.cxx:199
void setO(const TVector3 &o)
Definition: GFDetPlane.cxx:94
void setUV(const TVector3 &u, const TVector3 &v)
Definition: GFDetPlane.cxx:126
void Print(std::ostream &out=std::cout) const
Definition: GFDetPlane.cxx:228
virtual void Print(Option_t *) const
Definition: GFDetPlane.h:167
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
Definition: GFDetPlane.cxx:178
friend bool operator!=(const GFDetPlane &, const GFDetPlane &)
returns NOT ==
TVector3 getNormal() const
Definition: GFDetPlane.cxx:133
void setFinitePlane(genf::GFAbsFinitePlane *finite)
Definition: GFDetPlane.h:96
TVector3 getO() const
Definition: GFDetPlane.h:77
void setV(const TVector3 &v)
Definition: GFDetPlane.cxx:116
double distance(TVector3 &) const
Definition: GFDetPlane.cxx:340
bool inActive(double u, double v) const
inActive methods refer to finite plane. C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:142
virtual bool inActive(const double &u, const double &v) const =0
genf::GFAbsFinitePlane * fFinitePlane
Definition: GFDetPlane.h:160
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
Definition: GFDetPlane.cxx:191
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
Definition: GFDetPlane.cxx:185
virtual ~GFDetPlane()
Definition: GFDetPlane.cxx:57
TVector2 straightLineToPlane(const TVector3 &point, const TVector3 &dir) const
gives u,v coordinates of the intersection point of a straight line with plane
Definition: GFDetPlane.cxx:356
TVector3 getU() const
Definition: GFDetPlane.h:78
TDirectory * dir
Definition: macro.C:5
void setNormal(TVector3 n)
Definition: GFDetPlane.cxx:151
Char_t n[5]
bool inActive(const TVector3 &point, const TVector3 &dir) const
intersect in the active area? C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:136
TVector3 getV() const
Definition: GFDetPlane.h:79
friend bool operator==(const GFDetPlane &, const GFDetPlane &)
bool inActive(const TVector2 &v) const
inActive methods refer to finite plane. C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:149
GFDetPlane(genf::GFAbsFinitePlane *finite=NULL)
Definition: GFDetPlane.cxx:42