added += and + for AliFlowVector
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Oct 2009 16:08:56 +0000 (16:08 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Oct 2009 16:08:56 +0000 (16:08 +0000)
PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithScalarProduct.cxx
PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx
PWG2/FLOW/AliFlowCommon/AliFlowVector.cxx
PWG2/FLOW/AliFlowCommon/AliFlowVector.h

index 3bbeda0..cdb7125 100644 (file)
@@ -156,20 +156,17 @@ void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) {
 
     //fill control histograms     
     fCommonHists->FillControlHistograms(anEvent);
-    
-    //get the Q vector from the FlowEvent
-    //AliFlowVector vQ = anEvent->GetQ();   //NOT EQUAL TO Qa+Qb
-    //fHistProM -> Fill(1,vQ.GetMult()-1);  //NOT EQUAL TO Ma+Mb
-    //get Q vectors for the subevents
+        
+    //get Q vectors for the eta-subevents
     AliFlowVector vQa = anEvent->GetQsub(-1.,-0.01);  
     AliFlowVector vQb = anEvent->GetQsub(0.01,1.);
-    Double_t sumX = vQa.X() + vQb.X();
-    Double_t sumY = vQa.Y() + vQb.Y();
-    TVector2 temp(sumX,sumY);
-    AliFlowVector vQ(temp,0.,0.,0.,0.,0.,0.,0.,0.);
-
-    fHistProM -> Fill(1,vQa.GetMult()+vQb.GetMult()-1);
-    fHistProM -> Fill(2,vQa.GetMult()*vQb.GetMult());
+    //get total Q vector
+    AliFlowVector vQ = vQa + vQb;
+    
+    //fill the multiplicity histograms for the prefactor
+    fHistProM -> Fill(1,vQ.GetMult()-1);                //<M-1>
+    fHistProM -> Fill(2,vQa.GetMult()*vQb.GetMult());   //<Ma*Mb>
+    //scalar product of the two subevents
     Double_t dQaQb = vQa*vQb; 
     fHistProQaQb -> Fill(0.,dQaQb);    
                 
@@ -191,7 +188,7 @@ void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) {
          else cerr<<"dModulus is zero!"<<endl;
 
          TVector2 vQm = vQ;
-         //subtrackt particle from the flowvector if used to define it
+         //subtract particle from the flowvector if used to define it
          if (pTrack->InRPSelection()) {
            Double_t dQmX = vQm.X() - dUX;
            Double_t dQmY = vQm.Y() - dUY;
index eb88514..9f9e86e 100644 (file)
@@ -147,15 +147,7 @@ AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePh
   TH1F *phiWeights = NULL;
   TH1D *ptWeights  = NULL;
   TH1D *etaWeights = NULL;
-
-  Double_t dSumOfWeightsToPower2 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 2)
-  Double_t dSumOfWeightsToPower3 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 3)
-  Double_t dSumOfWeightsToPower4 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 4)
-  Double_t dSumOfWeightsToPower5 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 5)
-  Double_t dSumOfWeightsToPower6 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 6)
-  Double_t dSumOfWeightsToPower7 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 7)
-  Double_t dSumOfWeightsToPower8 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 8) 
-
+  
   if(weightsList)
   {
    if(usePhiWeights)
@@ -217,16 +209,7 @@ AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePh
     
      // weighted multiplicity:
      iUsedTracks+=wPhi*wPt*wEta;
-    
-     // weights raised to various powers are summed up:
-     dSumOfWeightsToPower2+=pow(wPhi*wPt*wEta, 2); 
-     dSumOfWeightsToPower3+=pow(wPhi*wPt*wEta, 3); 
-     dSumOfWeightsToPower4+=pow(wPhi*wPt*wEta, 4); 
-     dSumOfWeightsToPower5+=pow(wPhi*wPt*wEta, 5); 
-     dSumOfWeightsToPower6+=pow(wPhi*wPt*wEta, 6); 
-     dSumOfWeightsToPower7+=pow(wPhi*wPt*wEta, 7); 
-     dSumOfWeightsToPower8+=pow(wPhi*wPt*wEta, 8); 
-     
+         
     } // end of if (pTrack->InRPSelection())
    } // end of if (pTrack)
    else {cerr << "no particle!!!"<<endl;}
