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

Object to be filled with the neutrino path-segments representing geometry volume steps (generally boundary-to-boundary) along with geometry materials. Good for a single starting position and travelling along the direction of the neutrino 4-momentum. More...

#include <PathSegmentList.h>

Public Types

typedef std::list< PathSegmentPathSegmentV_t
 
typedef
PathSegmentV_t::const_iterator 
PathSegVCItr_t
 
typedef std::map< const
TGeoMaterial *, Double_t > 
MaterialMap_t
 
typedef
MaterialMap_t::const_iterator 
MaterialMapCItr_t
 

Public Member Functions

 PathSegmentList ()
 
 PathSegmentList (const PathSegmentList &plist)
 
 ~PathSegmentList ()
 
void SetDoCrossCheck (bool doit=true)
 
void SetPrintVerbose (bool doit=true)
 
void SetAllToZero (void)
 
void SetStartInfo (const TVector3 &pos=TVector3(0, 0, 1e37), const TVector3 &dir=TVector3(0, 0, 0))
 
bool IsSameStart (const TVector3 &pos, const TVector3 &dir) const
 
void AddSegment (const PathSegment &ps)
 
const TVector3 & GetDirection () const
 
const TVector3 & GetStartPos () const
 
const PathSegmentV_tGetPathSegmentV (void) const
 
size_t size (void) const
 
void FillMatStepSum (void)
 
const MaterialMap_tGetMatStepSumMap (void) const
 
void CrossCheck (double &mxddist, double &mxdstep) const
 
void Copy (const PathSegmentList &plist)
 
PathSegmentListoperator= (const PathSegmentList &list)
 
void Print (ostream &stream) const
 

Protected Attributes

TVector3 fStartPos
 Record, for future comparison, the path taken. More...
 
TVector3 fDirection
 direction (in top vol coords) More...
 
PathSegmentV_t fSegmentList
 Actual list of segments. More...
 
MaterialMap_t fMatStepSum
 Segment list re-evaluated by material for fast lookup of path lengths. More...
 
bool fDoCrossCheck
 
bool fPrintVerbose
 

Friends

ostream & operator<< (ostream &stream, const PathSegmentList &list)
 

Detailed Description

Object to be filled with the neutrino path-segments representing geometry volume steps (generally boundary-to-boundary) along with geometry materials. Good for a single starting position and travelling along the direction of the neutrino 4-momentum.

Author
Robert Hatcher rhatc.nosp@m.her@.nosp@m.fnal..nosp@m.gov FNAL
Created:
May 26, 2009
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 123 of file PathSegmentList.h.

Member Typedef Documentation

typedef std::map<const TGeoMaterial*,Double_t> genie::geometry::PathSegmentList::MaterialMap_t

Definition at line 147 of file PathSegmentList.h.

typedef MaterialMap_t::const_iterator genie::geometry::PathSegmentList::MaterialMapCItr_t

Definition at line 148 of file PathSegmentList.h.

Definition at line 141 of file PathSegmentList.h.

typedef PathSegmentV_t::const_iterator genie::geometry::PathSegmentList::PathSegVCItr_t

Definition at line 142 of file PathSegmentList.h.

Constructor & Destructor Documentation

PathSegmentList::PathSegmentList ( void  )

Definition at line 188 of file PathSegmentList.cxx.

189  : fDoCrossCheck(false), fPrintVerbose(false)
190 {
191 
192 }
PathSegmentList::PathSegmentList ( const PathSegmentList plist)

Definition at line 194 of file PathSegmentList.cxx.

References Copy().

195 {
196  this->Copy(plist);
197 }
void Copy(const PathSegmentList &plist)
PathSegmentList::~PathSegmentList ( )

Definition at line 199 of file PathSegmentList.cxx.

200 {
201 
202 }

Member Function Documentation

void genie::geometry::PathSegmentList::AddSegment ( const PathSegment ps)
inline

Definition at line 136 of file PathSegmentList.h.

References fSegmentList.

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

136 { fSegmentList.push_back(ps); }
PathSegmentV_t fSegmentList
Actual list of segments.
static constexpr double ps
Definition: Units.h:99
void PathSegmentList::Copy ( const PathSegmentList plist)

Definition at line 245 of file PathSegmentList.cxx.

References fDirection, fDoCrossCheck, fMatStepSum, fPrintVerbose, fSegmentList, and fStartPos.

Referenced by operator=(), and PathSegmentList().

246 {
247  fSegmentList.clear();
248  fMatStepSum.clear();
249 
250  // copy the segments
251  //vector<PathSegment>::const_iterator pl_iter;
252  //for (pl_iter = plist.fSegmentList.begin(); pl_iter != plist.fSegmentList.end(); ++pl_iter) {
253  // this->fSegmentList.push_back( *pl_iter );
254  //}
255 
256  // other elements
257  fStartPos = plist.fStartPos;
258  fDirection = plist.fDirection;
259  fSegmentList = plist.fSegmentList;
260  fMatStepSum = plist.fMatStepSum;
263 }
PathSegmentV_t fSegmentList
Actual list of segments.
MaterialMap_t fMatStepSum
Segment list re-evaluated by material for fast lookup of path lengths.
TVector3 fStartPos
Record, for future comparison, the path taken.
TVector3 fDirection
direction (in top vol coords)
void PathSegmentList::CrossCheck ( double &  mxddist,
double &  mxdstep 
) const

