GeomVolSelectorI.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5  or see $GENIE/LICENSE
6 
7  Author: Robert Hatcher <rhatcher@fnal.gov>
8 
9  For the class documentation see the corresponding header file.
10 
11  Important revisions after version 2.0.0 :
12  @ July 28, 2009 - RWH
13  Was first added in v2.5.1.
14  GeomVolSelectorI is the interface for a user defined volume selector.
15  Given a PathSegmentList* it returns a trimmed version (releasing ownership).
16  The selector can use info found in individual PathSegment element to
17  determine whether to keep, reject or trim elements.
18  @ February 4, 2010 - RWH
19  Make GenerateTrimmedList() a private method; users are now required to
20  supply the TrimSegment() method for all derived classes. This way they
21  don't have to worry about maintaining the list only how to trim any
22  particular PathSegment. Also, class now is configurable about whether to
23  retain a null segment; and also serves as a repository for the swimmer on
24  whether to fetch the geometry hierachy "path" (which turns out to be a
25  non-trivial overhead so we don't want to fetch it if we don't need to.
26 
27 */
28 //____________________________________________________________________________
29 
33 
34 using namespace genie;
35 using namespace genie::geometry;
36 
37 //____________________________________________________________________________
39  : fRemoveEntries(false), fNeedPath(false), fName("no-name")
40 {
41 }
42 
43 //____________________________________________________________________________
45  : fRemoveEntries(false), fNeedPath(false), fName(name)
46 {
47 }
48 
49 //___________________________________________________________________________
51 {
52 
53 }
54 //___________________________________________________________________________
55 
58 {
59  this->BeginPSList(untrimmed);
60 
61  PathSegmentList* trimmed = new PathSegmentList();
62  trimmed->SetStartInfo(untrimmed->GetStartPos(),untrimmed->GetDirection());
63 
65  untrimmed->GetPathSegmentV();
67  genie::geometry::PathSegmentList::PathSegVCItr_t sitr_end = segments.end();
68 
69  for ( ; sitr != sitr_end ; ++sitr ) {
70  PathSegment ps = *sitr; // new PathSegment is a copy of old
71  this->TrimSegment(ps);
72  if ( fRemoveEntries && ps.GetSummedStepRange() == 0 ) continue; // remove null segments
73  // now put (adjusted) entry on trimmed list
74  trimmed->AddSegment(ps);
75  }
76 
77  this->EndPSList();
78 
79  return trimmed;
80 }
81 //___________________________________________________________________________
const XML_Char * name
Definition: expat.h:151
const TVector3 & GetStartPos() const
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
virtual void TrimSegment(PathSegment &segment) const =0
bool fNeedPath
selector needs PathSegment "path" string
virtual void BeginPSList(const PathSegmentList *untrimmed) const =0
void AddSegment(const PathSegment &ps)
GENIE geometry drivers.
Object to be filled with the neutrino path-segments representing geometry volume steps (generally bou...
const TVector3 & GetDirection() const
std::string fName
volume selector name
PathSegmentV_t::const_iterator PathSegVCItr_t
bool fRemoveEntries
whether selector should remove entries or set hi=lo
void SetStartInfo(const TVector3 &pos=TVector3(0, 0, 1e37), const TVector3 &dir=TVector3(0, 0, 0))
Double_t GetSummedStepRange() const
get the sum of all the step range (in case step has been trimmed or split)
const PathSegmentV_t & GetPathSegmentV(void) const
virtual void EndPSList() const =0
virtual PathSegmentList * GenerateTrimmedList(const PathSegmentList *untrimmed) const
std::list< PathSegment > PathSegmentV_t
enum BeamMode string