PandaRoot
GFDetPlane.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /* Copyright 2008-2010, Technische Universitaet Muenchen,
14  Authors: Christian Hoeppner & Sebastian Neubert
15 
16  This file is part of GENFIT.
17 
18  GENFIT is free software: you can redistribute it and/or modify
19  it under the terms of the GNU Lesser General Public License as published
20  by the Free Software Foundation, either version 3 of the License, or
21  (at your option) any later version.
22 
23  GENFIT is distributed in the hope that it will be useful,
24  but WITHOUT ANY WARRANTY; without even the implied warranty of
25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  GNU Lesser General Public License for more details.
27 
28  You should have received a copy of the GNU Lesser General Public License
29  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
30 */
31 // Description:
32 // Detector plane - a geometric object
43 #ifndef GFDETPLANE_H
44 #define GFDETPLANE_H
45 
46 #include "GFAbsFinitePlane.h"
47 
48 #include "TObject.h"
49 
50 #include "TVector3.h"
51 #include "TPolyMarker3D.h"
52 #include "TPolyLine3D.h"
53 
70 class GFDetPlane : public TObject {
71  public:
72  // Constructors/Destructors ---------
73  GFDetPlane(GFAbsFinitePlane *finite = nullptr);
74  GFDetPlane(const TVector3 &o, const TVector3 &u, const TVector3 &v, GFAbsFinitePlane *finite = nullptr);
75  GFDetPlane(const TVector3 &o, const TVector3 &n, GFAbsFinitePlane *finite = nullptr);
76  virtual ~GFDetPlane();
77  GFDetPlane(const GFDetPlane &);
79  // Accessors -----------------------
80  TVector3 getO() const { return fO; }
81  TVector3 getU() const { return fU; }
82  TVector3 getV() const { return fV; }
83 
84  // Modifiers -----------------------
85  void set(const TVector3 &o, const TVector3 &u, const TVector3 &v);
86 
87  void setO(const TVector3 &o);
88  void setO(double, double, double);
89  void setU(const TVector3 &u);
90  void setU(double, double, double);
91  void setV(const TVector3 &v);
92  void setV(double, double, double);
93  void setUV(const TVector3 &u, const TVector3 &v);
94  void setON(const TVector3 &o, const TVector3 &n);
95 
99  void setFinitePlane(GFAbsFinitePlane *finite) { fFinitePlane = finite; }
100 
101  // Operations ----------------------
102  TVector3 getNormal() const;
103  void setNormal(TVector3 n);
104  void setNormal(double, double, double);
105  void setNormal(const double &theta, const double &phi);
107  TVector2 project(const TVector3 &x) const;
109  TVector2 LabToPlane(const TVector3 &x) const;
111  TVector3 toLab(const TVector2 &x) const;
112  // get vector from point to plane (normal)
113  TVector3 dist(const TVector3 &point) const;
114 
116  TVector2 straightLineToPlane(const TVector3 &point, const TVector3 &dir) const;
117 
118  void Print() const;
119 
121  void getGraphics(double mesh, double length, TPolyMarker3D **pl, TPolyLine3D **plLine, TPolyLine3D **u, TPolyLine3D **v, TPolyLine3D **n = nullptr);
122 
125  friend bool operator==(const GFDetPlane &lhs, const GFDetPlane &rhs);
127  friend bool operator!=(const GFDetPlane &lhs, const GFDetPlane &rhs);
128 
129  double distance(TVector3 &) const;
130  double distance(double, double, double) const;
131 
133  bool inActive(const TVector3 &point, const TVector3 &dir) const { return this->inActive(this->straightLineToPlane(point, dir)); }
134 
136  bool inActive(double u, double v) const
137  {
138  if (fFinitePlane == nullptr)
139  return true;
140  return fFinitePlane->inActive(u, v);
141  }
142 
144  bool inActive(const TVector2 &v) const { return inActive(v.X(), v.Y()); }
145 
146  private:
147  // Private Data Members ------------
148  // origin
149  TVector3 fO;
150  // Vectors spanning the plane
151  TVector3 fU;
152  TVector3 fV;
153 
154  GFAbsFinitePlane *fFinitePlane;
155 
156  // Private Methods -----------------
157 
158  void sane(); // ensures orthnormal coordinates
159  public:
160  ClassDef(GFDetPlane, 2)
161 };
162 
163 #endif
164 
void setFinitePlane(GFAbsFinitePlane *finite)
Definition: GFDetPlane.h:99
TVector2 straightLineToPlane(const TVector3 &point, const TVector3 &dir) const
gives u,v coordinates of the intersection point of a straight line with plane
void getGraphics(double mesh, double length, TPolyMarker3D **pl, TPolyLine3D **plLine, TPolyLine3D **u, TPolyLine3D **v, TPolyLine3D **n=nullptr)
for poor attempts of making an event display. There is a lot of room for improvements.
Detector plane genfit geometry class.
Definition: GFDetPlane.h:70
void setU(const TVector3 &u)
void setON(const TVector3 &o, const TVector3 &n)
void setO(const TVector3 &o)
TVector3 getV() const
Definition: GFDetPlane.h:82
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
TVector3 getU() const
Definition: GFDetPlane.h:81
__m128 v
Definition: P4_F32vec4.h:15
GFDetPlane & operator=(const GFDetPlane &)
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
void setNormal(TVector3 n)
bool inActive(double u, double v) const
inActive methods refer to finite plane. C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:136
TVector3 getO() const
Definition: GFDetPlane.h:80
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
friend bool operator==(const GFDetPlane &lhs, const GFDetPlane &rhs)
TVector3 dist(const TVector3 &point) const
GFDetPlane(GFAbsFinitePlane *finite=nullptr)
double distance(TVector3 &) const
void setUV(const TVector3 &u, const TVector3 &v)
bool inActive(const TVector3 &point, const TVector3 &dir) const
intersect in the active area? C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:133
void setV(const TVector3 &v)
virtual ~GFDetPlane()
friend bool operator!=(const GFDetPlane &lhs, const GFDetPlane &rhs)
returns NOT ==
void Print() const
virtual bool inActive(const double &u, const double &v) const =0
TVector3 getNormal() const
bool inActive(const TVector2 &v) const
inActive methods refer to finite plane. C.f. GFAbsFinitePlane
Definition: GFDetPlane.h:144
Abstract base class for implementing arbitrarily shaped finite detector planes.