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>
23 #include "AliVEvent.h"
24 #include "AliMCEvent.h"
25 #include "AliRsnEvent.h"
26 #include "AliRsnPair.h"
27 #include "AliRsnAnalysisManager.h"
30 ClassImp(AliRsnAnalysisManager)
32 //_____________________________________________________________________________
33 AliRsnAnalysisManager::AliRsnAnalysisManager(const char*name) :
38 // Default constructor
41 AliDebug(AliLog::kDebug+2, "<-");
42 AliDebug(AliLog::kDebug+2, "->");
45 //_____________________________________________________________________________
46 void AliRsnAnalysisManager::Add(AliRsnPair *pair)
49 // Adds a new pair manager to the list.
52 AliDebug(AliLog::kDebug+2,"<-");
55 AliWarning(Form("AliRsnPairManager is %p. Skipping ...", pair));
59 AliDebug(AliLog::kDebug+1, Form("Adding %s [%d]...", pair->GetName(), fPairs.GetEntries()));
60 fPairs.Add((AliRsnPair*)pair);
62 AliDebug(AliLog::kDebug+2,"->");
65 //_____________________________________________________________________________
66 void AliRsnAnalysisManager::Print(Option_t* /*dummy*/) const
69 // Overload of the TObject::Print() method
72 AliInfo(Form("\t======== Analysis Manager %s ========", GetName()));
76 //_____________________________________________________________________________
77 void AliRsnAnalysisManager::PrintArray() const
80 // Calls the "Print" method of all included pair managers
83 AliDebug(AliLog::kDebug+2,"<-");
86 TObjArrayIter next(&fPairs);
87 while ((pair = (AliRsnPair*)next())) pair->Print();
89 AliDebug(AliLog::kDebug+2,"->");
92 //_____________________________________________________________________________
93 void AliRsnAnalysisManager::InitAllPairs(TList *list)
96 // Initialize all pair managers, and put all the TList of histograms
97 // generated by each one into a unique final output TList
100 AliDebug(AliLog::kDebug+2,"<-");
102 // TList *list = new TList();
103 // list->SetName(GetName());
106 AliRsnPair *pair = 0;
107 TObjArrayIter next(&fPairs);
109 while ((pair = (AliRsnPair*)next()))
112 AliDebug(AliLog::kDebug+1, Form("InitAllPairs of the PairManager(%s) [%d] ...", pair->GetName(), i++));
113 pair->Init("", list);
115 AliDebug(AliLog::kDebug+2, "->");
119 //_____________________________________________________________________________
120 void AliRsnAnalysisManager::ProcessAllPairs(AliRsnEvent *ev0, AliRsnEvent *ev1)
123 // Process one or two events for all pair managers.
126 AliDebug(AliLog::kDebug+2,"<-");
130 Int_t nTracks[2], nV0[2], nTot[2];
131 nTracks[0] = ev0->GetRef()->GetNumberOfTracks();
132 nV0[0] = ev0->GetRef()->GetNumberOfV0s();
133 nTracks[1] = ev1->GetRef()->GetNumberOfTracks();
134 nV0[1] = ev1->GetRef()->GetNumberOfV0s();
135 nTot[0] = nTracks[0] + nV0[0];
136 nTot[1] = nTracks[1] + nV0[1];
139 // joins the loop on tracks and v0s, by looping the indexes from 0
140 // to the sum of them, and checking what to take depending of its value
142 AliRsnDaughter daughter0, daughter1;
143 AliRsnPair *pair = 0x0;
144 TObjArrayIter next(&fPairs);
146 for (i0 = 0; i0 < nTot[0]; i0++)
148 // assign first track
149 if (i0 < nTracks[0]) ev0->SetDaughter(daughter0, i0, AliRsnDaughter::kTrack);
150 else ev0->SetDaughter(daughter0, i0 - nTracks[0], AliRsnDaughter::kV0);
152 // internal loop (same criterion)
153 for (i1 = 0; i1 < nTot[1]; i1++)
155 // if looking same event, skip the case when the two indexes are equal
156 if (ev0 == ev1 && i0 == i1) continue;
158 // assign second track
159 if (i1 < nTracks[1]) ev1->SetDaughter(daughter1, i1, AliRsnDaughter::kTrack);
160 else ev1->SetDaughter(daughter1, i1 - nTracks[1], AliRsnDaughter::kV0);
162 // loop over all pairs and make computations
165 while ((pair = (AliRsnPair*)next()))
167 AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++));
169 // if the pair is a like-sign, skip the case when i1 < i0,
170 // in order not to double count each like-sign pair
171 // (equivalent to looping from i0+1 to ntracks)
172 if (pair->GetPairDef()->IsLikeSign() && i1 < i0) continue;
174 // process the two tracks
175 if (!pair->Fill(&daughter0, &daughter1, ev0, ev1)) continue;
181 AliDebug(AliLog::kDebug+2,"->");
184 //_____________________________________________________________________________
185 void AliRsnAnalysisManager::ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1)
188 // Process one or two events for all pair managers.
191 AliDebug(AliLog::kDebug+2,"<-");
196 nTracks[0] = ev0->GetRefMC()->GetNumberOfTracks();
197 nTracks[1] = ev1->GetRefMC()->GetNumberOfTracks();
200 // joins the loop on tracks and v0s, by looping the indexes from 0
201 // to the sum of them, and checking what to take depending of its value
203 AliRsnDaughter daughter0, daughter1;
204 AliRsnPair *pair = 0x0;
205 TObjArrayIter next(&fPairs);
207 for (i0 = 0; i0 < nTracks[0]; i0++)
209 // assign first track
210 if (i0 < nTracks[0]) ev0->SetDaughter(daughter0, i0, AliRsnDaughter::kTrack);
211 else ev0->SetDaughter(daughter0, i0 - nTracks[0], AliRsnDaughter::kV0);
213 // internal loop (same criterion)
214 for (i1 = 0; i1 < nTracks[1]; i1++)
216 // if looking same event, skip the case when the two indexes are equal
217 if (ev0 == ev1 && i0 == i1) continue;
219 // assign second track
220 if (i1 < nTracks[1]) ev1->SetDaughter(daughter1, i1, AliRsnDaughter::kTrack);
221 else ev1->SetDaughter(daughter1, i1 - nTracks[1], AliRsnDaughter::kV0);
223 // loop over all pairs and make computations
226 while ((pair = (AliRsnPair*)next()))
228 AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++));
230 // if the pair is a like-sign, skip the case when i1 < i0,
231 // in order not to double count each like-sign pair
232 // (equivalent to looping from i0+1 to ntracks)
233 if (pair->GetPairDef()->IsLikeSign() && i1 < i0) continue;
235 // process the two tracks
236 if (!pair->Fill(&daughter0, &daughter1, ev0, ev1)) continue;
242 AliDebug(AliLog::kDebug+2,"->");