32 DetPlane::DetPlane(AbsFinitePlane* finite)
43 DetPlane::DetPlane(
const TVector3& o,
46 AbsFinitePlane* finite)
47 :o_(o), u_(u), v_(v), finitePlane_(finite)
52 DetPlane::DetPlane(
const TVector3& o,
54 AbsFinitePlane* finite)
55 :o_(o), finitePlane_(finite)
61 DetPlane::~DetPlane(){
66 DetPlane::DetPlane(
const DetPlane& rhs) :
73 finitePlane_.reset(rhs.finitePlane_->clone());
74 else finitePlane_.reset();
78 DetPlane& DetPlane::operator=(DetPlane other) {
84 void DetPlane::swap(DetPlane& other) {
87 std::swap(this->o_, other.o_);
88 std::swap(this->u_, other.u_);
89 std::swap(this->v_, other.v_);
90 this->finitePlane_.swap(other.finitePlane_);
94 void DetPlane::set(
const TVector3& o,
105 void DetPlane::setO(
const TVector3& o)
110 void DetPlane::setO(
double X,
double Y,
double Z)
115 void DetPlane::setU(
const TVector3& u)
121 void DetPlane::setU(
double X,
double Y,
double Z)
127 void DetPlane::setV(
const TVector3& v)
130 u_ = getNormal().Cross(v_);
135 void DetPlane::setV(
double X,
double Y,
double Z)
138 u_ = getNormal().Cross(v_);
143 void DetPlane::setUV(
const TVector3& u,
const TVector3& v)
150 void DetPlane::setON(
const TVector3& o,
const TVector3& n){
156 TVector3 DetPlane::getNormal()
const
161 void DetPlane::setNormal(
double X,
double Y,
double Z){
162 setNormal( TVector3(X,Y,Z) );
165 void DetPlane::setNormal(
const TVector3& n){
172 void DetPlane::setNormal(
const double& theta,
const double& phi){
173 setNormal( TVector3(TMath::Sin(theta)*TMath::Cos(phi),TMath::Sin(theta)*TMath::Sin(phi),TMath::Cos(theta)) );
177 TVector2 DetPlane::project(
const TVector3& x)
const
179 return TVector2(u_*x, v_*x);
183 TVector2 DetPlane::LabToPlane(
const TVector3& x)
const
185 return project(x-o_);
189 TVector3 DetPlane::toLab(
const TVector2& x)
const
198 TVector3 DetPlane::dist(
const TVector3& x)
const
200 return toLab(LabToPlane(x)) - x;
204 void DetPlane::sane(){
212 if (u_.Dot(v_) < 1.E-5)
return;
215 v_ = getNormal().Cross(u_);
219 void DetPlane::Print(
const Option_t* option)
const
222 <<
"O("<<o_.X()<<
", "<<o_.Y()<<
", "<<o_.Z()<<
") "
223 <<
"u("<<u_.X()<<
", "<<u_.Y()<<
", "<<u_.Z()<<
") "
224 <<
"v("<<v_.X()<<
", "<<v_.Y()<<
", "<<v_.Z()<<
") "
225 <<
"n("<<getNormal().X()<<
", "<<getNormal().Y()<<
", "<<getNormal().Z()<<
") "
227 if(finitePlane_ !=
nullptr) {
228 finitePlane_->Print(option);
243 static const double detplaneEpsilon = 1.E-5;
245 fabs( (lhs.o_.X()-rhs.o_.X()) ) > detplaneEpsilon ||
246 fabs( (lhs.o_.Y()-rhs.o_.Y()) ) > detplaneEpsilon ||
247 fabs( (lhs.o_.Z()-rhs.o_.Z()) ) > detplaneEpsilon
250 fabs( (lhs.u_.X()-rhs.u_.X()) ) > detplaneEpsilon ||
251 fabs( (lhs.u_.Y()-rhs.u_.Y()) ) > detplaneEpsilon ||
252 fabs( (lhs.u_.Z()-rhs.u_.Z()) ) > detplaneEpsilon
255 fabs( (lhs.v_.X()-rhs.v_.X()) ) > detplaneEpsilon ||
256 fabs( (lhs.v_.Y()-rhs.v_.Y()) ) > detplaneEpsilon ||
257 fabs( (lhs.v_.Z()-rhs.v_.Z()) ) > detplaneEpsilon
267 double DetPlane::distance(
const TVector3& point)
const {
269 return fabs( (point.X()-o_.X()) * (u_.Y()*v_.Z() - u_.Z()*v_.Y()) +
270 (point.Y()-o_.Y()) * (u_.Z()*v_.X() - u_.X()*v_.Z()) +
271 (point.Z()-o_.Z()) * (u_.X()*v_.Y() - u_.Y()*v_.X()));
274 double DetPlane::distance(
double x,
double y,
double z)
const {
276 return fabs( (x-o_.X()) * (u_.Y()*v_.Z() - u_.Z()*v_.Y()) +
277 (y-o_.Y()) * (u_.Z()*v_.X() - u_.X()*v_.Z()) +
278 (z-o_.Z()) * (u_.X()*v_.Y() - u_.Y()*v_.X()));
282 TVector2 DetPlane::straightLineToPlane (
const TVector3& point,
const TVector3& dir)
const {
283 TVector3 dirNorm(dir.Unit());
284 TVector3 normal = getNormal();
285 double dirTimesN = dirNorm*normal;
286 if(fabs(dirTimesN)<1.E-6){
287 return TVector2(1.E100,1.E100);
289 double t = 1./dirTimesN * ((o_-point)*normal);
290 return project(point - o_ + t * dirNorm);
295 void DetPlane::straightLineToPlane(
const double& posX,
const double& posY,
const double& posZ,
296 const double& dirX,
const double& dirY,
const double& dirZ,
297 double& u,
double& v)
const {
299 TVector3 W = getNormal();
300 double dirTimesN = dirX*W.X() + dirY*W.Y() + dirZ*W.Z();
301 if(fabs(dirTimesN)<1.E-6){
306 double t = 1./dirTimesN * ((o_.X()-posX)*W.X() +
307 (o_.Y()-posY)*W.Y() +
308 (o_.Z()-posZ)*W.Z());
310 double posOnPlaneX = posX-o_.X() + t*dirX;
311 double posOnPlaneY = posY-o_.Y() + t*dirY;
312 double posOnPlaneZ = posZ-o_.Z() + t*dirZ;
314 u = u_.X()*posOnPlaneX + u_.Y()*posOnPlaneY + u_.Z()*posOnPlaneZ;
315 v = v_.X()*posOnPlaneX + v_.Y()*posOnPlaneY + v_.Z()*posOnPlaneZ;
319 void DetPlane::rotate(
double angle) {
320 TVector3 normal = getNormal();
321 u_.Rotate(angle, normal);
322 v_.Rotate(angle, normal);
328 void DetPlane::reset() {
332 finitePlane_.reset();
336 void DetPlane::Streamer(TBuffer &R__b)
342 typedef ::genfit::DetPlane thisClass;
344 if (R__b.IsReading()) {
345 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
if (R__v) { }
350 finitePlane_.reset();
356 TClass* cl = TClass::Load(R__b);
357 AbsFinitePlane *p = (AbsFinitePlane*)(cl->New());
358 cl->Streamer(p, R__b);
359 finitePlane_.reset(p);
361 R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
363 R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
399 finitePlane_->IsA()->Store(R__b);
400 finitePlane_->Streamer(R__b);
404 R__b.SetByteCount(R__c, kTRUE);
bool operator==(const DecayNode &node1, const DecayNode &node2)
Compare two Decay Nodes: They are equal if All daughter decay nodes are equal or one of the daughter ...
bool operator!=(const DecayNode &node1, const DecayNode &node2)
Not equal: See operator==.
Defines for I/O streams used for error and debug printing.
std::ostream printOut
Default stream for output of Print calls.