2 // Base class to implement any computation within the RSN package.
3 // It contains only an array of output objects which must derive
5 // Its core functions ar Init() and DoLoop() which must be
6 // overloaded by any class which inherits from this.
10 #include <TEntryList.h>
14 #include "AliRsnDaughterSelector.h"
16 #include "AliRsnLoop.h"
20 //_____________________________________________________________________________
21 AliRsnLoop::AliRsnLoop(const char *name, Bool_t isMixed) :
25 fOutputs("AliRsnListOutput", 0)
28 // Default constructor
32 //_____________________________________________________________________________
33 AliRsnLoop::AliRsnLoop(const AliRsnLoop ©) :
35 fIsMixed(copy.fIsMixed),
36 fEventCuts(copy.fEventCuts),
37 fOutputs(copy.fOutputs)
40 // Default constructor
44 //_____________________________________________________________________________
45 AliRsnLoop &AliRsnLoop::operator=(const AliRsnLoop ©)
48 // Assignment operator
52 fIsMixed = copy.fIsMixed;
53 fEventCuts = copy.fEventCuts;
54 fOutputs = copy.fOutputs;
58 //_____________________________________________________________________________
59 AliRsnLoop::~AliRsnLoop()
66 //_____________________________________________________________________________
67 void AliRsnLoop::AddOutput(TObject *object)
70 // Adds an object to any of the collections.
71 // The target depends on the object type.
72 // Returns kFALSE if the addition failed.
75 //fOutputs.AddLast(out);
76 AliRsnListOutput *out = (AliRsnListOutput *)object;
77 Int_t n = fOutputs.GetEntries();
78 new (fOutputs[n]) AliRsnListOutput(*out);
81 //_____________________________________________________________________________
82 void AliRsnLoop::Print(Option_t *) const
85 // Prints info about pair
88 TObjArrayIter next(&fOutputs);
89 AliRsnListOutput *out = 0x0;
91 while ( (out = (AliRsnListOutput *)next()) ) {
96 //_____________________________________________________________________________
97 Bool_t AliRsnLoop::OkEvent(AliRsnEvent *rsn)
100 // If event cuts are defined, check event against them
104 return fEventCuts->IsSelected(rsn);
109 //_____________________________________________________________________________
110 Bool_t AliRsnLoop::Init(const char *prefix, TList *list)
113 // Initialization function.
114 // Loops on all outputs, and initialize each of them.
115 // Returns kTRUE only if all initializations were successful.
118 TObjArrayIter next(&fOutputs);
119 AliRsnListOutput *out;
120 Bool_t globalOK = kTRUE;
122 while ( (out = (AliRsnListOutput *)next()) ) {
123 globalOK = globalOK && out->Init(prefix, list);
126 AliInfo(Form("[%s] Object initialization: %s", GetName(), (globalOK ? "successful" : "failed")));
130 //_____________________________________________________________________________
131 Int_t AliRsnLoop::DoLoop
132 (AliRsnEvent *, AliRsnDaughterSelector *, AliRsnEvent *, AliRsnDaughterSelector *)
136 // Performs all the computations, looping on the passed event(s) and using the lists
137 // of selected daughters which are provided, for allowing the user to choose what to do
141 AliWarning("Implement this method in derived class");