GENIEGenerator
Loading...
Searching...
No Matches
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 <GeomVolSelectorBasic.h>

Inheritance diagram for genie::geometry::GeomVolSelectorBasic:
[legend]
Collaboration diagram for genie::geometry::GeomVolSelectorBasic:
[legend]

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
Public Member Functions inherited from genie::geometry::GeomVolSelectorI
virtual ~GeomVolSelectorI ()
virtual PathSegmentListGenerateTrimmedList (const PathSegmentList *untrimmed) const
void SetCurrentRay (const TLorentzVector &x4, const TLorentzVector &p4)
 configure for individual neutrino ray
void SetSI2Local (double scale)
 set scale factor for SI to "raydist" units of PathSegmentList
void SetRemoveEntries (bool rmset)
bool GetRemoveEntries ()
void SetNeedPath ()
bool GetNeedPath () const
 allow toggle on only
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 Member Functions inherited from genie::geometry::GeomVolSelectorI
 GeomVolSelectorI ()
 GeomVolSelectorI (std::string name)

Protected Attributes

vector< string > fRequiredVol
vector< string > fRequiredMed
vector< string > fRequiredMat
vector< string > fRequiredPath
vector< string > fForbiddenVol
vector< string > fForbiddenMed
vector< string > fForbiddenMat
vector< string > fForbiddenPath
Protected Attributes inherited from genie::geometry::GeomVolSelectorI
TLorentzVector fX4
 current neutrino ray's start position (global)
TLorentzVector fP4
 current neutrino ray's momentum (global)
double fScale
 SI->raydist scale factor.
bool fRemoveEntries
 whether selector should remove entries or set hi=lo
bool fNeedPath
 selector needs PathSegment "path" string
std::string fName
 volume selector name

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
Created:\n December 3, 2008
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 35 of file GeomVolSelectorBasic.h.

Constructor & Destructor Documentation

◆ GeomVolSelectorBasic()

GeomVolSelectorBasic::GeomVolSelectorBasic ( )

◆ ~GeomVolSelectorBasic()

GeomVolSelectorBasic::~GeomVolSelectorBasic ( )
virtual

Definition at line 30 of file GeomVolSelectorBasic.cxx.

31{
32
33}

Member Function Documentation

◆ BeginPSList()

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 63 of file GeomVolSelectorBasic.cxx.

64{ ; }

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

◆ EndPSList()

void GeomVolSelectorBasic::EndPSList ( ) const
virtual

◆ ParseSelection()

void GeomVolSelectorBasic::ParseSelection ( const string & str,
vector< string > & required,
vector< string > & forbidden )
protected

Definition at line 109 of file GeomVolSelectorBasic.cxx.

112{
113 required.clear();
114 forbidden.clear();
115 vector<string> pieces = genie::utils::str::Split(strall,":;,");
116 size_t n = pieces.size();
117 for ( size_t i = 0; i < n; ++i ) {
118 string& strone = pieces[i];
119 if ( strone == "" ) continue; // reject null strings
120 if ( strone.find("-") == 0 ) forbidden.push_back(strone.substr(1,std::string::npos));
121 else if ( strone.find("+") == 0 ) required.push_back(strone.substr(1,std::string::npos));
122 else required.push_back(strone);
123 }
124}
vector< string > Split(string input, string delim)

References genie::utils::str::Split().

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

◆ RejectString()

bool GeomVolSelectorBasic::RejectString ( const string & str,
const vector< string > & required,
const vector< string > & forbidden ) const
protected

Definition at line 126 of file GeomVolSelectorBasic.cxx.

129{
130 bool reject = false;
131
132 // must have at least one of the required elements (if there are any)
133 size_t nrequired = required.size();
134 if ( nrequired > 0 ) {
135 bool found = false;
136 for (size_t jr = 0; jr < nrequired; ++jr) {
137 if ( str.find(required[jr]) != std::string::npos ) {
138 found = true;
139 break; // found at least one case, so we're good
140 }
141 }
142 if ( ! found ) reject = true;
143 }
144
145 // can not have any of the forbidden elements
146 size_t nforbidden = forbidden.size();
147 if ( nforbidden > 0 ) {
148 for (size_t jf = 0; jf < nforbidden; ++jf) {
149 if ( str.find(forbidden[jf]) != std::string::npos ) {
150 reject = true;
151 break; // found at least one case, so we can reject
152 }
153 }
154 }
155
156 return reject;
157}

Referenced by TrimSegment().

◆ SetMaterialSelection()

void GeomVolSelectorBasic::SetMaterialSelection ( string matstr)

Definition at line 44 of file GeomVolSelectorBasic.cxx.

45{
47}
void ParseSelection(const string &str, vector< string > &required, vector< string > &forbidden)

References fForbiddenMat, fRequiredMat, and ParseSelection().

◆ SetMediumSelection()

void GeomVolSelectorBasic::SetMediumSelection ( string medstr)

◆ SetPathSelection()

void GeomVolSelectorBasic::SetPathSelection ( string pathstr)

Definition at line 48 of file GeomVolSelectorBasic.cxx.

49{
51 if ( fRequiredPath.size() > 0 || fForbiddenPath.size() > 0 ) {
52#ifdef PATHSEG_KEEP_PATH
54#else
55 LOG("GeomVolSelectorBasic", pFATAL)
56 << "PathSegment is not defined to hold fPathString -- selectors can not cut on it";
57#endif
58 }
59}
#define pFATAL
Definition Messenger.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96

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

◆ SetVolumeSelection()

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 36 of file GeomVolSelectorBasic.cxx.

References fForbiddenVol, fRequiredVol, and ParseSelection().

◆ TrimSegment()

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 70 of file GeomVolSelectorBasic.cxx.

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

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, and RejectString().

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

Member Data Documentation

◆ fForbiddenMat

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

Definition at line 73 of file GeomVolSelectorBasic.h.

Referenced by SetMaterialSelection(), and TrimSegment().

◆ fForbiddenMed

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

Definition at line 72 of file GeomVolSelectorBasic.h.

Referenced by SetMediumSelection(), and TrimSegment().

◆ fForbiddenPath

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

Definition at line 74 of file GeomVolSelectorBasic.h.

Referenced by SetPathSelection(), and TrimSegment().

◆ fForbiddenVol

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

Definition at line 71 of file GeomVolSelectorBasic.h.

Referenced by SetVolumeSelection(), and TrimSegment().

◆ fRequiredMat

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

Definition at line 67 of file GeomVolSelectorBasic.h.

Referenced by SetMaterialSelection(), and TrimSegment().

◆ fRequiredMed

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

Definition at line 66 of file GeomVolSelectorBasic.h.

Referenced by SetMediumSelection(), and TrimSegment().

◆ fRequiredPath

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

Definition at line 68 of file GeomVolSelectorBasic.h.

Referenced by SetPathSelection(), and TrimSegment().

◆ fRequiredVol

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

Definition at line 65 of file GeomVolSelectorBasic.h.

Referenced by SetVolumeSelection(), and TrimSegment().


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