]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnPairManager.cxx
Herwig event header.
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPairManager.cxx
CommitLineData
5eb970a4 1//
2// Class AliRsnPairManager
3//
4// A collection of pairs for an analysis.
5// The function of this collection is just for purposes of well-sorting
6// the analyzed pairs into upper-level groups, in the case of a wide
7// analysis containing many resonances at once, or different settings for the same one.
8//
9// Each PairMgr will result in a separate list of histograms, which
10// can be seen as a folder in the output file, whose name is given by this object.
11//
12// author: M. Vala (email: martin.vala@cern.ch)
13//
14
15#include "AliLog.h"
4fbb2459 16#include "AliRsnPair.h"
5eb970a4 17
18#include "AliRsnPairManager.h"
19
20ClassImp(AliRsnPairManager)
21
22//_____________________________________________________________________________
23AliRsnPairManager::AliRsnPairManager(const char*name) :
4fbb2459 24 AliRsnVManager(name)
5eb970a4 25{
26//
27// Default constructor
28//
29
30 AliDebug(AliLog::kDebug +2, "<-");
31 AliDebug(AliLog::kDebug +2, "->");
32}
33
34//_____________________________________________________________________________
4fbb2459 35void AliRsnPairManager::Add(TObject* objPair)
5eb970a4 36{
37//
38// Adds a new AliRsnPair to the list owned by this object.
39//
40
41 AliDebug(AliLog::kDebug+2, "<-");
e79f56bd 42 AliRsnPair *pair = dynamic_cast<AliRsnPair*>(objPair);
5eb970a4 43
44 if (!pair) {
45 AliWarning(Form("Pair is %p. Skipping ...", pair));
46 return;
47 }
48
49 AliDebug(AliLog::kDebug+1, Form("Adding %s [%d entries] ...", pair->GetPairName().Data(), fArray.GetEntries()));
50 fArray.Add((AliRsnPair*)pair);
51
52 AliDebug(AliLog::kDebug+2, "->");
53}
54
4fbb2459 55//_____________________________________________________________________________
56void AliRsnPairManager::AddPair(AliRsnPair* pair)
57{
58//
59// Adds a new AliRsnPair to the list owned by this object.
60//
61
62 Add(pair);
63}
64
65
5eb970a4 66//_____________________________________________________________________________
67void AliRsnPairManager::Print(Option_t* /*dummy*/) const
68{
69//
70// Overload of TObject::Print() method.
71// With respect to the other print method, adds a title string.
72//
73
74 AliDebug(AliLog::kDebug+2,"<-");
75
76 AliInfo(Form("\t\t======== Pair Manager %s ========", GetName()));
77 PrintArray();
78
79 AliDebug(AliLog::kDebug+2,"->");
80}
81
82//_____________________________________________________________________________
83void AliRsnPairManager::PrintArray() const
84{
85//
86// Prints all pairs
87//
88
89 AliDebug(AliLog::kDebug+2,"<-");
90
91 AliRsnPair *pair = 0;
92 TObjArrayIter next(&fArray);
93 while ((pair = (AliRsnPair*)next())) pair->Print();
94
95 AliDebug(AliLog::kDebug+2,"->");
96}
97
98//_____________________________________________________________________________
4fbb2459 99void AliRsnPairManager::InitAllPairs(TList* list)
5eb970a4 100{
101//
102// Initialize all pairs, and builds a TList of histograms
103// which are created by each of them, in order to link it
104// to the output handler in the AnalysisTasks.
105//
106
107 AliDebug(AliLog::kDebug+2, "<-");
108
4fbb2459 109// TList *list = new TList();
110// list->SetName(GetName());
111// list->SetOwner();
5eb970a4 112
113 AliRsnPair *pair = 0;
114 TObjArrayIter next(&fArray);
115
116 Int_t i = 0;
117 while ((pair = (AliRsnPair*)next())) {
118 if (!pair) continue;
119 AliDebug(AliLog::kDebug+1, Form("InitAllPairs of the PairManager(%s) [%d] ...", pair->GetPairName().Data(), i++));
6f4a992c 120 pair->GenerateHistograms(GetName(),list);
5eb970a4 121 }
122
123 AliDebug(AliLog::kDebug+2, "->");
4fbb2459 124// return list;
5eb970a4 125}
126
127//_____________________________________________________________________________
128void AliRsnPairManager::ProcessAllPairs
129(AliRsnPIDIndex *pidIndexes1, AliRsnEvent *ev1, AliRsnPIDIndex *pidIndexes2, AliRsnEvent *ev2)
130{
131//
132// Processes one (single-event analysis) or two (event-mixing) events
133// to fill histograms in all stored pairs.
134//
135
136 AliDebug(AliLog::kDebug+2, "<-");
137
138 AliRsnPair *pair = 0;
139 TObjArrayIter next(&fArray);
140
141 Int_t i=0;
142 while ((pair = (AliRsnPair*)next())) {
143 if (!pair) continue;
144 AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the PairManager(%s) [%d] ...", pair->GetPairName().Data(), i++));
145 pair->LoopPair(pidIndexes1, ev1, pidIndexes2, ev2);
146 }
147
148 AliDebug(AliLog::kDebug+2, "->");
149}