27 #include "TPolyLine3D.h" 28 #include "TPolyMarker3D.h" 40 :fO(o),fU(u),fV(v),fFinitePlane(finite)
49 fU.SetXYZ(r.Uniform(),r.Uniform(),0.);
50 fV.SetXYZ(r.Uniform(),r.Uniform(),0.);
73 if (
this == &rhs)
return *
this;
165 if( fabs(n.X()) > 0.1 ){
166 fU.SetXYZ(1./n.X()*(-1.*n.Y()-1.*n.Z()),1.,1.);
170 if(fabs(n.Y()) > 0.1){
171 fU.SetXYZ(1.,1./n.Y()*(-1.*n.X()-1.*n.Z()),1.);
175 fU.SetXYZ(1.,1.,1./n.Z()*(-1.*n.X()-1.*n.Y()));
183 TVector3
n(TMath::Sin(theta)*TMath::Cos(phi),TMath::Sin(theta)*TMath::Sin(phi),TMath::Cos(theta));
192 return TVector2(xfU,xfV);
217 TVector3 xplane=
toLab(p);
226 throw GFException(
"genf::GFDetPlane::sane() sanity check failed", __LINE__, __FILE__).
setFatal();
238 v.Rotate(TMath::Pi()*0.5,n);
240 if (null.Mag() >= 1
E-6)
241 throw GFException(
"genf::GFDetPlane::sane(): non orthogonal!", __LINE__, __FILE__).
setFatal();
250 <<
"O("<<
fO.X()<<
","<<
fO.Y()<<
","<<
fO.Z()<<
") " 251 <<
"u("<<
fU.X()<<
","<<
fU.Y()<<
","<<
fU.Z()<<
") " 252 <<
"v("<<
fV.X()<<
","<<
fV.Y()<<
","<<
fV.Z()<<
") " 269 #define DETPLANE_EPSILON 1.E-5 290 return !(lhs == rhs);
295 *pl =
new TPolyMarker3D(21*21,24);
296 (*pl)->SetMarkerSize(0.1);
297 (*pl)->SetMarkerColor(kBlue);
300 *plLine =
new TPolyLine3D(5);
306 linevec=(
fO+(mesh*i)*
fU+(mesh*j)*
fV);
307 (*plLine)->SetPoint(0,linevec.X(),linevec.Y(),linevec.Z());
309 linevec=(
fO+(mesh*i)*
fU+(mesh*j)*
fV);
310 (*plLine)->SetPoint(0,linevec.X(),linevec.Y(),linevec.Z());
312 linevec=(
fO+(mesh*i)*
fU+(mesh*j)*
fV);
313 (*plLine)->SetPoint(2,linevec.X(),linevec.Y(),linevec.Z());
315 linevec=(
fO+(mesh*i)*
fU+(mesh*j)*
fV);
316 (*plLine)->SetPoint(1,linevec.X(),linevec.Y(),linevec.Z());
318 linevec=(
fO+(mesh*i)*
fU+(mesh*j)*
fV);
319 (*plLine)->SetPoint(4,linevec.X(),linevec.Y(),linevec.Z());
322 for (
int i=-1*nI;i<=nI;++i){
323 for (
int j=-1*nJ;j<=nJ;++j){
324 TVector3 vec(
fO+(mesh*i)*
fU+(mesh*j)*
fV);
325 int id=(i+10)*21+j+10;
326 (*pl)->SetPoint(
id,vec.X(),vec.Y(),vec.Z());
331 *u =
new TPolyLine3D(2);
332 (*u)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
333 (*u)->SetPoint(1,
fO.X()+length*
fU.X(),
fO.Y()+length*
fU.Y(),
fO.Z()+length*
fU.Z());
334 (*u)->SetLineWidth(2);
335 (*u)->SetLineColor(kGreen);
338 *v =
new TPolyLine3D(2);
339 (*v)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
340 (*v)->SetPoint(1,
fO.X()+length*
fV.X(),
fO.Y()+length*
fV.Y(),
fO.Z()+length*
fV.Z());
341 (*v)->SetLineWidth(2);
342 (*v)->SetLineColor(kRed);
345 *n =
new TPolyLine3D(2);
347 (*n)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
348 (*n)->SetPoint(1,
fO.X()+length*_n.X(),
fO.Y()+length*_n.Y(),
fO.Z()+length*_n.Z());
349 (*n)->SetLineWidth(2);
350 (*n)->SetLineColor(kBlue);
355 double s = (v -
fO)*
fU;
356 double t = (v -
fO)*
fV;
357 TVector3 distanceVector = v -
fO - (s*
fU) - (t*
fV);
358 return distanceVector.Mag();
362 double s = (v -
fO)*
fU;
363 double t = (v -
fO)*
fV;
364 TVector3 distanceVector = v -
fO - (s*
fU) - (t*
fV);
365 return distanceVector.Mag();
369 TVector3 dirNorm(dir);
372 double dirTimesN = dirNorm*normal;
373 if(fabs(dirTimesN)<1.
E-6){
375 return TVector2(1.E100,1.E100);
377 double t = 1/dirTimesN * ((
fO-point)*normal);
378 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.
QTextStream & endl(QTextStream &s)
GFDetPlane(genf::GFAbsFinitePlane *finite=NULL)