evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtHepMCEvent.hh
Go to the documentation of this file.
1 
2 /***********************************************************************
3 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4 * *
5 * This file is part of EvtGen. *
6 * *
7 * EvtGen is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * EvtGen is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19 ***********************************************************************/
20 
21 #ifndef EVTHEPMCEVENT_HH
22 #define EVTHEPMCEVENT_HH
23 
25 
26 #ifdef EVTGEN_HEPMC3
27 #include "HepMC3/GenEvent.h"
28 #include "HepMC3/GenParticle.h"
29 #include "HepMC3/GenVertex.h"
30 #include "HepMC3/Print.h"
31 #include "HepMC3/Units.h"
36 typedef HepMC3::Units Units;
38  const FourVector& mom = FourVector::ZERO_VECTOR(), int pid = 0,
39  int status = 0 )
40 {
41  return std::make_shared<HepMC3::GenParticle>( mom, pid, status );
42 }
44  const FourVector& pos = FourVector::ZERO_VECTOR() )
45 {
46  return std::make_shared<HepMC3::GenVertex>( pos );
47 }
48 #else
49 #include "HepMC/GenEvent.h"
50 #include "HepMC/GenParticle.h"
51 #include "HepMC/GenVertex.h"
52 #include "HepMC/SimpleVector.h"
53 #include "HepMC/Units.h"
54 typedef HepMC::GenParticle* GenParticlePtr;
55 typedef HepMC::GenVertex* GenVertexPtr;
58 #define Units HepMC::Units
60  const FourVector& mom = FourVector( 0.0, 0.0, 0.0, 0.0 ), int pid = 0,
61  int status = 0 )
62 {
63  return new HepMC::GenParticle( mom, pid, status );
64 }
66  const FourVector& pos = FourVector( 0.0, 0.0, 0.0, 0.0 ) )
67 {
68  return new HepMC::GenVertex( pos );
69 }
70 #endif
71 
72 class EvtParticle;
73 
75  public:
76  EvtHepMCEvent();
77  virtual ~EvtHepMCEvent();
78 
79  // Select what frame a given GenParticle is in:
80  // its own restframe, the lab frame (first mother), or its mother's frame
82  {
83  RESTFRAME = 1,
84  LAB = 2,
85  MOTHER = 3
86  };
87  // Select the GenParticle status
89  {
90  STABLE = 1,
91  DECAYED = 2,
92  HISTORY = 3
93  };
94 
95  void constructEvent( EvtParticle* baseParticle );
96  void constructEvent( EvtParticle* baseParticle, EvtVector4R& translation );
97 
98  GenEvent* getEvent() { return _theEvent; }
99 
100  // Methods used to create GenParticles and FourVectors of vertices.
101  // Make these public so that other classes may call them if they use EvtHepMCEvent.
102 
103  // Create a GenParticle using info from the EvtParticle, specifying what frame
104  // the 4-momentum is from.
105  GenParticlePtr createGenParticle( EvtParticle* theParticle, int frameType );
106 
107  // Find out the decay vertex position for the given EvtParticle.
108  FourVector getVertexCoord( EvtParticle* theParticle );
109 
110  protected:
111  private:
112  // Delete the event structure (called by destructor)
113  void deleteEvent();
114 
115  // Add a vertex to the event. This is called by the constructEvent function
116  // and is recursive, i.e. it loops through all possible daughter particles and
117  // their descendents.
118  void addVertex( EvtParticle* inEvtParticle, GenParticlePtr inGenParticle );
119 
122 };
123 
124 #endif
void constructEvent(EvtParticle *baseParticle)
EvtVector4R _translation
HepMC::GenParticle * GenParticlePtr
GenEvent * _theEvent
#define Units
virtual ~EvtHepMCEvent()
void addVertex(EvtParticle *inEvtParticle, GenParticlePtr inGenParticle)
GenParticlePtr createGenParticle(EvtParticle *theParticle, int frameType)
HepMC::FourVector FourVector
GenVertexPtr newGenVertexPtr(const FourVector &pos=FourVector(0.0, 0.0, 0.0, 0.0))
HepMC::GenEvent GenEvent
HepMC::GenVertex * GenVertexPtr
GenEvent * getEvent()
GenParticlePtr newGenParticlePtr(const FourVector &mom=FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
FourVector getVertexCoord(EvtParticle *theParticle)