Public Member Functions | Protected Attributes | List of all members
genie::geometry::FidCylinder 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::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
 

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 119 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 121 of file FidShape.h.

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

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

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 198 of file FidShape.cxx.

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

199 {
200  rgeom->Master2Top(fCylBase);
201  rgeom->Master2TopDir(fCylAxis);
204 }
void ConvertMaster2Top(const ROOTGeomAnalyzer *rgeom)
Definition: FidShape.cxx:52
PlaneParam fCylCap1
radius of cylinder
Definition: FidShape.h:133
TVector3 fCylAxis
base point on cylinder axis
Definition: FidShape.h:131
virtual void Master2TopDir(TVector3 &v) const
PlaneParam fCylCap2
define a plane for 1st cylinder cap
Definition: FidShape.h:134
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 163 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().

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

Definition at line 117 of file FidShape.cxx.

References d, dist, genie::geometry::RayIntercept::fDistIn, genie::geometry::RayIntercept::fDistOut, genie::geometry::RayIntercept::fIsHit, genie::geometry::RayIntercept::fSurfIn, genie::geometry::RayIntercept::fSurfOut, getGoodRuns4SAM::n, msf_helper::o, submit_cafana::rc, ana::Sqrt(), and confusionMatrixTree::t.

118 {
119  // A new neutrino ray has been set, calculate the entrance/exit distances.
120  // This sets fDistIn/fDistOut for an infinite cylinder
121  // Take as "hit" if the ray is parallel to the axis but inside the radius
122  RayIntercept intercept;
123 
124  TVector3 rc = start - fCylBase;
125  TVector3 n = dir.Cross(fCylAxis);
126  Double_t len = n.Mag();
127  Double_t dist = 0;
128  if ( len == 0.0 ) {
129  // ray is parallel to axis
130  dist = rc.Dot(fCylAxis);
131  TVector3 d = rc - dist*fCylAxis;
132  dist = d.Mag();
133  //LOG("GeomVolSel", pNOTICE) << " len = " << len << " is parallel, dist " << dist << ", " << fCylRadius;
134  if ( dist <= fCylRadius ) {
135  intercept.fIsHit = true; // inside is considered a hit
136  intercept.fSurfIn = 0;
137  intercept.fSurfOut = 0;
138  }
139  return intercept;
140  }
141  // ray is not parallel
142  if ( len != 1.0 ) n.SetMag(1.); // normalize if it isn't already
143  dist = TMath::Abs(rc.Dot(n)); // closest approach distance
144  //LOG("GeomVolSel", pNOTICE) << " len = " << len << " not parallel, dist " << dist << ", " << fCylRadius;
145  if ( dist <= fCylRadius ) {
146  intercept.fIsHit = true; // yes, it hits
147  intercept.fSurfIn = 0;
148  intercept.fSurfOut = 0;
149  TVector3 o = rc.Cross(fCylAxis);
150  Double_t t = - o.Dot(n)/len;
151  o = n.Cross(fCylAxis);
152  o.SetMag(1.);
153  Double_t s = TMath::Abs( TMath::Sqrt(fCylRadius*fCylRadius-dist*dist) /
154  dir.Dot(o) );
155  intercept.fDistIn = t - s;
156  intercept.fDistOut = t + s;
157  //LOG("GeomVolSel", pNOTICE) << " hits, t = " << t << " s = " << s;
158  }
159  return intercept;
160 }
const XML_Char int len
Definition: expat.h:262
Int_t fSurfOut
what surface was hit on way in
Definition: FidShape.h:55
Bool_t fIsHit
distance along ray to exit fid volume
Definition: FidShape.h:53
double dist
Definition: runWimpSim.h:113
const XML_Char * s
Definition: expat.h:262
Int_t fSurfIn
was the volume hit
Definition: FidShape.h:54
Float_t d
Definition: plot.C:236
Double_t fCylRadius
direction cosines of cylinder axis
Definition: FidShape.h:132
TVector3 fCylAxis
base point on cylinder axis
Definition: FidShape.h:131
TDirectory * dir
Definition: macro.C:5
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
Double_t fDistOut
distance along ray to enter fid volume
Definition: FidShape.h:52
void FidCylinder::Print ( std::ostream &  stream) const
virtual

Implements genie::geometry::FidShape.

Definition at line 207 of file FidShape.cxx.

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

Member Data Documentation

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

base point on cylinder axis

Definition at line 131 of file FidShape.h.

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

Definition at line 130 of file FidShape.h.

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

radius of cylinder

Definition at line 133 of file FidShape.h.

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

define a plane for 1st cylinder cap

Definition at line 134 of file FidShape.h.

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

direction cosines of cylinder axis

Definition at line 132 of file FidShape.h.


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