Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4QElastic Class Reference

#include <G4QElastic.hh>

+ Inheritance diagram for G4QElastic:

Public Member Functions

 G4QElastic (const G4String &processName="CHIPSElasticScattering")
 
 ~G4QElastic ()
 
G4bool IsApplicable (const G4ParticleDefinition &particle)
 
G4double GetMeanFreePath (const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
 
G4VParticleChangePostStepDoIt (const G4Track &aTrack, const G4Step &aStep)
 
G4LorentzVector GetEnegryMomentumConservation ()
 
G4int GetNumberOfNeutronsInTarget ()
 
- Public Member Functions inherited from G4VDiscreteProcess
 G4VDiscreteProcess (const G4String &, G4ProcessType aType=fNotDefined)
 
 G4VDiscreteProcess (G4VDiscreteProcess &)
 
virtual ~G4VDiscreteProcess ()
 
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual G4VParticleChangePostStepDoIt (const G4Track &, const G4Step &)
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &)
 
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
 
virtual G4VParticleChangePostStepDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)=0
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &track, G4ForceCondition *condition)=0
 
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)=0
 
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 G4bool IsApplicable (const G4ParticleDefinition &)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
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 StartTracking (G4Track *)
 
virtual void EndTracking ()
 
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
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VProcess
static const G4StringGetProcessTypeName (G4ProcessType)
 
virtual G4double GetMeanFreePath (const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)=0
 
- Protected Member Functions inherited from G4VProcess
void SubtractNumberOfInteractionLengthLeft (G4double previousStepSize)
 
void ClearNumberOfInteractionLengthLeft ()
 
- 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 69 of file G4QElastic.hh.

Constructor & Destructor Documentation

◆ G4QElastic()

G4QElastic::G4QElastic ( const G4String processName = "CHIPSElasticScattering")

Definition at line 56 of file G4QElastic.cc.

56 :
57 G4VDiscreteProcess(processName, fHadronic)
58{
59 G4HadronicDeprecate("G4QElastic");
60
61#ifdef debug
62 G4cout<<"G4QElastic::Constructor is called processName="<<processName<<G4endl;
63#endif
64 if (verboseLevel>0) G4cout << GetProcessName() << " process is created "<< G4endl;
65 //G4QCHIPSWorld::Get()->GetParticles(nPartCWorld); // Create CHIPS World (234 part. max)
66}
#define G4HadronicDeprecate(name)
@ fHadronic
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4int verboseLevel
Definition: G4VProcess.hh:368
const G4String & GetProcessName() const
Definition: G4VProcess.hh:379

◆ ~G4QElastic()

G4QElastic::~G4QElastic ( )

Definition at line 69 of file G4QElastic.cc.

69{}

Member Function Documentation

◆ GetEnegryMomentumConservation()

G4LorentzVector G4QElastic::GetEnegryMomentumConservation ( )

Definition at line 72 of file G4QElastic.cc.

72{return EnMomConservation;}

◆ GetMeanFreePath()

G4double G4QElastic::GetMeanFreePath ( const G4Track aTrack,
G4double  previousStepSize,
G4ForceCondition condition 
)
virtual

Implements G4VDiscreteProcess.

Definition at line 79 of file G4QElastic.cc.

