diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp index 27ad22bf6737dea553d9534356a431b0daac6b51..d88b46e2a7b28e7673b7bf294f55a8426972e3c4 100644 --- a/DDG4/src/Geant4InputHandling.cpp +++ b/DDG4/src/Geant4InputHandling.cpp @@ -22,7 +22,6 @@ // Geant4 include files #include <G4Event.hh> -#include <G4IonTable.hh> #include <G4ParticleDefinition.hh> #include <G4PrimaryParticle.hh> #include <G4PrimaryVertex.hh> @@ -344,11 +343,7 @@ int dd4hep::sim::smearInteraction(const Geant4Action* caller, static G4PrimaryParticle* createG4Primary(const Geant4ParticleHandle p) { G4PrimaryParticle* g4 = 0; - if ( 1000000000 < p->pdgID ) { - const G4ParticleDefinition* def = G4IonTable::GetIonTable()->GetIon(p->pdgID); - g4 = new G4PrimaryParticle(def, p->psx, p->psy, p->psz, p.energy()); - g4->SetCharge(p.charge()); - } else if ( 0 != p->pdgID ) { + if ( 0 != p->pdgID ) { g4 = new G4PrimaryParticle(p->pdgID, p->psx, p->psy, p->psz, p.energy()); } else { diff --git a/DDG4/src/Geant4Particle.cpp b/DDG4/src/Geant4Particle.cpp index a3dad3c72b017e698d05f9a15449d9631742b1fb..2b2c007163992dffb2afecc6541dc81e064c7fbb 100644 --- a/DDG4/src/Geant4Particle.cpp +++ b/DDG4/src/Geant4Particle.cpp @@ -12,17 +12,20 @@ //========================================================================== // Framework include files -#include <DD4hep/Printout.h> -#include <DD4hep/Primitives.h> #include <DD4hep/InstanceCount.h> +#include <DD4hep/Primitives.h> +#include <DD4hep/Printout.h> #include <DDG4/Geant4Particle.h> -#include <TDatabasePDG.h> -#include <TParticlePDG.h> -#include <G4ParticleTable.hh> -#include <G4ParticleDefinition.hh> -#include <G4VProcess.hh> + #include <G4ChargedGeantino.hh> #include <G4Geantino.hh> +#include <G4IonTable.hh> +#include <G4ParticleDefinition.hh> +#include <G4ParticleTable.hh> +#include <G4VProcess.hh> + +#include <TDatabasePDG.h> +#include <TParticlePDG.h> #include <sstream> #include <iostream> @@ -114,6 +117,14 @@ void Geant4Particle::removeDaughter(int id_daughter) { const G4ParticleDefinition* Geant4ParticleHandle::definition() const { G4ParticleTable* tab = G4ParticleTable::GetParticleTable(); G4ParticleDefinition* def = tab->FindParticle(particle->pdgID); + if( 1000000000 < particle->pdgID) { + if(particle->pdgID % 10) { + // this is an excited ion, not sure how to handle this + std::cout << "We are ignoring excited state!!!!" << std::endl; + } + // last digit is the excitation level, we just set this to zero + return G4IonTable::GetIonTable()->GetIon((particle->pdgID / 10) * 10); + } if ( 0 == def && 0 == particle->pdgID ) { if ( 0 == particle->charge ) return G4Geantino::Definition();