52 , fAsymmetryTable(nullptr)
53 , fTransverseAsymmetryTable(nullptr)
55 , fIsInitialised(false)
70 out <<
"Polarized version of G4eIonisation.\n";
76void G4PolarizedIonisation::CleanTables()
81 delete fAsymmetryTable;
82 fAsymmetryTable =
nullptr;
84 if(fTransverseAsymmetryTable)
87 delete fTransverseAsymmetryTable;
88 fTransverseAsymmetryTable =
nullptr;
134 fIsInitialised =
true;
145 if(fAsymmetryTable && fTransverseAsymmetryTable && mfp <
DBL_MAX)
147 mfp *= ComputeSaturationFactor(track);
151 G4cout <<
"G4PolarizedIonisation::MeanFreePath: " << mfp / mm <<
" mm "
173 if(fAsymmetryTable && fTransverseAsymmetryTable && x <
DBL_MAX)
175 satFact = ComputeSaturationFactor(track);
177 G4double prvLength = iLength * satFact;
181 std::max(nLength - step / prvLength, 0.0);
187 G4cout <<
"G4PolarizedIonisation::PostStepGPIL: " << std::setprecision(8)
188 << x / mm <<
" mm;" <<
G4endl
189 <<
" unpolarized value: " << std::setprecision(8)
190 << x0 / mm <<
" mm." <<
G4endl;
196G4double G4PolarizedIonisation::ComputeSaturationFactor(
const G4Track& track)
211 if(volumeIsPolarized && !volPolarization.
IsZero())
221 G4cout <<
"G4PolarizedIonisation::ComputeSaturationFactor: " <<
G4endl;
225 G4cout <<
" MaterialPol. " << volPolarization <<
G4endl;
234 if(midx < fAsymmetryTable->size())
236 aVector = (*fAsymmetryTable)(midx);
238 if(midx < fTransverseAsymmetryTable->size())
240 bVector = (*fTransverseAsymmetryTable)(midx);
242 if(aVector && bVector)
246 G4double polZZ = polarization.
z() * (volPolarization * direction0);
254 factor /= (1. + polZZ * lAsymmetry + (polXX + polYY) * tAsymmetry);
258 G4cout <<
" Asymmetry: " << lAsymmetry <<
", " << tAsymmetry
260 G4cout <<
" PolProduct: " << polXX <<
", " << polYY <<
", " << polZZ
268 ed <<
"Problem with asymmetry tables: material index " << midx
269 <<
" is out of range or tables are not filled";
270 G4Exception(
"G4PolarizedIonisation::ComputeSaturationFactor",
"em0048",
285 if(masterProcess && masterProcess !=
this)
291 BuildAsymmetryTables(part);
296void G4PolarizedIonisation::BuildAsymmetryTables(
302 fTransverseAsymmetryTable =
309 for(
G4int j = 0; j < numOfCouples; ++j)
322 for(std::size_t i = 0; i < bins; ++i)
326 G4double asym = ComputeAsymmetry(lowEdgeEnergy, couple, part, cut, tasm);
330 fAsymmetryTable->
insertAt(j, ptrVectorA);
331 fTransverseAsymmetryTable->
insertAt(j, ptrVectorB);
336G4double G4PolarizedIonisation::ComputeAsymmetry(
344 lAsymmetry = tAsymmetry = -1.0;
352 fEmModel->
CrossSection(couple, &aParticle, energy, cut, energy);
359 fEmModel->
CrossSection(couple, &aParticle, energy, cut, energy);
366 fEmModel->
CrossSection(couple, &aParticle, energy, cut, energy);
370 lAsymmetry = sigma2 / sigma0 - 1.;
371 tAsymmetry = sigma3 / sigma0 - 1.;
373 if(std::fabs(lAsymmetry) > 1.)
376 ed <<
"G4PolarizedIonisation::ComputeAsymmetry : E(MeV)= " <<
energy
377 <<
" lAsymmetry= " << lAsymmetry <<
" (" << std::fabs(lAsymmetry) - 1.
379 G4Exception(
"G4PolarizedIonisation::ComputeAsymmetry",
"pol002",
382 if(std::fabs(tAsymmetry) > 1.)
385 ed <<
"G4PolarizedIonisation::ComputeAsymmetry : E(MeV)= " <<
energy
386 <<
" tAsymmetry= " << tAsymmetry <<
" (" << std::fabs(tAsymmetry) - 1.
388 G4Exception(
"G4PolarizedIonisation::ComputeAsymmetry",
"pol003",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
static G4Electron * Electron()
static G4EmParameters * Instance()
G4double MinKinEnergy() const
G4double MaxKinEnergy() const
const G4String & GetName() const
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
void insertAt(std::size_t, G4PhysicsVector *)
void PutValue(const std::size_t index, const G4double value)
G4double Energy(const std::size_t index) const
G4double Value(const G4double energy, std::size_t &lastidx) const
std::size_t GetVectorLength() const
static G4ThreeVector GetParticleFrameY(const G4ThreeVector &)
static G4ThreeVector GetParticleFrameX(const G4ThreeVector &)
bool IsPolarized(G4LogicalVolume *lVol) const
const G4StokesVector GetVolumePolarization(G4LogicalVolume *lVol) const
static G4PolarizationManager * GetInstance()
void SetTargetPolarization(const G4ThreeVector &pTarget)
void SetBeamPolarization(const G4ThreeVector &pBeam)
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut) override
G4PolarizedIonisation(const G4String &name="pol-eIoni")
virtual void ProcessDescription(std::ostream &) const override
virtual void BuildPhysicsTable(const G4ParticleDefinition &) override
virtual ~G4PolarizedIonisation() override
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition *, const G4ParticleDefinition *) override
virtual G4bool IsApplicable(const G4ParticleDefinition &p) override
static G4Positron * Positron()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
const std::vector< G4double > * GetEnergyCutsVector(std::size_t pcIdx) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4VPhysicalVolume * GetVolume() const
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
const G4ThreeVector & GetPolarization() const
void SetHighEnergyLimit(G4double)
void SetLowEnergyLimit(G4double)
G4double CrossSection(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=nullptr, const G4Region *region=nullptr)
void SetFluctModel(G4VEmFluctuationModel *)
G4PhysicsVector * LambdaPhysicsVector(const G4MaterialCutsCouple *, G4double cut)
void ProcessDescription(std::ostream &outFile) const override
std::size_t CurrentMaterialCutsCoupleIndex() const
G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
void SetEmModel(G4VEmModel *, G4int index=0)
G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
G4VEmFluctuationModel * FluctModel() const
void BuildPhysicsTable(const G4ParticleDefinition &) override
void SetSecondaryParticle(const G4ParticleDefinition *p)
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4double currentInteractionLength
const G4VProcess * GetMasterProcess() const
G4double theNumberOfInteractionLengthLeft
void SetProcessSubType(G4int)
G4double energy(const ThreeVector &p, const G4double m)