Belle II Software  release-05-01-25
EvtGenInterface.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter, Susanne Koblitz *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 
14 #include <EvtGen/EvtGen.hh>
15 #include <EvtGenBase/EvtParticle.hh>
16 #include <EvtGenBase/EvtVector4R.hh>
17 #include <generators/evtgen/EvtGenFwRandEngine.h>
18 #include <mdst/dataobjects/MCParticleGraph.h>
19 
20 #include <framework/utilities/IOIntercept.h>
21 
22 #include <string>
23 
24 namespace Belle2 {
36  class EvtGenInterface {
37 
38  public:
45  static EvtGen* createEvtGen(const std::string& decayFileName, bool coherentMixing);
46 
50  EvtGenInterface(): m_parent(0), m_Generator(0), m_pinit(0, 0, 0, 0),
51  m_ParentInitialized(false),
52  m_logCapture("EvtGen", LogConfig::c_Debug, LogConfig::c_Warning, 100, 100) {}
53 
58 
60  int setup(const std::string& decayFileName, const std::string& parentParticle,
61  const std::string& userFileName = std::string(""), bool coherentMixing = true);
62 
64  int simulateEvent(MCParticleGraph& graph, TLorentzVector pParentParticle,
65  TVector3 pPrimaryVertex, int inclusiveType, const std::string& inclusiveParticle);
66 
68  int simulateDecay(MCParticleGraph& graph,
70 
71  private:
73  int addParticles2Graph(EvtParticle* particle, MCParticleGraph& graph, TVector3 pPrimaryVertex,
74  MCParticleGraph::GraphParticle* parent, double timeOffset = 0);
75 
77  void updateGraphParticle(EvtParticle* eParticle, MCParticleGraph::GraphParticle* gParticle,
78  TVector3 pPrimaryVertex, double timeOffset = 0);
79 
80  protected:
81  EvtParticle* m_parent;
82  static EvtGenFwRandEngine m_eng;
83  EvtGen* m_Generator;
84  EvtVector4R m_pinit;
85  EvtId m_ParentParticle;
86  bool m_ParentInitialized;
88  };
89 
91 }
92 
Belle2::EvtGenInterface::simulateDecay
int simulateDecay(MCParticleGraph &graph, MCParticleGraph::GraphParticle &parent)
Simulate a particle decay.
Definition: EvtGenInterface.cc:174
Belle2::EvtGenInterface::createEvtGen
static EvtGen * createEvtGen(const std::string &decayFileName, bool coherentMixing)
Create and initialize an EvtGen instance:
Definition: EvtGenInterface.cc:51
Belle2::MCParticleGraph
Class to build, validate and sort a particle decay chain.
Definition: MCParticleGraph.h:48
Belle2::EvtGenInterface::setup
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
Definition: EvtGenInterface.cc:83
Belle2::EvtGenInterface::m_pinit
EvtVector4R m_pinit
Variable needed for initial momentum.
Definition: EvtGenInterface.h:92
Belle2::EvtGenInterface::~EvtGenInterface
~EvtGenInterface()
Destructor.
Definition: EvtGenInterface.cc:40
Belle2::EvtGenInterface::m_ParentParticle
EvtId m_ParentParticle
Variable needed for parent particle ID.
Definition: EvtGenInterface.h:93
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::EvtGenInterface::m_ParentInitialized
bool m_ParentInitialized
Whether parent particle is initialized.
Definition: EvtGenInterface.h:94
Belle2::EvtGenInterface::m_parent
EvtParticle * m_parent
Variable needed for parent particle.
Definition: EvtGenInterface.h:89
Belle2::IOIntercept::OutputToLogMessages
Capture stdout and stderr and convert into log messages.
Definition: IOIntercept.h:236
Belle2::EvtGenInterface::addParticles2Graph
int addParticles2Graph(EvtParticle *particle, MCParticleGraph &graph, TVector3 pPrimaryVertex, MCParticleGraph::GraphParticle *parent, double timeOffset=0)
Convert EvtParticle structure to flat MCParticle list.
Definition: EvtGenInterface.cc:200
Belle2::EvtGenInterface::EvtGenInterface
EvtGenInterface()
Constructor.
Definition: EvtGenInterface.h:58
Belle2::EvtGenInterface::updateGraphParticle
void updateGraphParticle(EvtParticle *eParticle, MCParticleGraph::GraphParticle *gParticle, TVector3 pPrimaryVertex, double timeOffset=0)
Copy parameters from EvtParticle to MCParticle.
Definition: EvtGenInterface.cc:254
EvtGenFwRandEngine
Evtgen random generator.
Definition: EvtGenFwRandEngine.h:17
Belle2::EvtGenInterface::simulateEvent
int simulateEvent(MCParticleGraph &graph, TLorentzVector pParentParticle, TVector3 pPrimaryVertex, int inclusiveType, const std::string &inclusiveParticle)
Generate a single event.
Definition: EvtGenInterface.cc:111
Belle2::MCParticleGraph::GraphParticle
Class to represent Particle data in graph.
Definition: MCParticleGraph.h:86
Belle2::EvtGenInterface::m_logCapture
IOIntercept::OutputToLogMessages m_logCapture
Capture evtgen log and transform into basf2 logging.
Definition: EvtGenInterface.h:95
Belle2::EvtGenInterface::m_eng
static EvtGenFwRandEngine m_eng
Variable needed for random generator.
Definition: EvtGenInterface.h:90
Belle2::EvtGenInterface::m_Generator
EvtGen * m_Generator
Variable needed for EvtGen generator.
Definition: EvtGenInterface.h:91