Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
genie::geometry::GeomVolSelectorBasic Class Reference

GENIE Interface for user-defined volume selector functors This basic version allows configurations that depend on PathSegment elements' material/media/volume and/or "path". More...

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Tools/Geometry/GeomVolSelectorBasic.h"

Inheritance diagram for genie::geometry::GeomVolSelectorBasic:
genie::geometry::GeomVolSelectorI genie::geometry::GeomVolSelectorFiducial genie::geometry::GeomVolSelectorRockBox

Public Member Functions

 GeomVolSelectorBasic ()
 
virtual ~GeomVolSelectorBasic ()
 
void SetVolumeSelection (string volstr)
 
void SetMediumSelection (string medstr)
 
void SetMaterialSelection (string matstr)
 
void SetPathSelection (string pathstr)
 
void TrimSegment (PathSegment &segment) const
 
void BeginPSList (const PathSegmentList *untrimmed) const
 
void EndPSList () const
 
virtual PathSegmentListGenerateTrimmedList (const PathSegmentList *untrimmed) const
 
void SetCurrentRay (const TLorentzVector &x4, const TLorentzVector &p4)
 configure for individual neutrino ray More...
 
void SetSI2Local (double scale)
 set scale factor for SI to "raydist" units of PathSegmentList More...
 
void SetRemoveEntries (bool rmset)
 
bool GetRemoveEntries ()
 
void SetNeedPath ()
 
bool GetNeedPath () const
 allow toggle on only More...
 
std::string GetName () const
 

Protected Member Functions

void ParseSelection (const string &str, vector< string > &required, vector< string > &forbidden)
 
bool RejectString (const string &str, const vector< string > &required, const vector< string > &forbidden) const
 

Protected Attributes

vector< stringfRequiredVol
 
vector< stringfRequiredMed
 
vector< stringfRequiredMat
 
vector< stringfRequiredPath
 
vector< stringfForbiddenVol
 
vector< stringfForbiddenMed
 
vector< stringfForbiddenMat
 
vector< stringfForbiddenPath
 
TLorentzVector fX4
 current neutrino ray's start position (global) More...
 
TLorentzVector fP4
 current neutrino ray's momentum (global) More...
 
double fScale
 SI->raydist scale factor. More...
 
bool fRemoveEntries
 whether selector should remove entries or set hi=lo More...
 
bool fNeedPath
 selector needs PathSegment "path" string More...
 
std::string fName
 volume selector name More...
 

Detailed Description

GENIE Interface for user-defined volume selector functors This basic version allows configurations that depend on PathSegment elements' material/media/volume and/or "path".

Author
Robert Hatcher rhatc.nosp@m.her@.nosp@m.fnal..nosp@m.gov FNAL

December 3, 2008

Copyright (c) 2003-2019, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 36 of file GeomVolSelectorBasic.h.

Constructor & Destructor Documentation

GeomVolSelectorBasic::GeomVolSelectorBasic ( )

Definition at line 34 of file GeomVolSelectorBasic.cxx.

35  : GeomVolSelectorI("Basic")
36 {
37 
38 }
GeomVolSelectorBasic::~GeomVolSelectorBasic ( )
virtual

Definition at line 41 of file GeomVolSelectorBasic.cxx.

42 {
43 
44 }

Member Function Documentation

void GeomVolSelectorBasic::BeginPSList ( const PathSegmentList untrimmed) const
virtual

Every derived version must also respond to a signal that starts a new path segment list processing and ends it. In general they can simply ignore the signal. If the derived class needs to cache something, make it mutable

Implements genie::geometry::GeomVolSelectorI.

Reimplemented in genie::geometry::GeomVolSelectorFiducial, and genie::geometry::GeomVolSelectorRockBox.

Definition at line 74 of file GeomVolSelectorBasic.cxx.

Referenced by genie::geometry::GeomVolSelectorFiducial::BeginPSList().

75 { ; }
void GeomVolSelectorBasic::EndPSList ( ) const
virtual
PathSegmentList * GeomVolSelectorI::GenerateTrimmedList ( const PathSegmentList untrimmed) const
virtualinherited

create and return a new PathSegmentList from the old list relinquishes ownership of returned object

Definition at line 57 of file GeomVolSelectorI.cxx.

