CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PythiaDecays Class Reference

#include <PythiaDecays.h>

Public Member Functions

const DaughterParticleListparticleDaughters (ParticlePropagator &particle, CLHEP::HepRandomEngine *)
 
 PythiaDecays ()
 
 ~PythiaDecays ()
 

Private Attributes

std::unique_ptr< Pythia8::Pythia > decayer
 
std::unique_ptr< gen::P8RndmEnginep8RndmEngine
 
DaughterParticleList theList
 

Detailed Description

Definition at line 28 of file PythiaDecays.h.

Constructor & Destructor Documentation

◆ PythiaDecays()

PythiaDecays::PythiaDecays ( )

Definition at line 9 of file PythiaDecays.cc.

9  {
10  // inspired by method Pythia8Hadronizer::residualDecay() in GeneratorInterface/Pythia8Interface/src/Py8GunBase.cc
11  decayer.reset(new Pythia8::Pythia);
13  decayer->setRndmEnginePtr(p8RndmEngine.get());
14  decayer->settings.flag("ProcessLevel:all", false);
15  decayer->settings.flag("PartonLevel:FSRinResonances", false);
16  decayer->settings.flag("ProcessLevel:resonanceDecays", false);
17  decayer->init();
18 
19  // forbid all decays
20  // (decays are allowed selectively in the particleDaughters function)
21  Pythia8::ParticleData& pdt = decayer->particleData;
22  int pid = 1;
23  while (pdt.nextId(pid) > pid) {
24  pid = pdt.nextId(pid);
25  pdt.mayDecay(pid, false);
26  }
27 }

References decayer, and p8RndmEngine.

◆ ~PythiaDecays()

PythiaDecays::~PythiaDecays ( )

Definition at line 29 of file PythiaDecays.cc.

29 {}

Member Function Documentation

◆ particleDaughters()

const DaughterParticleList & PythiaDecays::particleDaughters ( ParticlePropagator particle,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 31 of file PythiaDecays.cc.

32  {
34 
35  theList.clear();
36 
37  // inspired by method Pythia8Hadronizer::residualDecay() in GeneratorInterface/Pythia8Interface/src/Py8GunBase.cc
38  int pid = particle.particle().pid();
39  decayer->event.reset();
40  Pythia8::Particle py8part(pid,
41  93,
42  0,
43  0,
44  0,
45  0,
46  0,
47  0,
48  particle.particle().momentum().x(), // note: momentum().x() and Px() are the same
49  particle.particle().momentum().y(),
50  particle.particle().momentum().z(),
51  particle.particle().momentum().t(),
52  particle.particle().mass());
53  py8part.vProd(particle.particle().X(), particle.particle().Y(), particle.particle().Z(), particle.particle().T());
54  decayer->event.append(py8part);
55 
56  int nentries_before = decayer->event.size();
57  decayer->particleData.mayDecay(pid,
58  true); // switch on the decay of this and only this particle (avoid double decays)
59  decayer->next(); // do the decay
60  decayer->particleData.mayDecay(pid, false); // switch it off again
61  int nentries_after = decayer->event.size();
62  if (nentries_after <= nentries_before)
63  return theList;
64 
65  theList.reserve(nentries_after - nentries_before);
66 
67  for (int ipart = nentries_before; ipart < nentries_after; ipart++) {
68  Pythia8::Particle& py8daughter = decayer->event[ipart];
69  theList
70  .emplace_back(makeParticle(
71  particle.particleDataTable(),
72  py8daughter.id(),
73  XYZTLorentzVector(py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e()),
74  XYZTLorentzVector(py8daughter.xProd(), py8daughter.yProd(), py8daughter.zProd(), py8daughter.tProd())))
75  .setMass(py8daughter.m());
76  }
77 
78  return theList;
79 }

References decayer, makeParticle(), RawParticle::mass(), RawParticle::momentum(), p8RndmEngine, BaseParticlePropagator::particle(), ParticlePropagator::particleDataTable(), RawParticle::pid(), RawParticle::T(), theList, RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

Referenced by TrajectoryManager::updateWithDaughters().

Member Data Documentation

◆ decayer

std::unique_ptr<Pythia8::Pythia> PythiaDecays::decayer
private

Definition at line 36 of file PythiaDecays.h.

Referenced by particleDaughters(), and PythiaDecays().

◆ p8RndmEngine

std::unique_ptr<gen::P8RndmEngine> PythiaDecays::p8RndmEngine
private

Definition at line 37 of file PythiaDecays.h.

Referenced by particleDaughters(), and PythiaDecays().

◆ theList

DaughterParticleList PythiaDecays::theList
private

Definition at line 35 of file PythiaDecays.h.

Referenced by particleDaughters().

BaseParticlePropagator::particle
RawParticle const & particle() const
The particle being propagated.
Definition: BaseParticlePropagator.h:164
RawParticle::momentum
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:321
makeParticle
RawParticle makeParticle(HepPDT::ParticleDataTable const *, int id, const math::XYZTLorentzVector &p)
Definition: makeParticle.cc:28
RawParticle::pid
int pid() const
get the HEP particle ID number
Definition: RawParticle.h:277
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
ParticlePropagator::particleDataTable
const HepPDT::ParticleDataTable * particleDataTable() const
Definition: ParticlePropagator.h:100
ParticleData
HepPDT::ParticleData ParticleData
Definition: ParticleDataTable.h:9
gen::P8RndmEngine
Definition: P8RndmEngine.h:27
RawParticle::Z
double Z() const
z of vertex
Definition: RawParticle.h:288
PythiaDecays::p8RndmEngine
std::unique_ptr< gen::P8RndmEngine > p8RndmEngine
Definition: PythiaDecays.h:37
PythiaDecays::theList
DaughterParticleList theList
Definition: PythiaDecays.h:35
RawParticle::T
double T() const
vertex time
Definition: RawParticle.h:289
RawParticle::Y
double Y() const
y of vertex
Definition: RawParticle.h:287
RawParticle::mass
double mass() const
get the MEASURED mass
Definition: RawParticle.h:295
edm::RandomEngineSentry
Definition: RandomEngineSentry.h:28
RawParticle::X
double X() const
x of vertex
Definition: RawParticle.h:286
PythiaDecays::decayer
std::unique_ptr< Pythia8::Pythia > decayer
Definition: PythiaDecays.h:36