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

#include <G4InuclCollider.hh>

+ Inheritance diagram for G4InuclCollider:

Public Member Functions

 G4InuclCollider ()
 
virtual ~G4InuclCollider ()
 
void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &globalOutput)
 
void rescatter (G4InuclParticle *bullet, G4KineticTrackVector *theSecondaries, G4V3DNucleus *theNucleus, G4CollisionOutput &globalOutput)
 
void setVerboseLevel (G4int verbose=0)
 
void useCascadeDeexcitation ()
 
void usePreCompoundDeexcitation ()
 
- Public Member Functions inherited from G4CascadeColliderBase
 G4CascadeColliderBase (const char *name, G4int verbose=0)
 
virtual ~G4CascadeColliderBase ()
 
virtual void rescatter (G4InuclParticle *, G4KineticTrackVector *, G4V3DNucleus *, G4CollisionOutput &)
 
virtual void setVerboseLevel (G4int verbose=0)
 
virtual void setConservationChecks (G4bool doBalance=true)
 
- Public Member Functions inherited from G4VCascadeCollider
 G4VCascadeCollider (const char *name, G4int verbose=0)
 
virtual ~G4VCascadeCollider ()
 
virtual void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)=0
 
virtual void setVerboseLevel (G4int verbose=0)
 

Protected Member Functions

void deexcite (const G4Fragment &fragment, G4CollisionOutput &globalOutput)
 
- Protected Member Functions inherited from G4CascadeColliderBase
virtual G4bool useEPCollider (G4InuclParticle *bullet, G4InuclParticle *target) const
 
virtual G4bool explosion (G4InuclNuclei *target) const
 
virtual G4bool explosion (G4Fragment *target) const
 
virtual G4bool explosion (G4int A, G4int Z, G4double excitation) const
 
virtual G4bool inelasticInteractionPossible (G4InuclParticle *bullet, G4InuclParticle *target, G4double ekin) const
 
