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

#include <G4ElementaryParticleCollider.hh>

+ Inheritance diagram for G4ElementaryParticleCollider:

Public Member Functions

 G4ElementaryParticleCollider ()
 
virtual ~G4ElementaryParticleCollider ()
 
void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
 
void setNucleusState (G4int a, G4int z)
 
- Public Member Functions inherited from G4CascadeColliderBase
 G4CascadeColliderBase (const G4String &name, G4int verbose=0)
 
virtual ~G4CascadeColliderBase ()
 
virtual void rescatter (G4InuclParticle *, G4KineticTrackVector *, G4V3DNucleus *, G4CollisionOutput &)
 
virtual void setVerboseLevel (G4int verbose=0)
 
- Public Member Functions inherited from G4VCascadeCollider
 G4VCascadeCollider (const G4String &name, G4int verbose=0)
 
virtual ~G4VCascadeCollider ()
 
virtual void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)=0
 
virtual void setVerboseLevel (G4int verbose=0)
 

Additional Inherited Members

- Protected Member Functions inherited from G4CascadeColliderBase
virtual G4bool useEPCollider (G4InuclParticle *bullet, G4InuclParticle *target) const
 
virtual G4bool inelasticInteractionPossible (G4InuclParticle *bullet, G4InuclParticle *target, G4double ekin) const
 
