1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
6 * Artur Szostak <artursz@iafrica.com> *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
20 /// @file AliHLTMUONEvent.cxx
21 /// @author Artur Szostak <artursz@iafrica.com>
23 /// @brief Implementation of the AliHLTMUONEvent class.
25 /// The class is used to store all ROOTified data objects from the dHLT chain
26 /// for a single event together.
28 #include "AliHLTMUONEvent.h"
29 #include "AliHLTMUONDecision.h"
33 ClassImp(AliHLTMUONEvent);
36 AliHLTMUONEvent::AliHLTMUONEvent(const AliHLTMUONEvent& event) :
38 fEventId(event.fEventId),
41 /// Copy constructor performs a deep copy of the object.
43 fEventId = event.fEventId;
44 fArray.SetOwner(kTRUE);
45 TIter next(&event.fArray);
47 while ( (obj = next()) != NULL )
49 fArray.Add(obj->Clone());
54 AliHLTMUONEvent& AliHLTMUONEvent::operator = (const AliHLTMUONEvent& event)
56 /// The assignment operator performs a deep copy of the object.
58 if (this == &event) return *this;
59 TObject::operator = (event);
60 fEventId = event.fEventId;
62 TIter next(&event.fArray);
64 while ( (obj = next()) != NULL )
66 fArray.Add(obj->Clone());
72 const AliHLTMUONDecision* AliHLTMUONEvent::FindDecision() const
74 /// Finds the decision object in the event from the list of dHLT objects.
75 /// There should only be one such object in the event. If not, then only
76 /// the first object found is returned. You will need to manually search
77 /// for the other objects.
78 /// \returns The AliHLTMUONDecision object in the event or NULL if none exists.
80 for (Int_t i = 0; i < fArray.GetEntriesFast(); i++)
82 if (fArray[i]->IsA() == AliHLTMUONDecision::Class())
84 return static_cast<const AliHLTMUONDecision*>(fArray[i]);
92 void AliHLTMUONEvent::Print(Option_t* option) const
95 /// Inherited from TObject. Prints the contents of the event objects in fArray.
96 /// \param option This is an option string that is just passed on to individual
97 /// objects in the event's fArray list of objects.
100 std::cout << "################## EVENT: " << fEventId << " ##################" << std::endl;
101 for (Int_t i = 0; i < fArray.GetEntriesFast(); i++)
102 if (fArray[i] != NULL) fArray[i]->Print(option);
106 void AliHLTMUONEvent::Clear(Option_t* option)
108 /// Clears the internal array of event objects.
110 fEventId = AliHLTEventID_t(-1);
111 fArray.Clear(option);
115 void AliHLTMUONEvent::Copy(TObject& object) const
117 /// Deep copy this object to the target object.
118 /// \param object The target object to copy to.
120 if (object.IsA() != this->IsA())
122 AliError(Form("Cannot copy an object of type %s to a type of %s.",
123 this->ClassName(), object.ClassName()
128 TObject::Copy(object);
129 AliHLTMUONEvent& event = static_cast<AliHLTMUONEvent&>(object);
130 event.fEventId = fEventId;
131 event.fArray.Clear();
134 while ( (obj = next()) != NULL )
136 event.fArray.Add(obj->Clone());