Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4AdjointPrimaryGenerator Class Reference

#include <G4AdjointPrimaryGenerator.hh>

Public Member Functions

 G4AdjointPrimaryGenerator ()
 
 ~G4AdjointPrimaryGenerator ()
 
void GenerateAdjointPrimaryVertex (G4Event *anEvt, G4ParticleDefinition *adj_part, G4double E1, G4double E2)
 
void GenerateFwdPrimaryVertex (G4Event *anEvt, G4ParticleDefinition *adj_part, G4double E1, G4double E2)
 
void SetSphericalAdjointPrimarySource (G4double radius, G4ThreeVector pos)
 
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume (const G4String &volume_name)
 
void ComputeAccumulatedDepthVectorAlongBackRay (G4ThreeVector glob_pos, G4ThreeVector direction, G4double ekin, G4ParticleDefinition *aPartDef)
 
G4double SampleDistanceAlongBackRayAndComputeWeightCorrection (G4double &weight_corr)
 

Detailed Description

Definition at line 67 of file G4AdjointPrimaryGenerator.hh.

Constructor & Destructor Documentation

G4AdjointPrimaryGenerator::G4AdjointPrimaryGenerator ( )

Definition at line 53 of file G4AdjointPrimaryGenerator.cc.

54  : radius_spherical_source(0.),fLinearNavigator(0),theAccumulatedDepthVector(0)
55 {
56  center_spherical_source = G4ThreeVector(0.,0.,0.);
57  type_of_adjoint_source="Spherical";
58  theSingleParticleSource = new G4SingleParticleSource();
59 
60  theSingleParticleSource->GetEneDist()->SetEnergyDisType("Pow");
61  theSingleParticleSource->GetEneDist()->SetAlpha(-1.);
62  theSingleParticleSource->GetPosDist()->SetPosDisType("Point");
63  theSingleParticleSource->GetAngDist()->SetAngDistType("planar");
64 
65  theG4AdjointPosOnPhysVolGenerator = G4AdjointPosOnPhysVolGenerator::GetInstance();
66 
67 }
G4SPSAngDistribution * GetAngDist() const
G4SPSEneDistribution * GetEneDist() const
G4SPSPosDistribution * GetPosDist() const
CLHEP::Hep3Vector G4ThreeVector
static G4AdjointPosOnPhysVolGenerator * GetInstance()

Here is the call graph for this function:

G4AdjointPrimaryGenerator::~G4AdjointPrimaryGenerator ( )

Definition at line 70 of file G4AdjointPrimaryGenerator.cc.

71 {
72  delete theSingleParticleSource;
73 }

Member Function Documentation

void G4AdjointPrimaryGenerator::ComputeAccumulatedDepthVectorAlongBackRay ( G4ThreeVector  glob_pos,
G4ThreeVector  direction,
G4double  ekin,
G4ParticleDefinition aPartDef 
)

Definition at line 154 of file G4AdjointPrimaryGenerator.cc.

