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

#include <G4QNGamma.hh>

+ Inheritance diagram for G4QNGamma:

Public Member Functions

 G4QNGamma (const G4String &processName="CHIPS_N-Gamma")
 
 ~G4QNGamma ()
 
G4bool IsApplicable (const G4ParticleDefinition &particle)
 
G4double GetMeanFreePath (const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
 
G4VParticleChangePostStepDoIt (const G4Track &aTrack, const G4Step &aStep)
 
void SetPhysicsTableBining (G4double, G4double, G4int)
 
void BuildPhysicsTable (const G4ParticleDefinition &)
 
void PrintInfoDefinition ()
 
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 66 of file G4QNGamma.hh.

Constructor & Destructor Documentation

◆ G4QNGamma()

G4QNGamma::G4QNGamma ( const G4String processName = "CHIPS_N-Gamma")

Definition at line 53 of file G4QNGamma.cc.

54 : G4VDiscreteProcess(processName, fHadronic)
55{
56 G4HadronicDeprecate("G4QNGamma");
57
58 EnMomConservation = G4LorentzVector(0.,0.,0.,0.);
59 nOfNeutrons = 0;
60#ifdef debug
61 G4cout<<"G4QNGamma::Constructor is called"<<G4endl;
62#endif
63 if (verboseLevel>0) G4cout << GetProcessName() << " process is created "<< G4endl;
64}
#define G4HadronicDeprecate(name)
CLHEP::HepLorentzVector G4LorentzVector
@ 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

◆ ~G4QNGamma()

G4QNGamma::~G4QNGamma ( )

Definition at line 67 of file G4QNGamma.cc.

68{
69 // The following is just a copy of what is done in PostStepDoIt every interaction !
70 // The correction is if(IPIE), so just for(...;ip<IPIE;...) does not work ! @@
71 G4int IPIE=IsoProbInEl.size(); // How many old elements?
72 if(IPIE) for(G4int ip=0; ip<IPIE; ++ip) // Clean up the SumProb's of Isotopes (SPI)
73 {
74 std::vector<G4double>* SPI=IsoProbInEl[ip]; // Pointer to the SPI vector
75 SPI->clear();
76 delete SPI;
77 std::vector<G4int>* IsN=ElIsoN[ip]; // Pointer to the N vector
78 IsN->clear();
79 delete IsN;
80 }
81 ElProbInMat.clear(); // Clean up the SumProb's of Elements (SPE)
82 ElementZ.clear(); // Clear the body vector for Z of Elements
83 IsoProbInEl.clear(); // Clear the body vector for SPI
84 ElIsoN.clear(); // Clear the body vector for N of Isotopes
85}
int G4int
Definition: G4Types.hh:66

Member Function Documentation

◆ BuildPhysicsTable()

void G4QNGamma::BuildPhysicsTable ( const G4ParticleDefinition )
inlinevirtual

Reimplemented from G4VProcess.

Definition at line 95 of file G4QNGamma.hh.

95{;}

◆ GetEnegryMomentumConservation()

G4LorentzVector G4QNGamma::GetEnegryMomentumConservation ( )

Definition at line 88 of file G4QNGamma.cc.

89{
90 return EnMomConservation;
91}

◆ GetMeanFreePath()

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

Implements G4VDiscreteProcess.

Definition at line 102 of file G4QNGamma.cc.

103{
104#ifdef debug
105 G4cout<<"G4QNGamma::GetMeanFreePath: Called Fc="<<*Fc<<G4endl;
106#endif
107 *Fc = NotForced;
108#ifdef debug
109 G4cout<<"G4QNGamma::GetMeanFreePath: Before GetDynPart"<<G4endl;
110#endif
111 const G4DynamicParticle* incidentParticle = aTrack.GetDynamicParticle();
112#ifdef debug
113 G4cout<<"G4QNGamma::GetMeanFreePath: Before GetDef"<<G4endl;
114#endif
115 G4ParticleDefinition* incidentParticleDefinition=incidentParticle->GetDefinition();
116 G4double Momentum = incidentParticle->GetTotalMomentum(); // 3-momentum of the Particle
117 if( !IsApplicable(*incidentParticleDefinition)) // @@ Unique for all QProcesses
118 {
119 G4cout<<"-W-G4QNGamma::GetMeanFreePath called for not implemented particle"<<G4endl;
120 return DBL_MAX;
121 }
122#ifdef debug
123 G4cout<<"G4QNGamma::GetMeanFreePath: BeforeGetMaterial P="<<Momentum<<G4endl;
124#endif
125 // @@ Can be additional condition internal function of G4VQProcess
126 if(Momentum > 500.) return DBL_MAX; // @@ Temporary cut (QInternal=MeV -> IU!)
127 // @@ This is a standard procedure, which can be moved to G4VQProcess (above is a funct)
128 const G4Material* material = aTrack.GetMaterial(); // Get the current material
129 const G4double* NOfNucPerVolume = material->GetVecNbOfAtomsPerVolume();
130 const G4ElementVector* theElementVector = material->GetElementVector();
131 G4int nE=material->GetNumberOfElements();
132#ifdef debug
133 G4cout<<"G4QNGamma::GetMeanFreePath:"<<nE<<" Elem's in theMaterial"<<G4endl;
134#endif
135 // @@ Can be internal function called by GetMeanFreePath (above Isotope LOOP)
136 G4VQCrossSection* CSmanager = 0; // @@ Reference modified in the function
137 G4QNeutronCaptureRatio* capMan = 0; // @@ Reference modified in the function
138 G4int pPDG =0; // @@ Reference modified in the function
139 G4double sigma =0.; // CS mean over isotopes @@ Reference modified in the function
140 if(incidentParticleDefinition == G4Neutron::Neutron())
141 {
143 capMan=G4QNeutronCaptureRatio::GetPointer(); // @@ can be CSmanager2
144#ifdef debug
145 G4cout<<"G4QNGamma::GetMeanFreePath: CSmanager is defined for neutrons"<<G4endl;
146#endif
147 pPDG=2112;
148 }
149 else
150 {
151 G4cout<<"-Warning-G4QNGamma::GetMeanFreePath:Particle "
152 <<incidentParticleDefinition->GetPDGEncoding()<<" isn't a neutron"<<G4endl;
153 return DBL_MAX; // can be returned in sigma
154 }
155 // @@ End of possible internal function
156 G4QIsotope* Isotopes = G4QIsotope::Get(); // Pointer to the G4QIsotopes singleton
157 G4int IPIE=IsoProbInEl.size(); // How many old elements?
158 if(IPIE) for(G4int ip=0; ip<IPIE; ++ip) // Clean up the SumProb's of Isotopes (SPI)
159 {
160 std::vector<G4double>* SPI=IsoProbInEl[ip]; // Pointer to the SPI vector
161 SPI->clear();
162 delete SPI;
163 std::vector<G4int>* IsN=ElIsoN[ip]; // Pointer to the N vector
164 IsN->clear();
165 delete IsN;
166 }
167 ElProbInMat.clear(); // Clean up the SumProb's of Elements (SPE)
168 ElementZ.clear(); // Clear the body vector for Z of Elements
169 IsoProbInEl.clear(); // Clear the body vector for SPI
170 ElIsoN.clear(); // Clear the body vector for N of Isotopes
171 for(G4int i=0; i<nE; ++i)
172 {
173 G4Element* pElement=(*theElementVector)[i]; // Pointer to the current element
174 G4int Z = static_cast<G4int>(pElement->GetZ()); // Z of the Element
175 ElementZ.push_back(Z); // Remember Z of the Element
176 G4int isoSize=0; // The default for the isoVectorLength is 0
177 G4int indEl=0; // Index of non-trivial element or 0(default)
178 G4IsotopeVector* isoVector=pElement->GetIsotopeVector(); // Get the predefined IsoVect
179 if(isoVector) isoSize=isoVector->size();// Get size of the existing isotopeVector
180#ifdef debug
181 G4cout<<"G4QNGamma::GetMeanFreePath: isovectorLength="<<isoSize<<G4endl; // Result
182#endif
183 if(isoSize) // The Element has non-trivial abundance set
184 {
185 indEl=pElement->GetIndex()+1; // Index of the non-trivial element
186 if(!Isotopes->IsDefined(Z,indEl)) // This index is not defined for this Z: define
187 {
188 std::vector<std::pair<G4int,G4double>*>* newAbund =
189 new std::vector<std::pair<G4int,G4double>*>;
190 G4double* abuVector=pElement->GetRelativeAbundanceVector();
191 for(G4int j=0; j<isoSize; j++) // Calculation of abundance vector for isotopes
192 {
193 G4int N=pElement->GetIsotope(j)->GetN()-Z; // N means A=N+Z !
194 if(pElement->GetIsotope(j)->GetZ()!=Z)G4cerr<<"G4QNGamma::GetMeanFreePath"
195 <<": Z="<<pElement->GetIsotope(j)->GetZ()<<"#"<<Z<<G4endl;
196 G4double abund=abuVector[j];
197 std::pair<G4int,G4double>* pr= new std::pair<G4int,G4double>(N,abund);
198#ifdef debug
199 G4cout<<"G4QNGamma::GetMeanFreePath: p#="<<j<<",N="<<N<<",ab="<<abund<<G4endl;
200#endif
201 newAbund->push_back(pr);
202 }
203#ifdef debug
204 G4cout<<"G4QNGamma::GetMeanFreePath: pairVectLength="<<newAbund->size()<<G4endl;
205#endif
206 indEl=G4QIsotope::Get()->InitElement(Z,indEl,newAbund); // definition of the newInd
207 for(G4int k=0; k<isoSize; k++) delete (*newAbund)[k]; // Cleaning temporary
208 delete newAbund; // Was "new" in the beginning of the name space
209 }
210 }
211 std::vector<std::pair<G4int,G4double>*>* cs= Isotopes->GetCSVector(Z,indEl);//CSPointer
212 std::vector<G4double>* SPI = new std::vector<G4double>; // Pointer to the SPI vector
213 IsoProbInEl.push_back(SPI);
214 std::vector<G4int>* IsN = new std::vector<G4int>; // Pointer to the N vector
215 ElIsoN.push_back(IsN);
216 G4int nIs=cs->size(); // A#Of Isotopes in the Element
217 G4double susi=0.; // sum of CS over isotopes
218#ifdef debug
219 G4cout<<"G4QNGamma::GetMeanFreePath: Before Loop nIs="<<nIs<<G4endl;
220#endif
221 if(nIs) for(G4int j=0; j<nIs; j++) // Calculate CS for eachIsotope of El
222 {
223 std::pair<G4int,G4double>* curIs=(*cs)[j]; // A pointer, which is used twice
224 G4int N=curIs->first; // #of Neuterons in the isotope j of El i
225 IsN->push_back(N); // Remember Min N for the Element
226#ifdef debug
227 G4cout<<"G4QNGam::GetMeanFrP: Before CS, P="<<Momentum<<",Z="<<Z<<",N="<<N<<G4endl;
228#endif
229 // @@ Can be a function, depanding on CSm1, CSm2, Momentum, Z, N, pPDG
230 G4double CSI=CSmanager->GetCrossSection(true, Momentum, Z, N, pPDG) *
231 capMan->GetRatio(Momentum, Z, N); // CS(j,i) for the isotope
232#ifdef debug
233 G4cout<<"GQC::GMF:X="<<CSI<<",M="<<Momentum<<",Z="<<Z<<",N="<<N<<",P="<<pPDG<<G4endl;
234#endif
235 curIs->second = CSI;
236 susi+=CSI; // Make a sum per isotopes
237 SPI->push_back(susi); // Remember summed cross-section
238 } // End of temporary initialization of the cross sections in the G4QIsotope singeltone
239 sigma+=Isotopes->GetMeanCrossSection(Z,indEl)*NOfNucPerVolume[i];//SUM(MeanCS*NOfNperV)
240 ElProbInMat.push_back(sigma);
241 } // End of LOOP over Elements
242#ifdef debug
243 G4cout<<"G4QNGam::GetMeanFrPa: Sigma="<<sigma<<G4endl;
244#endif
245 if(sigma > 0.) return 1./sigma; // Mean path [distance]
246 return DBL_MAX;
247}
std::vector< G4Element * > G4ElementVector
@ NotForced
std::vector< G4Isotope * > G4IsotopeVector
double G4double
Definition: G4Types.hh:64
G4DLLIMPORT std::ostream G4cerr
G4ParticleDefinition * GetDefinition() 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
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
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
G4bool IsApplicable(const G4ParticleDefinition &particle)
Definition: G4QNGamma.cc:250
G4double GetRatio(G4double pIU, G4int tgZ, G4int tgN)
static G4QNeutronCaptureRatio * GetPointer()
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
virtual G4double GetCrossSection(G4bool, G4double, G4int, G4int, G4int pPDG=0)
#define DBL_MAX
Definition: templates.hh:83

Referenced by PostStepDoIt().

◆ GetNumberOfNeutronsInTarget()

G4int G4QNGamma::GetNumberOfNeutronsInTarget ( )

Definition at line 93 of file G4QNGamma.cc.

94{
95 return nOfNeutrons;
96}

◆ IsApplicable()

G4bool G4QNGamma::IsApplicable ( const G4ParticleDefinition particle)
virtual

Reimplemented from G4VProcess.

Definition at line 250 of file G4QNGamma.cc.

251{
252 if ( particle == *( G4Neutron::Neutron() ) ) return true;
253#ifdef debug
254 G4cout<<"***G4QNGamma::IsApplicable: PDG="<<particle.GetPDGEncoding()<<G4endl;
255#endif
256 return false;
257}

Referenced by GetMeanFreePath(), and PostStepDoIt().

◆ PostStepDoIt()

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

Reimplemented from G4VDiscreteProcess.

Definition at line 259 of file G4QNGamma.cc.

260{
261#ifdef debug
262 static const G4double mNeut= G4QPDGCode(2112).GetMass();
263#endif
264 static const G4LorentzVector vacuum4M(0.,0.,0.,0.);
265 //-------------------------------------------------------------------------------------
266 const G4DynamicParticle* projHadron = track.GetDynamicParticle();
267 const G4ParticleDefinition* particle=projHadron->GetDefinition();
268#ifdef debug
269 G4cout<<"G4QNGamma::PostStepDoIt: Before the GetMeanFreePath is called"<<G4endl;
270#endif
272 GetMeanFreePath(track, 1., &cond);
273#ifdef debug
274 G4cout<<"G4QNGamma::PostStepDoIt: After the GetMeanFreePath is called"<<G4endl;
275#endif
276 G4LorentzVector proj4M=projHadron->Get4Momentum(); // 4-momentum of the projectile (IU?)
277 G4double momentum = projHadron->GetTotalMomentum(); // 3-momentum of the Particle
278 G4double Momentum=proj4M.rho();
279 if(std::fabs(Momentum-momentum)>.001)
280 G4cerr<<"*G4QNGamma::PostStepDoIt: P="<<Momentum<<"#"<<momentum<<G4endl;
281#ifdef debug
282 G4double mp=proj4M.m(); // @@ must be just the neutron mass
283 if(std::fabs(mp-mNeut)>.001)G4cerr<<"*G4QNGamma::PostStDoIt: M="<<mp<<"#"<<mNeut<<G4endl;
284 G4cout<<"->G4QNGam::PostStDoIt:*called*,4M="<<proj4M<<",P="<<Momentum<<",m="<<mp<<G4endl;
285#endif
286 // The same cut function can be used as in MeanFreePath (500)
287 if (!IsApplicable(*particle) || Momentum > 500.) // Check applicability (@@ IU?)
288 {
289 G4cerr<<"G4QNGamma::PostStepDoIt: Only neutrons with P="<<Momentum<<" < 500"<<G4endl;
290 return 0;
291 }
292 const G4Material* material = track.GetMaterial(); // Get the current material
293 G4int Z=0;
294 const G4ElementVector* theElementVector = material->GetElementVector();
295 G4int nE=material->GetNumberOfElements();
296#ifdef debug
297 G4cout<<"G4QNGamma::PostStepDoIt: "<<nE<<" elements in the material."<<G4endl;
298#endif
299 G4int EPIM=ElProbInMat.size();
300#ifdef debug
301 G4cout<<"G4QNGam::PostStDoIt: m="<<EPIM<<",n="<<nE<<",T="<<ElProbInMat[EPIM-1]<<G4endl;
302#endif
303 G4int i=0;
304 if(EPIM>1)
305 {
306 G4double rnd = ElProbInMat[EPIM-1]*G4UniformRand();
307 for(i=0; i<nE; ++i)
308 {
309#ifdef debug
310 G4cout<<"G4QNGamma::PostStepDoIt:E["<<i<<"]="<<ElProbInMat[i]<<",r="<<rnd<<G4endl;
311#endif
312 if (rnd<ElProbInMat[i]) break;
313 }
314 if(i>=nE) i=nE-1; // Top limit for the Element
315 }
316 G4Element* pElement=(*theElementVector)[i];
317 Z=static_cast<G4int>(pElement->GetZ());
318#ifdef debug
319 G4cout<<"G4QNGamma::PostStepDoIt: i="<<i<<", Z(element)="<<Z<<G4endl;
320#endif
321 if(Z <= 0)
322 {
323 G4cerr<<"---Warning---G4QNGamma::PostStepDoIt: Element with Z="<<Z<<G4endl;
324 if(Z<0) return 0;
325 }
326 std::vector<G4double>* SPI = IsoProbInEl[i];// Vector of summedProbabilities for isotopes
327 std::vector<G4int>* IsN = ElIsoN[i]; // Vector of "#of neutrons" in the isotope El[i]
328 G4int nofIsot=SPI->size(); // #of isotopes in the element i
329#ifdef debug
330 G4cout<<"G4QNGam::PosStDoIt:n="<<nofIsot<<",T="<<(*SPI)[nofIsot-1]<<G4endl;
331#endif
332 G4int j=0;
333 if(nofIsot>1)
334 {
335 G4double rndI=(*SPI)[nofIsot-1]*G4UniformRand(); // Randomize the isotop of the Element
336 for(j=0; j<nofIsot; ++j)
337 {
338#ifdef debug
339 G4cout<<"G4QNGamma::PostStepDoIt: SP["<<j<<"]="<<(*SPI)[j]<<", r="<<rndI<<G4endl;
340#endif
341 if(rndI < (*SPI)[j]) break;
342 }
343 if(j>=nofIsot) j=nofIsot-1; // Top limit for the isotope
344 }
345 G4int N =(*IsN)[j]; // Randomized number of neutrons
346#ifdef debug
347 G4cout<<"G4QNGamma::PostStepDoIt: Z="<<Z<<", j="<<i<<", N(isotope)="<<N<<G4endl;
348#endif
349 G4double kinEnergy= projHadron->GetKineticEnergy();
350 G4ParticleMomentum dir = projHadron->GetMomentumDirection();
351 //if() //DoNothing Action insead of the reaction
352 //{
353 // aParticleChange.ProposeEnergy(kinEnergy);
354 // aParticleChange.ProposeLocalEnergyDeposit(0.);
355 // aParticleChange.ProposeMomentumDirection(dir);
356 // aParticleChange.ProposeTrackStatus(fAlive);
357 // return G4VDiscreteProcess::PostStepDoIt(track,step);
358 //}
359 if(N<0)
360 {
361 G4cerr<<"-Warning-G4QNGamma::PostStepDoIt: Isotope with Z="<<Z<<", 0>N="<<N<<G4endl;
362 return 0;
363 }
364 nOfNeutrons=N; // Remember it for the energy-momentum check
365#ifdef debug
366 G4cout<<"G4QNGamma::PostStepDoIt: N="<<N<<" for element with Z="<<Z<<G4endl;
367#endif
369 G4double weight = track.GetWeight();
370#ifdef debug
371 G4cout<<"G4QNGamma::PostStepDoIt: weight="<<weight<<G4endl;
372#endif
373 G4double localtime = track.GetGlobalTime();
374#ifdef debug
375 G4cout<<"G4QNGamma::PostStepDoIt: localtime="<<localtime<<G4endl;
376#endif
377 G4ThreeVector position = track.GetPosition();
378 G4TouchableHandle trTouchable = track.GetTouchableHandle();
379#ifdef debug
380 G4cout<<"G4QNGamma::PostStepDoIt: position="<<position<<G4endl;
381#endif
382 G4int targPDG = 90000000 + Z*1000 + N; // PDG Code of the target nucleus
383 G4QPDGCode targQPDG(targPDG);
384 G4double tM = targQPDG.GetMass(); // Target mass
385#ifdef debug
386 G4cout<<"G4QNGamma::PostStepDoIt: n + targPDG="<<targPDG<<G4endl;
387#endif
388 // @@ All above is universal for all processes except for the additional condition (500)
389 G4LorentzVector tot4M=G4LorentzVector(0.,0.,0.,tM)+proj4M;
390 G4double totM2=tot4M.m2();
391 G4int tZ=Z;
392 G4int tN=N+1;
393 G4int resPDG = targPDG + 1; // Final ++N nucleus PDG
394 G4double rM=G4QPDGCode(resPDG).GetMass(); // Mass of the final nucleus
395 G4LorentzVector r4M=G4LorentzVector(0.,0.,0.,rM); // 4mom of the final nucleus
396 G4LorentzVector g4M=G4LorentzVector(0.,0.,0.,0.); // 4mom of the gamma
397#ifdef debug
398 G4cout<<"G4QNGamma::PostStepDoIt: tM="<<tM << ", rM="<<rM << ", Q="<<tM+mNeut-rM<<G4endl;
399#endif
400 if(!G4QHadron(tot4M).DecayIn2(r4M, g4M)) // The compoun decay din't succeed
401 {
402 //G4cerr<<"G4QNGamma::PostStDoIt: tM="<<std::sqrt(totM2)<<" < rM="<<rM<<G4endl;
403 //G4Exception("G4QNGamma::PostStepDoIt()", "HAD_CHPS_0001",
404 // FatalException, "Hadronize quasmon: Can't decay TotNuc->ResNuc+gam");
405 G4cerr<<"-Warning-G4QNGamma::PostStDoIt: tM="<<std::sqrt(totM2)<<" < rM="<<rM<<G4endl;
410 return G4VDiscreteProcess::PostStepDoIt(track,step);
411 }
412#ifdef debug
413 G4cout<<"G4QNGam::PStDoIt: RA="<<r4M.rho()<<r4M<<", Gamma="<<g4M.rho()<<g4M<<G4endl;
414#endif
415 EnMomConservation = tot4M - r4M - g4M; // EM conservation check 4mom
416 aParticleChange.ProposeEnergy(0.); // A standard procedure of killing proj.
417 aParticleChange.ProposeTrackStatus(fStopAndKill);// projectile neutron is killed
418 aParticleChange.SetNumberOfSecondaries(2); // Fix a#of secondaries
419 // Fill the gamma
420 G4ParticleDefinition* theDefinition = G4Gamma::Gamma();
421 G4DynamicParticle* theGam = new G4DynamicParticle(theDefinition, g4M);
422 G4Track* capGamma = new G4Track(theGam, localtime, position );
423 capGamma->SetWeight(weight);
424 capGamma->SetTouchableHandle(trTouchable);
426 // ----------------------------------------------------
427 // Fill the final nucleus
428 G4int tA=tZ+tN;
429 if (resPDG==90000001) theDefinition = G4Neutron::Neutron();
430 else if(resPDG==90001000) theDefinition = G4Proton::Proton();
431 else theDefinition = G4ParticleTable::GetParticleTable()->FindIon(tZ, tA, 0, tZ);
432 G4DynamicParticle* theReN = new G4DynamicParticle(theDefinition, r4M);
433 G4Track* scatReN = new G4Track(theReN, localtime, position );
434 scatReN->SetWeight(weight);
435 scatReN->SetTouchableHandle(trTouchable);
437
438 return G4VDiscreteProcess::PostStepDoIt(track, step);
439}
G4ForceCondition
@ fAlive
@ fStopAndKill
#define G4UniformRand()
Definition: Randomize.hh:53
const G4ThreeVector & GetMomentumDirection() const
G4LorentzVector Get4Momentum() const
G4double GetKineticEnergy() const
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
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 &)
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
static G4ParticleTable * GetParticleTable()
static G4Proton * Proton()
Definition: G4Proton.cc:93
G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
Definition: G4QNGamma.cc:102
G4double GetMass()
Definition: G4QPDGCode.cc:693
void SetWeight(G4double aValue)
void SetTouchableHandle(const G4TouchableHandle &apValue)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetNumberOfSecondaries(G4int totSecondaries)
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:289

◆ PrintInfoDefinition()

void G4QNGamma::PrintInfoDefinition ( )
inline

Definition at line 96 of file G4QNGamma.hh.

96{;}

◆ SetPhysicsTableBining()

void G4QNGamma::SetPhysicsTableBining ( G4double  ,
G4double  ,
G4int   
)
inline

Definition at line 94 of file G4QNGamma.hh.

94{;}

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