GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 <GeomVolSelectorBasic.h>

Inheritance diagram for genie::geometry::GeomVolSelectorBasic:
Inheritance graph
[legend]
Collaboration diagram for genie::geometry::GeomVolSelectorBasic:
Collaboration graph
[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 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 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) 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
Created:
December 3, 2008
License:
Copyright (c) 2003-2024, 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 ( )

Definition at line 23 of file GeomVolSelectorBasic.cxx.

24  : GeomVolSelectorI("Basic")
25 {
26 
27 }
GeomVolSelectorBasic::~GeomVolSelectorBasic ( )
virtual

Definition at line 30 of file GeomVolSelectorBasic.cxx.

31 {
32 
33 }

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

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

64 { ; }
void GeomVolSelectorBasic::EndPSList ( ) const
virtual
void GeomVolSelectorBasic::ParseSelection ( const string &  str,
vector< string > &  required,
vector< string > &  forbidden 
)
protected

Definition at line 109 of file GeomVolSelectorBasic.cxx.

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

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

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)
Definition: StringUtils.cxx:36
bool GeomVolSelectorBasic::RejectString ( const string &  str,
const vector< string > &  required,
const vector< string > &  forbidden 
) const
protected

Definition at line 126 of file GeomVolSelectorBasic.cxx.

Referenced by TrimSegment().

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 }
void GeomVolSelectorBasic::SetMaterialSelection ( string  matstr)

Definition at line 44 of file GeomVolSelectorBasic.cxx.

References fForbiddenMat, fRequiredMat, and ParseSelection().

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

Definition at line 40 of file GeomVolSelectorBasic.cxx.

References fForbiddenMed, fRequiredMed, and ParseSelection().

41 {
43 }
void ParseSelection(const string &str, vector< string > &required, vector< string > &forbidden)
void GeomVolSelectorBasic::SetPathSelection ( string  pathstr)

Definition at line 48 of file GeomVolSelectorBasic.cxx.

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

49 {
51  if ( fRequiredPath.size() > 0 || fForbiddenPath.size() > 0 ) {
52 #ifdef PATHSEG_KEEP_PATH
53  SetNeedPath();
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
void ParseSelection(const string &str, vector< string > &required, vector< string > &forbidden)
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().

37 {
39 }
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 70 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, and RejectString().

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

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 }
static constexpr double ps
Definition: Units.h:99
bool RejectString(const string &str, const vector< string > &required, const vector< string > &forbidden) const

Member Data Documentation

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

Definition at line 73 of file GeomVolSelectorBasic.h.

Referenced by SetMaterialSelection(), and TrimSegment().

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

Definition at line 72 of file GeomVolSelectorBasic.h.

Referenced by SetMediumSelection(), and TrimSegment().

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

Definition at line 74 of file GeomVolSelectorBasic.h.

Referenced by SetPathSelection(), and TrimSegment().

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

Definition at line 71 of file GeomVolSelectorBasic.h.

Referenced by SetVolumeSelection(), and TrimSegment().

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

Definition at line 67 of file GeomVolSelectorBasic.h.

Referenced by SetMaterialSelection(), and TrimSegment().

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

Definition at line 66 of file GeomVolSelectorBasic.h.

Referenced by SetMediumSelection(), and TrimSegment().

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

Definition at line 68 of file GeomVolSelectorBasic.h.

Referenced by SetPathSelection(), and TrimSegment().

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: