38 #include "Test30VSecondaryGenerator.hh"
39 #include "G4SystemOfUnits.hh"
41 #include "G4ParticleTable.hh"
42 #include "G4IonTable.hh"
43 #include "G4ParticleDefinition.hh"
44 #include "G4HadronicInteraction.hh"
45 #include "G4ElementVector.hh"
46 #include "G4Material.hh"
47 #include "G4NucleiProperties.hh"
51 Test30VSecondaryGenerator::Test30VSecondaryGenerator(
52 G4HadronicInteraction* hadi,
const G4Material* mat):
57 elm = material->GetElement(0);
58 targetZ = G4lrint(elm->GetZ());
59 G4cout <<
"New generator for material " << material->GetName()
60 <<
" Nelm= " << material->GetNumberOfElements()
61 <<
" Nmat= " << material->GetNumberOfMaterials()
62 <<
" Target element: " << elm->GetName()
69 Test30VSecondaryGenerator::~Test30VSecondaryGenerator()
74 void Test30VSecondaryGenerator::SetA(G4int A)
77 G4cout <<
"Nucleus with A= " << targetA <<
" Z= " << targetZ
78 <<
" A(amu)= " << elm->GetN();
79 if(targetA < targetZ) {
81 G4cout <<
" Natural abundances";
83 G4double mass = G4NucleiProperties::GetNuclearMass(targetA, targetZ);
84 G4cout <<
"Mass from G4NucleiProperties(GeV)= " << mass/GeV << G4endl;
91 G4double Test30VSecondaryGenerator::GetMass()
95 A = G4lrint(elm->GetAtomicMassAmu());
96 G4IsotopeVector* isoVector = elm->GetIsotopeVector();
97 G4int nIsoPerElement = elm->GetNumberOfIsotopes();
98 A = (*isoVector)[0]->GetN();
99 if(nIsoPerElement > 1) {
100 G4double* abundVector = elm->GetRelativeAbundanceVector();
101 G4double
y = G4UniformRand();
102 for(G4int j=0; j<nIsoPerElement; ++j) {
105 A = (*isoVector)[j]->GetN();
111 targetNucleus.SetParameters(A, targetZ);
112 G4double mass = G4NucleiProperties::GetNuclearMass(A, targetZ);
118 G4HadFinalState* Test30VSecondaryGenerator::Secondaries(
const G4Track&
track)
120 G4HadFinalState *result1 = 0;
121 G4HadProjectile thePro(track);
124 result1 = hInteraction->ApplyYourself(thePro, targetNucleus);
125 result1->SetTrafoToLab(thePro.GetTrafoToLab());