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

#include <G4CollisionNNToNNstar.hh>

Inheritance diagram for G4CollisionNNToNNstar:
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
 
 G4CollisionNNToNNstar ()
 
virtual const G4VAngularDistributionGetAngularDistribution () const
 
virtual const G4CollisionVectorGetComponents () const
 
virtual const G4VCrossSectionSourceGetCrossSectionSource () const
 
virtual G4String GetName () const
 
G4bool IsInCharge (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
G4bool operator!= (const G4VCollision &right) const
 
G4bool operator== (const G4VCollision &right) const
 
virtual void Print () const
 
virtual void Print (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
virtual ~G4CollisionNNToNNstar ()
 

Protected Member Functions

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

Protected Attributes

std::vector< G4Stringresult
 

Private Member Functions

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

Private Attributes

G4Mutex bufferMutex
 
G4CollisionVector components
 
std::vector< G4CrossSectionBuffertheBuffer
 

Static Private Attributes

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

Detailed Description

Definition at line 41 of file G4CollisionNNToNNstar.hh.

Constructor & Destructor Documentation

◆ G4CollisionNNToNNstar() [1/2]

G4CollisionNNToNNstar::G4CollisionNNToNNstar ( )

◆ ~G4CollisionNNToNNstar()

virtual G4CollisionNNToNNstar::~G4CollisionNNToNNstar ( )
inlinevirtual

Definition at line 48 of file G4CollisionNNToNNstar.hh.

48{};

◆ G4CollisionNNToNNstar() [2/2]

G4CollisionNNToNNstar::G4CollisionNNToNNstar ( const G4CollisionNNToNNstar )
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 G4CollisionComposite::CrossSection ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
virtualinherited

Reimplemented from G4VCollision.

Reimplemented in G4CollisionMesonBaryonToResonance, and G4CollisionNN.

Definition at line 57 of file G4CollisionComposite.cc.

59{
60 G4double crossSect = 0.;
62 if (xSource != 0)
63 // There is a total cross section for this Collision
64 {
65 crossSect = xSource->CrossSection(trk1,trk2);
66 }
67 else
68 {
70 // waiting for mutable to enable buffering.
71 const_cast<G4CollisionComposite *>(this)->BufferCrossSection(trk1.GetDefinition(), trk2.GetDefinition());
72// G4cerr << "Buffer filled, reying with sqrts = "<< (trk1.Get4Momentum()+trk2.Get4Momentum()).mag() <<G4endl;
73 crossSect = BufferedCrossSection(trk1,trk2);
74 }
75 return crossSect;
76}
void BufferCrossSection(const G4ParticleDefinition *aP, const G4ParticleDefinition *bP)
G4double BufferedCrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual const G4VCrossSectionSource * GetCrossSectionSource() const
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0

References G4CollisionComposite::BufferCrossSection(), G4CollisionComposite::BufferedCrossSection(), G4CollisionComposite::bufferMutex, G4VCrossSectionSource::CrossSection(), G4CollisionComposite::GetCrossSectionSource(), and G4KineticTrack::GetDefinition().

Referenced by G4CollisionMesonBaryonToResonance::CrossSection().

◆ 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 * G4CollisionComposite::GetAngularDistribution ( ) const
inlinevirtualinherited

Implements G4VCollision.

Reimplemented in G4CollisionNN, and G4CollisionPN.

Definition at line 76 of file G4CollisionComposite.hh.

76{ return 0; }

◆ GetComponents()

virtual const G4CollisionVector * G4CollisionComposite::GetComponents ( ) const
inlinevirtualinherited

◆ GetCrossSectionSource()

virtual const G4VCrossSectionSource * G4CollisionComposite::GetCrossSectionSource ( ) const
inlinevirtualinherited

Implements G4VCollision.

Reimplemented in G4CollisionNN, and G4CollisionPN.

Definition at line 75 of file G4CollisionComposite.hh.

75{ return 0; }

Referenced by G4CollisionComposite::CrossSection().

◆ GetListOfColliders()

virtual const std::vector< G4String > & G4CollisionNNToNNstar::GetListOfColliders ( G4int  ) const
inlineprotectedvirtual

Implements G4VCollision.

Definition at line 59 of file G4CollisionNNToNNstar.hh.

60 {
61 throw G4HadronicException(__FILE__, __LINE__, "Tried to call G4CollisionNNToNNstar::GetListOfColliders. Please find out why!");
62 return result;
63 }
std::vector< G4String > result

References result.

◆ GetName()

virtual G4String G4CollisionNNToNNstar::GetName ( ) const
inlinevirtual

Implements G4VCollision.

Definition at line 50 of file G4CollisionNNToNNstar.hh.

50{ return "NN -> N N* Collision"; }

◆ 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!=()

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

Definition at line 48 of file G4VCollision.cc.

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

◆ operator=()

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

◆ operator==()

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

◆ components

G4CollisionVector G4CollisionComposite::components
privateinherited

◆ nPoints

const G4int G4CollisionComposite::nPoints = 32
staticprivateinherited

Definition at line 123 of file G4CollisionComposite.hh.

Referenced by G4CollisionComposite::BufferCrossSection().

◆ result

std::vector<G4String> G4CollisionNNToNNstar::result
protected

Definition at line 58 of file G4CollisionNNToNNstar.hh.

Referenced by GetListOfColliders().

◆ 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: