Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:10:14

0001 #ifndef SHERPA_Tools_Userhook_Base_H
0002 #define SHERPA_Tools_Userhook_Base_H
0003 
0004 #include "ATOOLS/Phys/Blob_List.H"
0005 #include "ATOOLS/Org/Getter_Function.H"
0006 #include "ATOOLS/Org/Return_Value.H"
0007 #include <string>
0008 
0009 namespace SHERPA {
0010 
0011   class Sherpa;
0012 
0013   struct Userhook_Arguments {
0014     Sherpa* p_sherpa;
0015     Userhook_Arguments(Sherpa* const sherpa):
0016       p_sherpa(sherpa) {}
0017   };
0018 
0019   class Userhook_Base {
0020   protected:
0021 
0022     std::string m_name;
0023 
0024   public:
0025 
0026     typedef ATOOLS::Getter_Function
0027     <Userhook_Base,Userhook_Arguments> Getter_Function;
0028 
0029   public:
0030 
0031     /**
0032      * Constructor
0033      *
0034      * Any classes deriving from Userhook_Base should use a constructor like:
0035      *   Userhook_Example(const Userhook_Arguments args) :
0036      *     Userhook_Base("Example")
0037      *     { ... }
0038      */
0039     Userhook_Base(const std::string &name);
0040 
0041     /**
0042      * Destructor
0043      */
0044     virtual ~Userhook_Base();
0045 
0046     /**
0047      * This is where the action happens. Allowed return values are:
0048      * - Return_Value::Nothing if the event was not changed.
0049      * - Return_Value::Success if the event was successfully changed.
0050      * - Return_Value::New_Event if the event is to be discarded (and NTrials increased)
0051      * - Return_Value::Error if an error happened
0052      */
0053     virtual ATOOLS::Return_Value::code Run(ATOOLS::Blob_List* blobs) = 0;
0054 
0055     /**
0056      * Optional function which runs at the end of the run.
0057      */
0058     virtual void Finish();
0059 
0060     /**
0061      * Optional function which runs when an event is being retried.
0062      */
0063     virtual void CleanUp();
0064 
0065     inline const std::string Name() { return m_name; }
0066   };
0067 
0068   typedef std::vector<Userhook_Base*> Userhook_Vector;
0069 
0070 }
0071 
0072 #endif