Geant4  10.02.p01
G4eplusPolarizedAnnihilation.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4eplusPolarizedAnnihilation.cc 93113 2015-10-07 07:49:04Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4eplusPolarizedAnnihilation
34 //
35 // Author: A. Schaelicke on base of Vladimir Ivanchenko / Michel Maire code
36 //
37 // Creation date: 02.07.2006
38 //
39 // Modifications:
40 // 26-07-06 modified cross section (P. Starovoitov)
41 // 21-08-06 interface updated (A. Schaelicke)
42 // 11-06-07, add PostStepGetPhysicalInteractionLength (A.Schalicke)
43 // 02-10-07, enable AtRest (V.Ivanchenko)
44 //
45 //
46 // Class Description:
47 //
48 // Polarized process of e+ annihilation into 2 gammas
49 //
50 
51 //
52 // -------------------------------------------------------------------
53 //
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
56 
58 #include "G4PhysicalConstants.hh"
59 #include "G4SystemOfUnits.hh"
60 #include "G4MaterialCutsCouple.hh"
61 #include "G4Gamma.hh"
62 #include "G4PhysicsVector.hh"
63 #include "G4PhysicsLogVector.hh"
64 
66 #include "G4PhysicsTableHelper.hh"
67 #include "G4ProductionCutsTable.hh"
68 #include "G4PolarizationManager.hh"
69 #include "G4PolarizationHelper.hh"
70 #include "G4StokesVector.hh"
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
73 
75  : G4eplusAnnihilation(name), isInitialised(false),
76  theAsymmetryTable(nullptr),
77  theTransverseAsymmetryTable(nullptr)
78 {
80  SetEmModel(emModel, 1);
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
84 
86 {
87  CleanTables();
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
91 
93 {
94  if(theAsymmetryTable) {
96  delete theAsymmetryTable;
97  theAsymmetryTable = nullptr;
98  }
102  theTransverseAsymmetryTable = nullptr;
103  }
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
107 
109  G4double previousStepSize,
111 {
112  G4double mfp = G4VEmProcess::GetMeanFreePath(track, previousStepSize, condition);
113 
115  mfp *= ComputeSaturationFactor(track);
116  }
117  if (verboseLevel>=2) {
118  G4cout << "G4eplusPolarizedAnnihilation::MeanFreePath: "
119  << mfp / mm << " mm " << G4endl;
120  }
121  return mfp;
122 }
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
125 
127  const G4Track& track,
128  G4double previousStepSize,
130 {
131  // save previous value
133 
134  // *** compute uppolarized step limit ***
136  previousStepSize,
137  condition);
138 
141  if(nLength > 0.0) {
143  std::max(nLength - previousStepSize/curLength, 0.0);
144  }
145  x = theNumberOfInteractionLengthLeft * curLength;
146  }
147  if (verboseLevel>=2) {
148  G4cout << "G4eplusPolarizedAnnihilation::PostStepGetPhysicalInteractionLength: "
149  << x/mm << " mm " << G4endl;
150  }
151  return x;
152 }
153 
154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
155 
156 G4double
158 {
159  G4Material* aMaterial = track.GetMaterial();
160  G4VPhysicalVolume* aPVolume = track.GetVolume();
161  G4LogicalVolume* aLVolume = aPVolume->GetLogicalVolume();
162 
164 
165  const G4bool volumeIsPolarized = polarizationManger->IsPolarized(aLVolume);
166  G4StokesVector electronPolarization = polarizationManger->GetVolumePolarization(aLVolume);
167 
168  G4double factor = 1.0;
169 
170  if (volumeIsPolarized) {
171 
172  // *** get asymmetry, if target is polarized ***
173  const G4DynamicParticle* aDynamicPositron = track.GetDynamicParticle();
174  const G4double positronEnergy = aDynamicPositron->GetKineticEnergy();
175  const G4StokesVector positronPolarization = track.GetPolarization();
176  const G4ParticleMomentum positronDirection0 = aDynamicPositron->GetMomentumDirection();
177 
178  if (verboseLevel>=2) {
179  G4cout << "G4eplusPolarizedAnnihilation::ComputeSaturationFactor: " << G4endl;
180  G4cout << " Mom " << positronDirection0 << G4endl;
181  G4cout << " Polarization " << positronPolarization << G4endl;
182  G4cout << " MaterialPol. " << electronPolarization << G4endl;
183  G4cout << " Phys. Volume " << aPVolume->GetName() << G4endl;
184  G4cout << " Log. Volume " << aLVolume->GetName() << G4endl;
185  G4cout << " Material " << aMaterial << G4endl;
186  }
187 
188  size_t midx = CurrentMaterialCutsCoupleIndex();
189  const G4PhysicsVector* aVector = nullptr;
190  const G4PhysicsVector* bVector = nullptr;
191  if(midx < theAsymmetryTable->size()) {
192  aVector = (*theAsymmetryTable)(midx);
193  }
194  if(midx < theTransverseAsymmetryTable->size()) {
195  bVector = (*theTransverseAsymmetryTable)(midx);
196  }
197  if(aVector && bVector) {
198  G4double lAsymmetry = aVector->Value(positronEnergy);
199  G4double tAsymmetry = bVector->Value(positronEnergy);
200  G4double polZZ = positronPolarization.z()*
201  (electronPolarization*positronDirection0);
202  G4double polXX = positronPolarization.x()*
203  (electronPolarization*G4PolarizationHelper::GetParticleFrameX(positronDirection0));
204  G4double polYY = positronPolarization.y()*
205  (electronPolarization*G4PolarizationHelper::GetParticleFrameY(positronDirection0));
206 
207  factor /= (1. + polZZ*lAsymmetry + (polXX + polYY)*tAsymmetry);
208 
209  if (verboseLevel>=2) {
210  G4cout << " Asymmetry: " << lAsymmetry << ", " << tAsymmetry << G4endl;
211  G4cout << " PolProduct: " << polXX << ", " << polYY << ", " << polZZ << G4endl;
212  G4cout << " Factor: " << factor << G4endl;
213  }
214  } else {
216  ed << "Problem with asymmetry tables: material index " << midx
217  << " is out of range or tables are not filled";
218  G4Exception("G4eplusPolarizedAnnihilation::ComputeSaturationFactor","em0048",
219  JustWarning, ed, "");
220  }
221  }
222  return factor;
223 }
224 
225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
226 
228  const G4ParticleDefinition& part)
229 {
231  G4bool isMaster = true;
232  const G4eplusPolarizedAnnihilation* masterProcess =
233  static_cast<const G4eplusPolarizedAnnihilation*>(GetMasterProcess());
234  if(masterProcess && masterProcess != this) { isMaster = false; }
235  if(isMaster) { BuildAsymmetryTables(part); }
236 }
237 
238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
239 
241  const G4ParticleDefinition& part)
242 {
243  // cleanup old, initialise new table
244  CleanTables();
249 
250  // Access to materials
251  const G4ProductionCutsTable* theCoupleTable=
253  size_t numOfCouples = theCoupleTable->GetTableSize();
254  //G4cout<<" annih-numOfCouples="<<numOfCouples<<"\n";
255  for(size_t i=0; i<numOfCouples; ++i) {
256  //G4cout<<"annih- "<<i<<"/"<<numOfCouples<<"\n";
257  if (!theAsymmetryTable) break;
258  //G4cout<<"annih- "<<theAsymmetryTable->GetFlag(i)<<"\n";
259  if (theAsymmetryTable->GetFlag(i)) {
260  //G4cout<<" building pol-annih ... \n";
261 
262  // create physics vector and fill it
263  const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
264 
265  // use same parameters as for lambda
266  G4PhysicsVector* aVector = LambdaPhysicsVector(couple);
267  G4PhysicsVector* tVector = LambdaPhysicsVector(couple);
268 
269  for (G4int j = 0 ; j < LambdaBinning() ; ++j ) {
270  G4double lowEdgeEnergy = aVector->GetLowEdgeEnergy(j);
271  G4double tasm=0.;
272  G4double asym = ComputeAsymmetry(lowEdgeEnergy, couple, part, 0., tasm);
273  aVector->PutValue(j,asym);
274  tVector->PutValue(j,tasm);
275  }
278  }
279  }
280 }
281 
282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
283 
285  const G4MaterialCutsCouple* couple,
286  const G4ParticleDefinition& aParticle,
287  G4double cut,
288  G4double &tAsymmetry)
289 {
290  G4double lAsymmetry = 0.0;
291  tAsymmetry = 0.0;
292 
293  // calculate polarized cross section
297  G4double sigma2=emModel->CrossSection(couple,&aParticle,energy,cut,energy);
298 
299  // calculate transversely polarized cross section
303  G4double sigma3=emModel->CrossSection(couple,&aParticle,energy,cut,energy);
304 
305  // calculate unpolarized cross section
309  G4double sigma0=emModel->CrossSection(couple,&aParticle,energy,cut,energy);
310 
311  // determine assymmetries
312  if (sigma0>0.) {
313  lAsymmetry=sigma2/sigma0-1.;
314  tAsymmetry=sigma3/sigma0-1.;
315  }
316  return lAsymmetry;
317 }
318 
319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
320 
322 {
323  G4cout << " Polarized model for annihilation into 2 photons"
324  << G4endl;
325 }
326 
327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double condition(const G4ErrorSymMatrix &m)
const G4VProcess * GetMasterProcess() const
Definition: G4VProcess.hh:538
void SetBeamPolarization(const G4ThreeVector &pBeam)
const G4ThreeVector & GetPolarization() const
static void SetPhysicsVector(G4PhysicsTable *physTable, size_t idx, G4PhysicsVector *vec)
G4int verboseLevel
Definition: G4VProcess.hh:368
G4double ComputeSaturationFactor(const G4Track &aTrack)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
const G4DynamicParticle * GetDynamicParticle() const
G4String name
Definition: TRTMaterials.hh:40
static G4PolarizationManager * GetInstance()
G4double theNumberOfInteractionLengthLeft
Definition: G4VProcess.hh:293
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4double GetLowEdgeEnergy(size_t binNumber) const
int G4int
Definition: G4Types.hh:78
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
G4int LambdaBinning() const
G4double ComputeAsymmetry(G4double energy, const G4MaterialCutsCouple *couple, const G4ParticleDefinition &particle, G4double cut, G4double &tasm)
void SetEmModel(G4VEmModel *, G4int index=1)
size_t CurrentMaterialCutsCoupleIndex() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
void SetTargetPolarization(const G4ThreeVector &pTarget)
bool G4bool
Definition: G4Types.hh:79
const G4ThreeVector & GetMomentumDirection() const
G4double CrossSection(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.hh:501
G4double currentInteractionLength
Definition: G4VProcess.hh:297
void PutValue(size_t index, G4double theValue)
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4double Value(G4double theEnergy, size_t &lastidx) const
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4Material * GetMaterial() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
static G4ProductionCutsTable * GetProductionCutsTable()
G4PhysicsVector * LambdaPhysicsVector(const G4MaterialCutsCouple *)
static const G4double factor
G4LogicalVolume * GetLogicalVolume() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double energy(const ThreeVector &p, const G4double m)
G4PolarizedAnnihilationModel * emModel
const G4double x[NPOINTSGL]
bool IsPolarized(G4LogicalVolume *lVol) const
G4VPhysicalVolume * GetVolume() const
static G4ThreeVector GetParticleFrameY(const G4ThreeVector &)
#define G4endl
Definition: G4ios.hh:61
G4bool GetFlag(size_t i) const
const G4String & GetName() const
double G4double
Definition: G4Types.hh:76
G4ForceCondition
void BuildAsymmetryTables(const G4ParticleDefinition &part)
G4ThreeVector G4ParticleMomentum
#define DBL_MAX
Definition: templates.hh:83
static G4ThreeVector GetParticleFrameX(const G4ThreeVector &)
static const double mm
Definition: G4SIunits.hh:114
const G4ThreeVector & GetVolumePolarization(G4LogicalVolume *lVol) const
void clearAndDestroy()
G4eplusPolarizedAnnihilation(const G4String &name="pol-annihil")