]>
Commit | Line | Data |
---|---|---|
f1d945a1 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2008, 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 "AliFlowVector.h" |
8fa6a5fa MK |
17 | #include "AliFlowTrackSimple.h" |
18 | #include "TMath.h" | |
f1d945a1 | 19 | |
19f888a6 | 20 | //******************************************************************** |
21 | // AliFlowVector: * | |
22 | // Class to hold the flow vector and multiplicity for flow analysis. * | |
23 | // Author: A. Bilandzic (anteb@nikhef.nl) * | |
8fa6a5fa | 24 | // extended: M.Krzewicki (mikolaj.krzewicki@cern.ch) * |
19f888a6 | 25 | //******************************************************************** |
f1d945a1 | 26 | |
27 | ClassImp(AliFlowVector) | |
28 | ||
29 | //________________________________________________________________________ | |
30 | ||
ae733b3b | 31 | AliFlowVector::AliFlowVector(): |
8fa6a5fa MK |
32 | TVector2(0.0,0.0), |
33 | fMult(0.0), | |
34 | fHarmonic(2), | |
35 | fPOItype(0), | |
36 | fSubeventNumber(-1) | |
cbbaf54a | 37 | { |
7b5556ef | 38 | // default constructor |
cbbaf54a | 39 | } |
40 | ||
41 | //________________________________________________________________________ | |
868536da | 42 | |
ae733b3b | 43 | AliFlowVector::AliFlowVector(const AliFlowVector& aVector): |
cbbaf54a | 44 | TVector2(aVector), |
8fa6a5fa MK |
45 | fMult(aVector.fMult), |
46 | fHarmonic(aVector.fHarmonic), | |
47 | fPOItype(aVector.fPOItype), | |
48 | fSubeventNumber(aVector.fSubeventNumber) | |
cbbaf54a | 49 | { |
ae733b3b | 50 | // copy constructor |
cbbaf54a | 51 | } |
52 | ||
7b5556ef | 53 | //________________________________________________________________________ |
54 | ||
8fa6a5fa | 55 | AliFlowVector::AliFlowVector(Double_t *y, Double_t m, Int_t h, Int_t t, Int_t s): |
7b5556ef | 56 | TVector2(y), |
8fa6a5fa MK |
57 | fMult(m), |
58 | fHarmonic(h), | |
59 | fPOItype(t), | |
60 | fSubeventNumber(s) | |
7b5556ef | 61 | { |
62 | // Analogue of TVector2 constructor. Sets (x,y) and multiplicity 1. | |
63 | } | |
64 | ||
cbbaf54a | 65 | //________________________________________________________________________ |
66 | ||
8fa6a5fa | 67 | AliFlowVector::AliFlowVector(const TVector2 &v, Double_t m, Int_t h, Int_t t, Int_t s): |
cbbaf54a | 68 | TVector2(v), |
8fa6a5fa MK |
69 | fMult(m), |
70 | fHarmonic(h), | |
71 | fPOItype(t), | |
72 | fSubeventNumber(s) | |
cbbaf54a | 73 | { |
7b5556ef | 74 | // custom constructor, Sets vector and multiplicity |
75 | } | |
76 | ||
77 | //________________________________________________________________________ | |
78 | ||
8fa6a5fa | 79 | AliFlowVector::AliFlowVector(Double_t x, Double_t y, Double_t m, Int_t h, Int_t t, Int_t s): |
7b5556ef | 80 | TVector2(x,y), |
8fa6a5fa MK |
81 | fMult(m), |
82 | fHarmonic(h), | |
83 | fPOItype(t), | |
84 | fSubeventNumber(s) | |
7b5556ef | 85 | { |
86 | // custom constructor analogue of TVector2 constructor | |
cbbaf54a | 87 | } |
88 | ||
89 | //________________________________________________________________________ | |
90 | ||
ae733b3b | 91 | AliFlowVector::~AliFlowVector() |
92 | { | |
7b5556ef | 93 | // default destructor |
ae733b3b | 94 | } |
cbbaf54a | 95 | |
8fa6a5fa | 96 | void AliFlowVector::SetMagPhi(Double_t size, Double_t angle, Double_t mult) |
03740a6b | 97 | { |
7b5556ef | 98 | // Analogue to SetMagPhi for a TVector2 but here including a sum of weights |
03740a6b | 99 | TVector2::SetMagPhi(size,angle); |
100 | SetMult(mult); | |
101 | } | |
102 | ||
cbbaf54a | 103 | //________________________________________________________________________ |
104 | ||
19f888a6 | 105 | AliFlowVector& AliFlowVector::operator=(const AliFlowVector& aVector) |
868536da | 106 | { |
cbbaf54a | 107 | // assignement operator |
2047680a | 108 | if (this==&aVector) return *this; |
cbbaf54a | 109 | fX = aVector.X(); |
110 | fY = aVector.Y(); | |
111 | fMult = aVector.GetMult(); | |
cbbaf54a | 112 | return *this; |
868536da | 113 | } |
19f888a6 | 114 | |
cbbaf54a | 115 | //________________________________________________________________________ |
116 | ||
117 | AliFlowVector& AliFlowVector::operator+=(const AliFlowVector& aVector) | |
118 | { | |
119 | // addition operator | |
120 | fX += aVector.X(); | |
121 | fY += aVector.Y(); | |
7b5556ef | 122 | fMult += aVector.GetMult(); |
cbbaf54a | 123 | return *this; |
124 | } | |
19f888a6 | 125 | |
03740a6b | 126 | AliFlowVector& AliFlowVector::operator-=(const AliFlowVector& aVector) |
127 | { | |
7b5556ef | 128 | // subtraction operator |
03740a6b | 129 | fX -= aVector.X(); |
130 | fY -= aVector.Y(); | |
131 | fMult -= aVector.GetMult(); | |
03740a6b | 132 | return *this; |
133 | } | |
7b5556ef | 134 | |
8fa6a5fa | 135 | AliFlowVector& AliFlowVector::operator*=(Double_t w) |
7b5556ef | 136 | { |
137 | // multiply by a weight operator | |
138 | fX*=w; | |
139 | fY*=w; | |
140 | fMult*=w; | |
141 | return *this; | |
142 | } | |
8fa6a5fa MK |
143 | |
144 | //________________________________________________________________________ | |
145 | void AliFlowVector::Clear(Option_t* /*option*/) | |
146 | { | |
147 | //clear | |
148 | fX=0.; | |
149 | fY=0.; | |
150 | fMult=0; | |
151 | fHarmonic=2; | |
152 | fPOItype=AliFlowTrackSimple::kRP; | |
153 | fSubeventNumber=-1; | |
154 | } | |
155 | ||
156 | //________________________________________________________________________ | |
157 | Int_t AliFlowVector::SubtractTrackWithDaughters( const AliFlowTrackSimple* track, | |
158 | Double_t extraWeight | |
159 | ) | |
160 | { | |
161 | //subtract a track and all its daughters, only if tagged with flowTag and in specified | |
162 | //subevent (-1 for no subevent selection) | |
163 | //to only subtract if it was actually used in the construction of the vector) | |
164 | //TODO: maybe make recursive if it ever becomes needed | |
165 | //for complicated decay topologies | |
166 | Bool_t inSubEvent=kTRUE; | |
167 | if (fSubeventNumber>=0) | |
168 | { | |
169 | inSubEvent = track->InSubevent(fSubeventNumber); | |
170 | } | |
171 | if (track->IsPOItype(fPOItype) && inSubEvent ) | |
172 | { | |
173 | fX -= extraWeight * track->Weight() * TMath::Cos(fHarmonic*track->Phi()); | |
174 | fY -= extraWeight * track->Weight() * TMath::Sin(fHarmonic*track->Phi()); | |
175 | } | |
176 | ||
177 | Int_t numberOfsubtractedDaughters=0; | |
178 | for (Int_t i=0; i<track->GetNDaughters(); i++) | |
179 | { | |
180 | AliFlowTrackSimple* daughter = track->GetDaughter(i); | |
181 | if (!daughter) continue; | |
182 | inSubEvent=kTRUE; | |
183 | if (fSubeventNumber>=0) | |
184 | { | |
185 | inSubEvent = daughter->InSubevent(fSubeventNumber); | |
186 | } | |
187 | if (daughter->IsPOItype(fPOItype) && inSubEvent ) | |
188 | { | |
189 | fX -= extraWeight * daughter->Weight() * TMath::Cos(fHarmonic*daughter->Phi()); | |
190 | fY -= extraWeight * daughter->Weight() * TMath::Sin(fHarmonic*daughter->Phi()); | |
191 | numberOfsubtractedDaughters++; | |
192 | } | |
193 | } | |
194 | return numberOfsubtractedDaughters; | |
195 | } |