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

#include <G4ChipsNeutronElasticXS.hh>

Inheritance diagram for G4ChipsNeutronElasticXS:
G4VCrossSectionDataSet

Public Member Functions

 G4ChipsNeutronElasticXS ()
 
 ~G4ChipsNeutronElasticXS ()
 
virtual G4bool IsIsoApplicable (const G4DynamicParticle *Pt, G4int Z, G4int A, const G4Element *elm, const G4Material *mat)
 
virtual G4double GetIsoCrossSection (const G4DynamicParticle *, G4int tgZ, G4int A, const G4Isotope *iso=0, const G4Element *elm=0, const G4Material *mat=0)
 
virtual G4double GetChipsCrossSection (G4double momentum, G4int Z, G4int N, G4int pdg)
 
G4double GetExchangeT (G4int tZ, G4int tN, G4int pPDG)
 
G4double GetHMaxT ()
 
- Public Member Functions inherited from G4VCrossSectionDataSet
 G4VCrossSectionDataSet (const G4String &nam="")
 
virtual ~G4VCrossSectionDataSet ()
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
 
virtual G4Isotope * SelectIsotope (const G4Element *, G4double kinEnergy)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
virtual void CrossSectionDescription (std::ostream &) const
 
virtual G4int GetVerboseLevel () const
 
virtual void SetVerboseLevel (G4int value)
 
G4double GetMinKinEnergy () const
 
void SetMinKinEnergy (G4double value)
 
G4double GetMaxKinEnergy () const
 
void SetMaxKinEnergy (G4double value)
 
const G4String & GetName () const
 

Static Public Member Functions

static const char * Default_Name ()
 

Additional Inherited Members

- Protected Member Functions inherited from G4VCrossSectionDataSet
void SetName (const G4String &)
 
- Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel
 

Detailed Description

Definition at line 46 of file G4ChipsNeutronElasticXS.hh.

Constructor & Destructor Documentation

G4ChipsNeutronElasticXS::G4ChipsNeutronElasticXS ( )

Definition at line 55 of file G4ChipsNeutronElasticXS.cc.

55  :G4VCrossSectionDataSet(Default_Name()), nPoints(128), nLast(nPoints-1)
56 {
57  lPMin=-8.; // Min tabulated log Momentum (D)
58  lPMax= 8.; // Max tabulated log Momentum (D)
59  dlnP=(lPMax-lPMin)/nLast;// Log step in table (D)
60  onlyCS=true;// Flag to calc only CS (not Si/Bi)(L)
61  lastSIG=0.; // Last calculated cross section (L)
62  lastLP=-10.;// Last log(momOfIncidentHadron) (L)
63  lastTM=0.; // Last t_maximum (L)
64  theSS=0.; // The Last sq.slope of 1st difMax (L)
65  theS1=0.; // The Last mantissa of 1st difMax (L)
66  theB1=0.; // The Last slope of 1st difr. Max (L)
67  theS2=0.; // The Last mantissa of 2nd difMax (L)
68  theB2=0.; // The Last slope of 2nd difr. Max (L)
69  theS3=0.; // The Last mantissa of 3d difrMax (L)
70  theB3=0.; // The Last slope of 3d difructMax (L)
71  theS4=0.; // The Last mantissa of 4th difMax (L)
72  theB4=0.; // The Last slope of 4th difr. Max (L)
73  lastTZ=0; // Last atomic number of the target
74  lastTN=0; // Last # of neutrons in the target
75  lastPIN=0.; // Last initialized max momentum
76  lastCST=0; // Elastic cross-section table
77  lastPAR=0; // Parameters of FunctionalCalculation
78  lastSST=0; // E-dep of sq.slope of the 1st difMax
79  lastS1T=0; // E-dep of mantissa of the 1st difMax
80  lastB1T=0; // E-dep of theSlope of the 1st difMax
81  lastS2T=0; // E-dep of mantissa of the 2nd difMax
82  lastB2T=0; // E-dep of theSlope of the 2nd difMax
83  lastS3T=0; // E-dep of mantissa of the 3d difrMax
84  lastB3T=0; // E-dep of the slope of the 3d difMax
85  lastS4T=0; // E-dep of mantissa of the 4th difMax
86  lastB4T=0; // E-dep of theSlope of the 4th difMax
87  lastN=0; // The last N of calculated nucleus
88  lastZ=0; // The last Z of calculated nucleus
89  lastP=0.; // Last used in cross section Momentum
90  lastTH=0.; // Last threshold momentum
91  lastCS=0.; // Last value of the Cross Section
92  lastI=0; // The last position in the DAMDB
93 }
G4VCrossSectionDataSet(const G4String &nam="")
static const char * Default_Name()
G4ChipsNeutronElasticXS::~G4ChipsNeutronElasticXS ( )

