Geant4 9.6.0
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 40 of file G4TrajectoryOriginVolumeFilter.hh.

Constructor & Destructor Documentation

◆ G4TrajectoryOriginVolumeFilter()

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

◆ ~G4TrajectoryOriginVolumeFilter()

G4TrajectoryOriginVolumeFilter::~G4TrajectoryOriginVolumeFilter ( )
virtual

Definition at line 41 of file G4TrajectoryOriginVolumeFilter.cc.

41{}

Member Function Documentation

◆ Add()

void G4TrajectoryOriginVolumeFilter::Add ( const G4String volume)

Definition at line 81 of file G4TrajectoryOriginVolumeFilter.cc.

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

◆ Clear()

void G4TrajectoryOriginVolumeFilter::Clear ( )
virtual

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 99 of file G4TrajectoryOriginVolumeFilter.cc.

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

◆ Evaluate()

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

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 44 of file G4TrajectoryOriginVolumeFilter.cc.

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

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

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