Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VScatteringCollision Class Referenceabstract

#include <G4VScatteringCollision.hh>

+ Inheritance diagram for G4VScatteringCollision:

Public Member Functions

 G4VScatteringCollision ()
 
virtual ~G4VScatteringCollision ()
 
G4bool operator== (const G4VScatteringCollision &right) const
 
G4bool operator!= (const G4VScatteringCollision &right) const
 
virtual G4KineticTrackVectorFinalState (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
virtual const G4VAngularDistributionGetAngularDistribution () const
 
- Public Member Functions inherited from G4VCollision
 G4VCollision ()
 
virtual ~G4VCollision ()
 
G4bool operator== (const G4VCollision &right) const
 
G4bool operator!= (const G4VCollision &right) const
 
virtual G4double CrossSection (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 
virtual G4KineticTrackVectorFinalState (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
 
virtual G4bool IsInCharge (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
 
virtual G4String GetName () const =0
 
virtual void Print () const
 
virtual void Print (const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
 

Protected Member Functions

virtual const std::vector< const G4ParticleDefinition * > & GetOutgoingParticles () const =0
 
- Protected Member Functions inherited from G4VCollision
G4int GetNumberOfPartons (G4ParticleDefinition *aP) const
 
virtual const G4CollisionVectorGetComponents () const
 
virtual const G4VCrossSectionSourceGetCrossSectionSource () const =0
 
virtual const G4VAngularDistributionGetAngularDistribution () const =0
 
virtual const std::vector< G4String > & GetListOfColliders (G4int whichOne) const =0
 

Detailed Description

Definition at line 55 of file G4VScatteringCollision.hh.

Constructor & Destructor Documentation

◆ G4VScatteringCollision()

G4VScatteringCollision::G4VScatteringCollision ( )

Definition at line 47 of file G4VScatteringCollision.cc.

48{
49 theAngularDistribution = new G4AngularDistribution(true);
50}

◆ ~G4VScatteringCollision()

G4VScatteringCollision::~G4VScatteringCollision ( )
virtual

Definition at line 53 of file G4VScatteringCollision.cc.

54{
55 delete theAngularDistribution;
56}

Member Function Documentation

◆ FinalState()

G4KineticTrackVector * G4VScatteringCollision::FinalState ( const G4KineticTrack trk1,
const G4KineticTrack trk2 
) const
virtual

Implements G4VCollision.

Definition at line 59 of file G4VScatteringCollision.cc.

61{
62 const G4VAngularDistribution* angDistribution = GetAngularDistribution();
63 G4LorentzVector p = trk1.Get4Momentum() + trk2.Get4Momentum();
64 G4double sqrtS = p.m();
65 G4double S = sqrtS * sqrtS;
66
67 std::vector<const G4ParticleDefinition*> OutputDefinitions = GetOutgoingParticles();
68 if (OutputDefinitions.size() != 2)
69 throw G4HadronicException(__FILE__, __LINE__, "G4VScatteringCollision: Too many output particles!");
70
71 if (OutputDefinitions[0]->IsShortLived() && OutputDefinitions[1]->IsShortLived())
72 {
73 if(getenv("G4KCDEBUG")) G4cerr << "two shortlived for Type = "<<typeid(*this).name()<<G4endl;
74 // throw G4HadronicException(__FILE__, __LINE__, "G4VScatteringCollision: can't handle two shortlived particles!"); // @hpw@
75 }
76
77 G4double outm1 = OutputDefinitions[0]->GetPDGMass();
78 G4double outm2 = OutputDefinitions[1]->GetPDGMass();
79
80 if (OutputDefinitions[0]->IsShortLived())
81 {
82 outm1 = SampleResonanceMass(outm1,
83 OutputDefinitions[0]->GetPDGWidth(),
84 G4Neutron::NeutronDefinition()->GetPDGMass()+G4PionPlus::PionPlus()->GetPDGMass(),
85 sqrtS-(G4Neutron::NeutronDefinition()->GetPDGMass()+G4PionPlus::PionPlus()->GetPDGMass()));
86
87 }
88 if (OutputDefinitions[1]->IsShortLived())
89 {
90 outm2 = SampleResonanceMass(outm2, OutputDefinitions[1]->GetPDGWidth(),
91 G4Neutron::NeutronDefinition()->GetPDGMass()+G4PionPlus::PionPlus()->GetPDGMass(),
92 sqrtS-outm1);
93 }
94
95 // Angles of outgoing particles
96 G4double cosTheta = angDistribution->CosTheta(S, trk1.GetActualMass(), trk2.GetActualMass());
97 G4double phi = angDistribution->Phi();
98
99 // Unit vector of three-momentum
100 G4LorentzRotation fromCMSFrame(p.boostVector());
101 G4LorentzRotation toCMSFrame(fromCMSFrame.inverse());
102 G4LorentzVector TempPtr = toCMSFrame*trk1.Get4Momentum();
104 toZ.rotateZ(-1*TempPtr.phi());
105 toZ.rotateY(-1*TempPtr.theta());
106 G4LorentzRotation toCMS(toZ.inverse());
107
108 G4ThreeVector pFinal1(std::sin(std::acos(cosTheta))*std::cos(phi), std::sin(std::acos(cosTheta))*std::sin(phi), cosTheta);
109
110 // Three momentum in cm system
111 G4double pCM = std::sqrt( (S-(outm1+outm2)*(outm1+outm2)) * (S-(outm1-outm2)*(outm1-outm2)) /(4.*S));
112 pFinal1 = pFinal1 * pCM;
113 G4ThreeVector pFinal2 = -pFinal1;
114
115 G4double eFinal1 = std::sqrt(pFinal1.mag2() + outm1*outm1);
116 G4double eFinal2 = std::sqrt(pFinal2.mag2() + outm2*outm2);
117
118 G4LorentzVector p4Final1(pFinal1, eFinal1);
119 G4LorentzVector p4Final2(pFinal2, eFinal2);
120 p4Final1 = toCMS*p4Final1;
121 p4Final2 = toCMS*p4Final2;
122
123
124 // Lorentz transformation
125 G4LorentzRotation toLabFrame(p.boostVector());
126 p4Final1 *= toLabFrame;
127 p4Final2 *= toLabFrame;
128
129 // Final tracks are copies of incoming ones, with modified 4-momenta
130
131 G4double chargeBalance = OutputDefinitions[0]->GetPDGCharge()+OutputDefinitions[1]->GetPDGCharge();
132 chargeBalance-= trk1.GetDefinition()->GetPDGCharge();
133 chargeBalance-= trk2.GetDefinition()->GetPDGCharge();
134 if(std::abs(chargeBalance) >.1)
135 {
136 G4cout << "Charges in "<<typeid(*this).name()<<G4endl;
137 G4cout << OutputDefinitions[0]->GetPDGCharge()<<" "<<OutputDefinitions[0]->GetParticleName()
138 << OutputDefinitions[1]->GetPDGCharge()<<" "<<OutputDefinitions[1]->GetParticleName()
139 << trk1.GetDefinition()->GetPDGCharge()<<" "<<trk1.GetDefinition()->GetParticleName()
140 << trk2.GetDefinition()->GetPDGCharge()<<" "<<trk2.GetDefinition()->GetParticleName()<<G4endl;
141 }
142 G4KineticTrack* final1 = new G4KineticTrack(const_cast<G4ParticleDefinition *>(OutputDefinitions[0]), 0.0,
143 trk1.GetPosition(), p4Final1);
144 G4KineticTrack* final2 = new G4KineticTrack(const_cast<G4ParticleDefinition *>(OutputDefinitions[1]), 0.0,
145 trk2.GetPosition(), p4Final2);
146
148
149 finalTracks->push_back(final1);
150 finalTracks->push_back(final2);
151
152 return finalTracks;
153}
double G4double
Definition: G4Types.hh:64
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
double mag2() const
HepLorentzRotation & rotateY(double delta)
HepLorentzRotation & rotateZ(double delta)
HepLorentzRotation inverse() const
double theta() const
Hep3Vector boostVector() const
const G4ThreeVector & GetPosition() const
G4ParticleDefinition * GetDefinition() const
const G4LorentzVector & Get4Momentum() const
G4double GetActualMass() const
static G4Neutron * NeutronDefinition()
Definition: G4Neutron.cc:99
G4double GetPDGCharge() const
const G4String & GetParticleName() const
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:98
virtual G4double Phi() const
virtual G4double CosTheta(G4double s, G4double m1, G4double m2) const =0
virtual const G4VAngularDistribution * GetAngularDistribution() const
virtual const std::vector< const G4ParticleDefinition * > & GetOutgoingParticles() const =0

◆ GetAngularDistribution()

virtual const G4VAngularDistribution * G4VScatteringCollision::GetAngularDistribution ( ) const
inlinevirtual

Implements G4VCollision.

Definition at line 69 of file G4VScatteringCollision.hh.

70 {
71 return theAngularDistribution;
72 }

Referenced by FinalState().

◆ GetOutgoingParticles()

virtual const std::vector< const G4ParticleDefinition * > & G4VScatteringCollision::GetOutgoingParticles ( ) const
protectedpure virtual

Implemented in G4ConcreteNNTwoBodyResonance.

Referenced by FinalState().

◆ operator!=()

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

◆ operator==()

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

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