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