EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GFDetPlane.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GFDetPlane.h
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"GFAbsFinitePlane.h"
36 
37 #include "TObject.h"
38 
39 #include "TVector3.h"
40 #include "TPolyMarker3D.h"
41 #include "TPolyLine3D.h"
42 
59 class GFDetPlane : public TObject {
60 public:
61 
62  // Constructors/Destructors ---------
63  GFDetPlane(GFAbsFinitePlane* finite=NULL);
64  GFDetPlane(const TVector3& o,
65  const TVector3& u,
66  const TVector3& v,
67  GFAbsFinitePlane* finite=NULL);
68  GFDetPlane(const TVector3& o,
69  const TVector3& n,
70  GFAbsFinitePlane* finite=NULL);
71  virtual ~GFDetPlane();
72  GFDetPlane(const GFDetPlane&);
74  // Accessors -----------------------
75  TVector3 getO() const {return fO;}
76  TVector3 getU() const {return fU;}
77  TVector3 getV() const {return fV;}
78 
79  // Modifiers -----------------------
80  void set(const TVector3& o,
81  const TVector3& u,
82  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 
116  void Print(const Option_t* = "") const;
117 
119  void getGraphics(double mesh, double length, TPolyMarker3D **pl, TPolyLine3D **plLine,TPolyLine3D **u, TPolyLine3D **v, TPolyLine3D **n=NULL);
120 
123  friend bool operator== (const GFDetPlane& lhs, const GFDetPlane& rhs);
125  friend bool operator!= (const GFDetPlane& lhs, const GFDetPlane& rhs);
126 
127  double distance(TVector3) const;
128  double distance(double,double,double) const;
129 
130 
132  bool inActive(const TVector3& point, const TVector3& dir) const{
133  return this->inActive( this->straightLineToPlane(point,dir));
134  }
135 
137  bool inActive(double u, double v) const{
138  if(fFinitePlane==NULL) return true;
139  return fFinitePlane->inActive(u,v);
140  }
141 
143  bool inActive(const TVector2& v) const{
144  return inActive(v.X(),v.Y());
145  }
146 
147 private:
148 
149  // Private Data Members ------------
150  // origin
151  TVector3 fO;
152  // Vectors spanning the plane
153  TVector3 fU;
154  TVector3 fV;
155 
157 
158  // Private Methods -----------------
159 
160  void sane(); // ensures orthnormal coordinates
161 public:
162  ClassDef(GFDetPlane,2)
163 
164 };
165 
166 #endif
167