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 Int_t iUsedTracks = 0;
105 AliFlowTrackSimple* pTrack = NULL;
108 Double_t dBinWidthPt=0.;
110 Double_t dBinWidthEta=0.;
111 Double_t dNormEta=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;
125 phiWeights = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights"));
126 if(phiWeights) nBinsPhi = phiWeights->GetNbinsX();
130 ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights"));
133 dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width
134 dNormPt = ptWeights->Integral();
139 etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights"));
142 dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width
143 dNormEta = etaWeights->Integral();
146 } // end of if(weightsList)
150 for(Int_t i=0;i<fNumberOfTracks;i++)
152 pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i);
155 if(pTrack->UseForIntegratedFlow())
157 dPhi = pTrack->Phi();
159 dEta = pTrack->Eta();
161 //determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement)
162 if(phiWeights && (nBinsPhi!=0) && (phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())))!=0))
164 wPhi=pow(nBinsPhi*phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi()))),-1);
166 //determine v'(pt) weight:
167 if(ptWeights && dBinWidthPt && dNormPt)
169 wPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPt/dBinWidthPt)))/dNormPt;
171 //determine v'(eta) weight:
172 if(etaWeights && dBinWidthEta && dNormEta)
174 wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor(dEta/dBinWidthEta)))/dNormEta;
177 //building up the weighted Q-vector:
178 dQX += wPhi*wPt*wEta*TMath::Cos(iOrder*dPhi);
179 dQY += wPhi*wPt*wEta*TMath::Sin(iOrder*dPhi);
182 }//end of if (pTrack->UseForIntegratedFlow())
183 }//end of if (pTrack)
184 else {cerr << "no particle!!!"<<endl;}
185 }//loop over particles
188 vQ.SetMult(iUsedTracks);