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& copy) :
35 fIsMixed(copy.fIsMixed),
36 fEventCuts(copy.fEventCuts),
37 fOutputs(copy.fOutputs)
40 // Default constructor
44 //_____________________________________________________________________________
45 AliRsnLoop& AliRsnLoop::operator=(const AliRsnLoop& copy)
48 // Assignment operator
51 fIsMixed = copy.fIsMixed;
52 fEventCuts = copy.fEventCuts;
53 fOutputs = copy.fOutputs;
57 //_____________________________________________________________________________
58 AliRsnLoop::~AliRsnLoop()
65 //_____________________________________________________________________________
66 void AliRsnLoop::AddOutput(TObject *object)
69 // Adds an object to any of the collections.
70 // The target depends on the object type.
71 // Returns kFALSE if the addition failed.
74 //fOutputs.AddLast(out);
75 AliRsnListOutput *out = (AliRsnListOutput*)object;
76 Int_t n = fOutputs.GetEntries();
77 new (fOutputs[n]) AliRsnListOutput(*out);
80 //_____________________________________________________________________________
81 void AliRsnLoop::Print(Option_t*) const
84 // Prints info about pair
87 TObjArrayIter next(&fOutputs);
88 AliRsnListOutput *out = 0x0;
90 while ( (out = (AliRsnListOutput*)next()) ) {
95 //_____________________________________________________________________________
96 Bool_t AliRsnLoop::OkEvent(AliRsnEvent *rsn)
99 // If event cuts are defined, check event against them
103 return fEventCuts->IsSelected(rsn);
108 //_____________________________________________________________________________
109 Bool_t AliRsnLoop::Init(const char *prefix, TList *list)
112 // Initialization function.
113 // Loops on all outputs, and initialize each of them.
114 // Returns kTRUE only if all initializations were successful.
117 TObjArrayIter next(&fOutputs);
118 AliRsnListOutput *out;
119 Bool_t globalOK = kTRUE;
121 while ( (out = (AliRsnListOutput*)next()) ) {
122 globalOK = globalOK && out->Init(prefix, list);
125 AliInfo(Form("[%s] Object initialization: %s", GetName(), (globalOK ? "successful" : "failed")));
129 //_____________________________________________________________________________
130 Int_t AliRsnLoop::DoLoop
131 (AliRsnEvent *, AliRsnDaughterSelector *, AliRsnEvent *, AliRsnDaughterSelector *)
135 // Performs all the computations, looping on the passed event(s) and using the lists
136 // of selected daughters which are provided, for allowing the user to choose what to do
140 AliWarning("Implement this method in derived class");