#include <G4SDParticleFilter.hh>
Inheritance diagram for G4SDParticleFilter:
Public Member Functions | |
G4SDParticleFilter (G4String name) | |
G4SDParticleFilter (G4String name, const G4String &particleName) | |
G4SDParticleFilter (G4String name, const std::vector< G4String > &particleNames) | |
G4SDParticleFilter (G4String name, const std::vector< G4ParticleDefinition * > &particleDef) | |
virtual | ~G4SDParticleFilter () |
virtual G4bool | Accept (const G4Step *) const |
void | add (const G4String &particleName) |
void | addIon (G4int Z, G4int A) |
void | show () |
Definition at line 53 of file G4SDParticleFilter.hh.
G4SDParticleFilter::G4SDParticleFilter | ( | G4String | name | ) |
Definition at line 46 of file G4SDParticleFilter.cc.
00047 :G4VSDFilter(name) 00048 { 00049 thePdef.clear(); 00050 theIonZ.clear(); 00051 theIonA.clear(); 00052 }
Definition at line 54 of file G4SDParticleFilter.cc.
References FatalException, G4ParticleTable::FindParticle(), G4Exception(), and G4ParticleTable::GetParticleTable().
00056 :G4VSDFilter(name) 00057 { 00058 thePdef.clear(); 00059 G4ParticleDefinition* pd = G4ParticleTable::GetParticleTable()->FindParticle(particleName); 00060 if(!pd) 00061 { 00062 G4String msg = "Particle <"; 00063 msg += particleName; 00064 msg += "> not found."; 00065 G4Exception("G4SDParticleFilter::G4SDParticleFilter", 00066 "DetPS0101",FatalException,msg); 00067 } 00068 thePdef.push_back(pd); 00069 theIonZ.clear(); 00070 theIonA.clear(); 00071 }
G4SDParticleFilter::G4SDParticleFilter | ( | G4String | name, | |
const std::vector< G4String > & | particleNames | |||
) |
Definition at line 73 of file G4SDParticleFilter.cc.
References FatalException, G4ParticleTable::FindParticle(), G4Exception(), and G4ParticleTable::GetParticleTable().
00075 :G4VSDFilter(name) 00076 { 00077 thePdef.clear(); 00078 for ( size_t i = 0; i < particleNames.size(); i++){ 00079 G4ParticleDefinition* pd = G4ParticleTable::GetParticleTable()->FindParticle(particleNames[i]); 00080 if(!pd) 00081 { 00082 G4String msg = "Particle <"; 00083 msg += particleNames[i]; 00084 msg += "> not found."; 00085 G4Exception("G4SDParticleFilter::G4SDParticleFilter", 00086 "DetPS0102",FatalException,msg); 00087 } 00088 thePdef.push_back(pd); 00089 theIonZ.clear(); 00090 theIonA.clear(); 00091 } 00092 }
G4SDParticleFilter::G4SDParticleFilter | ( | G4String | name, | |
const std::vector< G4ParticleDefinition * > & | particleDef | |||
) |
Definition at line 94 of file G4SDParticleFilter.cc.
References FatalException, and G4Exception().
00096 :G4VSDFilter(name), thePdef(particleDef) 00097 { 00098 for ( size_t i = 0; i < particleDef.size(); i++){ 00099 if(!particleDef[i]) G4Exception("G4SDParticleFilter::G4SDParticleFilter", 00100 "DetPS0103",FatalException, 00101 "NULL pointer is found in the given particleDef vector."); 00102 } 00103 theIonZ.clear(); 00104 theIonA.clear(); 00105 }
G4SDParticleFilter::~G4SDParticleFilter | ( | ) | [virtual] |
Implements G4VSDFilter.
Definition at line 114 of file G4SDParticleFilter.cc.
References FALSE, G4ParticleDefinition::GetAtomicMass(), G4ParticleDefinition::GetAtomicNumber(), G4Track::GetDefinition(), G4Step::GetTrack(), and TRUE.
Referenced by G4SDParticleWithEnergyFilter::Accept().
00115 { 00116 00117 for ( size_t i = 0; i < thePdef.size(); i++){ 00118 if ( thePdef[i] == aStep->GetTrack()->GetDefinition() ) return TRUE; 00119 } 00120 00121 // Ions by Z,A 00122 for ( size_t i = 0; i < theIonZ.size(); i++){ 00123 if ( theIonZ[i] == aStep->GetTrack()->GetDefinition()->GetAtomicNumber() 00124 && theIonA[i] == aStep->GetTrack()->GetDefinition()->GetAtomicMass() ){ 00125 return TRUE; 00126 } 00127 } 00128 00129 return FALSE; 00130 }
void G4SDParticleFilter::add | ( | const G4String & | particleName | ) |
Definition at line 132 of file G4SDParticleFilter.cc.
References FatalException, G4ParticleTable::FindParticle(), G4Exception(), and G4ParticleTable::GetParticleTable().
Referenced by G4SDParticleWithEnergyFilter::add().
00133 { 00134 G4ParticleDefinition* pd = 00135 G4ParticleTable::GetParticleTable()->FindParticle(particleName); 00136 if(!pd) 00137 { 00138 G4String msg = "Particle <"; 00139 msg += particleName; 00140 msg += "> not found."; 00141 G4Exception("G4SDParticleFilter::add()", 00142 "DetPS0104",FatalException,msg); 00143 } 00144 for ( size_t i = 0; i < thePdef.size(); i++){ 00145 if ( thePdef[i] == pd ) return; 00146 } 00147 thePdef.push_back(pd); 00148 }
Definition at line 150 of file G4SDParticleFilter.cc.
References G4cout, and G4endl.
00150 { 00151 for ( size_t i = 0; i < theIonZ.size(); i++){ 00152 if ( theIonZ[i] == Z && theIonA[i] == A ){ 00153 G4cout << "G4SDParticleFilter:: Ion has been already registered."<<G4endl; 00154 return; 00155 } 00156 } 00157 theIonZ.push_back(Z); 00158 theIonA.push_back(A); 00159 }
void G4SDParticleFilter::show | ( | ) |
Definition at line 161 of file G4SDParticleFilter.cc.
References G4cout, and G4endl.
Referenced by G4SDParticleWithEnergyFilter::show().
00161 { 00162 G4cout << "----G4SDParticleFileter particle list------"<<G4endl; 00163 for ( size_t i = 0; i < thePdef.size(); i++){ 00164 G4cout << thePdef[i]->GetParticleName() << G4endl; 00165 } 00166 for ( size_t i = 0; i < theIonZ.size(); i++){ 00167 G4cout << " Ion PrtclDef (" << theIonZ[i]<<","<<theIonA[i]<<")" 00168 << G4endl; 00169 } 00170 G4cout << "-------------------------------------------"<<G4endl; 00171 }