]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnPairManager.cxx
New classes required for revision of package
[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
17 #include "AliRsnPairManager.h"
18
19 ClassImp(AliRsnPairManager)
20
21 //_____________________________________________________________________________
22 AliRsnPairManager::AliRsnPairManager(const char*name) :
23   AliRsnVManager(name)
24 {
25 //
26 // Default constructor
27 //
28
29   AliDebug(AliLog::kDebug +2, "<-");
30   AliDebug(AliLog::kDebug +2, "->");
31 }
32
33 //_____________________________________________________________________________
34 void AliRsnPairManager::Add(AliRsnPair *pair)
35 {
36 //
37 // Adds a new AliRsnPair to the list owned by this object.
38 //
39
40   AliDebug(AliLog::kDebug+2, "<-");
41
42   if (!pair) {
43     AliWarning(Form("Pair is %p. Skipping ...", pair));
44     return;
45   }
46
47   AliDebug(AliLog::kDebug+1, Form("Adding %s [%d entries] ...", pair->GetPairName().Data(), fArray.GetEntries()));
48   fArray.Add((AliRsnPair*)pair);
49
50   AliDebug(AliLog::kDebug+2, "->");
51 }
52
53 //_____________________________________________________________________________
54 void AliRsnPairManager::Print(Option_t* /*dummy*/) const
55 {
56 //
57 // Overload of TObject::Print() method.
58 // With respect to the other print method, adds a title string.
59 //
60
61   AliDebug(AliLog::kDebug+2,"<-");
62
63   AliInfo(Form("\t\t======== Pair Manager %s ========", GetName()));
64   PrintArray();
65
66   AliDebug(AliLog::kDebug+2,"->");
67 }
68
69 //_____________________________________________________________________________
70 void AliRsnPairManager::PrintArray() const
71 {
72 //
73 // Prints all pairs
74 //
75
76   AliDebug(AliLog::kDebug+2,"<-");
77
78   AliRsnPair *pair = 0;
79   TObjArrayIter next(&fArray);
80   while ((pair = (AliRsnPair*)next())) pair->Print();
81
82   AliDebug(AliLog::kDebug+2,"->");
83 }
84
85 //_____________________________________________________________________________
86 TList* AliRsnPairManager::InitAllPairs()
87 {
88 //
89 // Initialize all pairs, and builds a TList of histograms
90 // which are created by each of them, in order to link it
91 // to the output handler in the AnalysisTasks.
92 //
93
94   AliDebug(AliLog::kDebug+2, "<-");
95
96   TList *list = new TList();
97   list->SetName(GetName());
98   list->SetOwner();
99
100   AliRsnPair *pair = 0;
101   TObjArrayIter next(&fArray);
102
103   Int_t i = 0;
104   while ((pair = (AliRsnPair*)next())) {
105     if (!pair) continue;
106     AliDebug(AliLog::kDebug+1, Form("InitAllPairs of the PairManager(%s) [%d] ...", pair->GetPairName().Data(), i++));
107     list->Add(pair->GenerateHistograms(GetName()));
108   }
109
110   AliDebug(AliLog::kDebug+2, "->");
111   return list;
112 }
113
114 //_____________________________________________________________________________
115 void AliRsnPairManager::ProcessAllPairs
116 (AliRsnPIDIndex *pidIndexes1, AliRsnEvent *ev1, AliRsnPIDIndex *pidIndexes2, AliRsnEvent *ev2)
117 {
118 //
119 // Processes one (single-event analysis) or two (event-mixing) events
120 // to fill histograms in all stored pairs.
121 //
122
123   AliDebug(AliLog::kDebug+2, "<-");
124
125   AliRsnPair *pair = 0;
126   TObjArrayIter next(&fArray);
127
128   Int_t i=0;
129   while ((pair = (AliRsnPair*)next())) {
130     if (!pair) continue;
131     AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the PairManager(%s) [%d] ...", pair->GetPairName().Data(), i++));
132     pair->LoopPair(pidIndexes1, ev1, pidIndexes2, ev2);
133   }
134
135   AliDebug(AliLog::kDebug+2, "->");
136 }