80{
81 *Fc = NotForced;
82 const G4DynamicParticle* incidentParticle = aTrack.GetDynamicParticle();
83 G4ParticleDefinition* incidentParticleDefinition=incidentParticle->GetDefinition();
84 if( !IsApplicable(*incidentParticleDefinition))
85 G4cout<<"*W*G4QElastic::GetMeanFreePath: is called for notImplementedParticle"<<G4endl;
86 // Calculate the mean Cross Section for the set of Elements(*Isotopes) in the Material
87 G4double Momentum = incidentParticle->GetTotalMomentum(); // 3-momentum of the Particle
88#ifdef debug
89 G4double KinEn = incidentParticle->GetKineticEnergy();
90 G4cout<<"G4QElastic::GetMeanFreePath: kinE="<<KinEn<<",Mom="<<Momentum<<G4endl; // Result
91#endif
92 const G4Material* material = aTrack.GetMaterial(); // Get the current material
93 const G4double* NOfNucPerVolume = material->GetVecNbOfAtomsPerVolume();
94 const G4ElementVector* theElementVector = material->GetElementVector();
95 G4int nE=material->GetNumberOfElements();
96 G4int pPDG=0;
97 if (incidentParticleDefinition == G4Proton::Proton() ) pPDG=2212;
98 else if(incidentParticleDefinition == G4Neutron::Neutron() ) pPDG=2112;
99 else if(incidentParticleDefinition == G4PionPlus::PionPlus() ) pPDG= 211;
100 else if(incidentParticleDefinition == G4PionMinus::PionMinus() ) pPDG=-211;
101 else if(incidentParticleDefinition == G4KaonPlus::KaonPlus() ) pPDG= 321;
102 else if(incidentParticleDefinition == G4KaonMinus::KaonMinus() ) pPDG=-321;
103 else if(incidentParticleDefinition == G4KaonZeroLong::KaonZeroLong() ) pPDG= 130;
104 else if(incidentParticleDefinition == G4KaonZeroShort::KaonZeroShort() ) pPDG= 310;
105 else if(incidentParticleDefinition == G4Lambda::Lambda() ) pPDG= 3122;
106 else if(incidentParticleDefinition == G4SigmaPlus::SigmaPlus() ) pPDG= 3222;
107 else if(incidentParticleDefinition == G4SigmaMinus::SigmaMinus() ) pPDG= 3112;
108 else if(incidentParticleDefinition == G4SigmaZero::SigmaZero() ) pPDG= 3212;
109 else if(incidentParticleDefinition == G4XiMinus::XiMinus() ) pPDG= 3312;
110 else if(incidentParticleDefinition == G4XiZero::XiZero() ) pPDG= 3322;
111 else if(incidentParticleDefinition == G4OmegaMinus::OmegaMinus() ) pPDG= 3334;
112 else if(incidentParticleDefinition == G4AntiNeutron::AntiNeutron() ) pPDG=-2112;
113 else if(incidentParticleDefinition == G4AntiProton::AntiProton() ) pPDG=-2212;
114 else if(incidentParticleDefinition == G4AntiLambda::AntiLambda() ) pPDG=-3122;
115 else if(incidentParticleDefinition == G4AntiSigmaPlus::AntiSigmaPlus() ) pPDG=-3222;
116 else if(incidentParticleDefinition == G4AntiSigmaMinus::AntiSigmaMinus() ) pPDG=-3112;
117 else if(incidentParticleDefinition == G4AntiSigmaZero::AntiSigmaZero() ) pPDG=-3212;
118 else if(incidentParticleDefinition == G4AntiXiMinus::AntiXiMinus() ) pPDG=-3312;
119 else if(incidentParticleDefinition == G4AntiXiZero::AntiXiZero() ) pPDG=-3322;
120 else if(incidentParticleDefinition == G4AntiOmegaMinus::AntiOmegaMinus() ) pPDG=-3334;
121 else G4cout<<"Warning-G4QElastic::GetMFP:"<<incidentParticleDefinition->GetParticleName()
122 <<" isn't implemented (only SU(3) particles)"<<G4endl;
123#ifdef pdebug
124 G4cout<<"G4QElastic::GetMeanFreePath:"<<nE<<" Elem's in theMaterial,proj="<<pPDG<<G4endl;
125#endif
126 G4VQCrossSection* CSmanager=0;
127 G4VQCrossSection* CSmanager2=0;
128 if (pPDG==2212) CSmanager=G4QProtonElasticCrossSection::GetPointer();
129 else if(pPDG==2112) CSmanager=G4QNeutronElasticCrossSection::GetPointer();
130 else if(pPDG== 211) CSmanager=G4QPionPlusElasticCrossSection::GetPointer();
131 else if(pPDG==-211) CSmanager=G4QPionMinusElasticCrossSection::GetPointer();
132 else if(pPDG== 321) CSmanager=G4QKaonPlusElasticCrossSection::GetPointer();
133 else if(pPDG==-321) CSmanager=G4QKaonMinusElasticCrossSection::GetPointer();
134 else if(pPDG== 130 || pPDG== 310)
135 {
138 }
139 else if(pPDG==3222) CSmanager=G4QHyperonPlusElasticCrossSection::GetPointer();
140 else if(pPDG>3110 && pPDG<3335) CSmanager=G4QHyperonElasticCrossSection::GetPointer();
141 else if(pPDG>-3335&&pPDG<-1110) CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
142 else G4cout<<"*Warning*G4QElastic::GetMeanFreePath: wrong PDG="<<pPDG<<G4endl;
143 G4QIsotope* Isotopes = G4QIsotope::Get(); // Pointer to the G4QIsotopes singleton
144 G4double sigma=0.; // Sums over elements for the material
145 G4int IPIE=IsoProbInEl.size(); // How many old elements?
146 if(IPIE) for(G4int ip=0; ip<IPIE; ++ip) // Clean up the SumProb's of Isotopes (SPI)
147 {
148 std::vector<G4double>* SPI=IsoProbInEl[ip]; // Pointer to the SPI vector
149 SPI->clear();
150 delete SPI;
151 std::vector<G4int>* IsN=ElIsoN[ip]; // Pointer to the N vector
152 IsN->clear();
153 delete IsN;
154 }
155 ElProbInMat.clear(); // Clean up the SumProb's of Elements (SPE)
156 ElementZ.clear(); // Clear the body vector for Z of Elements
157 IsoProbInEl.clear(); // Clear the body vector for SPI
158 ElIsoN.clear(); // Clear the body vector for N of Isotopes
159 for(G4int i=0; i<nE; ++i)
160 {
161 G4Element* pElement=(*theElementVector)[i]; // Pointer to the current element
162 G4int Z = static_cast<G4int>(pElement->GetZ()); // Z of the Element
163 ElementZ.push_back(Z); // Remember Z of the Element
164 G4int isoSize=0; // The default for the isoVectorLength is 0
165 G4int indEl=0; // Index of non-natural element or 0(default)
166 G4IsotopeVector* isoVector=pElement->GetIsotopeVector(); // Get the predefined IsoVect
167 if(isoVector) isoSize=isoVector->size();// Get size of the existing isotopeVector
168#ifdef debug
169 G4cout<<"G4QElastic::GetMeanFreePath: isovectorLength="<<isoSize<<G4endl; // Result
170#endif
171 if(isoSize) // The Element has non-trivial abundance set
172 {
173 indEl=pElement->GetIndex()+1; // Index of the non-trivial element is an order
174#ifdef debug
175 G4cout<<"G4QEl::GetMFP: iE="<<indEl<<", def="<<Isotopes->IsDefined(Z,indEl)<<G4endl;
176#endif
177 if(!Isotopes->IsDefined(Z,indEl)) // This index is not defined for this Z: define
178 {
179 std::vector<std::pair<G4int,G4double>*>* newAbund =
180 new std::vector<std::pair<G4int,G4double>*>;
181 G4double* abuVector=pElement->GetRelativeAbundanceVector();
182 for(G4int j=0; j<isoSize; j++) // Calculation of abundance vector for isotopes
183 {
184 G4int N=pElement->GetIsotope(j)->GetN()-Z; // N means A=N+Z !
185 if(pElement->GetIsotope(j)->GetZ()!=Z)G4cerr<<"G4QElastic::GetMeanFreePath: Z="
186 <<pElement->GetIsotope(j)->GetZ()<<"#"<<Z<<G4endl;
187 G4double abund=abuVector[j];
188 std::pair<G4int,G4double>* pr= new std::pair<G4int,G4double>(N,abund);
189#ifdef debug
190 G4cout<<"G4QElastic::GetMeanFreePath:pair#="<<j<<",N="<<N<<",ab="<<abund<<G4endl;
191#endif
192 newAbund->push_back(pr);
193 }
194#ifdef debug
195 G4cout<<"G4QElastic::GetMeanFreePath: pairVectorLength="<<newAbund->size()<<G4endl;
196#endif
197 indEl=G4QIsotope::Get()->InitElement(Z,indEl,newAbund); // definition of the newInd
198 for(G4int k=0; k<isoSize; k++) delete (*newAbund)[k]; // Cleaning temporary
199 delete newAbund; // Was "new" in the beginning of the name space
200 }
201 }
202 std::vector<std::pair<G4int,G4double>*>* cs= Isotopes->GetCSVector(Z,indEl);//CSPointer
203 std::vector<G4double>* SPI = new std::vector<G4double>; // Pointer to the SPI vector
204 IsoProbInEl.push_back(SPI);
205 std::vector<G4int>* IsN = new std::vector<G4int>; // Pointer to the N vector
206 ElIsoN.push_back(IsN);
207 G4int nIs=cs->size(); // A#Of Isotopes in the Element
208#ifdef debug
209 G4cout<<"G4QEl::GMFP:=***=>,#isot="<<nIs<<", Z="<<Z<<", indEl="<<indEl<<G4endl;
210#endif
211 G4double susi=0.; // sum of CS over isotopes
212 if(nIs) for(G4int j=0; j<nIs; j++) // Calculate CS for eachIsotope of El
213 {
214 std::pair<G4int,G4double>* curIs=(*cs)[j]; // A pointer, which is used twice
215 G4int N=curIs->first; // #of Neuterons in the isotope j of El i
216 IsN->push_back(N); // Remember Min N for the Element
217#ifdef debug
218 G4cout<<"G4QEl::GMFP:*true*,P="<<Momentum<<",Z="<<Z<<",N="<<N<<",PDG="<<pPDG<<G4endl;
219#endif
220 G4bool ccsf=true;
221 if(Q==-27.) ccsf=false;
222#ifdef debug
223 G4cout<<"G4QEl::GMFP: GetCS #1 j="<<j<<G4endl;
224#endif
225 G4double CSI=0.; // Prototype of CS(j,i) for the isotope
226 if(!CSmanager2) CSI=CSmanager->GetCrossSection(ccsf,Momentum,Z,N,pPDG); // CS(j,i)
227 else CSI=(CSmanager->GetCrossSection(ccsf,Momentum,Z,N,-321)+
228 CSmanager2->GetCrossSection(ccsf,Momentum,Z,N,321) )/2.; // K0
229#ifdef debug
230 G4cout<<"G4QEl::GMFP: jI="<<j<<", Zt="<<Z<<", Nt="<<N<<", Mom="<<Momentum<<", XSec="
231 <<CSI/millibarn<<G4endl;
232#endif
233 curIs->second = CSI;
234 susi+=CSI; // Make a sum per isotopes
235 SPI->push_back(susi); // Remember summed cross-section
236 } // End of temporary initialization of the cross sections in the G4QIsotope singeltone
237 sigma+=Isotopes->GetMeanCrossSection(Z,indEl)*NOfNucPerVolume[i];//SUM(MeanCS*NOfNperV)
238#ifdef debug
239 G4cout<<"G4QEl::GMFP: <S>="<<Isotopes->GetMeanCrossSection(Z,indEl)<<", AddToSigma="
240 <<Isotopes->GetMeanCrossSection(Z,indEl)*NOfNucPerVolume[i]<<G4endl;
241#endif
242 ElProbInMat.push_back(sigma);
243 } // End of LOOP over Elements
244 // Check that cross section is not zero and return the mean free path
245#ifdef debug
246 G4cout<<"G4QElastic::GetMeanFreePath: MeanFreePath="<<1./sigma<<G4endl;
247#endif
248 if(sigma > 0.) return 1./sigma; // Mean path [distance]
249 return DBL_MAX;
250}
std::vector< G4Element * > G4ElementVector
@ NotForced
std::vector< G4Isotope * > G4IsotopeVector
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
G4DLLIMPORT std::ostream G4cerr
static G4AntiLambda * AntiLambda()
static G4AntiNeutron * AntiNeutron()
static G4AntiOmegaMinus * AntiOmegaMinus()
static G4AntiProton * AntiProton()
Definition: G4AntiProton.cc:93
static G4AntiSigmaMinus * AntiSigmaMinus()
static G4AntiSigmaPlus * AntiSigmaPlus()
static G4AntiSigmaZero * AntiSigmaZero()
static G4AntiXiMinus * AntiXiMinus()
static G4AntiXiZero * AntiXiZero()
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetTotalMomentum() const
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
G4double GetZ() const
Definition: G4Element.hh:131
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:169
size_t GetIndex() const
Definition: G4Element.hh:182
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
G4int GetZ() const
Definition: G4Isotope.hh:91
G4int GetN() const
Definition: G4Isotope.hh:94
static G4KaonMinus * KaonMinus()
Definition: G4KaonMinus.cc:113
static G4KaonPlus * KaonPlus()
Definition: G4KaonPlus.cc:113
static G4KaonZeroLong * KaonZeroLong()
static G4KaonZeroShort * KaonZeroShort()
static G4Lambda * Lambda()
Definition: G4Lambda.cc:108
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:189
size_t GetNumberOfElements() const
Definition: G4Material.hh:185
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:205
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4OmegaMinus * OmegaMinus()
const G4String & GetParticleName() const
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:98
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:98
static G4Proton * Proton()
Definition: G4Proton.cc:93
G4bool IsApplicable(const G4ParticleDefinition &particle)
Definition: G4QElastic.cc:253
std::vector< std::pair< G4int, G4double > * > * GetCSVector(G4int Z, G4int index=0)
Definition: G4QIsotope.cc:1737
G4bool IsDefined(G4int Z, G4int Ind)
Definition: G4QIsotope.cc:1660
G4double GetMeanCrossSection(G4int Z, G4int index=0)
Definition: G4QIsotope.cc:1842
static G4QIsotope * Get()
Definition: G4QIsotope.cc:720
G4int InitElement(G4int Z, G4int index, std::vector< std::pair< G4int, G4double > * > *abund)
Definition: G4QIsotope.cc:1557
static G4VQCrossSection * GetPointer()
static G4SigmaMinus * SigmaMinus()
static G4SigmaPlus * SigmaPlus()
Definition: G4SigmaPlus.cc:108
static G4SigmaZero * SigmaZero()
Definition: G4SigmaZero.cc:99
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
virtual G4double GetCrossSection(G4bool, G4double, G4int, G4int, G4int pPDG=0)
static G4XiMinus * XiMinus()
Definition: G4XiMinus.cc:106
static G4XiZero * XiZero()
Definition: G4XiZero.cc:106
#define DBL_MAX
Definition: templates.hh:83

