Geant4-11
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4ComponentSAIDTotalXS Class Reference

#include <G4ComponentSAIDTotalXS.hh>

Inheritance diagram for G4ComponentSAIDTotalXS:
G4VComponentCrossSection

Public Member Functions

virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual G4double ComputeQuasiElasticRatio (const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)
 
virtual void Description (std::ostream &) const final
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
 G4ComponentSAIDTotalXS ()
 
G4double GetChargeExchangeCrossSection (const G4ParticleDefinition *prim, const G4ParticleDefinition *sec, G4double kinEnergy, G4int, G4int)
 
G4double GetElasticElementCrossSection (const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
 
virtual G4double GetElasticElementCrossSection (const G4ParticleDefinition *, G4double kinEnergy, G4int, G4double)
 
virtual G4double GetElasticIsotopeCrossSection (const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)
 
G4double GetInelasticElementCrossSection (const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
 
virtual G4double GetInelasticElementCrossSection (const G4ParticleDefinition *, G4double kinEnergy, G4int, G4double)
 
virtual G4double GetInelasticIsotopeCrossSection (const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)
 
G4double GetMaxKinEnergy () const
 
G4double GetMinKinEnergy () const
 
const G4StringGetName () const
 
G4double GetTotalElementCrossSection (const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
 
virtual G4double GetTotalElementCrossSection (const G4ParticleDefinition *, G4double kinEnergy, G4int, G4double)
 
virtual G4double GetTotalIsotopeCrossSection (const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)
 
G4int GetVerboseLevel () const
 
void SetMaxKinEnergy (G4double value)
 
void SetMinKinEnergy (G4double value)
 
void SetVerboseLevel (G4int value)
 
virtual ~G4ComponentSAIDTotalXS ()
 

Private Member Functions

 G4ComponentSAIDTotalXS (const G4ComponentSAIDTotalXS &)
 
G4SAIDCrossSectionType GetType (const G4ParticleDefinition *prim, const G4ParticleDefinition *sec, G4int Z, G4int N)
 
void Initialise (G4SAIDCrossSectionType tp)
 
G4ComponentSAIDTotalXSoperator= (const G4ComponentSAIDTotalXS &right)
 
void PrintWarning (const G4ParticleDefinition *prim, const G4ParticleDefinition *sec, G4int, G4int, const G4String &, const G4String &)
 
void ReadData (G4int index, G4PhysicsVector *, const G4String &, const G4String &)
 

Private Attributes

G4PhysicsVectorelastdata [numberOfSaidXS]
 
G4PhysicsVectorinelastdata [numberOfSaidXS]
 
G4double maxKinEnergy
 
G4double minKinEnergy
 
const G4String name
 
G4CrossSectionDataSetRegistryregistry
 
G4int verboseLevel
 

Static Private Attributes

static const G4String fnames [numberOfSaidXS]
 

Detailed Description

Definition at line 74 of file G4ComponentSAIDTotalXS.hh.

Constructor & Destructor Documentation

◆ G4ComponentSAIDTotalXS() [1/2]

G4ComponentSAIDTotalXS::G4ComponentSAIDTotalXS ( )

Definition at line 53 of file G4ComponentSAIDTotalXS.cc.

54 : G4VComponentCrossSection("xsSAID")
55{
56 for(G4int i=0; i<numberOfSaidXS; ++i) {
57 elastdata[i] = nullptr;
58 inelastdata[i] = nullptr;
59 }
60}
@ numberOfSaidXS
int G4int
Definition: G4Types.hh:85
G4PhysicsVector * elastdata[numberOfSaidXS]
G4PhysicsVector * inelastdata[numberOfSaidXS]
G4VComponentCrossSection(const G4String &nam="")

References elastdata, inelastdata, and numberOfSaidXS.

◆ ~G4ComponentSAIDTotalXS()

G4ComponentSAIDTotalXS::~G4ComponentSAIDTotalXS ( )
virtual

Definition at line 62 of file G4ComponentSAIDTotalXS.cc.

63{
64 for(G4int i=0; i<numberOfSaidXS; ++i) {
65 if(elastdata[i]) {
66 delete elastdata[i];
67 elastdata[i] = nullptr;
68 }
69 if(inelastdata[i]) {
70 delete inelastdata[i];
71 inelastdata[i] = nullptr;
72 }
73 }
74}

References elastdata, inelastdata, and numberOfSaidXS.

◆ G4ComponentSAIDTotalXS() [2/2]

G4ComponentSAIDTotalXS::G4ComponentSAIDTotalXS ( const G4ComponentSAIDTotalXS )
private

Member Function Documentation

◆ BuildPhysicsTable()

void G4VComponentCrossSection::BuildPhysicsTable ( const G4ParticleDefinition )
virtualinherited

◆ ComputeQuasiElasticRatio()

G4double G4VComponentCrossSection::ComputeQuasiElasticRatio ( const G4ParticleDefinition ,
G4double  kinEnergy,
G4int  ,
G4int   
)
virtualinherited

Reimplemented in G4ComponentGGHadronNucleusXsc, and G4ComponentGGNuclNuclXsc.

Definition at line 56 of file G4VComponentCrossSection.cc.

59{
60 return 0.0;
61}

◆ Description()

void G4ComponentSAIDTotalXS::Description ( std::ostream &  ) const
finalvirtual

Reimplemented from G4VComponentCrossSection.

Definition at line 170 of file G4ComponentSAIDTotalXS.cc.

171{
172}

◆ DumpPhysicsTable()

void G4VComponentCrossSection::DumpPhysicsTable ( const G4ParticleDefinition )
virtualinherited

◆ GetChargeExchangeCrossSection()

G4double G4ComponentSAIDTotalXS::GetChargeExchangeCrossSection ( const G4ParticleDefinition prim,
const G4ParticleDefinition sec,
G4double  kinEnergy,
G4int  Z,
G4int  N 
)

Definition at line 153 of file G4ComponentSAIDTotalXS.cc.

157{
158 G4double cross = 0.0;
159 G4SAIDCrossSectionType tp = GetType(prim,sec,Z,N);
160 if(saidUnknown != tp) {
161 G4int idx = G4int(tp);
162 if(!inelastdata[idx]) { Initialise(tp); }
163 if(inelastdata[idx]) {
164 cross = (inelastdata[idx])->Value(kinEnergy);
165 }
166 }
167 return cross;
168}
G4SAIDCrossSectionType
double G4double
Definition: G4Types.hh:83
const G4int Z[17]
void Initialise(G4SAIDCrossSectionType tp)
G4SAIDCrossSectionType GetType(const G4ParticleDefinition *prim, const G4ParticleDefinition *sec, G4int Z, G4int N)

References GetType(), inelastdata, Initialise(), saidUnknown, G4InuclParticleNames::tp, and Z.

◆ GetElasticElementCrossSection() [1/2]

G4double G4VComponentCrossSection::GetElasticElementCrossSection ( const G4ParticleDefinition p,
G4double  kinEnergy,
const G4Element elm 
)
inlineinherited

◆ GetElasticElementCrossSection() [2/2]

G4double G4ComponentSAIDTotalXS::GetElasticElementCrossSection ( const G4ParticleDefinition part,
G4double  kinEnergy,
G4int  Z,
G4double  N 
)
virtual

Implements G4VComponentCrossSection.

Definition at line 125 of file G4ComponentSAIDTotalXS.cc.

128{
129 PrintWarning(part,0,Z,G4lrint(N),
130 "G4ComponentSAIDTotalXS::GetTotalElementCrossSection",
131 "Method is not implemented");
132 return 0.0;
133}
void PrintWarning(const G4ParticleDefinition *prim, const G4ParticleDefinition *sec, G4int, G4int, const G4String &, const G4String &)
int G4lrint(double ad)
Definition: templates.hh:134

References G4lrint(), PrintWarning(), and Z.

◆ GetElasticIsotopeCrossSection()

G4double G4ComponentSAIDTotalXS::GetElasticIsotopeCrossSection ( const G4ParticleDefinition part,
G4double  kinEnergy,
G4int  Z,
G4int  N 
)
virtual

Implements G4VComponentCrossSection.

Definition at line 136 of file G4ComponentSAIDTotalXS.cc.

139{
140 G4double cross = 0.0;
142 if(saidUnknown != tp) {
143 G4int idx = G4int(tp);
144 if(!elastdata[idx]) { Initialise(tp); }
145 if(elastdata[idx]) {
146 cross = (elastdata[idx])->Value(kinEnergy);
147 }
148 }
149 return cross;
150}

References elastdata, GetType(), Initialise(), saidUnknown, G4InuclParticleNames::tp, and Z.

Referenced by GetTotalIsotopeCrossSection().

◆ GetInelasticElementCrossSection() [1/2]

G4double G4VComponentCrossSection::GetInelasticElementCrossSection ( const G4ParticleDefinition p,
G4double  kinEnergy,
const G4Element elm 
)
inlineinherited

◆ GetInelasticElementCrossSection() [2/2]

G4double G4ComponentSAIDTotalXS::GetInelasticElementCrossSection ( const G4ParticleDefinition part,
G4double  kinEnergy,
G4int  Z,
G4double  N 
)
virtual

Implements G4VComponentCrossSection.

Definition at line 97 of file G4ComponentSAIDTotalXS.cc.

100{
101 PrintWarning(part,0,Z,G4lrint(N),
102 "G4ComponentSAIDTotalXS::GetTotalElementCrossSection",
103 "Method is not implemented");
104 return 0.0;
105}

References G4lrint(), PrintWarning(), and Z.

◆ GetInelasticIsotopeCrossSection()

G4double G4ComponentSAIDTotalXS::GetInelasticIsotopeCrossSection ( const G4ParticleDefinition part,
G4double  kinEnergy,
G4int  Z,
G4int  N 
)
virtual

Implements G4VComponentCrossSection.

Definition at line 108 of file G4ComponentSAIDTotalXS.cc.

111{
112 G4double cross = 0.0;
114 if(saidUnknown != tp) {
115 G4int idx = G4int(tp);
116 if(!inelastdata[idx]) { Initialise(tp); }
117 if(inelastdata[idx]) {
118 cross = (inelastdata[idx])->Value(kinEnergy);
119 }
120 }
121 return cross;
122}

References GetType(), inelastdata, Initialise(), saidUnknown, G4InuclParticleNames::tp, and Z.

Referenced by GetTotalIsotopeCrossSection().

◆ GetMaxKinEnergy()

G4double G4VComponentCrossSection::GetMaxKinEnergy ( ) const
inlineinherited

Definition at line 203 of file G4VComponentCrossSection.hh.

204{
205 return maxKinEnergy;
206}

References G4VComponentCrossSection::maxKinEnergy.

◆ GetMinKinEnergy()

G4double G4VComponentCrossSection::GetMinKinEnergy ( ) const
inlineinherited

Definition at line 193 of file G4VComponentCrossSection.hh.

194{
195 return minKinEnergy;
196}

References G4VComponentCrossSection::minKinEnergy.

◆ GetName()

const G4String & G4VComponentCrossSection::GetName ( ) const
inlineinherited

Definition at line 208 of file G4VComponentCrossSection.hh.

209{
210 return name;
211}

References G4VComponentCrossSection::name.

◆ GetTotalElementCrossSection() [1/2]

G4double G4VComponentCrossSection::GetTotalElementCrossSection ( const G4ParticleDefinition p,
G4double  kinEnergy,
const G4Element elm 
)
inlineinherited

Definition at line 149 of file G4VComponentCrossSection.hh.

153{
154 return GetTotalElementCrossSection(p,kinEnergy,
155 elm->GetZasInt(),elm->GetN());
156}
G4double GetTotalElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)

References G4Element::GetN(), G4VComponentCrossSection::GetTotalElementCrossSection(), and G4Element::GetZasInt().

Referenced by G4VComponentCrossSection::GetTotalElementCrossSection().

◆ GetTotalElementCrossSection() [2/2]

G4double G4ComponentSAIDTotalXS::GetTotalElementCrossSection ( const G4ParticleDefinition part,
G4double  kinEnergy,
G4int  Z,
G4double  N 
)
virtual

Implements G4VComponentCrossSection.

Definition at line 77 of file G4ComponentSAIDTotalXS.cc.

80{
81 PrintWarning(part,0,Z,G4lrint(N),
82 "G4ComponentSAIDTotalXS::GetTotalElementCrossSection",
83 "Method is not implemented");
84 return 0.0;
85}

References G4lrint(), PrintWarning(), and Z.

◆ GetTotalIsotopeCrossSection()

G4double G4ComponentSAIDTotalXS::GetTotalIsotopeCrossSection ( const G4ParticleDefinition part,
G4double  kinEnergy,
G4int  Z,
G4int  N 
)
virtual

Implements G4VComponentCrossSection.

Definition at line 88 of file G4ComponentSAIDTotalXS.cc.

91{
92 return GetInelasticIsotopeCrossSection(part,kinEnergy,Z,N)
93 + GetElasticIsotopeCrossSection(part,kinEnergy,Z,N);
94}
virtual G4double GetInelasticIsotopeCrossSection(const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)
virtual G4double GetElasticIsotopeCrossSection(const G4ParticleDefinition *, G4double kinEnergy, G4int, G4int)

References GetElasticIsotopeCrossSection(), GetInelasticIsotopeCrossSection(), and Z.

◆ GetType()

G4SAIDCrossSectionType G4ComponentSAIDTotalXS::GetType ( const G4ParticleDefinition prim,
const G4ParticleDefinition sec,
G4int  Z,
G4int  N 
)
private

Definition at line 175 of file G4ComponentSAIDTotalXS.cc.

178{
180 if(1 == N && prim) {
181 G4int code = prim->GetPDGEncoding();
182
183 // only gamma + N x-sections available
184 if(0 == Z && sec && 22 == code) {
185 G4int code1 = sec->GetPDGEncoding();
186 if(-211 == code1) { type = saidGN_PINP; }
187 else if(111 == code1) { type = saidGN_PI0N; }
188
189 // x-sections off proton
190 } else if(1 == Z) {
191 if(sec) {
192 G4int code1 = sec->GetPDGEncoding();
193 if(-211 == code) {
194 if(111 == code1) { type = saidPINP_PI0N; }
195 else if(221 == code1) { type = saidPINP_ETAN; }
196
197 } else if(22 == code) {
198 if(111 == code1) { type = saidGP_PI0P; }
199 else if(211 == code1) { type = saidGP_PIPN; }
200 else if(221 == code1) { type = saidGP_ETAP; }
201 else if(331 == code1) { type = saidGP_ETAPP; }
202 }
203 } else {
204 if(2212 == code) { type = saidPP; }
205 else if(2112 == code) { type = saidNP; }
206 else if(211 == code) { type = saidPIPP; }
207 else if(-211 == code) { type = saidPINP; }
208 }
209 }
210 }
211 //G4cout << "G4ComponentSAIDTotalXS::Type= " << type << G4endl;
212 return type;
213}
Definition: inftrees.h:24

References G4ParticleDefinition::GetPDGEncoding(), saidGN_PI0N, saidGN_PINP, saidGP_ETAP, saidGP_ETAPP, saidGP_PI0P, saidGP_PIPN, saidNP, saidPINP, saidPINP_ETAN, saidPINP_PI0N, saidPIPP, saidPP, saidUnknown, and Z.

Referenced by GetChargeExchangeCrossSection(), GetElasticIsotopeCrossSection(), and GetInelasticIsotopeCrossSection().

◆ GetVerboseLevel()

G4int G4VComponentCrossSection::GetVerboseLevel ( ) const
inlineinherited

Definition at line 183 of file G4VComponentCrossSection.hh.

184{
185 return verboseLevel;
186}

References G4VComponentCrossSection::verboseLevel.

Referenced by ReadData().

◆ Initialise()

void G4ComponentSAIDTotalXS::Initialise ( G4SAIDCrossSectionType  tp)
private

Definition at line 215 of file G4ComponentSAIDTotalXS.cc.

216{
217 G4int idx = G4int(tp);
218#ifdef G4MULTITHREADED
219 G4MUTEXLOCK(&saidXSMutex);
220 if(!inelastdata[idx]) {
221#endif
222 // check environment variable
223 // Build the complete string identifying the file with the data set
224 char* path = std::getenv("G4SAIDXSDATA");
225 if (!path){
226 G4Exception("G4ComponentSAIDTotalXS::Initialise(..)","had013",
228 "Environment variable G4SAIDXSDATA is not defined");
229 return;
230 }
231 if(idx <= 4) {
232 elastdata[idx] = new G4PhysicsFreeVector(true);
233 inelastdata[idx] = new G4PhysicsFreeVector(true);
234 ReadData(idx,elastdata[idx],path,"_el.dat");
235 ReadData(idx,inelastdata[idx],path,"_in.dat");
236 } else {
237 inelastdata[idx] = new G4PhysicsFreeVector();
238 ReadData(idx,inelastdata[idx],path,".dat");
239 }
240#ifdef G4MULTITHREADED
241 }
242 G4MUTEXUNLOCK(&saidXSMutex);
243#endif
244}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
void ReadData(G4int index, G4PhysicsVector *, const G4String &, const G4String &)

References elastdata, FatalException, G4Exception(), G4MUTEXLOCK, G4MUTEXUNLOCK, inelastdata, ReadData(), and G4InuclParticleNames::tp.

Referenced by GetChargeExchangeCrossSection(), GetElasticIsotopeCrossSection(), and GetInelasticIsotopeCrossSection().

◆ operator=()

G4ComponentSAIDTotalXS & G4ComponentSAIDTotalXS::operator= ( const G4ComponentSAIDTotalXS right)
private

◆ PrintWarning()

void G4ComponentSAIDTotalXS::PrintWarning ( const G4ParticleDefinition prim,
const G4ParticleDefinition sec,
G4int  Z,
G4int  N,
const G4String ss1,
const G4String ss2 
)
private

Definition at line 273 of file G4ComponentSAIDTotalXS.cc.

278{
279 G4cout << ss1 << ": " << ss2 << G4endl;
280 G4cout << "For Z= " << Z << " N= " << N << " of ";
281 if(prim) { G4cout << prim->GetParticleName() << " "; }
282 if(sec) { G4cout << " x-section to " << sec->GetParticleName(); }
283 G4cout << G4endl;
284}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4String & GetParticleName() const

References G4cout, G4endl, G4ParticleDefinition::GetParticleName(), and Z.

Referenced by GetElasticElementCrossSection(), GetInelasticElementCrossSection(), and GetTotalElementCrossSection().

◆ ReadData()

void G4ComponentSAIDTotalXS::ReadData ( G4int  index,
G4PhysicsVector v,
const G4String ss1,
const G4String ss2 
)
private

Definition at line 246 of file G4ComponentSAIDTotalXS.cc.

250{
251 std::ostringstream ost;
252 ost << ss1 << "/" << fnames[index] << ss2;
253 std::ifstream filein(ost.str().c_str());
254 if (!(filein)) {
256 ed << "Data file <" << ost.str().c_str()
257 << "> is not opened!";
258 G4Exception("G4ComponentSAIDTotalXS::ReadData(..)","had014",
259 FatalException, ed, "Check G4SAIDXSDATA");
260 } else {
261 if(GetVerboseLevel() > 1) {
262 G4cout << "File " << ost.str()
263 << " is opened by G4ComponentSAIDTotalXS" << G4endl;
264 }
265 // retrieve data from DB
266 v->Retrieve(filein, true);
269 }
270}
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static const G4String fnames[numberOfSaidXS]
void ScaleVector(const G4double factorE, const G4double factorV)
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)
static constexpr double millibarn
Definition: SystemOfUnits.h:87
static constexpr double MeV

References FatalException, G4PhysicsVector::FillSecondDerivatives(), fnames, G4cout, G4endl, G4Exception(), G4VComponentCrossSection::GetVerboseLevel(), CLHEP::MeV, CLHEP::millibarn, G4PhysicsVector::Retrieve(), and G4PhysicsVector::ScaleVector().

Referenced by Initialise().

◆ SetMaxKinEnergy()

void G4VComponentCrossSection::SetMaxKinEnergy ( G4double  value)
inlineinherited

Definition at line 198 of file G4VComponentCrossSection.hh.

199{
200 maxKinEnergy = value;
201}

References G4VComponentCrossSection::maxKinEnergy.

◆ SetMinKinEnergy()

void G4VComponentCrossSection::SetMinKinEnergy ( G4double  value)
inlineinherited

Definition at line 188 of file G4VComponentCrossSection.hh.

189{
190 minKinEnergy = value;
191}

References G4VComponentCrossSection::minKinEnergy.

◆ SetVerboseLevel()

void G4VComponentCrossSection::SetVerboseLevel ( G4int  value)
inlineinherited

Definition at line 178 of file G4VComponentCrossSection.hh.

179{
180 verboseLevel = value;
181}

References G4VComponentCrossSection::verboseLevel.

Field Documentation

◆ elastdata

G4PhysicsVector* G4ComponentSAIDTotalXS::elastdata[numberOfSaidXS]
private

◆ fnames

const G4String G4ComponentSAIDTotalXS::fnames
staticprivate
Initial value:
= {
"","pp","np","pip","pim",
"pin","pie",
"gp_pi0p","gp_pi+n","gn_pi-p","gn_pi0n","gp_etap","gp_etapp"
}

Definition at line 138 of file G4ComponentSAIDTotalXS.hh.

Referenced by ReadData().

◆ inelastdata

G4PhysicsVector* G4ComponentSAIDTotalXS::inelastdata[numberOfSaidXS]
private

◆ maxKinEnergy

G4double G4VComponentCrossSection::maxKinEnergy
privateinherited

◆ minKinEnergy

G4double G4VComponentCrossSection::minKinEnergy
privateinherited

◆ name

const G4String G4VComponentCrossSection::name
privateinherited

◆ registry

G4CrossSectionDataSetRegistry* G4VComponentCrossSection::registry
privateinherited

◆ verboseLevel

G4int G4VComponentCrossSection::verboseLevel
privateinherited

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