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

#include <G4CollisionNN.hh>

Inheritance diagram for G4CollisionNN:
G4GeneralNNCollision G4CollisionComposite G4VCollision

Public Member Functions

void AddComponent (G4VCollision *aC)
 
virtual G4double CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
void establish_G4MT_TLS_G4VCollision ()
 
virtual G4KineticTrackVectorFinalState (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
 G4CollisionNN ()
 
virtual G4String GetName () const
 
G4bool IsInCharge (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
G4bool operator!= (const G4CollisionNN &right) const
 
G4bool operator!= (const G4VCollision &right) const
 
G4bool operator== (const G4CollisionNN &right) const
 
G4bool operator== (const G4VCollision &right) const
 
virtual void Print () const
 
virtual void Print (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
virtual ~G4CollisionNN ()
 

Protected Member Functions

virtual const G4VAngularDistributionGetAngularDistribution () const
 
virtual const G4CollisionVectorGetComponents () const
 
virtual const G4VCrossSectionSourceGetCrossSectionSource () const
 
virtual const std::vector< G4String > & GetListOfColliders (G4int whichOne) const
 
G4int GetNumberOfPartons (const G4ParticleDefinition *aP) const
 

Private Member Functions

void BufferCrossSection (const G4ParticleDefinition *aP, const G4ParticleDefinition *bP)
 
G4double BufferedCrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
 G4CollisionNN (const G4CollisionNN &)
 
G4CollisionNNoperator= (const G4CollisionNN &)
 

Private Attributes

G4Mutex bufferMutex
 
std::vector< G4Stringcolliders1
 
std::vector< G4Stringcolliders2
 
G4CollisionVectorcomponents
 
G4VCrossSectionSourcecrossSectionSource
 
std::vector< G4CrossSectionBuffertheBuffer
 

Static Private Attributes

static const G4int nPoints = 32
 
static const G4double theT []
 

Detailed Description

Definition at line 39 of file G4CollisionNN.hh.

Constructor & Destructor Documentation

◆ G4CollisionNN() [1/2]

G4CollisionNN::G4CollisionNN ( )

Definition at line 54 of file G4CollisionNN.cc.

55{
56 components=0;
60}
G4CollisionVector * components
G4VCrossSectionSource * crossSectionSource
static void Apply()
Definition: G4Pair.hh:179

References G4ForEach< group >::Apply(), components, and crossSectionSource.

◆ ~G4CollisionNN()

G4CollisionNN::~G4CollisionNN ( )
virtual

Definition at line 63 of file G4CollisionNN.cc.

64{
65 if (components) {
66 delete components;
67 components=0;
68 }
69 delete crossSectionSource;
71}

References components, and crossSectionSource.

◆ G4CollisionNN() [2/2]

G4CollisionNN::G4CollisionNN ( const G4CollisionNN )
private

Member Function Documentation

◆ AddComponent()

void G4CollisionComposite::AddComponent ( G4VCollision aC)
inlineinherited

◆ BufferCrossSection()

void G4CollisionComposite::BufferCrossSection ( const G4ParticleDefinition aP,
const G4ParticleDefinition bP 
)
privateinherited

Definition at line 141 of file G4CollisionComposite.cc.

143{
144 // check if already buffered
145 size_t i;
146 for(i=0; i<theBuffer.size(); i++)
147 {
148 if(theBuffer[i].InCharge(aP, bP)) return;
149 }
150// G4cerr << "Buffering for "<<aP->GetParticleName()<<" "<<bP->GetParticleName()<<G4endl;
151
152 // buffer the new one.
153 G4CrossSectionBuffer aNewBuff(aP, bP);
154 size_t maxE=nPoints;
155 for(size_t tt=0; tt<maxE; tt++)
156 {
157 G4double aT = theT[tt]*GeV;
158 G4double crossSect = 0;
159 // The total cross-section is summed over all the component channels
160
161 //A.R. 28-Sep-2012 Fix reproducibility problem
162 // Assign the kinetic energy to the lightest of the
163 // two particles, instead to the first one always.
164 G4double atime = 0;
165 G4double btime = 0;
166 G4ThreeVector aPosition(0,0,0);
167 G4ThreeVector bPosition(0,0,0);
168 G4double aM = aP->GetPDGMass();
169 G4double bM = bP->GetPDGMass();
170 G4double aE = aM;
171 G4double bE = bM;
172 G4ThreeVector aMom(0,0,0);
173 G4ThreeVector bMom(0,0,0);
174 if ( aM <= bM ) {
175 aE += aT;
176 aMom = G4ThreeVector(0,0,std::sqrt(aE*aE-aM*aM));
177 } else {
178 bE += aT;
179 bMom = G4ThreeVector(0,0,std::sqrt(bE*bE-bM*bM));
180 }
181 G4LorentzVector a4Momentum(aE, aMom);
182 G4LorentzVector b4Momentum(bE, bMom);
183 G4KineticTrack a(aP, atime, aPosition, a4Momentum);
184 G4KineticTrack b(bP, btime, bPosition, b4Momentum);
185
186 for (i=0; i<components.size(); i++)
187 {
188 if(components[i]->IsInCharge(a,b))
189 {
190 crossSect += components[i]->CrossSection(a,b);
191 }
192 }
193 G4double sqrts = (a4Momentum+b4Momentum).mag();
194 aNewBuff.push_back(sqrts, crossSect);
195 }
196 theBuffer.push_back(aNewBuff);
197// theBuffer.back().Print();
198}
static constexpr double GeV
Definition: G4SIunits.hh:203
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
std::vector< G4CrossSectionBuffer > theBuffer
virtual G4bool IsInCharge(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
static const G4int nPoints
static const G4double theT[]

References G4CollisionComposite::components, G4ParticleDefinition::GetPDGMass(), GeV, G4CollisionComposite::IsInCharge(), G4CollisionComposite::nPoints, G4CrossSectionBuffer::push_back(), G4CollisionComposite::theBuffer, and G4CollisionComposite::theT.

Referenced by G4CollisionComposite::CrossSection().

◆ BufferedCrossSection()

G4double G4CollisionComposite::BufferedCrossSection ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
privateinherited

Definition at line 201 of file G4CollisionComposite.cc.

203{
204 for(size_t i=0; i<theBuffer.size(); i++)
205 {
206 if(theBuffer[i].InCharge(trk1.GetDefinition(), trk2.GetDefinition()))
207 {
208 return theBuffer[i].CrossSection(trk1, trk2);
209 }
210 }
211 throw G4HadronicException(__FILE__, __LINE__, "G4CollisionComposite::BufferedCrossSection - Blitz !!");
212 return 0;
213}
const G4ParticleDefinition * GetDefinition() const

References G4KineticTrack::GetDefinition(), and G4CollisionComposite::theBuffer.

Referenced by G4CollisionComposite::CrossSection().

◆ CrossSection()

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

Reimplemented from G4CollisionComposite.

Definition at line 81 of file G4CollisionNN.cc.

83{
84 G4double sigma = 0.;
85
86 // nucleon-nucleon cross-sections made for on-shell particles.
87 // here we take the kinetic energy as the quantity relevant
88 // for calculating the scattering cross-sections for off-shell hadrons
89
91 G4LorentzVector p1 = aTrk1.Get4Momentum();
92 G4LorentzVector p2 = aTrk2.Get4Momentum();
93 G4double t1 = p1.e()-aTrk1.GetActualMass();
94 G4double t2 = p2.e()-aTrk2.GetActualMass();
95 p1.setE(t1+aTrk1.GetDefinition()->GetPDGMass());
96 p2.setE(t2+aTrk2.GetDefinition()->GetPDGMass());
97 G4KineticTrack trk1(aTrk1);
98 trk1.Set4Momentum(p1);
99 G4KineticTrack trk2(aTrk2);
100 trk2.Set4Momentum(p2);
101 if( (p1+p2).mag()<aTrk1.GetDefinition()->GetPDGMass()+aTrk2.GetDefinition()->GetPDGMass())
102 {
103 return 0.;
104 }
105
106 if (xSource != 0)
107 {
108 // There is a cross section for this Collision
109 sigma = xSource->CrossSection(trk1,trk2);
110 }
111 return sigma;
112}
virtual const G4VCrossSectionSource * GetCrossSectionSource() const
void Set4Momentum(const G4LorentzVector &a4Momentum)
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0

References G4VCrossSectionSource::CrossSection(), CLHEP::HepLorentzVector::e(), G4KineticTrack::Get4Momentum(), G4KineticTrack::GetActualMass(), GetCrossSectionSource(), G4KineticTrack::GetDefinition(), G4ParticleDefinition::GetPDGMass(), G4KineticTrack::Set4Momentum(), and CLHEP::HepLorentzVector::setE().

◆ establish_G4MT_TLS_G4VCollision()

void G4VCollision::establish_G4MT_TLS_G4VCollision ( )
inherited

◆ FinalState()

G4KineticTrackVector * G4CollisionComposite::FinalState ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
virtualinherited

Implements G4VCollision.

Definition at line 79 of file G4CollisionComposite.cc.

81{
82 std::vector<G4double> cxCache;
83 G4double partialCxSum = 0.0;
84
85 size_t i;
86 for (i=0; i<components.size(); i++)
87 {
88 G4double partialCx;
89// cout << "comp" << i << " " << components[i]()->GetName();
90 if (components[i]->IsInCharge(trk1,trk2))
91 {
92 partialCx = components[i]->CrossSection(trk1,trk2);
93 }
94 else
95 {
96 partialCx = 0.0;
97 }
98// cout << " cx=" << partialCx << endl;
99 partialCxSum += partialCx;
100 cxCache.push_back(partialCx);
101 }
102
103 G4double random = G4UniformRand()*partialCxSum;
104 G4double running = 0;
105 for (i=0; i<cxCache.size(); i++)
106 {
107 running += cxCache[i];
108 if (running > random)
109 {
110 return components[i]->FinalState(trk1, trk2);
111 }
112 }
113// G4cerr <<"in charge = "<<IsInCharge(trk1, trk2)<<G4endl;
114// G4cerr <<"Cross-section = "<<CrossSection(trk1, trk2)/millibarn<<" "<<running<<" "<<cxCache.size()<<G4endl;
115// G4cerr <<"Names = "<<trk1.GetDefinition()->GetParticleName()<<", "<<trk2.GetDefinition()->GetParticleName()<<G4endl;
116// throw G4HadronicException(__FILE__, __LINE__, "G4CollisionComposite: no final state found!");
117 return NULL;
118}
#define G4UniformRand()
Definition: Randomize.hh:52

References G4CollisionComposite::components, G4UniformRand, and G4CollisionComposite::IsInCharge().

◆ GetAngularDistribution()

virtual const G4VAngularDistribution * G4CollisionNN::GetAngularDistribution ( ) const
inlineprotectedvirtual

Reimplemented from G4CollisionComposite.

Definition at line 64 of file G4CollisionNN.hh.

64{ return 0; }

◆ GetComponents()

virtual const G4CollisionVector * G4CollisionNN::GetComponents ( ) const
inlineprotectedvirtual

Reimplemented from G4CollisionComposite.

Definition at line 66 of file G4CollisionNN.hh.

66{ return components; }

References components.

◆ GetCrossSectionSource()

virtual const G4VCrossSectionSource * G4CollisionNN::GetCrossSectionSource ( ) const
inlineprotectedvirtual

Reimplemented from G4CollisionComposite.

Definition at line 63 of file G4CollisionNN.hh.

63{ return crossSectionSource; }

References crossSectionSource.

Referenced by CrossSection().

◆ GetListOfColliders()

const std::vector< G4String > & G4CollisionNN::GetListOfColliders ( G4int  whichOne) const
protectedvirtual

Implements G4VCollision.

Definition at line 74 of file G4CollisionNN.cc.

75{
76 throw G4HadronicException(__FILE__, __LINE__, "G4CollisionNN::GetListOfColliders - Argument outside valid range");
77 return colliders1;
78}
std::vector< G4String > colliders1

References colliders1.

◆ GetName()

virtual G4String G4CollisionNN::GetName ( ) const
inlinevirtual

Implements G4VCollision.

Definition at line 51 of file G4CollisionNN.hh.

51{ return "NN CollisionComposite"; }

◆ GetNumberOfPartons()

G4int G4VCollision::GetNumberOfPartons ( const G4ParticleDefinition aP) const
inlineprotectedinherited

Definition at line 68 of file G4VCollision.hh.

69 {
70 G4int result = 0;
71 for(G4int i=0; i<6; i++)
72 {
73 result += aP->GetQuarkContent(i+1);
74 result += aP->GetAntiQuarkContent(i+1);
75 }
76 return result;
77 }
int G4int
Definition: G4Types.hh:85
G4int GetQuarkContent(G4int flavor) const
G4int GetAntiQuarkContent(G4int flavor) const

References G4ParticleDefinition::GetAntiQuarkContent(), and G4ParticleDefinition::GetQuarkContent().

Referenced by G4CollisionMesonBaryonElastic::IsInCharge().

◆ IsInCharge()

G4bool G4GeneralNNCollision::IsInCharge ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
inlinevirtualinherited

Reimplemented from G4CollisionComposite.

Definition at line 40 of file G4GeneralNNCollision.hh.

41 {
42 G4bool result = false;
43 const G4ParticleDefinition * aD = trk1.GetDefinition();
44 const G4ParticleDefinition * bD = trk2.GetDefinition();
45 if( (aD==G4Proton::Proton() || aD == G4Neutron::Neutron())
46 &&(bD==G4Proton::Proton() || bD == G4Neutron::Neutron()) ) result = true;
47 return result;
48 }
bool G4bool
Definition: G4Types.hh:86
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
static G4Proton * Proton()
Definition: G4Proton.cc:92

References G4KineticTrack::GetDefinition(), G4Neutron::Neutron(), and G4Proton::Proton().

◆ operator!=() [1/2]

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

◆ operator!=() [2/2]

G4bool G4VCollision::operator!= ( const G4VCollision right) const
inherited

Definition at line 48 of file G4VCollision.cc.

49{
50 return (this != (G4VCollision *) &right);
51}

◆ operator=()

G4CollisionNN & G4CollisionNN::operator= ( const G4CollisionNN )
private

◆ operator==() [1/2]

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

◆ operator==() [2/2]

G4bool G4VCollision::operator== ( const G4VCollision right) const
inherited

Definition at line 42 of file G4VCollision.cc.

43{
44 return (this == (G4VCollision *) &right);
45}

◆ Print() [1/2]

void G4VCollision::Print ( ) const
virtualinherited

Definition at line 70 of file G4VCollision.cc.

71{
73
74 G4cout << "---- " << name << "---- Cross section" << G4endl;
75
77 if (xSource) xSource->Print();
78
79 G4int nComponents = 0;
80 const G4CollisionVector* components = GetComponents();
81 if (components)
82 {
83 nComponents = components->size();
84 }
85 G4cout << "---- " << name << "---- has " << nComponents << " components" <<G4endl;
86 G4int i = 0;
87 G4CollisionVector::const_iterator iter;
88 if (components)
89 {
90 for (iter = components->begin(); iter != components->end(); ++iter)
91 {
92 G4cout << "---- " << name << " ---- Component " << i << G4endl;
93 ((*iter))->Print();
94 i++;
95 }
96 }
97
98}
std::vector< G4VCollision * > G4CollisionVector
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
virtual const G4CollisionVector * GetComponents() const
Definition: G4VCollision.hh:79
virtual void Print() const
Definition: G4VCollision.cc:70
virtual const G4VCrossSectionSource * GetCrossSectionSource() const =0
virtual G4String GetName() const =0
virtual void Print() const
const char * name(G4int ptype)

References G4cout, G4endl, G4VCollision::GetComponents(), G4VCollision::GetCrossSectionSource(), G4VCollision::GetName(), G4InuclParticleNames::name(), G4VCollision::Print(), and G4VCrossSectionSource::Print().

Referenced by G4VCollision::Print().

◆ Print() [2/2]

void G4VCollision::Print ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
virtualinherited

Definition at line 101 of file G4VCollision.cc.

103{
105
106 if (IsInCharge(trk1,trk2))
107 {
108 G4cout << "---- " << name << "is in charge ---- " << G4endl;
109 }
110 else
111 {
112 G4cout << "---- " << name << "is not in charge ---- " << G4endl;
113 }
114
115 G4cout << "---- " << name << "---- Cross section" << G4endl;
116
118 if (xSource) xSource->Print();
119 G4cout << "Cross section = " << CrossSection(trk1,trk2) << G4endl;
120
121 G4int nComponents = 0;
122 const G4CollisionVector* components = GetComponents();
123 if (components)
124 {
125 nComponents = components->size();
126 }
127 G4cout << "---- " << name << "has " << nComponents << " components" <<G4endl;
128
129 G4int i = 0;
130 G4CollisionVector::const_iterator iter;
131 if (components)
132 {
133 for (iter = components->begin(); iter != components->end(); ++iter)
134 {
135 G4cout << "Component " << i << G4endl;
136 ((*iter))->Print();
137 i++;
138 }
139 }
140}
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
Definition: G4VCollision.cc:54
virtual G4bool IsInCharge(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0

References G4VCollision::CrossSection(), G4cout, G4endl, G4VCollision::GetComponents(), G4VCollision::GetCrossSectionSource(), G4VCollision::GetName(), G4VCollision::IsInCharge(), G4InuclParticleNames::name(), G4VCollision::Print(), and G4VCrossSectionSource::Print().

Field Documentation

◆ bufferMutex

G4Mutex G4CollisionComposite::bufferMutex
mutableprivateinherited

◆ colliders1

std::vector<G4String> G4CollisionNN::colliders1
private

Definition at line 76 of file G4CollisionNN.hh.

Referenced by GetListOfColliders().

◆ colliders2

std::vector<G4String> G4CollisionNN::colliders2
private

Definition at line 77 of file G4CollisionNN.hh.

◆ components

G4CollisionVector* G4CollisionNN::components
private

Definition at line 72 of file G4CollisionNN.hh.

Referenced by G4CollisionNN(), GetComponents(), and ~G4CollisionNN().

◆ crossSectionSource

G4VCrossSectionSource* G4CollisionNN::crossSectionSource
private

Definition at line 74 of file G4CollisionNN.hh.

Referenced by G4CollisionNN(), GetCrossSectionSource(), and ~G4CollisionNN().

◆ nPoints

const G4int G4CollisionComposite::nPoints = 32
staticprivateinherited

Definition at line 123 of file G4CollisionComposite.hh.

Referenced by G4CollisionComposite::BufferCrossSection().

◆ theBuffer

std::vector<G4CrossSectionBuffer> G4CollisionComposite::theBuffer
privateinherited

◆ theT

const G4double G4CollisionComposite::theT
staticprivateinherited
Initial value:
=
{.01, .03, .05, .1, .15, .2, .3, .4, .5, .6, .7, .8, .9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0, 8.0, 10., 15, 20, 50, 100}

Definition at line 124 of file G4CollisionComposite.hh.

Referenced by G4CollisionComposite::BufferCrossSection().


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