ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HadronicProcess.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4HadronicProcess.hh
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 //
27 // -------------------------------------------------------------------
28 //
29 // GEANT4 Class header file
30 //
31 // G4HadronicProcess
32 //
33 // This is the top level Hadronic Process class
34 // The inelastic, elastic, capture, and fission processes
35 // should derive from this class
36 //
37 // original by H.P.Wellisch
38 // J.L. Chuma, TRIUMF, 10-Mar-1997
39 // Last modified: 04-Apr-1997
40 // 19-May-2008 V.Ivanchenko cleanup and added comments
41 // 05-Jul-2010 V.Ivanchenko cleanup commented lines
42 // 28-Jul-2012 M.Maire add function GetTargetDefinition()
43 // 14-Sep-2012 Inherit from RestDiscrete, use subtype code (now in ctor) to
44 // configure base-class
45 // 28-Sep-2012 M. Kelsey -- Undo inheritance change, keep new ctor
46 
47 #ifndef G4HadronicProcess_h
48 #define G4HadronicProcess_h 1
49 
50 #include "globals.hh"
51 #include "G4VDiscreteProcess.hh"
52 #include "G4EnergyRangeManager.hh"
53 #include "G4Nucleus.hh"
54 #include "G4ReactionProduct.hh"
55 #include "G4HadronicProcessType.hh"
57 #include <vector>
58 
59 class G4Track;
60 class G4Step;
61 class G4Element;
62 class G4ParticleChange;
67 
69 {
70 public:
71  G4HadronicProcess(const G4String& processName="Hadronic",
72  G4ProcessType procType=fHadronic);
73 
74  // Preferred signature for subclasses, specifying their subtype here
75  G4HadronicProcess(const G4String& processName,
76  G4HadronicProcessType subType);
77 
78  ~G4HadronicProcess() override;
79 
80  // register generator of secondaries
82 
83  // get cross section per element
85  const G4Element * elm,
86  const G4Material* mat = nullptr);
87 
88  // obsolete method to get cross section per element
89  inline
91  const G4Element * elm,
92  const G4Material* mat = nullptr)
93  { return GetElementCrossSection(part, elm, mat); }
94 
95  // generic PostStepDoIt recommended for all derived classes
96  G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
97  const G4Step& aStep) override;
98 
99  // initialisation of physics tables and G4HadronicProcessStore
100  void PreparePhysicsTable(const G4ParticleDefinition&) override;
101 
102  // build physics tables and print out the configuration of the process
103  void BuildPhysicsTable(const G4ParticleDefinition&) override;
104 
105  // dump physics tables
107 
108  // add cross section data set
109  void AddDataSet(G4VCrossSectionDataSet * aDataSet);
110 
111  // access to the list of hadronic interactions
112  std::vector<G4HadronicInteraction*>& GetHadronicInteractionList();
113 
114  // access to an hadronic interaction by name
116 
117  // get inverse cross section per volume
118  G4double GetMeanFreePath(const G4Track &aTrack, G4double,
119  G4ForceCondition *) override;
120 
121  // access to the target nucleus
122  inline const G4Nucleus* GetTargetNucleus() const
123  { return &targetNucleus; }
124 
125  // G4ParticleDefinition* GetTargetDefinition();
126  inline const G4Isotope* GetTargetIsotope()
127  { return targetNucleus.GetIsotope(); }
128 
129  void ProcessDescription(std::ostream& outFile) const override;
130 
131 protected:
132 
133  // generic method to choose secondary generator
134  // recommended for all derived classes
136  const G4HadProjectile & aHadProjectile, G4Nucleus& aTargetNucleus,
137  const G4Material* aMaterial, const G4Element* anElement)
138  { return theEnergyRangeManager.GetHadronicInteraction(aHadProjectile,
139  aTargetNucleus,
140  aMaterial,anElement);
141  }
142 
143  // access to the target nucleus
145  { return &targetNucleus; }
146 
147 public:
148 
149  // scale cross section
150  void BiasCrossSectionByFactor(G4double aScale);
151  void MultiplyCrossSectionBy(G4double factor);
153  { return aScaleFactor; }
154 
155  // Integral option
156  inline void SetIntegral(G4bool val)
157  { useIntegralXS = val; }
158 
159  // Energy-momentum non-conservation limits and reporting
160  inline void SetEpReportLevel(G4int level)
161  { epReportLevel = level; }
162 
163  inline void SetEnergyMomentumCheckLevels(G4double relativeLevel, G4double absoluteLevel)
164  { epCheckLevels.first = relativeLevel;
165  epCheckLevels.second = absoluteLevel;
166  levelsSetByProcess = true;
167  }
168 
169  inline std::pair<G4double, G4double> GetEnergyMomentumCheckLevels() const
170  { return epCheckLevels; }
171 
172  // access to the cross section data store
174  {return theCrossSectionDataStore;}
175 
176 protected:
177 
178  void DumpState(const G4Track&, const G4String&, G4ExceptionDescription&);
179 
180  // access to the chosen generator
182  { return theInteraction; }
183 
184  // access to the cross section data set
186  { return theLastCrossSection; }
187 
188  // fill result
189  void FillResult(G4HadFinalState* aR, const G4Track& aT);
190 
191  // Check the result for catastrophic energy non-conservation
193  const G4Nucleus& targetNucleus,
194  G4HadFinalState* result);
195 
196  // Check 4-momentum balance
198 
199 private:
200 
201  void InitialiseLocal();
202 
205 
206  // hide assignment operator as private
209 
210  // Set E/p conservation check levels from environment variables
212 
213 protected:
214 
216 
218 
220 
222 
223 private:
224 
226 
228 
230 
232 
234 
236 
238 
240 
242 
244 
245  // Energy-momentum checking
246  std::pair<G4double, G4double> epCheckLevels;
248 
249  std::vector<G4VLeadingParticleBiasing*> theBias;
250 
252 
256 };
257 
258 #endif
259