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