Belle II Software  release-08-01-10
MCParticleGenerator.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 #include <mdst/dataobjects/MCParticleGraph.h>
12 
13 #include <G4VPrimaryGenerator.hh>
14 #include <G4PrimaryParticle.hh>
15 #include <G4Event.hh>
16 
17 #include <string>
18 
19 class G4VSolid;
20 
21 namespace Belle2 {
27  namespace Simulation {
28 
33  class MCParticleGenerator: public G4VPrimaryGenerator {
34 
35  public:
36 
41  MCParticleGenerator(const std::string& mcCollectionName,
42  MCParticleGraph& mcParticleGraph);
43 
45  virtual ~MCParticleGenerator();
46 
53  virtual void GeneratePrimaryVertex(G4Event* event);
54 
55 
56  protected:
58  G4VSolid* m_topSolid{nullptr};
59  std::string m_mcCollectionName;
72  void addParticle(const MCParticle& mcParticle,
73  G4Event* event,
74  G4PrimaryParticle* lastG4Mother,
75  int motherIndex,
76  bool useTime);
77 
96  G4PrimaryVertex* determineVertex(const MCParticleGraph::GraphParticle& p, double& productionTimeShift);
97  };
98 
99  } //end of Simulation namespace
100 
102 } //end of Belle2 namespace
Class to represent Particle data in graph.
Class to build, validate and sort a particle decay chain.
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
This class creates Geant4 primary particles from MCParticle list The generator assumes that each part...
std::string m_mcCollectionName
Name of the MCParticle collection.
virtual ~MCParticleGenerator()
The destructor of the MCParticleGenerator class.
MCParticleGraph & m_mcParticleGraph
Reference to the MCParticle graph.
void addParticle(const MCParticle &mcParticle, G4Event *event, G4PrimaryParticle *lastG4Mother, int motherIndex, bool useTime)
Takes a MCParticle and creates a primary particle for Geant4.
virtual void GeneratePrimaryVertex(G4Event *event)
Create G4 primary particles from MCParticle list.
G4VSolid * m_topSolid
Pointer to the top level solid to check if particles are inside the simulation volume.
G4PrimaryVertex * determineVertex(const MCParticleGraph::GraphParticle &p, double &productionTimeShift)
Create a simulation vertex for the given particle.
MCParticleGenerator(const std::string &mcCollectionName, MCParticleGraph &mcParticleGraph)
The constructor of the MCParticleGenerator class.
Abstract base class for different kinds of events.