48 : Emin(0.), Emax(0.), EminIon(0.), EmaxIon(0.), NbOfAdjointPrimaryTypes(0),
49 index_particle(100000), last_generated_part_was_adjoint(false),
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 if ( !last_generated_part_was_adjoint ) {
76 if (index_particle >= ListOfPrimaryAdjParticles.size()) index_particle =0;
83 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleName() ==
"adj_proton") {
87 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleType() ==
"adjoint_nucleus") {
88 G4int A= ListOfPrimaryAdjParticles[index_particle]->GetAtomicMass();
93 ListOfPrimaryAdjParticles[index_particle],
102 G4double m0=ListOfPrimaryAdjParticles[index_particle]->GetPDGMass();
103 G4double ekin=std::sqrt( m0*m0 + pmag*pmag) -m0;
108 G4double adjoint_weight = ComputeEnergyDistWeight(ekin,E1,E2)*adjoint_source_area*pi;
112 last_generated_part_was_adjoint =
true;
120 aPrimVertex->
SetT0(0.);
122 -p.
x(),-p.
y(),-p.
z());
126 last_generated_part_was_adjoint =
false;
180 radius_spherical_source = radius;
181 center_spherical_source = center_pos;
182 type_of_adjoint_source =
"Spherical";
189 type_of_adjoint_source =
"ExternalSurfaceOfAVolume";
196 if (PrimariesConsideredInAdjointSim.find(particle_name) != PrimariesConsideredInAdjointSim.end()){
197 PrimariesConsideredInAdjointSim[particle_name]=
true;
205 if (PrimariesConsideredInAdjointSim.find(particle_name) != PrimariesConsideredInAdjointSim.end()){
206 PrimariesConsideredInAdjointSim[particle_name]=
false;
215 ListOfPrimaryFwdParticles.clear();
216 ListOfPrimaryAdjParticles.clear();
217 std::map<G4String, G4bool>::iterator iter;
218 for( iter = PrimariesConsideredInAdjointSim.begin(); iter != PrimariesConsideredInAdjointSim.end(); ++iter ) {
221 if ( fwd_particle_name !=
"ion") {
223 ListOfPrimaryFwdParticles.push_back(theParticleTable->
FindParticle(fwd_particle_name));
224 ListOfPrimaryAdjParticles.push_back(theParticleTable->
FindParticle(adj_particle_name));
230 ListOfPrimaryFwdParticles.push_back(fwd_ion);
231 ListOfPrimaryAdjParticles.push_back(adj_ion);
234 ListOfPrimaryFwdParticles.push_back(0);
235 ListOfPrimaryAdjParticles.push_back(0);
247 adj_ion = adjointIon;
void UpdateListOfPrimaryParticles()
void GeneratePrimaries(G4Event *)
void ConsiderParticleAsPrimary(const G4String &particle_name)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
void SetEminIon(G4double val)
void SetEmin(G4double val)
void NeglectParticleAsPrimary(const G4String &particle_name)
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
~G4AdjointPrimaryGeneratorAction()
void SetEmaxIon(G4double val)
void SetEmax(G4double val)
G4AdjointPrimaryGeneratorAction()
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
void GenerateAdjointPrimaryVertex(G4Event *anEvt, G4ParticleDefinition *adj_part, G4double E1, G4double E2)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
void SetAdjointTrackingMode(G4bool aBool)
G4double GetAdjointSourceArea()
void RegisterAdjointPrimaryWeight(G4double aWeight)
G4int GetNbEvtOfLastRun()
static G4AdjointSimManager * GetInstance()
G4PrimaryVertex * GetPrimaryVertex(G4int i=0) const
void AddPrimaryVertex(G4PrimaryVertex *aPrimaryVertex)
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4ThreeVector GetMomentum() const
void SetPosition(G4double x0, G4double y0, G4double z0)
G4ThreeVector GetPosition() const
void SetPrimary(G4PrimaryParticle *pp)
void SetWeight(G4double w)
G4PrimaryParticle * GetPrimary(G4int i=0) const