]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliFlowVector.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowVector.h
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 #include "AliFlowTrackSimple.h"
10
11 //********************************************************************
12 // AliFlowVector:                                                    *
13 // Class to hold the flow vector and multiplicity for flow analysis. *
14 // Author: A. Bilandzic (anteb@nikhef.nl)                            *
15 //********************************************************************
16 class AliFlowTrackSimple;
17
18 class AliFlowVector: public TVector2 {
19  public:
20   AliFlowVector();
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();
26
27   void SetMagPhi(Double_t size, Double_t angle, Double_t mult=1);          // Set vector and weighted multiplicity
28
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
38
39   Int_t SubtractTrackWithDaughters( const AliFlowTrackSimple* track,
40                                    Double_t extraWeight=1.
41                                  );  //subtract a track with all its daughters
42
43   Bool_t  IsFolder() const {return kTRUE;};
44
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="");
54         
55  private:
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)
60    
61   ClassDef(AliFlowVector, 2) 
62 };
63
64
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();
71   cVector.Set(x,y);
72   cVector.SetMult(mult);
73   
74   return cVector;
75 }
76
77 inline  AliFlowVector operator-(const AliFlowVector& aVector,const AliFlowVector& bVector) 
78 {
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();
84   cVector.Set(x,y);
85   cVector.SetMult(mult);
86   
87   return cVector;
88 }
89 */
90
91 #endif