159 { if (!fLinearNavigator) fLinearNavigator =
162  G4ThreeVector position = glob_pos;
163  G4double safety=1.;
164  G4VPhysicalVolume* thePhysVolume =
165  fLinearNavigator->LocateGlobalPointAndSetup(position);
166  G4double newStep =fLinearNavigator->ComputeStep(position,direction,1.e50,
167  safety);
168  if (theAccumulatedDepthVector) delete theAccumulatedDepthVector;
169  theAccumulatedDepthVector = new G4PhysicsOrderedFreeVector();
170  //if (theAccumulatedCSDepthVector) delete theAccumulatedCSDepthVector;
171  //theAccumulatedCSDepthVector = new G4PhysicsOrderedFreeVector();
172 
173  G4double acc_depth=0.;
174  G4double acc_length=0.;
175  //G4double acc_cs_depth=0.;
176  //theAccumulatedCSDepthVector->InsertValues(acc_cs_depth, acc_length);
177  theAccumulatedDepthVector->InsertValues(acc_length,acc_depth);
178 
179  while (newStep > 0. && thePhysVolume) {
180  acc_length+=newStep;
181  /*
182  const G4MaterialCutsCouple* theMatCutsCouple=
183  thePhysVolume->GetLogicalVolume()->GetMaterialCutsCouple();
184 
185 
186  acc_cs_depth+=newStep*G4AdjointCSManager::GetAdjointCSManager()->GetTotalAdjointCS(aPartDef,
187  ekin,
188  theMatCutsCouple);
189  theAccumulatedCSDepthVector->InsertValues(acc_cs_depth, acc_length);*/
190 
191  acc_depth+=newStep*thePhysVolume->GetLogicalVolume()->GetMaterial()->GetDensity();
192  theAccumulatedDepthVector->InsertValues(acc_length,acc_depth);
193  position=position+newStep*direction;
194  thePhysVolume =
195  fLinearNavigator->LocateGlobalPointAndSetup(position,0,false);
196  newStep =fLinearNavigator->ComputeStep(position,direction,1.e50,
197  safety);
198  }
199 
200 
201 }
G4Material * GetMaterial() const
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
Definition: G4Navigator.cc:747
G4double GetDensity() const
Definition: G4Material.hh:180
G4Navigator * GetNavigatorForTracking() const
void InsertValues(G4double energy, G4double value)
static G4TransportationManager * GetTransportationManager()
G4LogicalVolume * GetLogicalVolume() const
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
Definition: G4Navigator.cc:125
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

void G4AdjointPrimaryGenerator::GenerateAdjointPrimaryVertex ( G4Event anEvt,
G4ParticleDefinition adj_part,
G4double  E1,
G4double  E2 
)

Definition at line 76 of file G4AdjointPrimaryGenerator.cc.

77 {
78  if (type_of_adjoint_source == "ExternalSurfaceOfAVolume") {
79 
80  //Generate position and direction relative to the external surface of sensitive volume
81  //-------------------------------------------------------------
82 
83  G4double costh_to_normal=1.;
84  G4ThreeVector pos =G4ThreeVector(0.,0.,0.);
85  G4ThreeVector direction = G4ThreeVector(0.,0.,1.);
86  theG4AdjointPosOnPhysVolGenerator->GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(pos, direction,costh_to_normal);
87  if (costh_to_normal <1.e-4) costh_to_normal =1.e-4;
88  //compute now the position along the ray backward direction
89 
90  theSingleParticleSource->GetAngDist()->SetParticleMomentumDirection(-direction);
91  theSingleParticleSource->GetPosDist()->SetCentreCoords(pos);
92  }
93 
94  theSingleParticleSource->GetEneDist()->SetEmin(E1);
95  theSingleParticleSource->GetEneDist()->SetEmax(E2);
96 
97  theSingleParticleSource->SetParticleDefinition(adj_part);
98  theSingleParticleSource->GeneratePrimaryVertex(anEvent);
99 
100 
101 
102 }
G4SPSAngDistribution * GetAngDist() const
G4SPSEneDistribution * GetEneDist() const
G4SPSPosDistribution * GetPosDist() const
CLHEP::Hep3Vector G4ThreeVector
void SetCentreCoords(G4ThreeVector)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector &p, G4ThreeVector &direction)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
void GeneratePrimaryVertex(G4Event *evt)
double G4double
Definition: G4Types.hh:76
static const G4double pos

Here is the call graph for this function:

void G4AdjointPrimaryGenerator::GenerateFwdPrimaryVertex ( G4Event anEvt,
G4ParticleDefinition adj_part,
G4double  E1,
G4double  E2 
)

Definition at line 105 of file G4AdjointPrimaryGenerator.cc.

