28 #include "TPolyLine3D.h" 29 #include "TPolyMarker3D.h" 38 : fO(o), fU(u), fV(v), fFinitePlane(finite)
45 fO.SetXYZ(0., 0., 0.);
46 fU.SetXYZ(r.Uniform(), r.Uniform(), 0.);
47 fV.SetXYZ(r.Uniform(), r.Uniform(), 0.);
74 if (
this == &rhs)
return *
this;
135 TVector3 result =
fU.Cross(
fV);
154 if (fabs(n.X()) > 0.1) {
155 fU.SetXYZ(1. / n.X() * (-1. * n.Y() - 1. * n.Z()), 1., 1.);
159 if (fabs(n.Y()) > 0.1) {
160 fU.SetXYZ(1., 1. / n.Y() * (-1. * n.X() - 1. * n.Z()), 1.);
164 fU.SetXYZ(1., 1., 1. / n.Z() * (-1. * n.X() - 1. * n.Y()));
174 TMath::Sin(theta) * TMath::Cos(phi), TMath::Sin(theta) * TMath::Sin(phi), TMath::Cos(theta));
180 Double_t xfU =
fU *
x;
181 Double_t xfV =
fV *
x;
182 return TVector2(xfU, xfV);
202 TVector3 xplane =
toLab(p);
209 throw GFException(
"genf::GFDetPlane::sane() sanity check failed", __LINE__, __FILE__)
222 v.Rotate(TMath::Pi() * 0.5, n);
223 TVector3 null = v -
fV;
224 if (null.Mag() >= 1
E-6)
225 throw GFException(
"genf::GFDetPlane::sane(): non orthogonal!", __LINE__, __FILE__).
setFatal();
230 out <<
"GFDetPlane: " 231 <<
"O(" <<
fO.X() <<
"," <<
fO.Y() <<
"," <<
fO.Z() <<
") " 232 <<
"u(" <<
fU.X() <<
"," <<
fU.Y() <<
"," <<
fU.Z() <<
") " 233 <<
"v(" <<
fV.X() <<
"," <<
fV.Y() <<
"," <<
fV.Z() <<
") " 248 #define DETPLANE_EPSILON 1.E-5 268 return !(lhs == rhs);
274 TPolyLine3D** plLine,
279 *pl =
new TPolyMarker3D(21 * 21, 24);
280 (*pl)->SetMarkerSize(0.1);
281 (*pl)->SetMarkerColor(kBlue);
284 *plLine =
new TPolyLine3D(5);
291 linevec = (
fO + (mesh * i) *
fU + (mesh * j) *
fV);
292 (*plLine)->SetPoint(0, linevec.X(), linevec.Y(), linevec.Z());
295 linevec = (
fO + (mesh * i) *
fU + (mesh * j) *
fV);
296 (*plLine)->SetPoint(0, linevec.X(), linevec.Y(), linevec.Z());
299 linevec = (
fO + (mesh * i) *
fU + (mesh * j) *
fV);
300 (*plLine)->SetPoint(2, linevec.X(), linevec.Y(), linevec.Z());
303 linevec = (
fO + (mesh * i) *
fU + (mesh * j) *
fV);
304 (*plLine)->SetPoint(1, linevec.X(), linevec.Y(), linevec.Z());
307 linevec = (
fO + (mesh * i) *
fU + (mesh * j) *
fV);
308 (*plLine)->SetPoint(4, linevec.X(), linevec.Y(), linevec.Z());
310 for (
int i = -1 * nI; i <= nI; ++i) {
311 for (
int j = -1 * nJ; j <= nJ; ++j) {
312 TVector3 vec(
fO + (mesh * i) *
fU + (mesh * j) *
fV);
313 int id = (i + 10) * 21 + j + 10;
314 (*pl)->SetPoint(
id, vec.X(), vec.Y(), vec.Z());
318 *u =
new TPolyLine3D(2);
319 (*u)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
320 (*u)->SetPoint(1,
fO.X() + length *
fU.X(),
fO.Y() + length *
fU.Y(),
fO.Z() + length *
fU.Z());
321 (*u)->SetLineWidth(2);
322 (*u)->SetLineColor(kGreen);
324 *v =
new TPolyLine3D(2);
325 (*v)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
326 (*v)->SetPoint(1,
fO.X() + length *
fV.X(),
fO.Y() + length *
fV.Y(),
fO.Z() + length *
fV.Z());
327 (*v)->SetLineWidth(2);
328 (*v)->SetLineColor(kRed);
331 *n =
new TPolyLine3D(2);
333 (*n)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
334 (*n)->SetPoint(1,
fO.X() + length * _n.X(),
fO.Y() + length * _n.Y(),
fO.Z() + length * _n.Z());
335 (*n)->SetLineWidth(2);
336 (*n)->SetLineColor(kBlue);
342 double s = (v -
fO) *
fU;
343 double t = (v -
fO) *
fV;
344 TVector3 distanceVector = v -
fO - (s *
fU) - (t *
fV);
345 return distanceVector.Mag();
350 double s = (v -
fO) *
fU;
351 double t = (v -
fO) *
fV;
352 TVector3 distanceVector = v -
fO - (s *
fU) - (t *
fV);
353 return distanceVector.Mag();
358 TVector3 dirNorm(dir);
361 double dirTimesN = dirNorm * normal;
362 if (fabs(dirTimesN) < 1.
E-6) {
364 return TVector2(1.E100, 1.E100);
366 double t = 1 / dirTimesN * ((
fO - point) * normal);
367 return project(point -
fO + t * dirNorm);
void set(const TVector3 &o, const TVector3 &u, const TVector3 &v)
void setON(const TVector3 &o, const TVector3 &n)
void setU(const TVector3 &u)
GFDetPlane & operator=(const genf::GFDetPlane &)
bool operator!=(const genf::GFDetPlane &, const genf::GFDetPlane &)
void getGraphics(double mesh, double length, TPolyMarker3D **pl, TPolyLine3D **plLine, TPolyLine3D **u, TPolyLine3D **v, TPolyLine3D **n=NULL)
for poor attempts of making an event display. There is a lot of room for improvements.
TVector3 dist(const TVector3 &point) const
void setO(const TVector3 &o)
void setUV(const TVector3 &u, const TVector3 &v)
void Print(std::ostream &out=std::cout) const
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
virtual void Print(std::ostream &out=std::cout) const =0
TVector3 getNormal() const
void setV(const TVector3 &v)
double distance(TVector3 &) const
bool operator==(const genf::GFDetPlane &, const genf::GFDetPlane &)
genf::GFAbsFinitePlane * fFinitePlane
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
TVector2 straightLineToPlane(const TVector3 &point, const TVector3 &dir) const
gives u,v coordinates of the intersection point of a straight line with plane
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
void setNormal(TVector3 n)
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
virtual GFAbsFinitePlane * clone() const =0
Deep copy ctor for polymorphic class.
GFDetPlane(genf::GFAbsFinitePlane *finite=NULL)