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

#include <G4TrajectoryParticleFilter.hh>

+ Inheritance diagram for G4TrajectoryParticleFilter:

Public Member Functions

 G4TrajectoryParticleFilter (const G4String &name="Unspecified")
 
virtual ~G4TrajectoryParticleFilter ()
 
virtual bool Evaluate (const G4VTrajectory &) const
 
virtual void Print (std::ostream &ostr) const
 
virtual void Clear ()
 
void Add (const G4String &particle)
 
- 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 G4TrajectoryParticleFilter.hh.

Constructor & Destructor Documentation

◆ G4TrajectoryParticleFilter()

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

◆ ~G4TrajectoryParticleFilter()

G4TrajectoryParticleFilter::~G4TrajectoryParticleFilter ( )
virtual

Definition at line 39 of file G4TrajectoryParticleFilter.cc.

39{}

Member Function Documentation

◆ Add()

void G4TrajectoryParticleFilter::Add ( const G4String particle)

Definition at line 58 of file G4TrajectoryParticleFilter.cc.

59{
60 fParticles.push_back(particle);
61}

◆ Clear()

void G4TrajectoryParticleFilter::Clear ( )
virtual

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 76 of file G4TrajectoryParticleFilter.cc.

77{
78 // Clear particle type vector
79 fParticles.clear();
80}

◆ Evaluate()

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

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 42 of file G4TrajectoryParticleFilter.cc.

43{
44 G4String particle = traj.GetParticleName();
45
46 if (GetVerbose()) G4cout<<"G4TrajectoryParticleFilter processing trajectory with particle type: "<<particle<<G4endl;
47
48 std::vector<G4String>::const_iterator iter = std::find(fParticles.begin(), fParticles.end(), particle);
49
50 // Fail if particle type not found in particle list
51 if (iter == fParticles.end()) return false;
52
53 return true;
54}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
virtual G4String GetParticleName() const =0

◆ Print()

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

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 64 of file G4TrajectoryParticleFilter.cc.

65{
66 ostr<<"Particle types registered: "<<G4endl;
67 std::vector<G4String>::const_iterator iter = fParticles.begin();
68
69 while (iter != fParticles.end()) {
70 ostr<<*iter<<G4endl;
71 iter++;
72 }
73}

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