virtual G4bool validateOutput (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
 
virtual G4bool validateOutput (const G4Fragment &fragment, G4CollisionOutput &output)
 
virtual G4bool validateOutput (G4InuclParticle *bullet, G4InuclParticle *target, const std::vector< G4InuclElementaryParticle > &particles)
 
- Protected Member Functions inherited from G4VCascadeCollider
virtual void setName (const G4String &name)
 
- Protected Attributes inherited from G4CascadeColliderBase
G4InteractionCase interCase
 
G4CascadeCheckBalancebalance
 
- Protected Attributes inherited from G4VCascadeCollider
G4String theName
 
G4int verboseLevel
 

Detailed Description

Definition at line 73 of file G4ElementaryParticleCollider.hh.

Constructor & Destructor Documentation

◆ G4ElementaryParticleCollider()

G4ElementaryParticleCollider::G4ElementaryParticleCollider ( )

Definition at line 137 of file G4ElementaryParticleCollider.cc.

138 : G4CascadeColliderBase("G4ElementaryParticleCollider"),
139 nucleusA(0), nucleusZ(0) {;}

◆ ~G4ElementaryParticleCollider()

virtual G4ElementaryParticleCollider::~G4ElementaryParticleCollider ( )
inlinevirtual

Definition at line 76 of file G4ElementaryParticleCollider.hh.

76{};

Member Function Documentation

◆ collide()

void G4ElementaryParticleCollider::collide ( G4InuclParticle bullet,
G4InuclParticle target,
G4CollisionOutput output 
)
virtual

Implements G4VCascadeCollider.

Definition at line 143 of file G4ElementaryParticleCollider.cc.

146{
147 if (verboseLevel > 1)
148 G4cout << " >>> G4ElementaryParticleCollider::collide" << G4endl;
149
150 if (!useEPCollider(bullet,target)) { // Sanity check
151 G4cerr << " ElementaryParticleCollider -> can collide only particle with particle "
152 << G4endl;
153 return;
154 }
155
156#ifdef G4CASCADE_DEBUG_SAMPLER
157 static G4bool doPrintTables = true; // Once and only once per job
158 if (doPrintTables) {
160 doPrintTables = false;
161 }
162#endif
163
164 interCase.set(bullet, target); // To identify kind of collision
165
166 if (verboseLevel > 1) G4cout << *bullet << G4endl << *target << G4endl;
167
168 G4InuclElementaryParticle* particle1 =
169 dynamic_cast<G4InuclElementaryParticle*>(bullet);
170 G4InuclElementaryParticle* particle2 =
171 dynamic_cast<G4InuclElementaryParticle*>(target);
172
173 if (!particle1 || !particle2) { // Redundant with useEPCollider()
174 G4cerr << " ElementaryParticleCollider -> can only collide hadrons"
175 << G4endl;
176 return;
177 }
178
179 if (particle1->isNeutrino() || particle2->isNeutrino()) return;
180
181 // Check for available interaction, or pion+dibaryon special case
183 !particle1->quasi_deutron() && !particle2->quasi_deutron()) {
184 G4cerr << " ElementaryParticleCollider -> cannot collide "
185 << particle1->getDefinition()->GetParticleName() << " with "
186 << particle2->getDefinition()->GetParticleName() << G4endl;
187 return;
188 }
189
190 G4LorentzConvertor convertToSCM; // Utility to handle frame manipulation
191 if (particle2->nucleon() || particle2->quasi_deutron()) {
192 convertToSCM.setBullet(particle1);
193 convertToSCM.setTarget(particle2);
194 } else {
195 convertToSCM.setBullet(particle2);
196 convertToSCM.setTarget(particle1);
197 }
198
199 convertToSCM.setVerbose(verboseLevel);
200 convertToSCM.toTheCenterOfMass();
201
202 G4double etot_scm = convertToSCM.getTotalSCMEnergy();
203
204 // Generate any particle collision with nucleon
205 if (particle1->nucleon() || particle2->nucleon()) {
206 G4double ekin = convertToSCM.getKinEnergyInTheTRS();
207
208 // SPECIAL: Very low energy pions may be absorbed by a nucleon
209 if (pionNucleonAbsorption(ekin)) {
210 generateSCMpionNAbsorption(etot_scm, particle1, particle2);
211 } else {
212 generateSCMfinalState(ekin, etot_scm, particle1, particle2);
213 }
214 }
215
216 // Generate pion or photon collision with quasi-deuteron
217 if (particle1->quasi_deutron() || particle2->quasi_deutron()) {
218 if (!G4NucleiModel::useQuasiDeuteron(particle1->type(),particle2->type()) &&
219 !G4NucleiModel::useQuasiDeuteron(particle2->type(),particle1->type())) {
220 G4cerr << " ElementaryParticleCollider -> can only collide pi,mu,gamma with"
221 << " dibaryons " << G4endl;
222 return;
223 }
224
225 if (particle1->isMuon() || particle2->isMuon()) {
226 generateSCMmuonAbsorption(etot_scm, particle1, particle2);
227 } else { // Currently, pion absoprtion also handles gammas
228 generateSCMpionAbsorption(etot_scm, particle1, particle2);
229 }
230 }
231
232 if (particles.empty()) { // No final state possible, pass bullet through
233 if (verboseLevel) {
234 G4cerr << " ElementaryParticleCollider -> failed to collide "
235 << particle1->getMomModule() << " GeV/c "
236 << particle1->getDefinition()->GetParticleName() << " with "
237 << particle2->getDefinition()->GetParticleName() << G4endl;
238 }
239 return;
240 }
241
242 // Convert final state back to lab frame
243 G4LorentzVector mom; // Buffer to avoid memory churn
244 particleIterator ipart;
245 for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
246 mom = convertToSCM.backToTheLab(ipart->getMomentum());
247 ipart->setMomentum(mom);
248 };
249
250 if (verboseLevel) {
251 // Check conservation in multibody final state
252 const G4ParticleDefinition* bDef = bullet->getDefinition();
253 const G4ParticleDefinition* tDef = target->getDefinition();
254
255 G4int initBaryonNumber = bDef->GetBaryonNumber() + tDef->GetBaryonNumber();
256 G4int initCharge = bullet->getCharge() + target->getCharge();
257 G4int initStrangeness = bDef->GetQuarkContent(3) - bDef->GetAntiQuarkContent(3) +
258 tDef->GetQuarkContent(3) - tDef->GetAntiQuarkContent(3);
259
260 G4int finalBaryonNumber = 0;
261 G4int finalCharge = 0;
262 G4int finalStrangeness = 0;
263
264 for (ipart = particles.begin(); ipart != particles.end(); ipart++) {
265 finalBaryonNumber += ipart->baryon();
266 finalCharge += ipart->getCharge();
267 finalStrangeness += ipart->getStrangeness();
268 }
269
270 G4int bnc = finalBaryonNumber - initBaryonNumber;
271 G4int cnc = finalCharge - initCharge;
272 G4int snc = finalStrangeness - initStrangeness;
273
274 if (bnc != 0 || cnc != 0 || snc != 0) {
275 G4cout << " G4ElementaryParticleCollider: quantum number non-conservation " << G4endl;
276 G4cout << " Baryon number: initial = " << initBaryonNumber << ", final = "
277 << finalBaryonNumber << G4endl;
278 G4cout << " Charge: initial = " << initCharge << ", final = "
279 << finalCharge << G4endl;
280 G4cout << " Strangeness: initial = " << initStrangeness << ", final = "
281 << finalStrangeness << G4endl;
282
283 G4cout << " bullet = " << bDef->GetParticleName() << G4endl;
284 G4cout << " target = " << tDef->GetParticleName() << G4endl;
285 G4cout << " secondaries = " ;
286 for (ipart = particles.begin(); ipart != particles.end(); ipart++) {
287 G4cout << ipart->getDefinition()->GetParticleName() << " " ;
288 }
289 G4cout << G4endl;
290 }
291 }
292
293 if (verboseLevel && !validateOutput(bullet, target, particles)) {
294 G4cout << " incoming particles: \n" << *particle1 << G4endl
295 << *particle2 << G4endl
296 << " outgoing particles: " << G4endl;
297 for(ipart = particles.begin(); ipart != particles.end(); ipart++)
298 G4cout << *ipart << G4endl;
299
300 G4cout << " <<< Non-conservation in G4ElementaryParticleCollider"
301 << G4endl;
302 }
303
304 std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
305 output.addOutgoingParticles(particles);
306}
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:64
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static void Print(std::ostream &os=G4cout)
static const G4CascadeChannel * GetTable(G4int initialState)
virtual G4bool useEPCollider(G4InuclParticle *bullet, G4InuclParticle *target) const
virtual G4bool validateOutput(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
G4int hadrons() const
void set(G4InuclParticle *part1, G4InuclParticle *part2)
const G4ParticleDefinition * getDefinition() const
G4double getMomModule() const
G4double getCharge() const
G4double getTotalSCMEnergy() const
void setVerbose(G4int vb=0)
void setBullet(const G4InuclParticle *bullet)
G4LorentzVector backToTheLab(const G4LorentzVector &mom) const
G4double getKinEnergyInTheTRS() const
void setTarget(const G4InuclParticle *target)
static G4bool useQuasiDeuteron(G4int ptype, G4int qdtype=0)
G4int GetQuarkContent(G4int flavor) const
const G4String & GetParticleName() const
G4int GetAntiQuarkContent(G4int flavor) const

Referenced by G4InuclCollider::collide(), G4LightTargetCollider::collide(), and G4NucleiModel::generateParticleFate().

◆ setNucleusState()

void G4ElementaryParticleCollider::setNucleusState ( G4int  a,
G4int  z 
)
inline

Definition at line 81 of file G4ElementaryParticleCollider.hh.

81 { // Nucleus to use for recoil
82 nucleusA = a; nucleusZ = z;
83 }

Referenced by G4NucleiModel::generateParticleFate().


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