virtual G4bool validateOutput (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
 
virtual G4bool validateOutput (G4InuclParticle *bullet, G4InuclParticle *target, const std::vector< G4InuclElementaryParticle > &particles)
 
virtual G4bool validateOutput (G4InuclParticle *bullet, G4InuclParticle *target, const std::vector< G4InuclNuclei > &fragments)
 
- Protected Member Functions inherited from G4VCascadeCollider
virtual void setName (const char *name)
 

Additional Inherited Members

- Protected Attributes inherited from G4CascadeColliderBase
G4InteractionCase interCase
 
G4bool doConservationChecks
 
G4CascadeCheckBalancebalance
 
- Protected Attributes inherited from G4VCascadeCollider
const char * theName
 
G4int verboseLevel
 

Detailed Description

Definition at line 59 of file G4InuclCollider.hh.

Constructor & Destructor Documentation

◆ G4InuclCollider()

G4InuclCollider::G4InuclCollider ( )

◆ ~G4InuclCollider()

G4InuclCollider::~G4InuclCollider ( )
virtual

Definition at line 84 of file G4InuclCollider.cc.

84 {
85 delete theElementaryParticleCollider;
86 delete theIntraNucleiCascader;
87 delete theDeexcitation;
88}

Member Function Documentation

◆ collide()

void G4InuclCollider::collide ( G4InuclParticle bullet,
G4InuclParticle target,
G4CollisionOutput globalOutput 
)
virtual

Implements G4VCascadeCollider.

Definition at line 121 of file G4InuclCollider.cc.

122 {
123 if (verboseLevel) G4cout << " >>> G4InuclCollider::collide" << G4endl;
124
125 const G4int itry_max = 100;
126
127 // Particle-on-particle collision; no nucleus involved
128 if (useEPCollider(bullet,target)) {
129 if (verboseLevel > 2)
130 G4cout << " InuclCollider -> particle on particle collision" << G4endl;
131
132 theElementaryParticleCollider->collide(bullet, target, globalOutput);
133 return;
134 }
135
136 interCase.set(bullet,target); // Classify collision type
137 if (verboseLevel > 2) {
138 G4cout << " InuclCollider -> inter case " << interCase.code() << G4endl;
139 }
140
141 if (!interCase.valid()) {
142 if (verboseLevel > 1)
143 G4cerr << " InuclCollider -> no collision possible " << G4endl;
144
145 globalOutput.trivialise(bullet, target);
146 return;
147 }
148
149 // Target must be a nucleus
150 G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(interCase.getTarget());
151 if (!ntarget) {
152 G4cerr << " InuclCollider -> ERROR target is not a nucleus " << G4endl;
153
154 globalOutput.trivialise(bullet, target);
155 return;
156 }
157
158 G4int btype = 0;
159 G4int ab = 0;
160 G4int zb = 0;
161
162 if (interCase.hadNucleus()) { // particle with nuclei
163 G4InuclElementaryParticle* pbullet =
165
166 if (!pbullet) {
167 G4cerr << " InuclCollider -> ERROR bullet is not a hadron " << G4endl;
168 globalOutput.trivialise(bullet, target);
169 return;
170 }
171
172 if (!G4CascadeChannelTables::GetTable(pbullet->type())) {
173 G4cerr << " InuclCollider -> ERROR can not collide with "
174 << pbullet->getDefinition()->GetParticleName() << G4endl;
175 globalOutput.trivialise(bullet, target);
176 return;
177 }
178
179 btype = pbullet->type();
180 } else { // nuclei with nuclei
181 G4InuclNuclei* nbullet =
182 dynamic_cast<G4InuclNuclei*>(interCase.getBullet());
183 if (!nbullet) {
184 G4cerr << " InuclCollider -> ERROR bullet is not a nucleus " << G4endl;
185 globalOutput.trivialise(bullet, target);
186 return;
187 }
188
189 ab = nbullet->getA();
190 zb = nbullet->getZ();
191 }
192
193 G4LorentzConvertor convertToTargetRestFrame(bullet, ntarget);
194 G4double ekin = convertToTargetRestFrame.getKinEnergyInTheTRS();
195
196 if (verboseLevel > 3) G4cout << " ekin in trs " << ekin << G4endl;
197
198 if (!inelasticInteractionPossible(bullet, target, ekin)) {
199 if (verboseLevel > 3)
200 G4cout << " InuclCollider -> inelastic interaction is impossible\n"
201 << " due to the coulomb barirer " << G4endl;
202
203 globalOutput.trivialise(bullet, target);
204 return;
205 }
206
207 // Generate interaction secondaries in rest frame of target nucleus
208 convertToTargetRestFrame.toTheTargetRestFrame();
209 if (verboseLevel > 3) {
210 G4cout << " degenerated? " << convertToTargetRestFrame.trivial()
211 << G4endl;
212 }
213
214 G4LorentzVector bmom; // Bullet is along local Z
215 bmom.setZ(convertToTargetRestFrame.getTRSMomentum());
216
217 // Need to make copy of bullet with momentum realigned
218 G4InuclParticle* zbullet = 0;
219 if (interCase.hadNucleus())
220 zbullet = new G4InuclElementaryParticle(bmom, btype);
221 else
222 zbullet = new G4InuclNuclei(bmom, ab, zb);
223
224 G4int itry = 0;
225 while (itry < itry_max) {
226 itry++;
227 if (verboseLevel > 2)
228 G4cout << " InuclCollider itry " << itry << G4endl;
229
230 globalOutput.reset(); // Clear buffers for this attempt
231 output.reset();
232
233 theIntraNucleiCascader->collide(zbullet, target, output);
234
235 if (verboseLevel > 1) G4cout << " After Cascade " << G4endl;
236
237 deexcite(output.getRecoilFragment(), output);
238 output.removeRecoilFragment();
239
240 if (verboseLevel > 2)
241 G4cout << " itry " << itry << " finished, moving to lab frame" << G4endl;
242
243 // convert to the LAB frame and add to final result
244 output.boostToLabFrame(convertToTargetRestFrame);
245
246 globalOutput.add(output);
247
248 // Adjust final state particles to balance momentum and energy
249 // FIXME: This should no longer be necessary!
250 globalOutput.setOnShell(bullet, target);
251 if (globalOutput.acceptable()) {
252 if (verboseLevel)
253 G4cout << " InuclCollider output after trials " << itry << G4endl;
254 delete zbullet;
255 return;
256 } else {
257 if (verboseLevel>2)
258 G4cerr << " InuclCollider setOnShell failed." << G4endl;
259 }
260 } // while (itry < itry_max)
261
262 if (verboseLevel) {
263 G4cout << " InuclCollider -> can not generate acceptable inter. after "
264 << itry_max << " attempts " << G4endl;
265 }
266
267 globalOutput.trivialise(bullet, target);
268
269 delete zbullet;
270 return;
271}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
static const G4CascadeChannel * GetTable(G4int initialState)
virtual G4bool useEPCollider(G4InuclParticle *bullet, G4InuclParticle *target) const
virtual G4bool inelasticInteractionPossible(G4InuclParticle *bullet, G4InuclParticle *target, G4double ekin) const
void boostToLabFrame(const G4LorentzConvertor &convertor)
void setOnShell(G4InuclParticle *bullet, G4InuclParticle *target)
const G4Fragment & getRecoilFragment() const
G4bool acceptable() const
void add(const G4CollisionOutput &right)
void trivialise(G4InuclParticle *bullet, G4InuclParticle *target)
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4bool valid() const
G4InuclParticle * getBullet() const
void set(G4InuclParticle *part1, G4InuclParticle *part2)
G4bool hadNucleus() const
G4InuclParticle * getTarget() const
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &globalOutput)
void deexcite(const G4Fragment &fragment, G4CollisionOutput &globalOutput)
G4int getZ() const
G4int getA() const
G4ParticleDefinition * getDefinition() const
const G4String & GetParticleName() const

