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

#include <PathSegmentList.h>

Collaboration diagram for genie::geometry::PathSegment:
Collaboration graph
[legend]

Public Member Functions

 PathSegment ()
 
 ~PathSegment ()
 
void SetEnter (const TVector3 &p3enter, double raydist)
 point of entry to geometry element More...
 
void SetEnter (const Double_t *p3enter, double raydist)
 
void SetExit (const TVector3 &p3exit)
 point of exit from geometry element More...
 
void SetExit (const Double_t *p3exit)
 
void SetGeo (const TGeoVolume *gvol, const TGeoMedium *gmed, const TGeoMaterial *gmat)
 info about the geometry element More...
 
void SetPath (const char *path)
 
void SetStep (Double_t step, bool setlimits=true)
 step taken in the geometry element More...
 
bool IsTrimmedEmpty () const
 
Double_t GetSummedStepRange () const
 get the sum of all the step range (in case step has been trimmed or split) More...
 
TVector3 GetPosition (Double_t frac) const
 calculate position within allowed ranges passed on fraction of total More...
 
void DoCrossCheck (const TVector3 &startpos, double &ddist, double &dstep) const
 perform cross check on segment, return differences More...
 
void Print (ostream &stream) const
 

Public Attributes

Double_t fRayDist
 distance from start of ray More...
 
Double_t fStepLength
 total step size in volume More...
 
const TGeoVolume * fVolume
 ref only ptr to TGeoVolume More...
 
const TGeoMedium * fMedium
 ref only ptr to TGeoMedium More...
 
const TGeoMaterial * fMaterial
 ref only ptr to TGeoMaterial More...
 
TVector3 fEnter
 top vol coordinates and units More...
 
TVector3 fExit
 top vol coordinates and units More...
 
std::string fPathString
 full path names More...
 
StepRangeSet fStepRangeSet
 collection of {steplo,stephi} pairs More...
 

Friends

ostream & operator<< (ostream &stream, const PathSegment &list)
 
bool operator< (const PathSegment &lhs, const PathSegment &rhs)
 

Detailed Description

Definition at line 56 of file PathSegmentList.h.

Constructor & Destructor Documentation

PathSegment::PathSegment ( void  )

Definition at line 76 of file PathSegmentList.cxx.

76  :
77  fRayDist(0), fStepLength(0),
78  fVolume(0), fMedium(0), fMaterial(0),
79  fEnter(), fExit()
80 {
81 }
TVector3 fEnter
top vol coordinates and units
const TGeoMaterial * fMaterial
ref only ptr to TGeoMaterial
const TGeoVolume * fVolume
ref only ptr to TGeoVolume
TVector3 fExit
top vol coordinates and units
const TGeoMedium * fMedium
ref only ptr to TGeoMedium
Double_t fRayDist
distance from start of ray
Double_t fStepLength
total step size in volume
genie::geometry::PathSegment::~PathSegment ( )
inline

Definition at line 60 of file PathSegmentList.h.

60 { ; }

Member Function Documentation

void PathSegment::DoCrossCheck ( const TVector3 &  startpos,
double &  ddist,
double &  dstep 
) const

perform cross check on segment, return differences

Definition at line 84 of file PathSegmentList.cxx.

References fEnter, fExit, fRayDist, and fStepLength.

Referenced by genie::geometry::PathSegmentList::CrossCheck().

86 {
87  double dist_recalc = (fEnter-startpos).Mag();
88  ddist = dist_recalc - fRayDist;
89 
90  double step_recalc = (fExit-fEnter).Mag();
91  dstep = step_recalc - fStepLength;
92 }
TVector3 fEnter
top vol coordinates and units
TVector3 fExit
top vol coordinates and units
Double_t fRayDist
distance from start of ray
Double_t fStepLength
total step size in volume
TVector3 PathSegment::GetPosition ( Double_t  frac) const

calculate position within allowed ranges passed on fraction of total

calculate position within allowed ranges passed as fraction of trimmed segment seg.fEnter + fractotal * ( seg.fExit - seg.fEnter );

Definition at line 148 of file PathSegmentList.cxx.

References fEnter, fExit, fStepLength, fStepRangeSet, GetSummedStepRange(), LOG, pFATAL, pINFO, and genie::units::sr.

Referenced by genie::geometry::ROOTGeomAnalyzer::GenerateVertex().