@@ -234,14 +217,7 @@ AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePh
     
   vQ.Set(dQX,dQY);
   vQ.SetMult(iUsedTracks);
-  vQ.SetSumOfWeightsToPower2(dSumOfWeightsToPower2);
-  vQ.SetSumOfWeightsToPower3(dSumOfWeightsToPower3);
-  vQ.SetSumOfWeightsToPower4(dSumOfWeightsToPower4);
-  vQ.SetSumOfWeightsToPower5(dSumOfWeightsToPower5);
-  vQ.SetSumOfWeightsToPower6(dSumOfWeightsToPower6);
-  vQ.SetSumOfWeightsToPower7(dSumOfWeightsToPower7);
-  vQ.SetSumOfWeightsToPower8(dSumOfWeightsToPower8);
-
+  
   return vQ;
   
 }
@@ -278,15 +254,7 @@ AliFlowVector AliFlowEventSimple::GetQsub(Double_t etaMin, Double_t etaMax, Int_
   TH1F *phiWeights = NULL;
   TH1D *ptWeights  = NULL;
   TH1D *etaWeights = NULL;
-
-  Double_t dSumOfWeightsToPower2 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 2)
-  Double_t dSumOfWeightsToPower3 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 3)
-  Double_t dSumOfWeightsToPower4 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 4)
-  Double_t dSumOfWeightsToPower5 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 5)
-  Double_t dSumOfWeightsToPower6 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 6)
-  Double_t dSumOfWeightsToPower7 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 7)
-  Double_t dSumOfWeightsToPower8 = 0.; // sum_{i=1}^{n} pow((wPhi*wPt*wEta)_i, 8) 
-
+  
   if(weightsList)
     {
       if(usePhiWeights)
@@ -348,15 +316,7 @@ AliFlowVector AliFlowEventSimple::GetQsub(Double_t etaMin, Double_t etaMax, Int_
     
        // weighted multiplicity:
        iUsedTracks+=wPhi*wPt*wEta;
-    
-       // weights raised to various powers are summed up:
-       dSumOfWeightsToPower2+=pow(wPhi*wPt*wEta, 2); 
-       dSumOfWeightsToPower3+=pow(wPhi*wPt*wEta, 3); 
-       dSumOfWeightsToPower4+=pow(wPhi*wPt*wEta, 4); 
-       dSumOfWeightsToPower5+=pow(wPhi*wPt*wEta, 5); 
-       dSumOfWeightsToPower6+=pow(wPhi*wPt*wEta, 6); 
-       dSumOfWeightsToPower7+=pow(wPhi*wPt*wEta, 7); 
-       dSumOfWeightsToPower8+=pow(wPhi*wPt*wEta, 8); 
+           
      } // end of if dEta in eta range
     } // end of if (pTrack->InRPSelection())
    } // end of if (pTrack)
@@ -365,14 +325,7 @@ AliFlowVector AliFlowEventSimple::GetQsub(Double_t etaMin, Double_t etaMax, Int_
     
   vQ.Set(dQX,dQY);
   vQ.SetMult(iUsedTracks);
-  vQ.SetSumOfWeightsToPower2(dSumOfWeightsToPower2);
-  vQ.SetSumOfWeightsToPower3(dSumOfWeightsToPower3);
-  vQ.SetSumOfWeightsToPower4(dSumOfWeightsToPower4);
-  vQ.SetSumOfWeightsToPower5(dSumOfWeightsToPower5);
-  vQ.SetSumOfWeightsToPower6(dSumOfWeightsToPower6);
-  vQ.SetSumOfWeightsToPower7(dSumOfWeightsToPower7);
-  vQ.SetSumOfWeightsToPower8(dSumOfWeightsToPower8);
-
+  
   return vQ;
   
 }
index 187874b..121a35b 100644 (file)
@@ -28,65 +28,57 @@ ClassImp(AliFlowVector)
 //________________________________________________________________________
 
 AliFlowVector::AliFlowVector():
