]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | ClassImp(AliRsnAnalysisME) | |
19 | ||
20 | //_____________________________________________________________________________ | |
2dab9030 | 21 | AliRsnAnalysisME::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 | ||
37 | AliRsnAnalysisME::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 | //_____________________________________________________________________________ | |
48 | void 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 | 69 | void 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 | //_____________________________________________________________________________ | |
94 | void 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 | //_____________________________________________________________________________ | |
132 | void 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; | |
143 | ||
2dab9030 | 144 | fRsnAnalysisManager.ProcessAllPairs(&fEvent, &fEventMix); |
145 | PostData(2, fOutList); | |
5eb970a4 | 146 | |
9477aa42 | 147 | AliDebug(AliLog::kDebug, Form("AOD tracks %d", aod1->GetNumberOfTracks())); |
148 | AliDebug(AliLog::kDebug, Form("AOD tracks %d", aod2->GetNumberOfTracks())); | |
5eb970a4 | 149 | |
5eb970a4 | 150 | } |
151 | ||
152 | ||
9477aa42 | 153 | //_____________________________________________________________________________ |
154 | void AliRsnAnalysisME::DoESDMixing(AliESDEvent* esd1, AliESDEvent* esd2) | |
155 | { | |
156 | // | |
157 | // mixing of two esd events | |
158 | // | |
159 | ||
160 | AliWarning(Form("ESD mixing not supported yet !!! (%p,%p)", esd1, esd2)); | |
161 | return; | |
162 | } | |
163 | ||
164 | ||
165 | ||
5eb970a4 | 166 | //_____________________________________________________________________________ |
4fbb2459 | 167 | void AliRsnAnalysisME::RsnTerminate(Option_t*) |
5eb970a4 | 168 | { |
4fbb2459 | 169 | // |
9477aa42 | 170 | // Rsn Terminate |
4fbb2459 | 171 | // |
172 | ||
9477aa42 | 173 | AliDebug(AliLog::kDebug+2, "<-"); |
5eb970a4 | 174 | AliDebug(AliLog::kDebug+2,"->"); |
175 | } | |
176 | ||
5eb970a4 | 177 | //_____________________________________________________________________________ |
178 | void AliRsnAnalysisME::SetPriorProbability(AliPID::EParticleType type, Double_t p) | |
179 | { | |
9477aa42 | 180 | // |
181 | // Sets the prior probability for Realistic PID, for a | |
182 | // given particle species. | |
183 | // | |
5eb970a4 | 184 | |
185 | if (type >= 0 && type < (Int_t)AliPID::kSPECIES) { | |
186 | fPrior[type] = p; | |
187 | } | |
188 | ||
189 | } | |
190 | ||
191 | //_____________________________________________________________________________ | |
192 | void AliRsnAnalysisME::DumpPriors() | |
193 | { | |
194 | // | |
195 | // Print all prior probabilities | |
196 | // | |
197 | ||
198 | Int_t i; | |
199 | for (i = 0; i < AliPID::kSPECIES; i++) { | |
200 | AliInfo(Form("Prior probability for %10s = %3.5f", AliPID::ParticleName((AliPID::EParticleType)i), fPrior[i])); | |
201 | } | |
202 | } | |
203 | ||
204 | //_____________________________________________________________________________ | |
4fbb2459 | 205 | void AliRsnAnalysisME::GetPriorProbability(Double_t *out) const |
5eb970a4 | 206 | { |
4fbb2459 | 207 | // |
208 | // Gets all prior probabilities to out | |
209 | // | |
5eb970a4 | 210 | |
211 | Int_t i; | |
9477aa42 | 212 | for (i = 0;i < AliPID::kSPECIES;i++) { |
5eb970a4 | 213 | out[i] = fPrior[i]; |
214 | } | |
215 | } | |
2dab9030 | 216 | |
217 |