]>
Commit | Line | Data |
---|---|---|
1 | // | |
2 | // Class AliRsnAnalysisManager | |
3 | // | |
4 | // This is the uppermost level of analysis objects collection. | |
5 | // It contains a list of pair managers, which all will process | |
6 | // a pool of events passed to this object, and fill their histograms. | |
7 | // | |
8 | // The utility of this object is to define a unique implementation | |
9 | // of the whole processing, which can then be included in the different | |
10 | // designs of AnalysisTask provided for SE and ME analysis. | |
11 | // | |
12 | // The base architecture is still AliRsnVManager, but in this case | |
13 | // all the objects in the list will be AliRsnPairManager's. | |
14 | // | |
15 | // author : M. Vala [martin.vala@cern.ch] | |
16 | // revised by : A. Pulvirenti [alberto.pulvirenti@ct.infn.it] | |
17 | // | |
18 | ||
19 | #include <Riostream.h> | |
20 | #include <TROOT.h> | |
21 | ||
22 | #include "AliLog.h" | |
23 | #include "AliStack.h" | |
24 | #include "AliVEvent.h" | |
25 | #include "AliMCEvent.h" | |
26 | #include "AliRsnEvent.h" | |
27 | #include "AliRsnPair.h" | |
28 | #include "AliRsnAnalysisManager.h" | |
29 | ||
30 | ||
31 | ClassImp(AliRsnAnalysisManager) | |
32 | ||
33 | //_____________________________________________________________________________ | |
34 | AliRsnAnalysisManager::AliRsnAnalysisManager(const char*name) : | |
35 | TNamed(name, ""), | |
36 | fPairs(0) | |
37 | { | |
38 | // | |
39 | // Default constructor | |
40 | // | |
41 | ||
42 | AliDebug(AliLog::kDebug+2, "<-"); | |
43 | AliDebug(AliLog::kDebug+2, "->"); | |
44 | } | |
45 | ||
46 | //_____________________________________________________________________________ | |
47 | void AliRsnAnalysisManager::Add(AliRsnPair *pair) | |
48 | { | |
49 | // | |
50 | // Adds a new pair manager to the list. | |
51 | // | |
52 | ||
53 | AliDebug(AliLog::kDebug+2,"<-"); | |
54 | ||
55 | if (!pair) { | |
56 | AliWarning(Form("AliRsnPairManager is %p. Skipping ...", pair)); | |
57 | return; | |
58 | } | |
59 | ||
60 | AliDebug(AliLog::kDebug+1, Form("Adding %s [%d]...", pair->GetName(), fPairs.GetEntries())); | |
61 | fPairs.Add((AliRsnPair*)pair); | |
62 | ||
63 | AliDebug(AliLog::kDebug+2,"->"); | |
64 | } | |
65 | ||
66 | //_____________________________________________________________________________ | |
67 | void AliRsnAnalysisManager::Print(Option_t* /*dummy*/) const | |
68 | { | |
69 | // | |
70 | // Overload of the TObject::Print() method | |
71 | // | |
72 | ||
73 | AliInfo(Form("\t======== Analysis Manager %s ========", GetName())); | |
74 | PrintArray(); | |
75 | } | |
76 | ||
77 | //_____________________________________________________________________________ | |
78 | void AliRsnAnalysisManager::PrintArray() const | |
79 | { | |
80 | // | |
81 | // Calls the "Print" method of all included pair managers | |
82 | // | |
83 | ||
84 | AliDebug(AliLog::kDebug+2,"<-"); | |
85 | ||
86 | AliRsnPair *pair = 0; | |
87 | TObjArrayIter next(&fPairs); | |
88 | while ((pair = (AliRsnPair*)next())) pair->Print(); | |
89 | ||
90 | AliDebug(AliLog::kDebug+2,"->"); | |
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
94 | void AliRsnAnalysisManager::InitAllPairs(TList *list) | |
95 | { | |
96 | // | |
97 | // Initialize all pair managers, and put all the TList of histograms | |
98 | // generated by each one into a unique final output TList | |
99 | // | |
100 | ||
101 | AliDebug(AliLog::kDebug+2,"<-"); | |
102 | ||
103 | // TList *list = new TList(); | |
104 | // list->SetName(GetName()); | |
105 | // list->SetOwner(); | |
106 | ||
107 | AliRsnPair *pair = 0; | |
108 | TObjArrayIter next(&fPairs); | |
109 | Int_t i = 0; | |
110 | while ((pair = (AliRsnPair*)next())) | |
111 | { | |
112 | if (!pair) continue; | |
113 | AliDebug(AliLog::kDebug+1, Form("InitAllPairs of the PairManager(%s) [%d] ...", pair->GetName(), i++)); | |
114 | pair->Init("", list); | |
115 | } | |
116 | AliDebug(AliLog::kDebug+2, "->"); | |
117 | // return list; | |
118 | } | |
119 | ||
120 | //_____________________________________________________________________________ | |
121 | void AliRsnAnalysisManager::ProcessAllPairs(AliRsnEvent *ev0, AliRsnEvent *ev1) | |
122 | { | |
123 | // | |
124 | // Process one or two events for all pair managers. | |
125 | // | |
126 | ||
127 | AliDebug(AliLog::kDebug+2,"<-"); | |
128 | ||
129 | if (!ev1) ev1 = ev0; | |
130 | ||
131 | Int_t nTracks[2], nV0[2], nTot[2]; | |
132 | nTracks[0] = ev0->GetRef()->GetNumberOfTracks(); | |
133 | nV0[0] = ev0->GetRef()->GetNumberOfV0s(); | |
134 | nTracks[1] = ev1->GetRef()->GetNumberOfTracks(); | |
135 | nV0[1] = ev1->GetRef()->GetNumberOfV0s(); | |
136 | nTot[0] = nTracks[0] + nV0[0]; | |
137 | nTot[1] = nTracks[1] + nV0[1]; | |
138 | ||
139 | // external loop | |
140 | // joins the loop on tracks and v0s, by looping the indexes from 0 | |
141 | // to the sum of them, and checking what to take depending of its value | |
142 | Int_t i0, i1, i; | |
143 | AliRsnDaughter daughter0, daughter1; | |
144 | AliRsnPair *pair = 0x0; | |
145 | TObjArrayIter next(&fPairs); | |
146 | ||
147 | for (i0 = 0; i0 < nTot[0]; i0++) | |
148 | { | |
149 | // assign first track | |
150 | if (i0 < nTracks[0]) ev0->SetDaughter(daughter0, i0, AliRsnDaughter::kTrack); | |
151 | else ev0->SetDaughter(daughter0, i0 - nTracks[0], AliRsnDaughter::kV0); | |
152 | ||
153 | // internal loop (same criterion) | |
154 | for (i1 = 0; i1 < nTot[1]; i1++) | |
155 | { | |
156 | // if looking same event, skip the case when the two indexes are equal | |
157 | if (ev0 == ev1 && i0 == i1) continue; | |
158 | ||
159 | // assign second track | |
160 | if (i1 < nTracks[1]) ev1->SetDaughter(daughter1, i1, AliRsnDaughter::kTrack); | |
161 | else ev1->SetDaughter(daughter1, i1 - nTracks[1], AliRsnDaughter::kV0); | |
162 | ||
163 | // loop over all pairs and make computations | |
164 | next.Reset(); | |
165 | i = 0; | |
166 | while ((pair = (AliRsnPair*)next())) | |
167 | { | |
168 | AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++)); | |
169 | ||
170 | // if the pair is a like-sign, skip the case when i1 < i0, | |
171 | // in order not to double count each like-sign pair | |
172 | // (equivalent to looping from i0+1 to ntracks) | |
173 | if (pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; | |
174 | ||
175 | // process the two tracks | |
176 | if (!pair->Fill(&daughter0, &daughter1, ev0, ev1)) continue; | |
177 | pair->Compute(); | |
178 | } | |
179 | } | |
180 | } | |
181 | ||
182 | AliDebug(AliLog::kDebug+2,"->"); | |
183 | } | |
184 | ||
185 | //_____________________________________________________________________________ | |
186 | void AliRsnAnalysisManager::ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1) | |
187 | { | |
188 | // | |
189 | // Process one or two events for all pair managers. | |
190 | // | |
191 | ||
192 | AliDebug(AliLog::kDebug+2,"<-"); | |
193 | ||
194 | if (!ev1) ev1 = ev0; | |
195 | ||
196 | Int_t nTracks[2]; | |
197 | nTracks[0] = ev0->GetRefMC()->GetNumberOfTracks(); | |
198 | nTracks[1] = ev1->GetRefMC()->GetNumberOfTracks(); | |
199 | ||
200 | // external loop | |
201 | // joins the loop on tracks and v0s, by looping the indexes from 0 | |
202 | // to the sum of them, and checking what to take depending of its value | |
203 | Int_t i0, i1, i; | |
204 | Bool_t filled; | |
205 | AliRsnDaughter daughter0, daughter1; | |
206 | AliRsnPair *pair = 0x0; | |
207 | TObjArrayIter next(&fPairs); | |
208 | ||
209 | for (i0 = 0; i0 < nTracks[0]; i0++) | |
210 | { | |
211 | // skip not physical primaries | |
212 | if (!ev0->GetRefMCESD()->Stack()->IsPhysicalPrimary(i0)) continue; | |
213 | ||
214 | // assign first track | |
215 | ev0->SetDaughterMC(daughter0, i0); | |
216 | ||
217 | // internal loop (same criterion) | |
218 | for (i1 = 0; i1 < nTracks[1]; i1++) | |
219 | { | |
220 | // if looking same event, skip the case when the two indexes are equal | |
221 | if (ev0 == ev1 && i0 == i1) continue; | |
222 | ||
223 | // skip not physical primaries | |
224 | if (!ev1->GetRefMCESD()->Stack()->IsPhysicalPrimary(i1)) continue; | |
225 | ||
226 | // assign second track | |
227 | ev1->SetDaughterMC(daughter1, i1); | |
228 | ||
229 | // loop over all pairs and make computations | |
230 | next.Reset(); | |
231 | i = 0; | |
232 | while ((pair = (AliRsnPair*)next())) | |
233 | { | |
234 | AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++)); | |
235 | ||
236 | // if the pair is a like-sign, skip the case when i1 < i0, | |
237 | // in order not to double count each like-sign pair | |
238 | // (equivalent to looping from i0+1 to ntracks) | |
239 | if (pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; | |
240 | ||
241 | // process the two tracks | |
242 | filled = pair->Fill(&daughter0, &daughter1, ev0, ev1); | |
243 | if (!filled) continue; | |
244 | pair->Compute(); | |
245 | } | |
246 | } | |
247 | } | |
248 | ||
249 | AliDebug(AliLog::kDebug+2,"->"); | |
250 | } | |
251 |