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

#include <G4ProductionCuts.hh>

Public Member Functions

 G4ProductionCuts ()
 
 G4ProductionCuts (const G4ProductionCuts &right)
 
G4double GetProductionCut (const G4String &name) const
 
G4double GetProductionCut (G4int index) const
 
const std::vector< G4double > & GetProductionCuts () const
 
G4bool IsModified () const
 
G4bool operator!= (const G4ProductionCuts &right) const
 
G4ProductionCutsoperator= (const G4ProductionCuts &right)
 
G4bool operator== (const G4ProductionCuts &right) const
 
void PhysicsTableUpdated ()
 
void SetProductionCut (G4double cut, const G4String &pName)
 
void SetProductionCut (G4double cut, G4int index=-1)
 
void SetProductionCut (G4double cut, G4ParticleDefinition *ptcl)
 
void SetProductionCuts (std::vector< G4double > &)
 
virtual ~G4ProductionCuts ()
 

Static Public Member Functions

static G4int GetIndex (const G4ParticleDefinition *ptcl)
 
static G4int GetIndex (const G4String &name)
 

Protected Attributes

std::vector< G4doublefRangeCuts
 
G4bool isModified = true
 

Static Private Attributes

static G4ThreadLocal G4ParticleDefinitionelectDef = nullptr
 
static G4ThreadLocal G4ParticleDefinitiongammaDef = nullptr
 
static G4ThreadLocal G4ParticleDefinitionpositDef = nullptr
 
static G4ThreadLocal G4ParticleDefinitionprotonDef = nullptr
 

Detailed Description

Definition at line 55 of file G4ProductionCuts.hh.

Constructor & Destructor Documentation

◆ G4ProductionCuts() [1/2]

G4ProductionCuts::G4ProductionCuts ( )

Definition at line 41 of file G4ProductionCuts.cc.

42{
43 for (G4int i=0; i< NumberOfG4CutIndex; ++i)
44 {
45 fRangeCuts.push_back(0.0);
46 }
47}
@ NumberOfG4CutIndex
int G4int
Definition: G4Types.hh:85
std::vector< G4double > fRangeCuts

References fRangeCuts, and NumberOfG4CutIndex.

◆ G4ProductionCuts() [2/2]

G4ProductionCuts::G4ProductionCuts ( const G4ProductionCuts right)

Definition at line 49 of file G4ProductionCuts.cc.

50{
51 for (G4int i=0; i< NumberOfG4CutIndex; ++i)
52 {
53 fRangeCuts.push_back(0.0);
54 }
55 *this = right;
56}

References fRangeCuts, and NumberOfG4CutIndex.

◆ ~G4ProductionCuts()

G4ProductionCuts::~G4ProductionCuts ( )
virtual

Definition at line 58 of file G4ProductionCuts.cc.

59{
60 fRangeCuts.clear();
61}

References fRangeCuts.

Member Function Documentation

◆ GetIndex() [1/2]

G4int G4ProductionCuts::GetIndex ( const G4ParticleDefinition ptcl)
static

Definition at line 104 of file G4ProductionCuts.cc.

105{
106 if(!ptcl) return -1;
107
108 // In the first call, pointers are set
109 if(gammaDef==nullptr && ptcl->GetParticleName()=="gamma")
110 { gammaDef = (G4ParticleDefinition*) ptcl; }
111 if(electDef==nullptr && ptcl->GetParticleName()=="e-")
112 { electDef = (G4ParticleDefinition*) ptcl; }
113 if(positDef==nullptr && ptcl->GetParticleName()=="e+")
114 { positDef = (G4ParticleDefinition*) ptcl; }
115 if(protonDef==nullptr && ptcl->GetParticleName()=="proton")
116 { protonDef = (G4ParticleDefinition*) ptcl; }
117
118 G4int index;
119 if(ptcl==(const G4ParticleDefinition*) gammaDef) { index = 0; }
120 else if(ptcl==(const G4ParticleDefinition*) electDef) { index = 1; }
121 else if(ptcl==(const G4ParticleDefinition*) positDef) { index = 2; }
122 else if(ptcl==(const G4ParticleDefinition*) protonDef) { index = 3; }
123 else { index = -1; }
124
125 return index;
126}
const G4String & GetParticleName() const
static G4ThreadLocal G4ParticleDefinition * positDef
static G4ThreadLocal G4ParticleDefinition * electDef
static G4ThreadLocal G4ParticleDefinition * protonDef
static G4ThreadLocal G4ParticleDefinition * gammaDef

