Public Member Functions | Protected Attributes | List of all members
genie::geometry::FidCylinder Class Reference

#include <FidShape.h>

Inheritance diagram for genie::geometry::FidCylinder:
genie::geometry::FidShape

Public Member Functions

 FidCylinder (const TVector3 &base, const TVector3 &axis, Double_t radius, const PlaneParam &cap1, const PlaneParam &cap2)
 
RayIntercept Intercept (const TVector3 &start, const TVector3 &dir) const
 
RayIntercept InterceptUncapped (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 fCylBase
 
TVector3 fCylAxis
 base point on cylinder axis More...
 
Double_t fCylRadius
 direction cosines of cylinder axis More...
 
PlaneParam fCylCap1
 radius of cylinder More...
 
PlaneParam fCylCap2
 define a plane for 1st cylinder cap More...
 

Detailed Description

Definition at line 118 of file FidShape.h.

Constructor & Destructor Documentation

genie::geometry::FidCylinder::FidCylinder ( const TVector3 &  base,
const TVector3 &  axis,
Double_t  radius,
const PlaneParam cap1,
const PlaneParam cap2 
)
inline

Definition at line 120 of file FidShape.h.

122  : fCylBase(base), fCylAxis(axis), fCylRadius(radius), fCylCap1(cap1), fCylCap2(cap2) { ; }
PlaneParam fCylCap1
radius of cylinder
Definition: FidShape.h:132
Double_t fCylRadius
direction cosines of cylinder axis
Definition: FidShape.h:131
TVector3 fCylAxis
base point on cylinder axis
Definition: FidShape.h:130
PlaneParam fCylCap2
define a plane for 1st cylinder cap
Definition: FidShape.h:133

Member Function Documentation

void FidCylinder::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 194 of file FidShape.cxx.

195 {
196  rgeom->Master2Top(fCylBase);
197  rgeom->Master2TopDir(fCylAxis);
200 }
void ConvertMaster2Top(const ROOTGeomAnalyzer *rgeom)
Definition: FidShape.cxx:48
PlaneParam fCylCap1
radius of cylinder
Definition: FidShape.h:132
TVector3 fCylAxis
base point on cylinder axis
Definition: FidShape.h:130
virtual void Master2TopDir(TVector3 &v) const
PlaneParam fCylCap2
define a plane for 1st cylinder cap
Definition: FidShape.h:133
virtual void Master2Top(TVector3 &v) const
RayIntercept FidCylinder::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 159 of file FidShape.cxx.

160 {
161  // A new neutrino ray has been set, calculate the entrance/exit distances.
162 
163  RayIntercept intercept = InterceptUncapped(start,dir); // find where ray hits the infinite cylinder
164  // trim this down by applying the end caps
165  if ( ! intercept.fIsHit ) return intercept;
166  for ( int icap=1; icap <= 2; ++icap ) {
167  const PlaneParam& cap = (icap==1) ? fCylCap1 : fCylCap2;
168  if ( ! cap.IsValid() ) continue;
169  Double_t vd = cap.Vd(dir);
170  Double_t vn = cap.Vn(start);
171  //std::cout << "FidCyl::Intercept cap " << icap
172  // << " vd " << vd << " vn " << vn;
173  if ( vd == 0.0 ) { // parallel to surface, is it on the right side?
174  //std::cout << " vd=0, vn " << ((vn>0)?"wrong":"right") << "side " << std::endl;
175  if ( vn > 0 ) { intercept.fIsHit = false; break; } // wrong side
176  } else {
177  Double_t t = -vn / vd;
178  //std::cout << " t " << t << " in/out "
179  // << intercept.fDistIn << "/" << intercept.fDistOut << std::endl;
180  if ( vd < 0.0 ) { // t is the entering point
181  if ( t > intercept.fDistIn )
182  { intercept.fDistIn = t; intercept.fSurfIn = 1; }
183  } else { // t is the exiting point
184  if ( t < intercept.fDistOut )
185  { intercept.fDistOut = t; intercept.fSurfOut = 1; }
186  }
187  }
188  }
189  if ( intercept.fDistIn > intercept.fDistOut ) intercept.fIsHit = false;
190  return intercept;
191 }
Int_t fSurfOut
what surface was hit on way in
Definition: FidShape.h:54
Double_t Vn(const TVector3 &raybase) const
Definition: FidShape.h:73
Bool_t fIsHit
distance along ray to exit fid volume
Definition: FidShape.h:52
string dir
PlaneParam fCylCap1
radius of cylinder
Definition: FidShape.h:132
Int_t fSurfIn
was the volume hit
Definition: FidShape.h:53
RayIntercept InterceptUncapped(const TVector3 &start, const TVector3 &dir) const
Definition: FidShape.cxx:113
Double_t fDistOut
distance along ray to enter fid volume
Definition: FidShape.h:51
Bool_t IsValid() const
Definition: FidShape.h:77
PlaneParam fCylCap2
define a plane for 1st cylinder cap
Definition: FidShape.h:133
Double_t Vd(const TVector3 &raycos) const
Definition: FidShape.h:75
RayIntercept FidCylinder::InterceptUncapped ( const TVector3 &  start,
const TVector3 &  dir 
) const

Definition at line 113 of file FidShape.cxx.

114 {
115  // A new neutrino ray has been set, calculate the entrance/exit distances.
116  // This sets fDistIn/fDistOut for an infinite cylinder
117  // Take as "hit" if the ray is parallel to the axis but inside the radius
118  RayIntercept intercept;
119 
120  TVector3 rc = start - fCylBase;
121  TVector3 n = dir.Cross(fCylAxis);
122  Double_t len = n.Mag();
123  Double_t dist = 0;
124  if ( len == 0.0 ) {
125  // ray is parallel to axis
126  dist = rc.Dot(fCylAxis);
127  TVector3 d = rc - dist*fCylAxis;
128  dist = d.Mag();
129  //LOG("GeomVolSel", pNOTICE) << " len = " << len << " is parallel, dist " << dist << ", " << fCylRadius;
130  if ( dist <= fCylRadius ) {
131  intercept.fIsHit = true; // inside is considered a hit
132  intercept.fSurfIn = 0;
133  intercept.fSurfOut = 0;
134  }
135  return intercept;
136  }
137  // ray is not parallel
138  if ( len != 1.0 ) n.SetMag(1.); // normalize if it isn't already
139  dist = TMath::Abs(rc.Dot(n)); // closest approach distance
140  //LOG("GeomVolSel", pNOTICE) << " len = " << len << " not parallel, dist " << dist << ", " << fCylRadius;
141  if ( dist <= fCylRadius ) {
142  intercept.fIsHit = true; // yes, it hits
143  intercept.fSurfIn = 0;
144  intercept.fSurfOut = 0;
145  TVector3 o = rc.Cross(fCylAxis);
146  Double_t t = - o.Dot(n)/len;
147  o = n.Cross(fCylAxis);
148  o.SetMag(1.);
149  Double_t s = TMath::Abs( TMath::Sqrt(fCylRadius*fCylRadius-dist*dist) /
150  dir.Dot(o) );
151  intercept.fDistIn = t - s;
152  intercept.fDistOut = t + s;
153  //LOG("GeomVolSel", pNOTICE) << " hits, t = " << t << " s = " << s;
154  }
155  return intercept;
156 }
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
std::void_t< T > n
Int_t fSurfIn
was the volume hit
Definition: FidShape.h:53
Double_t fCylRadius
direction cosines of cylinder axis
Definition: FidShape.h:131
TVector3 fCylAxis
base point on cylinder axis
Definition: FidShape.h:130
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
Double_t fDistOut
distance along ray to enter fid volume
Definition: FidShape.h:51
static QCString * s
Definition: config.cpp:1042
void FidCylinder::Print ( std::ostream &  stream) const
virtual

Implements genie::geometry::FidShape.

Definition at line 203 of file FidShape.cxx.

204 {
205  stream << "FidCylinder @ ["
206  << fCylBase.X() << ","
207  << fCylBase.Y() << ","
208  << fCylBase.Z() << "] dir ["
209  << fCylAxis.X() << ","
210  << fCylAxis.Y() << ","
211  << fCylAxis.Z() << "] r = " << fCylRadius;
212  stream << " cap1=" << fCylCap1 << " cap2=" << fCylCap2;
213 }
PlaneParam fCylCap1
radius of cylinder
Definition: FidShape.h:132
Double_t fCylRadius
direction cosines of cylinder axis
Definition: FidShape.h:131
TVector3 fCylAxis
base point on cylinder axis
Definition: FidShape.h:130
PlaneParam fCylCap2
define a plane for 1st cylinder cap
Definition: FidShape.h:133

Member Data Documentation

TVector3 genie::geometry::FidCylinder::fCylAxis
protected

base point on cylinder axis

Definition at line 130 of file FidShape.h.

TVector3 genie::geometry::FidCylinder::fCylBase
protected

Definition at line 129 of file FidShape.h.

PlaneParam genie::geometry::FidCylinder::fCylCap1
protected

radius of cylinder

Definition at line 132 of file FidShape.h.

PlaneParam genie::geometry::FidCylinder::fCylCap2
protected

define a plane for 1st cylinder cap

Definition at line 133 of file FidShape.h.

Double_t genie::geometry::FidCylinder::fCylRadius
protected

direction cosines of cylinder axis

Definition at line 131 of file FidShape.h.


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