LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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
32 #ifndef GFDETPLANE_H
33 #define GFDETPLANE_H
34 
35 #include<stdexcept> // std::logic_error
36 #include"GFAbsFinitePlane.h"
37 #include "TObject.h"
38 
39 #include "TVector3.h"
40 #include "TPolyMarker3D.h"
41 #include "TPolyLine3D.h"
42 
58 namespace genf {
59 
60  class GFDetPlane : public TObject {
61  public:
62 
63  // Constructors/Destructors ---------
64  GFDetPlane(genf::GFAbsFinitePlane* finite=NULL);
65  GFDetPlane(const TVector3& o,
66  const TVector3& u,
67  const TVector3& v,
68  genf::GFAbsFinitePlane* finite=NULL);
69  GFDetPlane(const TVector3& o,
70  const TVector3& n,
71  genf::GFAbsFinitePlane* finite=NULL);
72  virtual ~GFDetPlane();
75  // Accessors -----------------------
76  TVector3 getO() const {return fO;}
77  TVector3 getU() const {return fU;}
78  TVector3 getV() const {return fV;}
79 
80  // Modifiers -----------------------
81  void set(const TVector3& o,
82  const TVector3& u,
83  const TVector3& v);
84 
85  void setO(const TVector3& o);
86  void setO(double,double,double);
87  void setU(const TVector3& u);
88  void setU(double,double,double);
89  void setV(const TVector3& v);
90  void setV(double,double,double);
91  void setUV(const TVector3& u,const TVector3& v);
92  void setON(const TVector3& o,const TVector3& n);
93 
98 
99  // Operations ----------------------
100  TVector3 getNormal() const;
101  void setNormal(TVector3 n);
102  void setNormal(double,double,double);
103  void setNormal(const double& theta, const double& phi);
105  TVector2 project(const TVector3& x) const;
107  TVector2 LabToPlane(const TVector3& x) const;
109  TVector3 toLab(const TVector2& x) const;
110  // get vector from point to plane (normal)
111  TVector3 dist(const TVector3& point) const;
112 
114  TVector2 straightLineToPlane(const TVector3& point,const TVector3& dir) const;
115 
116 
117  void Print(std::ostream& out = std::cout) const;
118 
120  void getGraphics(double mesh, double length, TPolyMarker3D **pl, TPolyLine3D **plLine,TPolyLine3D **u, TPolyLine3D **v, TPolyLine3D **n=NULL);
121 
124  friend bool operator== (const GFDetPlane&, const GFDetPlane&);
126  friend bool operator!= (const GFDetPlane&, const GFDetPlane&);
127 
128  double distance(TVector3&) const;
129  double distance(double,double,double) const;
130 
131 
133  bool inActive(const TVector3& point, const TVector3& dir) const{
134  return this->inActive( this->straightLineToPlane(point,dir));
135  }
136 
138  bool inActive(double u, double v) const{
139  if(fFinitePlane==NULL) return true;
140  return fFinitePlane->inActive(u,v);
141  }
142 
144  bool inActive(const TVector2& v) const{
145  return inActive(v.X(),v.Y());
146  }
147 
148  //private:
149 
150  // Private Data Members ------------
151  // origin
152  TVector3 fO;
153  // Vectors spanning the plane
154  TVector3 fU;
155  TVector3 fV;
156 
158 
159  // Private Methods -----------------
160 
161  void sane(); // ensures orthnormal coordinates
162 
163  private:
164  virtual void Print(Option_t*) const
165  { throw std::logic_error(std::string(__func__) + "::Print(Option_t*) not available"); }
166 
167  //public:
168  //ClassDef(GFDetPlane,2)
169 
170  };
171 
172  bool operator==(const genf::GFDetPlane&, const genf::GFDetPlane&);
173  bool operator!=(const genf::GFDetPlane&, const genf::GFDetPlane&);
174 
175 } // namespace genf
176 
177 #endif
178 
Float_t x
Definition: compare.C:6
void setON(const TVector3 &o, const TVector3 &n)
Definition: GFDetPlane.cxx:147
void setU(const TVector3 &u)
Definition: GFDetPlane.cxx:107
GFDetPlane & operator=(const genf::GFDetPlane &)
Definition: GFDetPlane.cxx:67
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:289
Generic Interface to magnetic fields in GENFIT.
TVector3 dist(const TVector3 &point) const
Definition: GFDetPlane.cxx:209
void setO(const TVector3 &o)
Definition: GFDetPlane.cxx:94
void setUV(const TVector3 &u, const TVector3 &v)
Definition: GFDetPlane.cxx:132
void Print(std::ostream &out=std::cout) const
Definition: GFDetPlane.cxx:242
virtual void Print(Option_t *) const
Definition: GFDetPlane.h:164
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
Definition: GFDetPlane.cxx:183
friend bool operator!=(const GFDetPlane &, const GFDetPlane &)
returns NOT ==
TVector3 getNormal() const
Definition: GFDetPlane.cxx:140
void setFinitePlane(genf::GFAbsFinitePlane *finite)
Definition: GFDetPlane.h:97
TVector3 getO() const
Definition: GFDetPlane.h:76
void setV(const TVector3 &v)
Definition: GFDetPlane.cxx:120
double distance(TVector3 &) const
Definition: GFDetPlane.cxx:349
bool inActive(double u, double v) const
inActive methods refer to finite plane. C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:138
virtual bool inActive(const double &u, const double &v) const =0
genf::GFAbsFinitePlane * fFinitePlane
Definition: GFDetPlane.h:157
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
Definition: GFDetPlane.cxx:198
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
Definition: GFDetPlane.cxx:191
virtual ~GFDetPlane()
Definition: GFDetPlane.cxx:56
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:363
TVector3 getU() const
Definition: GFDetPlane.h:77
TDirectory * dir
Definition: macro.C:5
void setNormal(TVector3 n)
Definition: GFDetPlane.cxx:158
Char_t n[5]
bool inActive(const TVector3 &point, const TVector3 &dir) const
intersect in the active area? C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:133
TVector3 getV() const
Definition: GFDetPlane.h:78
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:144
GFDetPlane(genf::GFAbsFinitePlane *finite=NULL)
Definition: GFDetPlane.cxx:39