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