Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/digits_hits/scorer/src/G4SDParticleFilter.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4SDParticleFilter.cc,v 1.1 2007/07/11 01:31:03 asaim Exp $
    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: $
    2929//
    3030// G4VSensitiveDetector
     
    4949{
    5050  thePdef.clear();
     51  theIonZ.clear();
     52  theIonA.clear();
    5153}
    5254
     
    6668  }
    6769  thePdef.push_back(pd);
     70  theIonZ.clear();
     71  theIonA.clear();
    6872}
    6973
     
    8488   }
    8589   thePdef.push_back(pd);
     90   theIonZ.clear();
     91   theIonA.clear();
    8692  }
    8793}
     
    8995G4SDParticleFilter::G4SDParticleFilter(G4String name,
    9096                       const std::vector<G4ParticleDefinition*>& particleDef)
    91   :G4VSDFilter(name), thePdef(particleDef)
     97    :G4VSDFilter(name), thePdef(particleDef)
    9298{
    9399  for ( size_t i = 0; i < particleDef.size(); i++){
     
    95101       "NULL pointer is found in the given particleDef vector.");
    96102  }
     103  theIonZ.clear();
     104  theIonA.clear();
    97105}
    98106
     
    100108{
    101109  thePdef.clear();
    102 }
     110  theIonZ.clear();
     111  theIonA.clear();
     112      }
    103113
    104114G4bool G4SDParticleFilter::Accept(const G4Step* aStep) const
    105115{
     116 
    106117  for ( size_t i = 0; i < thePdef.size(); i++){
    107118    if ( thePdef[i] == aStep->GetTrack()->GetDefinition() ) return TRUE;
    108119  }
     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
    109129  return FALSE;
    110130}
     
    128148}
    129149
     150void 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
    130161void G4SDParticleFilter::show(){
    131162  G4cout << "----G4SDParticleFileter particle list------"<<G4endl;
    132163  for ( size_t i = 0; i < thePdef.size(); i++){
    133164    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;
    134169  }
    135170  G4cout << "-------------------------------------------"<<G4endl;
Note: See TracChangeset for help on using the changeset viewer.