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
21 /**
22  * @author Christian H&ouml;ppner (Technische Universit&auml;t M&uuml;nchen, original author)
23  * @author Sebastian Neubert (Technische Universit&auml;t M&uuml;nchen, original author)
24  *
25  */
26 
27 
28 /** @addtogroup genfit
29  * @{
30  */
31 
32 #ifndef GFDETPLANE_H
33 #define GFDETPLANE_H
34 
35 #include<stdexcept> // std::logic_error
36 #include <string>
37 
38 #include"GFAbsFinitePlane.h"
39 #include "TObject.h"
40 
41 #include "RtypesCore.h"
42 #include "TVector2.h"
43 #include "TVector3.h"
44 
45 class TPolyMarker3D;
46 class TPolyLine3D;
47 
48 /** @brief Detector plane genfit geometry class
49  *
50  * A detector plane is the principle object to define coordinate systems for
51  * track fitting in genfit. Since a particle trajectory is a
52  * one-dimensional object (regardless of any specific parameterization)
53  * positions with repect to the track are always meassured in a plane.
54  *
55  * Which plane is choosen depends on the type of detector. Fixed plane
56  * detectors have their detector plane defined by their mechanical setup. While
57  * wire chambers or time projection chambers might want to define a detector
58  * plane more flexibly.
59  *
60  * This class parameterizes a plane in terms of an origin vector o
61  * and two plane-spanning directions u and v.
62  */
63 namespace genf {
64 
65  class GFDetPlane : public TObject {
66  public:
67 
68  // Constructors/Destructors ---------
69  GFDetPlane(genf::GFAbsFinitePlane* finite=NULL);
70  GFDetPlane(const TVector3& o,
71  const TVector3& u,
72  const TVector3& v,
73  genf::GFAbsFinitePlane* finite=NULL);
74  GFDetPlane(const TVector3& o,
75  const TVector3& n,
76  genf::GFAbsFinitePlane* finite=NULL);
77  virtual ~GFDetPlane();
80  // Accessors -----------------------
81  TVector3 getO() const {return fO;}
82  TVector3 getU() const {return fU;}
83  TVector3 getV() const {return fV;}
84 
85  // Modifiers -----------------------
86  void set(const TVector3& o,
87  const TVector3& u,
88  const TVector3& v);
89 
90  void setO(const TVector3& o);
91  void setO(double,double,double);
92  void setU(const TVector3& u);
93  void setU(double,double,double);
94  void setV(const TVector3& v);
95  void setV(double,double,double);
96  void setUV(const TVector3& u,const TVector3& v);
97  void setON(const TVector3& o,const TVector3& n);
98 
99  //! Optionally, set the finite plane definition. This is most important for
100  //! avoiding fake intersection points in fitting of loopers. This should
101  //! be implemented for silicon detectors most importantly.
103 
104  // Operations ----------------------
105  TVector3 getNormal() const;
106  void setNormal(TVector3 n);
107  void setNormal(double,double,double);
108  void setNormal(const double& theta, const double& phi);
109  //! projecting a direction onto the plane:
110  TVector2 project(const TVector3& x) const;
111  //! transform from Lab system into plane
112  TVector2 LabToPlane(const TVector3& x) const;
113  //! transform from plane coordinates to lab system
114  TVector3 toLab(const TVector2& x) const;
115  // get vector from point to plane (normal)
116  TVector3 dist(const TVector3& point) const;
117 
118  //! gives u,v coordinates of the intersection point of a straight line with plane
119  TVector2 straightLineToPlane(const TVector3& point,const TVector3& dir) const;
120 
121 
122  void Print(std::ostream& out = std::cout) const;
123 
124  //! for poor attempts of making an event display. There is a lot of room for improvements.
125  void getGraphics(double mesh, double length, TPolyMarker3D **pl, TPolyLine3D **plLine,TPolyLine3D **u, TPolyLine3D **v, TPolyLine3D **n=NULL);
126 
127  //! this operator is called very often in Kalman filtering. It checks equality of planes
128  //! by comparing the 9 double values that define them.
129  friend bool operator== (const GFDetPlane&, const GFDetPlane&);
130  //! returns NOT ==
131  friend bool operator!= (const GFDetPlane&, const GFDetPlane&);
132 
133  double distance(TVector3&) const;
134  double distance(double,double,double) const;
135 
136 
137  //! intersect in the active area? C.f. GFAbsFinitePlane
138  bool inActive(const TVector3& point, const TVector3& dir) const{
139  return this->inActive( this->straightLineToPlane(point,dir));
140  }
141 
142  //! inActive methods refer to finite plane. C.f. GFAbsFinitePlane
143  bool inActive(double u, double v) const{
144  if(fFinitePlane==NULL) return true;
145  return fFinitePlane->inActive(u,v);
146  }
147 
148  //! inActive methods refer to finite plane. C.f. GFAbsFinitePlane
149  bool inActive(const TVector2& v) const{
150  return inActive(v.X(),v.Y());
151  }
152 
153  //private:
154 
155  // Private Data Members ------------
156  // origin
157  TVector3 fO;
158  // Vectors spanning the plane
159  TVector3 fU;
160  TVector3 fV;
161 
163 
164  // Private Methods -----------------
165 
166  void sane(); // ensures orthnormal coordinates
167 
168  private:
169  virtual void Print(Option_t*) const
170  { throw std::logic_error(std::string(__func__) + "::Print(Option_t*) not available"); }
171 
172  //public:
173  //ClassDef(GFDetPlane,2)
174 
175  };
176 
177  bool operator==(const genf::GFDetPlane&, const genf::GFDetPlane&);
178  bool operator!=(const genf::GFDetPlane&, const genf::GFDetPlane&);
179 
180 } // namespace genf
181 
182 #endif
183 
184 /** @} */
void setON(const TVector3 &o, const TVector3 &n)
Definition: GFDetPlane.cxx:152
void setU(const TVector3 &u)
Definition: GFDetPlane.cxx:112
GFDetPlane & operator=(const genf::GFDetPlane &)
Definition: GFDetPlane.cxx:72
std::string string
Definition: nybbler.cc:12
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:294
Generic Interface to magnetic fields in GENFIT.
Definition: GFAbsBField.h:35
TVector3 dist(const TVector3 &point) const
Definition: GFDetPlane.cxx:214
void setO(const TVector3 &o)
Definition: GFDetPlane.cxx:99
void setUV(const TVector3 &u, const TVector3 &v)
Definition: GFDetPlane.cxx:137
void Print(std::ostream &out=std::cout) const
Definition: GFDetPlane.cxx:247
string dir
virtual void Print(Option_t *) const
Definition: GFDetPlane.h:169
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
Definition: GFDetPlane.cxx:188
friend bool operator!=(const GFDetPlane &, const GFDetPlane &)
returns NOT ==
TVector3 getNormal() const
Definition: GFDetPlane.cxx:145
void setFinitePlane(genf::GFAbsFinitePlane *finite)
Definition: GFDetPlane.h:102
TVector3 getO() const
Definition: GFDetPlane.h:81
void setV(const TVector3 &v)
Definition: GFDetPlane.cxx:125
double distance(TVector3 &) const
Definition: GFDetPlane.cxx:354
bool inActive(double u, double v) const
inActive methods refer to finite plane. C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:143
virtual bool inActive(const double &u, const double &v) const =0
std::void_t< T > n
genf::GFAbsFinitePlane * fFinitePlane
Definition: GFDetPlane.h:162
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
Definition: GFDetPlane.cxx:203
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
Definition: GFDetPlane.cxx:196
virtual ~GFDetPlane()
Definition: GFDetPlane.cxx:61
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:368
TVector3 getU() const
Definition: GFDetPlane.h:82
void setNormal(TVector3 n)
Definition: GFDetPlane.cxx:163
list x
Definition: train.py:276
bool inActive(const TVector3 &point, const TVector3 &dir) const
intersect in the active area? C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:138
TVector3 getV() const
Definition: GFDetPlane.h:83
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:44