]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnAnalysisManager.cxx
Main changes:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnAnalysisManager.cxx
CommitLineData
5eb970a4 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 "AliLog.h"
20
21#include "AliRsnAnalysisManager.h"
22
23ClassImp(AliRsnAnalysisManager)
24
25//_____________________________________________________________________________
26AliRsnAnalysisManager::AliRsnAnalysisManager(const char*name) :
27 AliRsnVManager(name)
28{
29//
30// Default constructor
31//
32
33 AliDebug(AliLog::kDebug+2, "<-");
34 AliDebug(AliLog::kDebug+2, "->");
35}
36
37//_____________________________________________________________________________
38void AliRsnAnalysisManager::Add(AliRsnPairManager *pair)
39{
40//
41// Adds a new pair manager to the list.
42//
43
44 AliDebug(AliLog::kDebug+2,"<-");
45
46 if (!pair) {
47 AliWarning(Form("AliRsnPairManager is %p. Skipping ...", pair));
48 return;
49 }
50
51 AliDebug(AliLog::kDebug+1, Form("Adding %s [%d]...", pair->GetName(), fArray.GetEntries()));
52 fArray.Add((AliRsnPairManager*)pair);
53
54 AliDebug(AliLog::kDebug+2,"->");
55}
56
57//_____________________________________________________________________________
58void AliRsnAnalysisManager::Print(Option_t* /*dummy*/) const
59{
60//
61// Overload of the TObject::Print() method
62//
63
64 AliInfo(Form("\t======== Analysis Manager %s ========", GetName()));
65 PrintArray();
66}
67
68//_____________________________________________________________________________
69void AliRsnAnalysisManager::PrintArray() const
70{
71//
72// Calls the "Print" method of all included pair managers
73//
74
75 AliDebug(AliLog::kDebug+2,"<-");
76
77 AliRsnPairManager *mgr = 0;
78 TObjArrayIter next(&fArray);
79 while ((mgr = (AliRsnPairManager*)next())) mgr->Print();
80
81 AliDebug(AliLog::kDebug+2,"->");
82}
83
84//_____________________________________________________________________________
85TList* AliRsnAnalysisManager::InitAllPairMgrs()
86{
87//
88// Initialize all pair managers, and put all the TList of histograms
89// generated by each one into a unique final output TList
90//
91
92 AliDebug(AliLog::kDebug+2,"<-");
93
94 TList *list = new TList();
95 list->SetName(GetName());
96 list->SetOwner();
97
98 AliRsnPairManager *pairMgr = 0;
99 TObjArrayIter next(&fArray);
100 Int_t i = 0;
101 while ((pairMgr = (AliRsnPairManager*)next())) {
102 AliDebug(AliLog::kDebug+1, Form("InitAllPairs of the AnalysisManager(%s) [%d] ...", pairMgr->GetName(), i++));
103 list->Add(pairMgr->InitAllPairs());
104 }
105 AliDebug(AliLog::kDebug+2, "->");
106 return list;
107}
108
109//_____________________________________________________________________________
110void AliRsnAnalysisManager::ProcessAllPairMgrs
111(AliRsnPIDIndex *pidIndexes1, AliRsnEvent *ev1, AliRsnPIDIndex *pidIndexes2, AliRsnEvent *ev2)
112{
113//
114// Process one or two events for all pair managers.
115//
116
117 AliDebug(AliLog::kDebug+2,"<-");
118
119 AliRsnPairManager *pairMgr = 0;
120 TObjArrayIter next(&fArray);
121
122 Int_t i = 0;
123 while ((pairMgr = (AliRsnPairManager*)next())) {
124 AliDebug(AliLog::kDebug+1, Form("ProcessAllPairMgrs of the AnalysisManager(%s) [%d] ...", pairMgr->GetName(), i++));
125 pairMgr->ProcessAllPairs(pidIndexes1, ev1, pidIndexes2, ev2);
126 }
127
128 AliDebug(AliLog::kDebug+2,"->");
129}
130
131//_____________________________________________________________________________
132void AliRsnAnalysisManager::AddConfig
133(TString config,TString prefix,TString functionName)
134{
135//
136// Adds a new AliRsnPair generated according to a configuration macro
137// which is called interactively and executed from a ROOT session
138//
139
140 AliDebug(AliLog::kDebug+2,"<-");
141
142 gROOT->LoadMacro(config.Data());
143
144 config.ReplaceAll(".C","");
145 prefix.ReplaceAll("_","-");
146
147 if (!functionName.IsNull()) config = functionName;
148
149 AliRsnPairManager *pairMgr = (AliRsnPairManager*)gROOT->ProcessLine(Form("%s(\"%s\");", config.Data(), prefix.Data()));
150 Add(pairMgr);
151
152 AliDebug(AliLog::kDebug+2,"->");
153}