rivet is hosted by Hepforge, IPPP Durham
Run.hh
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_Run_HH
00003 #define RIVET_Run_HH
00004 
00005 #include "Rivet/Tools/RivetBoost.hh"
00006 #include "Rivet/Tools/RivetHepMC.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   // Forward declaration
00012   class AnalysisHandler;
00013 
00014 
00015   /// @brief Interface to handle a run of events read from a HepMC stream or file.
00016   class Run {
00017   public:
00018 
00019     /// @name Standard constructors and destructors. */
00020     //@{
00021     /// The standard constructor.
00022     Run(AnalysisHandler& ah);
00023 
00024     /// The destructor
00025     ~Run();
00026     //@}
00027 
00028 
00029   public:
00030 
00031     /// @name Set run properties
00032     //@{
00033 
00034     /// Get the cross-section for this run.
00035     Run& setCrossSection(const double xs);
00036 
00037     /// Get the current cross-section from the analysis handler in pb.
00038     double crossSection() const;
00039 
00040     /// Declare whether to list available analyses
00041     Run& setListAnalyses(const bool dolist);
00042 
00043     //@}
00044 
00045 
00046     /// @name File processing stages
00047     //@{
00048 
00049     /// Set up HepMC file readers (using the appropriate file weight for the first file)
00050     bool init(const std::string& evtfile, double weight=1.0);
00051 
00052     /// Open a HepMC GenEvent file (using the appropriate file weight for the first file)
00053     bool openFile(const std::string& evtfile, double weight=1.0);
00054 
00055     /// Read the next HepMC event
00056     bool readEvent();
00057 
00058     /// Handle next event
00059     bool processEvent();
00060 
00061     /// Close up HepMC I/O
00062     bool finalize();
00063 
00064     //@}
00065 
00066 
00067   private:
00068 
00069     /// AnalysisHandler object
00070     AnalysisHandler& _ah;
00071 
00072     /// @name Run variables obtained from events or command line
00073     //@{
00074 
00075     /// @brief An extra event weight scaling per event file.
00076     /// Useful for e.g. AlpGen n-parton event file combination.
00077     double _fileweight;
00078 
00079     /// Cross-section from command line.
00080     double _xs;
00081 
00082     //@}
00083 
00084 
00085     /// Flag to show list of analyses
00086     bool _listAnalyses;
00087 
00088 
00089     /// @name HepMC I/O members
00090     //@{
00091 
00092     /// Current event
00093     shared_ptr<GenEvent> _evt;
00094 
00095     /// Output stream for HepMC writer
00096     shared_ptr<std::istream> _istr;
00097 
00098     /// HepMC I/O writer
00099     shared_ptr<HepMC::IO_GenEvent> _io;
00100 
00101     //@}
00102 
00103   };
00104 
00105 
00106 }
00107 
00108 #endif