48 : Emin(0.), Emax(0.), EminIon(0.), EmaxIon(0.),
49 index_particle(100000),
50 radius_spherical_source(0.), fwd_ion(0), adj_ion(0),
51 ion_name(
"not_defined")
55 PrimariesConsideredInAdjointSim[
G4String(
"e-")]=
false;
56 PrimariesConsideredInAdjointSim[
G4String(
"gamma")]=
false;
57 PrimariesConsideredInAdjointSim[
G4String(
"proton")]=
false;
58 PrimariesConsideredInAdjointSim[
G4String(
"ion")]=
false;
60 ListOfPrimaryFwdParticles.clear();
61 ListOfPrimaryAdjParticles.clear();
67 delete theAdjointPrimaryGenerator;
73 size_t n=ListOfPrimaryAdjParticles.size();
74 index_particle=size_t(evt_id)-n*(size_t(evt_id)/
n);
81 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleName() ==
"adj_proton") {
85 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleType() ==
"adjoint_nucleus") {
86 G4int A= ListOfPrimaryAdjParticles[index_particle]->GetAtomicMass();
98 G4double m0=ListOfPrimaryFwdParticles[index_particle]->GetPDGMass();
99 G4double ekin=std::sqrt( m0*m0 + pmag*pmag) -m0;
103 adjPrimVertex->
SetT0(0.);
105 -
p.x(),-
p.y(),-
p.z());
112 G4double adjoint_weight = ComputeEnergyDistWeight(ekin,E1,E2)*adjoint_source_area*
pi;
113 adjPrimVertex->
SetWeight(adjoint_weight);
229 radius_spherical_source = radius;
230 center_spherical_source = center_pos;
231 type_of_adjoint_source =
"Spherical";
238 type_of_adjoint_source =
"ExternalSurfaceOfAVolume";
245 if (PrimariesConsideredInAdjointSim.find(particle_name) != PrimariesConsideredInAdjointSim.end()){
246 PrimariesConsideredInAdjointSim[particle_name]=
true;
254 if (PrimariesConsideredInAdjointSim.find(particle_name) != PrimariesConsideredInAdjointSim.end()){
255 PrimariesConsideredInAdjointSim[particle_name]=
false;
264 ListOfPrimaryFwdParticles.clear();
265 ListOfPrimaryAdjParticles.clear();
266 std::map<G4String, G4bool>::iterator iter;
267 for( iter = PrimariesConsideredInAdjointSim.begin(); iter != PrimariesConsideredInAdjointSim.end(); ++iter ) {
270 if ( fwd_particle_name !=
"ion") {
272 ListOfPrimaryFwdParticles.push_back(theParticleTable->
FindParticle(fwd_particle_name));
273 ListOfPrimaryAdjParticles.push_back(theParticleTable->
FindParticle(adj_particle_name));
279 ListOfPrimaryFwdParticles.push_back(fwd_ion);
280 ListOfPrimaryAdjParticles.push_back(adj_ion);
283 ListOfPrimaryFwdParticles.push_back(0);
284 ListOfPrimaryAdjParticles.push_back(0);
296 adj_ion = adjointIon;
static G4AdjointSimManager * GetInstance()
void UpdateListOfPrimaryParticles()
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4ThreeVector GetMomentum() const
G4ThreeVector GetPosition() const
void SetEmaxIon(G4double val)
void SetWeight(G4double w)
void SetEmax(G4double val)
void AddPrimaryVertex(G4PrimaryVertex *aPrimaryVertex)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
~G4AdjointPrimaryGeneratorAction()
const G4String & GetParticleName() const
G4int GetNbEvtOfLastRun()
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
G4PrimaryParticle * GetPrimary(G4int i=0) const
void ConsiderParticleAsPrimary(const G4String &particle_name)
void SetAdjointTrackingMode(G4bool aBool)
G4AdjointPrimaryGeneratorAction()
void GeneratePrimaries(G4Event *)
void SetEminIon(G4double val)
G4PrimaryVertex * GetPrimaryVertex(G4int i=0) const
void GenerateFwdPrimaryVertex(G4Event *anEvt, G4ParticleDefinition *adj_part, G4double E1, G4double E2)
static G4ParticleTable * GetParticleTable()
void NeglectParticleAsPrimary(const G4String &particle_name)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
void SetPrimary(G4PrimaryParticle *pp)
void SetPosition(G4double x0, G4double y0, G4double z0)
G4double GetAdjointSourceArea()
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
void SetEmin(G4double val)