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()));
176 TVector3
n(TMath::Sin(theta)*TMath::Cos(phi),TMath::Sin(theta)*TMath::Sin(phi),TMath::Cos(theta));
185 return TVector2(xfU,xfV);
210 TVector3 xplane=
toLab(p);
230 v.Rotate(TMath::Pi()*0.5,n);
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
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){
313 TVector3 vec(
fO+(mesh*i)*
fU+(mesh*j)*
fV);
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);
347 TVector3 distanceVector = v - (s*
fU) - (t*fV);
348 return distanceVector.Mag();
355 TVector3 distanceVector = v - (s*
fU) - (t*fV);
356 return distanceVector.Mag();
360 TVector3 dirNorm(dir);
363 double dirTimesN = dirNorm*normal;
364 if(fabs(dirTimesN)<1.E-6){
366 return TVector2(1.E100,1.E100);
368 double t = 1/dirTimesN * ((
fO-
point)*normal);
369 return project(point -
fO + t * dirNorm);