1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #include "Riostream.h"
17 #include "TObjArray.h"
24 #include "AliFlowVector.h"
25 #include "AliFlowTrackSimple.h"
26 #include "AliFlowEventSimple.h"
28 /**************************************
29 * AliFlowEventSimple: A simple event *
32 * authors: Naomi van der Kolk *
36 * ***********************************/
38 ClassImp(AliFlowEventSimple)
40 //-----------------------------------------------------------------------
42 AliFlowEventSimple::AliFlowEventSimple():
43 fTrackCollection(NULL),
45 fEventNSelTracksIntFlow(0)
47 cout << "AliFlowEventSimple: Default constructor to be used only by root for io" << endl;
50 //-----------------------------------------------------------------------
52 AliFlowEventSimple::AliFlowEventSimple(Int_t aLenght):
53 fTrackCollection(NULL),
55 fEventNSelTracksIntFlow(0)
58 fTrackCollection = new TObjArray(aLenght) ;
61 //-----------------------------------------------------------------------
63 AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent):
65 fTrackCollection(anEvent.fTrackCollection),
66 fNumberOfTracks(anEvent.fNumberOfTracks),
67 fEventNSelTracksIntFlow(anEvent.fEventNSelTracksIntFlow)
72 //-----------------------------------------------------------------------
74 AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEvent)
76 *fTrackCollection = *anEvent.fTrackCollection ;
77 fNumberOfTracks = anEvent.fNumberOfTracks;
78 fEventNSelTracksIntFlow = anEvent.fEventNSelTracksIntFlow;
83 //-----------------------------------------------------------------------
85 AliFlowEventSimple::~AliFlowEventSimple()
88 if (fTrackCollection) {
89 fTrackCollection->Delete() ; delete fTrackCollection ;
92 cout << "AliFlowEventSimple: Warning trying to delete track collections NULL pointer" << endl;
96 //-----------------------------------------------------------------------
98 AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
100 //get track i from collection
101 AliFlowTrackSimple* pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i) ;
105 //-----------------------------------------------------------------------
106 AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights)
108 // calculate Q-vector in harmonic n without weights (default harmonic n=2)
115 Double_t iUsedTracks = 0;
120 AliFlowTrackSimple* pTrack = NULL;
123 Double_t dBinWidthPt=0.;
125 Double_t dBinWidthEta=0.;
128 Double_t wPhi=1.; // weight Phi
129 Double_t wPt=1.; // weight Pt
130 Double_t wEta=1.; // weight Eta
132 TH1F *phiWeights = NULL;
133 TH1D *ptWeights = NULL;
134 TH1D *etaWeights = NULL;
136 Double_t dSumOfWeightsToPower2 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 2)
137 Double_t dSumOfWeightsToPower3 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 3)
138 Double_t dSumOfWeightsToPower4 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 4)
139 Double_t dSumOfWeightsToPower5 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 5)
140 Double_t dSumOfWeightsToPower6 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 6)
141 Double_t dSumOfWeightsToPower7 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 7)
142 Double_t dSumOfWeightsToPower8 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 8)
148 phiWeights = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights"));
149 if(phiWeights) nBinsPhi = phiWeights->GetNbinsX();
153 ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights"));
156 dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width
157 dPtMin = (ptWeights->GetXaxis())->GetXmin();
162 etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights"));
165 dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width
166 dEtaMin = (etaWeights->GetXaxis())->GetXmin();
169 } // end of if(weightsList)
172 for(Int_t i=0;i<fNumberOfTracks;i++)
174 pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i);
177 if(pTrack->UseForIntegratedFlow())
179 dPhi = pTrack->Phi();
181 dEta = pTrack->Eta();
183 // determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement)
184 if(phiWeights && nBinsPhi)
186 wPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())));
188 // determine v'(pt) weight:
189 if(ptWeights && dBinWidthPt)
191 wPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
193 // determine v'(eta) weight:
194 if(etaWeights && dBinWidthEta)
196 wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
199 // building up the weighted Q-vector:
200 dQX += wPhi*wPt*wEta*TMath::Cos(iOrder*dPhi);
201 dQY += wPhi*wPt*wEta*TMath::Sin(iOrder*dPhi);
203 // weighted multiplicity:
204 iUsedTracks+=wPhi*wPt*wEta;
206 // weights raised to various powers are summed up:
207 dSumOfWeightsToPower2+=pow(wPhi*wPt*wEta, 2);
208 dSumOfWeightsToPower3+=pow(wPhi*wPt*wEta, 3);
209 dSumOfWeightsToPower4+=pow(wPhi*wPt*wEta, 4);
210 dSumOfWeightsToPower5+=pow(wPhi*wPt*wEta, 5);
211 dSumOfWeightsToPower6+=pow(wPhi*wPt*wEta, 6);
212 dSumOfWeightsToPower7+=pow(wPhi*wPt*wEta, 7);
213 dSumOfWeightsToPower8+=pow(wPhi*wPt*wEta, 8);
215 } // end of if (pTrack->UseForIntegratedFlow())
216 } // end of if (pTrack)
217 else {cerr << "no particle!!!"<<endl;}
218 } // loop over particles
221 vQ.SetMult(iUsedTracks);
222 vQ.SetSumOfWeightsToPower2(dSumOfWeightsToPower2);
223 vQ.SetSumOfWeightsToPower3(dSumOfWeightsToPower3);
224 vQ.SetSumOfWeightsToPower4(dSumOfWeightsToPower4);
225 vQ.SetSumOfWeightsToPower5(dSumOfWeightsToPower5);
226 vQ.SetSumOfWeightsToPower6(dSumOfWeightsToPower6);
227 vQ.SetSumOfWeightsToPower7(dSumOfWeightsToPower7);
228 vQ.SetSumOfWeightsToPower8(dSumOfWeightsToPower8);