]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
First version of the merging function to be used for CAF and GRID
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Jul 2009 11:26:52 +0000 (11:26 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Jul 2009 11:26:52 +0000 (11:26 +0000)
PWG2/EBYE/AliBalance.cxx
PWG2/EBYE/AliBalance.h

index c6c19c94372b134f0751cc14f8a5a4f4dcedddf6..b1e6c7f2dd6ae9145262e2f63b8184d01c7ab1cb 100644 (file)
@@ -180,6 +180,43 @@ void AliBalance::SetAnalysisType(Int_t iType) {
   }
 }
 
+//____________________________________________________________________//
+const char* AliBalance::GetAnalysisType() {
+  //0:y - 1:eta - 2:Qlong - 3:Qout - 4:Qside - 5:Qinv - 6:phi
+  TString analysisType;
+  switch(fAnalysisType) {
+  case 0:
+    analysisType = "Rapidity"; 
+    break;
+  case 1:
+    analysisType = "Pseudo-rapidity"; 
+    break;
+  case 2:
+    analysisType = "Qlong"; 
+    break;
+  case 3:
+    analysisType = "Qout"; 
+    break;
+  case 4:
+    analysisType = "Qside"; 
+    break;
+  case 5:
+    analysisType = "Qinv"; 
+    break;
+  case 6:
+    analysisType = "Phi"; 
+    break;
+  default:
+    break;
+  }
+  analysisType += "\nInterval: ";
+  analysisType += fP2Start; analysisType += " - "; analysisType += fP2Stop;
+  analysisType += "\nSteps: "; analysisType += fP2Step;
+  analysisType += "\nBins: "; analysisType += fNumberOfBins;
+
+  return analysisType.Data();
+}
+
 //____________________________________________________________________//
 void AliBalance::SetParticles(TLorentzVector *P, Double_t *charge, Int_t dim) {
   // Sets a new particle with given 4-momentum and charge.
@@ -440,3 +477,15 @@ TGraphErrors *AliBalance::DrawBalance() {
 
   return gr;
 }
+
+//____________________________________________________________________//
+void AliBalance::Merge(AliBalance *b) {
+  //Merging function to be used for proof and grid
+  fNp += b->GetNp();
+  fNn += b->GetNn();
+  for(Int_t i = 0; i < fNumberOfBins; i++) {
+    fNnn[i] += b->GetNnn(i);
+    fNpp[i] += b->GetNpp(i);
+    fNpn[i] += b->GetNpn(i);
+  }
+}
index 495b3e3bca59583f0fb26036b5b1ed74f51c1df6..f9edb2999239abe274a979a590e6c6fa75c5f997 100644 (file)
@@ -32,6 +32,9 @@ class AliBalance : public TObject
   void SetAnalysisType(Int_t iType);
   void SetInterval(Double_t p2Start, Double_t p2Stop);
 
+  Int_t GetNumberOfBins() {return fNumberOfBins;}
+  const char* GetAnalysisType();
+
   void SetNp(Int_t np) {fNp = np;}
   void SetNn(Int_t nn) {fNn = nn;}
   void SetNnn(Double_t *nn);
@@ -52,6 +55,8 @@ class AliBalance : public TObject
   TGraphErrors *DrawBalance();
   void PrintResults();
 
+  void Merge(AliBalance *b);
+
  private:
   Double_t *fCharge; //matrix with the charge of each track
   Int_t fNtrack; //number of tracks to compute the BF