Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:38

0001 // LHAFortran.h is a part of the PYTHIA event generator.
0002 // Copyright (C) 2024 Torbjorn Sjostrand.
0003 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
0004 // Please respect the MCnet Guidelines, see GUIDELINES for details.
0005 
0006 // Header file for Fortran Les Houches Accord user process information.
0007 // LHAupFortran: derived class with the HEPRUP and HEPEUP Fortran info.
0008 // You are expected to create a derived class that supplies the fillHepRup
0009 // and fillHepEup methods (and returns true when successful).
0010 
0011 #ifndef Pythia8_LHAFortran_H
0012 #define Pythia8_LHAFortran_H
0013 
0014 #include "Pythia8/Pythia.h"
0015 
0016 namespace Pythia8 {
0017 
0018 //==========================================================================
0019 
0020 // Give access to the HEPRUP and HEPEUP Fortran commonblocks.
0021 
0022 #ifdef _WIN32
0023   #define heprup_ HEPRUP
0024   #define hepeup_ HEPEUP
0025 #endif
0026 
0027 extern "C" {
0028 
0029   extern struct {
0030     int idbmup[2];
0031     double ebmup[2];
0032     int pdfgup[2], pdfsup[2], idwtup, nprup;
0033     double xsecup[100], xerrup[100], xmaxup[100];
0034     int lprup[100];
0035   } heprup_;
0036 
0037   extern struct {
0038     int nup, idprup;
0039     double xwgtup, scalup, aqedup, aqcdup;
0040     int idup[500], istup[500], mothup[500][2], icolup[500][2];
0041     double pup[500][5], vtimup[500],spinup[500];
0042   } hepeup_;
0043 
0044 }
0045 
0046 //==========================================================================
0047 
0048 // A derived class with initialization information from the HEPRUP
0049 // Fortran commonblock and event information from the HEPEUP one.
0050 
0051 class LHAupFortran : public LHAup {
0052 
0053 public:
0054 
0055   // Constructor.
0056   LHAupFortran() {}
0057 
0058   // Routine for doing the job of setting initialization info.
0059   bool setInit() {
0060     // Call the routine that does the job.
0061     if (!fillHepRup()) return false;
0062     // Store beam and strategy info.
0063     setBeamA(heprup_.idbmup[0], heprup_.ebmup[0], heprup_.pdfgup[0],
0064       heprup_.pdfsup[0]);
0065     setBeamB(heprup_.idbmup[1], heprup_.ebmup[1], heprup_.pdfgup[1],
0066       heprup_.pdfsup[1]);
0067     setStrategy(heprup_.idwtup);
0068     // Store process info. Protect against vanishing cross section.
0069     for (int ip = 0; ip < heprup_.nprup; ++ip) {
0070       double xsec = max( 1e-10, heprup_.xsecup[ip]);
0071       addProcess( heprup_.lprup[ip], xsec, heprup_.xerrup[ip],
0072         heprup_.xmaxup[ip] );
0073     }
0074     // Store the beam energies to calculate x values later.
0075     eBeamA = heprup_.ebmup[0];
0076     eBeamB = heprup_.ebmup[1];
0077     // Done.
0078     return true;
0079   }
0080 
0081   // Routine for doing the job of setting info on next event.
0082   bool setEvent(int idProcIn = 0) {
0083     // In some strategies the type of the next event has been set.
0084     hepeup_.idprup = idProcIn;
0085     // Call the routine that does the job.
0086     if (!fillHepEup()) return false;
0087     // Store process info.
0088     setProcess(hepeup_.idprup, hepeup_.xwgtup, hepeup_.scalup,
0089       hepeup_.aqedup, hepeup_.aqcdup);
0090     // Store particle info.
0091     for (int ip = 0; ip < hepeup_.nup; ++ip) addParticle(hepeup_.idup[ip],
0092       hepeup_.istup[ip], hepeup_.mothup[ip][0], hepeup_.mothup[ip][1],
0093       hepeup_.icolup[ip][0], hepeup_.icolup[ip][1], hepeup_.pup[ip][0],
0094       hepeup_.pup[ip][1], hepeup_.pup[ip][2], hepeup_.pup[ip][3],
0095       hepeup_.pup[ip][4], hepeup_.vtimup[ip], hepeup_.spinup[ip]) ;
0096     // Store x values (here E = pup[ip][3]), but note incomplete info.
0097     setPdf( hepeup_.idup[0], hepeup_.idup[1], hepeup_.pup[0][3]/eBeamA,
0098       hepeup_.pup[1][3]/eBeamB, 0., 0., 0., false);
0099     // Done.
0100     return true;
0101   }
0102 
0103 protected:
0104 
0105   // User-written routine that does the intialization and fills heprup.
0106   virtual bool fillHepRup() {return false;}
0107 
0108   // User-written routine that does the event generation and fills hepeup.
0109   virtual bool fillHepEup() {return false;}
0110 
0111 private:
0112 
0113   // Save beam energies to calculate x values.
0114   double eBeamA, eBeamB;
0115 
0116 };
0117 
0118 //==========================================================================
0119 
0120 } // end namespace Pythia8
0121 
0122 #endif // Pythia8_LHAFortran_H