SND@LHC Software
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
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#ifndef __CINT__
40#include <boost/scoped_ptr.hpp>
41#endif
42
43
44namespace genfit {
45
61class DetPlane : public TObject {
62
63 public:
64
65
66 // Constructors/Destructors ---------
67 DetPlane(AbsFinitePlane* finite = NULL);
68
69 DetPlane(const TVector3& o,
70 const TVector3& u,
71 const TVector3& v,
72 AbsFinitePlane* finite = NULL);
73
74 DetPlane(const TVector3& o,
75 const TVector3& n,
76 AbsFinitePlane* finite = NULL);
77
78 virtual ~DetPlane();
79
80 DetPlane(const DetPlane&);
82 void swap(DetPlane& other); // nothrow
83
84 // Accessors -----------------------
85 const TVector3& getO() const {return o_;}
86 const TVector3& getU() const {return u_;}
87 const TVector3& getV() const {return v_;}
88
89 // Modifiers -----------------------
90 void set(const TVector3& o,
91 const TVector3& u,
92 const TVector3& v);
93 void setO(const TVector3& o);
94 void setO(double, double, double);
95 void setU(const TVector3& u);
96 void setU(double, double, double);
97 void setV(const TVector3& v);
98 void setV(double, double, double);
99 void setUV(const TVector3& u, const TVector3& v);
100 void setON(const TVector3& o, const TVector3& n);
101
105 void setFinitePlane(AbsFinitePlane* finite){finitePlane_.reset(finite);}
106
107 // Operations ----------------------
108 TVector3 getNormal() const;
109 void setNormal(const TVector3& n);
110 void setNormal(double, double, double);
111 void setNormal(const double& theta, const double& phi);
112
114 TVector2 project(const TVector3& x) const;
115
117 TVector2 LabToPlane(const TVector3& x) const;
118
120 TVector3 toLab(const TVector2& x) const;
121
122 // get vector from point to plane (normal)
123 TVector3 dist(const TVector3& point) const;
124
126 TVector2 straightLineToPlane(const TVector3& point, const TVector3& dir) const;
127
129 void straightLineToPlane(const double& posX, const double& posY, const double& posZ,
130 const double& dirX, const double& dirY, const double& dirZ,
131 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
144
146 bool isInActive(const TVector3& point, const TVector3& dir) const {
147 if(finitePlane_.get() == NULL) return true;
148 return this->isInActive( this->straightLineToPlane(point,dir));
149 }
150
152 bool isInActive(const double& posX, const double& posY, const double& posZ,
153 const double& dirX, const double& dirY, const double& dirZ) const {
154 if(finitePlane_.get() == NULL) return true;
155 double u, v;
156 this->straightLineToPlane(posX, posY, posZ, dirX, dirY, dirZ, u, v);
157 return this->isInActive(u, v);
158 }
159
161 bool isInActive(double u, double v) const{
162 if(finitePlane_.get() == NULL) return true;
163 return finitePlane_->isInActive(u,v);
164 }
165
167 bool isInActive(const TVector2& v) const{
168 return isInActive(v.X(),v.Y());
169 }
170
171 bool isFinite() const {
172 return (finitePlane_.get() != NULL);
173 }
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
194#endif
195
196
197 public:
198 ClassDef(DetPlane,1)
199
200};
201
202} /* End of namespace genfit */
205#endif // genfit_DetPlane_h
Abstract base class for finite detector planes.
Detector plane.
Definition DetPlane.h:61
void swap(DetPlane &other)
Definition DetPlane.cc:85
void setV(const TVector3 &v)
Definition DetPlane.cc:128
void rotate(double angle)
rotate u and v around normal. Angle is in rad. More for debugging than for actual use.
Definition DetPlane.cc:320
TVector3 getNormal() const
Definition DetPlane.cc:157
boost::scoped_ptr< AbsFinitePlane > finitePlane_
Definition DetPlane.h:191
const TVector3 & getU() const
Definition DetPlane.h:86
double distance(const TVector3 &point) const
absolute distance from a point to the plane
Definition DetPlane.cc:268
bool isInActive(const TVector2 &v) const
isInActive methods refer to finite plane. C.f. AbsFinitePlane
Definition DetPlane.h:167
const TVector3 & getO() const
Definition DetPlane.h:85
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
Definition DetPlane.cc:190
void Print(const Option_t *="") const
Definition DetPlane.cc:220
void reset()
delete finitePlane_ and set O, U, V to default values
Definition DetPlane.cc:329
void setO(const TVector3 &o)
Definition DetPlane.cc:106
DetPlane & operator=(DetPlane)
Definition DetPlane.cc:79
void set(const TVector3 &o, const TVector3 &u, const TVector3 &v)
Definition DetPlane.cc:95
virtual ~DetPlane()
Definition DetPlane.cc:62
void setUV(const TVector3 &u, const TVector3 &v)
Definition DetPlane.cc:144
void setON(const TVector3 &o, const TVector3 &n)
Definition DetPlane.cc:151
void setU(const TVector3 &u)
Definition DetPlane.cc:116
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
Definition DetPlane.cc:178
void setFinitePlane(AbsFinitePlane *finite)
Definition DetPlane.h:105
bool isInActive(const TVector3 &point, const TVector3 &dir) const
intersect in the active area? C.f. AbsFinitePlane
Definition DetPlane.h:146
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:241
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
Definition DetPlane.cc:184
const TVector3 & getV() const
Definition DetPlane.h:87
void sane()
ensures orthonormal coordinates
Definition DetPlane.cc:205
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:152
void setNormal(const TVector3 &n)
Definition DetPlane.cc:166
TVector3 dist(const TVector3 &point) const
Definition DetPlane.cc:199
friend bool operator!=(const DetPlane &lhs, const DetPlane &rhs)
returns NOT ==
Definition DetPlane.cc:263
bool isFinite() const
Definition DetPlane.h:171
bool isInActive(double u, double v) const
isInActive methods refer to finite plane. C.f. AbsFinitePlane
Definition DetPlane.h:161
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:283
Matrix inversion tools.
Definition AbsBField.h:29