Definition at line 95 of file G4ChipsNeutronElasticXS.cc.

96 {
97  std::vector<G4double*>::iterator pos;
98  for (pos=CST.begin(); pos<CST.end(); pos++)
99  { delete [] *pos; }
100  CST.clear();
101  for (pos=PAR.begin(); pos<PAR.end(); pos++)
102  { delete [] *pos; }
103  PAR.clear();
104  for (pos=SST.begin(); pos<SST.end(); pos++)
105  { delete [] *pos; }
106  SST.clear();
107  for (pos=S1T.begin(); pos<S1T.end(); pos++)
108  { delete [] *pos; }
109  S1T.clear();
110  for (pos=B1T.begin(); pos<B1T.end(); pos++)
111  { delete [] *pos; }
112  B1T.clear();
113  for (pos=S2T.begin(); pos<S2T.end(); pos++)
114  { delete [] *pos; }
115  S2T.clear();
116  for (pos=B2T.begin(); pos<B2T.end(); pos++)
117  { delete [] *pos; }
118  B2T.clear();
119  for (pos=S3T.begin(); pos<S3T.end(); pos++)
120  { delete [] *pos; }
121  S3T.clear();
122  for (pos=B3T.begin(); pos<B3T.end(); pos++)
123  { delete [] *pos; }
124  B3T.clear();
125  for (pos=S4T.begin(); pos<S4T.end(); pos++)
126  { delete [] *pos; }
127  S4T.clear();
128  for (pos=B4T.begin(); pos<B4T.end(); pos++)
129  { delete [] *pos; }
130  B4T.clear();
131 }

Member Function Documentation

static const char* G4ChipsNeutronElasticXS::Default_Name ( )
inlinestatic
G4double G4ChipsNeutronElasticXS::GetChipsCrossSection ( G4double  momentum,
G4int  Z,
G4int  N,
G4int  pdg 
)
virtual

!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)

Definition at line 155 of file G4ChipsNeutronElasticXS.cc.

References G4ThreadLocal, and python.hepunit::millibarn.

Referenced by G4QuasiElRatios::ChExer(), GetIsoCrossSection(), G4ChipsElasticModel::SampleInvariantT(), and G4QuasiElRatios::Scatter().

156 {
157  static G4ThreadLocal std::vector <G4int> *colN_G4MT_TLS_ = 0 ; if (!colN_G4MT_TLS_) colN_G4MT_TLS_ = new std::vector <G4int> ; std::vector <G4int> &colN = *colN_G4MT_TLS_; // Vector of N for calculated nuclei (isotops)
158  static G4ThreadLocal std::vector <G4int> *colZ_G4MT_TLS_ = 0 ; if (!colZ_G4MT_TLS_) colZ_G4MT_TLS_ = new std::vector <G4int> ; std::vector <G4int> &colZ = *colZ_G4MT_TLS_; // Vector of Z for calculated nuclei (isotops)
159  static G4ThreadLocal std::vector <G4double> *colP_G4MT_TLS_ = 0 ; if (!colP_G4MT_TLS_) colP_G4MT_TLS_ = new std::vector <G4double> ; std::vector <G4double> &colP = *colP_G4MT_TLS_; // Vector of last momenta for the reaction
160  static G4ThreadLocal std::vector <G4double> *colTH_G4MT_TLS_ = 0 ; if (!colTH_G4MT_TLS_) colTH_G4MT_TLS_ = new std::vector <G4double> ; std::vector <G4double> &colTH = *colTH_G4MT_TLS_; // Vector of energy thresholds for the reaction
161  static G4ThreadLocal std::vector <G4double> *colCS_G4MT_TLS_ = 0 ; if (!colCS_G4MT_TLS_) colCS_G4MT_TLS_ = new std::vector <G4double> ; std::vector <G4double> &colCS = *colCS_G4MT_TLS_; // Vector of last cross sections for the reaction
162  // ***---*** End of the mandatory Static Definitions of the Associative Memory ***---***
163 
164  G4double pEn=pMom;
165  onlyCS=false;
166 
167  G4bool in=false; // By default the isotope must be found in the AMDB
168  lastP = 0.; // New momentum history (nothing to compare with)
169  lastN = tgN; // The last N of the calculated nucleus
170  lastZ = tgZ; // The last Z of the calculated nucleus
171  lastI = colN.size(); // Size of the Associative Memory DB in the heap
172  if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
173  { // The nucleus with projPDG is found in AMDB
174  if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
175  {
176  lastI=i;
177  lastTH =colTH[i]; // Last THreshold (A-dependent)
178  if(pEn<=lastTH)
179  {
180  return 0.; // Energy is below the Threshold value
181  }
182  lastP =colP [i]; // Last Momentum (A-dependent)
183  lastCS =colCS[i]; // Last CrossSect (A-dependent)
184  // if(std::fabs(lastP/pMom-1.)<tolerance) //VI (do not use tolerance)
185  if(lastP == pMom) // Do not recalculate
186  {
187  CalculateCrossSection(false,-1,i,2112,lastZ,lastN,pMom); // Update param's only
188  return lastCS*millibarn; // Use theLastCS
189  }
190  in = true; // This is the case when the isotop is found in DB
191  // Momentum pMom is in IU ! @@ Units
192  lastCS=CalculateCrossSection(false,-1,i,2112,lastZ,lastN,pMom); // read & update
193  if(lastCS<=0. && pEn>lastTH) // Correct the threshold
194  {
195  lastTH=pEn;
196  }
197  break; // Go out of the LOOP with found lastI
198  }
199  }
200  if(!in) // This nucleus has not been calculated previously
201  {
202  //!!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)
203  lastCS=CalculateCrossSection(false,0,lastI,2112,lastZ,lastN,pMom);//calculate&create
204  if(lastCS<=0.)
205  {
206  lastTH = 0; // ThresholdEnergy(tgZ, tgN); // The Threshold Energy which is now the last
207  if(pEn>lastTH)
208  {
209  lastTH=pEn;
210  }
211  }
212  colN.push_back(tgN);
213  colZ.push_back(tgZ);
214  colP.push_back(pMom);
215  colTH.push_back(lastTH);
216  colCS.push_back(lastCS);
217  return lastCS*millibarn;
218  } // End of creation of the new set of parameters
219  else
220  {
221  colP[lastI]=pMom;
222  colCS[lastI]=lastCS;
223  }
224  return lastCS*millibarn;
225 }
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
int millibarn
Definition: hepunit.py:40
bool G4bool
Definition: G4Types.hh:79
double G4double
Definition: G4Types.hh:76
G4double G4ChipsNeutronElasticXS::GetExchangeT ( G4int  tZ,
G4int  tN,
G4int  pPDG 
)

