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

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Tools/Geometry/FidShape.h"

Inheritance diagram for genie::geometry::FidPolyhedron:
genie::geometry::FidShape

Public Member Functions

 FidPolyhedron ()
 convex polyhedron is made of multiple planar equations More...
 
void push_back (const PlaneParam &pln)
 
void clear ()
 
RayIntercept Intercept (const TVector3 &start, const TVector3 &dir) const
 
void ConvertMaster2Top (const ROOTGeomAnalyzer *rgeom)
 
void Print (std::ostream &stream) const
 

Protected Attributes

std::vector< PlaneParamfPolyFaces
 

Detailed Description

Definition at line 137 of file FidShape.h.

Constructor & Destructor Documentation

genie::geometry::FidPolyhedron::FidPolyhedron ( )
inline

convex polyhedron is made of multiple planar equations

Definition at line 140 of file FidShape.h.

140 { ; }

Member Function Documentation

void genie::geometry::FidPolyhedron::clear ( )
inline

Definition at line 142 of file FidShape.h.

References dir, Print(), febshutoff_auto::start, and runNovaSAM::stream.

142 { fPolyFaces.clear(); }
std::vector< PlaneParam > fPolyFaces
Definition: FidShape.h:147
void FidPolyhedron::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 300 of file FidShape.cxx.

References genie::geometry::PlaneParam::ConvertMaster2Top(), and MECModelEnuComparisons::i.

301 {
302  for (unsigned int i = 0; i < fPolyFaces.size(); ++i ) {
303  PlaneParam& aplane = fPolyFaces[i];
304  aplane.ConvertMaster2Top(rgeom);
305  }
306 }
void ConvertMaster2Top(const ROOTGeomAnalyzer *rgeom)
Definition: FidShape.cxx:52
std::vector< PlaneParam > fPolyFaces
Definition: FidShape.h:147
RayIntercept FidPolyhedron::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 220 of file FidShape.cxx.

References genie::geometry::RayIntercept::fDistIn, genie::geometry::RayIntercept::fDistOut, genie::geometry::RayIntercept::fIsHit, genie::geometry::RayIntercept::fSurfIn, genie::geometry::RayIntercept::fSurfOut, genie::geometry::PlaneParam::IsValid(), confusionMatrixTree::t, genie::geometry::PlaneParam::Vd(), and genie::geometry::PlaneParam::Vn().

221 {
222  // A new neutrino ray has been set, calculate the entrance/exit distances.
223  // Calculate the point of intersection of a ray (directed line) and a
224  // *convex* polyhedron constructed from the intersection of a list
225  // of planar equations (no check on convex condition).
226 
227  RayIntercept intercept;
228 
229  Double_t tnear = -DBL_MAX;
230  Double_t tfar = DBL_MAX;
231  Int_t surfNear = -1;
232  Int_t surfFar = -1;
233  Bool_t parallel = false;
234 
235  // test each plane in the polyhedron
236  for ( size_t iface=0; iface < fPolyFaces.size(); ++iface ) {
237  const PlaneParam& pln = fPolyFaces[iface];
238  if ( ! pln.IsValid() ) continue;
239 
240  // calculate numerator, denominator to "t" = distance along ray to intersection w/ pln
241  Double_t vd = pln.Vd(dir);
242  Double_t vn = pln.Vn(start);
243 
244  //LOG("GeomVolSel", pNOTICE)
245  // << " face " << iface << " [" << pln.a << "," << pln.b << "," << pln.c << "," << pln.d
246  // << "] vd=" << vd << " vn=" << vn;
247 
248  if ( vd == 0.0 ) {
249  // ray is parallel to plane - check if ray origin is inside plane's half-space
250  //LOG("GeomVolSel", pNOTICE)
251  // << " vd=0, " << " possibly parallel ";
252  if ( vn > 0.0 ) { parallel = true; break; } // wrong side ... complete miss
253  } else {
254  // ray is not parallel to plane -- get the distance to the plane
255  Double_t t = -vn / vd; // notice negative sign!
256  //LOG("GeomVolSel", pNOTICE) << " t=" << t << " tnear=" << tnear << " tfar=" << tfar;
257  if ( vd < 0.0 ) {
258  // front face: t is a near point
259  if ( t > tnear ) {
260  surfNear = iface;
261  tnear = t;
262  }
263  } else {
264  // back face: t is a far point
265  if ( t < tfar ) {
266  surfFar = iface;
267  tfar = t;
268  }
269  }
270  //LOG("GeomVolSel", pNOTICE) << " new surf " << surfNear << "," << surfFar
271  // << " tnear=" << tnear << " tfar=" << tfar;
272  }
273  }
274  if ( ! parallel ) {
275  // survived all the tests
276  if ( tnear > 0.0 ) {
277  if ( tnear < tfar ) {
278  //LOG("GeomVolSel", pNOTICE) << "is hit case1 ";
279  intercept.fIsHit = true;
280  intercept.fSurfIn = surfNear;
281  intercept.fSurfOut = surfFar;
282  }
283  } else {
284  if ( tfar > 0.0 ) {
285  //LOG("GeomVolSel", pNOTICE) << "is hit case2 ";
286  intercept.fIsHit = true;
287  intercept.fSurfIn = -1;
288  intercept.fSurfOut = surfFar;
289  }
290  }
291  }
292  intercept.fDistIn = tnear;
293  intercept.fDistOut = tfar;
294  //LOG("GeomVolSel", pNOTICE) << " hit? " << (fIsHit?"true":"false")
295  // << " dist in " << fDistIn << " out " << fDistOut;
296  return intercept;
297 }
Int_t fSurfOut
what surface was hit on way in
Definition: FidShape.h:55
Double_t Vn(const TVector3 &raybase) const
Definition: FidShape.h:74
Bool_t fIsHit
distance along ray to exit fid volume
Definition: FidShape.h:53
Int_t fSurfIn
was the volume hit
Definition: FidShape.h:54
TDirectory * dir
Definition: macro.C:5
Double_t fDistOut
distance along ray to enter fid volume
Definition: FidShape.h:52
Bool_t IsValid() const
Definition: FidShape.h:78
std::vector< PlaneParam > fPolyFaces
Definition: FidShape.h:147
Double_t Vd(const TVector3 &raycos) const
Definition: FidShape.h:76
void FidPolyhedron::Print ( std::ostream &  stream) const
virtual

Implements genie::geometry::FidShape.

Definition at line 307 of file FidShape.cxx.

References allTimeWatchdog::endl, and MECModelEnuComparisons::i.

308 {
309  size_t nfaces = fPolyFaces.size();
310  stream << "FidPolyhedron n=" << nfaces;
311  for ( size_t i=0; i<nfaces; ++i) {
312  const PlaneParam& aface = fPolyFaces[i];
313  stream << std::endl << "[" << setw(2) << i << "]" << aface;
314  }
315 }
std::vector< PlaneParam > fPolyFaces
Definition: FidShape.h:147
void genie::geometry::FidPolyhedron::push_back ( const PlaneParam pln)
inline

Member Data Documentation

std::vector<PlaneParam> genie::geometry::FidPolyhedron::fPolyFaces
protected

Definition at line 147 of file FidShape.h.


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