PandaRoot
DetPlane.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 & Johannes Rauch
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 genfit_DetPlane_h
44 #define genfit_DetPlane_h
45 
46 #include "AbsFinitePlane.h"
47 
48 #include <TObject.h>
49 #include <TVector3.h>
50 
51 #ifndef __CINT__
52 #include <boost/scoped_ptr.hpp>
53 #endif
54 
55 namespace genfit {
56 
72 class DetPlane : public TObject {
73 
74  public:
75  // Constructors/Destructors ---------
76  DetPlane(AbsFinitePlane *finite = nullptr);
77 
78  DetPlane(const TVector3 &o, const TVector3 &u, const TVector3 &v, AbsFinitePlane *finite = nullptr);
79 
80  DetPlane(const TVector3 &o, const TVector3 &n, AbsFinitePlane *finite = nullptr);
81 
82  virtual ~DetPlane();
83 
84  DetPlane(const DetPlane &);
86  void swap(DetPlane &other); // nothrow
87 
88  // Accessors -----------------------
89  const TVector3 &getO() const { return o_; }
90  const TVector3 &getU() const { return u_; }
91  const TVector3 &getV() const { return v_; }
92 
93  // Modifiers -----------------------
94  void set(const TVector3 &o, const TVector3 &u, const TVector3 &v);
95  void setO(const TVector3 &o);
96  void setO(double, double, double);
97  void setU(const TVector3 &u);
98  void setU(double, double, double);
99  void setV(const TVector3 &v);
100  void setV(double, double, double);
101  void setUV(const TVector3 &u, const TVector3 &v);
102  void setON(const TVector3 &o, const TVector3 &n);
103 
107  void setFinitePlane(AbsFinitePlane *finite) { finitePlane_.reset(finite); }
108 
109  // Operations ----------------------
110  TVector3 getNormal() const;
111  void setNormal(const TVector3 &n);
112  void setNormal(double, double, double);
113  void setNormal(const double &theta, const double &phi);
114 
116  TVector2 project(const TVector3 &x) const;
117 
119  TVector2 LabToPlane(const TVector3 &x) const;
120 
122  TVector3 toLab(const TVector2 &x) const;
123 
124  // get vector from point to plane (normal)
125  TVector3 dist(const TVector3 &point) const;
126 
128  TVector2 straightLineToPlane(const TVector3 &point, const TVector3 &dir) const;
129 
131  void straightLineToPlane(const double &posX, const double &posY, const double &posZ, const double &dirX, const double &dirY, const double &dirZ, double &u, double &v) const;
132 
133  void Print(const Option_t * = "") const;
134 
136  friend bool operator==(const DetPlane &lhs, const DetPlane &rhs);
138  friend bool operator!=(const DetPlane &lhs, const DetPlane &rhs);
139 
141  double distance(const TVector3 &point) const;
142  double distance(double, double, double) const;
143 
145  bool isInActive(const TVector3 &point, const TVector3 &dir) const
146  {
147  if (finitePlane_.get() == nullptr)
148  return true;
149  return this->isInActive(this->straightLineToPlane(point, dir));
150  }
151 
153  bool isInActive(const double &posX, const double &posY, const double &posZ, const double &dirX, const double &dirY, const double &dirZ) const
154  {
155  if (finitePlane_.get() == nullptr)
156  return true;
157  double u, v;
158  this->straightLineToPlane(posX, posY, posZ, dirX, dirY, dirZ, u, v);
159  return this->isInActive(u, v);
160  }
161 
163  bool isInActive(double u, double v) const
164  {
165  if (finitePlane_.get() == nullptr)
166  return true;
167  return finitePlane_->isInActive(u, v);
168  }
169 
171  bool isInActive(const TVector2 &v) const { return isInActive(v.X(), v.Y()); }
172 
173  bool isFinite() const { return (finitePlane_.get() != nullptr); }
174 
176  void rotate(double angle);
177 
179  void reset();
180 
181  private:
182  // Private Methods -----------------
184  void sane();
185 
186  TVector3 o_;
187  TVector3 u_;
188  TVector3 v_;
189 
190 #ifndef __CINT__
191  boost::scoped_ptr<AbsFinitePlane> finitePlane_; // Ownership
192 #else
193  class AbsFinitePlane *finitePlane_;
194 #endif
195 
196  public:
197  ClassDef(DetPlane, 1)
198 };
199 
200 } /* End of namespace genfit */
203 #endif // genfit_DetPlane_h
void setNormal(const TVector3 &n)
void setU(const TVector3 &u)
void setON(const TVector3 &o, const TVector3 &n)
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
Detector plane.
Definition: DetPlane.h:72
virtual ~DetPlane()
DetPlane(AbsFinitePlane *finite=nullptr)
double distance(const TVector3 &point) const
absolute distance from a point to the plane
const TVector3 & getV() const
Definition: DetPlane.h:91
Abstract base class for finite detector planes.
__m128 v
Definition: P4_F32vec4.h:15
TVector3 getNormal() const
friend bool operator==(const DetPlane &lhs, const DetPlane &rhs)
Checks equality of planes by comparing the 9 double values that define them.
bool isFinite() const
Definition: DetPlane.h:173
bool isInActive(const double &posX, const double &posY, const double &posZ, const double &dirX, const double &dirY, const double &dirZ) const
intersect in the active area? C.f. AbsFinitePlane
Definition: DetPlane.h:153
TVector3 dist(const TVector3 &point) const
void swap(DetPlane &other)
void setV(const TVector3 &v)
DetPlane & operator=(DetPlane)
void setUV(const TVector3 &u, const TVector3 &v)
bool isInActive(double u, double v) const
isInActive methods refer to finite plane. C.f. AbsFinitePlane
Definition: DetPlane.h:163
void setFinitePlane(AbsFinitePlane *finite)
Definition: DetPlane.h:107
void reset()
delete finitePlane_ and set O, U, V to default values
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
const TVector3 & getU() const
Definition: DetPlane.h:90
friend bool operator!=(const DetPlane &lhs, const DetPlane &rhs)
returns NOT ==
bool isInActive(const TVector2 &v) const
isInActive methods refer to finite plane. C.f. AbsFinitePlane
Definition: DetPlane.h:171
void setO(const TVector3 &o)
bool isInActive(const TVector3 &point, const TVector3 &dir) const
intersect in the active area? C.f. AbsFinitePlane
Definition: DetPlane.h:145
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
void rotate(double angle)
rotate u and v around normal. Angle is in rad. More for debugging than for actual use...
const TVector3 & getO() const
Definition: DetPlane.h:89
TVector2 straightLineToPlane(const TVector3 &point, const TVector3 &dir) const
gives u,v coordinates of the intersection point of a straight line with plane
void Print(const Option_t *="") const
Matrix inversion tools.
Definition: AbsBField.h:40