]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowEventSimple.cxx
copy ctor's
[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
34 AliFlowEventSimple::AliFlowEventSimple(Int_t lenght):
35 fTrackCollection(0),
36 fTrack(0),
37 fNumberOfTracks(0),
38 fEventNSelTracksIntFlow(0)
39{
40 //constructor
41 fTrackCollection = new TObjArray(lenght) ;
42
43
44}
45
46//-----------------------------------------------------------------------
47
48AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& event):
bc6b015e 49 TObject(),
50 fTrackCollection(event.fTrackCollection),
51 fTrack(event.fTrack),
f1d945a1 52 fNumberOfTracks(event.fNumberOfTracks),
53 fEventNSelTracksIntFlow(event.fEventNSelTracksIntFlow)
54{
55 //copy constructor
bc6b015e 56 // *fTrack = *event.fTrack;
57 // *fTrackCollection = *event.fTrackCollection ;
f1d945a1 58
59}
60
61//-----------------------------------------------------------------------
62
63AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& event)
64{
f1d945a1 65 *fTrack = *event.fTrack;
66 *fTrackCollection = *event.fTrackCollection ;
67 fNumberOfTracks = event.fNumberOfTracks;
68 fEventNSelTracksIntFlow = event.fEventNSelTracksIntFlow;
69
70 return *this;
71
72}
73
74
75//-----------------------------------------------------------------------
76
77AliFlowEventSimple::~AliFlowEventSimple()
78{
79 //destructor
80 fTrackCollection->Delete() ; delete fTrackCollection ;
81}
82
83//-----------------------------------------------------------------------
84
85AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
86{
87 //get track i from collection
88 fTrack = (AliFlowTrackSimple*)TrackCollection()->At(i) ;
89 return fTrack;
90}
91
92//-----------------------------------------------------------------------
93 AliFlowVector AliFlowEventSimple::GetQ()
94{
95 //calculate Q.
96
97 Double_t fQX = 0.;
98 Double_t fQY = 0.;
99 AliFlowVector fQ;
100 fQ.Set(0.,0.);
101 Double_t fOrder = 2.;
102 Int_t fUsedTracks = 0;
103
104 for (Int_t i=0;i<fNumberOfTracks;i++)
105 {
106 fTrack = (AliFlowTrackSimple*)TrackCollection()->At(i) ;
107 if (fTrack){
108 if (fTrack->UseForIntegratedFlow()) {
109 Double_t fPhi = fTrack->Phi();
110 fQX += TMath::Cos(fOrder*fPhi);
111 fQY += TMath::Sin(fOrder*fPhi);
112 fUsedTracks++;
113 }
114 } //if particle
115 else {cerr << "no particle!!!"<<endl;}
116 }//loop over particles
117
118 fQ.Set(fQX,fQY);
119 fQ.SetMult(fUsedTracks);
120
121 return fQ;
122
123}