63 type_of_adjoint_source=
"Spherical";
65 theSingleParticleSource->GetEneDist()->SetEnergyDisType(
"Pow");
66 theSingleParticleSource->GetEneDist()->SetAlpha(-1.);
67 theSingleParticleSource->GetPosDist()->SetPosDisType(
"Point");
68 theSingleParticleSource->GetAngDist()->SetAngDistType(
"planar");
77 delete theSingleParticleSource;
86 if (type_of_adjoint_source ==
"ExternalSurfaceOfAVolume")
94 theG4AdjointPosOnPhysVolGenerator
95 ->GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(pos, direction,
97 if (costh_to_normal <1.e-4) { costh_to_normal = 1.e-4; }
101 theSingleParticleSource->GetAngDist()
102 ->SetParticleMomentumDirection(-direction);
103 theSingleParticleSource->GetPosDist()->SetCentreCoords(pos);
106 theSingleParticleSource->GetEneDist()->SetEmin(E1);
107 theSingleParticleSource->GetEneDist()->SetEmax(E2);
109 theSingleParticleSource->SetParticleDefinition(adj_part);
110 theSingleParticleSource->GeneratePrimaryVertex(anEvent);
119 if (type_of_adjoint_source ==
"ExternalSurfaceOfAVolume")
127 theG4AdjointPosOnPhysVolGenerator
128 ->GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(pos, direction,
130 if (costh_to_normal <1.e-4) { costh_to_normal =1.e-4; }
131 theSingleParticleSource->GetAngDist()
132 ->SetParticleMomentumDirection(direction);
133 theSingleParticleSource->GetPosDist()->SetCentreCoords(pos);
136 theSingleParticleSource->GetEneDist()->SetEmin(E1);
137 theSingleParticleSource->GetEneDist()->SetEmax(E2);
139 theSingleParticleSource->SetParticleDefinition(fwd_part);
140 theSingleParticleSource->GeneratePrimaryVertex(anEvent);
148 radius_spherical_source = radius;
149 center_spherical_source = center_pos;
150 type_of_adjoint_source =
"Spherical";
151 theSingleParticleSource->GetPosDist()->SetPosDisType(
"Surface");
152 theSingleParticleSource->GetPosDist()->SetPosDisShape(
"Sphere");
153 theSingleParticleSource->GetPosDist()->SetCentreCoords(center_pos);
154 theSingleParticleSource->GetPosDist()->SetRadius(radius);
155 theSingleParticleSource->GetAngDist()->SetAngDistType(
"cos");
156 theSingleParticleSource->GetAngDist()->SetMaxTheta(pi);
157 theSingleParticleSource->GetAngDist()->SetMinTheta(halfpi);
165 theG4AdjointPosOnPhysVolGenerator->DefinePhysicalVolume1(volume_name);
166 type_of_adjoint_source =
"ExternalSurfaceOfAVolume";
167 theSingleParticleSource->GetPosDist()->SetPosDisType(
"Point");
168 theSingleParticleSource->GetAngDist()->SetAngDistType(
"planar");
178 if (fLinearNavigator ==
nullptr)
186 fLinearNavigator->LocateGlobalPointAndSetup(
position);
189 delete theAccumulatedDepthVector;
194 theAccumulatedDepthVector->InsertValues(acc_length,acc_depth);
196 while (newStep > 0. && thePhysVolume !=
nullptr)
201 theAccumulatedDepthVector->InsertValues(acc_length,acc_depth);
203 thePhysVolume = fLinearNavigator
204 ->LocateGlobalPointAndSetup(
position,
nullptr,
false);
205 newStep = fLinearNavigator->ComputeStep(
position,direction,1.e50,safety);
215 G4double distance = theAccumulatedDepthVector->FindLinearEnergy(rand);
CLHEP::Hep3Vector G4ThreeVector
static G4AdjointPosOnPhysVolGenerator * GetInstance()
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &v_name)
static G4AdjointPrimaryGenerator * GetInstance()
void GenerateAdjointPrimaryVertex(G4Event *anEvt, G4ParticleDefinition *adj_part, G4double E1, G4double E2)
G4double SampleDistanceAlongBackRayAndComputeWeightCorrection(G4double &weight_corr)
void GenerateFwdPrimaryVertex(G4Event *anEvt, G4ParticleDefinition *adj_part, G4double E1, G4double E2)
void ComputeAccumulatedDepthVectorAlongBackRay(G4ThreeVector glob_pos, G4ThreeVector direction, G4double ekin, G4ParticleDefinition *aPDef)
G4AdjointPrimaryGenerator()
~G4AdjointPrimaryGenerator()
G4Material * GetMaterial() const
G4double GetDensity() const
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4LogicalVolume * GetLogicalVolume() const