]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowEventSimple.cxx
Moved old reacton plane code to /oldcode
[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
16/*
17$Log$
18*/
19
20#include "Riostream.h"
21#include "TObjArray.h"
22#include "TMath.h"
23#include "AliFlowVector.h"
24#include "AliFlowTrackSimple.h"
25#include "AliFlowEventSimple.h"
26
27// AliFlowEventSimple:
28// A simple event for flow analysis
29//
30//
31// authors: N. van der Kolk (kolk@nikhef.nl), A. Bilandzic (anteb@nikhef.nl)
32
33
34ClassImp(AliFlowEventSimple)
35
36//-----------------------------------------------------------------------
37
38 AliFlowEventSimple::AliFlowEventSimple(Int_t lenght):
39 fTrackCollection(0),
40 fTrack(0),
41 fNumberOfTracks(0),
42 fEventNSelTracksIntFlow(0)
43{
44 //constructor
45 fTrackCollection = new TObjArray(lenght) ;
46
47
48}
49
50//-----------------------------------------------------------------------
51
52AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& event):
53 fNumberOfTracks(event.fNumberOfTracks),
54 fEventNSelTracksIntFlow(event.fEventNSelTracksIntFlow)
55{
56 //copy constructor
57 *fTrack = *event.fTrack;
58 *fTrackCollection = *event.fTrackCollection ;
59
60}
61
62//-----------------------------------------------------------------------
63
64AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& event)
65{
66 //copy constructor
67 *fTrack = *event.fTrack;
68 *fTrackCollection = *event.fTrackCollection ;
69 fNumberOfTracks = event.fNumberOfTracks;
70 fEventNSelTracksIntFlow = event.fEventNSelTracksIntFlow;
71
72 return *this;
73
74}
75
76
77//-----------------------------------------------------------------------
78
79AliFlowEventSimple::~AliFlowEventSimple()
80{
81 //destructor
82 fTrackCollection->Delete() ; delete fTrackCollection ;
83}
84
85//-----------------------------------------------------------------------
86
87AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
88{
89 //get track i from collection
90 fTrack = (AliFlowTrackSimple*)TrackCollection()->At(i) ;
91 return fTrack;
92}
93
94//-----------------------------------------------------------------------
95 AliFlowVector AliFlowEventSimple::GetQ()
96{
97 //calculate Q.
98
99 Double_t fQX = 0.;
100 Double_t fQY = 0.;
101 AliFlowVector fQ;
102 fQ.Set(0.,0.);
103 Double_t fOrder = 2.;
104 Int_t fUsedTracks = 0;
105
106 for (Int_t i=0;i<fNumberOfTracks;i++)
107 {
108 fTrack = (AliFlowTrackSimple*)TrackCollection()->At(i) ;
109 if (fTrack){
110 if (fTrack->UseForIntegratedFlow()) {
111 Double_t fPhi = fTrack->Phi();
112 fQX += TMath::Cos(fOrder*fPhi);
113 fQY += TMath::Sin(fOrder*fPhi);
114 fUsedTracks++;
115 }
116 } //if particle
117 else {cerr << "no particle!!!"<<endl;}
118 }//loop over particles
119
120 fQ.Set(fQX,fQY);
121 fQ.SetMult(fUsedTracks);
122
123 return fQ;
124
125}