]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/AliHLTMUONEvent.h
Adding FindObject methods to the event container class.
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONEvent.h
1 #ifndef ALIHLTMUONEVENT_H
2 #define ALIHLTMUONEVENT_H
3 /* This file is property of and copyright by the ALICE HLT Project        *
4  * ALICE Experiment at CERN, All rights reserved.                         *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id: $ */
8
9 ///
10 /// @file   AliHLTMUONRootifierComponent.h
11 /// @author Artur Szostak <artursz@iafrica.com>
12 /// @date   9 May 2008
13 /// @brief  Declaration of class for storing ROOTified data objects for one event.
14 ///
15
16 #include "TObjArray.h"
17 #include "AliHLTMUONDataTypes.h"
18
19 class AliHLTMUONDecision;
20
21
22 class AliHLTMUONEvent : public TObject
23 {
24 public:
25
26         /// AliHLTMUONEvent class contructor.
27         /// \param eventId  The event identifier number for this event. Set to -1 by default.
28         AliHLTMUONEvent(AliHLTEventID_t eventId = AliHLTEventID_t(-1))
29           : fEventId(eventId), fArray()
30         {
31                 fArray.SetOwner(kTRUE);
32         }
33         
34         /// Default destructor.
35         virtual ~AliHLTMUONEvent() {}
36         
37         /// Returns the corresponding event ID for the data objects.
38         AliHLTEventID_t EventID() const { return fEventId; }
39         
40         /// Returns the array of data objects for this event.
41         const TObjArray& Array() const { return fArray; }
42         
43         /// Returns the array of data objects for this event.
44         const TObjArray& DataObjects() const { return fArray; }
45         
46         /// Finds the decision object in the array of dHLT objects.
47         const AliHLTMUONDecision* FindDecision() const;
48         
49         /**
50          * Overloaded to find the object given by name in the array of event objects.
51          * \param name  The name of the object to find. This will be the class
52          *      name if the object in the array does not overload the GetName
53          *      method.
54          * \returns  The pointer to the found object or NULL if none was found.
55          */
56         virtual TObject* FindObject(const char* name) const
57         {
58                 return fArray.FindObject(name);
59         }
60         
61         /**
62          * Overloaded to find the object for which obj->IsEqual() is true in
63          * the array of event objects.
64          * \param obj  The object to compare to.
65          * \returns  The pointer to the found object or NULL if none was found.
66          */
67         virtual TObject* FindObject(const TObject* obj) const
68         {
69                 return fArray.FindObject(obj);
70         }
71         
72         /// Adds an object to the event.
73         /// \note This method takes ownership of the object.
74         void Add(TObject* obj) { fArray.Add(obj); }
75         
76         /// Inherited method for printing information about all objects in the event.
77         virtual void Print(Option_t* option = NULL) const;
78
79 private:
80
81         AliHLTEventID_t fEventId;  ///< The event ID.
82         TObjArray fArray;          ///< Array of event objects.
83         
84         ClassDef(AliHLTMUONEvent, 2); // Container class for dHLT event results.
85 };
86
87 #endif // ALIHLTMUONEVENT_H