Public Member Functions | Public Attributes | Friends | List of all members
genie::geometry::PathSegment 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/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 57 of file PathSegmentList.h.

Constructor & Destructor Documentation

PathSegment::PathSegment ( void  )

Definition at line 119 of file PathSegmentList.cxx.

119  :
120  fRayDist(0), fStepLength(0),
121  fVolume(0), fMedium(0), fMaterial(0),
122  fEnter(), fExit()
123 {
124 }
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 61 of file PathSegmentList.h.

61 { ; }

Member Function Documentation

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

perform cross check on segment, return differences

Definition at line 127 of file PathSegmentList.cxx.

References fEnter, fExit, fRayDist, fStepLength, and Mag().

Referenced by genie::geometry::PathSegmentList::CrossCheck(), and IsTrimmedEmpty().

129 {
130  double dist_recalc = (fEnter-startpos).Mag();
131  ddist = dist_recalc - fRayDist;
132 
133  double step_recalc = (fExit-fEnter).Mag();
134  dstep = step_recalc - fStepLength;
135 }
TVector3 fEnter
top vol coordinates and units
TVector3 fExit
top vol coordinates and units
Double_t fRayDist
distance from start of ray
float Mag() const
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 191 of file PathSegmentList.cxx.

References fEnter, fExit, fStepLength, fStepRangeSet, GetSummedStepRange(), MECModelEnuComparisons::i, LOG, pFATAL, pINFO, sr, and sum.

Referenced by genie::geometry::ROOTGeomAnalyzer::GenerateVertex(), and IsTrimmedEmpty().

192 {
193  /// calculate position within allowed ranges passed as
194  /// fraction of trimmed segment
195  /// seg.fEnter + fractotal * ( seg.fExit - seg.fEnter );
196  Double_t sumrange = GetSummedStepRange();
197  if ( sumrange < 0.0 ) {
198  LOG("PathS", pFATAL) << "GetPosition failed fractrim=" << fractrim
199  << " because sumrange = " << sumrange;
200  return TVector3(0,0,0);
201  }
202  Double_t target = fractrim * sumrange;
203  Double_t sum = 0;
204  for ( size_t i = 0; i < fStepRangeSet.size(); ++i ) {
205  const StepRange& sr = fStepRangeSet[i];
206  Double_t ds = ( sr.second - sr.first );
207  sum += ds;
208 #ifdef RWH_DEBUG
209  LOG("PathS", pINFO) << "GetPosition fractrim=" << fractrim
210  << " target " << target << " [" << i << "] "
211  << " ds " << ds << " sum " << sum;
212 #endif
213  if ( sum >= target ) {
214  Double_t overstep = sum - target;
215  Double_t fractotal = (sr.second - overstep)/fStepLength;
216 #ifdef RWH_DEBUG
217  LOG("PathS", pINFO) << "GetPosition fractrim=" << fractrim
218  << " overstep " << overstep
219  << " fractotal " << fractotal;
220 #endif
221  return fEnter + fractotal * ( fExit - fEnter );
222  }
223  }
224  LOG("PathS", pFATAL) << "GetPosition failed fractrim=" << fractrim;
225  return TVector3(0,0,0);
226 }
const XML_Char * target
Definition: expat.h:268
StepRangeSet fStepRangeSet
collection of {steplo,stephi} pairs
TVector3 fEnter
top vol coordinates and units
#define pFATAL
Definition: Messenger.h:57
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
TVector3 fExit
top vol coordinates and units
caf::StandardRecord * sr
#define pINFO
Definition: Messenger.h:63
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
A very simple service to remember what detector we&#39;re working in.
Double_t sum
Definition: plot.C:31
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 181 of file PathSegmentList.cxx.

References fStepRangeSet, MECModelEnuComparisons::i, sr, and sum.

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

