Geant4 11.1.1
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 39 of file G4TrajectoryParticleFilter.hh.

Constructor & Destructor Documentation

◆ G4TrajectoryParticleFilter()

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

◆ ~G4TrajectoryParticleFilter()

G4TrajectoryParticleFilter::~G4TrajectoryParticleFilter ( )
virtual

Definition at line 38 of file G4TrajectoryParticleFilter.cc.

38{}

Member Function Documentation

◆ Add()

void G4TrajectoryParticleFilter::Add ( const G4String particle)

Definition at line 57 of file G4TrajectoryParticleFilter.cc.

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

◆ Clear()

void G4TrajectoryParticleFilter::Clear ( )
virtual

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 75 of file G4TrajectoryParticleFilter.cc.

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

◆ Evaluate()

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

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 41 of file G4TrajectoryParticleFilter.cc.

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

◆ Print()

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

Implements G4SmartFilter< G4VTrajectory >.

Definition at line 63 of file G4TrajectoryParticleFilter.cc.

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

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