#include "AliFlowVector.h"
#include "AliFlowTrackSimple.h"
#include "TMath.h"
ClassImp(AliFlowVector)
AliFlowVector::AliFlowVector():
TVector2(0.0,0.0),
fMult(0.0),
fHarmonic(2),
fPOItype(0),
fSubeventNumber(-1)
{
}
AliFlowVector::AliFlowVector(const AliFlowVector& aVector):
TVector2(aVector),
fMult(aVector.fMult),
fHarmonic(aVector.fHarmonic),
fPOItype(aVector.fPOItype),
fSubeventNumber(aVector.fSubeventNumber)
{
}
AliFlowVector::AliFlowVector(Double_t *y, Double_t m, Int_t h, Int_t t, Int_t s):
TVector2(y),
fMult(m),
fHarmonic(h),
fPOItype(t),
fSubeventNumber(s)
{
}
AliFlowVector::AliFlowVector(const TVector2 &v, Double_t m, Int_t h, Int_t t, Int_t s):
TVector2(v),
fMult(m),
fHarmonic(h),
fPOItype(t),
fSubeventNumber(s)
{
}
AliFlowVector::AliFlowVector(Double_t x, Double_t y, Double_t m, Int_t h, Int_t t, Int_t s):
TVector2(x,y),
fMult(m),
fHarmonic(h),
fPOItype(t),
fSubeventNumber(s)
{
}
AliFlowVector::~AliFlowVector()
{
}
void AliFlowVector::SetMagPhi(Double_t size, Double_t angle, Double_t mult)
{
TVector2::SetMagPhi(size,angle);
SetMult(mult);
}
AliFlowVector& AliFlowVector::operator=(const AliFlowVector& aVector)
{
if (this==&aVector) return *this;
fX = aVector.X();
fY = aVector.Y();
fMult = aVector.GetMult();
return *this;
}
AliFlowVector& AliFlowVector::operator+=(const AliFlowVector& aVector)
{
fX += aVector.X();
fY += aVector.Y();
fMult += aVector.GetMult();
return *this;
}
AliFlowVector& AliFlowVector::operator-=(const AliFlowVector& aVector)
{
fX -= aVector.X();
fY -= aVector.Y();
fMult -= aVector.GetMult();
return *this;
}
AliFlowVector& AliFlowVector::operator*=(Double_t w)
{
fX*=w;
fY*=w;
fMult*=w;
return *this;
}
void AliFlowVector::Clear(Option_t* )
{
fX=0.;
fY=0.;
fMult=0;
fHarmonic=2;
fPOItype=AliFlowTrackSimple::kRP;
fSubeventNumber=-1;
}
Int_t AliFlowVector::SubtractTrackWithDaughters( const AliFlowTrackSimple* track,
Double_t extraWeight
)
{
Bool_t inSubEvent=kTRUE;
if (fSubeventNumber>=0)
{
inSubEvent = track->InSubevent(fSubeventNumber);
}
if (track->IsPOItype(fPOItype) && inSubEvent )
{
fX -= extraWeight * track->Weight() * TMath::Cos(fHarmonic*track->Phi());
fY -= extraWeight * track->Weight() * TMath::Sin(fHarmonic*track->Phi());
}
Int_t numberOfsubtractedDaughters=0;
for (Int_t i=0; i<track->GetNDaughters(); i++)
{
AliFlowTrackSimple* daughter = track->GetDaughter(i);
if (!daughter) continue;
inSubEvent=kTRUE;
if (fSubeventNumber>=0)
{
inSubEvent = daughter->InSubevent(fSubeventNumber);
}
if (daughter->IsPOItype(fPOItype) && inSubEvent )
{
fX -= extraWeight * daughter->Weight() * TMath::Cos(fHarmonic*daughter->Phi());
fY -= extraWeight * daughter->Weight() * TMath::Sin(fHarmonic*daughter->Phi());
numberOfsubtractedDaughters++;
}
}
return numberOfsubtractedDaughters;
}