Belle II Software development
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
15#include <string>
16
17class G4VSolid;
18class G4PrimaryParticle;
19class G4Event;
20class G4PrimaryVertex;
21
22namespace Belle2 {
27
28 namespace Simulation {
29
34 class MCParticleGenerator: public G4VPrimaryGenerator {
35
36 public:
37
42 MCParticleGenerator(const std::string& mcCollectionName,
43 MCParticleGraph& mcParticleGraph);
44
46 virtual ~MCParticleGenerator();
47
54 virtual void GeneratePrimaryVertex(G4Event* event);
55
56
57 protected:
59 G4VSolid* m_topSolid{nullptr};
60 std::string m_mcCollectionName;
62
73 void addParticle(const MCParticle& mcParticle,
74 G4Event* event,
75 G4PrimaryParticle* lastG4Mother,
76 int motherIndex,
77 bool useTime);
78
97 G4PrimaryVertex* determineVertex(const MCParticleGraph::GraphParticle& p, double& productionTimeShift);
98 };
99
100 } //end of Simulation namespace
101
103} //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
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.