Belle II Software  release-06-01-15
EvtGenInterface.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 
12 #include <EvtGen/EvtGen.hh>
13 #include <EvtGenBase/EvtParticle.hh>
14 #include <EvtGenBase/EvtVector4R.hh>
15 #include <generators/evtgen/EvtGenFwRandEngine.h>
16 #include <mdst/dataobjects/MCParticleGraph.h>
17 
18 #include <framework/utilities/IOIntercept.h>
19 
20 #include <string>
21 
22 namespace Belle2 {
35 
36  public:
43  static EvtGen* createEvtGen(const std::string& decayFileName, bool coherentMixing);
44 
48  EvtGenInterface(): m_parent(0), m_Generator(0), m_pinit(0, 0, 0, 0),
49  m_ParentInitialized(false),
50  m_logCapture("EvtGen", LogConfig::c_Debug, LogConfig::c_Warning, 100, 100) {}
51 
56 
58  int setup(const std::string& decayFileName, const std::string& parentParticle,
59  const std::string& userFileName = std::string(""), bool coherentMixing = true);
60 
62  int simulateEvent(MCParticleGraph& graph, TLorentzVector pParentParticle,
63  TVector3 pPrimaryVertex, int inclusiveType, const std::string& inclusiveParticle);
64 
66  int simulateDecay(MCParticleGraph& graph,
68 
69  private:
71  int addParticles2Graph(EvtParticle* particle, MCParticleGraph& graph, TVector3 pPrimaryVertex,
72  MCParticleGraph::GraphParticle* parent, double timeOffset = 0);
73 
75  void updateGraphParticle(EvtParticle* eParticle, MCParticleGraph::GraphParticle* gParticle,
76  TVector3 pPrimaryVertex, double timeOffset = 0);
77 
78  protected:
79  EvtParticle* m_parent;
81  EvtGen* m_Generator;
82  EvtVector4R m_pinit;
86  };
87 
89 }
90 
Class to interface EvtGen.
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.
EvtVector4R m_pinit
Variable needed for initial momentum.
int simulateDecay(MCParticleGraph &graph, MCParticleGraph::GraphParticle &parent)
Simulate a particle decay.
EvtGen * m_Generator
Variable needed for EvtGen generator.
int simulateEvent(MCParticleGraph &graph, TLorentzVector pParentParticle, TVector3 pPrimaryVertex, int inclusiveType, const std::string &inclusiveParticle)
Generate a single event.
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
static EvtGenFwRandEngine m_eng
Variable needed for random generator.
EvtParticle * m_parent
Variable needed for parent particle.
static EvtGen * createEvtGen(const std::string &decayFileName, bool coherentMixing)
Create and initialize an EvtGen instance:
EvtId m_ParentParticle
Variable needed for parent particle ID.
bool m_ParentInitialized
Whether parent particle is initialized.
EvtGenInterface()
Constructor.
IOIntercept::OutputToLogMessages m_logCapture
Capture evtgen log and transform into basf2 logging.
Capture stdout and stderr and convert into log messages.
Definition: IOIntercept.h:226
The LogConfig class.
Definition: LogConfig.h:22
Class to represent Particle data in graph.
Class to build, validate and sort a particle decay chain.
Evtgen random generator.
Abstract base class for different kinds of events.