References genie::geometry::PathSegmentList::AddSegment(), genie::geometry::GeomVolSelectorI::BeginPSList(), genie::geometry::GeomVolSelectorI::EndPSList(), genie::geometry::GeomVolSelectorI::fRemoveEntries, genie::geometry::PathSegmentList::GetDirection(), genie::geometry::PathSegmentList::GetPathSegmentV(), genie::geometry::PathSegmentList::GetStartPos(), genie::geometry::PathSegment::GetSummedStepRange(), nd_projection_maker::ps, genie::geometry::PathSegmentList::SetStartInfo(), and genie::geometry::GeomVolSelectorI::TrimSegment().

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

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 }
const TVector3 & GetStartPos() const
virtual void TrimSegment(PathSegment &segment) const =0
virtual void BeginPSList(const PathSegmentList *untrimmed) const =0
void AddSegment(const PathSegment &ps)
Object to be filled with the neutrino path-segments representing geometry volume steps (generally bou...
const TVector3 & GetDirection() const
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
std::list< PathSegment > PathSegmentV_t
std::string genie::geometry::GeomVolSelectorI::GetName ( ) const
inlineinherited
bool genie::geometry::GeomVolSelectorI::GetNeedPath ( ) const
inlineinherited

allow toggle on only

Definition at line 65 of file GeomVolSelectorI.h.

References genie::geometry::GeomVolSelectorI::fNeedPath.

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

65 { return fNeedPath; }
bool fNeedPath
selector needs PathSegment "path" string
bool genie::geometry::GeomVolSelectorI::GetRemoveEntries ( )
inlineinherited

Definition at line 62 of file GeomVolSelectorI.h.

References genie::geometry::GeomVolSelectorI::fRemoveEntries.

62 { return fRemoveEntries; }
bool fRemoveEntries
whether selector should remove entries or set hi=lo
void GeomVolSelectorBasic::ParseSelection ( const string str,
vector< string > &  required,
vector< string > &  forbidden 
)
protected

Definition at line 120 of file GeomVolSelectorBasic.cxx.

References MECModelEnuComparisons::i, getGoodRuns4SAM::n, and genie::utils::str::Split().

Referenced by SetMaterialSelection(), SetMediumSelection(), SetPathSelection(), and SetVolumeSelection().

123 {
124  required.clear();
125  forbidden.clear();
126  vector<string> pieces = genie::utils::str::Split(strall,":;,");
127  size_t n = pieces.size();
128  for ( size_t i = 0; i < n; ++i ) {
129  string& strone = pieces[i];
130  if ( strone == "" ) continue; // reject null strings
131  if ( strone.find("-") == 0 ) forbidden.push_back(strone.substr(1,std::string::npos));
132  else if ( strone.find("+") == 0 ) required.push_back(strone.substr(1,std::string::npos));
133  else required.push_back(strone);
134  }
135 }
vector< string > Split(string input, string delim)
Definition: StringUtils.cxx:42
bool GeomVolSelectorBasic::RejectString ( const string str,
const vector< string > &  required,
const vector< string > &  forbidden 
) const
protected

Definition at line 137 of file GeomVolSelectorBasic.cxx.

References modifyFHiCL::found.

Referenced by TrimSegment().

140 {
141  bool reject = false;
142 
143  // must have at least one of the required elements (if there are any)
144  size_t nrequired = required.size();
145  if ( nrequired > 0 ) {
146  bool found = false;
147  for (size_t jr = 0; jr < nrequired; ++jr) {
148  if ( str.find(required[jr]) != std::string::npos ) {
149  found = true;
150  break; // found at least one case, so we're good
151  }
152  }
153  if ( ! found ) reject = true;
154  }
155 
156  // can not have any of the forbidden elements
157  size_t nforbidden = forbidden.size();
158  if ( nforbidden > 0 ) {
159  for (size_t jf = 0; jf < nforbidden; ++jf) {
160  if ( str.find(forbidden[jf]) != std::string::npos ) {
161  reject = true;
162  break; // found at least one case, so we can reject
163  }
164  }
165  }
166 
167  return reject;
168 }
void genie::geometry::GeomVolSelectorI::SetCurrentRay ( const TLorentzVector &  x4,
const TLorentzVector &  p4 
)
inlineinherited

configure for individual neutrino ray

Definition at line 55 of file GeomVolSelectorI.h.

References genie::geometry::GeomVolSelectorI::fP4, genie::geometry::GeomVolSelectorI::fX4, and make_associated_cosmic_defs::p4.

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

56  { fX4 = x4; fP4 = p4; }
TLorentzVector fP4
current neutrino ray&#39;s momentum (global)
TLorentzVector fX4
current neutrino ray&#39;s start position (global)
void GeomVolSelectorBasic::SetMaterialSelection ( string  matstr)

Definition at line 55 of file GeomVolSelectorBasic.cxx.

References fForbiddenMat, fRequiredMat, and ParseSelection().

56 {
58 }
void ParseSelection(const string &str, vector< string > &required, vector< string > &forbidden)
void GeomVolSelectorBasic::SetMediumSelection ( string  medstr)

Definition at line 51 of file GeomVolSelectorBasic.cxx.

References fForbiddenMed, fRequiredMed, and ParseSelection().

52 {
54 }
void ParseSelection(const string &str, vector< string > &required, vector< string > &forbidden)
void genie::geometry::GeomVolSelectorI::SetNeedPath ( )
inlineinherited

Definition at line 64 of file GeomVolSelectorI.h.

References genie::geometry::GeomVolSelectorI::fNeedPath.

Referenced by SetPathSelection().

64 { fNeedPath = true; } /// allow toggle *on* only
bool fNeedPath
selector needs PathSegment "path" string
void GeomVolSelectorBasic::SetPathSelection ( string  pathstr)

Definition at line 59 of file GeomVolSelectorBasic.cxx.

References fForbiddenPath, fRequiredPath, LOG, ParseSelection(), pFATAL, and genie::geometry::GeomVolSelectorI::SetNeedPath().

60 {
62  if ( fRequiredPath.size() > 0 || fForbiddenPath.size() > 0 ) {
63 #ifdef PATHSEG_KEEP_PATH
64  SetNeedPath();
65 #else
66  LOG("GeomVolSelectorBasic", pFATAL)
67  << "PathSegment is not defined to hold fPathString -- selectors can not cut on it";
68 #endif
69  }
70 }
#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
void ParseSelection(const string &str, vector< string > &required, vector< string > &forbidden)
void genie::geometry::GeomVolSelectorI::SetRemoveEntries ( bool  rmset)
inlineinherited

Definition at line 61 of file GeomVolSelectorI.h.

References genie::geometry::GeomVolSelectorI::fRemoveEntries.

Referenced by CreateFidSelection(), and CreateRockBoxSelection().

61 { fRemoveEntries = rmset; }
bool fRemoveEntries
whether selector should remove entries or set hi=lo
void genie::geometry::GeomVolSelectorI::SetSI2Local ( double  scale)
inlineinherited

set scale factor for SI to "raydist" units of PathSegmentList

Definition at line 59 of file GeomVolSelectorI.h.

References genie::geometry::GeomVolSelectorI::fScale, and scale.

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

59 { fScale = scale; }
Double_t scale
Definition: plot.C:25
double fScale
SI->raydist scale factor.
void GeomVolSelectorBasic::SetVolumeSelection ( string  volstr)

Selections are string based, elements are specified as a list of items separated by comma, semicolon or colons. Elements that start with "-" are rejections; elements that start with "+" (or nothing) are required, e.g. "+N276B,-air0"

Definition at line 47 of file GeomVolSelectorBasic.cxx.

References fForbiddenVol, fRequiredVol, and ParseSelection().

48 {
50 }
void ParseSelection(const string &str, vector< string > &required, vector< string > &forbidden)
void GeomVolSelectorBasic::TrimSegment ( PathSegment segment) const
virtual

This is the method every derived version must implement To reject a segment outright: segment.fStepRangeSet.clear()

Implements genie::geometry::GeomVolSelectorI.

Reimplemented in genie::geometry::GeomVolSelectorFiducial, and genie::geometry::GeomVolSelectorRockBox.

Definition at line 81 of file GeomVolSelectorBasic.cxx.

References fForbiddenMat, fForbiddenMed, fForbiddenPath, fForbiddenVol, genie::geometry::PathSegment::fMaterial, genie::geometry::PathSegment::fMedium, genie::geometry::PathSegment::fPathString, fRequiredMat, fRequiredMed, fRequiredPath, fRequiredVol, genie::geometry::PathSegment::fStepRangeSet, genie::geometry::PathSegment::fVolume, RejectString(), and string.

Referenced by genie::geometry::GeomVolSelectorFiducial::TrimSegment().

82 {
83  bool reject = false;
84 
85  // not splitting PathSegment into 2 or more PathSegment elements
86  // so either
87  // - keep "as is"
88  // - adjust the low/high endpoints
89  // - not copy to output list (
90  // be careful about steps outside all the geometry that might not
91  // have an associated volume/media/material
92 
93 
94  if ( ! reject ) {
95  std::string volname = ( ps.fVolume) ? ps.fVolume->GetName() : "no-volume";
96  reject = RejectString(volname,fRequiredVol,fForbiddenVol);
97  }
98 
99  if ( ! reject ) {
100  std::string medname = ( ps.fMedium) ? ps.fMedium->GetName() : "no-medium";
101  reject = RejectString(medname,fRequiredMed,fForbiddenMed);
102  }
103 
104  if ( ! reject ) {
105  std::string matname = ( ps.fMaterial) ? ps.fMaterial->GetName() : "no-material";
106  reject = RejectString(matname,fRequiredMat,fForbiddenMat);
107  }
108 
109 #ifdef PATHSEG_KEEP_PATH
110  if ( ! reject ) {
111  reject = RejectString(ps.fPathString,fRequiredPath,fForbiddenPath);
112  }
113 #endif
114 
115  if ( reject ) ps.fStepRangeSet.clear();
116 
117 }
bool RejectString(const string &str, const vector< string > &required, const vector< string > &forbidden) const
enum BeamMode string

Member Data Documentation

vector<string> genie::geometry::GeomVolSelectorBasic::fForbiddenMat
protected

Definition at line 74 of file GeomVolSelectorBasic.h.

Referenced by SetMaterialSelection(), and TrimSegment().

vector<string> genie::geometry::GeomVolSelectorBasic::fForbiddenMed
protected

Definition at line 73 of file GeomVolSelectorBasic.h.

Referenced by SetMediumSelection(), and TrimSegment().

vector<string> genie::geometry::GeomVolSelectorBasic::fForbiddenPath
protected

Definition at line 75 of file GeomVolSelectorBasic.h.

Referenced by SetPathSelection(), and TrimSegment().

vector<string> genie::geometry::GeomVolSelectorBasic::fForbiddenVol
protected

Definition at line 72 of file GeomVolSelectorBasic.h.

Referenced by SetVolumeSelection(), and TrimSegment().

std::string genie::geometry::GeomVolSelectorI::fName
protectedinherited
bool genie::geometry::GeomVolSelectorI::fNeedPath
protectedinherited
TLorentzVector genie::geometry::GeomVolSelectorI::fP4
protectedinherited

current neutrino ray's momentum (global)

Definition at line 75 of file GeomVolSelectorI.h.

Referenced by genie::geometry::GeomVolSelectorRockBox::MakeRockBox(), and genie::geometry::GeomVolSelectorI::SetCurrentRay().

bool genie::geometry::GeomVolSelectorI::fRemoveEntries
protectedinherited
vector<string> genie::geometry::GeomVolSelectorBasic::fRequiredMat
protected

Definition at line 68 of file GeomVolSelectorBasic.h.

Referenced by SetMaterialSelection(), and TrimSegment().

vector<string> genie::geometry::GeomVolSelectorBasic::fRequiredMed
protected

Definition at line 67 of file GeomVolSelectorBasic.h.

Referenced by SetMediumSelection(), and TrimSegment().

vector<string> genie::geometry::GeomVolSelectorBasic::fRequiredPath
protected

Definition at line 69 of file GeomVolSelectorBasic.h.

Referenced by SetPathSelection(), and TrimSegment().

vector<string> genie::geometry::GeomVolSelectorBasic::fRequiredVol
protected

Definition at line 66 of file GeomVolSelectorBasic.h.

Referenced by SetVolumeSelection(), and TrimSegment().

double genie::geometry::GeomVolSelectorI::fScale
protectedinherited

SI->raydist scale factor.

Definition at line 76 of file GeomVolSelectorI.h.

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

TLorentzVector genie::geometry::GeomVolSelectorI::fX4
protectedinherited

current neutrino ray's start position (global)

Definition at line 74 of file GeomVolSelectorI.h.

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


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