AliPhysics  f9b5d69 (f9b5d69)
AliFlowVector.cxx
Go to the documentation of this file.
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 
16 #include "AliFlowVector.h"
17 #include "AliFlowTrackSimple.h"
18 #include "TMath.h"
19 
20 //********************************************************************
21 // AliFlowVector: *
22 // Class to hold the flow vector and multiplicity for flow analysis. *
23 // Author: A. Bilandzic (anteb@nikhef.nl) *
24 // extended: M.Krzewicki (mikolaj.krzewicki@cern.ch) *
25 //********************************************************************
26 
27 ClassImp(AliFlowVector)
28 
29 //________________________________________________________________________
30 
32  TVector2(0.0,0.0),
33  fMult(0.0),
34  fHarmonic(2),
35  fPOItype(0),
36  fSubeventNumber(-1)
37 {
38  // default constructor
39 }
40 
41 //________________________________________________________________________
42 
44  TVector2(aVector),
45  fMult(aVector.fMult),
46  fHarmonic(aVector.fHarmonic),
47  fPOItype(aVector.fPOItype),
48  fSubeventNumber(aVector.fSubeventNumber)
49 {
50  // copy constructor
51 }
52 
53 //________________________________________________________________________
54 
56  TVector2(y),
57  fMult(m),
58  fHarmonic(h),
59  fPOItype(t),
61 {
62  // Analogue of TVector2 constructor. Sets (x,y) and multiplicity 1.
63 }
64 
65  //________________________________________________________________________
66 
67 AliFlowVector::AliFlowVector(const TVector2 &v, Double_t m, Int_t h, Int_t t, Int_t s):
68  TVector2(v),
69  fMult(m),
70  fHarmonic(h),
71  fPOItype(t),
73 {
74  // custom constructor, Sets vector and multiplicity
75 }
76 
77  //________________________________________________________________________
78 
80  TVector2(x,y),
81  fMult(m),
82  fHarmonic(h),
83  fPOItype(t),
85 {
86  // custom constructor analogue of TVector2 constructor
87 }
88 
89 //________________________________________________________________________
90 
92 {
93  // default destructor
94 }
95 
97 {
98  // Analogue to SetMagPhi for a TVector2 but here including a sum of weights
99  TVector2::SetMagPhi(size,angle);
100  SetMult(mult);
101 }
102 
103 //________________________________________________________________________
104 
106 {
107  // assignement operator
108  if (this==&aVector) return *this;
109  fX = aVector.X();
110  fY = aVector.Y();
111  fMult = aVector.GetMult();
112  return *this;
113 }
114 
115 //________________________________________________________________________
116 
118 {
119  // addition operator
120  fX += aVector.X();
121  fY += aVector.Y();
122  fMult += aVector.GetMult();
123  return *this;
124 }
125 
127 {
128  // subtraction operator
129  fX -= aVector.X();
130  fY -= aVector.Y();
131  fMult -= aVector.GetMult();
132  return *this;
133 }
134 
136 {
137  // multiply by a weight operator
138  fX*=w;
139  fY*=w;
140  fMult*=w;
141  return *this;
142 }
143 
144 //________________________________________________________________________
146 {
147  //clear
148  fX=0.;
149  fY=0.;
150  fMult=0;
151  fHarmonic=2;
153  fSubeventNumber=-1;
154 }
155 
156 //________________________________________________________________________
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 }
double Double_t
Definition: External.C:58
virtual Int_t GetNDaughters() const
Bool_t InSubevent(Int_t i) const
AliFlowVector & operator-=(const AliFlowVector &aVector)
AliFlowVector & operator=(const AliFlowVector &aVector)
AliFlowVector & operator*=(Double_t w)
Double_t GetMult() const
Definition: AliFlowVector.h:46
AliFlowVector & operator+=(const AliFlowVector &aVector)
Int_t SubtractTrackWithDaughters(const AliFlowTrackSimple *track, Double_t extraWeight=1.)
Double_t Phi() const
void Clear(Option_t *option="")
int Int_t
Definition: External.C:63
void SetMult(Double_t mult)
Definition: AliFlowVector.h:45
Int_t fSubeventNumber
Definition: AliFlowVector.h:59
void SetMagPhi(Double_t size, Double_t angle, Double_t mult=1)
Double_t Weight() const
virtual AliFlowTrackSimple * GetDaughter(Int_t) const
Bool_t IsPOItype(Int_t poiType) const
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
Double_t fMult
Definition: AliFlowVector.h:56
virtual ~AliFlowVector()