Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions
G4DecayWithSpin Class Reference

#include <G4DecayWithSpin.hh>

Inheritance diagram for G4DecayWithSpin:
G4Decay G4VRestDiscreteProcess G4VProcess

Public Member Functions

 G4DecayWithSpin (const G4String &processName="DecayWithSpin")
 
virtual ~G4DecayWithSpin ()
 
- Public Member Functions inherited from G4Decay
 G4Decay (const G4String &processName="Decay")
 
virtual ~G4Decay ()
 
virtual G4VParticleChangePostStepDoIt (const G4Track &aTrack, const G4Step &aStep)
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &aTrack, const G4Step &aStep)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual G4bool IsApplicable (const G4ParticleDefinition &)
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &track, G4ForceCondition *condition)
 
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual void StartTracking (G4Track *)
 
virtual void EndTracking ()
 
void SetExtDecayer (G4VExtDecayer *)
 
const G4VExtDecayerGetExtDecayer () const
 
G4double GetRemainderLifeTime () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
- Public Member Functions inherited from G4VRestDiscreteProcess
 G4VRestDiscreteProcess (const G4String &, G4ProcessType aType=fNotDefined)
 
 G4VRestDiscreteProcess (G4VRestDiscreteProcess &)
 
virtual ~G4VRestDiscreteProcess ()
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &)
 