149 {
150  /// calculate position within allowed ranges passed as
151  /// fraction of trimmed segment
152  /// seg.fEnter + fractotal * ( seg.fExit - seg.fEnter );
153  Double_t sumrange = GetSummedStepRange();
154  if ( sumrange < 0.0 ) {
155  LOG("PathS", pFATAL) << "GetPosition failed fractrim=" << fractrim
156  << " because sumrange = " << sumrange;
157  return TVector3(0,0,0);
158  }
159  Double_t target = fractrim * sumrange;
160  Double_t sum = 0;
161  for ( size_t i = 0; i < fStepRangeSet.size(); ++i ) {
162  const StepRange& sr = fStepRangeSet[i];
163  Double_t ds = ( sr.second - sr.first );
164  sum += ds;
165 #ifdef RWH_DEBUG
166  LOG("PathS", pINFO) << "GetPosition fractrim=" << fractrim
167  << " target " << target << " [" << i << "] "
168  << " ds " << ds << " sum " << sum;
169 #endif
170  if ( sum >= target ) {
171  Double_t overstep = sum - target;
172  Double_t fractotal = (sr.second - overstep)/fStepLength;
173 #ifdef RWH_DEBUG
174  LOG("PathS", pINFO) << "GetPosition fractrim=" << fractrim
175  << " overstep " << overstep
176  << " fractotal " << fractotal;
177 #endif
178  return fEnter + fractotal * ( fExit - fEnter );
179  }
180  }
181  LOG("PathS", pFATAL) << "GetPosition failed fractrim=" << fractrim;
182  return TVector3(0,0,0);
183 }
StepRangeSet fStepRangeSet
collection of {steplo,stephi} pairs
TVector3 fEnter
top vol coordinates and units
#define pFATAL
Definition: Messenger.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
TVector3 fExit
top vol coordinates and units
#define pINFO
Definition: Messenger.h:62
Double_t GetSummedStepRange() const
get the sum of all the step range (in case step has been trimmed or split)
std::pair< Double_t, Double_t > StepRange
static constexpr double sr
Definition: Units.h:166
Double_t fStepLength
total step size in volume
Double_t PathSegment::GetSummedStepRange ( ) const

get the sum of all the step range (in case step has been trimmed or split)

Definition at line 138 of file PathSegmentList.cxx.

References fStepRangeSet, and genie::units::sr.

Referenced by genie::geometry::ROOTGeomAnalyzer::ComputeMatLengths(), genie::geometry::PathSegmentList::FillMatStepSum(), genie::geometry::GeomVolSelectorI::GenerateTrimmedList(), genie::geometry::ROOTGeomAnalyzer::GenerateVertex(), and GetPosition().

139 {
140  Double_t sum = 0;
141  for ( size_t i = 0; i < fStepRangeSet.size(); ++i ) {
142  const StepRange& sr = fStepRangeSet[i];
143  sum += ( sr.second - sr.first );
144  }
145  return sum;
146 }
StepRangeSet fStepRangeSet
collection of {steplo,stephi} pairs
std::pair< Double_t, Double_t > StepRange
static constexpr double sr
Definition: Units.h:166
bool genie::geometry::PathSegment::IsTrimmedEmpty ( ) const
inline

Definition at line 84 of file PathSegmentList.h.

References fStepRangeSet.

84 { return fStepRangeSet.empty(); }
StepRangeSet fStepRangeSet
collection of {steplo,stephi} pairs
void PathSegment::Print ( ostream &  stream) const

Definition at line 95 of file PathSegmentList.cxx.

References fEnter, fMaterial, fPathString, fRayDist, fStepLength, fStepRangeSet, fVolume, genie::units::sr, and genie::pathsegutils::Vec3AsString().

Referenced by genie::geometry::operator<<().

96 {
97  const char* vname = (fVolume) ? fVolume->GetName() : "no volume";
98  const char* mname = (fMaterial) ? fMaterial->GetName() : "no material";
99  stream << genie::pathsegutils::Vec3AsString(&fEnter) << " "
100  //<< genie::pathsegutils::Vec3AsString(&fExit)
101  << " " // "raydist "
102  << std::setw(12) << fRayDist
103  << " " // "step "
104  << std::setw(12) << fStepLength << " "
105  << std::left
106  << std::setw(16) << vname << " '"
107  << std::setw(18) << mname << "' ";
108  size_t n = fStepRangeSet.size();
109  const int rngw = 24;
110  if ( n == 0 ) {
111  stream << std::setw(rngw) << "[ ]";
112  } else {
113  std::ostringstream rngset;
114  for ( size_t i = 0 ; i < n; ++i ) {
115  const StepRange& sr = fStepRangeSet[i];
116  rngset << "[" << sr.first << ":" << sr.second << "]";
117  }
118  stream << std::setw(rngw) << rngset.str();
119  }
120  stream << std::right;
121 #ifdef PATHSEG_KEEP_PATH
122  stream << " " << fPathString;
123 #endif
124 
125 }
string Vec3AsString(const TVector3 *vec)
StepRangeSet fStepRangeSet
collection of {steplo,stephi} pairs
TVector3 fEnter
top vol coordinates and units
const TGeoMaterial * fMaterial
ref only ptr to TGeoMaterial
const TGeoVolume * fVolume
ref only ptr to TGeoVolume
std::pair< Double_t, Double_t > StepRange
Double_t fRayDist
distance from start of ray
static constexpr double sr
Definition: Units.h:166
Double_t fStepLength
total step size in volume
std::string fPathString
full path names
void genie::geometry::PathSegment::SetEnter ( const TVector3 &  p3enter,
double  raydist 
)
inline