- fMult(0),
- fSumOfWeightsToPower2(0),
- fSumOfWeightsToPower3(0),
- fSumOfWeightsToPower4(0),
- fSumOfWeightsToPower5(0),
- fSumOfWeightsToPower6(0),
- fSumOfWeightsToPower7(0),
- fSumOfWeightsToPower8(0) 
- {
+ fMult(0)
+{
   // default contructor
- }
+}
+
+//________________________________________________________________________
 
 AliFlowVector::AliFlowVector(const AliFlowVector& aVector):
- TVector2(aVector),
- fMult(aVector.fMult),
- fSumOfWeightsToPower2(aVector.fSumOfWeightsToPower2),
- fSumOfWeightsToPower3(aVector.fSumOfWeightsToPower3),
- fSumOfWeightsToPower4(aVector.fSumOfWeightsToPower4),
- fSumOfWeightsToPower5(aVector.fSumOfWeightsToPower5),
- fSumOfWeightsToPower6(aVector.fSumOfWeightsToPower6),
- fSumOfWeightsToPower7(aVector.fSumOfWeightsToPower7),
- fSumOfWeightsToPower8(aVector.fSumOfWeightsToPower8)
- {
+  TVector2(aVector),
+  fMult(aVector.fMult)
+{
   // copy constructor
- }
-AliFlowVector::AliFlowVector(const TVector2 &v, const Double_t m, const Double_t sumPow2w, const Double_t sumPow3w, const Double_t sumPow4w, const Double_t sumPow5w, const Double_t sumPow6w, const Double_t sumPow7w, const Double_t sumPow8w):
- TVector2(v),
- fMult(m),
- fSumOfWeightsToPower2(sumPow2w),
- fSumOfWeightsToPower3(sumPow3w),
- fSumOfWeightsToPower4(sumPow4w),
- fSumOfWeightsToPower5(sumPow5w),
- fSumOfWeightsToPower6(sumPow6w),
- fSumOfWeightsToPower7(sumPow7w),
- fSumOfWeightsToPower8(sumPow8w) 
- {
+}
+
+ //________________________________________________________________________
+
+AliFlowVector::AliFlowVector(const TVector2 &v, const Double_t m):
+  TVector2(v),
+  fMult(m)
+{
   // custom constructor
- }
+}
+
+//________________________________________________________________________ 
+
 AliFlowVector::~AliFlowVector()
 {
- // default constructor 
+  // default constructor 
 }
+
+//________________________________________________________________________
+
 AliFlowVector& AliFlowVector::operator=(const AliFlowVector& aVector)
 {
- // assignement operator
- fX = aVector.X();
- fY = aVector.Y();
- fMult = aVector.GetMult();
- fSumOfWeightsToPower2 = aVector.GetSumOfWeightsToPower2();
- fSumOfWeightsToPower3 = aVector.GetSumOfWeightsToPower3();
- fSumOfWeightsToPower4 = aVector.GetSumOfWeightsToPower4();
- fSumOfWeightsToPower5 = aVector.GetSumOfWeightsToPower5();
- fSumOfWeightsToPower6 = aVector.GetSumOfWeightsToPower6();
- fSumOfWeightsToPower7 = aVector.GetSumOfWeightsToPower7();
- fSumOfWeightsToPower8 = aVector.GetSumOfWeightsToPower8();
- return *this;
+  // assignement operator
+  fX = aVector.X();
+  fY = aVector.Y();
+  fMult = aVector.GetMult();
+  
+  return *this;
 }
 
+//________________________________________________________________________
+
+AliFlowVector& AliFlowVector::operator+=(const AliFlowVector& aVector)
+{
+  // addition operator
+  fX += aVector.X(); 
+  fY += aVector.Y(); 
+  fMult += aVector.GetMult();
+  
+  return *this;
+}
 
