Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:20:26

0001 #ifndef _Photos_h_included_
0002 #define _Photos_h_included_
0003 
0004 /**
0005  * @class Photos
0006  *
0007  * @brief Controls the configuration and initialization of Photos.
0008  *
0009  * This is the main configuration class for Photos C++ Interface.
0010  * It is also used for invoking methods for processing single particle or branch.
0011  *
0012  * @author Nadia Davidson
0013  * @date 16th June 2008
0014  */
0015 #include <stdarg.h>
0016 #include <vector>
0017 #include "PhotosParticle.h"
0018 #include "PhotosRandom.h"
0019 #include "photosC.h"
0020 // WARNING: VARIANT B of phase space generation was not tested in C++ for all
0021 // options of the program initialization.. 
0022 //#define VARIANTB true
0023 using std::vector;
0024 using std::pair;
0025 
0026 namespace Photospp
0027 {
0028 
0029 class PhotosParticle;
0030 
0031 class Photos
0032 {
0033 public:
0034     static const int VER_MAJOR=3, VER_MINOR=64;
0035     static const int DAT_DAY  =18, DAT_MONTH=2, DAT_YEAR=20;
0036     
0037     /** Units */
0038     static enum MomentumUnits { DEFAULT_MOMENTUM=-1, MEV, GEV } momentumUnit;
0039 
0040 
0041 public:
0042 
0043     /** Initalize Photos with the parameters previously set via the
0044        setter methods */
0045     static void initialize();
0046 
0047     /** Prints info on  Photos initialization (reinitialization)
0048        status */
0049     static void iniInfo();
0050 
0051     /** Process decay of single particle */
0052     static void processParticle(PhotosParticle *p);
0053     /** Process decay of whole decay branch starting from given particle */
0054     static void processBranch(PhotosParticle *p);
0055 
0056     /** Suppress processing of a single decay */
0057     static void suppressBremForDecay (int count, int motherID, ... );
0058     /** Suppress processing of whole decay branch */
0059     static void suppressBremForBranch(int count, int motherID, ... );
0060 
0061     /** Suppress all processing. Only forced decays will be processed. */
0062     static void suppressAll()                      { isSuppressed=true; }
0063 
0064     /** Force processing of a single decay */
0065     static void forceBremForDecay (int count, int motherID, ... );
0066 
0067     /** Force processing of a whole decay branch */
0068     static void forceBremForBranch(int count, int motherID, ... );
0069 
0070   /** Block emissions id decays pi0 and K_L -> gamma e+ e- 
0071       1           = no suppression
0072       2 (default) = suppressed emissions in K_L -> gamma e+ e- ... and all pi0 decays */
0073   static void IPHEKL_setPi0KLnoEmission(int m);
0074 
0075   static bool IPHQRK_setQarknoEmission(int MODCOR, int PDGID);
0076   
0077   /** If event record allows it, create history entries of particles
0078       before Photos processing */
0079   static void createHistoryEntries(bool flag, int status);
0080 
0081   /** Ignore particles with given status code */
0082   static void ignoreParticlesOfStatus(int status);
0083 
0084   /** Remove 'status' from the list of ignored status codes */
0085   static void deIgnoreParticlesOfStatus(int status);
0086   
0087   /** Returns 'true' if status code is ignored */
0088   static bool isStatusCodeIgnored(int status);
0089 public:
0090   /** Substitute build-in generator with external one */
0091   static void setRandomGenerator( double (*gen)() );
0092 
0093     /** Seed for RANMAR used by fortran part of the Photos */
0094     static void setSeed(int iseed1, int iseed2)    { PhotosRandom::setSeed(iseed1,iseed2); }
0095 
0096     /** Maximum interference weight */
0097     static void maxWtInterference(double interference) { phokey.fint=interference; }
0098 
0099     /** Minimal energy (in units of decaying particle mass) for photons to be explicitly generated */
0100     static void setInfraredCutOff(double cut_off)  { phocop.xphcut=cut_off; }
0101 
0102     /** Coupling constant alpha QED */
0103     static void setAlphaQED(double alpha)          { phocop.alpha=alpha; }
0104 
0105     /** Key for interference, matrix element weight */
0106     static void setInterference(bool interference) { phokey.interf=(int)interference; }
0107 
0108     /** Set double bremsstrahlung generation */
0109     static void setDoubleBrem(bool doub)           { phokey.isec=(int)doub; }
0110 
0111     /** Set bremsstrahlung generation up to multiplicity of 4 */
0112     static void setQuatroBrem(bool quatroBrem)     { phokey.itre=(int)quatroBrem; }
0113 
0114     /* Key for partial effects of  matrix element (in leptonic W decays) */
0115     static void setCorrectionWtForW(bool corr) { phokey.ifw=(int)corr; }
0116 
0117     /** Set exponentiation mode */
0118     static void setExponentiation(bool expo);
0119 
0120     /** Set pair emission */
0121     static void setPairEmission(bool ifpair);
0122 
0123     /** Set photon emission */
0124     static void setPhotonEmission(bool ifphot);
0125 
0126     /** Switch for complete effects of matrix element (in  scalar  to 2 scalars decays) */
0127     static void setMeCorrectionWtForScalar(bool corr);
0128 
0129     /** Switch for complete effects of matrix element (in leptonic W decays) */
0130     static void setMeCorrectionWtForW(bool corr);
0131 
0132     /** Switch for complete effects of matrix element (in leptonic Z decays) */
0133     static void setMeCorrectionWtForZ(bool corr);
0134 
0135     /** Set photon emission in top pair production in quark (gluon) pair annihilation */
0136     static void setTopProcessRadiation(bool top)         { phokey.iftop=(int)top; }
0137 
0138     /** Set momentum unit */
0139     static void setMomentumUnit(MomentumUnits unit)      { momentumUnit = unit; }
0140 
0141     /* Set if PHOTOS should stop at critical error. True by default.
0142        WARNING: These stops are an essential source of debugging information flow
0143                     from event record to PHOTOS algorithm. Never switch it off! The only exception:
0144                 you have checked your set-up including particular physics initialization
0145                     with the substantially large sample and you submit large production. */
0146     static void setStopAtCriticalError(bool stop);
0147 
0148     /** Initialize kinematic corrections */
0149     static void initializeKinematicCorrections(int flag) { PHCORK(flag); }
0150 
0151     /** Force mass value to be sqrt(e^2-p^2) for all particle momenta
0152         taken from event record. May be important for numerical stability.
0153         May lead to faulty results due to rounding errors for
0154         hiper-relativistic electron, for example. */
0155     static void forceMassFrom4Vector(bool flag) { massFrom4Vector=flag; }
0156     
0157   /** When particles with PDGID and -PDGID will be processed by Photos,
0158       their mass value will be taken from event record instead of being
0159       calculated from 4-vector.
0160 
0161       This works only if 'forceMassFrom4Vector' is set to 'true' (default)      
0162       This routine may be executed several times with different PDGID values. */
0163   static void forceMassFromEventRecord(int pdgid);
0164 
0165   /** When particles with PDGID and -PDGID will be processed by Photos,
0166       their mass value will be given by user instead of being calculated
0167       from 4-vector.
0168 
0169       This works only if 'forceMassFrom4Vector' is set to 'true' (default)
0170       This routine may be executed several times with different PDGID values. */  
0171   static void forceMass(int pdgid, double mass);
0172 
0173     /** set energy momentum conservation threshold */
0174     static void setMomentumConservationThreshold(double threshold){momentum_conservation_threshold=threshold; }
0175 
0176     /** set event no */
0177     static void setEventNo(int iEvt){EventNo=iEvt; }
0178 public:
0179 
0180 
0181     /** Is event No */
0182     static int EventNo;
0183 
0184     /** Is in suppressed mode */
0185     static bool isSuppressed;
0186 
0187     /** Is mass from 4-vector or from event record */
0188     static bool massFrom4Vector;
0189     
0190     /** List of suppressed decays */
0191     static vector<vector<int>* >    *supBremList;
0192 
0193     /** List of forced decays */
0194     static vector<vector<int>* >    *forceBremList;
0195 
0196     /** List of forced mass values */
0197     static vector<pair<int,double>* > *forceMassList;
0198   
0199   /** List of ignored status codes */
0200     static vector<int >             *ignoreStatusCodeList;
0201 
0202     /** Threshold for momentum conservation check */
0203     static double momentum_conservation_threshold;
0204 
0205     /** Flag for complete effects of matrix element (in scalars decays) */
0206     static bool meCorrectionWtForScalar;
0207 
0208     /** Flag for complete effects of matrix element (in leptonic Z decays) */
0209     static bool meCorrectionWtForZ;
0210     
0211     /** Flag for complete effects of matrix element (in leptonic W decays) */
0212     static bool meCorrectionWtForW;
0213   
0214   /** Flag for creating historic entries */
0215   static bool isCreateHistoryEntries;
0216 
0217   /** Flag for generating emission of pairs */
0218   static bool IfPair;
0219 
0220   /** Flag for generating emission of photons */
0221   static bool IfPhot;
0222 
0223 
0224   /** Status of history entries */
0225   static int  historyEntriesStatus;
0226 
0227   /** Pointer to random generator function */
0228   static double (*randomDouble)();
0229 public:
0230     /** Get instance of Photos */
0231     Photos& getInstance() { return _instance; }
0232 private:
0233     /* Singleton: only one instance allowed.
0234        Constructor sets default values of PHOTOS parameters */
0235      Photos();
0236     ~Photos() {}
0237     Photos(const Photos&);
0238     Photos& operator=(const Photos&);
0239     static Photos _instance;
0240 };
0241 
0242 } // namespace Photospp
0243 #endif
0244