CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/GeneratorInterface/MCatNLOInterface/plugins/MCatNLOSource.h

Go to the documentation of this file.
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/ExternalInputSource.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::ExternalInputSource,
00044                    public gen::Herwig6Instance {
00045 public:
00046   explicit MCatNLOSource(const edm::ParameterSet &params,
00047                       const edm::InputSourceDescription &desc);
00048   virtual ~MCatNLOSource();
00049   
00050 protected:
00051   virtual void endJob();
00052   virtual void beginRun(edm::Run &run);
00053   virtual bool produce(edm::Event &event);
00054   
00055   void nextEvent();
00056 
00057   virtual bool hwwarn(const std::string &fn, int code);
00058 
00060   std::string                   fileName;
00061   
00063   std::auto_ptr<std::ifstream>  inputFile;
00064   
00066   unsigned int                  skipEvents;
00067   
00069   unsigned int                  nEvents;
00070 
00071   int                           processCode;
00072   
00073   std::auto_ptr<std::ifstream>          reader;
00074   
00075   boost::shared_ptr<lhef::LHERunInfo>   runInfo;
00076   boost::shared_ptr<lhef::LHEEvent>     event;
00077 };
00078 
00079 #endif // GeneratorInterface_MCatNLOInterface_MCatNLOSource_h