GENIEGenerator
Loading...
Searching...
No Matches
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.
TVector3 fDirection
 direction (in top vol coords)
PathSegmentV_t fSegmentList
 Actual list of segments.
MaterialMap_t fMatStepSum
 Segment list re-evaluated by material for fast lookup of path lengths.
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:\n May 26, 2009
License:\n Copyright (c) 2003-2025, 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

◆ MaterialMap_t

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

Definition at line 147 of file PathSegmentList.h.

◆ MaterialMapCItr_t

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

Definition at line 148 of file PathSegmentList.h.

◆ PathSegmentV_t

◆ PathSegVCItr_t

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

Definition at line 142 of file PathSegmentList.h.

Constructor & Destructor Documentation

◆ PathSegmentList() [1/2]

PathSegmentList::PathSegmentList ( void )

Definition at line 188 of file PathSegmentList.cxx.

References fDoCrossCheck, and fPrintVerbose.

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

◆ PathSegmentList() [2/2]

PathSegmentList::PathSegmentList ( const PathSegmentList & plist)

Definition at line 194 of file PathSegmentList.cxx.

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

References Copy(), and PathSegmentList().

◆ ~PathSegmentList()

PathSegmentList::~PathSegmentList ( )

Definition at line 199 of file PathSegmentList.cxx.

200{
201
202}

Member Function Documentation

◆ AddSegment()

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

Definition at line 136 of file PathSegmentList.h.

136{ fSegmentList.push_back(ps); }
PathSegmentV_t fSegmentList
Actual list of segments.

References fSegmentList.

Referenced by genie::geometry::GeomVolSelectorI::GenerateTrimmedList().

◆ Copy()

void PathSegmentList::Copy ( const PathSegmentList & plist)

Definition at line 245 of file PathSegmentList.cxx.

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;
260 fMatStepSum = plist.fMatStepSum;
263}
TVector3 fDirection
direction (in top vol coords)
TVector3 fStartPos
Record, for future comparison, the path taken.
MaterialMap_t fMatStepSum
Segment list re-evaluated by material for fast lookup of path lengths.

References fDirection, fDoCrossCheck, fMatStepSum, fPrintVerbose, fSegmentList, fStartPos, and PathSegmentList().

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

◆ CrossCheck()

void PathSegmentList::CrossCheck ( double & mxddist,
double & mxdstep ) const

Definition at line 266 of file PathSegmentList.cxx.

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::const_iterator PathSegVCItr_t
void DoCrossCheck(const TVector3 &startpos, double &ddist, double &dstep) const
perform cross check on segment, return differences

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

◆ FillMatStepSum()

void PathSegmentList::FillMatStepSum ( void )

Definition at line 229 of file PathSegmentList.cxx.

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}
const TGeoMaterial * fMaterial
ref only ptr to TGeoMaterial
Double_t GetSummedStepRange() const
get the sum of all the step range (in case step has been trimmed or split)

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

◆ GetDirection()

const TVector3 & genie::geometry::PathSegmentList::GetDirection ( ) const
inline

Definition at line 138 of file PathSegmentList.h.

138{ return fDirection; }

References fDirection.

Referenced by genie::geometry::GeomVolSelectorI::GenerateTrimmedList().

◆ GetMatStepSumMap()

const MaterialMap_t & genie::geometry::PathSegmentList::GetMatStepSumMap ( void ) const
inline

Definition at line 151 of file PathSegmentList.h.

151{ return fMatStepSum; };

References fMatStepSum.

Referenced by Print().

◆ GetPathSegmentV()

const PathSegmentV_t & genie::geometry::PathSegmentList::GetPathSegmentV ( void ) const
inline

Definition at line 144 of file PathSegmentList.h.

144{ return fSegmentList; }

References fSegmentList.

Referenced by genie::geometry::GeomVolSelectorI::GenerateTrimmedList().

◆ GetStartPos()

const TVector3 & genie::geometry::PathSegmentList::GetStartPos ( ) const
inline

Definition at line 139 of file PathSegmentList.h.

139{ return fStartPos; }

References fStartPos.

Referenced by genie::geometry::GeomVolSelectorI::GenerateTrimmedList().

◆ IsSameStart()

bool PathSegmentList::IsSameStart ( const TVector3 & pos,
const TVector3 & dir ) const

Definition at line 223 of file PathSegmentList.cxx.

224{
225 return ( this->fStartPos == pos && this->fDirection == dir );
226}
string dir

References dir, fDirection, and fStartPos.

◆ operator=()

PathSegmentList & PathSegmentList::operator= ( const PathSegmentList & list)

Definition at line 442 of file PathSegmentList.cxx.

443{
444 this->Copy(list);
445 return (*this);
446}

References Copy(), and PathSegmentList().

◆ Print()

void PathSegmentList::Print ( ostream & stream) const

Definition at line 286 of file PathSegmentList.cxx.

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}
const MaterialMap_t & GetMatStepSumMap(void) const
MaterialMap_t::const_iterator MaterialMapCItr_t
string Vec3AsString(const TVector3 *vec)

References genie::geometry::PathSegment::DoCrossCheck(), fDirection, fDoCrossCheck, fPrintVerbose, fSegmentList, fStartPos, GetMatStepSumMap(), and genie::pathsegutils::Vec3AsString().

Referenced by operator<<.

◆ SetAllToZero()

void PathSegmentList::SetAllToZero ( void )

Definition at line 205 of file PathSegmentList.cxx.

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}
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96

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

◆ SetDoCrossCheck()

void genie::geometry::PathSegmentList::SetDoCrossCheck ( bool doit = true)
inline

Definition at line 130 of file PathSegmentList.h.

130{ fDoCrossCheck = doit; }

References fDoCrossCheck.

◆ SetPrintVerbose()

void genie::geometry::PathSegmentList::SetPrintVerbose ( bool doit = true)
inline

Definition at line 131 of file PathSegmentList.h.

131{ fPrintVerbose = doit; }

References fPrintVerbose.

◆ SetStartInfo()

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.

217{
218 this->fStartPos = pos;
219 this->fDirection = dir;
220}

References dir, fDirection, and fStartPos.

Referenced by genie::geometry::GeomVolSelectorI::GenerateTrimmedList().

◆ size()

size_t genie::geometry::PathSegmentList::size ( void ) const
inline

Definition at line 145 of file PathSegmentList.h.

145{ return fSegmentList.size(); }

References fSegmentList.

◆ operator<<

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

References Print().

Member Data Documentation

◆ fDirection

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().

◆ fDoCrossCheck

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

Definition at line 178 of file PathSegmentList.h.

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

◆ fMatStepSum

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().

◆ fPrintVerbose

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

Definition at line 179 of file PathSegmentList.h.

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

◆ fSegmentList

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().

◆ fStartPos

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: