psana/include/PSAnaApp.h

Go to the documentation of this file.
00001 #ifndef PSANA_PSANAAPP_H
00002 #define PSANA_PSANAAPP_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //     $Id: PSAnaApp.h 8825 2014-08-28 01:16:10Z davidsch@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //     Class PSAnaApp.
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------
00014 // C/C++ Headers --
00015 //-----------------
00016 #include <string>
00017 #include <vector>
00018 #include <stack>
00019 #include <map>
00020 #include <boost/shared_ptr.hpp>
00021 
00022 //----------------------
00023 // Base Class Headers --
00024 //----------------------
00025 #include "AppUtils/AppBase.h"
00026 
00027 //-------------------------------
00028 // Collaborating Class Headers --
00029 //-------------------------------
00030 #include "AppUtils/AppCmdArgList.h"
00031 #include "AppUtils/AppCmdOpt.h"
00032 #include "AppUtils/AppCmdOptList.h"
00033 #include "psana/Module.h"
00034 #include "PSEnv/Env.h"
00035 #include "PSEvt/Event.h"
00036 
00037 //------------------------------------
00038 // Collaborating Class Declarations --
00039 //------------------------------------
00040 
00041 //             ---------------------
00042 //             -- Class Interface --
00043 //             ---------------------
00044 
00045 namespace psana {
00046 
00047 /// @addtogroup psana
00048 
00049 /**
00050  *  @ingroup psana
00051  *
00052  *  @brief Application calss for psana.
00053  *
00054  *  This class is a whole application, you can run psana by making an
00055  *  instance of this class and passing arguments to its run() method.
00056  *
00057  *  This software was developed for the LCLS project.  If you use all or 
00058  *  part of it, please give an appropriate acknowledgment.
00059  *
00060  *  @version $Id: PSAnaApp.h 8825 2014-08-28 01:16:10Z davidsch@SLAC.STANFORD.EDU $
00061  *
00062  *  @author Andy Salnikov
00063  */
00064 
00065 class PSAnaApp : public AppUtils::AppBase {
00066 public:
00067 
00068   // Constructor
00069   explicit PSAnaApp(const std::string& appName = "psana") ;
00070 
00071   // destructor
00072   virtual ~PSAnaApp () ;
00073 
00074   /**
00075    *  Run the application, accepts regular argc and argv.
00076    */
00077   int run(int argc, char** argv) { return AppUtils::AppBase::run(argc, argv); }
00078 
00079   /**
00080    *  Run the application, accepts arguments as vector of strings which
00081    *  should contain the same values as regular argv (first element must be
00082    *  application name).
00083    */
00084   int run(const std::vector<std::string>& argv);
00085   
00086 protected :
00087 
00088   /**
00089    *  Method called before runApp, can be overriden in subclasses.
00090    *  Usually if you override it, call base class method too.
00091    */
00092   virtual int preRunApp () ;
00093 
00094   /**
00095    *  Main method which runs the whole application
00096    */
00097   virtual int runApp () ;
00098 
00099   /**
00100    * helper function for runApp which sets config file and options for framework
00101    */
00102   void setConfigFileAndOptions(std::string &cfgFile, std::map<std::string, std::string> &options);
00103 
00104   std::vector<std::string> inputDataSets() const;
00105 private:
00106 
00107   // more command line options and arguments
00108   AppUtils::AppCmdOpt<std::string> m_calibDirOpt ;
00109   AppUtils::AppCmdOpt<std::string> m_configOpt ;
00110   AppUtils::AppCmdOpt<std::string> m_expNameOpt ;
00111   AppUtils::AppCmdOpt<std::string> m_jobNameOpt ;
00112   AppUtils::AppCmdOptList<std::string> m_modulesOpt;
00113   AppUtils::AppCmdOpt<unsigned> m_maxEventsOpt ;
00114   AppUtils::AppCmdOpt<unsigned> m_skipEventsOpt ;
00115   AppUtils::AppCmdOpt<unsigned> m_parallelOpt;
00116   AppUtils::AppCmdOptList<std::string> m_optionsOpt;
00117   AppUtils::AppCmdArgList<std::string>  m_datasets;
00118 };
00119 
00120 } // namespace psana
00121 
00122 #endif // PSANA_PSANAAPP_H

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7