1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #include "AliFlowVector.h"
17 #include "AliFlowTrackSimple.h"
20 //********************************************************************
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 //********************************************************************
27 ClassImp(AliFlowVector)
29 //________________________________________________________________________
31 AliFlowVector::AliFlowVector():
38 // default constructor
41 //________________________________________________________________________
43 AliFlowVector::AliFlowVector(const AliFlowVector& aVector):
46 fHarmonic(aVector.fHarmonic),
47 fPOItype(aVector.fPOItype),
48 fSubeventNumber(aVector.fSubeventNumber)
53 //________________________________________________________________________
55 AliFlowVector::AliFlowVector(Double_t *y, Double_t m, Int_t h, Int_t t, Int_t s):
62 // Analogue of TVector2 constructor. Sets (x,y) and multiplicity 1.
65 //________________________________________________________________________
67 AliFlowVector::AliFlowVector(const TVector2 &v, Double_t m, Int_t h, Int_t t, Int_t s):
74 // custom constructor, Sets vector and multiplicity
77 //________________________________________________________________________
79 AliFlowVector::AliFlowVector(Double_t x, Double_t y, Double_t m, Int_t h, Int_t t, Int_t s):
86 // custom constructor analogue of TVector2 constructor
89 //________________________________________________________________________
91 AliFlowVector::~AliFlowVector()
96 void AliFlowVector::SetMagPhi(Double_t size, Double_t angle, Double_t mult)
98 // Analogue to SetMagPhi for a TVector2 but here including a sum of weights
99 TVector2::SetMagPhi(size,angle);
103 //________________________________________________________________________
105 AliFlowVector& AliFlowVector::operator=(const AliFlowVector& aVector)
107 // assignement operator
108 if (this==&aVector) return *this;
111 fMult = aVector.GetMult();
115 //________________________________________________________________________
117 AliFlowVector& AliFlowVector::operator+=(const AliFlowVector& aVector)
122 fMult += aVector.GetMult();
126 AliFlowVector& AliFlowVector::operator-=(const AliFlowVector& aVector)
128 // subtraction operator
131 fMult -= aVector.GetMult();
135 AliFlowVector& AliFlowVector::operator*=(Double_t w)
137 // multiply by a weight operator
144 //________________________________________________________________________
145 void AliFlowVector::Clear(Option_t* /*option*/)
152 fPOItype=AliFlowTrackSimple::kRP;
156 //________________________________________________________________________
157 Int_t AliFlowVector::SubtractTrackWithDaughters( const AliFlowTrackSimple* track,
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)
169 inSubEvent = track->InSubevent(fSubeventNumber);
171 if (track->IsPOItype(fPOItype) && inSubEvent )
173 fX -= extraWeight * track->Weight() * TMath::Cos(fHarmonic*track->Phi());
174 fY -= extraWeight * track->Weight() * TMath::Sin(fHarmonic*track->Phi());
177 Int_t numberOfsubtractedDaughters=0;
178 for (Int_t i=0; i<track->GetNDaughters(); i++)
180 AliFlowTrackSimple* daughter = track->GetDaughter(i);
181 if (!daughter) continue;
183 if (fSubeventNumber>=0)
185 inSubEvent = daughter->InSubevent(fSubeventNumber);
187 if (daughter->IsPOItype(fPOItype) && inSubEvent )
189 fX -= extraWeight * daughter->Weight() * TMath::Cos(fHarmonic*daughter->Phi());
190 fY -= extraWeight * daughter->Weight() * TMath::Sin(fHarmonic*daughter->Phi());
191 numberOfsubtractedDaughters++;
194 return numberOfsubtractedDaughters;