Belle II Software  release-05-02-19
EvtGenInterface Class Reference

Class to interface EvtGen. More...

#include <EvtGenInterface.h>

Collaboration diagram for EvtGenInterface:

Public Member Functions

 EvtGenInterface ()
 Constructor.
 
 ~EvtGenInterface ()
 Destructor.
 
int setup (const std::string &decayFileName, const std::string &parentParticle, const std::string &userFileName=std::string(""), bool coherentMixing=true)
 Setup evtgen with the given decay files

 
int simulateEvent (MCParticleGraph &graph, TLorentzVector pParentParticle, TVector3 pPrimaryVertex, int inclusiveType, const std::string &inclusiveParticle)
 Generate a single event.
 
int simulateDecay (MCParticleGraph &graph, MCParticleGraph::GraphParticle &parent)
 Simulate a particle decay.
 

Static Public Member Functions

static EvtGen * createEvtGen (const std::string &decayFileName, bool coherentMixing)
 Create and initialize an EvtGen instance: More...
 

Protected Attributes

EvtParticle * m_parent
 Variable needed for parent particle. More...
 
EvtGen * m_Generator
 Variable needed for EvtGen generator.
 
EvtVector4R m_pinit
 Variable needed for initial momentum.
 
EvtId m_ParentParticle
 Variable needed for parent particle ID.
 
bool m_ParentInitialized
 Whether parent particle is initialized.
 
IOIntercept::OutputToLogMessages m_logCapture
 Capture evtgen log and transform into basf2 logging.
 

Static Protected Attributes

static EvtGenFwRandEngine m_eng
 Variable needed for random generator.
 

Private Member Functions

int addParticles2Graph (EvtParticle *particle, MCParticleGraph &graph, TVector3 pPrimaryVertex, MCParticleGraph::GraphParticle *parent, double timeOffset=0)
 Convert EvtParticle structure to flat MCParticle list.
 
void updateGraphParticle (EvtParticle *eParticle, MCParticleGraph::GraphParticle *gParticle, TVector3 pPrimaryVertex, double timeOffset=0)
 Copy parameters from EvtParticle to MCParticle.
 

Detailed Description

Class to interface EvtGen.

This class is responsible to handle all interaction with evtgen and its classes when generating events. It sets up the models, calls evtgen to generate the events and converts the evtgen particles to a list of MCParticles

Definition at line 44 of file EvtGenInterface.h.

Member Function Documentation

◆ createEvtGen()

EvtGen * createEvtGen ( const std::string &  decayFileName,
bool  coherentMixing 
)
static

Create and initialize an EvtGen instance:

  • Make sure Random engine is setup correctly
  • Create evt.pdl on the fly from current contents of particle database
  • Add photos/all models
  • Use Coherent mixing unless set otherwise

Definition at line 51 of file EvtGenInterface.cc.

52 {
53  IOIntercept::OutputToLogMessages initLogCapture("EvtGen", LogConfig::c_Debug, LogConfig::c_Debug, 100, 100);
54  initLogCapture.start();
55  EvtRandom::setRandomEngine(&EvtGenInterface::m_eng);
56 
57  // Official BelleII models
58  std::list<EvtDecayBase*> extraModels = EvtGenModelRegister::getModels();
59 
60  //fill model list with pythia, photos etc.
61  EvtExternalGenList genList;
62  EvtAbsRadCorr* radCorrEngine = genList.getPhotosModel();
63  list<EvtDecayBase*> modelList = genList.getListOfModels();
64  extraModels.insert(extraModels.end(), modelList.begin(), modelList.end());
65 
68 
69  auto mixingMode = EvtCPUtil::Incoherent;
70  if (coherentMixing)
71  mixingMode = EvtCPUtil::Coherent;
72  else {
73  B2WARNING("Evtgen has been set to decay the B mesons incoherently. This is useful as a workaround only to generate Y(5S, 6S) -> BBar for QCD studies.");
74  B2WARNING("If you are generating Y(4S) events, you _really_ must use the coherent decay mode.");
75  }
76 
77  return new EvtGen(DECFileName.c_str(), tmp.getName().c_str(), &EvtGenInterface::m_eng,
78  radCorrEngine, &extraModels, mixingMode);
79 
80  initLogCapture.finish();
81 }

Member Data Documentation

◆ m_parent

EvtParticle* m_parent
protected

Variable needed for parent particle.


Definition at line 89 of file EvtGenInterface.h.


The documentation for this class was generated from the following files:
Belle2::EvtGenModelRegister::getModels
static std::list< EvtDecayBase * > getModels()
Return a list of models.
Definition: EvtGenModelRegister.cc:29
Belle2::EvtGenDatabasePDG::WriteEvtGenTable
void WriteEvtGenTable(std::ostream &out)
Write current database as EvtGen table to a stream.
Definition: EvtGenDatabasePDG.cc:183
Belle2::FileSystem::TemporaryFile
Helper file to create a temporary file and ensure deletion if object goes out of scope.
Definition: FileSystem.h:138
Belle2::IOIntercept::OutputToLogMessages
Capture stdout and stderr and convert into log messages.
Definition: IOIntercept.h:236
Belle2::LogConfig::c_Debug
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:36
Belle2::EvtGenDatabasePDG::Instance
static EvtGenDatabasePDG * Instance()
Instance method that loads the EvtGen table.
Definition: EvtGenDatabasePDG.cc:27
Belle2::EvtGenInterface::m_eng
static EvtGenFwRandEngine m_eng
Variable needed for random generator.
Definition: EvtGenInterface.h:90