]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnAnalysisME.cxx
Implemented a static AliRsnEvent pointer to point to the current event being analyzed...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnAnalysisME.cxx
CommitLineData
5eb970a4 1//
2// Class AliRsnAnalysisME
3//
9477aa42 4//
5// Virtual Class derivated from AliRsnVAnalysisTaskME which will be base class
6// for all RSN SE tasks
5eb970a4 7//
8// authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
9// Martin Vala (martin.vala@cern.ch)
10//
11
4fbb2459 12#include "AliESDEvent.h"
13#include "AliMCEvent.h"
14#include "AliAODEvent.h"
9477aa42 15#include "AliMultiEventInputHandler.h"
5eb970a4 16#include "AliRsnAnalysisME.h"
17
18ClassImp(AliRsnAnalysisME)
19
20//_____________________________________________________________________________
2dab9030 21AliRsnAnalysisME::AliRsnAnalysisME(const char *name) :
22 AliRsnVAnalysisTaskME(name),
e79f56bd 23 fRsnAnalysisManager(),
e79f56bd 24 fEvent(),
2dab9030 25 fEventMix(),
26 fOutList(0x0)
5eb970a4 27{
28//
29// Default constructor
30//
9477aa42 31 AliDebug(AliLog::kDebug+2, "<-");
2dab9030 32
33 DefineOutput(2, TList::Class());
5eb970a4 34 AliDebug(AliLog::kDebug+2,"->");
35}
36
37AliRsnAnalysisME::AliRsnAnalysisME(const AliRsnAnalysisME& copy) : AliRsnVAnalysisTaskME(copy),
e79f56bd 38 fRsnAnalysisManager(copy.fRsnAnalysisManager),
e79f56bd 39 fEvent(copy.fEvent),
2dab9030 40 fEventMix(copy.fEvent),
41 fOutList(0x0)
5eb970a4 42{
9477aa42 43 AliDebug(AliLog::kDebug+2, "<-");
5eb970a4 44 AliDebug(AliLog::kDebug+2,"->");
45}
46
47//_____________________________________________________________________________
48void AliRsnAnalysisME::RsnUserCreateOutputObjects()
49{
4fbb2459 50//
9477aa42 51// Creation of output objects.
52// These are created through the utility methods in the analysis manager,
53// which produces a list of histograms for each specified set of pairs.
54// Each of these lists is added to the main list of this task.
4fbb2459 55//
5eb970a4 56
9477aa42 57 AliDebug(AliLog::kDebug+2, "<-");
5eb970a4 58
2dab9030 59 fOutList = new TList();
60 fOutList->SetOwner();
5eb970a4 61
2dab9030 62 fRsnAnalysisManager.InitAllPairs(fOutList);
63
64 PostData(2, fOutList);
5eb970a4 65
66 AliDebug(AliLog::kDebug+2,"->");
67}
68
4fbb2459 69void AliRsnAnalysisME::RsnUserExec(Option_t*)
5eb970a4 70{
4fbb2459 71//
9477aa42 72// Rsn User Exec
4fbb2459 73//
74
9477aa42 75 fTaskInfo.SetEventUsed(kFALSE);
76
77 AliDebug(AliLog::kDebug+2, "<-");
78 if (!CheckAndPrintEvents()) return;
79
80 DoMixing(GetEvent(0));
81
82
83 // if cuts are passed or not cuts were defined,
84 // update the task info...
85 fTaskInfo.SetEventUsed(kTRUE);
86
2dab9030 87 PostData(2, fOutList);
9477aa42 88
89 AliDebug(AliLog::kDebug+2,"->");
90}
91
92
93//_____________________________________________________________________________
94void AliRsnAnalysisME::DoMixing(AliVEvent* ev)
95{
96//
97// Do Mixing
98//
99
100 Int_t nEvents = fInputHandler->GetBufferSize();
101 fESDEvent = dynamic_cast<AliESDEvent*>(ev);
102 fAODEvent = dynamic_cast<AliAODEvent*>(ev);
103
104 if (fESDEvent) {
105 AliESDEvent **esdEvent = new AliESDEvent*[nEvents];
106 for (Int_t i = 0; i < nEvents; i++) {
107 esdEvent[i] = dynamic_cast<AliESDEvent*>(GetEvent(i));
108 if (!esdEvent[i]) {
109 AliWarning(Form("Null ESD event in index %d", i));
110 continue;
111 }
112 if (i > 0)
113 DoESDMixing(esdEvent[0], esdEvent[i]);
114 }
9477aa42 115 } else if (fAODEvent) {
116 AliAODEvent **aodEvent = new AliAODEvent*[nEvents];
117 for (Int_t i = 0; i < nEvents; i++) {
118 aodEvent[i] = dynamic_cast<AliAODEvent*>(GetEvent(i));
119 if (!aodEvent[i]) {
120 AliWarning(Form("Null AOD event in index %d", i));
121 continue;
122 }
123 if (i > 0)
124 DoAODMixing(aodEvent[0], aodEvent[i]);
125 }
5eb970a4 126 }
127
9477aa42 128}
129
130
131//_____________________________________________________________________________
132void AliRsnAnalysisME::DoAODMixing(AliAODEvent* aod1, AliAODEvent* aod2)
133{
134//
135// mixing of two aod events
136//
5eb970a4 137
138 // assign events
139 fEvent.SetRef(aod1);
140 fEventMix.SetRef(aod2);
141 if (fEvent.GetMultiplicity() < 2) return;
142 if (fEventMix.GetMultiplicity() < 2) return;
5faf5a07 143
144 AliRsnEvent::SetCurrentEvent1(&fEvent);
145 AliRsnEvent::SetCurrentEvent2(&fEventMix);
5eb970a4 146
5faf5a07 147 fRsnAnalysisManager.ProcessAllPairs();
2dab9030 148 PostData(2, fOutList);
5eb970a4 149
9477aa42 150 AliDebug(AliLog::kDebug, Form("AOD tracks %d", aod1->GetNumberOfTracks()));
151 AliDebug(AliLog::kDebug, Form("AOD tracks %d", aod2->GetNumberOfTracks()));
5eb970a4 152
5eb970a4 153}
154
155
9477aa42 156//_____________________________________________________________________________
157void AliRsnAnalysisME::DoESDMixing(AliESDEvent* esd1, AliESDEvent* esd2)
158{
159//
160// mixing of two esd events
161//
162
163 AliWarning(Form("ESD mixing not supported yet !!! (%p,%p)", esd1, esd2));
164 return;
165}
166
167
168
5eb970a4 169//_____________________________________________________________________________
4fbb2459 170void AliRsnAnalysisME::RsnTerminate(Option_t*)
5eb970a4 171{
4fbb2459 172//
9477aa42 173// Rsn Terminate
4fbb2459 174//
175
9477aa42 176 AliDebug(AliLog::kDebug+2, "<-");
5eb970a4 177 AliDebug(AliLog::kDebug+2,"->");
178}
179
5eb970a4 180//_____________________________________________________________________________
181void AliRsnAnalysisME::SetPriorProbability(AliPID::EParticleType type, Double_t p)
182{
9477aa42 183//
184// Sets the prior probability for Realistic PID, for a
185// given particle species.
186//
5eb970a4 187
188 if (type >= 0 && type < (Int_t)AliPID::kSPECIES) {
189 fPrior[type] = p;
190 }
191
192}
193
194//_____________________________________________________________________________
195void AliRsnAnalysisME::DumpPriors()
196{
197 //
198 // Print all prior probabilities
199 //
200
201 Int_t i;
202 for (i = 0; i < AliPID::kSPECIES; i++) {
203 AliInfo(Form("Prior probability for %10s = %3.5f", AliPID::ParticleName((AliPID::EParticleType)i), fPrior[i]));
204 }
205}
206
207//_____________________________________________________________________________
4fbb2459 208void AliRsnAnalysisME::GetPriorProbability(Double_t *out) const
5eb970a4 209{
4fbb2459 210//
211// Gets all prior probabilities to out
212//
5eb970a4 213
214 Int_t i;
9477aa42 215 for (i = 0;i < AliPID::kSPECIES;i++) {
5eb970a4 216 out[i] = fPrior[i];
217 }
218}
2dab9030 219
220