]>
Commit | Line | Data |
---|---|---|
c865cb1d | 1 | // |
2 | // Base class to implement any computation within the RSN package. | |
61f275d1 | 3 | // It contains only an array of output objects which must derive |
c865cb1d | 4 | // from AliRsnOutput. |
61f275d1 | 5 | // Its core functions ar Init() and DoLoop() which must be |
c865cb1d | 6 | // overloaded by any class which inherits from this. |
7 | // | |
8 | ||
9 | #include <TList.h> | |
10 | #include <TEntryList.h> | |
11 | ||
12 | #include "AliLog.h" | |
13 | ||
14 | #include "AliRsnDaughterSelector.h" | |
15 | ||
16 | #include "AliRsnLoop.h" | |
17 | ||
18 | ClassImp(AliRsnLoop) | |
19 | ||
20 | //_____________________________________________________________________________ | |
21 | AliRsnLoop::AliRsnLoop(const char *name, Bool_t isMixed) : | |
22 | TNamed(name, ""), | |
23 | fIsMixed(isMixed), | |
24 | fEventCuts(0x0), | |
25 | fOutputs("AliRsnListOutput", 0) | |
26 | { | |
27 | // | |
28 | // Default constructor | |
29 | // | |
30 | } | |
31 | ||
32 | //_____________________________________________________________________________ | |
61f275d1 | 33 | AliRsnLoop::AliRsnLoop(const AliRsnLoop ©) : |
c865cb1d | 34 | TNamed(copy), |
35 | fIsMixed(copy.fIsMixed), | |
36 | fEventCuts(copy.fEventCuts), | |
37 | fOutputs(copy.fOutputs) | |
38 | { | |
39 | // | |
40 | // Default constructor | |
41 | // | |
42 | } | |
43 | ||
44 | //_____________________________________________________________________________ | |
61f275d1 | 45 | AliRsnLoop &AliRsnLoop::operator=(const AliRsnLoop ©) |
c865cb1d | 46 | { |
47 | // | |
48 | // Assignment operator | |
49 | // | |
61f275d1 | 50 | if (this == ©) |
51 | return *this; | |
52 | fIsMixed = copy.fIsMixed; | |
53 | fEventCuts = copy.fEventCuts; | |
54 | fOutputs = copy.fOutputs; | |
55 | return (*this); | |
c865cb1d | 56 | } |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | AliRsnLoop::~AliRsnLoop() | |
60 | { | |
61 | // | |
62 | // Destructor | |
63 | // | |
64 | } | |
65 | ||
66 | //_____________________________________________________________________________ | |
67 | void AliRsnLoop::AddOutput(TObject *object) | |
68 | { | |
69 | // | |
70 | // Adds an object to any of the collections. | |
71 | // The target depends on the object type. | |
72 | // Returns kFALSE if the addition failed. | |
73 | // | |
74 | ||
75 | //fOutputs.AddLast(out); | |
61f275d1 | 76 | AliRsnListOutput *out = (AliRsnListOutput *)object; |
c865cb1d | 77 | Int_t n = fOutputs.GetEntries(); |
78 | new (fOutputs[n]) AliRsnListOutput(*out); | |
79 | } | |
80 | ||
81 | //_____________________________________________________________________________ | |
61f275d1 | 82 | void AliRsnLoop::Print(Option_t *) const |
c865cb1d | 83 | { |
84 | // | |
85 | // Prints info about pair | |
86 | // | |
61f275d1 | 87 | |
c865cb1d | 88 | TObjArrayIter next(&fOutputs); |
89 | AliRsnListOutput *out = 0x0; | |
61f275d1 | 90 | |
91 | while ( (out = (AliRsnListOutput *)next()) ) { | |
c865cb1d | 92 | out->Print(); |
93 | } | |
94 | } | |
95 | ||
96 | //_____________________________________________________________________________ | |
97 | Bool_t AliRsnLoop::OkEvent(AliRsnEvent *rsn) | |
98 | { | |
99 | // | |
100 | // If event cuts are defined, check event against them | |
101 | // | |
102 | ||
61f275d1 | 103 | if (fEventCuts) |
c865cb1d | 104 | return fEventCuts->IsSelected(rsn); |
105 | else | |
106 | return kTRUE; | |
107 | } | |
108 | ||
109 | //_____________________________________________________________________________ | |
110 | Bool_t AliRsnLoop::Init(const char *prefix, TList *list) | |
111 | { | |
112 | // | |
113 | // Initialization function. | |
114 | // Loops on all outputs, and initialize each of them. | |
115 | // Returns kTRUE only if all initializations were successful. | |
116 | // | |
117 | ||
118 | TObjArrayIter next(&fOutputs); | |
119 | AliRsnListOutput *out; | |
120 | Bool_t globalOK = kTRUE; | |
61f275d1 | 121 | |
122 | while ( (out = (AliRsnListOutput *)next()) ) { | |
c865cb1d | 123 | globalOK = globalOK && out->Init(prefix, list); |
124 | } | |
61f275d1 | 125 | |
c865cb1d | 126 | AliInfo(Form("[%s] Object initialization: %s", GetName(), (globalOK ? "successful" : "failed"))); |
127 | return globalOK; | |
128 | } | |
129 | ||
130 | //_____________________________________________________________________________ | |
131 | Int_t AliRsnLoop::DoLoop | |
132 | (AliRsnEvent *, AliRsnDaughterSelector *, AliRsnEvent *, AliRsnDaughterSelector *) | |
133 | { | |
134 | // | |
135 | // Main loop. | |
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 | |
138 | // with them. | |
139 | // | |
140 | ||
141 | AliWarning("Implement this method in derived class"); | |
142 | return 0; | |
143 | } |