Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:54

0001 #ifndef gen_Pythia6Service_h
0002 #define gen_Pythia6Service_h
0003 
0004 #include <vector>
0005 
0006 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0007 #include "FWCore/Utilities/interface/Exception.h"
0008 
0009 #include "GeneratorInterface/Core/interface/FortranInstance.h"
0010 
0011 // #include "HepMC/PythiaWrapper6_2.h"
0012 
0013 namespace CLHEP {
0014   class HepRandomEngine;
0015 }
0016 
0017 namespace gen {
0018 
0019   // the callbacks from Pythia which are passed on to the Pythia6Service
0020   extern "C" {
0021   double pyr_(int* idummy);
0022   }
0023 
0024   class Pythia6Service : public FortranInstance {
0025   public:
0026     // ctor & dtor
0027     Pythia6Service();
0028     Pythia6Service(edm::ParameterSet const&);
0029     ~Pythia6Service() override;
0030 
0031     void setGeneralParams();
0032     void setCSAParams();
0033     void setSLHAParams();
0034     void setPYUPDAParams(bool afterPyinit);
0035     void setSLHAFromHeader(const std::vector<std::string>& lines);
0036 
0037     void openSLHA(const char*);
0038     void closeSLHA();
0039     void openPYUPDA(const char*, bool write_file);
0040     void closePYUPDA();
0041 
0042     // initialise Pythia on first call from "dummy" instance
0043     void enter() override;
0044 
0045     CLHEP::HepRandomEngine* randomEngine() const { return fRandomEngine; }
0046     void setRandomEngine(CLHEP::HepRandomEngine* v) { fRandomEngine = v; }
0047 
0048   private:
0049     friend double gen::pyr_(int*);
0050 
0051     bool fInitialising;
0052 
0053     CLHEP::HepRandomEngine* fRandomEngine;
0054 
0055     std::vector<std::string> fParamGeneral;
0056     std::vector<std::string> fParamCSA;
0057     std::vector<std::string> fParamSLHA;
0058     std::vector<std::string> fParamPYUPDA;
0059     int fUnitSLHA;
0060     int fUnitPYUPDA;
0061 
0062     static Pythia6Service* fPythia6Owner;
0063   };
0064 
0065 }  // namespace gen
0066 
0067 #endif