Geant4-11
Public Member Functions | Protected Attributes | Private Attributes
G4SDParticleFilter Class Reference

#include <G4SDParticleFilter.hh>

Inheritance diagram for G4SDParticleFilter:
G4VSDFilter

Public Member Functions

virtual G4bool Accept (const G4Step *) const
 
void add (const G4String &particleName)
 
void addIon (G4int Z, G4int A)
 
 G4SDParticleFilter (G4String name)
 
 G4SDParticleFilter (G4String name, const G4String &particleName)
 
 G4SDParticleFilter (G4String name, const std::vector< G4ParticleDefinition * > &particleDef)
 
 G4SDParticleFilter (G4String name, const std::vector< G4String > &particleNames)
 
G4String GetName () const
 
void show ()
 
virtual ~G4SDParticleFilter ()
 

Protected Attributes

G4String filterName
 

Private Attributes

std::vector< G4inttheIonA
 
std::vector< G4inttheIonZ
 
std::vector< G4ParticleDefinition * > thePdef
 

Detailed Description

Definition at line 52 of file G4SDParticleFilter.hh.

Constructor & Destructor Documentation

◆ G4SDParticleFilter() [1/4]

G4SDParticleFilter::G4SDParticleFilter ( G4String  name)

Definition at line 45 of file G4SDParticleFilter.cc.

47{
48 thePdef.clear();
49 theIonZ.clear();
50 theIonA.clear();
51}
std::vector< G4int > theIonZ
std::vector< G4int > theIonA
std::vector< G4ParticleDefinition * > thePdef
G4VSDFilter(G4String name)
Definition: G4VSDFilter.cc:32
const char * name(G4int ptype)

References theIonA, theIonZ, and thePdef.

◆ G4SDParticleFilter() [2/4]

G4SDParticleFilter::G4SDParticleFilter ( G4String  name,
const G4String particleName 
)

Definition at line 53 of file G4SDParticleFilter.cc.

56{
57 thePdef.clear();
60 if(!pd)
61 {
62 G4String msg = "Particle <";
63 msg += particleName;
64 msg += "> not found.";
65 G4Exception("G4SDParticleFilter::G4SDParticleFilter", "DetPS0101",
66 FatalException, msg);
67 }
68 thePdef.push_back(pd);
69 theIonZ.clear();
70 theIonA.clear();
71}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()

References FatalException, G4ParticleTable::FindParticle(), G4Exception(), G4ParticleTable::GetParticleTable(), theIonA, theIonZ, and thePdef.

◆ G4SDParticleFilter() [3/4]

G4SDParticleFilter::G4SDParticleFilter ( G4String  name,
const std::vector< G4String > &  particleNames 
)

Definition at line 73 of file G4SDParticleFilter.cc.

76{
77 thePdef.clear();
78 for(size_t i = 0; i < particleNames.size(); i++)
79 {
82 if(!pd)
83 {
84 G4String msg = "Particle <";
85 msg += particleNames[i];
86 msg += "> not found.";
87 G4Exception("G4SDParticleFilter::G4SDParticleFilter", "DetPS0102",
88 FatalException, msg);
89 }
90 thePdef.push_back(pd);
91 theIonZ.clear();
92 theIonA.clear();
93 }
94}

References FatalException, G4ParticleTable::FindParticle(), G4Exception(), G4ParticleTable::GetParticleTable(), theIonA, theIonZ, and thePdef.

◆ G4SDParticleFilter() [4/4]

G4SDParticleFilter::G4SDParticleFilter ( G4String  name,
const std::vector< G4ParticleDefinition * > &  particleDef 
)

Definition at line 96 of file G4SDParticleFilter.cc.

99 , thePdef(particleDef)
100{
101 for(size_t i = 0; i < particleDef.size(); i++)
102 {
103 if(!particleDef[i])
104 G4Exception("G4SDParticleFilter::G4SDParticleFilter", "DetPS0103",
106 "NULL pointer is found in the given particleDef vector.");
107 }
108 theIonZ.clear();
109 theIonA.clear();
110}

References FatalException, G4Exception(), theIonA, and theIonZ.

◆ ~G4SDParticleFilter()

G4SDParticleFilter::~G4SDParticleFilter ( )
virtual

Definition at line 112 of file G4SDParticleFilter.cc.

113{
114 thePdef.clear();
115 theIonZ.clear();
116 theIonA.clear();
117}

References theIonA, theIonZ, and thePdef.

Member Function Documentation

◆ Accept()

G4bool G4SDParticleFilter::Accept ( const G4Step aStep) const
virtual

Implements G4VSDFilter.

Definition at line 119 of file G4SDParticleFilter.cc.

