00001 #ifndef GeneratorInterface_MCatNLOInterface_MCatNLOSource_h 00002 #define GeneratorInterface_MCatNLOInterface_MCatNLOSource_h 00003 00004 #include <memory> 00005 00006 #include <boost/shared_ptr.hpp> 00007 00008 #include "FWCore/Framework/interface/Event.h" 00009 #include "FWCore/Framework/interface/Run.h" 00010 #include "FWCore/Sources/interface/ProducerSourceFromFiles.h" 00011 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00012 00013 #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h" 00014 00015 #include "GeneratorInterface/Herwig6Interface/interface/Herwig6Instance.h" 00016 00017 #include <fstream> 00018 00019 00020 // Common Block for HERWIG parameters set by UPINIT 00021 extern "C" { 00022 extern struct MCPARS_ { 00023 double emmin; 00024 double emmax; 00025 double gammax; 00026 double rmass[1000]; 00027 double gamw; 00028 double gamz; 00029 int emmins; 00030 int emmaxs; 00031 int gammaxs; 00032 int rmasss[1000]; 00033 int gamws; 00034 int gamzs; 00035 } mcpars_; 00036 } 00037 00038 namespace lhef { 00039 class LHERunInfo; 00040 class LHEEvent; 00041 } 00042 00043 class MCatNLOSource : public edm::ProducerSourceFromFiles, 00044 public gen::Herwig6Instance { 00045 public: 00046 explicit MCatNLOSource(const edm::ParameterSet ¶ms, 00047 const edm::InputSourceDescription &desc); 00048 virtual ~MCatNLOSource(); 00049 00050 private: 00051 virtual void endJob(); 00052 virtual void beginRun(edm::Run &run); 00053 virtual bool setRunAndEventInfo(edm::EventID&, edm::TimeValue_t&); 00054 virtual void produce(edm::Event &event); 00055 00056 void nextEvent(); 00057 00058 virtual bool hwwarn(const std::string &fn, int code); 00059 00061 std::string fileName; 00062 00064 std::unique_ptr<std::ifstream> inputFile; 00065 00067 unsigned int skipEvents; 00068 00070 unsigned int nEvents; 00071 00072 int ihpro; 00073 00074 int processCode; 00075 00076 std::unique_ptr<std::ifstream> reader; 00077 00078 boost::shared_ptr<lhef::LHERunInfo> runInfo; 00079 boost::shared_ptr<lhef::LHEEvent> event; 00080 }; 00081 00082 #endif // GeneratorInterface_MCatNLOInterface_MCatNLOSource_h