References electDef, gammaDef, G4ParticleDefinition::GetParticleName(), positDef, and protonDef.

◆ GetIndex() [2/2]

G4int G4ProductionCuts::GetIndex ( const G4String name)
static

Definition at line 86 of file G4ProductionCuts.cc.

87{
88 static const G4String gamma ("gamma");
89 static const G4String electron("e-");
90 static const G4String positron("e+");
91 static const G4String proton("proton");
92
93 G4int index;
94 if ( name == gamma ) { index = 0; }
95 else if ( name == electron ) { index = 1; }
96 else if ( name == positron ) { index = 2; }
97 else if ( name == proton ) { index = 3; }
98 else { index = -1; }
99
100 return index;
101}
const char * name(G4int ptype)

References G4InuclParticleNames::electron, G4InuclParticleNames::name(), G4InuclParticleNames::positron, and G4InuclParticleNames::proton.

Referenced by G4ITStepProcessor::ApplyProductionCut(), G4SteppingManager::ApplyProductionCut(), G4ProductionCutsTable::ConvertRangeToEnergy(), GetProductionCut(), and SetProductionCut().

◆ GetProductionCut() [1/2]

G4double G4ProductionCuts::GetProductionCut ( const G4String name) const
inline

Definition at line 167 of file G4ProductionCuts.hh.

168{
170}
static G4int GetIndex(const G4String &name)
G4double GetProductionCut(G4int index) const

References GetIndex(), GetProductionCut(), and G4InuclParticleNames::name().

◆ GetProductionCut() [2/2]

G4double G4ProductionCuts::GetProductionCut ( G4int  index) const
inline

◆ GetProductionCuts()

const std::vector< G4double > & G4ProductionCuts::GetProductionCuts ( ) const
inline

Definition at line 174 of file G4ProductionCuts.hh.

175{
176 return fRangeCuts;
177}

References fRangeCuts.

Referenced by G4ProductionCutsTable::UpdateCoupleTable().

◆ IsModified()

G4bool G4ProductionCuts::IsModified ( ) const
inline

Definition at line 180 of file G4ProductionCuts.hh.

181{
182 return isModified;
183}

References isModified.

Referenced by G4MaterialCutsCouple::IsRecalcNeeded().

◆ operator!=()

G4bool G4ProductionCuts::operator!= ( const G4ProductionCuts right) const

Definition at line 81 of file G4ProductionCuts.cc.

82{
83 return (this != &right);
84}

◆ operator=()

G4ProductionCuts & G4ProductionCuts::operator= ( const G4ProductionCuts right)

Definition at line 63 of file G4ProductionCuts.cc.

64{
65 if (&right==this) return *this;
66
67 for (G4int i=0; i< NumberOfG4CutIndex; ++i)
68 {
69 fRangeCuts[i] = right.fRangeCuts[i];
70 }
71 isModified = right.isModified;
72 return *this;
73}

References fRangeCuts, isModified, and NumberOfG4CutIndex.

◆ operator==()

G4bool G4ProductionCuts::operator== ( const G4ProductionCuts right) const

Definition at line 75 of file G4ProductionCuts.cc.

76{
77 return (this == &right);
78}

◆ PhysicsTableUpdated()

void G4ProductionCuts::PhysicsTableUpdated ( )
inline

Definition at line 186 of file G4ProductionCuts.hh.

187{
188 isModified = false;
189}

References isModified.

Referenced by G4MaterialCutsCouple::PhysicsTableUpdated().

◆ SetProductionCut() [1/3]