point of entry to geometry element

Definition at line 63 of file PathSegmentList.h.

References fEnter, and fRayDist.

Referenced by genie::geometry::ROOTGeomAnalyzer::SwimOnce().

64  { fEnter = p3enter; fRayDist = raydist; }
TVector3 fEnter
top vol coordinates and units
Double_t fRayDist
distance from start of ray
void genie::geometry::PathSegment::SetEnter ( const Double_t *  p3enter,
double  raydist 
)
inline

Definition at line 65 of file PathSegmentList.h.

References fEnter, and fRayDist.

66  { fEnter.SetXYZ(p3enter[0],p3enter[1],p3enter[2]); fRayDist = raydist; }
TVector3 fEnter
top vol coordinates and units
Double_t fRayDist
distance from start of ray
void genie::geometry::PathSegment::SetExit ( const TVector3 &  p3exit)
inline

point of exit from geometry element

Definition at line 69 of file PathSegmentList.h.

References fExit.

Referenced by genie::geometry::ROOTGeomAnalyzer::SwimOnce().

69 { fExit = p3exit; }
TVector3 fExit
top vol coordinates and units
void genie::geometry::PathSegment::SetExit ( const Double_t *  p3exit)
inline

Definition at line 70 of file PathSegmentList.h.

References fExit.

71  { fExit.SetXYZ(p3exit[0],p3exit[1],p3exit[2]); }
TVector3 fExit
top vol coordinates and units
void genie::geometry::PathSegment::SetGeo ( const TGeoVolume *  gvol,
const TGeoMedium *  gmed,
const TGeoMaterial *  gmat 
)
inline

info about the geometry element

Definition at line 74 of file PathSegmentList.h.

References fMaterial, fMedium, and fVolume.

Referenced by genie::geometry::ROOTGeomAnalyzer::SwimOnce().

76  { fVolume = gvol; fMedium = gmed; fMaterial = gmat; }
const TGeoMaterial * fMaterial
ref only ptr to TGeoMaterial
const TGeoVolume * fVolume
ref only ptr to TGeoVolume
const TGeoMedium * fMedium
ref only ptr to TGeoMedium
void genie::geometry::PathSegment::SetPath ( const char *  path)
inline

Definition at line 78 of file PathSegmentList.h.

References fPathString.

Referenced by genie::geometry::ROOTGeomAnalyzer::SwimOnce().

78 { fPathString = path; }
std::string fPathString
full path names
void PathSegment::SetStep ( Double_t  step,
bool  setlimits = true 
)

step taken in the geometry element

Definition at line 128 of file PathSegmentList.cxx.

References fStepLength, and fStepRangeSet.

Referenced by genie::geometry::ROOTGeomAnalyzer::SwimOnce().

129 {
130  fStepLength = step;
131  if (setlimits) {
132  fStepRangeSet.clear();
133  fStepRangeSet.push_back(StepRange(0,step));
134  }
135 }
StepRangeSet fStepRangeSet
collection of {steplo,stephi} pairs
std::pair< Double_t, Double_t > StepRange
Double_t fStepLength
total step size in volume

Friends And Related Function Documentation

bool operator< ( const PathSegment lhs,
const PathSegment rhs 
)
friend

Definition at line 116 of file PathSegmentList.h.

117  { return ( lhs.fRayDist < rhs.fRayDist ); }
ostream& operator<< ( ostream &  stream,
const PathSegment list 
)
friend

Definition at line 45 of file PathSegmentList.cxx.

46  {
47  ps.Print(stream);
48  return stream;
49  }
static constexpr double ps
Definition: Units.h:99

Member Data Documentation

TVector3 genie::geometry::PathSegment::fEnter

top vol coordinates and units

Definition at line 108 of file PathSegmentList.h.

Referenced by DoCrossCheck(), GetPosition(), Print(), and SetEnter().

TVector3 genie::geometry::PathSegment::fExit

top vol coordinates and units

Definition at line 109 of file PathSegmentList.h.

Referenced by DoCrossCheck(), GetPosition(), and SetExit().

const TGeoMaterial* genie::geometry::PathSegment::fMaterial
const TGeoMedium* genie::geometry::PathSegment::fMedium

ref only ptr to TGeoMedium

Definition at line 106 of file PathSegmentList.h.

Referenced by SetGeo(), and genie::geometry::GeomVolSelectorBasic::TrimSegment().

std::string genie::geometry::PathSegment::fPathString

full path names

Definition at line 111 of file PathSegmentList.h.

Referenced by Print(), SetPath(), and genie::geometry::GeomVolSelectorBasic::TrimSegment().

Double_t genie::geometry::PathSegment::fRayDist
Double_t genie::geometry::PathSegment::fStepLength

total step size in volume

Definition at line 104 of file PathSegmentList.h.

Referenced by DoCrossCheck(), GetPosition(), Print(), and SetStep().

StepRangeSet genie::geometry::PathSegment::fStepRangeSet
const TGeoVolume* genie::geometry::PathSegment::fVolume

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