]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnPairManager.cxx
Modifications in analysis tasks for train
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPairManager.cxx
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"
16 #include "AliRsnPair.h"
17
18 #include "AliRsnPairManager.h"
19
20 ClassImp(AliRsnPairManager)
21
22 //_____________________________________________________________________________
23 AliRsnPairManager::AliRsnPairManager(const char*name) :
24     AliRsnVManager(name)
25 {
26 //
27 // Default constructor
28 //
29
30   AliDebug(AliLog::kDebug +2, "<-");
31   AliDebug(AliLog::kDebug +2, "->");
32 }
33
34 //_____________________________________________________________________________
35 void AliRsnPairManager::Add(TObject* objPair)
36 {
37 //
38 // Adds a new AliRsnPair to the list owned by this object.
39 //
40
41   AliDebug(AliLog::kDebug+2, "<-");
42   AliRsnPair *pair = dynamic_cast<AliRsnPair*>(objPair);
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
55 //_____________________________________________________________________________
56 void 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
66 //_____________________________________________________________________________
67 void 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 //_____________________________________________________________________________
83 void 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 //_____________________________________________________________________________
99 void AliRsnPairManager::InitAllPairs(TList* list)
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
109 //   TList *list = new TList();
110 //   list->SetName(GetName());
111 //   list->SetOwner();
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++));
120     pair->GenerateHistograms(GetName(),list);
121   }
122
123   AliDebug(AliLog::kDebug+2, "->");
124 //   return list;
125 }
126
127 //_____________________________________________________________________________
128 void 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 }