73 std::size_t n = ListOfPrimaryAdjParticles.size();
74 index_particle = std::size_t(evt_id) - n * (std::size_t(evt_id) / n);
78 if (ListOfPrimaryAdjParticles[index_particle] ==
nullptr)
81 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleName() ==
"adj_proton") {
85 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleType() ==
"adjoint_nucleus") {
86 G4int A = ListOfPrimaryAdjParticles[index_particle]->GetAtomicMass();
92 anEvent, ListOfPrimaryFwdParticles[index_particle], E1, E2);
98 G4double m0 = ListOfPrimaryFwdParticles[index_particle]->GetPDGMass();
99 G4double ekin = std::sqrt(m0 * m0 + pmag * pmag) - m0;
105 weight_correction = 1.;
107 if (ListOfPrimaryFwdParticles[index_particle] ==
G4Gamma::Gamma() && nb_fwd_gammas_per_event > 1)
109 G4double weight = (1. / nb_fwd_gammas_per_event);
111 for (
G4int i = 0; i < nb_fwd_gammas_per_event - 1; ++i) {
113 newFwdPrimVertex->SetPosition(pos.
x(), pos.
y(), pos.
z());
114 newFwdPrimVertex->SetT0(0.);
117 newFwdPrimVertex->SetPrimary(aPrimParticle);
118 newFwdPrimVertex->SetWeight(weight);
125 adjPrimVertex->SetPosition(pos.
x(), pos.
y(), pos.
z());
126 adjPrimVertex->SetT0(0.);
130 adjPrimVertex->SetPrimary(aPrimParticle);
136 weight_correction * ComputeEnergyDistWeight(ekin, E1, E2) * adjoint_source_area * pi;
137 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleName() ==
"adj_gamma") {
140 adjoint_weight = adjoint_weight / nb_adj_primary_gammas_per_event;
141 for (
G4int i = 0; i < nb_adj_primary_gammas_per_event - 1; ++i) {
143 newAdjPrimVertex->SetPosition(pos.
x(), pos.
y(), pos.
z());
144 newAdjPrimVertex->SetT0(0.);
147 newAdjPrimVertex->SetPrimary(aPrimParticle);
148 newAdjPrimVertex->SetWeight(adjoint_weight);
152 else if (ListOfPrimaryAdjParticles[index_particle]->GetParticleName() ==
"adj_electron") {
155 adjoint_weight = adjoint_weight / nb_adj_primary_electrons_per_event;
156 for (
G4int i = 0; i < nb_adj_primary_electrons_per_event - 1; ++i) {
158 newAdjPrimVertex->SetPosition(pos.
x(), pos.
y(), pos.
z());
159 newAdjPrimVertex->SetT0(0.);
162 newAdjPrimVertex->SetPrimary(aPrimParticle);
163 newAdjPrimVertex->SetWeight(adjoint_weight);
167 adjPrimVertex->SetWeight(adjoint_weight);
273 ListOfPrimaryFwdParticles.clear();
274 ListOfPrimaryAdjParticles.clear();
275 for (
const auto& iter : PrimariesConsideredInAdjointSim) {
277 G4String fwd_particle_name = iter.first;
278 if (fwd_particle_name !=
"ion") {
280 ListOfPrimaryFwdParticles.push_back(theParticleTable->
FindParticle(fwd_particle_name));
281 ListOfPrimaryAdjParticles.push_back(theParticleTable->
FindParticle(adj_particle_name));
284 if (fwd_ion !=
nullptr) {
287 ListOfPrimaryFwdParticles.push_back(fwd_ion);
288 ListOfPrimaryAdjParticles.push_back(adj_ion);
291 ListOfPrimaryFwdParticles.push_back(
nullptr);
292 ListOfPrimaryAdjParticles.push_back(
nullptr);
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4ThreeVector GetMomentum() const