VMC Examples Version 6.8
Loading...
Searching...
No Matches
Ex03dMCStack.h
Go to the documentation of this file.
1#ifndef EX03_STACK_H
2#define EX03_STACK_H
3
4//------------------------------------------------
5// The Virtual Monte Carlo examples
6// Copyright (C) 2014 - 2018 Ivana Hrivnacova
7// All rights reserved.
8//
9// For the licensing terms see geant4_vmc/LICENSE.
10// Contact: root-vmc@cern.ch
11//-------------------------------------------------
12
13/// \file E03/include/Ex03dMCStack.h
14/// \brief Definition of the Ex03dMCStack class
15///
16/// Geant4 ExampleN03 adapted to Virtual Monte Carlo
17///
18/// \author Radoslaw Karabowicz; GSI
19
20#include <TVirtualMCStack.h>
21
22#include "Ex03dParticle.h"
23#include "TParticle.h"
24
25#include <stack>
26#include <vector>
27
28/// \ingroup E03
29/// \brief Implementation of the TVirtualMCStack interface
30///
31/// A variant of the Ex03MCStack class
32/// updated for RNTuple output.
33///
34/// \date 07/07/2026
35/// \author Radoslaw Karabowicz; GSI
36
38{
39 public:
40 Ex03dMCStack(Int_t size);
42 virtual ~Ex03dMCStack();
43
44 // methods
45 virtual void PushTrack(Int_t toBeDone, Int_t parent, Int_t pdg, Double_t px,
46 Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz,
47 Double_t tof, Double_t polx, Double_t poly, Double_t polz, TMCProcess mech,
48 Int_t& ntr, Double_t weight, Int_t is);
49 virtual TParticle* PopNextTrack(Int_t& track);
50 virtual TParticle* PopPrimaryForTracking(Int_t i);
51 virtual void Print(Option_t* option = "") const;
52 void Reset();
53
54 void Register();
55
56 // set methods
57 virtual void SetCurrentTrack(Int_t track);
58
59 // get methods
60 virtual Int_t GetNtrack() const;
61 virtual Int_t GetNprimary() const;
62 virtual TParticle* GetCurrentTrack() const;
63 virtual Int_t GetCurrentTrackNumber() const;
64 virtual Int_t GetCurrentParentTrackNumber() const;
65 TParticle* GetParticle(Int_t id) const;
66
67 private:
68 // data members
69 std::stack<TParticle*> fStack; //! < The stack of particles (transient)
70 std::vector<TParticle>* fParticles{
71 new std::vector<TParticle>
72 }; //! < The vector of particle (persistent)
73 // libc++abi: terminating due to uncaught exception of type
74 // ROOT::RException: TParticle cannot be stored natively in RNTuple
75 std::vector<Ex03dParticle>* fExParticles{
76 new std::vector<Ex03dParticle>
77 }; //! < The vector of particle (persistent)
78 Int_t fCurrentTrack{ -1 }; /// < The current track number
79 Int_t fNPrimary{ 0 }; /// < The number of primaries
80
81 ClassDef(Ex03dMCStack, 1) // Ex03dMCStack
82};
83
84#endif // EX03_STACK_H
Definition of the Ex03dParticle class.
Implementation of the TVirtualMCStack interface.
virtual Int_t GetNprimary() const
virtual Int_t GetCurrentParentTrackNumber() const
virtual TParticle * PopPrimaryForTracking(Int_t i)
virtual Int_t GetNtrack() const
virtual TParticle * GetCurrentTrack() const
virtual Int_t GetCurrentTrackNumber() const
virtual void Print(Option_t *option="") const
Ex03dMCStack(Int_t size)
std::vector< TParticle > * fParticles
< The stack of particles (transient)
virtual void SetCurrentTrack(Int_t track)
virtual ~Ex03dMCStack()
TParticle * GetParticle(Int_t id) const
std::vector< Ex03dParticle > * fExParticles
< The vector of particle (persistent)
virtual void PushTrack(Int_t toBeDone, Int_t parent, Int_t pdg, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t tof, Double_t polx, Double_t poly, Double_t polz, TMCProcess mech, Int_t &ntr, Double_t weight, Int_t is)
virtual TParticle * PopNextTrack(Int_t &track)
Int_t fNPrimary
< The current track number
std::stack< TParticle * > fStack
Int_t fCurrentTrack
< The vector of particle (persistent)