Referenced by PostStepDoIt().

◆ GetNumberOfNeutronsInTarget()

G4int G4QElastic::GetNumberOfNeutronsInTarget ( )

Definition at line 74 of file G4QElastic.cc.

74{return nOfNeutrons;}

◆ IsApplicable()

G4bool G4QElastic::IsApplicable ( const G4ParticleDefinition particle)
virtual

Reimplemented from G4VProcess.

Definition at line 253 of file G4QElastic.cc.

254{
255 if (particle == *( G4Proton::Proton() )) return true;
256 else if (particle == *( G4Neutron::Neutron() )) return true;
257 else if (particle == *( G4MuonMinus::MuonMinus() )) return true;
258 else if (particle == *( G4TauPlus::TauPlus() )) return true;
259 else if (particle == *( G4TauMinus::TauMinus() )) return true;
260 else if (particle == *( G4Electron::Electron() )) return true;
261 else if (particle == *( G4Positron::Positron() )) return true;
262 else if (particle == *( G4Gamma::Gamma() )) return true;
263 else if (particle == *( G4MuonPlus::MuonPlus() )) return true;
264 else if (particle == *(G4AntiNeutrinoMu::AntiNeutrinoMu())) return true;
265 else if (particle == *( G4NeutrinoMu::NeutrinoMu() )) return true;
266 else if (particle == *( G4PionMinus::PionMinus() )) return true;
267 else if (particle == *( G4PionPlus::PionPlus() )) return true;
268 else if (particle == *( G4KaonPlus::KaonPlus() )) return true;
269 else if (particle == *( G4KaonMinus::KaonMinus() )) return true;
270 else if (particle == *( G4KaonZeroLong::KaonZeroLong() )) return true;
271 else if (particle == *( G4KaonZeroShort::KaonZeroShort() )) return true;
272 else if (particle == *( G4Lambda::Lambda() )) return true;
273 else if (particle == *( G4SigmaPlus::SigmaPlus() )) return true;
274 else if (particle == *( G4SigmaMinus::SigmaMinus() )) return true;
275 else if (particle == *( G4SigmaZero::SigmaZero() )) return true;
276 else if (particle == *( G4XiMinus::XiMinus() )) return true;
277 else if (particle == *( G4XiZero::XiZero() )) return true;
278 else if (particle == *( G4OmegaMinus::OmegaMinus() )) return true;
279 else if (particle == *( G4AntiNeutron::AntiNeutron() )) return true;
280 else if (particle == *( G4AntiProton::AntiProton() )) return true;
281#ifdef debug
282 G4cout<<"***>>G4QElastic::IsApplicable: PDG="<<particle.GetPDGEncoding()<<G4endl;
283#endif
284 return false;
285}
static G4AntiNeutrinoMu * AntiNeutrinoMu()
static G4Electron * Electron()
Definition: G4Electron.cc:94
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4MuonMinus * MuonMinus()
Definition: G4MuonMinus.cc:100
static G4MuonPlus * MuonPlus()
Definition: G4MuonPlus.cc:99
static G4NeutrinoMu * NeutrinoMu()
Definition: G4NeutrinoMu.cc:85
static G4Positron * Positron()
Definition: G4Positron.cc:94
static G4TauMinus * TauMinus()
Definition: G4TauMinus.cc:135
static G4TauPlus * TauPlus()
Definition: G4TauPlus.cc:134