Definition at line 1854 of file G4ChipsNeutronElasticXS.cc.

References G4cout, G4endl, G4UniformRand, and python.hepunit::gigaelectronvolt.

Referenced by G4QuasiElRatios::ChExer(), G4ChipsElasticModel::SampleInvariantT(), and G4QuasiElRatios::Scatter().

1855 {
1856  static const G4double GeVSQ=gigaelectronvolt*gigaelectronvolt;
1857  static const G4double third=1./3.;
1858  static const G4double fifth=1./5.;
1859  static const G4double sevth=1./7.;
1860  if(PDG!=2112) G4cout<<"*Warning*G4ChipsNeutronElasticXS::GetExT:PDG="<<PDG<<G4endl;
1861  if(onlyCS) G4cout<<"*Warning*G4ChipsNeutronElasticXS::GetExchangeT:onCS=1"<<G4endl;
1862  if(lastLP<-4.3) return lastTM*GeVSQ*G4UniformRand();// S-wave for p<14 MeV/c (kinE<.1MeV)
1863  G4double q2=0.;
1864  if(tgZ==1 && tgN==0) // ===> n+p=n+p
1865  {
1866  G4double E1=lastTM*theB1;
1867  G4double R1=(1.-std::exp(-E1));
1868  G4double E2=lastTM*theB2;
1869  G4double R2=(1.-std::exp(-E2));
1870  G4double I1=R1*theS1;
1871  G4double I2=R2*theS2/theB2;
1872  //G4double I3=R3*theS3/theB3;
1873  G4double I12=I1+I2;
1874  //G4double rand=(I12+I3)*G4UniformRand();
1875  G4double rand=I12*G4UniformRand();
1876  if (rand<I1 )
1877  {
1878  G4double ran=R1*G4UniformRand();
1879  if(ran>1.) ran=1.;
1880  q2=-std::log(1.-ran)/theB1; // t-chan
1881  }
1882  else
1883  {
1884  G4double ran=R2*G4UniformRand();
1885  if(ran>1.) ran=1.;
1886  q2=lastTM+std::log(1.-ran)/theB2; // u-chan (ChEx)
1887  }
1888  }
1889  else
1890  {
1891  G4double a=tgZ+tgN;
1892  G4double E1=lastTM*(theB1+lastTM*theSS);
1893  G4double R1=(1.-std::exp(-E1));
1894  G4double tss=theSS+theSS; // for future solution of quadratic equation (imediate check)
1895  G4double tm2=lastTM*lastTM;
1896  G4double E2=lastTM*tm2*theB2; // power 3 for lowA, 5 for HighA (1st)
1897  if(a>6.5)E2*=tm2; // for heavy nuclei
1898  G4double R2=(1.-std::exp(-E2));
1899  G4double E3=lastTM*theB3;
1900  if(a>6.5)E3*=tm2*tm2*tm2; // power 1 for lowA, 7 (2nd) for HighA
1901  G4double R3=(1.-std::exp(-E3));
1902  G4double E4=lastTM*theB4;
1903  G4double R4=(1.-std::exp(-E4));
1904  G4double I1=R1*theS1;
1905  G4double I2=R2*theS2;
1906  G4double I3=R3*theS3;
1907  G4double I4=R4*theS4;
1908  G4double I12=I1+I2;
1909  G4double I13=I12+I3;
1910  G4double rand=(I13+I4)*G4UniformRand();
1911  if(rand<I1)
1912  {
1913  G4double ran=R1*G4UniformRand();
1914  if(ran>1.) ran=1.;
1915  q2=-std::log(1.-ran)/theB1;
1916  if(std::fabs(tss)>1.e-7) q2=(std::sqrt(theB1*(theB1+(tss+tss)*q2))-theB1)/tss;
1917  }
1918  else if(rand<I12)
1919  {
1920  G4double ran=R2*G4UniformRand();
1921  if(ran>1.) ran=1.;
1922  q2=-std::log(1.-ran)/theB2;
1923  if(q2<0.) q2=0.;
1924  if(a<6.5) q2=std::pow(q2,third);
1925  else q2=std::pow(q2,fifth);
1926  }
1927  else if(rand<I13)
1928  {
1929  G4double ran=R3*G4UniformRand();
1930  if(ran>1.) ran=1.;
1931  q2=-std::log(1.-ran)/theB3;
1932  if(q2<0.) q2=0.;
1933  if(a>6.5) q2=std::pow(q2,sevth);
1934  }
1935  else
1936  {
1937  G4double ran=R4*G4UniformRand();
1938  if(ran>1.) ran=1.;
1939  q2=-std::log(1.-ran)/theB4;
1940  if(a<6.5) q2=lastTM-q2; // u reduced for lightA (starts from 0)
1941  }
1942  }
1943  if(q2<0.) q2=0.;
1944  if(!(q2>=-1.||q2<=1.)) G4cout<<"*NAN*G4QNeutronElCroSect::GetExchangeT: -t="<<q2<<G4endl;
1945  if(q2>lastTM)
1946  {
1947  q2=lastTM;
1948  }
1949  return q2*GeVSQ;
1950 }
int gigaelectronvolt
Definition: hepunit.py:110
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double G4ChipsNeutronElasticXS::GetHMaxT ( )

