GENFIT Rev: NoNumberAvailable
Loading...
Searching...
No Matches
DetPlane.h
Go to the documentation of this file.
1/* Copyright 2008-2010, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
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
26
30
31#ifndef genfit_DetPlane_h
32#define genfit_DetPlane_h
33
34#include "AbsFinitePlane.h"
35
36#include <TObject.h>
37#include <TVector3.h>
38
39#include <memory>
40
41
42namespace genfit {
43
59class DetPlane : public TObject {
60
61 public:
62
63
64 // Constructors/Destructors ---------
65 DetPlane(AbsFinitePlane* finite = nullptr);
66
67 DetPlane(const TVector3& o,
68 const TVector3& u,
69 const TVector3& v,
70 AbsFinitePlane* finite = nullptr);
71
72 DetPlane(const TVector3& o,
73 const TVector3& n,
74 AbsFinitePlane* finite = nullptr);
75
76 virtual ~DetPlane();
77
78 DetPlane(const DetPlane&);
80 void swap(DetPlane& other); // nothrow
81
82 // Accessors -----------------------
83 const TVector3& getO() const {return o_;}
84 const TVector3& getU() const {return u_;}
85 const TVector3& getV() const {return v_;}
86
87 // Modifiers -----------------------
88 void set(const TVector3& o,
89 const TVector3& u,
90 const TVector3& v);
91 void setO(const TVector3& o);
92 void setO(double, double, double);
93 void setU(const TVector3& u);
94 void setU(double, double, double);
95 void setV(const TVector3& v);
96 void setV(double, double, double);
97 void setUV(const TVector3& u, const TVector3& v);
98 void setON(const TVector3& o, const TVector3& n);
99
103 void setFinitePlane(AbsFinitePlane* finite){finitePlane_.reset(finite);}
104
105 // Operations ----------------------
106 TVector3 getNormal() const;
107 void setNormal(const TVector3& n);
108 void setNormal(double, double, double);
109 void setNormal(const double& theta, const double& phi);
110
112 TVector2 project(const TVector3& x) const;
113
115 TVector2 LabToPlane(const TVector3& x) const;
116
118 TVector3 toLab(const TVector2& x) const;
119
120 // get vector from point to plane (normal)
121 TVector3 dist(const TVector3& point) const;
122
124 TVector2 straightLineToPlane(const TVector3& point, const TVector3& dir) const;
125
127 void straightLineToPlane(const double& posX, const double& posY, const double& posZ,
128 const double& dirX, const double& dirY, const double& dirZ,
129 double& u, double& v) const;
130
131 void Print(const Option_t* = "") const;
132
134 friend bool operator== (const DetPlane& lhs, const DetPlane& rhs);
136 friend bool operator!= (const DetPlane& lhs, const DetPlane& rhs);
137
139 double distance(const TVector3& point) const;
140 double distance(double, double, double) const;
141
142
144 bool isInActive(const TVector3& point, const TVector3& dir) const {
145 if(finitePlane_.get() == nullptr) return true;
146 return this->isInActive( this->straightLineToPlane(point,dir));
147 }
148
150 bool isInActive(const double& posX, const double& posY, const double& posZ,
151 const double& dirX, const double& dirY, const double& dirZ) const {
152 if(finitePlane_.get() == nullptr) return true;
153 double u, v;
154 this->straightLineToPlane(posX, posY, posZ, dirX, dirY, dirZ, u, v);
155 return this->isInActive(u, v);
156 }
157
159 bool isInActive(double u, double v) const{
160 if(finitePlane_.get() == nullptr) return true;
161 return finitePlane_->isInActive(u,v);
162 }
163
165 bool isInActive(const TVector2& v) const{
166 return isInActive(v.X(),v.Y());
167 }
168
169 bool isFinite() const {
170 return (finitePlane_.get() != nullptr);
171 }
172
174 void rotate(double angle);
175
177 void reset();
178
179 private:
180 // Private Methods -----------------
182 void sane();
183
184 TVector3 o_;
185 TVector3 u_;
186 TVector3 v_;
187
188 std::unique_ptr<AbsFinitePlane> finitePlane_; // Ownership
189
190 public:
191 ClassDef(DetPlane,1)
192
193};
194
195} /* End of namespace genfit */
197
198#endif // genfit_DetPlane_h
Abstract base class for finite detector planes.
Detector plane.
Definition DetPlane.h:59
void swap(DetPlane &other)
Definition DetPlane.cc:84
void setV(const TVector3 &v)
Definition DetPlane.cc:127
void rotate(double angle)
rotate u and v around normal. Angle is in rad. More for debugging than for actual use.
Definition DetPlane.cc:319
TVector3 getNormal() const
Definition DetPlane.cc:156
DetPlane(AbsFinitePlane *finite=nullptr)
Definition DetPlane.cc:32
const TVector3 & getU() const
Definition DetPlane.h:84
double distance(const TVector3 &point) const
absolute distance from a point to the plane
Definition DetPlane.cc:267
bool isInActive(const TVector2 &v) const
isInActive methods refer to finite plane. C.f. AbsFinitePlane
Definition DetPlane.h:165
const TVector3 & getO() const
Definition DetPlane.h:83
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
Definition DetPlane.cc:189
void Print(const Option_t *="") const
Definition DetPlane.cc:219
void reset()
delete finitePlane_ and set O, U, V to default values
Definition DetPlane.cc:328
void setO(const TVector3 &o)
Definition DetPlane.cc:105
DetPlane & operator=(DetPlane)
Definition DetPlane.cc:78
void set(const TVector3 &o, const TVector3 &u, const TVector3 &v)
Definition DetPlane.cc:94
virtual ~DetPlane()
Definition DetPlane.cc:61
void setUV(const TVector3 &u, const TVector3 &v)
Definition DetPlane.cc:143
void setON(const TVector3 &o, const TVector3 &n)
Definition DetPlane.cc:150
void setU(const TVector3 &u)
Definition DetPlane.cc:115
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
Definition DetPlane.cc:177
void setFinitePlane(AbsFinitePlane *finite)
Definition DetPlane.h:103
bool isInActive(const TVector3 &point, const TVector3 &dir) const
intersect in the active area? C.f. AbsFinitePlane
Definition DetPlane.h:144
friend bool operator==(const DetPlane &lhs, const DetPlane &rhs)
Checks equality of planes by comparing the 9 double values that define them.
Definition DetPlane.cc:240
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
Definition DetPlane.cc:183
std::unique_ptr< AbsFinitePlane > finitePlane_
Definition DetPlane.h:188
const TVector3 & getV() const
Definition DetPlane.h:85
void sane()
ensures orthonormal coordinates
Definition DetPlane.cc:204
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:150
void setNormal(const TVector3 &n)
Definition DetPlane.cc:165
TVector3 dist(const TVector3 &point) const
Definition DetPlane.cc:198
friend bool operator!=(const DetPlane &lhs, const DetPlane &rhs)
returns NOT ==
Definition DetPlane.cc:262
bool isFinite() const
Definition DetPlane.h:169
bool isInActive(double u, double v) const
isInActive methods refer to finite plane. C.f. AbsFinitePlane
Definition DetPlane.h:159
TVector2 straightLineToPlane(const TVector3 &point, const TVector3 &dir) const
gives u,v coordinates of the intersection point of a straight line with plane
Definition DetPlane.cc:282
Defines for I/O streams used for error and debug printing.