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
10 //********************************************************************
12 // Class to hold the flow vector and multiplicity for flow analysis. *
13 // Author: A. Bilandzic (anteb@nikhef.nl) *
14 //********************************************************************
16 class AliFlowVector: public TVector2 {
19 AliFlowVector(const AliFlowVector& aVector);
20 AliFlowVector(const TVector2 &p, Double_t m); // constructor: Add a weight to the TVector
21 AliFlowVector(Double_t *y, Double_t m=1); // constructor: Analogue to TVector2(y) with multiplicity
22 AliFlowVector(Double_t x, Double_t y, Double_t m=1); // constructor: Sets the components individually
23 virtual ~AliFlowVector();
25 void SetMagPhi(Double_t size, Double_t angle, Double_t mult=1); // Set vector and weighted multiplicity
27 AliFlowVector& operator=(const AliFlowVector& aVector); // Assign to self
28 AliFlowVector& operator+=(const AliFlowVector& aVector); // Add to self
29 AliFlowVector& operator-=(const AliFlowVector& aVector); // Subtract from self
30 AliFlowVector& operator*=(double w); // Multiply by a weight
31 AliFlowVector& operator/=(double w){ (*this)*=(1.0/w); return *this;}; // Divide by a weight
32 const AliFlowVector operator+(const AliFlowVector&a) const { AliFlowVector v(*this); return v+=a; }; // Add and return by value
33 const AliFlowVector operator-(const AliFlowVector&a) const { AliFlowVector v(*this); return v-=a; }; // Subtract and return by value
34 const AliFlowVector operator*(double w) const { AliFlowVector v(*this); return v*=w; }; // Scale and return by value
35 const AliFlowVector operator/(double w) const { AliFlowVector v(*this); return v/=w; }; // Scale and return by value
37 Bool_t IsFolder() const {return kTRUE;};
39 void SetMult(Double_t mult) {fMult = mult;}; // Set sum of weights
40 Double_t GetMult() const {return fMult;}; // Get sum of weights
43 Double_t fMult; // multiplicity = sum of weights = w_1 + w_2 + ... + w_n
45 ClassDef(AliFlowVector, 1)
49 /* Old, less efficient code
50 inline AliFlowVector operator+(const AliFlowVector& aVector,const AliFlowVector& bVector) {
51 AliFlowVector cVector;
52 Double_t x = aVector.X() + bVector.X();
53 Double_t y = aVector.Y() + bVector.Y();
54 Double_t mult = aVector.GetMult() + bVector.GetMult();
56 cVector.SetMult(mult);
61 inline AliFlowVector operator-(const AliFlowVector& aVector,const AliFlowVector& bVector)
63 // Difference between two vectors
64 AliFlowVector cVector;
65 Double_t x = aVector.X() - bVector.X();
66 Double_t y = aVector.Y() - bVector.Y();
67 Double_t mult = aVector.GetMult() - bVector.GetMult();
69 cVector.SetMult(mult);