]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/Tauola/Tauola.h
ATO-97, ATO-78 - speed-up creation of the AliTPCCalPad objects from TTree
[u/mrichter/AliRoot.git] / TEvtGen / Tauola / Tauola.h
1 #ifndef _Tauola_h_included_
2 #define _Tauola_h_included_
3
4 /** 
5  * @class Tauola
6  *
7  * @brief Controls the configuration, initialization of Tauola.
8  *
9  * The Tauola class provides a wrapper to the TAUOLA common block
10  * responsible for setting up TAUOLA. They should then configure Tauola
11  * via the set method and then call initialize(). This is a static class.
12  *
13  * @author Nadia Davidson
14  * @date 16th June 2008
15  */
16
17 #include <iostream>
18 #include "TauolaParticle.h"
19 #include "f_InitTauola.h"
20 #include "f_Variables.h"
21
22 namespace Tauolapp
23 {
24
25 class TauolaEvent;
26 class TauolaParticle;
27
28 class Tauola{
29
30  public:
31
32   static const int NS1=100,NS2=100,NS3=100,NCOS=21;
33
34   /** Units */
35   static enum MomentumUnits { DEFAULT_MOMENTUM=-1, MEV, GEV } momentumUnit;
36   static enum LengthUnits   { DEFAULT_LENGTH  =-1, MM , CM  } lengthUnit;
37
38   /** Set output units (default Tauola::GEV and Tauola::MM). */
39   static void   setUnits(MomentumUnits m,LengthUnits l);
40
41   /** Set tau lifetime (in mm). */
42   static void   setTauLifetime(double t);
43
44   /** Decay Modes */
45   enum { All=0, ElectronMode, MuonMode, PionMode,
46          RhoMode, A1Mode, KMode, KStarMode };
47
48   /** Structure for switching the computation of spin correlation.
49       By default all spin correlations are turned on. */
50   struct Particles
51   {
52      bool GAMMA,
53           Z0,
54           HIGGS,
55           HIGGS_H,
56           HIGGS_A,
57           HIGGS_PLUS,
58           HIGGS_MINUS,
59           W_PLUS,
60           W_MINUS;
61      void setAll(bool flag) { GAMMA=Z0=HIGGS=HIGGS_H=HIGGS_A=HIGGS_PLUS=HIGGS_MINUS=W_PLUS=W_MINUS=flag; }
62   } static spin_correlation;
63
64    /** Initalize Tauola with the parameters previously set via the
65        setter methods */
66    static void initialize();
67
68    /** DEPRECATED: Use 'initialize' instead. */
69    static void initialise();
70
71    /** Change currents used by Tauola.
72        mode = 0 (default) - use CLEO currents
73        mode = 1 use RChL currents for 3pi and Belle currents for 2pi */
74    static void setNewCurrents(int mode);
75
76    /** Substitute build-in generator with external one */
77    static void setRandomGenerator( double (*gen)() );
78
79    static void setRedefineTauMinus( void (*fun)(TauolaParticle *) );
80    static void setRedefineTauPlus ( void (*fun)(TauolaParticle *) );
81
82    /** Tau gun. Takes one particle that's already inside an event record and produces it's decay.
83        The tau provided may be undecayed first, or left intact if it already has daughters.
84        If the polarization three-vector is provided it will be used to construct m_R matrix. */
85    static void decayOne(TauolaParticle *tau, bool undecay=false, double polx=0,double poly=0, double polz=0);
86
87    /** Checks if we are using decayOne() */
88    static bool isUsingDecayOne();
89
90    /** Checks if we are using boost routine for decayOne */
91    static bool isUsingDecayOneBoost();
92
93    /** Set boost routine for decayOne(). Refer to documentation for more details. */
94    static void setBoostRoutine( void (*boost)(TauolaParticle*, TauolaParticle *) );
95
96    /** Execute boost routine for decayOne() */
97    static void decayOneBoost(TauolaParticle *mother, TauolaParticle *target);
98
99    /** Return polarization vector used by decayOne() */
100    static const double* getDecayOnePolarization();
101
102    /** Set the pdg id of the particle to decay (should be 15 or -15) */
103    static void setDecayingParticle(int pdg_id);
104
105    /** Return the pdg id of the particle to decay */
106    static int getDecayingParticle();
107    
108    /** Set the decay mode of all particle with pdg id the same
109        as the one given in setDecayingParticle(). firstDecayMode=0 
110        is default and allows all decay modes. */
111    static void setSameParticleDecayMode(int firstDecayMode);
112    
113    /** Set the decay mode of all particle with opposite charge
114        to the one given in setDecayingParticle(). secondDecayMode=0 
115        is default and allows all decay modes. */
116    static void setOppositeParticleDecayMode(int secondDecayMode);
117
118    /** Switch for bremssthahlung in leptonic tau decays */
119    static void setRadiation(bool rad);
120
121    /** Cut-Off parameter of radition. Above that value photon is explicitly generated */
122    static void setRadiationCutOff(double rad_cut_off);
123
124    /** Initialization of some constants related to QED corrections.
125        Variable iniphy_param is at present dummy. It is prepared to be transmitted
126        to some old style production code and is kept for backward compatibility */
127    static void setInitializePhy(double iniphy);
128
129    /** DEPRECATED: Use 'setInitializePhy' instead. */
130    static void setInitialisePhy(double iniphy);
131
132    /** Set branching fraction for i-th channel. Can be reused several times during the run. */
133    static void setTauBr(int i, double value);
134
135    static void setTaukle(double bra1, double brk0, double brk0b, double brks);
136
137    static double getHiggsScalarPseudoscalarMixingAngle();
138
139    /** set the mixing angle. coupling: tau~(cos(phi)+isin(phi)gamma5)tau */
140    static void setHiggsScalarPseudoscalarMixingAngle(double angle); 
141
142    /** Get mass of the tau used by interface. */
143    static double getTauMass();
144
145    /** Modify Higgs Scalar-Pseudoscalar PDG id (default is 35). */
146    static void setHiggsScalarPseudoscalarPDG(int pdg_id);
147
148    /** Get Higgs Scalar-Pseudoscalar PDG id. */
149    static int getHiggsScalarPseudoscalarPDG();
150
151    static int getHelPlus();
152
153    static int getHelMinus();
154
155    static double getEWwt();
156
157    static double getEWwt0();
158
159    static void setEWwt(double wt, double wt0);
160
161    static void setHelicities(int Minus, int Plus);
162
163    static void setEtaK0sPi(int eta, int k, int pi);
164
165    static void getBornKinematics(int *incoming_pdg_id, int *outgoing_pdg_id, double *invariant_mass_squared,double *cosTheta);
166
167    static void summary();
168
169 public:
170
171    static double table11A[NS1][NCOS][4][4],table1A[NS1][NCOS][4][4],table2A[NS1][NCOS][4][4];
172    static double wtable11A[NS1][NCOS],wtable1A[NS1][NCOS],wtable2A[NS1][NCOS];
173    static double w0table11A[NS1][NCOS],w0table1A[NS1][NCOS],w0table2A[NS1][NCOS];
174
175    static double table11B[NS2][NCOS][4][4],table1B[NS2][NCOS][4][4],table2B[NS2][NCOS][4][4];
176    static double wtable11B[NS2][NCOS],wtable1B[NS2][NCOS],wtable2B[NS2][NCOS];
177    static double w0table11B[NS2][NCOS],w0table1B[NS2][NCOS],w0table2B[NS2][NCOS];
178
179    static double table11C[NS3][NCOS][4][4],table1C[NS3][NCOS][4][4],table2C[NS3][NCOS][4][4];
180    static double wtable11C[NS3][NCOS],wtable1C[NS3][NCOS],wtable2C[NS3][NCOS];
181    static double w0table11C[NS3][NCOS],w0table1C[NS3][NCOS],w0table2C[NS3][NCOS];
182    static double sminA,smaxA,sminB,smaxB,sminC,smaxC;
183
184    static int ion[3];
185
186    // c*tau in milimeters, survival probablility  P(t)=exp(-t/lifetime) 
187    static double tau_lifetime;
188    static double momentum_conservation_threshold;
189
190    //born kinematic variables
191    static int buf_incoming_pdg_id,  buf_outgoing_pdg_id;
192    static double  buf_invariant_mass_squared,  buf_cosTheta;
193    static double  buf_R[4][4]; //density matrix
194
195    //pointer to random generator function
196    static double (*randomDouble)();
197
198    static void (*redefineTauPlusProperties)(TauolaParticle *);
199    static void (*redefineTauMinusProperties)(TauolaParticle *);
200
201  private:
202
203   /** Calculate the charge  of particle  with code 'idhep'. 
204       The code  of the  particle  is  defined by the Particle Data
205       Group in Phys. Lett. B204 (1988) 1.
206       NOTE: Code taken from Photos++, file: PhotosUtilities.cxx, function: PHOCHA */
207   static double particleCharge(int idhep);
208   
209   /** Fill 'array' indices from 'beg' to 'end' with 'value' */
210   static void fill_val(int beg, int end, double* array, double value);
211   
212   /** Default generator used in Tauola */
213   static double defaultRandomGenerator();
214   static void   defaultRedPlus(TauolaParticle *);
215   static void   defaultRedMinus(TauolaParticle *);
216
217   /** Are we using decayOne() ? */
218   static bool   m_is_using_decay_one;
219   /** decayOne() polarization vector */
220   static double m_decay_one_polarization[3];
221   /** Boost routine used by decayOne() */
222   static void (*m_decay_one_boost_routine)(TauolaParticle*,TauolaParticle*);
223
224   static int m_pdg_id;
225   static int m_firstDecayMode; 
226   static int m_secondDecayMode;
227   static bool m_rad;
228   static double m_rad_cut_off;
229   static double m_iniphy;
230   static double m_higgs_scalar_pseudoscalar_mix;
231   static int m_higgs_scalar_pseudoscalar_pdg;
232   static double m_wtEW;
233   static double m_wtEW0;
234   static int m_helPlus;
235   static int m_helMinus;
236 };
237
238 } // namespace Tauolapp
239 #endif  
240