Public Member Functions | Public Attributes | Friends | List of all members
genie::geometry::PathSegment Class Reference

#include <PathSegmentList.h>

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.

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.

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.

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.

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.

96 {
97  const char* vname = (fVolume) ? fVolume->GetName() : "no volume";
98  const char* mname = (fMaterial) ? fMaterial->GetName() : "no material";
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
std::void_t< T > n
const TGeoVolume * fVolume
ref only ptr to TGeoVolume
std::pair< Double_t, Double_t > StepRange
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
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.

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.

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.

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.

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.

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.

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.

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.

TVector3 genie::geometry::PathSegment::fExit

top vol coordinates and units

Definition at line 109 of file PathSegmentList.h.

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

ref only ptr to TGeoMaterial

Definition at line 107 of file PathSegmentList.h.

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

ref only ptr to TGeoMedium

Definition at line 106 of file PathSegmentList.h.

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

full path names

Definition at line 111 of file PathSegmentList.h.

Double_t genie::geometry::PathSegment::fRayDist

distance from start of ray

Definition at line 103 of file PathSegmentList.h.

Double_t genie::geometry::PathSegment::fStepLength

total step size in volume

Definition at line 104 of file PathSegmentList.h.

StepRangeSet genie::geometry::PathSegment::fStepRangeSet

collection of {steplo,stephi} pairs

Definition at line 113 of file PathSegmentList.h.

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

ref only ptr to TGeoVolume

Definition at line 105 of file PathSegmentList.h.


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