Definition at line 1976 of file G4ChipsNeutronElasticXS.cc.

Referenced by G4QuasiElRatios::ChExer(), and G4QuasiElRatios::Scatter().

1977 {
1978  static const G4double HGeVSQ=gigaelectronvolt*gigaelectronvolt/2.;
1979  return lastTM*HGeVSQ;
1980 }
int gigaelectronvolt
Definition: hepunit.py:110
double G4double
Definition: G4Types.hh:76
G4double G4ChipsNeutronElasticXS::GetIsoCrossSection ( const G4DynamicParticle *  Pt,
G4int  tgZ,
G4int  A,
const G4Isotope *  iso = 0,
const G4Element *  elm = 0,
const G4Material *  mat = 0 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 142 of file G4ChipsNeutronElasticXS.cc.

References GetChipsCrossSection(), and G4DynamicParticle::GetTotalMomentum().

146 {
147  G4double pMom=Pt->GetTotalMomentum();
148  G4int tgN = A - tgZ;
149 
150  return GetChipsCrossSection(pMom, tgZ, tgN, 2112);
151 }
virtual G4double GetChipsCrossSection(G4double momentum, G4int Z, G4int N, G4int pdg)
int G4int
Definition: G4Types.hh:78
G4double GetTotalMomentum() const
double G4double
Definition: G4Types.hh:76
G4bool G4ChipsNeutronElasticXS::IsIsoApplicable ( const G4DynamicParticle *  Pt,
G4int  Z,
G4int  A,
const G4Element *  elm,
const G4Material *  mat 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 133 of file G4ChipsNeutronElasticXS.cc.

References G4DynamicParticle::GetDefinition(), and G4Proton::Proton().

136 {
137  G4ParticleDefinition* particle = Pt->GetDefinition();
138  if (particle == G4Proton::Proton() ) return true;
139  return false;
140 }
G4ParticleDefinition * GetDefinition() const
static G4Proton * Proton()
Definition: G4Proton.cc:93

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