File indexing completed on 2025-08-05 08:18:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef genfit_DetPlane_h
0032 #define genfit_DetPlane_h
0033
0034 #include "AbsFinitePlane.h"
0035
0036 #include <TObject.h>
0037 #include <TVector3.h>
0038
0039 #include <memory>
0040
0041
0042 namespace genfit {
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 class DetPlane : public TObject {
0060
0061 public:
0062
0063
0064
0065 DetPlane(AbsFinitePlane* finite = nullptr);
0066
0067 DetPlane(const TVector3& o,
0068 const TVector3& u,
0069 const TVector3& v,
0070 AbsFinitePlane* finite = nullptr);
0071
0072 DetPlane(const TVector3& o,
0073 const TVector3& n,
0074 AbsFinitePlane* finite = nullptr);
0075
0076 virtual ~DetPlane();
0077
0078 DetPlane(const DetPlane&);
0079 DetPlane& operator=(DetPlane);
0080 void swap(DetPlane& other);
0081
0082
0083 const TVector3& getO() const {return o_;}
0084 const TVector3& getU() const {return u_;}
0085 const TVector3& getV() const {return v_;}
0086
0087
0088 void set(const TVector3& o,
0089 const TVector3& u,
0090 const TVector3& v);
0091 void setO(const TVector3& o);
0092 void setO(double, double, double);
0093 void setU(const TVector3& u);
0094 void setU(double, double, double);
0095 void setV(const TVector3& v);
0096 void setV(double, double, double);
0097 void setUV(const TVector3& u, const TVector3& v);
0098 void setON(const TVector3& o, const TVector3& n);
0099
0100
0101
0102
0103 void setFinitePlane(AbsFinitePlane* finite){finitePlane_.reset(finite);}
0104
0105
0106 TVector3 getNormal() const;
0107 void setNormal(const TVector3& n);
0108 void setNormal(double, double, double);
0109 void setNormal(const double& theta, const double& phi);
0110
0111
0112 TVector2 project(const TVector3& x) const;
0113
0114
0115 TVector2 LabToPlane(const TVector3& x) const;
0116
0117
0118 TVector3 toLab(const TVector2& x) const;
0119
0120
0121 TVector3 dist(const TVector3& point) const;
0122
0123
0124 TVector2 straightLineToPlane(const TVector3& point, const TVector3& dir) const;
0125
0126
0127 void straightLineToPlane(const double& posX, const double& posY, const double& posZ,
0128 const double& dirX, const double& dirY, const double& dirZ,
0129 double& u, double& v) const;
0130
0131 void Print(const Option_t* = "") const;
0132
0133
0134 friend bool operator== (const DetPlane& lhs, const DetPlane& rhs);
0135
0136 friend bool operator!= (const DetPlane& lhs, const DetPlane& rhs);
0137
0138
0139 double distance(const TVector3& point) const;
0140 double distance(double, double, double) const;
0141
0142
0143
0144 bool isInActive(const TVector3& point, const TVector3& dir) const {
0145 if(finitePlane_.get() == nullptr) return true;
0146 return this->isInActive( this->straightLineToPlane(point,dir));
0147 }
0148
0149
0150 bool isInActive(const double& posX, const double& posY, const double& posZ,
0151 const double& dirX, const double& dirY, const double& dirZ) const {
0152 if(finitePlane_.get() == nullptr) return true;
0153 double u, v;
0154 this->straightLineToPlane(posX, posY, posZ, dirX, dirY, dirZ, u, v);
0155 return this->isInActive(u, v);
0156 }
0157
0158
0159 bool isInActive(double u, double v) const{
0160 if(finitePlane_.get() == nullptr) return true;
0161 return finitePlane_->isInActive(u,v);
0162 }
0163
0164
0165 bool isInActive(const TVector2& v) const{
0166 return isInActive(v.X(),v.Y());
0167 }
0168
0169 bool isFinite() const {
0170 return (finitePlane_.get() != nullptr);
0171 }
0172
0173
0174 void rotate(double angle);
0175
0176
0177 void reset();
0178
0179 private:
0180
0181
0182 void sane();
0183
0184 TVector3 o_;
0185 TVector3 u_;
0186 TVector3 v_;
0187
0188 std::unique_ptr<AbsFinitePlane> finitePlane_;
0189
0190 public:
0191 ClassDef(DetPlane,1)
0192
0193 };
0194
0195 }
0196
0197
0198 #endif