Belle II Software  release-05-02-19
MCParticleGenerator.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2011 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Andreas Moll, Martin Ritter, Marko Staric *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <mdst/dataobjects/MCParticleGraph.h>
14 
15 #include <G4VPrimaryGenerator.hh>
16 #include <G4PrimaryParticle.hh>
17 #include <G4Event.hh>
18 
19 #include <string>
20 
21 class G4VSolid;
22 
23 namespace Belle2 {
29  namespace Simulation {
30 
35  class MCParticleGenerator: public G4VPrimaryGenerator {
36 
37  public:
38 
43  MCParticleGenerator(const std::string& mcCollectionName,
44  MCParticleGraph& mcParticleGraph);
45 
47  virtual ~MCParticleGenerator();
48 
55  virtual void GeneratePrimaryVertex(G4Event* event);
56 
57 
58  protected:
60  G4VSolid* m_topSolid{nullptr};
61  std::string m_mcCollectionName;
74  void addParticle(const MCParticle& mcParticle,
75  G4Event* event,
76  G4PrimaryParticle* lastG4Mother,
77  int motherIndex,
78  bool useTime);
79 
98  G4PrimaryVertex* determineVertex(const MCParticleGraph::GraphParticle& p, double& productionTimeShift);
99  };
100 
101  } //end of Simulation namespace
102 
104 } //end of Belle2 namespace
Belle2::Simulation::MCParticleGenerator::~MCParticleGenerator
virtual ~MCParticleGenerator()
The destructor of the MCParticleGenerator class.
Definition: MCParticleGenerator.cc:51
Belle2::MCParticleGraph
Class to build, validate and sort a particle decay chain.
Definition: MCParticleGraph.h:48
Belle2::Simulation::MCParticleGenerator::m_mcParticleGraph
MCParticleGraph & m_mcParticleGraph
Reference to the MCParticle graph.
Definition: MCParticleGenerator.h:62
Belle2::Simulation::MCParticleGenerator::m_mcCollectionName
std::string m_mcCollectionName
Name of the MCParticle collection.
Definition: MCParticleGenerator.h:61
Belle2::Simulation::MCParticleGenerator::m_topSolid
G4VSolid * m_topSolid
Pointer to the top level solid to check if particles are inside the simulation volume.
Definition: MCParticleGenerator.h:60
Belle2::Simulation::MCParticleGenerator::determineVertex
G4PrimaryVertex * determineVertex(const MCParticleGraph::GraphParticle &p, double &productionTimeShift)
Create a simulation vertex for the given particle.
Definition: MCParticleGenerator.cc:83
Belle2::Simulation::MCParticleGenerator::GeneratePrimaryVertex
virtual void GeneratePrimaryVertex(G4Event *event)
Create G4 primary particles from MCParticle list.
Definition: MCParticleGenerator.cc:57
Belle2::Simulation::MCParticleGenerator::MCParticleGenerator
MCParticleGenerator(const std::string &mcCollectionName, MCParticleGraph &mcParticleGraph)
The constructor of the MCParticleGenerator class.
Definition: MCParticleGenerator.cc:41
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Simulation::MCParticleGenerator
This class creates Geant4 primary particles from MCParticle list The generator assumes that each part...
Definition: MCParticleGenerator.h:35
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::Simulation::MCParticleGenerator::addParticle
void addParticle(const MCParticle &mcParticle, G4Event *event, G4PrimaryParticle *lastG4Mother, int motherIndex, bool useTime)
Takes a MCParticle and creates a primary particle for Geant4.
Definition: MCParticleGenerator.cc:121
Belle2::MCParticleGraph::GraphParticle
Class to represent Particle data in graph.
Definition: MCParticleGraph.h:86