Definition at line 266 of file PathSegmentList.cxx.

References genie::geometry::PathSegment::DoCrossCheck(), fSegmentList, fStartPos, and genie::units::ps.

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

267 {
268 
269  double dstep, ddist;
270  mxdstep = 0;
271  mxddist = 0;
274  for ( ; sitr != sitr_end ; ++sitr ) {
275  const PathSegment& ps = *sitr;
276  ps.DoCrossCheck(fStartPos,ddist,dstep);
277  double addist = TMath::Abs(ddist);
278  double adstep = TMath::Abs(dstep);
279  if ( addist > mxddist ) mxddist = addist;
280  if ( adstep > mxdstep ) mxdstep = adstep;
281  }
282 
283 }
PathSegmentV_t fSegmentList
Actual list of segments.
TVector3 fStartPos
Record, for future comparison, the path taken.
PathSegmentV_t::const_iterator PathSegVCItr_t
static constexpr double ps
Definition: Units.h:99
void DoCrossCheck(const TVector3 &startpos, double &ddist, double &dstep) const
perform cross check on segment, return differences
void PathSegmentList::FillMatStepSum ( void  )

Definition at line 229 of file PathSegmentList.cxx.

References genie::geometry::PathSegment::fMaterial, fMatStepSum, fSegmentList, genie::geometry::PathSegment::GetSummedStepRange(), and genie::units::ps.

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

230 {
231  fMatStepSum.clear();
232 
235  for ( ; sitr != sitr_end ; ++sitr ) {
236  const PathSegment& ps = *sitr;
237  const TGeoMaterial* mat = ps.fMaterial;
238  // use the post-trim limits on how much material is stepped through
239  fMatStepSum[mat] += ps.GetSummedStepRange();
240  }
241 
242 }
PathSegmentV_t fSegmentList
Actual list of segments.
MaterialMap_t fMatStepSum
Segment list re-evaluated by material for fast lookup of path lengths.
const TGeoMaterial * fMaterial
ref only ptr to TGeoMaterial
PathSegmentV_t::const_iterator PathSegVCItr_t
Double_t GetSummedStepRange() const
get the sum of all the step range (in case step has been trimmed or split)
static constexpr double ps
Definition: Units.h:99
const TVector3& genie::geometry::PathSegmentList::GetDirection ( ) const
inline
const MaterialMap_t& genie::geometry::PathSegmentList::GetMatStepSumMap ( void  ) const
inline

Definition at line 151 of file PathSegmentList.h.

References fMatStepSum.

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

151 { return fMatStepSum; };
MaterialMap_t fMatStepSum
Segment list re-evaluated by material for fast lookup of path lengths.
const PathSegmentV_t& genie::geometry::PathSegmentList::GetPathSegmentV ( void  ) const
inline
const TVector3& genie::geometry::PathSegmentList::GetStartPos ( ) const
inline
bool PathSegmentList::IsSameStart ( const TVector3 &  pos,
const TVector3 &  dir 
) const

Definition at line 223 of file PathSegmentList.cxx.

References fDirection, and fStartPos.

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

224 {
225  return ( this->fStartPos == pos && this->fDirection == dir );
226 }
TVector3 fStartPos
Record, for future comparison, the path taken.
string dir
TVector3 fDirection
direction (in top vol coords)
PathSegmentList & PathSegmentList::operator= ( const PathSegmentList list)

Definition at line 442 of file PathSegmentList.cxx.

References Copy().

443 {
444  this->Copy(list);
445  return (*this);
446 }
void Copy(const PathSegmentList &plist)
void PathSegmentList::Print ( ostream &  stream) const

Definition at line 286 of file PathSegmentList.cxx.

References fDirection, fDoCrossCheck, fPrintVerbose, fSegmentList, fStartPos, GetMatStepSumMap(), genie::units::ps, and genie::pathsegutils::Vec3AsString().

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

