Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TrajectoryOriginVolumeFilter Class Reference

#include <G4TrajectoryOriginVolumeFilter.hh>

+ Inheritance diagram for G4TrajectoryOriginVolumeFilter:

Public Member Functions

 G4TrajectoryOriginVolumeFilter (const G4String &name="Unspecified")
 
virtual ~G4TrajectoryOriginVolumeFilter ()
 
virtual bool Evaluate (const G4VTrajectory &) const
 
virtual void Print (std::ostream &ostr) const
 
virtual void Clear ()
 
void Add (const G4String &volume)
 
- Public Member Functions inherited from G4SmartFilter< G4VTrajectory >
 G4SmartFilter (const G4String &name)
 
virtual ~G4SmartFilter ()
 
virtual G4bool Evaluate (const G4VTrajectory &) const=0
 
virtual void Print (std::ostream &ostr) const=0
 
virtual void Clear ()=0
 
G4bool Accept (const G4VTrajectory &) const
 
virtual void PrintAll (std::ostream &ostr) const
 
virtual void Reset ()
 
void SetActive (const G4bool &)
 
G4bool GetActive () const
 
void SetInvert (const G4bool &)
 
G4bool GetInvert () const
 
void SetVerbose (const G4bool &)
 
G4bool GetVerbose () const
 
- Public Member Functions inherited from G4VFilter< T >
 G4VFilter (const G4String &name)
 
virtual ~G4VFilter ()
 
virtual G4bool Accept (const T &) const =0
 
virtual void PrintAll (std::ostream &ostr) const =0
 
virtual void Reset ()=0
 
G4String Name () const
 
G4String GetName () const
 

Additional Inherited Members

- Public Types inherited from G4VFilter< T >
typedef T Type
 

Detailed Description

Definition at line 39 of file G4TrajectoryOriginVolumeFilter.hh.

Constructor & Destructor Documentation

◆ G4TrajectoryOriginVolumeFilter()

G4TrajectoryOriginVolumeFilter::G4TrajectoryOriginVolumeFilter ( const G4String name = "Unspecified")

◆ ~G4TrajectoryOriginVolumeFilter()

G4TrajectoryOriginVolumeFilter::~G4TrajectoryOriginVolumeFilter ( )
virtual

Definition at line 40 of file G4TrajectoryOriginVolumeFilter.cc.

40{}

Member Function Documentation

◆ Add()

void G4TrajectoryOriginVolumeFilter::Add ( const G4String volume)

Definition at line 82 of file G4TrajectoryOriginVolumeFilter.cc.

83{
84 fVolumes.push_back(volume);
85}

◆ Clear()

void G4TrajectoryOriginVolumeFilter::Clear ( )
virtual

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 100 of file G4TrajectoryOriginVolumeFilter.cc.

101{
102 // Clear volume vector
103 fVolumes.clear();
104}

◆ Evaluate()

bool G4TrajectoryOriginVolumeFilter::Evaluate ( const G4VTrajectory traj) const
virtual

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 43 of file G4TrajectoryOriginVolumeFilter.cc.

44{
45 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
46 assert (0 != aTrajectoryPoint);
47
48 G4Navigator* navigator =
50
52 (aTrajectoryPoint->GetPosition(), nullptr,false,true);
53
54 // Logical volume
55 G4LogicalVolume* logicalVolume = volume->GetLogicalVolume();
56 assert (0 != logicalVolume);
57
58 // Get volume names
59 G4String logicalName = logicalVolume->GetName();
60 G4String physicalName = volume->GetName();
61
62 if (GetVerbose()) {
63 G4cout<<"G4TrajectoryOriginVolumeFilter processing trajectory with originating volume "<<G4endl;
64 G4cout<<"logical and physical names: "<<logicalName<<" "<<physicalName<<G4endl;
65 }
66 // Search for logical volume name
67 std::vector<G4String>::const_iterator iterLogical = std::find(fVolumes.begin(), fVolumes.end(), logicalName);
68
69 // Keep if logical volume registered
70 if (iterLogical != fVolumes.end()) return true;
71
72 // Repeat for physical volume name
73 std::vector<G4String>::const_iterator iterPhysical = std::find(fVolumes.begin(), fVolumes.end(), physicalName);
74
75 if (iterPhysical != fVolumes.end()) return true;
76
77 // Volume names not registered
78 return false;
79}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
Definition: G4Navigator.cc:132
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
virtual const G4ThreeVector GetPosition() const =0
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0

◆ Print()

void G4TrajectoryOriginVolumeFilter::Print ( std::ostream &  ostr) const
virtual

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 88 of file G4TrajectoryOriginVolumeFilter.cc.

89{
90 ostr<<"Volume names registered: "<<G4endl;
91 std::vector<G4String>::const_iterator iter = fVolumes.begin();
92
93 while (iter != fVolumes.end()) {
94 ostr<<*iter<<G4endl;
95 iter++;
96 }
97}

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