Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:06:53

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