Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4XPDGElastic Class Reference

#include <G4XPDGElastic.hh>

+ Inheritance diagram for G4XPDGElastic:

Public Member Functions

 G4XPDGElastic ()
 
virtual ~G4XPDGElastic ()
 
G4bool operator== (const G4XPDGElastic &right) const
 
G4bool operator!= (const G4XPDGElastic &right) const
 
virtual G4double CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
virtual const G4CrossSectionVectorGetComponents () const
 
virtual G4String Name () const
 
virtual G4bool IsValid (G4double e) const
 
virtual G4double LowLimit () const
 
- Public Member Functions inherited from G4VCrossSectionSource
 G4VCrossSectionSource ()
 
virtual ~G4VCrossSectionSource ()
 
G4bool operator== (const G4VCrossSectionSource &right) const
 
G4bool operator!= (const G4VCrossSectionSource &right) const
 
virtual G4double CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
 
virtual const G4CrossSectionVectorGetComponents () const =0
 
virtual G4String Name () const =0
 
virtual void Print () const
 
virtual void PrintAll (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
virtual G4bool IsValid (G4double e) const
 
virtual G4double HighLimit () const
 
virtual G4double LowLimit () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VCrossSectionSource
G4bool InLimits (G4double e, G4double eLow, G4double eHigh) const
 
const G4ParticleDefinitionFindLightParticle (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
G4double FcrossX (G4double e, G4double e0, G4double sigma, G4double eParam, G4double power) const
 
const G4ParticleDefinitionFindKeyParticle (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 

Detailed Description

Definition at line 54 of file G4XPDGElastic.hh.

Constructor & Destructor Documentation

◆ G4XPDGElastic()

G4XPDGElastic::G4XPDGElastic ( )

Definition at line 76 of file G4XPDGElastic.cc.

77{
85
86 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> pp(proton,proton);
87 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> pn(proton,neutron);
88 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> piPlusp(piPlus,proton);
89 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> piMinusp(piMinus,proton);
90 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> KPlusp(KPlus,proton);
91 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> KMinusp(KMinus,proton);
92 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> nn(neutron,neutron);
93 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> ppbar(proton,antiproton);
94 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> npbar(antiproton,neutron);
95
96 std::vector<G4double> ppData;
97 std::vector<G4double> pPiPlusData;
98 std::vector<G4double> pPiMinusData;
99 std::vector<G4double> pKPlusData;
100 std::vector<G4double> pKMinusData;
101 std::vector<G4double> ppbarData;
102 std::vector<G4double> npbarData;
103
104 G4int i;
105 for (i=0; i<2; i++)
106 {
107 ppData.push_back(ppPDGFit[i] * GeV);
108 pPiPlusData.push_back(pPiPlusPDGFit[i] * GeV);
109 pPiMinusData.push_back(pPiMinusPDGFit[i] * GeV);
110 pKPlusData.push_back(pKPlusPDGFit[i] * GeV);
111 pKMinusData.push_back(pKMinusPDGFit[i] * GeV);
112 ppbarData.push_back(ppbarPDGFit[i] * GeV);
113 npbarData.push_back(npbarPDGFit[i] * GeV);
114 }
115
116 for (i=2; i<nPar; i++)
117 {
118 ppData.push_back(ppPDGFit[i]);
119 pPiPlusData.push_back(pPiPlusPDGFit[i]);
120 pPiMinusData.push_back(pPiMinusPDGFit[i]);
121 pKPlusData.push_back(pKPlusPDGFit[i]);
122 pKMinusData.push_back(pKMinusPDGFit[i]);
123 ppbarData.push_back(ppbarPDGFit[i]);
124 npbarData.push_back(npbarPDGFit[i]);
125 }
126
127 xMap[nn] = ppData;
128 xMap[pp] = ppData;
129 xMap[pn] = ppData;
130 xMap[piPlusp] = pPiPlusData;
131 xMap[piMinusp] = pPiMinusData;
132 xMap[KPlusp] = pKPlusData;
133 xMap[KMinusp] = pKMinusData;
134 xMap[ppbar] = ppbarData;
135 xMap[npbar] = npbarData;
136}
int G4int
Definition: G4Types.hh:85
static G4AntiProton * AntiProtonDefinition()
Definition: G4AntiProton.cc:87
static G4KaonMinus * KaonMinusDefinition()
Definition: G4KaonMinus.cc:107
static G4KaonPlus * KaonPlusDefinition()
Definition: G4KaonPlus.cc:107
static G4Neutron * NeutronDefinition()
Definition: G4Neutron.cc:98
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:92
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:92
static G4Proton * ProtonDefinition()
Definition: G4Proton.cc:87

◆ ~G4XPDGElastic()

G4XPDGElastic::~G4XPDGElastic ( )
virtual

Definition at line 139 of file G4XPDGElastic.cc.

140{ }

Member Function Documentation

◆ CrossSection()

G4double G4XPDGElastic::CrossSection ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
virtual

Implements G4VCrossSectionSource.

Definition at line 155 of file G4XPDGElastic.cc.

156{
157 // Elastic Cross-section fit, 1994 Review of Particle Properties, (1994), 1
158
159 G4double sigma = 0.;
160
161 const G4ParticleDefinition* def1 = trk1.GetDefinition();
162 const G4ParticleDefinition* def2 = trk2.GetDefinition();
163
164 G4double sqrtS = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag();
165 G4double m_1 = def1->GetPDGMass();
166 G4double m_2 = def2->GetPDGMass();
167 G4double m_max = std::max(m_1,m_2);
168 // if (m1 > m) m = m1;
169
170 G4double pLab = 0.;
171
172 if (m_max > 0. && sqrtS > (m_1 + m_2))
173 {
174 pLab = std::sqrt( (sqrtS*sqrtS - (m_1+m_2)*(m_1+m_2) ) * (sqrtS*sqrtS - (m_1-m_2)*(m_1-m_2)) ) / (2*m_max);
175
176 // The PDG fit formula requires p in GeV/c
177
178 // Order the pair: first is the lower mass particle, second is the higher mass one
179 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> trkPair(def1,def2);
180 if (def1->GetPDGMass() > def2->GetPDGMass())
181 trkPair = std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *>(def2,def1);
182
183 std::vector<G4double> data;
184 G4double pMinFit = 0.;
185 G4double pMaxFit = 0.;
186 G4double aFit = 0.;
187 G4double bFit = 0.;
188 G4double cFit = 0.;
189 G4double dFit = 0.;
190 G4double nFit = 0.;
191
192 // Debug
193// G4cout << "Map has " << xMap.size() << " elements" << G4endl;
194 // Debug end
195
196 if (xMap.find(trkPair) != xMap.end())
197 {
198 PairDoubleMap::const_iterator iter;
199 for (iter = xMap.begin(); iter != xMap.end(); ++iter)
200 {
201 std::pair<const G4ParticleDefinition *,const G4ParticleDefinition *> thePair = (*iter).first;
202 if (thePair == trkPair)
203 {
204 data = (*iter).second;
205 pMinFit = data[0];
206 pMaxFit = data[1];
207 aFit = data[2];
208 bFit = data[3];
209 cFit = data[5];
210 dFit = data[6];
211 nFit = data[4];
212
213 if (pLab < pMinFit) return 0.0;
214 if (pLab > pMaxFit )
215 G4cout << "WARNING! G4XPDGElastic::PDGElastic "
216 << trk1.GetDefinition()->GetParticleName() << "-"
217 << trk2.GetDefinition()->GetParticleName()
218 << " elastic cross section: momentum "
219 << pLab / GeV << " GeV outside valid fit range "
220 << pMinFit /GeV << "-" << pMaxFit / GeV
221 << G4endl;
222
223 pLab /= GeV;
224 if (pLab > 0.)
225 {
226 G4double logP = G4Log(pLab);
227 sigma = aFit + bFit * G4Pow::GetInstance()->powA(pLab, nFit) + cFit * logP*logP + dFit * logP;
228 sigma = sigma * millibarn;
229 }
230 }
231 }
232 }
233 else
234 {
235 G4cout << "G4XPDGElastic::CrossSection - Data not found in Map" << G4endl;
236 }
237 }
238
239 if (sigma < 0.)
240 {
241 G4cout << "WARNING! G4XPDGElastic::PDGElastic "
242 << def1->GetParticleName() << "-" << def2->GetParticleName()
243 << " elastic cross section: momentum "
244 << pLab << " GeV, negative cross section "
245 << sigma / millibarn << " mb set to 0" << G4endl;
246 sigma = 0.;
247 }
248
249 return sigma;
250}
G4double G4Log(G4double x)
Definition: G4Log.hh:227
double G4double
Definition: G4Types.hh:83
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4ParticleDefinition * GetDefinition() const
const G4LorentzVector & Get4Momentum() const
const G4String & GetParticleName() const
static G4Pow * GetInstance()
Definition: G4Pow.cc:41
G4double powA(G4double A, G4double y) const
Definition: G4Pow.hh:230

Referenced by G4XMesonBaryonElastic::CrossSection().

◆ GetComponents()

virtual const G4CrossSectionVector * G4XPDGElastic::GetComponents ( ) const
inlinevirtual

Implements G4VCrossSectionSource.

Definition at line 68 of file G4XPDGElastic.hh.

68{ return 0; }

◆ IsValid()

G4bool G4XPDGElastic::IsValid ( G4double  e) const
virtual

Reimplemented from G4VCrossSectionSource.

Definition at line 260 of file G4XPDGElastic.cc.

261{
262 G4bool answer = InLimits(e,_lowLimit,_highLimit);
263
264 return answer;
265}
bool G4bool
Definition: G4Types.hh:86
G4bool InLimits(G4double e, G4double eLow, G4double eHigh) const

◆ LowLimit()

virtual G4double G4XPDGElastic::LowLimit ( ) const
inlinevirtual

Reimplemented from G4VCrossSectionSource.

Definition at line 74 of file G4XPDGElastic.hh.

74{ return _lowLimit; }

◆ Name()

G4String G4XPDGElastic::Name ( ) const
virtual

Implements G4VCrossSectionSource.

Definition at line 253 of file G4XPDGElastic.cc.

254{
255 G4String name = "PDGElastic ";
256 return name;
257}
const char * name(G4int ptype)

◆ operator!=()

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

Definition at line 149 of file G4XPDGElastic.cc.

150{
151 return (this != (G4XPDGElastic *) &right);
152}

◆ operator==()

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

Definition at line 143 of file G4XPDGElastic.cc.

144{
145 return (this == (G4XPDGElastic *) &right);
146}

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