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