From c927722f475b777272c3694d810519bcce6150c2 Mon Sep 17 00:00:00 2001 From: hristov Date: Mon, 16 Oct 2006 09:49:43 +0000 Subject: [PATCH] Moving the analysis of balance function to PWG2 (Panos) --- ANALYSIS/ANALYSISLinkDef.h | 1 - ANALYSIS/AliBalance.cxx | 489 ------------------------------------- ANALYSIS/AliBalance.h | 73 ------ ANALYSIS/libANALYSIS.pkg | 4 +- 4 files changed, 2 insertions(+), 565 deletions(-) delete mode 100644 ANALYSIS/AliBalance.cxx delete mode 100644 ANALYSIS/AliBalance.h diff --git a/ANALYSIS/ANALYSISLinkDef.h b/ANALYSIS/ANALYSISLinkDef.h index 65703105e6a..16f15f5285c 100644 --- a/ANALYSIS/ANALYSISLinkDef.h +++ b/ANALYSIS/ANALYSISLinkDef.h @@ -97,6 +97,5 @@ #pragma link C++ class AliAnalysisEventCuts+; #pragma link C++ class AliAnalysisTrackCuts+; -#pragma link C++ class AliBalance+; #endif diff --git a/ANALYSIS/AliBalance.cxx b/ANALYSIS/AliBalance.cxx deleted file mode 100644 index 99f3f9853b0..00000000000 --- a/ANALYSIS/AliBalance.cxx +++ /dev/null @@ -1,489 +0,0 @@ -/************************************************************************** - * Author: Panos Christakoglou. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -/* $Id$ */ - -//----------------------------------------------------------------- -// Balance Function class -// This is the class to deal with the Balance Function analysis -// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch -//----------------------------------------------------------------- - - -//ROOT -#include -#include -#include -#include - -#include "AliBalance.h" - -ClassImp(AliBalance) - -//----------------------------------------// -AliBalance::AliBalance() -{ - // Default constructor - for(Int_t i = 0; i < MAXIMUM_NUMBER_OF_STEPS; i++) - { - fNpp[i] = .0; - fNnn[i] = .0; - fNpn[i] = .0; - fB[i] = 0.0; - ferror[i] = 0.0; - } - fNp = 0.0; - fNn = 0.0; - fP2Start = 0.0; - fP2Stop = 0.0; - fP2Step = 0.0; - fAnalysisType = 0; - fNumberOfBins = 0; - fNtrack = 0; - fAnalyzedEvents = 0; -} - -//----------------------------------------// -AliBalance::AliBalance(Double_t p2Start, Double_t p2Stop, Int_t p2Bins) -{ - // Constructor - for(Int_t i = 0; i < MAXIMUM_NUMBER_OF_STEPS; i++) - { - fNpp[i] = .0; - fNnn[i] = .0; - fNpn[i] = .0; - fB[i] = 0.0; - ferror[i] = 0.0; - } - fNp = 0.0; - fNn = 0.0; - fAnalysisType = 0; - fNtrack = 0; - fAnalyzedEvents = 0; - - fP2Start = p2Start; - fP2Stop = p2Stop; - fNumberOfBins = p2Bins; - fP2Step = TMath::Abs(fP2Start - fP2Stop) / (Double_t)fNumberOfBins; -} - -//----------------------------------------// -AliBalance::~AliBalance() -{ - // Destructor -} - -//----------------------------------------// -void AliBalance::SetNumberOfBins(Int_t ibins) -{ - // Sets the number of bins for the analyzed interval - fNumberOfBins = ibins ; -} - -//----------------------------------------// -void AliBalance::SetInterval(Double_t p2Start, Double_t p2Stop) -{ - // Sets the analyzed interval. - // The analysis variable is set by SetAnalysisType - fP2Start = p2Start; - fP2Stop = p2Stop; - fP2Step = TMath::Abs(p2Start - p2Stop) / (Double_t)fNumberOfBins; -} - -//----------------------------------------// -void AliBalance::SetAnalysisType(Int_t iType) -{ - //0:y - 1:eta - 2:Qlong - 3:Qout - 4:Qside - 5:Qinv - 6:phi - this->fAnalysisType = iType; - if(fAnalysisType==0) - { - cout<<" ====================== "<fV = P; - this->fCharge = charge; - fNtrack = dim; -} - - -//----------------------------------------// -void AliBalance::CalculateBalance() -{ - // Calculates the balance function - fAnalyzedEvents++; - Int_t i = 0 , j = 0; - Int_t ibin = 0; - - for(i = 0; i < fNtrack; i++) - { - if(fCharge[i] > 0) - fNp += 1.; - if(fCharge[i] < 0) - fNn += 1.; - } - - //0:y - 1:eta - 2:Qlong - 3:Qout - 4:Qside - 5:Qinv - 6:phi - if(fAnalysisType==0) - { - for(i = 1; i < fNtrack; i++) - { - for(j = 0; j < i; j++) - { - Double_t rap1 = 0.5*log((fV[i].E() + fV[i].Pz())/(fV[i].E() - fV[i].Pz())); - Double_t rap2 = 0.5*log((fV[j].E() + fV[j].Pz())/(fV[j].E() - fV[j].Pz())); - Double_t dy = TMath::Abs(rap1 - rap2); - ibin = Int_t(dy/fP2Step); - if((fCharge[i] > 0)&&(fCharge[j] > 0)) - fNpp[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] < 0)) - fNnn[ibin] += 1.; - if((fCharge[i] > 0)&&(fCharge[j] < 0)) - fNpn[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] > 0)) - fNpn[ibin] += 1.; - } - } - }//case 0 - if(fAnalysisType==1) - { - for(i = 1; i < fNtrack; i++) - { - for(j = 0; j < i; j++) - { - Double_t p1 = sqrt(pow(fV[i].Px(),2) + pow(fV[i].Py(),2) + pow(fV[i].Pz(),2)); - Double_t p2 = sqrt(pow(fV[j].Px(),2) + pow(fV[j].Py(),2) + pow(fV[j].Pz(),2)); - Double_t eta1 = 0.5*log((p1 + fV[i].Pz())/(p1 - fV[i].Pz())); - Double_t eta2 = 0.5*log((p2 + fV[j].Pz())/(p2 - fV[j].Pz())); - Double_t deta = TMath::Abs(eta1 - eta2); - ibin = Int_t(deta/fP2Step); - if((fCharge[i] > 0)&&(fCharge[j] > 0)) - fNpp[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] < 0)) - fNnn[ibin] += 1.; - if((fCharge[i] > 0)&&(fCharge[j] < 0)) - fNpn[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] > 0)) - fNpn[ibin] += 1.; - } - } - }//case 1 - if(fAnalysisType==2) - { - for(i = 1; i < fNtrack; i++) - { - for(j = 0; j < i; j++) - { - Double_t eTot = fV[i].E() + fV[j].E(); - Double_t pxTot = fV[i].Px() + fV[j].Px(); - Double_t pyTot = fV[i].Py() + fV[j].Py(); - Double_t pzTot = fV[i].Pz() + fV[j].Pz(); - Double_t q0Tot = fV[i].E() - fV[j].E(); - Double_t qzTot = fV[i].Pz() - fV[j].Pz(); - Double_t snn = pow(eTot,2) - pow(pxTot,2) - pow(pyTot,2) - pow(pzTot,2); - Double_t ptTot = sqrt( pow(pxTot,2) + pow(pyTot,2)); - Double_t qLong = TMath::Abs(eTot*qzTot - pzTot*q0Tot)/sqrt(snn + pow(ptTot,2)); - ibin = Int_t(qLong/fP2Step); - //cout< 0)&&(fCharge[j] > 0)) - fNpp[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] < 0)) - fNnn[ibin] += 1.; - if((fCharge[i] > 0)&&(fCharge[j] < 0)) - fNpn[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] > 0)) - fNpn[ibin] += 1.; - } - } - }//case 2 - if(fAnalysisType==3) - { - for(i = 1; i < fNtrack; i++) - { - for(j = 0; j < i; j++) - { - Double_t eTot = fV[i].E() + fV[j].E(); - Double_t pxTot = fV[i].Px() + fV[j].Px(); - Double_t pyTot = fV[i].Py() + fV[j].Py(); - Double_t pzTot = fV[i].Pz() + fV[j].Pz(); - Double_t qxTot = fV[i].Px() - fV[j].Px(); - Double_t qyTot = fV[i].Py() - fV[j].Py(); - Double_t snn = pow(eTot,2) - pow(pxTot,2) - pow(pyTot,2) - pow(pzTot,2); - Double_t ptTot = sqrt( pow(pxTot,2) + pow(pyTot,2)); - Double_t qOut = sqrt(snn/(snn + pow(ptTot,2))) * TMath::Abs(pxTot*qxTot + pyTot*qyTot)/ptTot; - ibin = Int_t(qOut/fP2Step); - //cout< 0)&&(fCharge[j] > 0)) - fNpp[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] < 0)) - fNnn[ibin] += 1.; - if((fCharge[i] > 0)&&(fCharge[j] < 0)) - fNpn[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] > 0)) - fNpn[ibin] += 1.; - } - } - }//case 3 - if(fAnalysisType==4) - { - for(i = 1; i < fNtrack; i++) - { - for(j = 0; j < i; j++) - { - Double_t pxTot = fV[i].Px() + fV[j].Px(); - Double_t pyTot = fV[i].Py() + fV[j].Py(); - Double_t qxTot = fV[i].Px() - fV[j].Px(); - Double_t qyTot = fV[i].Py() - fV[j].Py(); - Double_t ptTot = sqrt( pow(pxTot,2) + pow(pyTot,2)); - Double_t qSide = TMath::Abs(pxTot*qyTot - pyTot*qxTot)/ptTot; - ibin = Int_t(qSide/fP2Step); - //cout< 0)&&(fCharge[j] > 0)) - fNpp[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] < 0)) - fNnn[ibin] += 1.; - if((fCharge[i] > 0)&&(fCharge[j] < 0)) - fNpn[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] > 0)) - fNpn[ibin] += 1.; - } - } - }//case 4 - if(fAnalysisType==5) - { - for(i = 1; i < fNtrack; i++) - { - for(j = 0; j < i; j++) - { - Double_t q0Tot = fV[i].E() - fV[j].E(); - Double_t qxTot = fV[i].Px() - fV[j].Px(); - Double_t qyTot = fV[i].Py() - fV[j].Py(); - Double_t qzTot = fV[i].Pz() - fV[j].Pz(); - Double_t qInv = sqrt(TMath::Abs(-pow(q0Tot,2) +pow(qxTot,2) +pow(qyTot,2) +pow(qzTot,2))); - ibin = Int_t(qInv/fP2Step); - //cout< 0)&&(fCharge[j] > 0)) - fNpp[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] < 0)) - fNnn[ibin] += 1.; - if((fCharge[i] > 0)&&(fCharge[j] < 0)) - fNpn[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] > 0)) - fNpn[ibin] += 1.; - } - } - }//case 5 - if(fAnalysisType==6) - { - for(i = 1; i < fNtrack; i++) - { - for(j = 0; j < i; j++) - { - Double_t phi1 = TMath::ATan(fV[i].Py()/fV[i].Px())*180.0/TMath::Pi(); - Double_t phi2 = TMath::ATan(fV[j].Py()/fV[j].Px())*180.0/TMath::Pi(); - Double_t dphi = TMath::Abs(phi1 - phi2); - ibin = Int_t(dphi/fP2Step); - if((fCharge[i] > 0)&&(fCharge[j] > 0)) - fNpp[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] < 0)) - fNnn[ibin] += 1.; - if((fCharge[i] > 0)&&(fCharge[j] < 0)) - fNpn[ibin] += 1.; - if((fCharge[i] < 0)&&(fCharge[j] > 0)) - fNpn[ibin] += 1.; - } - } - }//case 6 -} - -//----------------------------------------// -Double_t AliBalance::GetBalance(Int_t p2) -{ - // Returns the value of the balance function in bin p2 - fB[p2] = 0.5*(((fNpn[p2] - 2.0*fNnn[p2])/fNn) + ((fNpn[p2] - 2.0*fNpp[p2])/fNp))/fP2Step; - - return fB[p2]; -} - -//----------------------------------------// -Double_t AliBalance::GetError(Int_t p2) -{ - // Returns the error on the BF value for bin p2 - ferror[p2] = sqrt( Double_t(fNpp[p2])/(Double_t(fNp)*Double_t(fNp)) + Double_t(fNnn[p2])/(Double_t(fNn)*Double_t(fNn)) + Double_t(fNpn[p2])*pow((0.5/Double_t(fNp) + 0.5/Double_t(fNn)),2))/fP2Step; - - return ferror[p2]; -} - -//----------------------------------------// -void AliBalance::PrintResults() -{ - // Prints the results - Double_t x[MAXIMUM_NUMBER_OF_STEPS]; - Double_t fSumXi = 0.0, fSumBi = 0.0, fSumBiXi = 0.0; - Double_t fSumBiXi2 = 0.0, fSumBi2Xi2 = 0.0; - Double_t fSumDeltaBi2 = 0.0, fSumXi2DeltaBi2 = 0.0; - Double_t deltaBalP2 = 0.0, integral = 0.0; - Double_t deltaErrorNew = 0.0; - - cout<<"=================================================="<SetMarkerStyle(25) ; - gr->GetXaxis()->SetTitleColor(1); - if(fAnalysisType==0) - { - gr->GetXaxis()->SetTitle("#Delta y"); - gr->GetYaxis()->SetTitle("B(#Delta y)"); - } - if(fAnalysisType==1) - { - gr->GetXaxis()->SetTitle("#Delta #eta"); - gr->GetYaxis()->SetTitle("B(#Delta #eta)"); - } - if(fAnalysisType==2) - { - gr->GetXaxis()->SetTitle("Q_{long} [GeV]"); - gr->GetYaxis()->SetTitle("B(Q_{long})"); - } - if(fAnalysisType==3) - { - gr->GetXaxis()->SetTitle("Q_{out} [GeV]"); - gr->GetYaxis()->SetTitle("B(Q_{out})"); - } - if(fAnalysisType==4) - { - gr->GetXaxis()->SetTitle("Q_{side} [GeV]"); - gr->GetYaxis()->SetTitle("B(Q_{side})"); - } - if(fAnalysisType==5) - { - gr->GetXaxis()->SetTitle("Q_{inv} [GeV]"); - gr->GetYaxis()->SetTitle("B(Q_{inv})"); - } - if(fAnalysisType==6) - { - gr->GetXaxis()->SetTitle("#Delta #phi"); - gr->GetYaxis()->SetTitle("B(#Delta #phi)"); - } - gr->Draw("AP") ; - - return gr; -} diff --git a/ANALYSIS/AliBalance.h b/ANALYSIS/AliBalance.h deleted file mode 100644 index 6dc869c21a5..00000000000 --- a/ANALYSIS/AliBalance.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef ALIBALANCE_H -#define ALIBALANCE_H -/* See cxx source for full Copyright notice */ - - -/* $Id$ */ - -//------------------------------------------------------------------------- -// Class AliBalance -// This is the class for the Balance Function analysis -// -// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch -//------------------------------------------------------------------------- - -#include - -#define MAXIMUM_NUMBER_OF_STEPS 1024 - -class TLorentzVector; -class TGraphErrors; - -class AliBalance : public TObject -{ - public: - AliBalance(); - - AliBalance(Double_t p2Start, Double_t p2Stop, Int_t p2Steps); - - ~AliBalance(); - - void SetParticles(TLorentzVector *P, Double_t *charge, Int_t dim); - void SetNumberOfBins(Int_t ibins); - void SetAnalysisType(Int_t iType); - void SetInterval(Double_t p2Start, Double_t p2Stop); - - void CalculateBalance(); - - Double_t GetNp() const { return 1.0*fNp; } - Double_t GetNn() const { return 1.0*fNn; } - Double_t GetNnn(Int_t p2) const { return 1.0*fNnn[p2]; } - Double_t GetNpp(Int_t p2) const { return 1.0*fNpp[p2]; } - Double_t GetNpn(Int_t p2) const { return 1.0*fNpn[p2]; } - - Double_t GetBalance(Int_t p2); - Double_t GetError(Int_t p2); - - TGraphErrors *DrawBalance(); - void PrintResults(); - - private: - Double_t *fCharge; //matrix with the charge of each track - Int_t fNtrack; //number of tracks to compute the BF - - TLorentzVector *fV; //4-momentum vector - info for tracks used to compute the BF - - Int_t fNumberOfBins; //number of bins of the analyzed interval - Int_t fAnalysisType; //0:y - 1:eta - 2:Qlong - 3:Qout - 4:Qside - 5:Qinv - 6:phi - Int_t fAnalyzedEvents; //number of events that have been analyzed - - Double_t fP2Start, fP2Stop, fP2Step; //inerval info - - Double_t fNnn[MAXIMUM_NUMBER_OF_STEPS]; //N(--) - Double_t fNpp[MAXIMUM_NUMBER_OF_STEPS]; //N(++) - Double_t fNpn[MAXIMUM_NUMBER_OF_STEPS]; //N(+-) - Double_t fNn, fNp; //number of pos./neg. inside the analyzed interval - - Double_t fB[MAXIMUM_NUMBER_OF_STEPS]; //BF matrix - Double_t ferror[MAXIMUM_NUMBER_OF_STEPS]; //error of the BF - - ClassDef(AliBalance, 1) -} ; - -#endif diff --git a/ANALYSIS/libANALYSIS.pkg b/ANALYSIS/libANALYSIS.pkg index 8ddf2c2c7bb..76dfa8dc58e 100644 --- a/ANALYSIS/libANALYSIS.pkg +++ b/ANALYSIS/libANALYSIS.pkg @@ -11,7 +11,7 @@ SRCS= TGliteXmlEventlist.cxx\ AliTrackPoints.cxx AliClusterMap.cxx \ AliD0toKpi.cxx AliD0toKpiAnalysis.cxx AliFlowAnalysis.cxx \ AliMuonAnalysis.cxx AliAODv0.cxx AliAODxi.cxx AliAODevent.cxx \ - AliAnalysisEventCuts.cxx AliAnalysisTrackCuts.cxx AliBalance.cxx + AliAnalysisEventCuts.cxx AliAnalysisTrackCuts.cxx HDRS= $(SRCS:.cxx=.h) @@ -28,6 +28,6 @@ EXPORT:=AliAOD.h AliEventBuffer.h\ AliTrackPoints.h AliClusterMap.h \ AliFlowAnalysis.h AliReaderESDTree.h \ AliMuonAnalysis.h AliAODv0.h AliAODxi.h AliAODevent.h \ - AliAnalysisEventCuts.h AliAnalysisTrackCuts.h AliBalance.h + AliAnalysisEventCuts.h AliAnalysisTrackCuts.h EINCLUDE:= TPC ITS -- 2.39.3