120{
121 for(size_t i = 0; i < thePdef.size(); i++)
122 {
123 if(thePdef[i] == aStep->GetTrack()->GetDefinition())
124 return TRUE;
125 }
126
127 // Ions by Z,A
128 for(size_t i = 0; i < theIonZ.size(); i++)
129 {
130 if(theIonZ[i] == aStep->GetTrack()->GetDefinition()->GetAtomicNumber() &&
131 theIonA[i] == aStep->GetTrack()->GetDefinition()->GetAtomicMass())
132 {
133 return TRUE;
134 }
135 }
136
137 return FALSE;
138}
#define TRUE
Definition: Globals.hh:27
#define FALSE
Definition: Globals.hh:23
G4int GetAtomicNumber() const
G4int GetAtomicMass() const
G4Track * GetTrack() const
G4ParticleDefinition * GetDefinition() const

References FALSE, G4ParticleDefinition::GetAtomicMass(), G4ParticleDefinition::GetAtomicNumber(), G4Track::GetDefinition(), G4Step::GetTrack(), theIonA, theIonZ, thePdef, and TRUE.

Referenced by G4SDParticleWithEnergyFilter::Accept().

◆ add()

void G4SDParticleFilter::add ( const G4String particleName)

Definition at line 140 of file G4SDParticleFilter.cc.

141{
144 if(!pd)
145 {
146 G4String msg = "Particle <";
147 msg += particleName;
148 msg += "> not found.";
149 G4Exception("G4SDParticleFilter::add()", "DetPS0104", FatalException, msg);
150 }
151 for(size_t i = 0; i < thePdef.size(); i++)
152 {
153 if(thePdef[i] == pd)
154 return;
155 }
156 thePdef.push_back(pd);
157}

References FatalException, G4ParticleTable::FindParticle(), G4Exception(), G4ParticleTable::GetParticleTable(), and thePdef.

Referenced by G4SDParticleWithEnergyFilter::add().

◆ addIon()

void G4SDParticleFilter::addIon ( G4int  Z,
G4int  A 
)

Definition at line 159 of file G4SDParticleFilter.cc.

160{
161 for(size_t i = 0; i < theIonZ.size(); i++)
162 {
163 if(theIonZ[i] == Z && theIonA[i] == A)
164 {
165 G4cout << "G4SDParticleFilter:: Ion has been already registered."
166 << G4endl;
167 return;
168 }
169 }
170 theIonZ.push_back(Z);
171 theIonA.push_back(A);
172}
const G4int Z[17]
const G4double A[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

References A, G4cout, G4endl, theIonA, theIonZ, and Z.

◆ GetName()

G4String G4VSDFilter::GetName ( ) const
inlineinherited

Definition at line 55 of file G4VSDFilter.hh.

55{ return filterName; }
G4String filterName
Definition: G4VSDFilter.hh:52

References G4VSDFilter::filterName.

Referenced by G4VScoringMesh::List(), G4VScoringMesh::SetFilter(), and G4SDKineticEnergyFilter::show().

◆ show()

void G4SDParticleFilter::show ( )

Definition at line 174 of file G4SDParticleFilter.cc.

175{
176 G4cout << "----G4SDParticleFileter particle list------" << G4endl;
177 for(size_t i = 0; i < thePdef.size(); i++)
178 {
179 G4cout << thePdef[i]->GetParticleName() << G4endl;
180 }
181 for(size_t i = 0; i < theIonZ.size(); i++)
182 {
183 G4cout << " Ion PrtclDef (" << theIonZ[i] << "," << theIonA[i] << ")"
184 << G4endl;
185 }
186 G4cout << "-------------------------------------------" << G4endl;
187}

References G4cout, G4endl, theIonA, theIonZ, and thePdef.

Referenced by G4SDParticleWithEnergyFilter::show().

Field Documentation

◆ filterName

G4String G4VSDFilter::filterName
protectedinherited

Definition at line 52 of file G4VSDFilter.hh.

Referenced by G4VSDFilter::GetName().

◆ theIonA

std::vector<G4int> G4SDParticleFilter::theIonA
private

Definition at line 77 of file G4SDParticleFilter.hh.

Referenced by Accept(), addIon(), G4SDParticleFilter(), show(), and ~G4SDParticleFilter().

◆ theIonZ

std::vector<G4int> G4SDParticleFilter::theIonZ
private

Definition at line 76 of file G4SDParticleFilter.hh.

Referenced by Accept(), addIon(), G4SDParticleFilter(), show(), and ~G4SDParticleFilter().

◆ thePdef

std::vector<G4ParticleDefinition*> G4SDParticleFilter::thePdef
private

Definition at line 75 of file G4SDParticleFilter.hh.

Referenced by Accept(), add(), G4SDParticleFilter(), show(), and ~G4SDParticleFilter().


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