GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
genie::geometry::FidSphere Class Reference

#include <FidShape.h>

Inheritance diagram for genie::geometry::FidSphere:
Inheritance graph
[legend]
Collaboration diagram for genie::geometry::FidSphere:
Collaboration graph
[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 More...
 

Detailed Description

Definition at line 107 of file FidShape.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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.

References genie::geometry::ROOTGeomAnalyzer::Master2Top().

99 {
100  rgeom->Master2Top(fCenter);
101 }
virtual void Master2Top(TVector3 &v) const
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.

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

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 }
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
string dir
Int_t fSurfIn
was the volume hit
Definition: FidShape.h:53
Double_t fDistOut
distance along ray to enter fid volume
Definition: FidShape.h:51
Double_t fSRadius
center of the sphere
Definition: FidShape.h:115
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 }
Double_t fSRadius
center of the sphere
Definition: FidShape.h:115

Member Data Documentation

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

Definition at line 114 of file FidShape.h.

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

center of the sphere

Definition at line 115 of file FidShape.h.


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