33 :fO(o),fU(u),fV(v),fFinitePlane(finite)
42 fU.SetXYZ(r.Uniform(),r.Uniform(),0.);
43 fV.SetXYZ(r.Uniform(),r.Uniform(),0.);
50 :fO(o),fFinitePlane(finite){
140 TVector3 result=
fU.Cross(
fV);
158 if(
fabs(n.X()) > 0.1 ){
159 fU.SetXYZ(1./n.X()*(-1.*n.Y()-1.*n.Z()),1.,1.);
163 if(
fabs(n.Y()) > 0.1){
164 fU.SetXYZ(1.,1./n.Y()*(-1.*n.X()-1.*n.Z()),1.);
168 fU.SetXYZ(1.,1.,1./n.Z()*(-1.*n.X()-1.*n.Y()));
185 return TVector2(xfU,xfV);
210 TVector3 xplane=
toLab(p);
232 assert(null.Mag()<1E-6);
240 std::cout<<
"GFDetPlane: "
241 <<
"O("<<
fO.X()<<
","<<
fO.Y()<<
","<<
fO.Z()<<
") "
242 <<
"u("<<
fU.X()<<
","<<
fU.Y()<<
","<<
fU.Z()<<
") "
243 <<
"v("<<
fV.X()<<
","<<
fV.Y()<<
","<<
fV.Z()<<
") "
258 #define DETPLANE_EPSILON 1.E-5
283 void GFDetPlane::getGraphics(
double mesh,
double length, TPolyMarker3D **pl,TPolyLine3D** plLine, TPolyLine3D **u, TPolyLine3D **
v, TPolyLine3D**
n){
284 *pl =
new TPolyMarker3D(21*21,24);
285 (*pl)->SetMarkerSize(0.1);
286 (*pl)->SetMarkerColor(kBlue);
289 *plLine =
new TPolyLine3D(5);
295 linevec=(
fO+(mesh*
i)*
fU+(mesh*j)*
fV);
296 (*plLine)->SetPoint(0,linevec.X(),linevec.Y(),linevec.Z());
298 linevec=(
fO+(mesh*
i)*
fU+(mesh*j)*
fV);
299 (*plLine)->SetPoint(0,linevec.X(),linevec.Y(),linevec.Z());
301 linevec=(
fO+(mesh*
i)*
fU+(mesh*j)*
fV);
302 (*plLine)->SetPoint(2,linevec.X(),linevec.Y(),linevec.Z());
304 linevec=(
fO+(mesh*
i)*
fU+(mesh*j)*
fV);
305 (*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());
311 for (
int i=-1*nI;
i<=nI;++
i){
312 for (
int j=-1*nJ;j<=nJ;++j){
314 int id=(i+10)*21+j+10;
315 (*pl)->SetPoint(
id,vec.X(),vec.Y(),vec.Z());
320 *u =
new TPolyLine3D(2);
321 (*u)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
322 (*u)->SetPoint(1,
fO.X()+length*
fU.X(),
fO.Y()+length*
fU.Y(),
fO.Z()+length*
fU.Z());
323 (*u)->SetLineWidth(2);
324 (*u)->SetLineColor(kGreen);
327 *v =
new TPolyLine3D(2);
328 (*v)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
329 (*v)->SetPoint(1,
fO.X()+length*
fV.X(),
fO.Y()+length*
fV.Y(),
fO.Z()+length*
fV.Z());
330 (*v)->SetLineWidth(2);
331 (*v)->SetLineColor(kRed);
334 *n =
new TPolyLine3D(2);
336 (*n)->SetPoint(0,
fO.X(),
fO.Y(),
fO.Z());
337 (*n)->SetPoint(1,
fO.X()+length*_n.X(),
fO.Y()+length*_n.Y(),
fO.Z()+length*_n.Z());
338 (*n)->SetLineWidth(2);
339 (*n)->SetLineColor(kBlue);
344 double s = (v -
fO)*
fU;
345 double t = (v -
fO)*
fV;
346 TVector3 distanceVector = v -
fO - (s*
fU) - (t*
fV);
347 return distanceVector.Mag();
351 double s = (v -
fO)*
fU;
352 double t = (v -
fO)*
fV;
353 TVector3 distanceVector = v -
fO - (s*
fU) - (t*
fV);
354 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);
GFDetPlane & operator=(const GFDetPlane &)
void set(const TVector3 &o, const TVector3 &u, const TVector3 &v)
Detector plane genfit geometry class.
void setU(const TVector3 &u)
GFDetPlane(GFAbsFinitePlane *finite=NULL)
virtual GFAbsFinitePlane * clone() const =0
Deep copy ctor for polymorphic class.
void setON(const TVector3 &o, const TVector3 &n)
void setO(const TVector3 &o)
double distance(TVector3 &) const
bool operator==(const GFDetPlane &lhs, const GFDetPlane &rhs)
bool operator!=(const GFDetPlane &lhs, const GFDetPlane &rhs)
GFAbsFinitePlane * fFinitePlane
void setNormal(TVector3 n)
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.
TVector2 project(const TVector3 &x) const
projecting a direction onto the plane:
friend F32vec4 fabs(const F32vec4 &a)
TVector2 straightLineToPlane(const TVector3 &point, const TVector3 &dir) const
gives u,v coordinates of the intersection point of a straight line with plane
TVector3 toLab(const TVector2 &x) const
transform from plane coordinates to lab system
void setUV(const TVector3 &u, const TVector3 &v)
TVector2 LabToPlane(const TVector3 &x) const
transform from Lab system into plane
void setV(const TVector3 &v)
ClassImp(GFDetPlane) GFDetPlane
virtual void Print() const =0
TVector3 getNormal() const
Abstract base class for implementing arbitrarily shaped finite detector planes.
TVector3 dist(const TVector3 &point) const