Finalised the survey to alignment conversion. Closing corresponding task
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowEventSimple.cxx
CommitLineData
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
f1d945a1 16#include "Riostream.h"
17#include "TObjArray.h"
18#include "TMath.h"
19#include "AliFlowVector.h"
20#include "AliFlowTrackSimple.h"
21#include "AliFlowEventSimple.h"
22
23// AliFlowEventSimple:
24// A simple event for flow analysis
25//
26//
27// authors: N. van der Kolk (kolk@nikhef.nl), A. Bilandzic (anteb@nikhef.nl)
28
29
30ClassImp(AliFlowEventSimple)
31
32//-----------------------------------------------------------------------
33
e35ddff0 34 AliFlowEventSimple::AliFlowEventSimple(Int_t aLenght):
d29ba078 35 fTrackCollection(NULL),
f1d945a1 36 fNumberOfTracks(0),
37 fEventNSelTracksIntFlow(0)
38{
39 //constructor
e35ddff0 40 fTrackCollection = new TObjArray(aLenght) ;
f1d945a1 41}
42
43//-----------------------------------------------------------------------
44
e35ddff0 45AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent):
bc6b015e 46 TObject(),
e35ddff0 47 fTrackCollection(anEvent.fTrackCollection),
48 fNumberOfTracks(anEvent.fNumberOfTracks),
49 fEventNSelTracksIntFlow(anEvent.fEventNSelTracksIntFlow)
f1d945a1 50{
51 //copy constructor
f1d945a1 52}
53
54//-----------------------------------------------------------------------
55
e35ddff0 56AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEvent)
f1d945a1 57{
e35ddff0 58 *fTrackCollection = *anEvent.fTrackCollection ;
59 fNumberOfTracks = anEvent.fNumberOfTracks;
60 fEventNSelTracksIntFlow = anEvent.fEventNSelTracksIntFlow;
f1d945a1 61
62 return *this;
63
64}
65
66
67//-----------------------------------------------------------------------
68
69AliFlowEventSimple::~AliFlowEventSimple()
70{
71 //destructor
72 fTrackCollection->Delete() ; delete fTrackCollection ;
73}
74
75//-----------------------------------------------------------------------
76
77AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
78{
79 //get track i from collection
e35ddff0 80 AliFlowTrackSimple* pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i) ;
81 return pTrack;
f1d945a1 82}
83
84//-----------------------------------------------------------------------
9825d4a9 85 AliFlowVector AliFlowEventSimple::GetQ(Int_t n)
f1d945a1 86{
87 //calculate Q.
88
e35ddff0 89 Double_t dQX = 0.;
90 Double_t dQY = 0.;
91 AliFlowVector vQ;
92 vQ.Set(0.,0.);
9825d4a9 93
94 Int_t iOrder = n;
e35ddff0 95 Int_t iUsedTracks = 0;
f1d945a1 96
97 for (Int_t i=0;i<fNumberOfTracks;i++)
98 {
e35ddff0 99 AliFlowTrackSimple* pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i) ;
100 if (pTrack){
101 if (pTrack->UseForIntegratedFlow()) {
102 Double_t dPhi = pTrack->Phi();
9825d4a9 103 dQX += TMath::Cos(iOrder*dPhi);
104 dQY += TMath::Sin(iOrder*dPhi);
e35ddff0 105 iUsedTracks++;
f1d945a1 106 }
107 } //if particle
108 else {cerr << "no particle!!!"<<endl;}
109 }//loop over particles
110
e35ddff0 111 vQ.Set(dQX,dQY);
112 vQ.SetMult(iUsedTracks);
f1d945a1 113
e35ddff0 114 return vQ;
f1d945a1 115
5fef318d 116}
117
118