GENIEGenerator
Loading...
Searching...
No Matches
genie::geometry::FidSphere Class Reference

#include <FidShape.h>

Inheritance diagram for genie::geometry::FidSphere:
[legend]
Collaboration diagram for genie::geometry::FidSphere:
[legend]

Public Member Functions

 FidSphere (const TVector3 &center, Double_t radius)
RayIntercept Intercept (const TVector3 &start, const TVector3 &dir) const
void ConvertMaster2Top (const ROOTGeomAnalyzer *rgeom)
void Print (std::ostream &stream) const
Public Member Functions inherited from genie::geometry::FidShape
 FidShape ()
virtual ~FidShape ()

Protected Attributes

TVector3 fCenter
Double_t fSRadius
 center of the sphere

Detailed Description

Definition at line 107 of file FidShape.h.

Constructor & Destructor Documentation

◆ FidSphere()

genie::geometry::FidSphere::FidSphere ( const TVector3 & center,
Double_t radius )
inline

Definition at line 109 of file FidShape.h.

109: fCenter(center), fSRadius(radius) { ; }
Double_t fSRadius
center of the sphere
Definition FidShape.h:115

References fCenter, and fSRadius.

Member Function Documentation

◆ ConvertMaster2Top()

void FidSphere::ConvertMaster2Top ( const ROOTGeomAnalyzer * rgeom)
virtual

derived classes must implement the ConvertMaster2Top() method which transforms the shape specification from master coordinates to "top vol"

Implements genie::geometry::FidShape.

Definition at line 98 of file FidShape.cxx.

99{
100 rgeom->Master2Top(fCenter);
101}
virtual void Master2Top(TVector3 &v) const

References fCenter, and genie::geometry::ROOTGeomAnalyzer::Master2Top().

◆ Intercept()

RayIntercept FidSphere::Intercept ( const TVector3 & start,
const TVector3 & dir ) const
virtual

derived classes must implement the Intercept() method which calculates the entry/exit point of a ray w/ the shape

Implements genie::geometry::FidShape.

Definition at line 69 of file FidShape.cxx.

70{
71 // A new neutrino ray has been set, calculate the entrance/exit distances.
72 // This sets fDistIn/fDistOut for an sphere
73 RayIntercept intercept;
74
75 TVector3 oc = fCenter - start;
76 Double_t loc2 = oc.Mag2();
77 Double_t r2 = fSRadius*fSRadius;
78 //LOG("GeomVolSel", pNOTICE) << " loc2 = " << loc2 << " r2 " << r2;
79 // if ( loc2 > r2 ) ray originates outside the sphere
80 const TVector3& d = dir;
81 Double_t d2 = d.Mag2();
82 Double_t tca = oc.Dot(d)/d2;
83 //if ( tca < 0.0 ) sphere _center_ behind the ray orgin
84 Double_t lhc2 = ( r2 -loc2 )/d2 + tca*tca;
85 if ( lhc2 < 0.0 ) return intercept; // ray misses the sphere
86 intercept.fIsHit = true;
87 Double_t lhc = TMath::Sqrt(lhc2);
88
89 intercept.fDistIn = tca - lhc;
90 intercept.fSurfIn = 1;
91 intercept.fDistOut = tca + lhc;
92 intercept.fSurfOut = 1;
93
94 return intercept;
95}
string dir
Int_t fSurfIn
was the volume hit
Definition FidShape.h:53
Int_t fSurfOut
what surface was hit on way in
Definition FidShape.h:54
Bool_t fIsHit
distance along ray to exit fid volume
Definition FidShape.h:52
Double_t fDistOut
distance along ray to enter fid volume
Definition FidShape.h:51

References dir, fCenter, genie::geometry::RayIntercept::fDistIn, genie::geometry::RayIntercept::fDistOut, genie::geometry::RayIntercept::fIsHit, fSRadius, genie::geometry::RayIntercept::fSurfIn, and genie::geometry::RayIntercept::fSurfOut.

◆ Print()

void FidSphere::Print ( std::ostream & stream) const
virtual

Implements genie::geometry::FidShape.

Definition at line 104 of file FidShape.cxx.

105{
106 stream << "FidSphere @ ["
107 << fCenter.X() << ","
108 << fCenter.Y() << ","
109 << fCenter.Z() << "] r = " << fSRadius;
110}

References fCenter, and fSRadius.

Member Data Documentation

◆ fCenter

TVector3 genie::geometry::FidSphere::fCenter
protected

Definition at line 114 of file FidShape.h.

Referenced by ConvertMaster2Top(), FidSphere(), Intercept(), and Print().

◆ fSRadius

Double_t genie::geometry::FidSphere::fSRadius
protected

center of the sphere

Definition at line 115 of file FidShape.h.

Referenced by FidSphere(), Intercept(), and Print().


The documentation for this class was generated from the following files: