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(Int_t aLenght):
43 fTrackCollection(NULL),
45 fEventNSelTracksIntFlow(0)
48 fTrackCollection = new TObjArray(aLenght) ;
51 //-----------------------------------------------------------------------
53 AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent):
55 fTrackCollection(anEvent.fTrackCollection),
56 fNumberOfTracks(anEvent.fNumberOfTracks),
57 fEventNSelTracksIntFlow(anEvent.fEventNSelTracksIntFlow)
62 //-----------------------------------------------------------------------
64 AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEvent)
66 *fTrackCollection = *anEvent.fTrackCollection ;
67 fNumberOfTracks = anEvent.fNumberOfTracks;
68 fEventNSelTracksIntFlow = anEvent.fEventNSelTracksIntFlow;
73 //-----------------------------------------------------------------------
75 AliFlowEventSimple::~AliFlowEventSimple()
78 fTrackCollection->Delete() ; delete fTrackCollection ;
81 //-----------------------------------------------------------------------
83 AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
85 //get track i from collection
86 AliFlowTrackSimple* pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i) ;
90 //-----------------------------------------------------------------------
91 AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights)
93 // calculate Q-vector in harmonic n without weights (default harmonic n=2)
100 Double_t iUsedTracks = 0;
105 AliFlowTrackSimple* pTrack = NULL;
108 Double_t dBinWidthPt=0.;
110 Double_t dBinWidthEta=0.;
113 Double_t wPhi=1.; // weight Phi
114 Double_t wPt=1.; // weight Pt
115 Double_t wEta=1.; // weight Eta
117 TH1F *phiWeights = NULL;
118 TH1D *ptWeights = NULL;
119 TH1D *etaWeights = NULL;
121 Double_t dSumOfWeightsToPower2 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 2)
122 Double_t dSumOfWeightsToPower3 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 3)
123 Double_t dSumOfWeightsToPower4 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 4)
124 Double_t dSumOfWeightsToPower5 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 5)
125 Double_t dSumOfWeightsToPower6 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 6)
126 Double_t dSumOfWeightsToPower7 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 7)
127 Double_t dSumOfWeightsToPower8 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 8)
133 phiWeights = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights"));
134 if(phiWeights) nBinsPhi = phiWeights->GetNbinsX();
138 ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights"));
141 dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width
142 dPtMin = (ptWeights->GetXaxis())->GetXmin();
147 etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights"));
150 dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width
151 dEtaMin = (etaWeights->GetXaxis())->GetXmin();
154 } // end of if(weightsList)
157 for(Int_t i=0;i<fNumberOfTracks;i++)
159 pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i);
162 if(pTrack->UseForIntegratedFlow())
164 dPhi = pTrack->Phi();
166 dEta = pTrack->Eta();
168 // determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement)
169 if(phiWeights && nBinsPhi)
171 wPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())));
173 // determine v'(pt) weight:
174 if(ptWeights && dBinWidthPt)
176 wPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
178 // determine v'(eta) weight:
179 if(etaWeights && dBinWidthEta)
181 wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
184 // building up the weighted Q-vector:
185 dQX += wPhi*wPt*wEta*TMath::Cos(iOrder*dPhi);
186 dQY += wPhi*wPt*wEta*TMath::Sin(iOrder*dPhi);
188 // weighted multiplicity:
189 iUsedTracks+=wPhi*wPt*wEta;
191 // weights raised to various powers are summed up:
192 dSumOfWeightsToPower2+=pow(wPhi*wPt*wEta, 2);
193 dSumOfWeightsToPower3+=pow(wPhi*wPt*wEta, 3);
194 dSumOfWeightsToPower4+=pow(wPhi*wPt*wEta, 4);
195 dSumOfWeightsToPower5+=pow(wPhi*wPt*wEta, 5);
196 dSumOfWeightsToPower6+=pow(wPhi*wPt*wEta, 6);
197 dSumOfWeightsToPower7+=pow(wPhi*wPt*wEta, 7);
198 dSumOfWeightsToPower8+=pow(wPhi*wPt*wEta, 8);
200 } // end of if (pTrack->UseForIntegratedFlow())
201 } // end of if (pTrack)
202 else {cerr << "no particle!!!"<<endl;}
203 } // loop over particles
206 vQ.SetMult(iUsedTracks);
207 vQ.SetSumOfWeightsToPower2(dSumOfWeightsToPower2);
208 vQ.SetSumOfWeightsToPower3(dSumOfWeightsToPower3);
209 vQ.SetSumOfWeightsToPower4(dSumOfWeightsToPower4);
210 vQ.SetSumOfWeightsToPower5(dSumOfWeightsToPower5);
211 vQ.SetSumOfWeightsToPower6(dSumOfWeightsToPower6);
212 vQ.SetSumOfWeightsToPower7(dSumOfWeightsToPower7);
213 vQ.SetSumOfWeightsToPower8(dSumOfWeightsToPower8);