ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HadronicInteraction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4HadronicInteraction.cc
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 // Hadronic Interaction base class
28 // original by H.P. Wellisch
29 // modified by J.L. Chuma, TRIUMF, 21-Mar-1997
30 // Last modified: 04-Apr-1997
31 // reimplemented 1.11.2003 JPW.
32 // 23-Jan-2009 V.Ivanchenko move constructor and destructor to the body
33 
34 #include <iostream>
35 
36 #include "G4HadronicInteraction.hh"
37 #include "G4SystemOfUnits.hh"
39 #include "G4HadronicParameters.hh"
40 
42  verboseLevel(0), theMinEnergy(0.0),
43  isBlocked(false), recoilEnergyThreshold(0.0), theModelName(modelName),
44  epCheckLevels(DBL_MAX, DBL_MAX)
45 {
48  registry->RegisterMe(this);
49 }
50 
52 {
53  registry->RemoveMe(this);
54 }
55 
57 {}
58 
60 {}
61 
62 G4double
65 {
66  return 0.0;
67 }
68 
70  G4Nucleus&)
71 {
72  return true;
73 }
74 
76  const G4Material *aMaterial, const G4Element *anElement ) const
77 {
78  if(!IsBlocked()) { return theMinEnergy; }
79  if( IsBlocked(aMaterial) || IsBlocked(anElement) ) { return DBL_MAX; }
80  if(!theMinEnergyListElements.empty()) {
81  for(auto const& elmlist : theMinEnergyListElements) {
82  if( anElement == elmlist.second )
83  { return elmlist.first; }
84  }
85  }
86  if(!theMinEnergyList.empty()) {
87  for(auto const & matlist : theMinEnergyList) {
88  if( aMaterial == matlist.second )
89  { return matlist.first; }
90  }
91  }
92  return theMinEnergy;
93 }
94 
96  const G4Element *anElement )
97 {
98  Block();
99  if(!theMinEnergyListElements.empty()) {
100  for(auto & elmlist : theMinEnergyListElements) {
101  if( anElement == elmlist.second ) {
102  elmlist.first = anEnergy;
103  return;
104  }
105  }
106  }
107  theMinEnergyListElements.push_back(std::pair<G4double, const G4Element *>(anEnergy, anElement));
108 }
109 
111  const G4Material *aMaterial )
112 {
113  Block();
114  if(!theMinEnergyList.empty()) {
115  for(auto & matlist : theMinEnergyList) {
116  if( aMaterial == matlist.second ) {
117  matlist.first = anEnergy;
118  return;
119  }
120  }
121  }
122  theMinEnergyList.push_back(std::pair<G4double, const G4Material *>(anEnergy, aMaterial));
123 }
124 
126  const G4Element *anElement ) const
127 {
128  if(!IsBlocked()) { return theMaxEnergy; }
129  if( IsBlocked(aMaterial) || IsBlocked(anElement) ) { return 0.0; }
130  if(!theMaxEnergyListElements.empty()) {
131  for(auto const& elmlist : theMaxEnergyListElements) {
132  if( anElement == elmlist.second )
133  { return elmlist.first; }
134  }
135  }
136  if(!theMaxEnergyList.empty()) {
137  for(auto const& matlist : theMaxEnergyList) {
138  if( aMaterial == matlist.second )
139  { return matlist.first; }
140  }
141  }
142  return theMaxEnergy;
143 }
144 
146  const G4Element *anElement )
147 {
148  Block();
149  if(!theMaxEnergyListElements.empty()) {
150  for(auto & elmlist : theMaxEnergyListElements) {
151  if( anElement == elmlist.second ) {
152  elmlist.first = anEnergy;
153  return;
154  }
155  }
156  }
157  theMaxEnergyListElements.push_back(std::pair<G4double, const G4Element *>(anEnergy, anElement));
158 }
159 
160 void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy, const G4Material *aMaterial )
161 {
162  Block();
163  if(!theMaxEnergyList.empty()) {
164  for(auto & matlist: theMaxEnergyList) {
165  if( aMaterial == matlist.second ) {
166  matlist.first = anEnergy;
167  return;
168  }
169  }
170  }
171  theMaxEnergyList.push_back(std::pair<G4double, const G4Material *>(anEnergy, aMaterial));
172 }
173 
175 {
176  Block();
177  theBlockedList.push_back(aMaterial);
178 }
179 
181 {
182  Block();
183  theBlockedListElements.push_back(anElement);
184 }
185 
186 
188 {
189  for (auto const& mat : theBlockedList) {
190  if (aMaterial == mat) return true;
191  }
192  return false;
193 }
194 
195 
197 {
198  for (auto const& elm : theBlockedListElements) {
199  if (anElement == elm) return true;
200  }
201  return false;
202 }
203 
204 const std::pair<G4double, G4double> G4HadronicInteraction::GetFatalEnergyCheckLevels() const
205 {
206  // default level of Check
207  return std::pair<G4double, G4double>(2.*perCent, 1. * GeV);
208 }
209 
210 std::pair<G4double, G4double>
212 {
213  return epCheckLevels;
214 }
215 
216 void G4HadronicInteraction::ModelDescription(std::ostream& outFile) const
217 {
218  outFile << "The description for this model has not been written yet.\n";
219 }
220