Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::SrcChannel Class Reference

#include <G4INCLSrcChannel.hh>

Inheritance diagram for G4INCL::SrcChannel:

Public Member Functions

 SrcChannel (Particle *p1, Particle *p2, Nucleus *n)
virtual ~SrcChannel ()
void fillFinalState (FinalState *fs)
void fillFinalState (FinalState *fs, ParticleType, ParticleType)
Public Member Functions inherited from G4INCL::IChannel
 IChannel ()
virtual ~IChannel ()
FinalStategetFinalState ()

Detailed Description

Definition at line 57 of file G4INCLSrcChannel.hh.

Constructor & Destructor Documentation

◆ SrcChannel()

G4INCL::SrcChannel::SrcChannel ( Particle * p1,
Particle * p2,
Nucleus * n )

Definition at line 54 of file G4INCLSrcChannel.cc.

55 : particle1(p1), particle2(p2), thenucleus(n) {
57 srcpartner = nullptr;
58 ftype1 = UnknownParticle;
59 ftype2 = UnknownParticle;
60}
G4float getsrcPairDistance()
Get the distance between src nucleons.

◆ ~SrcChannel()

G4INCL::SrcChannel::~SrcChannel ( )
virtual

Definition at line 62 of file G4INCLSrcChannel.cc.

62{}

Member Function Documentation

◆ fillFinalState() [1/2]

void G4INCL::SrcChannel::fillFinalState ( FinalState * fs)
virtual

Implements G4INCL::IChannel.

Definition at line 89 of file G4INCLSrcChannel.cc.

89 {
90
91 auto fSource = InteractionAvatar::Instance();
92
93 G4double psrcmax = 2.0 * PhysicalConstants::Pf; // Fermi momentum in MeV/c
94
95 if (particle1->getSrcPair() > 0) {
96
97 if (particle2->getSrcPair() > 0)
98 {
99 INCL_ERROR(particle2->print() << " \n");
100 }
101 srcpartner = findpairpartner(particle1);
102
103 if (srcpartner)
104 {
105 srcpartner->setSrcPartner();
106 fSource->setSrcPartner(srcpartner);
107
108 ThreeVector d1 = particle1->getPosition();
109 ThreeVector d2 = srcpartner->getPosition();
110 auto d = d1 - d2;
111 if (d.mag() > fDistSrc) {
112 INCL_DEBUG("Distance src > " << fDistSrc << " fm : " << d.mag()
113 << " \n");
114 }
115
116 auto x = (fDistSrc - d.mag()) / fDistSrc;
117 auto srcp = x * x * psrcmax;
118 INCL_DEBUG("Src momentum = " << srcp << " , eventnb: "
119 << theEventInfo.eventNumber << " \n");
120
121 auto pmomentum =
122 particle1->getMomentum() / particle1->getMomentum().mag() * srcp;
123 particle1->setMomentum(particle1->getMomentum() + pmomentum);
124 srcpartner->setMomentum(srcpartner->getMomentum() - pmomentum);
125
126 particle1->adjustEnergyFromMomentum();
127 srcpartner->adjustEnergyFromMomentum();
128 thenucleus->updatePotentialEnergy(srcpartner);
129
130 fs->addModifiedParticle(particle1);
131 fs->addModifiedParticle(particle2);
132 fs->addModifiedParticle(srcpartner);
133 }
134 } else {
135
136 if (particle1->getSrcPair() > 0)
137 {
138 INCL_ERROR(particle1->print() << " \n");
139 }
140 srcpartner = findpairpartner(particle2);
141
142 if (srcpartner)
143 {
144 srcpartner->setSrcPartner();
145 fSource->setSrcPartner(srcpartner);
146
147 ThreeVector d1 = particle2->getPosition();
148 ThreeVector d2 = srcpartner->getPosition();
149 auto d = d1 - d2;
150
151 if (d.mag() > fDistSrc) {
152 INCL_DEBUG("Distance src > " << fDistSrc << " fm : " << d.mag()
153 << " \n");
154 }
155
156 auto x = (fDistSrc - d.mag()) / fDistSrc;
157 auto srcp = x * x * psrcmax;
158 INCL_DEBUG("Src momentum = " << srcp << " , eventnb: "
159 << theEventInfo.eventNumber << " \n");
160
161 auto pmomentum =
162 particle2->getMomentum() / particle2->getMomentum().mag() * srcp;
163
164 particle2->setMomentum(particle2->getMomentum() + pmomentum);
165 srcpartner->setMomentum(srcpartner->getMomentum() - pmomentum);
166
167 particle2->adjustEnergyFromMomentum();
168 srcpartner->adjustEnergyFromMomentum();
169 thenucleus->updatePotentialEnergy(srcpartner);
170
171 fs->addModifiedParticle(particle1);
172 fs->addModifiedParticle(particle2);
173 fs->addModifiedParticle(srcpartner);
174 }
175 }
176 thenucleus->getStore()->getBook().incrementAcceptedSrcCollisions();
177}
#define INCL_ERROR(x)
#define INCL_DEBUG(x)
double G4double
Definition G4Types.hh:83
static InteractionAvatar * Instance()
const G4double Pf
Fermi momentum [MeV/c].

Referenced by fillFinalState().

◆ fillFinalState() [2/2]

void G4INCL::SrcChannel::fillFinalState ( FinalState * fs,
ParticleType type1,
ParticleType type2 )

Definition at line 82 of file G4INCLSrcChannel.cc.

83 {
84 ftype1 = type1;
85 ftype2 = type2;
87}
void fillFinalState(FinalState *fs)

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