/** \file Declaration of HybridEvent \author Stefano Argir� Antoine Letessier-Selvon */ #ifndef __AugerEvent_h_ #define __AugerEvent_h_ #include "cdas_config.h" #include #include #ifndef NOFD #include #endif class IoSdEvent; #ifdef HAVE_IOMD namespace md { class Event; } #endif #ifdef HAVE_IORD // #include class AERAevent; #endif typedef unsigned long long AugerEventId; // should be EventId, but we have a name conflict /** * \class AugerEvent * * \brief The Auger Event * Data structure including one SD Event (IoSd) and 1..n FD Event * (TEyeEvent) * * \todo Add boundary checks */ class AugerEvent : public TObject { public: enum TDataType { eReal, eCLF, eUnknown }; AugerEvent(); virtual ~ AugerEvent(); AugerEvent(const AugerEvent & theAugerEvent); AugerEvent& operator=(const AugerEvent & theAugerEvent); /// return the id of the event /** The id is assigned by the merger as an incremental number * * more documentation here */ AugerEventId Id() const { return EventId; }; /// return true if the event has both FD and SD bool IsHybrid() const { #ifdef NOFD return false; #else return HasSd() && Eyes.size(); #endif }; /// return true if the SD event exists bool HasSd() const { return (SEvent != 0); }; /// return the SD event IoSdEvent & Sd(); const IoSdEvent& Sd() const; #ifdef HAVE_IOMD /// return true if the event has SD, MD and FD bool IsXHybrid() const { #ifdef NOFD return false; #else return (IsXd() && Eyes.size()); #endif }; /// return true if the event has SD and MD bool IsXd() const { return (HasSd() && HasMd()); }; /// return true if the MD event exists bool HasMd() const { return (MEvent != 0); }; /// return the MD event md::Event & Md(); const md::Event& Md() const; void PushEvent(const md::Event & mdevent); #else bool HasMd() const { return false; } #endif #ifdef HAVE_IORD /// return the MD event void PushREvent( const AERAevent & AEVent); AERAevent& GiveREvent(); const AERAevent& GiveREvent() const; bool HasRd() const { return (REvent != 0); }; /// return true if the event has SD, RD and FD bool IsXRHybrid() const { #ifdef NOFD return false; #else return (IsXRd() && Eyes.size()); #endif }; /// return true if the event has SD and RD bool IsXRd() const { return (HasSd() && HasRd()); }; #else bool HasRd() const { return false; } #endif #ifndef NOFD /// The container of TEyeEvents (FD events) typedef std::vector < TEyeEvent > EyesContainer; /// A read and write iterator over the eye events typedef EyesContainer::iterator EyeIterator; typedef EyesContainer::const_iterator ConstEyeIterator; /// return the first available TEyeEvent EyeIterator EyesBegin() { return Eyes.begin();}; ConstEyeIterator EyesBegin() const { return Eyes.begin(); } /// return one past the last available TEyeEvent EyeIterator EyesEnd() {return Eyes.end();}; ConstEyeIterator EyesEnd() const { return Eyes.end(); } /// return the TEyeEvent at position @param pos in the list TEyeEvent & Eye(unsigned int pos) {return Eyes[pos];}; const TEyeEvent& Eye(unsigned int pos) const { return Eyes[pos]; } /// Add the FD event to the hybrid void PushEvent(const TEyeEvent & eyeevent) {Eyes.push_back(eyeevent);} #endif /// Add the SD event to the hybrid void PushEvent(const IoSdEvent & sdevent); public: AugerEventId EventId; //! should not go to file. Id is read from the key IoSdEvent *SEvent; #ifdef HAVE_IOMD md::Event * MEvent; #endif #ifdef HAVE_IORD AERAevent * REvent; #endif #ifndef NOFD EyesContainer Eyes; #endif TDataType Type; //! does not go to file (carried by the AugerKey) #if !defined(NOFD) & !defined(HAVE_IOMD) & !defined(HAVE_IORD) ClassDef(AugerEvent, 4); #elif !defined(NOFD) & defined(HAVE_IOMD) & defined(HAVE_IORD) ClassDef(AugerEvent, 5); #else #error Unsupported combination of detector componentes #endif }; // AugerEvent #endif // __AugerEvent_h_