]>
Commit | Line | Data |
---|---|---|
f1d945a1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
929098e4 | 16 | /***************************************************************** |
17 | AliFlowEventSimple: A simple event | |
18 | for flow analysis | |
19 | ||
20 | origin: Naomi van der Kolk (kolk@nikhef.nl) | |
21 | Ante Bilandzic (anteb@nikhef.nl) | |
22 | Raimond Snellings (Raimond.Snellings@nikhef.nl) | |
23 | mods: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch) | |
24 | *****************************************************************/ | |
25 | ||
f1d945a1 | 26 | #include "Riostream.h" |
27 | #include "TObjArray.h" | |
26c4cbb9 | 28 | #include "TFile.h" |
03a02aca | 29 | #include "TList.h" |
929098e4 | 30 | #include "TTree.h" |
31 | #include "TParticle.h" | |
f1d945a1 | 32 | #include "TMath.h" |
26c4cbb9 | 33 | #include "TH1F.h" |
34 | #include "TH1D.h" | |
bc231a12 | 35 | #include "TF1.h" |
26c4cbb9 | 36 | #include "TProfile.h" |
929098e4 | 37 | #include "TParameter.h" |
c076fda8 | 38 | #include "TBrowser.h" |
f1d945a1 | 39 | #include "AliFlowVector.h" |
40 | #include "AliFlowTrackSimple.h" | |
929098e4 | 41 | #include "AliFlowTrackSimpleCuts.h" |
701f71c1 | 42 | #include "AliFlowEventSimple.h" |
7382279b | 43 | #include "TRandom.h" |
f1d945a1 | 44 | |
f1d945a1 | 45 | ClassImp(AliFlowEventSimple) |
46 | ||
47 | //----------------------------------------------------------------------- | |
46bec39c | 48 | AliFlowEventSimple::AliFlowEventSimple(): |
49 | fTrackCollection(NULL), | |
85d2ee8d | 50 | fReferenceMultiplicity(0), |
46bec39c | 51 | fNumberOfTracks(0), |
bc231a12 | 52 | fNumberOfRPs(0), |
7183fe85 | 53 | fMCReactionPlaneAngle(0.), |
929098e4 | 54 | fMCReactionPlaneAngleIsSet(kFALSE), |
bc231a12 | 55 | fAfterBurnerPrecision(0.001), |
9fa64edc | 56 | fUserModified(kFALSE), |
c076fda8 | 57 | fNumberOfTracksWrap(NULL), |
bc231a12 | 58 | fNumberOfRPsWrap(NULL), |
a12990bb | 59 | fMCReactionPlaneAngleWrap(NULL) |
46bec39c | 60 | { |
61 | cout << "AliFlowEventSimple: Default constructor to be used only by root for io" << endl; | |
62 | } | |
63 | ||
64 | //----------------------------------------------------------------------- | |
9fa64edc | 65 | AliFlowEventSimple::AliFlowEventSimple( Int_t n, |
66 | ConstructionMethod method, | |
bc231a12 | 67 | TF1* ptDist, |
68 | Double_t phiMin, | |
69 | Double_t phiMax, | |
70 | Double_t etaMin, | |
71 | Double_t etaMax): | |
9fa64edc | 72 | fTrackCollection(new TObjArray(n)), |
73 | fReferenceMultiplicity(n), | |
bc231a12 | 74 | fNumberOfTracks(0), |
75 | fNumberOfRPs(0), | |
76 | fMCReactionPlaneAngle(0.), | |
77 | fMCReactionPlaneAngleIsSet(kFALSE), | |
78 | fAfterBurnerPrecision(0.001), | |
9fa64edc | 79 | fUserModified(kFALSE), |
bc231a12 | 80 | fNumberOfTracksWrap(NULL), |
81 | fNumberOfRPsWrap(NULL), | |
82 | fMCReactionPlaneAngleWrap(NULL) | |
83 | { | |
9fa64edc | 84 | //ctor |
85 | // if second argument is set to AliFlowEventSimple::kGenerate | |
86 | // it generates n random tracks with given Pt distribution | |
87 | // (a sane default is provided), phi and eta are uniform | |
88 | ||
89 | if (method==kGenerate) | |
90 | Generate(n,ptDist,phiMin,phiMax,etaMin,etaMax); | |
f1d945a1 | 91 | } |
92 | ||
93 | //----------------------------------------------------------------------- | |
e35ddff0 | 94 | AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent): |
bc231a12 | 95 | TObject(anEvent), |
96 | fTrackCollection((TObjArray*)(anEvent.fTrackCollection)->Clone()), | |
85d2ee8d | 97 | fReferenceMultiplicity(anEvent.fReferenceMultiplicity), |
e35ddff0 | 98 | fNumberOfTracks(anEvent.fNumberOfTracks), |
bc231a12 | 99 | fNumberOfRPs(anEvent.fNumberOfRPs), |
a12990bb | 100 | fMCReactionPlaneAngle(anEvent.fMCReactionPlaneAngle), |
929098e4 | 101 | fMCReactionPlaneAngleIsSet(anEvent.fMCReactionPlaneAngleIsSet), |
bc231a12 | 102 | fAfterBurnerPrecision(anEvent.fAfterBurnerPrecision), |
9fa64edc | 103 | fUserModified(anEvent.fUserModified), |
c076fda8 | 104 | fNumberOfTracksWrap(anEvent.fNumberOfTracksWrap), |
bc231a12 | 105 | fNumberOfRPsWrap(anEvent.fNumberOfRPsWrap), |
a12990bb | 106 | fMCReactionPlaneAngleWrap(anEvent.fMCReactionPlaneAngleWrap) |
f1d945a1 | 107 | { |
929098e4 | 108 | //copy constructor |
f1d945a1 | 109 | } |
110 | ||
111 | //----------------------------------------------------------------------- | |
e35ddff0 | 112 | AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEvent) |
f1d945a1 | 113 | { |
124fb262 | 114 | //assignment operator |
701f71c1 | 115 | if (fTrackCollection) fTrackCollection->Delete(); |
124fb262 | 116 | delete fTrackCollection; |
bc231a12 | 117 | fTrackCollection = (TObjArray*)(anEvent.fTrackCollection)->Clone(); //deep copy |
85d2ee8d | 118 | fReferenceMultiplicity = anEvent.fReferenceMultiplicity; |
e35ddff0 | 119 | fNumberOfTracks = anEvent.fNumberOfTracks; |
bc231a12 | 120 | fNumberOfRPs = anEvent.fNumberOfRPs; |
a12990bb | 121 | fMCReactionPlaneAngle = anEvent.fMCReactionPlaneAngle; |
929098e4 | 122 | fMCReactionPlaneAngleIsSet = anEvent.fMCReactionPlaneAngleIsSet; |
bc231a12 | 123 | fAfterBurnerPrecision = anEvent.fAfterBurnerPrecision; |
9fa64edc | 124 | fUserModified=anEvent.fUserModified; |
929098e4 | 125 | fNumberOfTracksWrap = anEvent.fNumberOfTracksWrap; |
bc231a12 | 126 | fNumberOfRPsWrap = anEvent.fNumberOfRPsWrap; |
a12990bb | 127 | fMCReactionPlaneAngleWrap=anEvent.fMCReactionPlaneAngleWrap; |
f1d945a1 | 128 | return *this; |
f1d945a1 | 129 | } |
130 | ||
929098e4 | 131 | //----------------------------------------------------------------------- |
f1d945a1 | 132 | AliFlowEventSimple::~AliFlowEventSimple() |
133 | { | |
134 | //destructor | |
929098e4 | 135 | if (fTrackCollection) fTrackCollection->Delete(); |
136 | delete fTrackCollection; | |
c076fda8 | 137 | if (fNumberOfTracksWrap) delete fNumberOfTracksWrap; |
bc231a12 | 138 | if (fNumberOfRPsWrap) delete fNumberOfRPsWrap; |
a12990bb | 139 | if (fMCReactionPlaneAngleWrap) delete fMCReactionPlaneAngleWrap; |
f1d945a1 | 140 | } |
141 | ||
bc231a12 | 142 | //----------------------------------------------------------------------- |
143 | void AliFlowEventSimple::Generate(Int_t nParticles, | |
6e027e29 | 144 | TF1* ptDist, |
145 | Double_t phiMin, | |
146 | Double_t phiMax, | |
147 | Double_t etaMin, | |
148 | Double_t etaMax) | |
bc231a12 | 149 | { |
150 | //generate nParticles random tracks uniform in phi and eta | |
151 | //according to the specified pt distribution | |
6e027e29 | 152 | if (!ptDist) |
153 | { | |
154 | static TF1 ptdistribution("ptSpectra","x*TMath::Exp(-pow(0.13957*0.13957+x*x,0.5)/0.4)",0.1,10.); | |
155 | ptDist=&ptdistribution; | |
156 | } | |
9fa64edc | 157 | |
bc231a12 | 158 | for (Int_t i=0; i<nParticles; i++) |
159 | { | |
701f71c1 | 160 | AliFlowTrackSimple* track = new AliFlowTrackSimple(); |
161 | track->SetPhi( gRandom->Uniform(phiMin,phiMax) ); | |
162 | track->SetEta( gRandom->Uniform(etaMin,etaMax) ); | |
163 | track->SetPt( ptDist->GetRandom() ); | |
164 | track->SetCharge( (gRandom->Uniform()-0.5<0)?-1:1 ); | |
165 | AddTrack(track); | |
bc231a12 | 166 | } |
6e027e29 | 167 | fMCReactionPlaneAngle=gRandom->Uniform(0.0,TMath::TwoPi()); |
9fa64edc | 168 | fMCReactionPlaneAngleIsSet=kTRUE; |
169 | SetUserModified(); | |
bc231a12 | 170 | } |
171 | ||
929098e4 | 172 | //----------------------------------------------------------------------- |
f1d945a1 | 173 | AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i) |
174 | { | |
175 | //get track i from collection | |
7382279b | 176 | if (i>=fNumberOfTracks) return NULL; |
124fb262 | 177 | AliFlowTrackSimple* pTrack = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)) ; |
e35ddff0 | 178 | return pTrack; |
f1d945a1 | 179 | } |
180 | ||
7382279b | 181 | //----------------------------------------------------------------------- |
182 | void AliFlowEventSimple::AddTrack( AliFlowTrackSimple* track ) | |
183 | { | |
184 | //add a track | |
7382279b | 185 | fTrackCollection->AddLast(track); |
186 | fNumberOfTracks++; | |
187 | } | |
188 | ||
929098e4 | 189 | //----------------------------------------------------------------------- |
190 | AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights) | |
f1d945a1 | 191 | { |
929098e4 | 192 | // calculate Q-vector in harmonic n without weights (default harmonic n=2) |
e35ddff0 | 193 | Double_t dQX = 0.; |
194 | Double_t dQY = 0.; | |
195 | AliFlowVector vQ; | |
196 | vQ.Set(0.,0.); | |
929098e4 | 197 | |
9825d4a9 | 198 | Int_t iOrder = n; |
ae733b3b | 199 | Double_t iUsedTracks = 0; |
44e060e0 | 200 | Double_t dPhi = 0.; |
201 | Double_t dPt = 0.; | |
202 | Double_t dEta = 0.; | |
203 | Double_t dWeight = 1.; | |
929098e4 | 204 | |
26c4cbb9 | 205 | AliFlowTrackSimple* pTrack = NULL; |
929098e4 | 206 | |
44e060e0 | 207 | Int_t nBinsPhi = 0; |
208 | Double_t dBinWidthPt = 0.; | |
209 | Double_t dPtMin = 0.; | |
210 | Double_t dBinWidthEta = 0.; | |
211 | Double_t dEtaMin = 0.; | |
929098e4 | 212 | |
44e060e0 | 213 | Double_t wPhi = 1.; // weight Phi |
214 | Double_t wPt = 1.; // weight Pt | |
215 | Double_t wEta = 1.; // weight Eta | |
929098e4 | 216 | |
03a02aca | 217 | TH1F *phiWeights = NULL; |
ae733b3b | 218 | TH1D *ptWeights = NULL; |
03a02aca | 219 | TH1D *etaWeights = NULL; |
929098e4 | 220 | |
03a02aca | 221 | if(weightsList) |
26c4cbb9 | 222 | { |
929098e4 | 223 | if(usePhiWeights) |
224 | { | |
225 | phiWeights = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights")); | |
226 | if(phiWeights) nBinsPhi = phiWeights->GetNbinsX(); | |
227 | } | |
228 | if(usePtWeights) | |
03a02aca | 229 | { |
929098e4 | 230 | ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights")); |
231 | if(ptWeights) | |
232 | { | |
233 | dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width | |
234 | dPtMin = (ptWeights->GetXaxis())->GetXmin(); | |
235 | } | |
236 | } | |
237 | if(useEtaWeights) | |
03a02aca | 238 | { |
929098e4 | 239 | etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights")); |
240 | if(etaWeights) | |
241 | { | |
242 | dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width | |
243 | dEtaMin = (etaWeights->GetXaxis())->GetXmin(); | |
244 | } | |
245 | } | |
03a02aca | 246 | } // end of if(weightsList) |
929098e4 | 247 | |
248 | // loop over tracks | |
249 | for(Int_t i=0; i<fNumberOfTracks; i++) | |
26c4cbb9 | 250 | { |
124fb262 | 251 | pTrack = (AliFlowTrackSimple*)fTrackCollection->At(i); |
929098e4 | 252 | if(pTrack) |
f1d945a1 | 253 | { |
929098e4 | 254 | if(pTrack->InRPSelection()) |
255 | { | |
256 | dPhi = pTrack->Phi(); | |
257 | dPt = pTrack->Pt(); | |
258 | dEta = pTrack->Eta(); | |
701f71c1 | 259 | dWeight = pTrack->Weight(); |
929098e4 | 260 | |
261 | // determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement) | |
262 | if(phiWeights && nBinsPhi) | |
263 | { | |
264 | wPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi()))); | |
265 | } | |
266 | // determine v'(pt) weight: | |
267 | if(ptWeights && dBinWidthPt) | |
268 | { | |
269 | wPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt))); | |
270 | } | |
271 | // determine v'(eta) weight: | |
272 | if(etaWeights && dBinWidthEta) | |
273 | { | |
274 | wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta))); | |
275 | } | |
276 | ||
277 | // building up the weighted Q-vector: | |
44e060e0 | 278 | dQX += dWeight*wPhi*wPt*wEta*TMath::Cos(iOrder*dPhi); |
279 | dQY += dWeight*wPhi*wPt*wEta*TMath::Sin(iOrder*dPhi); | |
929098e4 | 280 | |
281 | // weighted multiplicity: | |
44e060e0 | 282 | iUsedTracks += dWeight*wPhi*wPt*wEta; |
929098e4 | 283 | |
284 | } // end of if (pTrack->InRPSelection()) | |
285 | } // end of if (pTrack) | |
286 | else | |
287 | { | |
288 | cerr << "no particle!!!"<<endl; | |
289 | } | |
ae733b3b | 290 | } // loop over particles |
929098e4 | 291 | |
e35ddff0 | 292 | vQ.Set(dQX,dQY); |
293 | vQ.SetMult(iUsedTracks); | |
929098e4 | 294 | |
e35ddff0 | 295 | return vQ; |
929098e4 | 296 | |
5fef318d | 297 | } |
298 | ||
929098e4 | 299 | //----------------------------------------------------------------------- |
300 | void AliFlowEventSimple::Get2Qsub(AliFlowVector* Qarray, Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights) | |
395fadba | 301 | { |
929098e4 | 302 | |
303 | // calculate Q-vector in harmonic n without weights (default harmonic n=2) | |
395fadba | 304 | Double_t dQX = 0.; |
305 | Double_t dQY = 0.; | |
929098e4 | 306 | |
395fadba | 307 | Int_t iOrder = n; |
308 | Double_t iUsedTracks = 0; | |
309 | Double_t dPhi = 0.; | |
310 | Double_t dPt = 0.; | |
311 | Double_t dEta = 0.; | |
44e060e0 | 312 | Double_t dWeight = 1.; |
929098e4 | 313 | |
395fadba | 314 | AliFlowTrackSimple* pTrack = NULL; |
929098e4 | 315 | |
44e060e0 | 316 | Int_t iNbinsPhiSub0 = 0; |
317 | Int_t iNbinsPhiSub1 = 0; | |
395fadba | 318 | Double_t dBinWidthPt = 0.; |
319 | Double_t dPtMin = 0.; | |
320 | Double_t dBinWidthEta= 0.; | |
321 | Double_t dEtaMin = 0.; | |
929098e4 | 322 | |
323 | Double_t dWphi = 1.; // weight Phi | |
324 | Double_t dWpt = 1.; // weight Pt | |
325 | Double_t dWeta = 1.; // weight Eta | |
326 | ||
44e060e0 | 327 | TH1F* phiWeightsSub0 = NULL; |
328 | TH1F* phiWeightsSub1 = NULL; | |
29195b69 | 329 | TH1D* ptWeights = NULL; |
330 | TH1D* etaWeights = NULL; | |
929098e4 | 331 | |
332 | if(weightsList) | |
333 | { | |
334 | if(usePhiWeights) | |
335 | { | |
44e060e0 | 336 | phiWeightsSub0 = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights_sub0")); |
44e060e0 | 337 | if(phiWeightsSub0) { |
13ff9ccd | 338 | iNbinsPhiSub0 = phiWeightsSub0->GetNbinsX(); |
44e060e0 | 339 | } |
13ff9ccd | 340 | phiWeightsSub1 = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights_sub1")); |
44e060e0 | 341 | if(phiWeightsSub1) { |
13ff9ccd | 342 | iNbinsPhiSub1 = phiWeightsSub1->GetNbinsX(); |
29195b69 | 343 | } |
929098e4 | 344 | } |
345 | if(usePtWeights) | |
346 | { | |
29195b69 | 347 | ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights")); |
929098e4 | 348 | if(ptWeights) |
349 | { | |
350 | dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width | |
351 | dPtMin = (ptWeights->GetXaxis())->GetXmin(); | |
352 | } | |
353 | } | |
354 | if(useEtaWeights) | |
355 | { | |
356 | etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights")); | |
357 | if(etaWeights) | |
358 | { | |
359 | dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width | |
360 | dEtaMin = (etaWeights->GetXaxis())->GetXmin(); | |
361 | } | |
362 | } | |
395fadba | 363 | } // end of if(weightsList) |
929098e4 | 364 | |
b125a454 | 365 | //loop over the two subevents |
929098e4 | 366 | for (Int_t s=0; s<2; s++) |
367 | { | |
368 | // loop over tracks | |
369 | for(Int_t i=0; i<fNumberOfTracks; i++) | |
370 | { | |
124fb262 | 371 | pTrack = (AliFlowTrackSimple*)fTrackCollection->At(i); |
929098e4 | 372 | if(pTrack) |
373 | { | |
374 | if(pTrack->InRPSelection()) | |
375 | { | |
376 | if (pTrack->InSubevent(s)) | |
377 | { | |
44e060e0 | 378 | dPhi = pTrack->Phi(); |
379 | dPt = pTrack->Pt(); | |
380 | dEta = pTrack->Eta(); | |
381 | dWeight = pTrack->Weight(); | |
929098e4 | 382 | |
383 | // determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement) | |
13ff9ccd | 384 | //subevent 0 |
385 | if(s == 0) { | |
386 | if(phiWeightsSub0 && iNbinsPhiSub0) { | |
387 | Int_t phiBin = 1+(Int_t)(TMath::Floor(dPhi*iNbinsPhiSub0/TMath::TwoPi())); | |
388 | //use the phi value at the center of the bin | |
389 | dPhi = phiWeightsSub0->GetBinCenter(phiBin); | |
390 | dWphi = phiWeightsSub0->GetBinContent(phiBin); | |
391 | } | |
392 | } | |
393 | //subevent 1 | |
394 | else if (s == 1) { | |
395 | if(phiWeightsSub1 && iNbinsPhiSub1) { | |
396 | Int_t phiBin = 1+(Int_t)(TMath::Floor(dPhi*iNbinsPhiSub1/TMath::TwoPi())); | |
397 | //use the phi value at the center of the bin | |
398 | dPhi = phiWeightsSub1->GetBinCenter(phiBin); | |
399 | dWphi = phiWeightsSub1->GetBinContent(phiBin); | |
44e060e0 | 400 | } |
401 | } | |
13ff9ccd | 402 | |
929098e4 | 403 | // determine v'(pt) weight: |
404 | if(ptWeights && dBinWidthPt) | |
405 | { | |
406 | dWpt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt))); | |
407 | } | |
44e060e0 | 408 | |
929098e4 | 409 | // determine v'(eta) weight: |
410 | if(etaWeights && dBinWidthEta) | |
411 | { | |
412 | dWeta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta))); | |
413 | } | |
414 | ||
415 | // building up the weighted Q-vector: | |
44e060e0 | 416 | dQX += dWeight*dWphi*dWpt*dWeta*TMath::Cos(iOrder*dPhi); |
417 | dQY += dWeight*dWphi*dWpt*dWeta*TMath::Sin(iOrder*dPhi); | |
929098e4 | 418 | |
419 | // weighted multiplicity: | |
44e060e0 | 420 | iUsedTracks+=dWeight*dWphi*dWpt*dWeta; |
929098e4 | 421 | |
422 | } // end of subevent | |
423 | } // end of if (pTrack->InRPSelection()) | |
29195b69 | 424 | } // end of if (pTrack) |
929098e4 | 425 | else |
426 | { | |
427 | cerr << "no particle!!!"<<endl; | |
428 | } | |
29195b69 | 429 | } // loop over particles |
430 | Qarray[s].Set(dQX,dQY); | |
431 | Qarray[s].SetMult(iUsedTracks); | |
432 | //reset | |
433 | iUsedTracks = 0; | |
434 | dQX = 0.; | |
435 | dQY = 0.; | |
436 | } | |
929098e4 | 437 | |
395fadba | 438 | } |
439 | ||
440 | ||
929098e4 | 441 | //----------------------------------------------------------------------- |
c076fda8 | 442 | void AliFlowEventSimple::Print(Option_t *option) const |
443 | { | |
444 | // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-* | |
445 | // =============================================== | |
446 | // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights()); | |
f873707d | 447 | printf( "Class.Print Name = %s, #tracks= %d, Number of RPs= %d, MC EventPlaneAngle= %f\n", |
bc231a12 | 448 | GetName(),fNumberOfTracks, fNumberOfRPs, fMCReactionPlaneAngle ); |
c076fda8 | 449 | |
b4dba88d | 450 | TString optionstr(option); |
451 | if (!optionstr.Contains("all")) return; | |
929098e4 | 452 | if (fTrackCollection) |
453 | { | |
c076fda8 | 454 | fTrackCollection->Print(option); |
455 | } | |
929098e4 | 456 | else |
457 | { | |
c076fda8 | 458 | printf( "Empty track collection \n"); |
459 | } | |
460 | } | |
461 | ||
929098e4 | 462 | //----------------------------------------------------------------------- |
463 | void AliFlowEventSimple::Browse(TBrowser *b) | |
c076fda8 | 464 | { |
465 | if (!b) return; | |
929098e4 | 466 | if (!fNumberOfTracksWrap) |
467 | { | |
c076fda8 | 468 | fNumberOfTracksWrap = new TParameter<int>("fNumberOfTracks", fNumberOfTracks); |
469 | b->Add(fNumberOfTracksWrap); | |
470 | } | |
bc231a12 | 471 | if (!fNumberOfRPsWrap) |
929098e4 | 472 | { |
bc231a12 | 473 | fNumberOfRPsWrap = new TParameter<int>("fNumberOfRPs", fNumberOfRPs); |
474 | b->Add(fNumberOfRPsWrap); | |
c076fda8 | 475 | } |
929098e4 | 476 | if (!fMCReactionPlaneAngleWrap) |
477 | { | |
7183fe85 | 478 | fMCReactionPlaneAngleWrap = new TParameter<double>(" fMCReactionPlaneAngle", fMCReactionPlaneAngle); |
a12990bb | 479 | b->Add( fMCReactionPlaneAngleWrap); |
480 | } | |
c076fda8 | 481 | if (fTrackCollection) b->Add(fTrackCollection,"AliFlowTracksSimple"); |
482 | } | |
483 | ||
929098e4 | 484 | //----------------------------------------------------------------------- |
485 | AliFlowEventSimple::AliFlowEventSimple( TTree* inputTree, | |
486 | const AliFlowTrackSimpleCuts* rpCuts, | |
487 | const AliFlowTrackSimpleCuts* poiCuts): | |
488 | fTrackCollection(NULL), | |
85d2ee8d | 489 | fReferenceMultiplicity(0), |
929098e4 | 490 | fNumberOfTracks(0), |
bc231a12 | 491 | fNumberOfRPs(0), |
929098e4 | 492 | fMCReactionPlaneAngle(0.), |
493 | fMCReactionPlaneAngleIsSet(kFALSE), | |
bc231a12 | 494 | fAfterBurnerPrecision(0.001), |
9fa64edc | 495 | fUserModified(kFALSE), |
929098e4 | 496 | fNumberOfTracksWrap(NULL), |
bc231a12 | 497 | fNumberOfRPsWrap(NULL), |
929098e4 | 498 | fMCReactionPlaneAngleWrap(NULL) |
499 | { | |
500 | //constructor, fills the event from a TTree of kinematic.root files | |
501 | //applies RP and POI cuts, tags the tracks | |
502 | ||
503 | Int_t numberOfInputTracks = inputTree->GetEntries() ; | |
504 | fTrackCollection = new TObjArray(numberOfInputTracks/2); | |
505 | ||
506 | TParticle* pParticle = new TParticle(); | |
507 | inputTree->SetBranchAddress("Particles",&pParticle); | |
508 | ||
509 | Int_t iSelParticlesPOI = 0; | |
510 | ||
511 | for (Int_t i=0; i<numberOfInputTracks; i++) | |
512 | { | |
513 | inputTree->GetEntry(i); //get input particle | |
514 | ||
515 | if (!pParticle) continue; //no particle | |
516 | if (!pParticle->IsPrimary()) continue; | |
517 | ||
7382279b | 518 | Bool_t rpOK = rpCuts->PassesCuts(pParticle); |
519 | Bool_t poiOK = poiCuts->PassesCuts(pParticle); | |
929098e4 | 520 | |
7382279b | 521 | if (rpOK || poiOK) |
929098e4 | 522 | { |
523 | AliFlowTrackSimple* pTrack = new AliFlowTrackSimple(pParticle); | |
524 | ||
525 | //marking the particles used for int. flow: | |
7382279b | 526 | if(rpOK) |
929098e4 | 527 | { |
528 | pTrack->SetForRPSelection(kTRUE); | |
bc231a12 | 529 | fNumberOfRPs++; |
929098e4 | 530 | } |
531 | //marking the particles used for diff. flow: | |
7382279b | 532 | if(poiOK) |
929098e4 | 533 | { |
534 | pTrack->SetForPOISelection(kTRUE); | |
535 | iSelParticlesPOI++; | |
536 | } | |
537 | //adding a particles which were used either for int. or diff. flow to the list | |
124fb262 | 538 | AddTrack(pTrack); |
929098e4 | 539 | } |
540 | }//for i | |
541 | delete pParticle; | |
542 | } | |
543 | ||
544 | //_____________________________________________________________________________ | |
545 | void AliFlowEventSimple::CloneTracks(Int_t n) | |
546 | { | |
547 | //clone every track n times to add non-flow | |
34b15925 | 548 | if (n<=0) return; //no use to clone stuff zero or less times |
bc231a12 | 549 | Int_t ntracks = fNumberOfTracks; |
550 | fTrackCollection->Expand((n+1)*fNumberOfTracks); | |
551 | for (Int_t i=0; i<n; i++) | |
929098e4 | 552 | { |
bc231a12 | 553 | for (Int_t itrack=0; itrack<ntracks; itrack++) |
929098e4 | 554 | { |
555 | AliFlowTrackSimple* track = dynamic_cast<AliFlowTrackSimple*>(fTrackCollection->At(itrack)); | |
556 | if (!track) continue; | |
bc231a12 | 557 | AddTrack(static_cast<AliFlowTrackSimple*>(track->Clone())); |
929098e4 | 558 | } |
559 | } | |
9fa64edc | 560 | SetUserModified(); |
929098e4 | 561 | } |
7382279b | 562 | |
563 | //_____________________________________________________________________________ | |
564 | void AliFlowEventSimple::ResolutionPt(Double_t res) | |
565 | { | |
566 | //smear pt of all tracks by gaussian with sigma=res | |
567 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
568 | { | |
569 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
124fb262 | 570 | if (track) track->ResolutionPt(res); |
7382279b | 571 | } |
9fa64edc | 572 | SetUserModified(); |
7382279b | 573 | } |
124fb262 | 574 | |
575 | //_____________________________________________________________________________ | |
34b15925 | 576 | void AliFlowEventSimple::TagSubeventsInEta( Double_t etaMinA, |
577 | Double_t etaMaxA, | |
578 | Double_t etaMinB, | |
579 | Double_t etaMaxB ) | |
124fb262 | 580 | { |
581 | //Flag two subevents in given eta ranges | |
582 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
583 | { | |
584 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
585 | Double_t eta=track->Eta(); | |
586 | if (eta >= etaMinA && eta <= etaMaxA) track->SetForSubevent(0); | |
587 | if (eta >= etaMinB && eta <= etaMaxB) track->SetForSubevent(1); | |
588 | } | |
589 | } | |
590 | ||
bc231a12 | 591 | //_____________________________________________________________________________ |
34b15925 | 592 | void AliFlowEventSimple::AddV1( Double_t v1 ) |
bc231a12 | 593 | { |
594 | //add v2 to all tracks wrt the reaction plane angle | |
595 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
596 | { | |
597 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
598 | if (track) track->AddV1(v1, fMCReactionPlaneAngle, fAfterBurnerPrecision); | |
599 | } | |
9fa64edc | 600 | SetUserModified(); |
bc231a12 | 601 | } |
602 | ||
124fb262 | 603 | //_____________________________________________________________________________ |
34b15925 | 604 | void AliFlowEventSimple::AddV2( Double_t v2 ) |
124fb262 | 605 | { |
244c607a | 606 | //add v2 to all tracks wrt the reaction plane angle |
124fb262 | 607 | for (Int_t i=0; i<fNumberOfTracks; i++) |
608 | { | |
609 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
bc231a12 | 610 | if (track) track->AddV2(v2, fMCReactionPlaneAngle, fAfterBurnerPrecision); |
611 | } | |
9fa64edc | 612 | SetUserModified(); |
bc231a12 | 613 | } |
614 | ||
615 | //_____________________________________________________________________________ | |
54089829 | 616 | void AliFlowEventSimple::AddV3( Double_t v3 ) |
617 | { | |
618 | //add v3 to all tracks wrt the reaction plane angle | |
619 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
620 | { | |
621 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
622 | if (track) track->AddV3(v3, fMCReactionPlaneAngle, fAfterBurnerPrecision); | |
623 | } | |
624 | SetUserModified(); | |
625 | } | |
626 | ||
627 | //_____________________________________________________________________________ | |
34b15925 | 628 | void AliFlowEventSimple::AddV4( Double_t v4 ) |
bc231a12 | 629 | { |
630 | //add v4 to all tracks wrt the reaction plane angle | |
631 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
632 | { | |
633 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
634 | if (track) track->AddV4(v4, fMCReactionPlaneAngle, fAfterBurnerPrecision); | |
635 | } | |
9fa64edc | 636 | SetUserModified(); |
bc231a12 | 637 | } |
638 | ||
639 | //_____________________________________________________________________________ | |
bff213ad | 640 | void AliFlowEventSimple::AddFlow( Double_t v1, Double_t v2, Double_t v3, Double_t v4 ) |
bc231a12 | 641 | { |
642 | //add flow to all tracks wrt the reaction plane angle | |
643 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
644 | { | |
645 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
bff213ad | 646 | if (track) track->AddFlow(v1,v2,v3,v4,fMCReactionPlaneAngle, fAfterBurnerPrecision); |
124fb262 | 647 | } |
9fa64edc | 648 | SetUserModified(); |
124fb262 | 649 | } |
650 | ||
dd91b595 | 651 | //_____________________________________________________________________________ |
34b15925 | 652 | void AliFlowEventSimple::TagRP( AliFlowTrackSimpleCuts* cuts ) |
dd91b595 | 653 | { |
654 | //tag tracks as reference particles (RPs) | |
655 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
656 | { | |
657 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
658 | if (!track) continue; | |
701f71c1 | 659 | Bool_t pass=cuts->PassesCuts(track); |
e0da66a2 | 660 | Bool_t rpTrack=track->InRPSelection(); |
701f71c1 | 661 | if (pass) |
e0da66a2 | 662 | { |
663 | if (!rpTrack) fNumberOfRPs++; //only increase if not already tagged | |
664 | } | |
701f71c1 | 665 | else |
e0da66a2 | 666 | { |
667 | if (rpTrack) fNumberOfRPs--; //only decrease if detagging | |
668 | } | |
669 | track->SetForRPSelection(pass); | |
dd91b595 | 670 | } |
671 | } | |
672 | ||
673 | //_____________________________________________________________________________ | |
34b15925 | 674 | void AliFlowEventSimple::TagPOI( AliFlowTrackSimpleCuts* cuts ) |
dd91b595 | 675 | { |
676 | //tag tracks as particles of interest (POIs) | |
677 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
678 | { | |
679 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
680 | if (!track) continue; | |
701f71c1 | 681 | Bool_t pass=cuts->PassesCuts(track); |
682 | track->SetForPOISelection(pass); | |
dd91b595 | 683 | } |
684 | } | |
685 | ||
34b15925 | 686 | //_____________________________________________________________________________ |
687 | void AliFlowEventSimple::DefineDeadZone( Double_t etaMin, | |
688 | Double_t etaMax, | |
689 | Double_t phiMin, | |
690 | Double_t phiMax ) | |
691 | { | |
692 | //mark tracks in given eta-phi region as dead | |
693 | //by resetting the flow bits | |
694 | for (Int_t i=0; i<fNumberOfTracks; i++) | |
695 | { | |
696 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
697 | Double_t eta = track->Eta(); | |
698 | Double_t phi = track->Phi(); | |
699 | if (eta>etaMin && eta<etaMax && phi>phiMin && phi<phiMax) | |
1a43aca9 | 700 | { |
701 | if (track->InRPSelection()) fNumberOfRPs--; | |
34b15925 | 702 | track->ResetFlowTags(); |
1a43aca9 | 703 | } |
34b15925 | 704 | } |
705 | } | |
706 | ||
707 | //_____________________________________________________________________________ | |
708 | Int_t AliFlowEventSimple::CleanUpDeadTracks() | |
709 | { | |
710 | //remove tracks that have no flow tags set and cleanup the container | |
65ef7d1a | 711 | //returns number of cleaned tracks |
712 | Int_t ncleaned=0; | |
34b15925 | 713 | for (Int_t i=0; i<fNumberOfTracks; i++) |
714 | { | |
715 | AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)); | |
65ef7d1a | 716 | if (track->IsDead()) {delete track;ncleaned++;} |
34b15925 | 717 | } |
718 | fTrackCollection->Compress(); //clean up empty slots | |
65ef7d1a | 719 | return ncleaned; |
34b15925 | 720 | } |