1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
5 #ifndef ALIFLOWVECTOR_H
6 #define ALIFLOWVECTOR_H
9 #include "AliFlowTrackSimple.h"
11 //********************************************************************
13 // Class to hold the flow vector and multiplicity for flow analysis. *
14 // Author: A. Bilandzic (anteb@nikhef.nl) *
15 //********************************************************************
16 class AliFlowTrackSimple;
18 class AliFlowVector: public TVector2 {
21 AliFlowVector(const AliFlowVector& aVector);
22 AliFlowVector(const TVector2 &p, Double_t m, Int_t h=2, Int_t poiType=0, Int_t s=1); // constructor: Add a weight to the TVector
23 AliFlowVector(Double_t *y, Double_t m=1, Int_t h=2, Int_t poiType=0, Int_t s=-1); // constructor: Analogue to TVector2(y) with multiplicity
24 AliFlowVector(Double_t x, Double_t y, Double_t m=1, Int_t h=2, Int_t poiType=0, Int_t s=-1); // constructor: Sets the components individually
25 virtual ~AliFlowVector();
27 void SetMagPhi(Double_t size, Double_t angle, Double_t mult=1); // Set vector and weighted multiplicity
29 AliFlowVector& operator=(const AliFlowVector& aVector); // Assign to self
30 AliFlowVector& operator+=(const AliFlowVector& aVector); // Add to self
31 AliFlowVector& operator-=(const AliFlowVector& aVector); // Subtract from self
32 AliFlowVector& operator*=(Double_t w); // Multiply by a weight
33 AliFlowVector& operator/=(Double_t w){ (*this)*=(1.0/w); return *this;}; // Divide by a weight
34 const AliFlowVector operator+(const AliFlowVector&a) const { AliFlowVector v(*this); return v+=a; }; // Add and return by value
35 const AliFlowVector operator-(const AliFlowVector&a) const { AliFlowVector v(*this); return v-=a; }; // Subtract and return by value
36 const AliFlowVector operator*(Double_t w) const { AliFlowVector v(*this); return v*=w; }; // Scale and return by value
37 const AliFlowVector operator/(Double_t w) const { AliFlowVector v(*this); return v/=w; }; // Scale and return by value
39 Int_t SubtractTrackWithDaughters( const AliFlowTrackSimple* track,
40 Double_t extraWeight=1.
41 ); //subtract a track with all its daughters
43 Bool_t IsFolder() const {return kTRUE;};
45 void SetMult(Double_t mult) {fMult = mult;}; // Set sum of weights
46 Double_t GetMult() const {return fMult;}; // Get sum of weights
47 void SetHarmonic(Int_t h) {fHarmonic = h;} //set the harmonic
48 Int_t GetHarmonic() const {return fHarmonic;} //get the harmonic
49 void SetPOItype(Int_t t) {fPOItype=t;}
50 Int_t GetPOItype() const {return fPOItype;}
51 void SetSubeventNumber(Int_t n) {fSubeventNumber=n;}
52 Int_t GetSubeventNumber() const {return fSubeventNumber;}
53 void Clear(Option_t* option="");
56 Double_t fMult; // multiplicity = sum of weights = w_1 + w_2 + ... + w_n
57 Int_t fHarmonic; // harmonic for which the vector is constructed
58 Int_t fPOItype; //which tracks are used to construct? RP=0, POIn=n,...
59 Int_t fSubeventNumber; //for which subevent is this vector constructed? (-1 for no subevent in particular)
61 ClassDef(AliFlowVector, 2)
65 /* Old, less efficient code
66 inline AliFlowVector operator+(const AliFlowVector& aVector,const AliFlowVector& bVector) {
67 AliFlowVector cVector;
68 Double_t x = aVector.X() + bVector.X();
69 Double_t y = aVector.Y() + bVector.Y();
70 Double_t mult = aVector.GetMult() + bVector.GetMult();
72 cVector.SetMult(mult);
77 inline AliFlowVector operator-(const AliFlowVector& aVector,const AliFlowVector& bVector)
79 // Difference between two vectors
80 AliFlowVector cVector;
81 Double_t x = aVector.X() - bVector.X();
82 Double_t y = aVector.Y() - bVector.Y();
83 Double_t mult = aVector.GetMult() - bVector.GetMult();
85 cVector.SetMult(mult);