src/photosCInterfaces/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 */
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 */
203  static double momentum_conservation_threshold;
204 
205  /** Flag for complete effects of matrix element (in scalars decays) */
206  static bool meCorrectionWtForScalar;
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 */
215  static bool isCreateHistoryEntries;
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 */
225  static int historyEntriesStatus;
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 
Abstract base class for particle in the event. This class also handles boosting.
Controls the configuration and initialization of Photos.
static void createHistoryEntries(bool flag, int status)
static void deIgnoreParticlesOfStatus(int status)
static void setQuatroBrem(bool quatroBrem)
static void setPairEmission(bool ifpair)
static void setSeed(int iseed1, int iseed2)
static bool isCreateHistoryEntries
static void setExponentiation(bool expo)
static void forceMassFrom4Vector(bool flag)
static bool meCorrectionWtForZ
static void setMomentumConservationThreshold(double threshold)
static void setMeCorrectionWtForScalar(bool corr)
static void suppressBremForBranch(int count, int motherID,...)
static vector< pair< int, double > * > * forceMassList
static void processParticle(PhotosParticle *p)
static void forceBremForBranch(int count, int motherID,...)
static void IPHEKL_setPi0KLnoEmission(int m)
static bool isStatusCodeIgnored(int status)
static void setMeCorrectionWtForW(bool corr)
static void ignoreParticlesOfStatus(int status)
static void suppressBremForDecay(int count, int motherID,...)
static void setRandomGenerator(double(*gen)())
static void setInfraredCutOff(double cut_off)
static void setTopProcessRadiation(bool top)
static bool meCorrectionWtForScalar
static void setInterference(bool interference)
static void processBranch(PhotosParticle *p)
static void initialize()
static void maxWtInterference(double interference)
static void iniInfo()
static double(* randomDouble)()
static vector< vector< int > * > * supBremList
static void setPhotonEmission(bool ifphot)
static vector< vector< int > * > * forceBremList
static vector< int > * ignoreStatusCodeList
static void setMeCorrectionWtForZ(bool corr)
static void setMomentumUnit(MomentumUnits unit)
static void forceMass(int pdgid, double mass)
static void forceBremForDecay(int count, int motherID,...)
static void setEventNo(int iEvt)
static void setDoubleBrem(bool doub)
static double momentum_conservation_threshold
static void forceMassFromEventRecord(int pdgid)
static void initializeKinematicCorrections(int flag)
static bool meCorrectionWtForW
static void setAlphaQED(double alpha)