106 {
107  if (type_of_adjoint_source == "ExternalSurfaceOfAVolume") {
108 
109  //Generate position and direction relative to the external surface of sensitive volume
110  //-------------------------------------------------------------
111 
112  G4double costh_to_normal=1.;
113  G4ThreeVector pos =G4ThreeVector(0.,0.,0.);
114  G4ThreeVector direction = G4ThreeVector(0.,0.,1.);
115  theG4AdjointPosOnPhysVolGenerator->GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(pos, direction,costh_to_normal);
116  if (costh_to_normal <1.e-4) costh_to_normal =1.e-4;
117  theSingleParticleSource->GetAngDist()->SetParticleMomentumDirection(direction);
118  theSingleParticleSource->GetPosDist()->SetCentreCoords(pos);
119  }
120 
121  theSingleParticleSource->GetEneDist()->SetEmin(E1);
122  theSingleParticleSource->GetEneDist()->SetEmax(E2);
123 
124  theSingleParticleSource->SetParticleDefinition(fwd_part);
125  theSingleParticleSource->GeneratePrimaryVertex(anEvent);
126 }
G4SPSAngDistribution * GetAngDist() const
G4SPSEneDistribution * GetEneDist() const
G4SPSPosDistribution * GetPosDist() const
CLHEP::Hep3Vector G4ThreeVector
void SetCentreCoords(G4ThreeVector)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector &p, G4ThreeVector &direction)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
void GeneratePrimaryVertex(G4Event *evt)
double G4double
Definition: G4Types.hh:76
static const G4double pos

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4AdjointPrimaryGenerator::SampleDistanceAlongBackRayAndComputeWeightCorrection ( G4double weight_corr)

Definition at line 204 of file G4AdjointPrimaryGenerator.cc.

205 {G4double rand = G4UniformRand();
206  G4double distance = theAccumulatedDepthVector->FindLinearEnergy(rand);
207  /*
208  G4double acc_cs_depth=theAccumulatedCSDepthVector->GetEnergy(distance);
209  weight_corr=std::exp(-acc_cs_depth);*/
210  weight_corr=1.;
211  return distance;
212 }
G4double FindLinearEnergy(G4double rand) const
#define G4UniformRand()
Definition: Randomize.hh:97
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

void G4AdjointPrimaryGenerator::SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume ( const G4String volume_name)

Definition at line 144 of file G4AdjointPrimaryGenerator.cc.

145 {
146  theG4AdjointPosOnPhysVolGenerator->DefinePhysicalVolume1(volume_name);
147  type_of_adjoint_source ="ExternalSurfaceOfAVolume";
148  theSingleParticleSource->GetPosDist()->SetPosDisType("Point");
149  theSingleParticleSource->GetAngDist()->SetAngDistType("planar");
150 }
G4SPSAngDistribution * GetAngDist() const
G4SPSPosDistribution * GetPosDist() const
void DefinePhysicalVolume1(const G4String &aName)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4AdjointPrimaryGenerator::SetSphericalAdjointPrimarySource ( G4double  radius,
G4ThreeVector  pos 
)

Definition at line 129 of file G4AdjointPrimaryGenerator.cc.

130 {
131  radius_spherical_source = radius;
132  center_spherical_source = center_pos;
133  type_of_adjoint_source ="Spherical";
134  theSingleParticleSource->GetPosDist()->SetPosDisType("Surface");
135  theSingleParticleSource->GetPosDist()->SetPosDisShape("Sphere");
136  theSingleParticleSource->GetPosDist()->SetCentreCoords(center_pos);
137  theSingleParticleSource->GetPosDist()->SetRadius(radius);
138  theSingleParticleSource->GetAngDist()->SetAngDistType("cos");
139  theSingleParticleSource->GetAngDist()->SetMaxTheta(pi);
140  theSingleParticleSource->GetAngDist()->SetMinTheta(halfpi);
141 }
G4SPSAngDistribution * GetAngDist() const
G4SPSPosDistribution * GetPosDist() const
void SetCentreCoords(G4ThreeVector)
static constexpr double pi
Definition: G4SIunits.hh:75
static constexpr double halfpi
Definition: G4SIunits.hh:77

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: