2 // Class AliRsnAnalysisManager
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.
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.
12 // The base architecture is still AliRsnVManager, but in this case
13 // all the objects in the list will be AliRsnPairManager's.
15 // author : M. Vala [martin.vala@cern.ch]
16 // revised by : A. Pulvirenti [alberto.pulvirenti@ct.infn.it]
19 #include <Riostream.h>
24 #include "AliVEvent.h"
25 #include "AliMCEvent.h"
26 #include "AliRsnEvent.h"
27 #include "AliRsnPair.h"
28 #include "AliRsnAnalysisManager.h"
31 ClassImp(AliRsnAnalysisManager)
33 //_____________________________________________________________________________
34 AliRsnAnalysisManager::AliRsnAnalysisManager(const char*name) :
39 // Default constructor
42 AliDebug(AliLog::kDebug+2, "<-");
43 AliDebug(AliLog::kDebug+2, "->");
46 //_____________________________________________________________________________
47 void AliRsnAnalysisManager::Add(AliRsnPair *pair)
50 // Adds a new pair manager to the list.
53 AliDebug(AliLog::kDebug+2,"<-");
56 AliWarning(Form("AliRsnPairManager is %p. Skipping ...", pair));
60 AliDebug(AliLog::kDebug+1, Form("Adding %s [%d]...", pair->GetName(), fPairs.GetEntries()));
61 fPairs.Add((AliRsnPair*)pair);
63 AliDebug(AliLog::kDebug+2,"->");
66 //_____________________________________________________________________________
67 void AliRsnAnalysisManager::Print(Option_t* /*dummy*/) const
70 // Overload of the TObject::Print() method
73 AliInfo(Form("\t======== Analysis Manager %s ========", GetName()));
77 //_____________________________________________________________________________
78 void AliRsnAnalysisManager::PrintArray() const
81 // Calls the "Print" method of all included pair managers
84 AliDebug(AliLog::kDebug+2,"<-");
87 TObjArrayIter next(&fPairs);
88 while ((pair = (AliRsnPair*)next())) pair->Print();
90 AliDebug(AliLog::kDebug+2,"->");
93 //_____________________________________________________________________________
94 void AliRsnAnalysisManager::InitAllPairs(TList *list)
97 // Initialize all pair managers, and put all the TList of histograms
98 // generated by each one into a unique final output TList
101 AliDebug(AliLog::kDebug+2,"<-");
103 // TList *list = new TList();
104 // list->SetName(GetName());
107 AliRsnPair *pair = 0;
108 TObjArrayIter next(&fPairs);
110 while ((pair = (AliRsnPair*)next()))
113 AliDebug(AliLog::kDebug+1, Form("InitAllPairs of the PairManager(%s) [%d] ...", pair->GetName(), i++));
114 pair->Init("", list);
116 AliDebug(AliLog::kDebug+2, "->");
120 //_____________________________________________________________________________
121 void AliRsnAnalysisManager::ProcessAllPairs(AliRsnEvent *ev0, AliRsnEvent *ev1)
124 // Process one or two events for all pair managers.
127 AliDebug(AliLog::kDebug+2,"<-");
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];
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
143 AliRsnDaughter daughter0, daughter1;
144 AliRsnPair *pair = 0x0;
145 TObjArrayIter next(&fPairs);
147 for (i0 = 0; i0 < nTot[0]; i0++)
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);
153 // internal loop (same criterion)
154 for (i1 = 0; i1 < nTot[1]; i1++)
156 // if looking same event, skip the case when the two indexes are equal
157 if (ev0 == ev1 && i0 == i1) continue;
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);
163 // loop over all pairs and make computations
166 while ((pair = (AliRsnPair*)next()))
168 AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++));
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;
175 // process the two tracks
176 if (!pair->Fill(&daughter0, &daughter1, ev0, ev1)) continue;
182 AliDebug(AliLog::kDebug+2,"->");
185 //_____________________________________________________________________________
186 void AliRsnAnalysisManager::ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1)
189 // Process one or two events for all pair managers.
192 AliDebug(AliLog::kDebug+2,"<-");
197 nTracks[0] = ev0->GetRefMC()->GetNumberOfTracks();
198 nTracks[1] = ev1->GetRefMC()->GetNumberOfTracks();
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
205 AliRsnDaughter daughter0, daughter1;
206 AliRsnPair *pair = 0x0;
207 TObjArrayIter next(&fPairs);
209 for (i0 = 0; i0 < nTracks[0]; i0++)
211 // skip not physical primaries
212 if (!ev0->GetRefMC()->Stack()->IsPhysicalPrimary(i0)) continue;
214 // assign first track
215 ev0->SetDaughterMC(daughter0, i0);
217 // internal loop (same criterion)
218 for (i1 = 0; i1 < nTracks[1]; i1++)
220 // if looking same event, skip the case when the two indexes are equal
221 if (ev0 == ev1 && i0 == i1) continue;
223 // skip not physical primaries
224 if (!ev1->GetRefMC()->Stack()->IsPhysicalPrimary(i1)) continue;
226 // assign second track
227 ev1->SetDaughterMC(daughter1, i1);
229 // loop over all pairs and make computations
232 while ((pair = (AliRsnPair*)next()))
234 AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++));
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;
241 // process the two tracks
242 filled = pair->Fill(&daughter0, &daughter1, ev0, ev1);
243 if (!filled) continue;
249 AliDebug(AliLog::kDebug+2,"->");