index c3271ee..414aba7 100644 (file)
@@ -17,49 +17,32 @@ class AliFlowVector: public TVector2 {
  public:
   AliFlowVector();
   AliFlowVector(const AliFlowVector& aVector);
-  AliFlowVector(const TVector2 &p, const Double_t m, const Double_t sumPow2w, const Double_t sumPow3w, const Double_t sumPow4w, const Double_t sumPow5w, const Double_t sumPow6w, const Double_t sumPow7w, const Double_t sumPow8w);
+  AliFlowVector(const TVector2 &p, const Double_t m);
   virtual ~AliFlowVector();
 
   AliFlowVector& operator=(const AliFlowVector& aVector);
+  AliFlowVector& operator+=(const AliFlowVector& aVector);
 
   Bool_t  IsFolder() const {return kTRUE;};
 
   void SetMult(Double_t const mult) {this->fMult = mult;};
   Double_t GetMult() const {return this->fMult;};
-  
-  void SetSumOfWeightsToPower2(Double_t const p2w) {this->fSumOfWeightsToPower2 = p2w;};
-  Double_t GetSumOfWeightsToPower2() const {return this->fSumOfWeightsToPower2;};
-
-  void SetSumOfWeightsToPower3(Double_t const p3w) {this->fSumOfWeightsToPower3 = p3w;};
-  Double_t GetSumOfWeightsToPower3() const {return this->fSumOfWeightsToPower3;};
-  
-  void SetSumOfWeightsToPower4(Double_t const p4w) {this->fSumOfWeightsToPower4 = p4w;};
-  Double_t GetSumOfWeightsToPower4() const {return this->fSumOfWeightsToPower4;};
-  
-  void SetSumOfWeightsToPower5(Double_t const p5w) {this->fSumOfWeightsToPower5 = p5w;};
-  Double_t GetSumOfWeightsToPower5() const {return this->fSumOfWeightsToPower5;};
-  
-  void SetSumOfWeightsToPower6(Double_t const p6w) {this->fSumOfWeightsToPower6 = p6w;};
-  Double_t GetSumOfWeightsToPower6() const {return this->fSumOfWeightsToPower6;};
-  
-  void SetSumOfWeightsToPower7(Double_t const p7w) {this->fSumOfWeightsToPower7 = p7w;};
-  Double_t GetSumOfWeightsToPower7() const {return this->fSumOfWeightsToPower7;};
-  
-  void SetSumOfWeightsToPower8(Double_t const p8w) {this->fSumOfWeightsToPower8 = p8w;};
-  Double_t GetSumOfWeightsToPower8() const {return this->fSumOfWeightsToPower8;};
-    
+        
  private:
   Double_t fMult;                 // multiplicity = sum of weights = w_1 + w_2 + ... + w_n
-  Double_t fSumOfWeightsToPower2; // pow(w_1,2) + pow(w_2,2) + ... + pow(w_n,2)
-  Double_t fSumOfWeightsToPower3; // pow(w_1,3) + pow(w_2,3) + ... + pow(w_n,4)
-  Double_t fSumOfWeightsToPower4; // pow(w_1,4) + pow(w_2,4) + ... + pow(w_n,4)
-  Double_t fSumOfWeightsToPower5; // pow(w_1,5) + pow(w_2,5) + ... + pow(w_n,5)
-  Double_t fSumOfWeightsToPower6; // pow(w_1,6) + pow(w_2,6) + ... + pow(w_n,6)
-  Double_t fSumOfWeightsToPower7; // pow(w_1,7) + pow(w_2,7) + ... + pow(w_n,7)
-  Double_t fSumOfWeightsToPower8; // pow(w_1,8) + pow(w_2,8) + ... + pow(w_n,8)
+   
   ClassDef(AliFlowVector, 1) 
 };
-#endif
 
+inline  AliFlowVector operator+(const AliFlowVector& aVector,const AliFlowVector& bVector) {
+  AliFlowVector cVector;
+  Double_t x = aVector.X() + bVector.X(); 
+  Double_t y = aVector.Y() + bVector.Y(); 
+  Double_t mult = aVector.GetMult() + bVector.GetMult();
+  cVector.Set(x,y);
+  cVector.SetMult(mult);
+  
+  return cVector;
+}
 
+#endif