Referenced by G4CascadeInterface::ApplyYourself().

◆ deexcite()

void G4InuclCollider::deexcite ( const G4Fragment fragment,
G4CollisionOutput globalOutput 
)
protected

Definition at line 305 of file G4InuclCollider.cc.

306 {
307 if (fragment.GetA() <= 1) return; // Nothing real to be de-excited
308
309 if (verboseLevel) G4cout << " >>> G4InuclCollider::deexcite" << G4endl;
310
311 G4InuclNuclei frag(fragment); // Eventually unnecessary
312
313 const G4int itry_max = 10; // Maximum number of attempts
314 G4int itry = 0;
315 do {
316 if (verboseLevel > 2) G4cout << " deexcite itry " << itry << G4endl;
317
318 DEXoutput.reset();
319 theDeexcitation->collide(0, &frag, DEXoutput);
320 } while (!validateOutput(0, &frag, DEXoutput) && (++itry < itry_max));
321
322 // Add de-excitation products to output buffer
323 globalOutput.add(DEXoutput);
324}
virtual G4bool validateOutput(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4double GetA() const
Definition: G4Fragment.hh:283
virtual void collide(G4InuclParticle *, G4InuclParticle *target, G4CollisionOutput &globalOutput)=0

Referenced by collide(), and rescatter().

◆ rescatter()

void G4InuclCollider::rescatter ( G4InuclParticle bullet,
G4KineticTrackVector theSecondaries,
G4V3DNucleus theNucleus,
G4CollisionOutput globalOutput 
)
virtual

Reimplemented from G4CascadeColliderBase.

Definition at line 276 of file G4InuclCollider.cc.

279 {
280 if (verboseLevel) G4cout << " >>> G4InuclCollider::rescatter" << G4endl;
281
282 G4int itry=1; // For diagnostic post-processing only
283 if (verboseLevel > 2) G4cout << " InuclCollider itry " << itry << G4endl;
284
285 globalOutput.reset(); // Clear buffers for this attempt
286 output.reset();
287
288 theIntraNucleiCascader->rescatter(bullet, theSecondaries, theNucleus,
289 output);
290
291 if (verboseLevel > 1) G4cout << " After Rescatter" << G4endl;
292
293 deexcite(output.getRecoilFragment(), output);
294 output.removeRecoilFragment();
295
296 globalOutput.add(output); // Add local results to global output
297
298 if (verboseLevel)
299 G4cout << " InuclCollider output after trials " << itry << G4endl;
300}
void rescatter(G4InuclParticle *bullet, G4KineticTrackVector *theSecondaries, G4V3DNucleus *theNucleus, G4CollisionOutput &globalOutput)

Referenced by G4CascadeInterface::Propagate().

◆ setVerboseLevel()

void G4InuclCollider::setVerboseLevel ( G4int  verbose = 0)
virtual

Reimplemented from G4CascadeColliderBase.

Definition at line 92 of file G4InuclCollider.cc.

92 {
94
95 theElementaryParticleCollider->setVerboseLevel(verboseLevel);
96 theIntraNucleiCascader->setVerboseLevel(verboseLevel);
97 theDeexcitation->setVerboseLevel(verboseLevel);
98
100 DEXoutput.setVerboseLevel(verboseLevel);
101}
virtual void setVerboseLevel(G4int verbose=0)
void setVerboseLevel(G4int verbose)
void setVerboseLevel(G4int verbose=0)

Referenced by G4CascadeInterface::SetVerboseLevel().

◆ useCascadeDeexcitation()

void G4InuclCollider::useCascadeDeexcitation ( )

Definition at line 106 of file G4InuclCollider.cc.

106 {
107 delete theDeexcitation;
108 theDeexcitation = new G4CascadeDeexcitation;
109 theDeexcitation->setVerboseLevel(verboseLevel);
110}

Referenced by G4CascadeInterface::useCascadeDeexcitation().

◆ usePreCompoundDeexcitation()

void G4InuclCollider::usePreCompoundDeexcitation ( )

Definition at line 112 of file G4InuclCollider.cc.

112 {
113 delete theDeexcitation;
114 theDeexcitation = new G4PreCompoundDeexcitation;
115 theDeexcitation->setVerboseLevel(verboseLevel);
116}

Referenced by G4CascadeInterface::usePreCompoundDeexcitation().


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