]>
Commit | Line | Data |
---|---|---|
b26900d0 | 1 | #include "AliFlowAnalysis.h" |
0206ddfb | 2 | |
3 | //********************************************************* | |
b26900d0 | 4 | // class AliFlowAnalysis |
b26900d0 | 5 | // Flow Analysis |
b26900d0 | 6 | // S.Radomski@gsi.de |
7 | // Piotr.Skowronski@cern.ch | |
0206ddfb | 8 | //********************************************************* |
b26900d0 | 9 | |
a5556ea5 | 10 | #include <AliAOD.h> |
afa8b37b | 11 | #include <AliVAODParticle.h> |
a5556ea5 | 12 | #include <AliAODParticleCut.h> |
13 | ||
b26900d0 | 14 | #include <AliESDtrack.h> |
15 | #include <AliESD.h> | |
16 | ||
17 | ClassImp(AliFlowAnalysis) | |
18 | ||
a5556ea5 | 19 | AliFlowAnalysis::AliFlowAnalysis(): |
20 | fPartCut(0x0) | |
21 | { | |
22 | //ctor | |
23 | } | |
24 | /*********************************************************/ | |
25 | ||
26 | AliFlowAnalysis::~AliFlowAnalysis() | |
27 | { | |
28 | //dtor | |
29 | delete fPartCut; | |
30 | } | |
31 | /*********************************************************/ | |
32 | ||
b26900d0 | 33 | Int_t AliFlowAnalysis::Init() |
34 | { | |
35 | //Initilizes anaysis | |
36 | Info("Init",""); | |
37 | return 0; | |
38 | } | |
b26900d0 | 39 | /*********************************************************/ |
40 | ||
a5556ea5 | 41 | Int_t AliFlowAnalysis::ProcessEvent(AliAOD* aodrec, AliAOD* aodsim) |
b26900d0 | 42 | { |
0206ddfb | 43 | // Process AOD events containing the reconstructed and simulated information |
a5556ea5 | 44 | Info("ProcessEvent","Sim AOD address %#x",aodsim); |
45 | Double_t psi = 0, v2 = 0; | |
46 | if (aodrec) | |
47 | { | |
48 | GetFlow(aodrec,v2,psi); | |
49 | Info("ProcessEvent","Reconstructed Event: Event plane is %f, V2 is %f",psi,v2); | |
50 | } | |
51 | ||
52 | if (aodsim) | |
53 | { | |
54 | GetFlow(aodsim,v2,psi); | |
55 | Info("ProcessEvent","Simulated Event: Event plane is %f, V2 is %f",psi,v2); | |
56 | } | |
57 | ||
b26900d0 | 58 | return 0; |
59 | ||
60 | } | |
61 | /*********************************************************/ | |
62 | ||
63 | Int_t AliFlowAnalysis::Finish() | |
64 | { | |
65 | //Finish analysis and writes results | |
66 | Info("Init","Finish"); | |
67 | return 0; | |
68 | } | |
69 | /*********************************************************/ | |
70 | ||
a5556ea5 | 71 | Double_t AliFlowAnalysis::GetEventPlane(AliAOD* aod) |
72 | { | |
73 | //returns event plane in degrees | |
74 | if (aod == 0x0) | |
75 | { | |
76 | Error("AliFlowAnalysis::GetFlow","Pointer to AOD is NULL"); | |
77 | return -1.0; | |
78 | } | |
79 | ||
80 | Double_t psi; | |
81 | Int_t mult = aod->GetNumberOfParticles(); | |
82 | ||
83 | Double_t ssin = 0, scos = 0; | |
84 | ||
85 | for (Int_t i=0; i<mult; i++) | |
86 | { | |
afa8b37b | 87 | AliVAODParticle* aodtrack = aod->GetParticle(i); |
a5556ea5 | 88 | if (aodtrack == 0x0) |
89 | { | |
90 | Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i); | |
91 | continue; | |
92 | } | |
93 | ||
94 | if (fPartCut) | |
cea0a066 | 95 | if (fPartCut->Rejected(aodtrack)) |
a5556ea5 | 96 | continue; |
97 | ||
98 | Double_t phi = TMath::Pi()+TMath::ATan2(-aodtrack->Py(),-aodtrack->Px()); | |
99 | ||
100 | ssin += TMath::Sin( 2.0 * phi ); | |
101 | scos += TMath::Cos( 2.0 * phi ); | |
102 | } | |
103 | ||
104 | psi = atan2 (ssin, scos) / 2.0; | |
105 | psi = psi * 180. / TMath::Pi(); | |
106 | ||
107 | return psi; | |
108 | ||
109 | } | |
110 | /*********************************************************/ | |
111 | ||
112 | void AliFlowAnalysis::GetFlow(AliAOD* aod,Double_t& v2,Double_t& psi) | |
113 | { | |
114 | //returns flow parameters: v2 and event plane | |
115 | if (aod == 0x0) | |
116 | { | |
117 | Error("AliFlowAnalysis::GetFlow","Pointer to AOD is NULL"); | |
118 | return; | |
119 | } | |
120 | ||
121 | psi = GetEventPlane(aod); | |
122 | Int_t mult = aod->GetNumberOfParticles(); | |
123 | ||
124 | Double_t ssin = 0, scos = 0; | |
125 | ||
126 | for (Int_t i=0; i<mult; i++) | |
127 | { | |
afa8b37b | 128 | AliVAODParticle* aodtrack = aod->GetParticle(i); |
a5556ea5 | 129 | if (aodtrack == 0x0) |
130 | { | |
131 | Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i); | |
132 | continue; | |
133 | } | |
134 | if (fPartCut) | |
cea0a066 | 135 | if (fPartCut->Rejected(aodtrack)) |
a5556ea5 | 136 | continue; |
137 | ||
138 | Double_t phi = TMath::Pi()+TMath::ATan2(-aodtrack->Py(),-aodtrack->Px()); | |
139 | ssin += TMath::Sin( 2.0 * (phi - psi)); | |
140 | scos += TMath::Cos( 2.0 * (phi - psi)); | |
141 | } | |
142 | ||
143 | v2 = TMath::Hypot(ssin,scos); | |
144 | } | |
145 | ||
146 | ||
147 | /*********************************************************/ | |
148 | ||
b26900d0 | 149 | Double_t AliFlowAnalysis::GetEventPlane(AliESD* esd) |
150 | { | |
151 | //returns event plane | |
e6577ac7 | 152 | if (esd == 0x0) |
153 | { | |
a5556ea5 | 154 | ::Error("AliFlowAnalysis::GetFlow","Pointer to ESD is NULL"); |
e6577ac7 | 155 | return -1.0; |
156 | } | |
157 | ||
b26900d0 | 158 | Double_t psi; |
159 | Int_t mult = esd->GetNumberOfTracks(); | |
160 | ||
161 | Double_t ssin = 0, scos = 0; | |
162 | ||
163 | for (Int_t i=0; i<mult; i++) | |
164 | { | |
165 | AliESDtrack* esdtrack = esd->GetTrack(i); | |
166 | if (esdtrack == 0x0) | |
167 | { | |
a5556ea5 | 168 | ::Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i); |
b26900d0 | 169 | continue; |
170 | } | |
171 | ||
172 | Double_t mom[3];//momentum | |
173 | esdtrack->GetPxPyPz(mom); | |
174 | Double_t phi = TMath::Pi()+TMath::ATan2(-mom[1],-mom[0]); | |
175 | ||
176 | ssin += TMath::Sin( 2.0 * phi ); | |
177 | scos += TMath::Cos( 2.0 * phi ); | |
178 | } | |
179 | ||
180 | psi = atan2 (ssin, scos) / 2.0; | |
181 | psi = psi * 180. / TMath::Pi(); | |
182 | ||
183 | return psi; | |
184 | ||
185 | } | |
a5556ea5 | 186 | /*********************************************************/ |
e6577ac7 | 187 | |
188 | void AliFlowAnalysis::GetFlow(AliESD* esd,Double_t& v2,Double_t& psi) | |
189 | { | |
190 | //returns flow parameters: v2 and event plane | |
191 | if (esd == 0x0) | |
192 | { | |
a5556ea5 | 193 | ::Error("AliFlowAnalysis::GetFlow","Pointer to ESD is NULL"); |
e6577ac7 | 194 | return; |
195 | } | |
196 | ||
197 | psi = GetEventPlane(esd); | |
198 | Int_t mult = esd->GetNumberOfTracks(); | |
199 | ||
200 | Double_t ssin = 0, scos = 0; | |
201 | ||
202 | for (Int_t i=0; i<mult; i++) | |
203 | { | |
204 | AliESDtrack* esdtrack = esd->GetTrack(i); | |
205 | if (esdtrack == 0x0) | |
206 | { | |
a5556ea5 | 207 | ::Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i); |
e6577ac7 | 208 | continue; |
209 | } | |
210 | ||
211 | Double_t mom[3];//momentum | |
212 | esdtrack->GetPxPyPz(mom); | |
213 | Double_t phi = TMath::Pi()+TMath::ATan2(-mom[1],-mom[0]); | |
214 | ||
215 | ssin += TMath::Sin( 2.0 * (phi - psi)); | |
216 | scos += TMath::Cos( 2.0 * (phi - psi)); | |
217 | } | |
218 | ||
219 | v2 = TMath::Hypot(ssin,scos); | |
220 | } | |
a5556ea5 | 221 | /*********************************************************/ |