]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliFlowVector.h.orig
initial checkin of the new flow development - from an OLD diff!
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowVector.h.orig
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
3 /* $Id$ */
4
5 #ifndef ALIFLOWVECTOR_H
6 #define ALIFLOWVECTOR_H
7
8 #include "TVector2.h"
9
10 //********************************************************************
11 // AliFlowVector:                                                    *
12 // Class to hold the flow vector and multiplicity for flow analysis. *
13 // Author: A. Bilandzic (anteb@nikhef.nl)                            *
14 //********************************************************************
15
16 class AliFlowVector: public TVector2 {
17  public:
18   AliFlowVector();
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();
24
25   void SetMagPhi(Double_t size, Double_t angle, Double_t mult=1);          // Set vector and weighted multiplicity
26
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
36
37   Bool_t  IsFolder() const {return kTRUE;};
38
39   void SetMult(Double_t mult) {fMult = mult;};           // Set sum of weights
40   Double_t GetMult() const {return fMult;};                    // Get sum of weights
41         
42  private:
43   Double_t fMult;                 // multiplicity = sum of weights = w_1 + w_2 + ... + w_n
44    
45   ClassDef(AliFlowVector, 1) 
46 };
47
48
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();
55   cVector.Set(x,y);
56   cVector.SetMult(mult);
57   
58   return cVector;
59 }
60
61 inline  AliFlowVector operator-(const AliFlowVector& aVector,const AliFlowVector& bVector) 
62 {
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();
68   cVector.Set(x,y);
69   cVector.SetMult(mult);
70   
71   return cVector;
72 }
73 */
74
75 #endif