Geant4  10.02.p02
G4ePolarizedIonisation.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 //
27 // $Id: G4ePolarizedIonisation.cc 93113 2015-10-07 07:49:04Z gcosmo $
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4ePolarizedIonisation
34 //
35 // Author: A.Schaelicke on base of Vladimir Ivanchenko code
36 //
37 // Creation date: 10.11.2005
38 //
39 // Modifications:
40 //
41 // 10-11-05, include polarization description (A.Schaelicke)
42 // , create asymmetry table and determine interactionlength
43 // , update polarized differential cross section
44 //
45 // 20-08-06, modified interface (A.Schaelicke)
46 // 11-06-07, add PostStepGetPhysicalInteractionLength (A.Schalicke)
47 //
48 // Class Description:
49 //
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
54 #include "G4Electron.hh"
56 #include "G4UnitsTable.hh"
57 
59 #include "G4PhysicsTableHelper.hh"
60 #include "G4ProductionCutsTable.hh"
61 #include "G4PolarizationManager.hh"
62 #include "G4PolarizationHelper.hh"
63 #include "G4StokesVector.hh"
64 #include "G4EmParameters.hh"
65 
66 #include "G4SystemOfUnits.hh"
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69 
71  : G4VEnergyLossProcess(name),
72  theElectron(G4Electron::Electron()),
73  isElectron(true),
74  isInitialised(false),
75  theTargetPolarization(0.,0.,0.),
76  theAsymmetryTable(nullptr),
77  theTransverseAsymmetryTable(nullptr)
78 {
79  verboseLevel=0;
82  flucModel = nullptr;
83  emModel = nullptr;
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
87 
89 {
90  CleanTables();
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
94 
96 {
97  if(theAsymmetryTable) {
99  delete theAsymmetryTable;
100  theAsymmetryTable = nullptr;
101  }
105  theTransverseAsymmetryTable = nullptr;
106  }
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
110 
111 G4double
113  const G4Material*, G4double cut)
114 {
115  G4double x = cut;
116  if(isElectron) { x += cut; }
117  return x;
118 }
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
121 
123 {
124  return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
125 }
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
127 
129  const G4ParticleDefinition* part,
130  const G4ParticleDefinition* /*part2*/)
131 {
132  if(!isInitialised) {
133 
134  if(part == G4Positron::Positron()) { isElectron = false; }
135 
137  flucModel = FluctModel();
138 
140  SetEmModel(emModel, 1);
145 
146  isInitialised = true;
147  }
148 }
149 
150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
151 
153 {}
154 
155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
156 
158  G4double step,
159  G4ForceCondition* cond)
160 {
161  // *** get unploarised mean free path from lambda table ***
162  G4double mfp = G4VEnergyLossProcess::GetMeanFreePath(track, step, cond);
164  mfp *= ComputeSaturationFactor(track);
165  }
166  if (verboseLevel>=2) {
167  G4cout << "G4ePolarizedIonisation::MeanFreePath: "
168  << mfp / mm << " mm " << G4endl;
169  }
170  return mfp;
171 }
172 
173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
174 
176  G4double step,
177  G4ForceCondition* cond)
178 {
179  // save previous value
181 
182  // *** get unploarised mean free path from lambda table ***
184 
187  if(nLength > 0.0) {
189  std::max(nLength - step/curLength, 0.0);
190  }
191  x = theNumberOfInteractionLengthLeft * curLength;
192  }
193  if (verboseLevel>=2) {
194  G4cout << "G4ePolarizedIonisation::PostStepGetPhysicalInteractionLength: "
195  << x/mm << " mm " << G4endl;
196  }
197  return x;
198 }
199 
200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
201 
202 G4double
204 {
205  G4Material* aMaterial = track.GetMaterial();
206  G4VPhysicalVolume* aPVolume = track.GetVolume();
207  G4LogicalVolume* aLVolume = aPVolume->GetLogicalVolume();
208 
210 
211  const G4bool volumeIsPolarized = polarizationManger->IsPolarized(aLVolume);
212  G4StokesVector volPolarization = polarizationManger->GetVolumePolarization(aLVolume);
213 
214  G4double factor = 1.0;
215 
216  if (volumeIsPolarized && !volPolarization.IsZero()) {
217 
218  // *** get asymmetry, if target is polarized ***
219  const G4DynamicParticle* aDynamicPart = track.GetDynamicParticle();
220  const G4double energy = aDynamicPart->GetKineticEnergy();
221  const G4StokesVector polarization = track.GetPolarization();
222  const G4ParticleMomentum direction0 = aDynamicPart->GetMomentumDirection();
223 
224  if (verboseLevel>=2) {
225  G4cout << "G4ePolarizedIonisation::ComputeSaturationFactor: " << G4endl;
226  G4cout << " Energy(MeV) " << energy/MeV << G4endl;
227  G4cout << " Direction " << direction0 << G4endl;
228  G4cout << " Polarization " << polarization << G4endl;
229  G4cout << " MaterialPol. " << volPolarization << G4endl;
230  G4cout << " Phys. Volume " << aPVolume->GetName() << G4endl;
231  G4cout << " Log. Volume " << aLVolume->GetName() << G4endl;
232  G4cout << " Material " << aMaterial << G4endl;
233  }
234 
235  size_t midx = CurrentMaterialCutsCoupleIndex();
236  const G4PhysicsVector* aVector = nullptr;
237  const G4PhysicsVector* bVector = nullptr;
238  if(midx < theAsymmetryTable->size()) {
239  aVector = (*theAsymmetryTable)(midx);
240  }
241  if(midx < theTransverseAsymmetryTable->size()) {
242  bVector = (*theTransverseAsymmetryTable)(midx);
243  }
244  if(aVector && bVector) {
245  G4double lAsymmetry = aVector->Value(energy);
246  G4double tAsymmetry = bVector->Value(energy);
247  G4double polZZ = polarization.z()*(volPolarization*direction0);
248  G4double polXX = polarization.x()*
249  (volPolarization*G4PolarizationHelper::GetParticleFrameX(direction0));
250  G4double polYY = polarization.y()*
251  (volPolarization*G4PolarizationHelper::GetParticleFrameY(direction0));
252 
253  factor /= (1. + polZZ*lAsymmetry + (polXX + polYY)*tAsymmetry);
254 
255  if (verboseLevel>=2) {
256  G4cout << " Asymmetry: " << lAsymmetry << ", " << tAsymmetry << G4endl;
257  G4cout << " PolProduct: " << polXX << ", " << polYY << ", " << polZZ << G4endl;
258  G4cout << " Factor: " << factor << G4endl;
259  }
260  } else {
262  ed << "Problem with asymmetry tables: material index " << midx
263  << " is out of range or tables are not filled";
264  G4Exception("G4ePolarizedIonisation::ComputeSaturationFactor","em0048",
265  JustWarning, ed, "");
266  }
267  }
268  return factor;
269 }
270 
271 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
272 
274  const G4ParticleDefinition& part)
275 {
276  // *** build DEDX and (unpolarized) cross section tables
278  G4bool master = true;
279  const G4ePolarizedIonisation* masterProcess =
280  static_cast<const G4ePolarizedIonisation*>(GetMasterProcess());
281  if(masterProcess && masterProcess != this) { master = false; }
282  if(master) { BuildAsymmetryTables(part); }
283 }
284 
285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
286 
288  const G4ParticleDefinition& part)
289 {
290  // cleanup old, initialise new table
291  CleanTables();
296 
297  const G4ProductionCutsTable* theCoupleTable=
299  size_t numOfCouples = theCoupleTable->GetTableSize();
300 
301  for (size_t j=0 ; j < numOfCouples; j++ ) {
302  // get cut value
303  const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(j);
304 
305  G4double cut = (*theCoupleTable->GetEnergyCutsVector(1))[j];
306 
307  //create physics vectors then fill it (same parameters as lambda vector)
308  G4PhysicsVector * ptrVectorA = LambdaPhysicsVector(couple,cut);
309  G4PhysicsVector * ptrVectorB = LambdaPhysicsVector(couple,cut);
310  size_t bins = ptrVectorA->GetVectorLength();
311 
312  for (size_t i = 0 ; i < bins ; i++ ) {
313  G4double lowEdgeEnergy = ptrVectorA->Energy(i);
314  G4double tasm=0.;
315  G4double asym = ComputeAsymmetry(lowEdgeEnergy, couple, part, cut, tasm);
316  ptrVectorA->PutValue(i,asym);
317  ptrVectorB->PutValue(i,tasm);
318  }
319  theAsymmetryTable->insertAt( j , ptrVectorA ) ;
320  theTransverseAsymmetryTable->insertAt( j , ptrVectorB ) ;
321  }
322 }
323 
324 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
325 
326 G4double
328  const G4MaterialCutsCouple* couple,
329  const G4ParticleDefinition& aParticle,
330  G4double cut,
331  G4double & tAsymmetry)
332 {
333  G4double lAsymmetry = 0.0;
334  tAsymmetry = 0.0;
335  if (isElectron) { lAsymmetry = tAsymmetry = -1.0; }
336 
337  // calculate polarized cross section
341  G4double sigma2=emModel->CrossSection(couple,&aParticle,energy,cut,energy);
342 
343  // calculate transversely polarized cross section
347  G4double sigma3=emModel->CrossSection(couple,&aParticle,energy,cut,energy);
348 
349  // calculate unpolarized cross section
353  G4double sigma0 = emModel->CrossSection(couple,&aParticle,energy,cut,energy);
354  // determine assymmetries
355  if (sigma0 > 0.) {
356  lAsymmetry=sigma2/sigma0 - 1.;
357  tAsymmetry=sigma3/sigma0 - 1.;
358  }
359  if (std::fabs(lAsymmetry)>1.) {
360  G4cout<<"G4ePolarizedIonisation::ComputeAsymmetry WARNING: E(MeV)= "
361  << energy << " lAsymmetry= "<<lAsymmetry
362  <<" ("<<std::fabs(lAsymmetry)-1.<<")\n";
363  }
364  if (std::fabs(tAsymmetry)>1.) {
365  G4cout<<" energy="<<energy<<"\n";
366  G4cout<<"G4ePolarizedIonisation::ComputeAsymmetry WARNING: E(MeV)= "
367  << energy << " tAsymmetry= "<<tAsymmetry
368  <<" ("<<std::fabs(tAsymmetry)-1.<<")\n";
369  }
370  return lAsymmetry;
371 }
372 
373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
374 
const G4VProcess * GetMasterProcess() const
Definition: G4VProcess.hh:538
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut)
const G4ThreeVector & GetPolarization() const
static const double MeV
Definition: G4SIunits.hh:211
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
G4double MaxKinEnergy() const
G4bool isElectron(G4int ityp)
G4int verboseLevel
Definition: G4VProcess.hh:368
G4ePolarizedIonisation(const G4String &name="pol-eIoni")
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
const G4DynamicParticle * GetDynamicParticle() const
G4double ComputeAsymmetry(G4double energy, const G4MaterialCutsCouple *couple, const G4ParticleDefinition &particle, G4double cut, G4double &tasm)
G4String name
Definition: TRTMaterials.hh:40
static G4PolarizationManager * GetInstance()
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4double theNumberOfInteractionLengthLeft
Definition: G4VProcess.hh:293
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
size_t GetVectorLength() const
void SetFluctModel(G4VEmFluctuationModel *)
G4PhysicsVector * LambdaPhysicsVector(const G4MaterialCutsCouple *, G4double cut)
G4PolarizedMollerBhabhaModel * emModel
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
G4bool IsZero() const
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:725
G4VEmFluctuationModel * FluctModel()
G4GLOB_DLL std::ostream G4cout
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition *, const G4ParticleDefinition *)
const G4String & GetName() const
void BuildAsymmetryTables(const G4ParticleDefinition &part)
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)
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=0, const G4Region *region=0)
G4double MinKinEnergy() const
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
G4double ComputeSaturationFactor(const G4Track &aTrack)
void SetSecondaryParticle(const G4ParticleDefinition *p)
G4Material * GetMaterial() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
Definition: G4Positron.cc:94
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)
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
const G4double x[NPOINTSGL]
static G4EmParameters * Instance()
bool IsPolarized(G4LogicalVolume *lVol) const
void SetTargetPolarization(const G4ThreeVector &pTarget)
void SetEmModel(G4VEmModel *, G4int index=1)
G4VPhysicalVolume * GetVolume() const
static G4ThreeVector GetParticleFrameY(const G4ThreeVector &)
void insertAt(size_t, G4PhysicsVector *)
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
G4ParticleDefinition * theElectron
const G4String & GetName() const
double G4double
Definition: G4Types.hh:76
void SetBeamPolarization(const G4ThreeVector &pBeam)
void SetLowEnergyLimit(G4double)
Definition: G4VEmModel.hh:732
G4ForceCondition
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
virtual G4bool IsApplicable(const G4ParticleDefinition &p)
G4VEmFluctuationModel * flucModel
void clearAndDestroy()
G4PhysicsTable * theTransverseAsymmetryTable
size_t CurrentMaterialCutsCoupleIndex() const