void G4ProductionCuts::SetProductionCut ( G4double  cut,
const G4String pName 
)
inline

Definition at line 149 of file G4ProductionCuts.hh.

150{
151 G4int idx = GetIndex(pName);
152 if(idx>=0) SetProductionCut(cut,idx);
153}
void SetProductionCut(G4double cut, G4int index=-1)

References GetIndex(), and SetProductionCut().

◆ SetProductionCut() [2/3]

void G4ProductionCuts::SetProductionCut ( G4double  cut,
G4int  index = -1 
)
inline

Definition at line 121 of file G4ProductionCuts.hh.

122{
123 if (index<0)
124 {
125 for(G4int i = 0; i < NumberOfG4CutIndex; ++i)
126 {
127 fRangeCuts[i] = cut;
128 }
129 isModified = true;
130
131 }
132 else if (index < NumberOfG4CutIndex)
133 {
134 fRangeCuts[index] = cut;
135 isModified = true;
136 }
137}

References fRangeCuts, isModified, and NumberOfG4CutIndex.

Referenced by G4GDMLParser::ImportRegions(), G4VUserPhysicsList::SetParticleCuts(), and SetProductionCut().

◆ SetProductionCut() [3/3]

void G4ProductionCuts::SetProductionCut ( G4double  cut,
G4ParticleDefinition ptcl 
)
inline

Definition at line 140 of file G4ProductionCuts.hh.

142{
143 G4int idx = -1;
144 if(ptcl) idx = GetIndex(ptcl);
145 if(idx>=0) SetProductionCut(cut,idx);
146}

References GetIndex(), and SetProductionCut().

◆ SetProductionCuts()

void G4ProductionCuts::SetProductionCuts ( std::vector< G4double > &  cut)

Definition at line 128 of file G4ProductionCuts.cc.

129{
130 G4int vSize = cut.size();
131 if (vSize != NumberOfG4CutIndex)
132 {
133#ifdef G4VERBOSE
134 if ( G4ProductionCutsTable::GetProductionCutsTable()->GetVerboseLevel()>1)
135 {
136 G4cerr << "G4ProductionCuts::SetProductionCuts ";
137 G4cerr << " The size of given cut value vector [=" << vSize << "] "
138 << " is not consistent with number of CutIndex [="
140 }
141#endif
142 G4Exception( "G4ProductionCuts::SetProductionCuts ",
143 "ProcCuts108",
144 JustWarning, "Given vector size is inconsistent ");
145 if (NumberOfG4CutIndex<vSize) { vSize = NumberOfG4CutIndex; }
146 }
147 for(G4int i = 0; (i<vSize ); ++i)
148 {
149 fRangeCuts[i] = cut[i];
150 }
151 isModified = true;
152}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
static G4ProductionCutsTable * GetProductionCutsTable()

References fRangeCuts, G4cerr, G4endl, G4Exception(), G4ProductionCutsTable::GetProductionCutsTable(), isModified, JustWarning, and NumberOfG4CutIndex.

Field Documentation

◆ electDef

G4ThreadLocal G4ParticleDefinition * G4ProductionCuts::electDef = nullptr
staticprivate

Definition at line 111 of file G4ProductionCuts.hh.

Referenced by GetIndex().

◆ fRangeCuts

std::vector<G4double> G4ProductionCuts::fRangeCuts
protected

◆ gammaDef

G4ThreadLocal G4ParticleDefinition * G4ProductionCuts::gammaDef = nullptr
staticprivate

Definition at line 110 of file G4ProductionCuts.hh.

Referenced by GetIndex().

◆ isModified

G4bool G4ProductionCuts::isModified = true
protected

◆ positDef

G4ThreadLocal G4ParticleDefinition * G4ProductionCuts::positDef = nullptr
staticprivate

Definition at line 112 of file G4ProductionCuts.hh.

Referenced by GetIndex().

◆ protonDef

G4ThreadLocal G4ParticleDefinition * G4ProductionCuts::protonDef = nullptr
staticprivate

Definition at line 113 of file G4ProductionCuts.hh.

Referenced by GetIndex().


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