Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /**
0002 Marco A. Harrendorf
0003 **/
0004 #ifndef SRC_HERWIG_UIProvider_H
0005 #define SRC_HERWIG_UIProvider_H
0006 
0007 #include <Herwig/API/HerwigUI.h>
0008 #include <iostream>
0009 
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 
0012 namespace Herwig {
0013 
0014   /**
0015  * HerwigUIProvider is an implementation of the HerwigUI interface getting its input from CMSSW configs.
0016  * 
0017  */
0018   class HerwigUIProvider : public HerwigUI {
0019   public:
0020     /// Constructor from the arguments provided by CMSSW
0021     HerwigUIProvider(const edm::ParameterSet& pset, std::string inputFileName, RunMode::Mode);
0022 
0023     /// Destructor to leave a clean ThePEG::Repository behind
0024     ~HerwigUIProvider() override;
0025 
0026     /// Requested Herwig run mode
0027     RunMode::Mode runMode() const override { return runMode_; }
0028     void setSeed(long seed) { seed_ = seed; }
0029 
0030     /// Try to resume execution from an earlier interrupted run.
0031     bool resume() const override { return resume_; }
0032 
0033     /// Require verbose progress markers
0034     bool tics() const override { return tics_; }
0035 
0036     /// A user-defined tag to append to the run name.
0037     std::string tag() const override { return tag_; }
0038 
0039     /// Name of the file to be read
0040     std::string inputfile() const override { return inputfile_; }
0041 
0042     /// Repository name to operate on
0043     std::string repository() const override { return repository_; }
0044 
0045     /// Name of the setup file to be read, to modify the repository
0046     std::string setupfile() const override { return setupfile_; }
0047 
0048     std::string integrationList() const override { return integrationList_; }
0049 
0050     const std::vector<std::string>& prependReadDirectories() const override { return prependReadDirectories_; }
0051 
0052     const std::vector<std::string>& appendReadDirectories() const override { return appendReadDirectories_; }
0053 
0054     long N() const override { return nEvents_; }
0055     int seed() const override { return seed_; }
0056     int jobs() const override { return jobs_; }
0057     unsigned int jobSize() const override { return jobsize_; }
0058     unsigned int maxJobs() const override { return maxjobs_; }
0059 
0060     void quitWithHelp() const override;
0061 
0062     void quit() const override;
0063 
0064     /// Return the standard out stream to be used
0065     std::ostream& outStream() const override { return std::cout; }
0066 
0067     /// Return the standard err stream to be used
0068     std::ostream& errStream() const override { return std::cerr; }
0069 
0070     /// Return the standard in stream to be used
0071     std::istream& inStream() const override { return std::cin; }
0072 
0073     /**
0074   *  Change run mode of Herwig
0075   *  Additionally pass the name of the new input file
0076   *
0077   *  Function sets jobsize_ and maxjobs_ accordingly to the run modes.
0078   **/
0079     void setRunMode(RunMode::Mode runMode, const edm::ParameterSet& pset, std::string inputFile = "");
0080 
0081   private:
0082     RunMode::Mode runMode_;
0083 
0084     bool resume_;
0085     bool tics_;
0086     std::string tag_;
0087 
0088     std::string inputfile_;
0089     std::string repository_;
0090     std::string setupfile_;
0091 
0092     std::string integrationList_;
0093 
0094     std::vector<std::string> prependReadDirectories_;
0095     std::vector<std::string> appendReadDirectories_;
0096 
0097     long nEvents_;
0098     int seed_;
0099     int jobs_;
0100     unsigned int jobsize_;
0101     unsigned int maxjobs_;
0102   };
0103 
0104 }  // namespace Herwig
0105 
0106 #endif