74 theTargetPolarization(0.,0.,0.),
75 theAsymmetryTable(nullptr),
76 theTransverseAsymmetryTable(nullptr)
94void G4ePolarizedIonisation::CleanTables()
96 if(theAsymmetryTable) {
98 delete theAsymmetryTable;
99 theAsymmetryTable =
nullptr;
101 if(theTransverseAsymmetryTable) {
103 delete theTransverseAsymmetryTable;
104 theTransverseAsymmetryTable =
nullptr;
115 if(isElectron) { x += cut; }
145 isInitialised =
true;
162 if(theAsymmetryTable && theTransverseAsymmetryTable && mfp <
DBL_MAX) {
163 mfp *= ComputeSaturationFactor(track);
166 G4cout <<
"G4ePolarizedIonisation::MeanFreePath: "
167 << mfp / mm <<
" mm " <<
G4endl;
189 if(theAsymmetryTable && theTransverseAsymmetryTable && x <
DBL_MAX) {
190 satFact = ComputeSaturationFactor(track);
192 G4double prvLength = iLength*satFact;
195 std::max(nLength - step/prvLength, 0.0);
200 G4cout <<
"G4ePolarizedIonisation::PostStepGPIL: "
201 << std::setprecision(8) << x/mm <<
" mm;" <<
G4endl
202 <<
" unpolarized value: "
203 << std::setprecision(8) << x0/mm <<
" mm." <<
G4endl;
211G4ePolarizedIonisation::ComputeSaturationFactor(
const G4Track& track)
224 if (volumeIsPolarized && !volPolarization.
IsZero()) {
233 G4cout <<
"G4ePolarizedIonisation::ComputeSaturationFactor: " <<
G4endl;
237 G4cout <<
" MaterialPol. " << volPolarization <<
G4endl;
246 if(midx < theAsymmetryTable->size()) {
247 aVector = (*theAsymmetryTable)(midx);
249 if(midx < theTransverseAsymmetryTable->size()) {
250 bVector = (*theTransverseAsymmetryTable)(midx);
252 if(aVector && bVector) {
255 G4double polZZ = polarization.
z()*(volPolarization*direction0);
261 factor /= (1. + polZZ*lAsymmetry + (polXX + polYY)*tAsymmetry);
264 G4cout <<
" Asymmetry: " << lAsymmetry <<
", " << tAsymmetry <<
G4endl;
265 G4cout <<
" PolProduct: " << polXX <<
", " << polYY <<
", " << polZZ <<
G4endl;
270 ed <<
"Problem with asymmetry tables: material index " << midx
271 <<
" is out of range or tables are not filled";
272 G4Exception(
"G4ePolarizedIonisation::ComputeSaturationFactor",
"em0048",
289 if(masterProcess && masterProcess !=
this) { master =
false; }
290 if(master) { BuildAsymmetryTables(part); }
295void G4ePolarizedIonisation::BuildAsymmetryTables(
302 theTransverseAsymmetryTable =
309 for (
size_t j=0 ; j < numOfCouples; j++ ) {
320 for (
size_t i = 0 ; i < bins ; i++ ) {
323 G4double asym = ComputeAsymmetry(lowEdgeEnergy, couple, part, cut, tasm);
327 theAsymmetryTable->
insertAt( j , ptrVectorA ) ;
328 theTransverseAsymmetryTable->
insertAt( j , ptrVectorB ) ;
335G4ePolarizedIonisation::ComputeAsymmetry(
G4double energy,
343 if (isElectron) { lAsymmetry = tAsymmetry = -1.0; }
364 lAsymmetry=sigma2/sigma0 - 1.;
365 tAsymmetry=sigma3/sigma0 - 1.;
367 if (std::fabs(lAsymmetry)>1.) {
368 G4cout<<
"G4ePolarizedIonisation::ComputeAsymmetry WARNING: E(MeV)= "
369 <<
energy <<
" lAsymmetry= "<<lAsymmetry
370 <<
" ("<<std::fabs(lAsymmetry)-1.<<
")\n";
372 if (std::fabs(tAsymmetry)>1.) {
374 G4cout<<
"G4ePolarizedIonisation::ComputeAsymmetry WARNING: E(MeV)= "
375 <<
energy <<
" tAsymmetry= "<<tAsymmetry
376 <<
" ("<<std::fabs(tAsymmetry)-1.<<
")\n";
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 *)
G4double Energy(std::size_t index) const
G4double Value(G4double theEnergy, std::size_t &lastidx) const
void PutValue(std::size_t index, G4double theValue)
std::size_t GetVectorLength() const
static G4ThreeVector GetParticleFrameY(const G4ThreeVector &)
static G4ThreeVector GetParticleFrameX(const G4ThreeVector &)
bool IsPolarized(G4LogicalVolume *lVol) const
static G4PolarizationManager * GetInstance()
const G4ThreeVector & GetVolumePolarization(G4LogicalVolume *lVol) const
void SetBeamPolarization(const G4ThreeVector &pBeam)
void SetTargetPolarization(const G4ThreeVector &pTarget)
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 SetFluctModel(G4VEmFluctuationModel *)
G4PhysicsVector * LambdaPhysicsVector(const G4MaterialCutsCouple *, G4double cut)
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
void SetEmModel(G4VEmModel *, G4int index=0)
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=0, const G4Region *region=nullptr)
virtual void BuildPhysicsTable(const G4ParticleDefinition &) override
size_t CurrentMaterialCutsCoupleIndex() const
void SetSecondaryParticle(const G4ParticleDefinition *p)
G4VEmFluctuationModel * FluctModel()
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4double currentInteractionLength
const G4VProcess * GetMasterProcess() const
G4double theNumberOfInteractionLengthLeft
void SetProcessSubType(G4int)
G4ePolarizedIonisation(const G4String &name="pol-eIoni")
virtual void PrintInfo() override
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut) override
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
virtual G4bool IsApplicable(const G4ParticleDefinition &p) override
virtual ~G4ePolarizedIonisation()
virtual void BuildPhysicsTable(const G4ParticleDefinition &) override
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition *, const G4ParticleDefinition *) override
G4double energy(const ThreeVector &p, const G4double m)