00001 #include "SimG4Core/Notification/interface/G4TrackToParticleID.h" 00002 00003 #include "G4Track.hh" 00004 00005 G4TrackToParticleID::G4TrackToParticleID() 00006 { 00007 theInternalMap["deuteron"] = -100; 00008 theInternalMap["alpha"] = -102; 00009 theInternalMap["triton"] = -101; 00010 theInternalMap["He3"] = -104; 00011 } 00012 00013 int G4TrackToParticleID::particleID(const G4Track * g4trk) 00014 { 00015 int particleID_ = g4trk->GetDefinition()->GetPDGEncoding(); 00016 if ( particleID_ > 1000000000 ) { 00017 //std::cout << "G4TrackToParticleID ion code = " << particleID_ << std::endl; 00018 particleID_ = theInternalMap[g4trk->GetDefinition()->GetParticleName()]; 00019 //std::cout << "G4TrackToParticleID light nucleus code = " << particleID_ << std::endl; 00020 } 00021 if (particleID_ != 0) return particleID_; 00022 return -99; 00023 } 00024 00025 G4TrackToParticleID::~G4TrackToParticleID() { theInternalMap.clear(); }