182 {
183  Double_t sum = 0;
184  for ( size_t i = 0; i < fStepRangeSet.size(); ++i ) {
185  const StepRange& sr = fStepRangeSet[i];
186  sum += ( sr.second - sr.first );
187  }
188  return sum;
189 }
StepRangeSet fStepRangeSet
collection of {steplo,stephi} pairs
caf::StandardRecord * sr
std::pair< Double_t, Double_t > StepRange
Double_t sum
Definition: plot.C:31
bool genie::geometry::PathSegment::IsTrimmedEmpty ( ) const
inline

Definition at line 85 of file PathSegmentList.h.

References DoCrossCheck(), util::frac(), fStepRangeSet, GetPosition(), GetSummedStepRange(), parse_dependency_file_t::list, operator<, operator<<, Print(), and runNovaSAM::stream.

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

Definition at line 138 of file PathSegmentList.cxx.

References fEnter, fMaterial, fPathString, fRayDist, fStepLength, fStepRangeSet, fVolume, MECModelEnuComparisons::i, art::left(), getGoodRuns4SAM::n, art::right(), sr, and genie::pathsegutils::Vec3AsString().

Referenced by genie::geometry::PathSegmentList::GetMatStepSumMap(), IsTrimmedEmpty(), and genie::geometry::operator<<().

139 {
140  const char* vname = (fVolume) ? fVolume->GetName() : "no volume";
141  const char* mname = (fMaterial) ? fMaterial->GetName() : "no material";
143  //<< genie::pathsegutils::Vec3AsString(&fExit)
144  << " " // "raydist "
145  << std::setw(12) << fRayDist
146  << " " // "step "
147  << std::setw(12) << fStepLength << " "
148  << std::left
149  << std::setw(16) << vname << " '"
150  << std::setw(18) << mname << "' ";
151  size_t n = fStepRangeSet.size();
152  const int rngw = 24;
153  if ( n == 0 ) {
154  stream << std::setw(rngw) << "[ ]";
155  } else {
156  std::ostringstream rngset;
157  for ( size_t i = 0 ; i < n; ++i ) {
158  const StepRange& sr = fStepRangeSet[i];
159  rngset << "[" << sr.first << ":" << sr.second << "]";
160  }
161  stream << std::setw(rngw) << rngset.str();
162  }
163  stream << std::right;
164 #ifdef PATHSEG_KEEP_PATH
165  stream << " " << fPathString;
166 #endif
167 
168 }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
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
caf::StandardRecord * sr
std::pair< Double_t, Double_t > StepRange
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
Double_t fRayDist
distance from start of ray
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 64 of file PathSegmentList.h.

References fEnter, and fRayDist.

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

65  { 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 66 of file PathSegmentList.h.

References fEnter, and fRayDist.

67  { 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 70 of file PathSegmentList.h.

References fExit.

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

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

Definition at line 71 of file PathSegmentList.h.

References fExit.

72  { 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 75 of file PathSegmentList.h.

References fMaterial, fMedium, and fVolume.

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

77  { 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 79 of file PathSegmentList.h.

References fPathString, path, SetStep(), and fillBadChanDBTables::step.

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

79 { fPathString = path; }
const std::string path
Definition: plot_BEN.C:43
std::string fPathString
full path names
void PathSegment::SetStep ( Double_t  step,
bool  setlimits = true 
)

step taken in the geometry element

Definition at line 171 of file PathSegmentList.cxx.

References fStepLength, fStepRangeSet, and fillBadChanDBTables::step.

Referenced by SetPath(), and genie::geometry::ROOTGeomAnalyzer::SwimOnce().

172 {
173  fStepLength = step;
174  if (setlimits) {
175  fStepRangeSet.clear();
176  fStepRangeSet.push_back(StepRange(0,step));
177  }
178 }
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 117 of file PathSegmentList.h.

Referenced by IsTrimmedEmpty().

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

Member Data Documentation

TVector3 genie::geometry::PathSegment::fEnter

top vol coordinates and units

Definition at line 109 of file PathSegmentList.h.

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

TVector3 genie::geometry::PathSegment::fExit

top vol coordinates and units

Definition at line 110 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 107 of file PathSegmentList.h.

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

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

full path names

Definition at line 112 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 105 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: