Geant4  10.02
G4CrossSectionPairGG.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4CrossSectionPairGG.cc 93682 2015-10-28 10:09:49Z gcosmo $
27 // $ GEANT4 tag $Name: not supported by cvs2svn $
28 //
29 // Class G4CrossSectionPairGG
30 //
31 // smoothly join two cross section sets by scaling the second at a given
32 // transition energy to match the first.
33 //
34 // Author: Gunter Folger
35 // November 2009
36 //
37 
38 #include "G4CrossSectionPairGG.hh"
39 
40 #include "globals.hh"
41 #include "G4PhysicalConstants.hh"
42 #include "G4SystemOfUnits.hh"
43 #include "G4HadTmpUtil.hh"
44 #include "G4NistManager.hh"
45 #include "G4ThreeVector.hh"
46 #include "G4NistManager.hh"
48 
49 
51  G4double Etransit) :
52  G4VCrossSectionDataSet("G4CrossSectionPairGG"), theLowX(low), ETransition(
53  Etransit) {
56  verboseLevel = 0;
57 }
58 
60  delete theHighX;
61  // The cross section registry will delete theLowX
62 }
63 
65  std::ostream& outFile) const {
66  outFile << "G4CrossSectionPairGG is used to add the relativistic rise to\n"
67  << "hadronic cross section data sets above a given energy. In this\n"
68  << "case, the Glauber-Gribov cross section is used above 91 GeV.\n"
69  << "At this energy the low energy cross section is smoothly joined\n"
70  << "to the high energy cross section. Below 91 GeV the Barashenkov\n"
71  << "cross section is used for pions (G4PiNuclearCrossSection), the\n"
72  << "Axen-Wellisch cross section is used for protons\n"
73  << "(G4ProtonInelasticCrossSection), and the Wellisch-Laidlaw cross\n"
74  << "section is used for neutrons (G4NeutronInelasticCrossSection).\n";
75 }
76 
78  const G4DynamicParticle* aParticle, G4int Z, const G4Material* mat) {
79  G4bool isApplicable(false);
80  G4double Ekin = aParticle->GetKineticEnergy();
81  if (Ekin <= ETransition) {
82  isApplicable = theLowX->IsElementApplicable(aParticle, Z, mat);
83  } else if (Z > 1) {
84  isApplicable = true;
85  }
86  return isApplicable;
87 }
88 
90  const G4DynamicParticle* aParticle, G4int ZZ, const G4Material* mat)
91 {
92  G4double Xsec(0.);
93 
94  if (aParticle->GetKineticEnergy() < ETransition)
95  {
96  Xsec = theLowX->GetElementCrossSection(aParticle, ZZ, mat);
97  } else {
98 
99  std::vector<ParticleXScale>::iterator iter = scale_factors.begin();
100  const G4ParticleDefinition * pDef = aParticle->GetDefinition();
101  while (iter != scale_factors.end() && (*iter).first != pDef)
102  {
103  ++iter;
104  }
105  if (iter != scale_factors.end() )
106  {
108  Xsec = theHighX->GetInelasticGlauberGribov(aParticle, ZZ, AA)
109  * (*iter).second[ZZ];
110  if (verboseLevel > 2)
111  {
112  G4cout << " scaling .." << ZZ << " " << AA << " "
113  << (*iter).second[ZZ] << " "
114  << theHighX->GetInelasticGlauberGribov(aParticle, ZZ, AA)
115  << " " << Xsec << G4endl;
116  }
117  } else {
118  // BuildPhysicsTable not done for pDef=aParticle->GetDefinition
119  // build table, and recurse
120  BuildPhysicsTable(*pDef);
121  Xsec=GetElementCrossSection(aParticle, ZZ, mat);
122  }
123  }
124 
125  return Xsec;
126 }
127 
129  theLowX->BuildPhysicsTable(pDef);
131 
132  if (verboseLevel > 0) {
133  G4cout << "G4CrossSectionPairGG::BuildPhysicsTable "
134  << theLowX->GetName() << " " << theHighX->GetName() << G4endl;
135  }
136 
137  const G4ParticleDefinition * myDef = &pDef;
138  std::vector<ParticleXScale>::iterator iter;
139  iter = scale_factors.begin();
140  while (iter != scale_factors.end() && (*iter).first != myDef) {
141  ++iter;
142  }
143 
144  // new particle, initialise
145 
146  G4Material* mat = 0;
147 
148  if (iter == scale_factors.end()) {
149  XS_factors factors(93);
150  G4ThreeVector mom(0.0, 0.0, 1.0);
151  G4DynamicParticle DynPart(myDef, mom, ETransition); // last is kinetic Energy
152 
153  if (verboseLevel > 0) {
154  G4cout << "G4CrossSectionPairGG::BuildPhysicsTable for particle "
155  << pDef.GetParticleName() << G4endl;
156  }
157  for (G4int aZ = 1; aZ < 93; ++aZ) {
158  factors[aZ] = 1.; // default, to give reasonable value if only high is applicable
160  G4bool isApplicable = theLowX->IsElementApplicable(&DynPart, aZ,
161  mat) && (aZ > 1);
162 
163  if (isApplicable) {
164  factors[aZ] = theLowX->GetElementCrossSection(&DynPart, aZ, mat)
165  / theHighX->GetInelasticGlauberGribov(&DynPart, aZ, AA);
166 
167  }
168  if (verboseLevel > 0) {
169  G4cout << "Z=" << aZ << ", A=" << AA << ", scale="
170  << factors[aZ];
171  if (verboseLevel == 1) {
172  G4cout << G4endl;
173  } else {
174  if (isApplicable) {
175  G4cout << ", low / high "
176  << theLowX->GetElementCrossSection(&DynPart, aZ,
177  mat) << " "
178  << theHighX->GetInelasticGlauberGribov(&DynPart,
179  aZ, AA) << G4endl;
180  } else {
181  G4cout << ", N/A" << G4endl;
182  }
183  }
184  }
185  }
186  ParticleXScale forPart(myDef, factors);
187  scale_factors.push_back(forPart);
188  }
189 }
190 
191 /*
192  void G4CrossSectionPairGG::DumpHtml(const G4ParticleDefinition&,
193  std::ofstream outFile)
194  {
195  outFile << " <li><b>"
196  << " G4CrossSectionPairGG: " << theLowX->GetName() << " cross sections \n";
197  outFile << "below " << ETransition/GeV << " GeV, Glauber-Gribov above \n";
198  }
199  */
200 
202  G4cout << std::setw(24) << " " << " G4CrossSectionPairGG: "
203  << theLowX->GetName() << " cross sections " << G4endl;
204  G4cout << std::setw(27) << " " << "below " << ETransition / GeV
205  << " GeV, Glauber-Gribov above " << G4endl;
206 }
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
virtual void CrossSectionDescription(std::ostream &) const
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
virtual G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
G4VCrossSectionDataSet * theLowX
std::valarray< G4double > XS_factors
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
G4ParticleDefinition * GetDefinition() const
const G4String & GetName() const
int G4int
Definition: G4Types.hh:78
G4ComponentGGHadronNucleusXsc * theHighX
static G4NistManager * Instance()
const G4String & GetParticleName() const
virtual G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
static const double GeV
Definition: G4SIunits.hh:214
virtual G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
std::vector< ParticleXScale > scale_factors
int G4lrint(double ad)
Definition: templates.hh:163
std::pair< const G4ParticleDefinition *, XS_factors > ParticleXScale
G4double GetAtomicMassAmu(const G4String &symb) const
virtual void DumpPhysicsTable(const G4ParticleDefinition &)
#define G4endl
Definition: G4ios.hh:61
G4double GetInelasticGlauberGribov(const G4DynamicParticle *, G4int Z, G4int A)
double G4double
Definition: G4Types.hh:76
const G4String & GetName() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
virtual G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *mat=0)