Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-04-13 22:49:55

0001 /**
0002 Marco A. Harrendorf
0003 **/
0004 
0005 #ifndef GeneratorInterface_Herwig7Interface_Herwig7HepMC3Interface_h
0006 #define GeneratorInterface_Herwig7Interface_Herwig7HepMC3Interface_h
0007 
0008 #include <memory>
0009 #include <string>
0010 
0011 #include <HepMC/GenEvent.h>
0012 #include <HepMC/PdfInfo.h>
0013 #include <HepMC/IO_BaseClass.h>
0014 
0015 #include <HepMC3/GenEvent.h>
0016 #include <HepMC3/GenParticle.h>
0017 #include <HepMC3/GenPdfInfo.h>
0018 
0019 #include <ThePEG/Repository/EventGenerator.h>
0020 #include <ThePEG/EventRecord/Event.h>
0021 #include <GeneratorInterface/Herwig7Interface/interface/HepMC3Helper.h>
0022 
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 
0025 #include "GeneratorInterface/Herwig7Interface/interface/RandomEngineGlue.h"
0026 #include "GeneratorInterface/Herwig7Interface/interface/HerwigUIProvider.h"
0027 
0028 namespace CLHEP {
0029   class HepRandomEngine;
0030 }
0031 
0032 class Herwig7HepMC3Interface {
0033 public:
0034   Herwig7HepMC3Interface(const edm::ParameterSet &params);
0035   ~Herwig7HepMC3Interface() noexcept;
0036 
0037   void setPEGRandomEngine(CLHEP::HepRandomEngine *);
0038 
0039   ThePEG::EGPtr eg_;
0040 
0041 protected:
0042   void initRepository(const edm::ParameterSet &params);
0043   bool initGenerator();
0044   void flushRandomNumberGenerator();
0045 
0046   static std::unique_ptr<HepMC3::GenEvent> convert(const ThePEG::EventPtr &event);
0047 
0048   static double pthat(const ThePEG::EventPtr &event);
0049 
0050   //std::unique_ptr<HepMC::IO_BaseClass> iobc_;
0051 
0052   // HerwigUi contains settings piped to Herwig7
0053   std::shared_ptr<Herwig::HerwigUIProvider> HwUI_;
0054 
0055   /**
0056         * Function calls Herwig event generator via API
0057     *
0058     * According to the run mode different steps of event generation are done
0059     **/
0060   void callHerwigGenerator();
0061 
0062   // The Inputfile ist created according to the parameter set
0063   void createInputFile(const edm::ParameterSet &params);
0064 
0065 private:
0066   std::shared_ptr<ThePEG::RandomEngineGlue::Proxy> randomEngineGlueProxy_;
0067 
0068   const std::string dataLocation_;
0069   const std::string generator_;
0070   const std::string run_;
0071   // File name containing Herwig input config
0072   std::string dumpConfig_;
0073   const unsigned int skipEvents_;
0074   CLHEP::HepRandomEngine *randomEngine;
0075 };
0076 
0077 #endif  // GeneratorInterface_Herwig7Interface_Herwig7HepMC3Interface_h