FairShip
Loading...
Searching...
No Matches
makeCascadePythia8.InclusiveSignalEvents Class Reference

Public Member Functions

 __init__ (self, new_pythia, signal_ids, heavy_quark, p_beam)
 next (self, beam_id, i_nucleon, px, py, pz)

Public Attributes

 signal_ids = signal_ids
 heavy_quark = heavy_quark
list pythia
int n_tried = 0

Detailed Description

Inclusive inelastic events with signal hadrons, at the exact projectile momentum, one Pythia8 instance
per target nucleon. Events are hadronised only if they contain a heavy quark, which saves most of the
time spent on events without one.

Definition at line 387 of file makeCascadePythia8.py.

Constructor & Destructor Documentation

◆ __init__()

makeCascadePythia8.InclusiveSignalEvents.__init__ ( self,
new_pythia,
signal_ids,
heavy_quark,
p_beam )

Definition at line 392 of file makeCascadePythia8.py.

392 def __init__(self, new_pythia, signal_ids, heavy_quark, p_beam):
393 self.signal_ids = signal_ids
394 self.heavy_quark = heavy_quark
395 self.pythia = [
396 new_pythia(
397 ["SoftQCD:inelastic = on", "HadronLevel:all = off"]
398 + ["Beams:frameType = 3", "Beams:allowVariableEnergy = on", "Beams:allowIDAswitch = on"]
399 + [f"Beams:idB = {nucleon_id}", f"Beams:pzA = {p_beam}", "Beams:pzB = 0."]
400 )
401 for nucleon_id in TARGET_NUCLEONS
402 ]
403 self.n_tried = 0
404

Member Function Documentation

◆ next()

makeCascadePythia8.InclusiveSignalEvents.next ( self,
beam_id,
i_nucleon,
px,
py,
pz )
Return process code and signal hadrons (id, px, py, pz, E, m) in the lab frame.

Definition at line 405 of file makeCascadePythia8.py.

405 def next(self, beam_id, i_nucleon, px, py, pz):
406 """Return process code and signal hadrons (id, px, py, pz, E, m) in the lab frame."""
407 pythia = self.pythia[i_nucleon]
408 pythia.setBeamIDs(beam_id, TARGET_NUCLEONS[i_nucleon])
409 pythia.setKinematics(px, py, pz, 0.0, 0.0, 0.0)
410 for _ in range(MAX_INCLUSIVE_TRIES):
411 next_event(pythia)
412 self.n_tried += 1
413 event = pythia.event
414 if not any(event[i].idAbs() == self.heavy_quark for i in range(event.size())):
415 continue
416 if not pythia.forceHadronLevel():
417 continue
418 event = pythia.event
419 hadrons = [
420 event[i] for i in range(event.size()) if event[i].idAbs() in self.signal_ids and event[i].isFinal()
421 ]
422 if hadrons:
423 return pythia.infoPython().code(), [(h.id(), h.px(), h.py(), h.pz(), h.e(), h.m()) for h in hadrons]
424 raise RuntimeError(
425 f"no charm in {MAX_INCLUSIVE_TRIES} inclusive events of {beam_id} on {TARGET_NUCLEONS[i_nucleon]}"
426 f" at p = ({px:.1f}, {py:.1f}, {pz:.1f}) GeV"
427 )
428
429

Member Data Documentation

◆ heavy_quark

makeCascadePythia8.InclusiveSignalEvents.heavy_quark = heavy_quark

Definition at line 394 of file makeCascadePythia8.py.

◆ n_tried

int makeCascadePythia8.InclusiveSignalEvents.n_tried = 0

Definition at line 403 of file makeCascadePythia8.py.

◆ pythia

list makeCascadePythia8.InclusiveSignalEvents.pythia
Initial value:
= [
new_pythia(
["SoftQCD:inelastic = on", "HadronLevel:all = off"]
+ ["Beams:frameType = 3", "Beams:allowVariableEnergy = on", "Beams:allowIDAswitch = on"]
+ [f"Beams:idB = {nucleon_id}", f"Beams:pzA = {p_beam}", "Beams:pzB = 0."]
)
for nucleon_id in TARGET_NUCLEONS
]

Definition at line 395 of file makeCascadePythia8.py.

◆ signal_ids

makeCascadePythia8.InclusiveSignalEvents.signal_ids = signal_ids

Definition at line 393 of file makeCascadePythia8.py.


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