Referenced by GetMeanFreePath(), and PostStepDoIt().

◆ PostStepDoIt()

G4VParticleChange * G4QElastic::PostStepDoIt ( const G4Track aTrack,
const G4Step aStep 
)
virtual

Reimplemented from G4VDiscreteProcess.

Definition at line 287 of file G4QElastic.cc.

288{
289 //static const G4double mProt=G4Proton::Proton()->GetPDGMass()*GeV;// proton mass in GeV
290 //static const G4double mProt= G4QPDGCode(2212).GetMass()*.001; // CHIPS m_p in GeV
291 //static const G4double mP2=mProt*mProt; // squared proton mass
292 //
293 //-------------------------------------------------------------------------------------
294 static G4bool CWinit = true; // CHIPS Warld needs to be initted
295 if(CWinit)
296 {
297 CWinit=false;
298 G4QCHIPSWorld::Get()->GetParticles(nPartCWorld); // Create CHIPS World (234 part.max)
299 }
300 //-------------------------------------------------------------------------------------
301 const G4DynamicParticle* projHadron = track.GetDynamicParticle();
302 const G4ParticleDefinition* particle=projHadron->GetDefinition();
303#ifdef debug
304 G4cout<<"G4QElastic::PostStepDoIt: Before the GetMeanFreePath is called In4M="
305 <<projHadron->Get4Momentum()<<" of PDG="<<particle->GetPDGEncoding()<<", Type="
306 <<particle->GetParticleType()<<", Subtp="<<particle->GetParticleSubType()<<G4endl;
307#endif
309 GetMeanFreePath(track, -27., &cond); // @@ ?? jus to update parameters?
310#ifdef debug
311 G4cout<<"G4QElastic::PostStepDoIt: After the GetMeanFreePath is called"<<G4endl;
312#endif
313 G4LorentzVector proj4M=(projHadron->Get4Momentum())/MeV; // Convert to MeV!
314 G4LorentzVector scat4M=proj4M; // @@ Must be filled (?)
315 G4double momentum = projHadron->GetTotalMomentum()/MeV; // 3-momentum of the Proj in MeV
316 G4double Momentum = proj4M.rho(); // @@ Just for the test purposes
317 if(std::fabs(Momentum-momentum)>.000001)
318 G4cerr<<"*War*G4QElastic::PostStepDoIt:P(IU)="<<Momentum<<"#"<<momentum<<G4endl;
319 G4double pM2=proj4M.m2(); // in MeV^2
320 G4double pM=std::sqrt(pM2); // in MeV
321#ifdef debug
322 G4cout<<"G4QElastic::PostStepDoIt: pP(IU)="<<Momentum<<"="<<momentum<<",pM="<<pM
323 <<",scat4M="<<scat4M<<scat4M.m()<<G4endl;
324#endif
325 if (!IsApplicable(*particle)) // Check applicability
326 {
327 G4cerr<<"G4QElastic::PostStepDoIt: Only NA elastic is implemented."<<G4endl;
328 return 0;
329 }
330 const G4Material* material = track.GetMaterial(); // Get the current material
331 const G4ElementVector* theElementVector = material->GetElementVector();
332 G4int nE=material->GetNumberOfElements();
333#ifdef debug
334 G4cout<<"G4QElastic::PostStepDoIt: "<<nE<<" elements in the material."<<G4endl;
335#endif
336 G4int projPDG=0; // PDG Code prototype for the captured hadron
337 // Not all these particles are implemented yet (see Is Applicable)
338 if (particle == G4Proton::Proton() ) projPDG= 2212;
339 else if (particle == G4Neutron::Neutron() ) projPDG= 2112;
340 else if (particle == G4PionMinus::PionMinus() ) projPDG= -211;
341 else if (particle == G4PionPlus::PionPlus() ) projPDG= 211;
342 else if (particle == G4KaonPlus::KaonPlus() ) projPDG= 2112;
343 else if (particle == G4KaonMinus::KaonMinus() ) projPDG= -321;
344 else if (particle == G4KaonZeroLong::KaonZeroLong() ) projPDG= 130;
345 else if (particle == G4KaonZeroShort::KaonZeroShort() ) projPDG= 310;
346 //else if (particle == G4MuonPlus::MuonPlus() ) projPDG= -13;
347 //else if (particle == G4MuonMinus::MuonMinus() ) projPDG= 13;
348 //else if (particle == G4NeutrinoMu::NeutrinoMu() ) projPDG= 14;
349 //else if (particle == G4AntiNeutrinoMu::AntiNeutrinoMu() ) projPDG= -14;
350 //else if (particle == G4Electron::Electron() ) projPDG= 11;
351 //else if (particle == G4Positron::Positron() ) projPDG= -11;
352 //else if (particle == G4NeutrinoE::NeutrinoE() ) projPDG= 12;
353 //else if (particle == G4AntiNeutrinoE::AntiNeutrinoE() ) projPDG= -12;
354 //else if (particle == G4Gamma::Gamma() ) projPDG= 22;
355 //else if (particle == G4TauPlus::TauPlus() ) projPDG= -15;
356 //else if (particle == G4TauMinus::TauMinus() ) projPDG= 15;
357 //else if (particle == G4NeutrinoTau::NeutrinoTau() ) projPDG= 16;
358 //else if (particle == G4AntiNeutrinoTau::AntiNeutrinoTau()) projPDG= -16;
359 else if (particle == G4Lambda::Lambda() ) projPDG= 3122;
360 else if (particle == G4SigmaPlus::SigmaPlus() ) projPDG= 3222;
361 else if (particle == G4SigmaMinus::SigmaMinus() ) projPDG= 3112;
362 else if (particle == G4SigmaZero::SigmaZero() ) projPDG= 3212;
363 else if (particle == G4XiMinus::XiMinus() ) projPDG= 3312;
364 else if (particle == G4XiZero::XiZero() ) projPDG= 3322;
365 else if (particle == G4OmegaMinus::OmegaMinus() ) projPDG= 3334;
366 else if (particle == G4AntiNeutron::AntiNeutron() ) projPDG=-2112;
367 else if (particle == G4AntiProton::AntiProton() ) projPDG=-2212;
368 else if (particle == G4AntiLambda::AntiLambda() ) projPDG=-3122;
369 else if (particle == G4AntiSigmaPlus::AntiSigmaPlus() ) projPDG=-3222;
370 else if (particle == G4AntiSigmaMinus::AntiSigmaMinus() ) projPDG=-3112;
371 else if (particle == G4AntiSigmaZero::AntiSigmaZero() ) projPDG=-3212;
372 else if (particle == G4AntiXiMinus::AntiXiMinus() ) projPDG=-3312;
373 else if (particle == G4AntiXiZero::AntiXiZero() ) projPDG=-3322;
374 else if (particle == G4AntiOmegaMinus::AntiOmegaMinus() ) projPDG=-3334;
375#ifdef pdebug
376 G4int prPDG=particle->GetPDGEncoding();
377 G4cout<<"G4QElastic::PostStepDoIt: projPDG="<<projPDG<<", stPDG="<<prPDG<<G4endl;
378#endif
379 if(!projPDG)
380 {
381 G4cerr<<"*Warning*G4QElastic::PostStepDoIt: Undefined interacting hadron"<<G4endl;
382 return 0;
383 }
384 G4int EPIM=ElProbInMat.size();
385#ifdef debug
386 G4cout<<"G4QElastic::PostStDoIt:m="<<EPIM<<",n="<<nE<<",T="<<ElProbInMat[EPIM-1]<<G4endl;
387#endif
388 G4int i=0;
389 if(EPIM>1)
390 {
391 G4double rnd = ElProbInMat[EPIM-1]*G4UniformRand();
392 for(i=0; i<nE; ++i)
393 {
394#ifdef debug
395 G4cout<<"G4QElastic::PostStepDoIt:EPM["<<i<<"]="<<ElProbInMat[i]<<",r="<<rnd<<G4endl;
396#endif
397 if (rnd<ElProbInMat[i]) break;
398 }
399 if(i>=nE) i=nE-1; // Top limit for the Element
400 }
401 G4Element* pElement=(*theElementVector)[i];
402 G4int Z=static_cast<G4int>(pElement->GetZ());
403#ifdef debug
404 G4cout<<"G4QElastic::PostStepDoIt: i="<<i<<", Z(element)="<<Z<<G4endl;
405#endif
406 if(Z<=0)
407 {
408 G4cerr<<"---Warning---G4QElastic::PostStepDoIt: Element with Z="<<Z<<G4endl;
409 if(Z<0) return 0;
410 }
411 std::vector<G4double>* SPI = IsoProbInEl[i];// Vector of summedProbabilities for isotopes
412 std::vector<G4int>* IsN = ElIsoN[i]; // Vector of "#of neutrons" in the isotope El[i]
413 G4int nofIsot=SPI->size(); // #of isotopes in the element i
414#ifdef debug
415 G4cout<<"G4QElastic::PosStDoIt: nI="<<nofIsot<<",T="<<(*SPI)[nofIsot-1]<<G4endl;
416#endif
417 G4int j=0;
418 if(nofIsot>1)
419 {
420 G4double rndI=(*SPI)[nofIsot-1]*G4UniformRand(); // Randomize the isotop of the Element
421 for(j=0; j<nofIsot; ++j)
422 {
423#ifdef debug
424 G4cout<<"G4QElastic::PostStepDoIt: SP["<<j<<"]="<<(*SPI)[j]<<", r="<<rndI<<G4endl;
425#endif
426 if(rndI < (*SPI)[j]) break;
427 }
428 if(j>=nofIsot) j=nofIsot-1; // Top limit for the isotope
429 }
430 G4int N =(*IsN)[j]; ; // Randomized number of neutrons
431#ifdef debug
432 G4cout<<"G4QElastic::PostStepDoIt: j="<<i<<", N(isotope)="<<N<<", MeV="<<MeV<<G4endl;
433#endif
434 if(N<0)
435 {
436 G4cerr<<"*Warning*G4QElastic::PostStepDoIt: Isotope with Z="<<Z<<", 0>N="<<N<<G4endl;
437 return 0;
438 }
439 nOfNeutrons=N; // Remember it for the energy-momentum check
440#ifdef debug
441 G4cout<<"G4QElastic::PostStepDoIt: N="<<N<<" for element with Z="<<Z<<G4endl;
442#endif
444#ifdef debug
445 G4cout<<"G4QElastic::PostStepDoIt: track is initialized"<<G4endl;
446#endif
447 G4double weight = track.GetWeight();
448 G4double localtime = track.GetGlobalTime();
449 G4ThreeVector position = track.GetPosition();
450#ifdef debug
451 G4cout<<"G4QElastic::PostStepDoIt: before Touchable extraction"<<G4endl;
452#endif
453 G4TouchableHandle trTouchable = track.GetTouchableHandle();
454#ifdef debug
455 G4cout<<"G4QElastic::PostStepDoIt: Touchable is extracted"<<G4endl;
456#endif
457 //
458 G4int targPDG=90000000+Z*1000+N; // CHIPS PDG Code of the target nucleus
459 G4QPDGCode targQPDG(targPDG); // @@ one can use G4Ion & get rid of CHIPSWorld
460 G4double tM=targQPDG.GetMass(); // CHIPS target mass in MeV
461 G4double kinEnergy= projHadron->GetKineticEnergy()*MeV; // Kin energy in MeV (Is *MeV n?)
462 G4ParticleMomentum dir = projHadron->GetMomentumDirection();// It is a unit three-vector
463 G4LorentzVector tot4M=proj4M+G4LorentzVector(0.,0.,0.,tM); // Total 4-mom of the reaction
464#ifdef debug
465 G4cout<<"G4QElastic::PostStepDoIt: tM="<<tM<<", p4M="<<proj4M<<", t4M="<<tot4M<<G4endl;
466#endif
467 EnMomConservation=tot4M; // Total 4-mom of reaction for E/M conservation
468 G4VQCrossSection* CSmanager=0;
469 G4VQCrossSection* CSmanager2=0;
470 if (projPDG==2212) CSmanager=G4QProtonElasticCrossSection::GetPointer();
471 else if(projPDG==2112) CSmanager=G4QNeutronElasticCrossSection::GetPointer();
472 else if(projPDG== 211) CSmanager=G4QPionPlusElasticCrossSection::GetPointer();
473 else if(projPDG==-211) CSmanager=G4QPionMinusElasticCrossSection::GetPointer();
474 else if(projPDG== 321) CSmanager=G4QKaonPlusElasticCrossSection::GetPointer();
475 else if(projPDG==-321) CSmanager=G4QKaonMinusElasticCrossSection::GetPointer();
476 else if(projPDG== 130 || projPDG== 310)
477 {
480 }
481 else if(projPDG==3222) CSmanager=G4QHyperonPlusElasticCrossSection::GetPointer();
482 else if(projPDG>3110&&projPDG<3335)CSmanager=G4QHyperonElasticCrossSection::GetPointer();
483 else if(projPDG>-3335 && projPDG<-1110)
485 else G4cout<<"*Warning*G4QElastic::PostStepDoIt: wrong PDG="<<projPDG<<G4endl;
486#ifdef debug
487 G4cout<<"G4QElas::PSDI:false,P="<<Momentum<<",Z="<<Z<<",N="<<N<<",PDG="<<projPDG<<G4endl;
488#endif
489 G4double xSec=0.;
490 if(!CSmanager2) xSec=CSmanager->GetCrossSection(false,Momentum,Z,N,projPDG); //ReactionCS
491 else xSec=(CSmanager->GetCrossSection(false,Momentum,Z,N,-321)+
492 CSmanager2->GetCrossSection(false,Momentum,Z,N,321) )/2.; // K0
493#ifdef debug
494 G4cout<<"G4QElast::PSDI:pPDG="<<projPDG<<",P="<<Momentum<<",CS="<<xSec/millibarn<<G4endl;
495#endif
496#ifdef nandebug
497 if(xSec>0. || xSec<0. || xSec==0);
498 else G4cout<<"*Warning*G4QElastic::PostStDoIt: xSec="<<xSec/millibarn<<G4endl;
499#endif
500 // @@ check a possibility to separate p, n, or alpha (!)
501 if(xSec <= 0.) // The cross-section iz 0 -> Do Nothing
502 {
503#ifdef debug
504 G4cerr<<"*Warning*G4QElastic::PostStDoIt: *Zero cross-section* PDG="<<projPDG<<",tPDG="
505 <<targPDG<<",P="<<Momentum<<G4endl;
506#endif
507 //Do Nothing Action insead of the reaction
511 return G4VDiscreteProcess::PostStepDoIt(track,step);
512 }
513 G4double mint=CSmanager->GetExchangeT(Z, N, projPDG); // functional rand -t(MeV^2)
514#ifdef debug
515 G4cout<<"G4QElast::PSDI:pPDG="<<projPDG<<",tPDG="<<targPDG<<",P="<<Momentum<<",CS="
516 <<xSec<<",-t="<<mint<<G4endl;
517#endif
518#ifdef nandebug
519 if(mint>-.0000001);
520 else G4cout<<"*Warning*G4QElastic::PostStDoIt:-t="<<mint<<G4endl;
521#endif
522 G4double maxt=CSmanager->GetHMaxT(); // max -t (MeV^2)
523 G4double cost=1.-mint/maxt; // cos(theta) in CMS
524 //
525#ifdef ppdebug
526 G4cout<<"G4QElastic::PoStDoI:t="<<mint<<", maxt="<<maxt<<",Ek="<<kinEnergy<<",tM="<<tM
527 <<",pM="<<pM<<",cost="<<cost<<G4endl;
528#endif
529 if(cost>1. || cost<-1. || !(cost>-1. || cost<1.))
530 {
531 if(cost>1.000001 || cost<-1.000001 || !(cost>-1. || cost<1.))
532 {
533 G4double tM2=tM*tM; // Squared target mass
534 G4double pEn=pM+kinEnergy; // tot projectile Energy in MeV
535 G4double sM=(tM+tM)*pEn+tM2+pM2; // Mondelstam s
536 G4double twop2cm=(tM2+tM2)*(pEn*pEn-pM2)/sM;// Max_t/2 (2*p^2_cm)
537 G4cout<<"*Warning*G4QElastic::PostStepDoIt:cos="<<cost<<",t="<<mint<<",T="<<kinEnergy
538 <<",tM="<<tM<<",tmax="<<2*kinEnergy*tM<<",p="<<projPDG<<",t="<<targPDG<<G4endl;
539 G4cout<<"..G4QElastic::PoStDoI: dpcm2="<<twop2cm<<"="<<maxt<<G4endl;
540 }
541 if (cost>1.) cost=1.;
542 else if(cost<-1.) cost=-1.;
543 }
544 G4LorentzVector reco4M=G4LorentzVector(0.,0.,0.,tM); // 4mom of the recoil target
545 G4LorentzVector dir4M=tot4M-G4LorentzVector(0.,0.,0.,(tot4M.e()-tM-pM)*.01);
546 if(!G4QHadron(tot4M).RelDecayIn2(scat4M, reco4M, dir4M, cost, cost))
547 {
548 G4cerr<<"G4QElastic::PSD:t4M="<<tot4M<<",pM="<<pM<<",tM="<<tM<<",cost="<<cost<<G4endl;
549 //G4Exception("G4QElastic::PostStepDoIt:","009",FatalException,"Decay of ElasticComp");
550 }
551#ifdef debug
552 G4cout<<"G4QElastic::PoStDoIt:s4M="<<scat4M<<"+r4M="<<reco4M<<"="<<scat4M+reco4M<<G4endl;
553 G4cout<<"G4QElastic::PoStDoIt: scatE="<<scat4M.e()-pM<<", recoE="<<reco4M.e()-tM<<",d4M="
554 <<tot4M-scat4M-reco4M<<G4endl;
555#endif
556 // Update G4VParticleChange for the scattered projectile
557 G4double finE=scat4M.e()-pM; // Final kinetic energy of the scattered proton
558 if(finE>0.0) aParticleChange.ProposeEnergy(finE);
559 else
560 {
561 if(finE<-1.e-8 || !(finE>-1.||finE<1.)) // NAN or negative
562 G4cerr<<"*Warning*G4QElastic::PostStDoIt: Zero or negative scattered E="<<finE
563 <<", s4M="<<scat4M<<", r4M="<<reco4M<<", d4M="<<tot4M-scat4M-reco4M<<G4endl;
564 //G4Exception("G4QElastic::PostStDoIt()","009", FatalException," <0 or nan energy");
567 }
568 G4ThreeVector findir=scat4M.vect()/scat4M.rho(); // Unit vector in new direction
569 aParticleChange.ProposeMomentumDirection(findir); // new direction for the scattered part
570 EnMomConservation-=scat4M; // It must be initialized by (pE+tM,pP)
571 // This is how in general the secondary should be identified
572 G4DynamicParticle* theSec = new G4DynamicParticle; // A secondary for the recoil hadron
573 G4int aA = Z+N;
574#ifdef debug
575 G4cout<<"G4QElastic::PostStepDoIt: Ion Z="<<Z<<", A="<<aA<<G4endl;
576#endif
578 ->FindIon(Z,aA,0,Z);
579 if(!theDefinition)G4cout<<"*Warning*G4QElastic::PostStepDoIt:drop PDG="<<targPDG<<G4endl;
580#ifdef debug
581 G4cout<<"G4QElastic::PostStepDoIt:RecoilName="<<theDefinition->GetParticleName()<<G4endl;
582#endif
583 theSec->SetDefinition(theDefinition);
584
585 EnMomConservation-=reco4M;
586#ifdef tdebug
587 G4cout<<"G4QElastic::PostSDoIt:"<<targPDG<<reco4M<<reco4M.m()<<EnMomConservation<<G4endl;
588#endif
589 theSec->Set4Momentum(reco4M);
590#ifdef debug
591 G4ThreeVector curD=theSec->GetMomentumDirection();
592 G4double curM=theSec->GetMass();
593 G4double curE=theSec->GetKineticEnergy()+curM;
594 G4cout<<"G4QElastic::PSDoIt:p="<<curD<<curD.mag()<<",e="<<curE<<",m="<<curM<<G4endl;
595#endif
596 // Make a recoil nucleus
597 G4Track* aNewTrack = new G4Track(theSec, localtime, position );
598 aNewTrack->SetWeight(weight); // weighted
599 aNewTrack->SetTouchableHandle(trTouchable);
600 aParticleChange.AddSecondary( aNewTrack );
601#ifdef debug
602 G4cout<<"G4QElastic::PostStepDoIt: **** PostStepDoIt is done ****"<<G4endl;
603#endif
604 return G4VDiscreteProcess::PostStepDoIt(track, step);
605}
G4ForceCondition
CLHEP::HepLorentzVector G4LorentzVector
@ fStopButAlive
#define G4UniformRand()
Definition: Randomize.hh:53
double mag() const
Hep3Vector vect() const
G4double GetMass() const
const G4ThreeVector & GetMomentumDirection() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4LorentzVector Get4Momentum() const
void Set4Momentum(const G4LorentzVector &momentum)
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:576
void AddSecondary(G4Track *aSecondary)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
virtual void Initialize(const G4Track &)
const G4String & GetParticleType() const
const G4String & GetParticleSubType() const
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
static G4ParticleTable * GetParticleTable()
static G4QCHIPSWorld * Get()
G4QParticleVector * GetParticles(G4int nOfParts=0)
G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
Definition: G4QElastic.cc:79
void SetWeight(G4double aValue)
void SetTouchableHandle(const G4TouchableHandle &apValue)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:289
virtual G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
virtual G4double GetHMaxT()

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