287 {
288  stream << "\nPathSegmentList [-]" << endl;
289  stream << " start " << pathsegutils::Vec3AsString(&fStartPos)
290  << " dir " << pathsegutils::Vec3AsString(&fDirection) << endl;
291 
292  double dstep, ddist, mxdstep = 0, mxddist = 0;
293  int k = 0, nseg = 0;
296  for ( ; sitr != sitr_end ; ++sitr, ++k ) {
297  const PathSegment& ps = *sitr;
298  ++nseg;
299  stream << " [" << setw(4) << k << "] " << ps;
300  if ( fDoCrossCheck ) {
301  ps.DoCrossCheck(fStartPos,ddist,dstep);
302  double addist = TMath::Abs(ddist);
303  double adstep = TMath::Abs(dstep);
304  if ( addist > mxddist ) mxddist = addist;
305  if ( adstep > mxdstep ) mxdstep = adstep;
306  stream << " recalc diff"
307  << " dist " << std::setw(12) << ddist
308  << " step " << std::setw(12) << dstep;
309  }
310  stream << std::endl;
311  }
312  if ( nseg == 0 ) stream << " holds no segments." << std::endl;
313 
314  if ( fDoCrossCheck )
315  stream << "PathSegmentList "
316  << " mxddist " << mxddist
317  << " mxdstep " << mxdstep
318  << std::endl;
319 
320  if ( fPrintVerbose ) {
323  // loop over map to get tgt weight for each material (once)
324  // steps outside the geometry may have no assigned material
325  for ( ; mitr != mitr_end; ++mitr ) {
326  const TGeoMaterial* mat = mitr->first;
327  double sumsteps = mitr->second;
328  stream << " fMatStepSum[" << mat->GetName() << "] = " << sumsteps << std::endl;
329  }
330  }
331 
332 }
PathSegmentV_t fSegmentList
Actual list of segments.
string Vec3AsString(const TVector3 *vec)
TVector3 fStartPos
Record, for future comparison, the path taken.
PathSegmentV_t::const_iterator PathSegVCItr_t
TVector3 fDirection
direction (in top vol coords)
static constexpr double ps
Definition: Units.h:99
MaterialMap_t::const_iterator MaterialMapCItr_t
const MaterialMap_t & GetMatStepSumMap(void) const
void PathSegmentList::SetAllToZero ( void  )

Definition at line 205 of file PathSegmentList.cxx.

References fDirection, fMatStepSum, fSegmentList, fStartPos, LOG, and pDEBUG.

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

206 {
207  LOG("PathS", pDEBUG) << "SetAllToZero called";
208 
209  this->fStartPos.SetXYZ(0,0,1e37); // clear cache of position/direction
210  this->fDirection.SetXYZ(0,0,0); //
211  this->fSegmentList.clear(); // clear the vector
212  this->fMatStepSum.clear(); // clear the re-factorized info
213 }
PathSegmentV_t fSegmentList
Actual list of segments.
MaterialMap_t fMatStepSum
Segment list re-evaluated by material for fast lookup of path lengths.
TVector3 fStartPos
Record, for future comparison, the path taken.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
TVector3 fDirection
direction (in top vol coords)
#define pDEBUG
Definition: Messenger.h:63
void genie::geometry::PathSegmentList::SetDoCrossCheck ( bool  doit = true)
inline
void genie::geometry::PathSegmentList::SetPrintVerbose ( bool  doit = true)
inline

Definition at line 131 of file PathSegmentList.h.

References fPrintVerbose.

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

void PathSegmentList::SetStartInfo ( const TVector3 &  pos = TVector3(0,0,1e37),
const TVector3 &  dir = TVector3(0,0,0) 
)

Definition at line 216 of file PathSegmentList.cxx.

References dir, fDirection, and fStartPos.

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

217 {
218  this->fStartPos = pos;
219  this->fDirection = dir;
220 }
TVector3 fStartPos
Record, for future comparison, the path taken.
string dir
TVector3 fDirection
direction (in top vol coords)
size_t genie::geometry::PathSegmentList::size ( void  ) const
inline

Definition at line 145 of file PathSegmentList.h.

References fSegmentList.

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

145 { return fSegmentList.size(); }
PathSegmentV_t fSegmentList
Actual list of segments.

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const PathSegmentList list 
)
friend

Definition at line 51 of file PathSegmentList.cxx.

52  {
53  list.Print(stream);
54  return stream;
55  }
void Print(ostream &stream) const

Member Data Documentation

TVector3 genie::geometry::PathSegmentList::fDirection
protected

direction (in top vol coords)

Definition at line 170 of file PathSegmentList.h.

Referenced by Copy(), GetDirection(), IsSameStart(), Print(), SetAllToZero(), and SetStartInfo().

bool genie::geometry::PathSegmentList::fDoCrossCheck
protected

Definition at line 178 of file PathSegmentList.h.

Referenced by Copy(), Print(), and SetDoCrossCheck().

MaterialMap_t genie::geometry::PathSegmentList::fMatStepSum
protected

Segment list re-evaluated by material for fast lookup of path lengths.

Definition at line 176 of file PathSegmentList.h.

Referenced by Copy(), FillMatStepSum(), GetMatStepSumMap(), and SetAllToZero().

bool genie::geometry::PathSegmentList::fPrintVerbose
protected

Definition at line 179 of file PathSegmentList.h.

Referenced by Copy(), Print(), and SetPrintVerbose().

PathSegmentV_t genie::geometry::PathSegmentList::fSegmentList
protected

Actual list of segments.

Definition at line 173 of file PathSegmentList.h.

Referenced by AddSegment(), Copy(), CrossCheck(), FillMatStepSum(), GetPathSegmentV(), Print(), SetAllToZero(), and size().

TVector3 genie::geometry::PathSegmentList::fStartPos
protected

Record, for future comparison, the path taken.

starting position (in top vol coords)

Definition at line 169 of file PathSegmentList.h.

Referenced by Copy(), CrossCheck(), GetStartPos(), IsSameStart(), Print(), SetAllToZero(), and SetStartInfo().


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