Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:15:55

0001 /**
0002  *  @file   PandoraSDK/include/Objects/EventContext.h
0003  * 
0004  *  @brief  Header file of the EventContext class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef EVENT_H
0009 #define EVENT_H 1
0010 
0011 #include "Pandora/StatusCodes.h"
0012 
0013 #include <map>
0014 
0015 namespace pandora
0016 {
0017 
0018 class Pandora;
0019 class TiXmlHandle;
0020 
0021 //------------------------------------------------------------------------------------------------------------------------------------------
0022 
0023 class EventContextObject;
0024 
0025 /**
0026  *  @brief  The EventContext class provides a container for event-level quantities that should be accessible by algorithms.
0027  */
0028 class EventContext
0029 {
0030 public:
0031     /**
0032      *  @brief  Constructor
0033      * 
0034      *  @param  pPandora address of the associated pandora object
0035      */
0036     EventContext(const Pandora *const pPandora);
0037 
0038     /**
0039      *  @brief  Copy constructor
0040      * 
0041      *  @param  event the event object to be copied
0042      */
0043     EventContext(const EventContext &event);
0044 
0045     /**
0046      *  @brief  Destructor
0047      */
0048     virtual ~EventContext();
0049 
0050     /**
0051      *  @brief  Adds an EventContextObject object to this event.
0052      *
0053      *  @param  key the key to associated with the event object
0054      *  @param  pObject the object to be stored
0055      */
0056     void AddEventContextObject(const std::string &key, const EventContextObject *const pObject);
0057 
0058     /**
0059      *  @brief  Remove an EventContextObject object from this event context.
0060      *
0061      *  @param  key the key of the event context object to be removed
0062      */
0063     void RemoveEventContextObject(const std::string &key);
0064 
0065     /**
0066     *  @brief  Retrieves the EventContextObject object associated with a key.
0067     *
0068     *  @param  key the key associated with the desired event object
0069     *  @return the event object associated with the specified key
0070     */
0071    const EventContextObject *GetEventContextObject(const std::string &key) const;
0072    
0073     /**
0074     *  @brief  Checks if an EventContextObject object is associated with a key.
0075     *
0076     *  @param  key the key associated with the desired event object
0077     *  @return true if there is an event object associated with the specified key
0078     */
0079    bool DoesKeyExist(const std::string &key) const;
0080 
0081    // Needs persistency functions
0082 
0083 private:
0084     /**
0085      *  @brief  Resets all event level properties
0086      *
0087      *  @return Whether or not the reset was successful
0088      */
0089     StatusCode ResetForNextEvent();
0090 
0091     typedef std::map<std::string, const EventContextObject *> EventContextObjectMap;
0092 
0093     EventContextObjectMap m_eventObjectMap; ///< A map to all event objects
0094     const Pandora *const m_pPandora; ///< The associated pandora object
0095 
0096     friend class PandoraImpl;
0097 };
0098 
0099 //------------------------------------------------------------------------------------------------------------------------------------------
0100 
0101 /**
0102  *  @brief  The EventContextObject class provides a pure virtual class for custom information to be added to an EventContext object.
0103  */
0104 class EventContextObject
0105 {
0106 public:
0107     /**
0108      *  @brief Default constructor
0109      */
0110     EventContextObject() = default;
0111 
0112     /**
0113      *  @brief  Destructor
0114      */
0115     virtual ~EventContextObject() = default;
0116 };
0117 
0118 } // namespace pandora
0119 
0120 #endif // #ifndef EVENT_H