- Public Member Functions inherited from G4VProcess
 G4VProcess (const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
 
 G4VProcess (const G4VProcess &right)
 
virtual ~G4VProcess ()
 
G4int operator== (const G4VProcess &right) const
 
G4int operator!= (const G4VProcess &right) const
 
G4double GetCurrentInteractionLength () const
 
void SetPILfactor (G4double value)
 
G4double GetPILfactor () const
 
G4double AlongStepGPIL (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
 
G4double AtRestGPIL (const G4Track &track, G4ForceCondition *condition)
 
G4double PostStepGPIL (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual void PreparePhysicsTable (const G4ParticleDefinition &)
 
virtual G4bool StorePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
virtual G4bool RetrievePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
const G4StringGetPhysicsTableFileName (const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
 
const G4StringGetProcessName () const
 
G4ProcessType GetProcessType () const
 
void SetProcessType (G4ProcessType)
 
G4int GetProcessSubType () const
 
void SetProcessSubType (G4int)
 
virtual void SetProcessManager (const G4ProcessManager *)
 
virtual const G4ProcessManagerGetProcessManager ()
 
virtual void ResetNumberOfInteractionLengthLeft ()
 
G4double GetNumberOfInteractionLengthLeft () const
 
G4double GetTotalNumberOfInteractionLengthTraversed () const
 
G4bool isAtRestDoItIsEnabled () const
 
G4bool isAlongStepDoItIsEnabled () const
 
G4bool isPostStepDoItIsEnabled () const
 
virtual void DumpInfo () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
virtual void SetMasterProcess (G4VProcess *masterP)
 
const G4VProcessGetMasterProcess () const
 
virtual void BuildWorkerPhysicsTable (const G4ParticleDefinition &part)
 
virtual void PrepareWorkerPhysicsTable (const G4ParticleDefinition &)
 

Protected Member Functions

virtual G4VParticleChangeDecayIt (const G4Track &aTrack, const G4Step &aStep)
 
- Protected Member Functions inherited from G4Decay
virtual void DaughterPolarization (const G4Track &aTrack, G4DecayProducts *products)
 
virtual G4double GetMeanFreePath (const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
 
virtual G4double GetMeanLifeTime (const G4Track &aTrack, G4ForceCondition *condition)
 
- Protected Member Functions inherited from G4VProcess
void SubtractNumberOfInteractionLengthLeft (G4double previousStepSize)
 
void ClearNumberOfInteractionLengthLeft ()
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VProcess
static const G4StringGetProcessTypeName (G4ProcessType)
 
- Protected Attributes inherited from G4Decay
G4int verboseLevel
 
const G4double HighestValue
 
G4double fRemainderLifeTime
 
G4ParticleChangeForDecay fParticleChangeForDecay
 
G4VExtDecayerpExtDecayer
 
- Protected Attributes inherited from G4VProcess
const G4ProcessManageraProcessManager
 
G4VParticleChangepParticleChange
 
G4ParticleChange aParticleChange
 
G4double theNumberOfInteractionLengthLeft
 
G4double currentInteractionLength
 
G4double theInitialNumberOfInteractionLength
 
G4String theProcessName
 
G4String thePhysicsTableFileName
 
G4ProcessType theProcessType
 
G4int theProcessSubType
 
G4double thePILfactor
 
G4bool enableAtRestDoIt
 
G4bool enableAlongStepDoIt
 
G4bool enablePostStepDoIt
 
G4int verboseLevel
 

Detailed Description

Definition at line 43 of file G4DecayWithSpin.hh.

Constructor & Destructor Documentation

G4DecayWithSpin::G4DecayWithSpin ( const G4String processName = "DecayWithSpin")

Definition at line 52 of file G4DecayWithSpin.cc.

References DECAY_WithSpin, and G4VProcess::SetProcessSubType().

52  :G4Decay(processName)
53 {
54  // set Process Sub Type
55  SetProcessSubType(static_cast<int>(DECAY_WithSpin));
56 
57 }
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
G4Decay(const G4String &processName="Decay")
Definition: G4Decay.cc:63
G4DecayWithSpin::~G4DecayWithSpin ( )
virtual

Definition at line 59 of file G4DecayWithSpin.cc.

59 {}

Member Function Documentation

G4VParticleChange * G4DecayWithSpin::DecayIt ( const G4Track aTrack,
const G4Step aStep 
)
protectedvirtual

Reimplemented from G4Decay.

Definition at line 61 of file G4DecayWithSpin.cc.

References G4Decay::DecayIt(), G4Decay::fRemainderLifeTime, G4UniformRand, G4PropagatorInField::GetCurrentFieldManager(), G4ParticleDefinition::GetDecayTable(), G4DynamicParticle::GetDefinition(), G4FieldManager::GetDetectorField(), G4Track::GetDynamicParticle(), G4Track::GetGlobalTime(), G4DynamicParticle::GetPolarization(), G4StepPoint::GetPosition(), G4Step::GetPostStepPoint(), G4TransportationManager::GetPropagatorInField(), G4Step::GetTrack(), G4TransportationManager::GetTransportationManager(), G4Track::GetVolume(), CLHEP::Hep3Vector::mag2(), G4ParticleChangeForDecay::ProposePolarization(), G4DecayTable::SelectADecayChannel(), G4MuonDecayChannelWithSpin::SetPolarization(), CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), and python.hepunit::twopi.

62 {
63 
64 // get particle
65  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
66  const G4ParticleDefinition* aParticleDef = aParticle->GetDefinition();
67 
68 // get parent_polarization
69  G4ThreeVector parent_polarization = aParticle->GetPolarization();
70 
71  if(parent_polarization == G4ThreeVector(0,0,0))
72  {
73  // Generate random polarization direction
74 
75  G4double cost = 1. - 2.*G4UniformRand();
76  G4double sint = std::sqrt((1.-cost)*(1.+cost));
77 
79  G4double sinp = std::sin(phi);
80  G4double cosp = std::cos(phi);
81 
82  G4double px = sint*cosp;
83  G4double py = sint*sinp;
84  G4double pz = cost;
85 
86  parent_polarization.setX(px);
87  parent_polarization.setY(py);
88  parent_polarization.setZ(pz);
89 
90  }else{
91 
92  G4FieldManager* fieldMgr = aStep.GetTrack()->GetVolume()->
93  GetLogicalVolume()->GetFieldManager();
94 
95  if (!fieldMgr) {
96  G4TransportationManager *transportMgr =
98  G4PropagatorInField* fFieldPropagator =
99  transportMgr->GetPropagatorInField();
100  if (fFieldPropagator) fieldMgr =
101  fFieldPropagator->GetCurrentFieldManager();
102  }
103 
104  const G4Field* field = NULL;
105  if(fieldMgr)field = fieldMgr->GetDetectorField();
106 
107  if (field) {
108 
109  G4double point[4];
110  point[0] = (aStep.GetPostStepPoint()->GetPosition())[0];
111  point[1] = (aStep.GetPostStepPoint()->GetPosition())[1];
112  point[2] = (aStep.GetPostStepPoint()->GetPosition())[2];
113  point[3] = aTrack.GetGlobalTime();
114 
115  G4double fieldValue[6];
116  field -> GetFieldValue(point,fieldValue);
117 
118  G4ThreeVector B(fieldValue[0],fieldValue[1],fieldValue[2]);
119 
120  // Call the spin precession only for non-zero mag. field
121  if (B.mag2() > 0.) parent_polarization =
122  Spin_Precession(aStep,B,fRemainderLifeTime);
123 
124  }
125  }
126 
127 // decay table
128  G4DecayTable *decaytable = aParticleDef->GetDecayTable();
129 
130  if (decaytable) {
131  G4MuonDecayChannelWithSpin *decaychannel;
132  decaychannel = (G4MuonDecayChannelWithSpin*)decaytable->SelectADecayChannel();
133  if (decaychannel) decaychannel->SetPolarization(parent_polarization);
134  }
135 
136  G4ParticleChangeForDecay* pParticleChangeForDecay;
137 
138  pParticleChangeForDecay = (G4ParticleChangeForDecay*)G4Decay::DecayIt(aTrack,aStep);
139 
140  pParticleChangeForDecay->ProposePolarization(parent_polarization);
141 
142  return pParticleChangeForDecay;
143 
144 }
CLHEP::Hep3Vector G4ThreeVector
const G4DynamicParticle * GetDynamicParticle() const
G4ParticleDefinition * GetDefinition() const
void setY(double)
void setZ(double)
void setX(double)
virtual G4VParticleChange * DecayIt(const G4Track &aTrack, const G4Step &aStep)
Definition: G4Decay.cc:181
G4double fRemainderLifeTime
Definition: G4Decay.hh:175
G4DecayTable * GetDecayTable() const
#define G4UniformRand()
Definition: Randomize.hh:87
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4VDecayChannel * SelectADecayChannel()
Definition: G4DecayTable.cc:81
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetCurrentFieldManager()
G4StepPoint * GetPostStepPoint() const
const G4ThreeVector & GetPolarization() const
G4VPhysicalVolume * GetVolume() const
double G4double
Definition: G4Types.hh:76
const G4Field * GetDetectorField() const
G4Track * GetTrack() const
G4PropagatorInField * GetPropagatorInField() const
void ProposePolarization(G4double Px, G4double Py, G4double Pz)

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