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