]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/Photos/Photos.h
Merge branch 'master' into LocalDev
[u/mrichter/AliRoot.git] / TEvtGen / Photos / Photos.h
1 #ifndef _Photos_h_included_
2 #define _Photos_h_included_
3
4 /**
5  * @class Photos
6  *
7  * @brief Controls the configuration and initialization of Photos.
8  *
9  * This is the main configuration class for Photos C++ Interface.
10  * It is also used for invoking methods for processing single particle or branch.
11  *
12  * @author Nadia Davidson
13  * @date 16th June 2008
14  *
15  */
16 #include <stdarg.h>
17 #include <vector>
18 #include "PhotosParticle.h"
19 #include "PhotosRandom.h"
20 #include "f_Init.h"
21 // WARNING: VARIANT B of phase space generation was not tested in C++ for all
22 // options of the program initialization.. 
23 //#define VARIANTB true
24 using std::vector;
25 using std::pair;
26
27 namespace Photospp
28 {
29
30 class PhotosParticle;
31
32 class Photos
33 {
34 public:
35         static const int VER_MAJOR=3, VER_MINOR=54;
36         static const int DAT_DAY  =2, DAT_MONTH=12,DAT_YEAR=13;
37 public:
38
39         /** Initalize Photos with the parameters previously set via the
40            setter methods */
41         static void initialize();
42
43         /** Prints info on  Photos initialization (reinitialization)
44            status */
45         static void iniInfo();
46
47         /** Process decay of single particle */
48         static void processParticle(PhotosParticle *p);
49         /** Process decay of whole decay branch starting from given particle */
50         static void processBranch(PhotosParticle *p);
51
52         /** Suppress processing of a single decay */
53         static void suppressBremForDecay (int count, int motherID, ... );
54         /** Suppress processing of whole decay branch */
55         static void suppressBremForBranch(int count, int motherID, ... );
56
57         /** Suppress all processing. Only forced decays will be processed. */
58         static void suppressAll()                      { isSuppressed=true; }
59
60         /** Force processing of a single decay */
61         static void forceBremForDecay (int count, int motherID, ... );
62
63         /** Force processing of a whole decay branch */
64         static void forceBremForBranch(int count, int motherID, ... );
65
66   /** Block emissions id decays pi0 and K_L -> gamma e+ e- 
67       1           = no suppression
68       2 (default) = suppressed emissions in K_L -> gamma e+ e- ... and all pi0 decays */
69   static void IPHEKL_setPi0KLnoEmission(int m);
70
71   static bool IPHQRK_setQarknoEmission(int MODCOR, int PDGID);
72   
73   /** If event record allows it, create history entries of particles
74       before Photos processing */
75   static void createHistoryEntries(bool flag, int status);
76
77   /** Ignore particles with given status code */
78   static void ignoreParticlesOfStatus(int status);
79
80   /** Remove 'status' from the list of ignored status codes */
81   static void deIgnoreParticlesOfStatus(int status);
82   
83   /** Returns 'true' if status code is ignored */
84   static bool isStatusCodeIgnored(int status);
85 public:
86   /** Substitute build-in generator with external one */
87   static void setRandomGenerator( double (*gen)() );
88
89         /** Seed for RANMAR used by fortran part of the Photos */
90         static void setSeed(int iseed1, int iseed2)    { PhotosRandom::setSeed(iseed1,iseed2); }
91
92         /** Maximum interference weight */
93         static void maxWtInterference(double interference) { phokey_.fint=interference; }
94
95         /** Minimal energy (in units of decaying particle mass) for photons to be explicitly generated */
96         static void setInfraredCutOff(double cut_off)  { phocop_.xphcut=cut_off; }
97
98         /** Coupling constant alpha QED */
99         static void setAlphaQED(double alpha)          { phocop_.alpha=alpha; }
100
101         /** Key for interference, matrix element weight */
102         static void setInterference(bool interference) { phokey_.interf=(int)interference; }
103
104         /** Set double bremsstrahlung generation */
105         static void setDoubleBrem(bool doub)           { phokey_.isec=(int)doub; }
106
107         /** Set bremsstrahlung generation up to multiplicity of 4 */
108         static void setQuatroBrem(bool quatroBrem)     { phokey_.itre=(int)quatroBrem; }
109
110         /* Key for partial effects of  matrix element (in leptonic W decays) */
111         static void setCorrectionWtForW(bool corr) { phokey_.ifw=(int)corr; }
112
113         /** Set exponentiation mode */
114         static void setExponentiation(bool expo);
115
116         /** Switch for complete effects of matrix element (in  scalar  to 2 scalars decays) */
117         static void setMeCorrectionWtForScalar(bool corr);
118
119         /** Switch for complete effects of matrix element (in leptonic W decays) */
120         static void setMeCorrectionWtForW(bool corr);
121
122         /** Switch for complete effects of matrix element (in leptonic Z decays) */
123         static void setMeCorrectionWtForZ(bool corr);
124
125         /** Set photon emission in top pair production in quark (gluon) pair annihilation */
126         static void setTopProcessRadiation(bool top)         { phokey_.iftop=(int)top; }
127
128         /* Set if PHOTOS should stop at critical error. True by default.
129            WARNING: These stops are an essential source of debugging information flow
130                     from event record to PHOTOS algorithm. Never switch it off! The only exception:
131                     you have checked your set-up including particular physics initialization
132                     with the substantially large sample and you submit large production. */
133         static void setStopAtCriticalError(bool stop);
134
135         /** Initialize kinematic corrections */
136         static void initializeKinematicCorrections(int flag) { PHCORK(flag); }
137
138         /** Force mass value to be sqrt(e^2-p^2) for all particle momenta
139             taken from event record. May be important for numerical stability.
140                 May lead to faulty results due to rounding errors for
141                 hiper-relativistic electron, for example. */
142         static void forceMassFrom4Vector(bool flag) { massFrom4Vector=flag; }
143         
144   /** When particles with PDGID and -PDGID will be processed by Photos,
145       their mass value will be taken from event record instead of being
146       calculated from 4-vector.
147
148       This works only if 'forceMassFrom4Vector' is set to 'true' (default)      
149       This routine may be executed several times with different PDGID values. */
150   static void forceMassFromEventRecord(int pdgid);
151
152   /** When particles with PDGID and -PDGID will be processed by Photos,
153       their mass value will be given by user instead of being calculated
154       from 4-vector.
155
156       This works only if 'forceMassFrom4Vector' is set to 'true' (default)
157       This routine may be executed several times with different PDGID values. */  
158   static void forceMass(int pdgid, double mass);
159
160         /** set energy momentum conservation threshold */
161         static void setMomentumConservationThreshold(double threshold){momentum_conservation_threshold=threshold; }
162
163 public:
164         /** Is in suppressed mode */
165         static bool isSuppressed;
166
167         /** Is mass from 4-vector or from event record */
168         static bool massFrom4Vector;
169         
170         /** List of suppressed decays */
171         static vector<vector<int>* >    *supBremList;
172
173         /** List of forced decays */
174         static vector<vector<int>* >    *forceBremList;
175
176         /** List of forced mass values */
177         static vector<pair<int,double>* > *forceMassList;
178   
179   /** List of ignored status codes */
180         static vector<int >             *ignoreStatusCodeList;
181
182         /** Threshold for momentum conservation check */
183         static double momentum_conservation_threshold;
184
185         /** Flag for complete effects of matrix element (in scalars decays) */
186         static bool meCorrectionWtForScalar;
187
188         /** Flag for complete effects of matrix element (in leptonic Z decays) */
189         static bool meCorrectionWtForZ;
190         
191         /** Flag for complete effects of matrix element (in leptonic W decays) */
192         static bool meCorrectionWtForW;
193   
194   /** Flag for creating historic entries */
195   static bool isCreateHistoryEntries;
196
197   /** Status of history entries */
198   static int  historyEntriesStatus;
199
200   /** Pointer to random generator function */
201   static double (*randomDouble)();
202 public:
203         /** Get instance of Photos */
204         Photos& getInstance() { return _instance; }
205 private:
206         /* Singleton: only one instance allowed.
207            Constructor sets default values of PHOTOS parameters */
208          Photos();
209         ~Photos() {}
210         Photos(const Photos&);
211         Photos& operator=(const Photos&);
212         static Photos _instance;
213 };
214
215 } // namespace Photospp
216 #endif
217