- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/digits_hits/scorer/src/G4SDParticleFilter.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4SDParticleFilter.cc,v 1. 1 2007/07/11 01:31:03 asaimExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4SDParticleFilter.cc,v 1.2 2010/07/23 00:59:58 taso Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // G4VSensitiveDetector … … 49 49 { 50 50 thePdef.clear(); 51 theIonZ.clear(); 52 theIonA.clear(); 51 53 } 52 54 … … 66 68 } 67 69 thePdef.push_back(pd); 70 theIonZ.clear(); 71 theIonA.clear(); 68 72 } 69 73 … … 84 88 } 85 89 thePdef.push_back(pd); 90 theIonZ.clear(); 91 theIonA.clear(); 86 92 } 87 93 } … … 89 95 G4SDParticleFilter::G4SDParticleFilter(G4String name, 90 96 const std::vector<G4ParticleDefinition*>& particleDef) 91 :G4VSDFilter(name), thePdef(particleDef)97 :G4VSDFilter(name), thePdef(particleDef) 92 98 { 93 99 for ( size_t i = 0; i < particleDef.size(); i++){ … … 95 101 "NULL pointer is found in the given particleDef vector."); 96 102 } 103 theIonZ.clear(); 104 theIonA.clear(); 97 105 } 98 106 … … 100 108 { 101 109 thePdef.clear(); 102 } 110 theIonZ.clear(); 111 theIonA.clear(); 112 } 103 113 104 114 G4bool G4SDParticleFilter::Accept(const G4Step* aStep) const 105 115 { 116 106 117 for ( size_t i = 0; i < thePdef.size(); i++){ 107 118 if ( thePdef[i] == aStep->GetTrack()->GetDefinition() ) return TRUE; 108 119 } 120 121 // Ions by Z,A 122 for ( size_t i = 0; i < theIonZ.size(); i++){ 123 if ( theIonZ[i] == aStep->GetTrack()->GetDefinition()->GetAtomicNumber() 124 && theIonA[i] == aStep->GetTrack()->GetDefinition()->GetAtomicMass() ){ 125 return TRUE; 126 } 127 } 128 109 129 return FALSE; 110 130 } … … 128 148 } 129 149 150 void G4SDParticleFilter::addIon(G4int Z, G4int A){ 151 for ( size_t i = 0; i < theIonZ.size(); i++){ 152 if ( theIonZ[i] == Z && theIonA[i] == A ){ 153 G4cout << "G4SDParticleFilter:: Ion has been already registered."<<G4endl; 154 return; 155 } 156 } 157 theIonZ.push_back(Z); 158 theIonA.push_back(A); 159 } 160 130 161 void G4SDParticleFilter::show(){ 131 162 G4cout << "----G4SDParticleFileter particle list------"<<G4endl; 132 163 for ( size_t i = 0; i < thePdef.size(); i++){ 133 164 G4cout << thePdef[i]->GetParticleName() << G4endl; 165 } 166 for ( size_t i = 0; i < theIonZ.size(); i++){ 167 G4cout << " Ion PrtclDef (" << theIonZ[i]<<","<<theIonA[i]<<")" 168 << G4endl; 134 169 } 135 170 G4cout << "-------------------------------------------"<<G4endl;
Note: See TracChangeset
for help on using the changeset viewer.