]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/Tauola/TauolaParticle.h
Handle expressions with negations (Diego)
[u/mrichter/AliRoot.git] / TEvtGen / Tauola / TauolaParticle.h
1 #ifndef _TauolaParticle_h_included_
2 #define _TauolaParticle_h_included_
3
4 /**
5  * @class TauolaParticle
6  *
7  * @brief Abstract base class for particle in the event. This class also
8  * handles boosting.
9  *
10  * TauolaParticle is a Tauola 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 TauolaHepMCParticle. In this way it provides an
13  * interface to the information in the Event Record.
14  *
15  * The class is also responsible for decays and contains the polarimetric 
16  * vector returned from tauola. All boosting is also done here.
17  *
18  * @author Nadia Davidson
19  * @date 16 June 2008
20  */
21
22 #include <iostream>
23 #include <math.h>
24 #include <vector>
25
26 #include "DecayList.h"
27 #include "Tauola.h"
28 #include "f_Decay.h"
29
30 namespace Tauolapp
31 {
32
33 class TauolaParticle{
34
35  public:
36
37   virtual ~TauolaParticle(){};
38
39   /** The same sign as decaying particle pdg ID code 
40       given to Tauola object (only meaningful for taus). */
41   static const int SAME_SIGN=1;
42
43   /** The opposite sign to decaying particle pdg ID code 
44       given to Tauola object (only meaningful for taus). */
45   static const int OPPOSITE_SIGN=2;
46
47   /** Sign type is not applicable for this particle
48       (probably it's not a tau). */
49   static const int NA_SIGN=3;
50
51   /** Stable particle status */
52   static const int STABLE=1;
53
54   /** Decayed particle status */
55   static const int DECAYED=2;
56
57   /** History particle status */
58   static const int HISTORY=3;  
59
60   /** X Axis */
61   static const int X_AXIS=1;
62
63   /** Y Axis */
64   static const int Y_AXIS=2;
65
66   /** Z Axis */
67   static const int Z_AXIS=3;
68
69   /** Z0 particle */
70   static const int Z0 = 23;
71
72   /** H particle */
73   static const int HIGGS = 25;
74
75   /** A0 particle */
76   static const int HIGGS_A = 36;
77
78   /** H+ particle */
79   static const int HIGGS_PLUS = 37;
80
81   /** H- particle */
82   static const int HIGGS_MINUS = -37;
83
84
85   /** W+ particle */
86   static const int W_PLUS = 24;
87
88   /** W- particle */
89   static const int W_MINUS = -24;
90
91   /** photon */
92   static const int GAMMA = 22;
93
94   /** tau+ particle */
95   static const int TAU_PLUS = -15;
96
97   /** tau- particle */
98   static const int TAU_MINUS = 15;
99
100   /** tau neutrino particle */
101   static const int TAU_NEUTRINO = 16;
102
103   /** tau antineutrino particle */
104   static const int TAU_ANTINEUTRINO = -16;
105
106
107   /** muon+ particle */
108   static const int MUON_PLUS = -13;
109
110   /** muon- particle */
111   static const int MUON_MINUS = 13;
112
113   /** muon neutrino particle */
114   static const int MUON_NEUTRINO = 14;
115
116   /** muon antineutrino particle */
117   static const int MUON_ANTINEUTRINO = -14;
118
119
120   /** e+ particle */
121   static const int POSITRON = -11;
122
123   /** e- particle */
124   static const int ELECTRON = 11;
125
126   /** e neutrino particle */
127   static const int ELECTRON_NEUTRINO = 12;
128
129   /** e antineutrino particle */
130   static const int ELECTRON_ANTINEUTRINO = -12;
131
132   /** up quark */
133   static const int UP = 2;
134
135   /** anti-up quark */
136   static const int ANTIUP = -2;
137
138   /** down quark */
139   static const int DOWN = 1;
140
141   /** anti-down quark */
142   static const int ANTIDOWN = -1;
143
144   static const int GLUON = 21;
145   static const int CHARM = 4;
146   static const int TOP = 6;
147   static const int STRANGE = 3;
148   static const int BOTTOM = 5;
149
150   /** All other particle types*/
151   static const int OTHER = 0;
152
153   /** Create a new particle with the same properties as this one.
154       Mothers and daughters will not be linked. */
155   TauolaParticle * clone();
156
157   /** Get the angle between this particle and another particle */
158   double getAngle(TauolaParticle *);
159
160   /** Add the 4 momentum of another particle to this particle */
161   void add(TauolaParticle *);
162
163   /** Subtract the 4 momentum of another particle from this particle */
164   void subtract(TauolaParticle *);
165
166   /** Decay the particle. This calls the decay methods in the
167       interface to (FORTRAN) tauola. */
168   void decay();
169
170   /** Invokes TAUOLA FORTRAN routine DEKAY retrieving the daughters of
171       decayed tau. */
172   void addDecayToEventRecord();
173
174   /** Get whether this particle has the same or opposite sign
175       to the pdg code given to the Tauola object. (Only relevant
176       for tau particles).*/  
177   int  getSign();
178
179   /** Get the polarimetric vector of this particle in the direction X. 
180       (Only relevant for tau particles).*/
181   double getPolarimetricX();
182
183   /** Get the polarimetric vector of this particle in the direction Y. 
184       (Only relevant for tau particles).*/
185   double getPolarimetricY();
186
187   /** Get the polarimetric vector of this particle in the direction Z. 
188       (Only relevant for tau particles).*/
189   double getPolarimetricZ(); 
190
191   /** Return whether the particle has any chidren */
192   bool hasDaughters();
193
194   /** Traverse the event structure and find the final version
195       of this particle which does not have a particle of it's own type
196       as it's daughter. eg. Generally the final stable copy */ 
197   TauolaParticle * findLastSelf();
198
199   /** Traverse the event structure and find the first set of mothers 
200       which are not of the same type as this particle. */
201   std::vector<TauolaParticle *> findProductionMothers();
202
203   /** Transform this particles four momentum from the lab frome
204       into the rest frame of the paramter TauolaParticle. **/   
205   void boostToRestFrame(TauolaParticle * boost);
206
207   /** Transform the four momentum of all the daughters recursively 
208       into the frame of the "particle" TauolaParticle. **/   
209   void boostDaughtersToRestFrame(TauolaParticle * boost);
210
211
212   /** Transform this particles four momentum from the rest frame of
213       the paramter TauolaParticle, back into the lab frame. **/   
214   void boostFromRestFrame(TauolaParticle * boost);
215
216   void boostDaughtersFromRestFrame(TauolaParticle * boost);
217
218   /** Do a Lorenz transformation along the Z axis. */ 
219   void boostAlongZ(double pz, double e);
220
221   /** rotate this particles 4-momentum by an angle phi from
222    the axisis "axis" towards the axis "second_axis". */
223   void rotate(int axis, double phi, int second_axis=Z_AXIS);
224
225   void rotateDaughters(int axis, double phi, int second_axis=Z_AXIS);
226
227   /** Returns the angle around the axis "axis" needed to rotate 
228       the four momenum is such a way that the non-Z component 
229       disappears and Z>0. This is used to rotating the coordinate 
230       system into a frame with only a Z component before calling 
231       boostAlongZ().*/
232   double getRotationAngle(int axis, int second_axis=Z_AXIS);
233
234   /** Get scalar momentum */
235   double getP();
236
237   /** Get momentum component in the direction of "axis" (x,y,z) */
238   double getP(int axis);
239
240   /** Set momentum component in the direction of "axis" (x,y,z) */
241   void  setP(int axis, double p_component);
242
243   /** Get the invariant mass from the four momentum*/
244   double getMass();
245
246
247
248   /********************************************** 
249       Beginning of virtual methods 
250
251   ********************************************/
252
253   /** remove the ougoing branch from this particles and reset its status to stable */
254   virtual void undecay(){};
255
256   /** check that the 4 momentum in conserved at the vertices producing
257       and ending this particle */
258   virtual void checkMomentumConservation(){};
259
260   /** Optional. Modify particle or decay tree if needed. */
261   virtual void decayEndgame(){};
262
263   /** Returns the px component of the four vector*/
264   virtual double getPx()=0;
265
266   /** Returns the py component of the four vector */
267   virtual double getPy()=0;
268
269   /** Returns the pz component of the four vector */
270   virtual double getPz()=0;
271
272   /** Returns the energy component of the four vector */
273   virtual double getE()=0;
274
275   /** Set the px component of the four vector */
276   virtual void setPx( double px )=0;
277
278   /** Set the px component of the four vector */
279   virtual void setPy( double py )=0;
280
281   /** Set the pz component of the four vector */
282   virtual void setPz( double pz )=0;
283
284   /** Set the energy component of the four vector */
285   virtual void setE( double e )=0;
286
287   /** Set the mothers of this particle via a vector of TauolaParticle */
288   virtual void setMothers(std::vector<TauolaParticle*> mothers)=0;
289
290   /** Set the daughters of this particle via a vector of TauolaParticle */  
291   virtual void setDaughters(std::vector<TauolaParticle*> daughters)=0;
292
293   /** Returns the mothers of this particle via a vector of TauolaParticle */
294   virtual std::vector<TauolaParticle*> getMothers()=0;
295
296   /** Returns the daughters of this particle via a vector of TauolaParticle */
297   virtual std::vector<TauolaParticle*> getDaughters()=0;
298
299   /** Set the PDG ID code of this particle */
300   virtual void setPdgID(int pdg_id)=0;
301
302   /** Set the mass of this particle */
303   virtual void setMass(double mass)=0;
304
305   /** Set the status of this particle */
306   virtual void setStatus(int status)=0;
307
308   /** Get the PDG ID code of this particle */
309   virtual int getPdgID()=0;
310
311   /** Get the status of this particle */
312   virtual int getStatus()=0;
313
314   /** Get the barcode of this particle */
315   virtual int getBarcode()=0;
316
317   /** Create a new particle of the same type, with the given
318       properties. The new particle bares no relations to this
319       particle, but it provides a way of creating a intance of
320       the derived class. eg. createNewParticle() is used inside
321       filhep_() so that an eg. TauolaHepMCParticle is created without
322       the method having explicit knowledge of the TauolaHepMCParticle 
323       class */
324   virtual TauolaParticle * createNewParticle(int pdg_id, int status, 
325                                              double mass, double px,
326                                              double py, double pz,
327                                              double e)=0;
328
329   /** Print some information about this particle to standard output */
330   virtual void print()=0;
331
332  private:
333
334   /** The polarimetric vector of this particle in the direction X. 
335       (Only relevant for tau particles). */
336   double m_pol_x;
337
338   /** The polarimetric vector of this particle in the direction Y. 
339       (Only relevant for tau particles). */
340   double m_pol_y;
341
342   /** The polarimetric vector of this particle in the direction Z. 
343       (Only relevant for tau particles). */
344   double m_pol_z;
345
346   /** Fourth component of the polarimetric vector. Should be the
347       normalisation (1). (Only relevant for tau particles). */
348   double m_pol_n;
349 };
350
351 } // namespace Tauolapp
352 #endif  
353