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