include/Photos/PhotosParticle.h
1#ifndef _PhotosParticle_h_included_
2#define _PhotosParticle_h_included_
3
4/**
5 * @class PhotosParticle
6 *
7 * @brief Abstract base class for particle in the event. This class also
8 * handles boosting.
9 *
10 * PhotosParticle is a Photos representation of a particle. It has virtual
11 * getter and setter methods that need to be implemented by a derived class.
12 * An example of this is PhotosHepMCParticle. In this way it provides an
13 * interface to the information in the Event Record.
14 *
15 * @author Nadia Davidson
16 * @date 16 June 2008
17 */
18
19#include <vector>
20#include "Photos.h"
21
22namespace Photospp
23{
24
26{
27public:
28 /** Stable particle status */
29 static const int STABLE=1;
30
31 /** Decayed particle status */
32 static const int DECAYED=2;
33
34 /** History particle status */
35 static const int HISTORY=3;
36
37 /** X Axis */
38 static const int X_AXIS=1;
39
40 /** Y Axis */
41 static const int Y_AXIS=2;
42
43 /** Z Axis */
44 static const int Z_AXIS=3;
45
46 /** Z0 particle */
47 static const int Z0 = 23;
48
49 /** H particle */
50 static const int HIGGS = 25;
51
52 /** H0 particle */
53 static const int HIGGS_H = 35;
54
55 /** A0 particle */
56 static const int HIGGS_A = 36;
57
58 /** H+ particle */
59 static const int HIGGS_PLUS = 37;
60
61 /** H- particle */
62 static const int HIGGS_MINUS = -37;
63
64 /** W+ particle */
65 static const int W_PLUS = 24;
66
67 /** W- particle */
68 static const int W_MINUS = -24;
69
70 /** photon */
71 static const int GAMMA = 22;
72
73 /** tau+ particle */
74 static const int TAU_PLUS = -15;
75
76 /** tau- particle */
77 static const int TAU_MINUS = 15;
78
79 /** tau neutrino particle */
80 static const int TAU_NEUTRINO = 16;
81
82 /** tau antineutrino particle */
83 static const int TAU_ANTINEUTRINO = -16;
84
85 /** muon+ particle */
86 static const int MUON_PLUS = -13;
87
88 /** muon- particle */
89 static const int MUON_MINUS = 13;
90
91 /** muon neutrino particle */
92 static const int MUON_NEUTRINO = 14;
93
94 /** muon antineutrino particle */
95 static const int MUON_ANTINEUTRINO = -14;
96
97 /** e+ particle */
98 static const int POSITRON = -11;
99
100 /** e- particle */
101 static const int ELECTRON = 11;
102
103 /** e neutrino particle */
104 static const int ELECTRON_NEUTRINO = 12;
105
106 /** e antineutrino particle */
107 static const int ELECTRON_ANTINEUTRINO = -12;
108
109 /** up quark */
110 static const int UP = 2;
111
112 /** anti-up quark */
113 static const int ANTIUP = -2;
114
115 /** down quark */
116 static const int DOWN = 1;
117
118 /** anti-down quark */
119 static const int ANTIDOWN = -1;
120
121 /** All other particle types*/
122 static const int OTHER = 0;
123
124public:
125 virtual ~PhotosParticle(){};
126
127 /** Return whether the particle has any chidren */
128 bool hasDaughters();
129
130 /** Traverse the event structure and find the final version
131 of this particle which does not have a particle of it's own type
132 as it's daughter. eg. Generally the final stable copy */
134
135 /** Traverse the event structure and find the first set of mothers
136 which are not of the same type as this particle. */
137 std::vector<PhotosParticle *> findProductionMothers();
138
139 /** Return whole decay tree starting from this particle */
140 std::vector<PhotosParticle *> getDecayTree();
141
142 /** Transform this particles four momentum from the lab frome
143 into the rest frame of the paramter PhotosParticle. */
144 void boostToRestFrame(PhotosParticle * boost);
145
146 /** Transform the four momentum of all the daughters recursively
147 into the frame of the "particle" PhotosParticle. */
149
150 /** Transform this particles four momentum from the rest frame of
151 the paramter PhotosParticle, back into the lab frame. */
153
154 /** Transform this particles four momentum from the lab frame to
155 the rest frame of the parameter PhotosParticle. */
157
158 /** Do a Lorenz transformation along the Z axis. */
159 void boostAlongZ(double pz, double e);
160
161 /** rotate this particles 4-momentum by an angle phi from
162 the axisis "axis" towards the axis "second_axis". */
163 void rotate(int axis, double phi, int second_axis=Z_AXIS);
164
165 /** rotate 4-momentum of daughters of this particle by an angle phi from
166 the axisis "axis" towards the axis "second_axis". */
167 void rotateDaughters(int axis, double phi, int second_axis=Z_AXIS);
168
169 /** Returns the angle around the axis "axis" needed to rotate
170 the four momenum is such a way that the non-Z component
171 disappears and Z>0. This is used to in rotating the coordinate
172 system into a frame with only a Z component before calling
173 boostAlongZ(). */
174 double getRotationAngle(int axis, int second_axis=Z_AXIS);
175
176 /** Get scalar momentum */
177 double getP();
178
179 /** Get momentum component in the direction of "axis" (x,y,z) */
180 double getP(int axis);
181
182 /** Set momentum component in the direction of "axis" (x,y,z) */
183 void setP(int axis, double p_component);
184
185 /** Get sqrt(e^2-p^2) */
186 virtual double getVirtuality();
187
188public:
189 /** check that the 4 momentum in conserved at the vertices producing
190 and ending this particle */
192
193 /** Returns the px component of the four vector */
194 virtual double getPx()=0;
195
196 /** Returns the py component of the four vector */
197 virtual double getPy()=0;
198
199 /** Returns the pz component of the four vector */
200 virtual double getPz()=0;
201
202 /** Returns the energy component of the four vector */
203 virtual double getE()=0;
204
205 /** Get the invariant mass from the event record*/
206 virtual double getMass() = 0;
207
208 /** Set the px component of the four vector */
209 virtual void setPx( double px )=0;
210
211 /** Set the px component of the four vector */
212 virtual void setPy( double py )=0;
213
214 /** Set the pz component of the four vector */
215 virtual void setPz( double pz )=0;
216
217 /** Set the energy component of the four vector */
218 virtual void setE( double e )=0;
219
220 /** Set the mothers of this particle via a vector of PhotosParticle */
221 virtual void setMothers(std::vector<PhotosParticle*> mothers)=0;
222
223 /** Set the daughters of this particle via a vector of PhotosParticle */
224 virtual void setDaughters(std::vector<PhotosParticle*> daughters)=0;
225
226 /** Add a new daughter to this particle */
227 virtual void addDaughter(PhotosParticle* daughter)=0;
228
229 /** Returns the mothers of this particle via a vector of PhotosParticle */
230 virtual std::vector<PhotosParticle*> getMothers()=0;
231
232 /** Returns the daughters of this particle via a vector of PhotosParticle */
233 virtual std::vector<PhotosParticle*> getDaughters()=0;
234
235 /** Returns all particles in the decay tree of this particle
236 via a vector of PhotosParticle */
237 virtual std::vector<PhotosParticle*> getAllDecayProducts()=0;
238
239 /** Set the PDG ID code of this particle */
240 virtual void setPdgID(int pdg_id)=0;
241
242 /** Set the mass of this particle */
243 virtual void setMass(double mass)=0;
244
245 /** Set the status of this particle */
246 virtual void setStatus(int status)=0;
247
248 /** Get the PDG ID code of this particle */
249 virtual int getPdgID()=0;
250
251 /** Get the status of this particle */
252 virtual int getStatus()=0;
253
254 /** Get the barcode of this particle */
255 virtual int getBarcode()=0;
256
257 /** Create a new particle of the same type, with the given
258 properties. The new particle bares no relations to this
259 particle, but it provides a way of creating a intance of
260 the derived class. eg. createNewParticle() is used inside
261 filhep_() so that an eg. PhotosHepMCParticle is created without
262 the method having explicit knowledge of the PhotosHepMCParticle
263 class */
264 virtual PhotosParticle * createNewParticle(int pdg_id, int status,
265 double mass, double px,
266 double py, double pz,
267 double e)=0;
268
269 /** Create history entry of this particle before modifications
270 of PHOTOS. Implementation of this method depends strongly
271 on the event record. */
272 virtual void createHistoryEntry()=0;
273
274 /** Create a self-decay vertex for this particle
275 with 'out' being the outgoing particle in new vertex */
277
278 /** Print some information about this particle to standard output */
279 virtual void print()=0;
280};
281
282} // namespace Photospp
283#endif
virtual void print()=0
virtual void setDaughters(std::vector< PhotosParticle * > daughters)=0
virtual void setE(double e)=0
void rotate(int axis, double phi, int second_axis=Z_AXIS)
virtual void setMothers(std::vector< PhotosParticle * > mothers)=0
virtual std::vector< PhotosParticle * > getDaughters()=0
virtual void setStatus(int status)=0
virtual std::vector< PhotosParticle * > getMothers()=0
PhotosParticle * findLastSelf()
virtual bool checkMomentumConservation()=0
void boostToRestFrame(PhotosParticle *boost)
virtual int getBarcode()=0
virtual void setPy(double py)=0
virtual int getPdgID()=0
void rotateDaughters(int axis, double phi, int second_axis=Z_AXIS)
virtual double getPz()=0
virtual double getE()=0
virtual double getPy()=0
virtual double getPx()=0
virtual void setMass(double mass)=0
void setP(int axis, double p_component)
virtual void setPdgID(int pdg_id)=0
virtual void createHistoryEntry()=0
std::vector< PhotosParticle * > getDecayTree()
virtual double getVirtuality()
std::vector< PhotosParticle * > findProductionMothers()
virtual void setPx(double px)=0
void boostAlongZ(double pz, double e)
virtual int getStatus()=0
virtual void setPz(double pz)=0
double getRotationAngle(int axis, int second_axis=Z_AXIS)
virtual void addDaughter(PhotosParticle *daughter)=0
virtual void createSelfDecayVertex(PhotosParticle *out)=0
virtual double getMass()=0
void boostDaughtersFromRestFrame(PhotosParticle *boost)
virtual std::vector< PhotosParticle * > getAllDecayProducts()=0
void boostFromRestFrame(PhotosParticle *boost)
void boostDaughtersToRestFrame(PhotosParticle *boost)
virtual PhotosParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)=0