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