HepMC3 event record library
PhotosHepMC3Particle.h
1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details)
5 //
6 #ifndef _PhotosHepMC3Particle_h_included_
7 #define _PhotosHepMC3Particle_h_included_
8 
9 #warning "HepMC3 interface is available in the latest version of PHOTOS, see http://photospp.web.cern.ch/photospp/. This interface will be removed in the future HepMC3 versions."
10 
11 /**
12  * @class PhotosHepMC3Particle
13  *
14  * @brief Interface to GenParticle objects
15  *
16  * This class implements the virtual methods of
17  * PhotosParticle. In this way it provides an
18  * interface between the generic PhotosParticle class
19  * and a GenParticle object.
20  *
21  * @author Nadia Davidson
22  * @date 17 June 2008
23  *
24  * This code is licensed under GNU General Public Licence.
25  * For more informations, see: http://www.gnu.org/licenses/
26  */
27 
28 #include <vector>
29 
30 #include "HepMC3/GenParticle.h"
31 #include "PhotosParticle.h"
32 
33 namespace Photospp
34 {
35 using namespace HepMC3;
36 class PhotosHepMC3Particle: public PhotosParticle {
37 
38 public:
39  /** General constructor */
41 
42  /** Constructor which keeps a pointer to the GenParticle*/
43  PhotosHepMC3Particle(GenParticlePtr particle);
44 
45  /** Constructor which creates a new GenParticle and
46  sets the properties pdg_id, statu and mass. */
47  PhotosHepMC3Particle(int pdg_id, int status, double mass);
48 
49  /** Destructor */
51 
52  /** return the GenParticlePtr */
53  GenParticlePtr getHepMC3();
54 
55  /** Set the mothers of this particle via a vector of PhotosParticle*/
56  void setMothers(std::vector<PhotosParticle*> mothers);
57 
58  /** Set the daughters of this particle via a vector of PhotosParticle*/
59  void setDaughters(std::vector<PhotosParticle*> daughters);
60 
61  /** Add a new daughter to the end vertex of this particle */
62  void addDaughter(PhotosParticle* daughter);
63 
64  /** Returns the mothers of this particle via a vector of PhotosParticle */
65  std::vector<PhotosParticle*> getMothers();
66 
67  /** Returns the daughters of this particle via a vector of PhotosParticle
68  IMPORTANT: this method will remeber list from the first call. Particles
69  (e.g. photons) added later will be ignored */
70  std::vector<PhotosParticle*> getDaughters();
71 
72  /** Returns all particles in the decay tree of this particle
73  via a vector of PhotosParticle */
74  std::vector<PhotosParticle*> getAllDecayProducts();
75 
76  /** Set the PDG ID code of this particle */
77  void setPdgID(int pdg_id);
78 
79  /** Set the status of this particle */
80  void setStatus(int statu);
81 
82  /** Set the mass of this particle */
83  void setMass(double mass);
84 
85  /** Get the PDG ID code of this particle */
86  int getPdgID();
87 
88  /** Get the status of this particle */
89  int getStatus();
90 
91  /** Get the barcode of this particle */
92  int getBarcode();
93 
94  /** check that the 4 momentum in conserved at the vertices producing
95  and ending this particle */
96  bool checkMomentumConservation();
97 
98  /** Create a new particle of type PhotosHepMC3Particle, with the given
99  properties. The new particle bares no relations to this
100  particle, but it provides a way of creating a instance of
101  this derived class. eg. createNewParticle() is used inside
102  filhep_() so that a PhotosHepMC3Particle can be created without
103  the method having explicit knowledge of the PhotosHepMC3Particle
104  class */
105  PhotosHepMC3Particle * createNewParticle(int pdg_id, int status, double mass,
106  double px, double py,
107  double pz, double e);
108 
109  /** Create history entry for HepMC event record.
110  Creates copy of this particle with status = 3 */
111  void createHistoryEntry();
112 
113  /** Create a self-decay vertex for this particle
114  with 'out' being the outgoing particle in new vertex */
115  void createSelfDecayVertex(PhotosParticle *out);
116 
117  /** Print some information about this particle to standard output */
118  void print();
119 
120  /** Returns the px component of the four vector*/
121  double getPx();
122 
123  /** Returns the py component of the four vector */
124  double getPy();
125 
126  /** Returns the pz component of the four vector */
127  double getPz();
128 
129  /** Returns the energy component of the four vector */
130  double getE();
131 
132  /** Returns the mass taken from event record */
133  double getMass();
134 
135  /** Set the px component of the four vector */
136  void setPx( double px );
137 
138  /** Set the px component of the four vector */
139  void setPy( double py );
140 
141  /** Set the pz component of the four vector */
142  void setPz( double pz );
143 
144  /** Set the energy component of the four vector */
145  void setE( double e );
146 
147 private:
148  /** Internal function used to clear particles from the vector */
149  void clear(std::vector<PhotosParticle*> v);
150 
151  /** A pointer to the GenParticle particle */
152  GenParticlePtr m_particle;
153 
154  /** A vector of this particles mothers */
155  std::vector<PhotosParticle*> m_mothers;
156 
157  /** A vector of this particles daughters */
158  std::vector<PhotosParticle*> m_daughters;
159 
160  /** A vector of all decay products of this particle */
161  std::vector<PhotosParticle*> m_decay_products;
162 
163  /** list to keep track of new particles which have been
164  created from this one, so we can call their destructor later */
165  std::vector<PhotosParticle*> m_created_particles;
166 
167 };
168 
169 } // namespace Photospp
170 #endif
HepMC3 main namespace.
Definition of class GenParticle.
std::vector< PhotosParticle * > m_mothers
std::vector< PhotosParticle * > m_created_particles
std::vector< PhotosParticle * > m_daughters
std::vector< PhotosParticle * > m_decay_products