/************************************************************************** * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * 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. * **************************************************************************/ #include #include "AliAODEvent.h" #include "AliVertexingHFUtils.h" /* $Id: $ */ /////////////////////////////////////////////////////////////////// // // // Class with functions useful for different D2H analyses // // - event plane resolution // // - calculation with side band subtraction // // - tracklet multiplcity calculation // // Origin: F.Prino, Torino, prino@to.infn.it // // // /////////////////////////////////////////////////////////////////// ClassImp(AliVertexingHFUtils) //______________________________________________________________________ AliVertexingHFUtils::AliVertexingHFUtils():TObject(), fK(1), fSubRes(1.), fMinEtaForTracklets(-1.), fMaxEtaForTracklets(1.) { // Default contructor } //______________________________________________________________________ AliVertexingHFUtils::AliVertexingHFUtils(Int_t k): TObject(), fK(k), fSubRes(1.), fMinEtaForTracklets(-1.), fMaxEtaForTracklets(1.) { // Standard constructor } //______________________________________________________________________ Double_t AliVertexingHFUtils::Pol(Double_t x, Int_t k){ // compute chi from polynomial approximation Double_t c[5]; if(k==1){ c[0]=0.626657; c[1]=0.; c[2]=-0.09694; c[3]=0.02754; c[4]=-0.002283; } else if(k==2){ c[0]=0.; c[1]=0.25; c[2]=-0.011414; c[3]=-0.034726; c[4]=0.006815; } else return -1; return c[0]*x+c[1]*x*x+c[2]*x*x*x+c[3]*x*x*x*x+c[4]*x*x*x*x*x; } //______________________________________________________________________ Double_t AliVertexingHFUtils:: ResolK1(Double_t x){ return TMath::Sqrt(TMath::Pi()/8)*x*TMath::Exp(-x*x/4)*(TMath::BesselI0(x*x/4)+TMath::BesselI1(x*x/4)); } //______________________________________________________________________ Double_t AliVertexingHFUtils::FindChi(Double_t res, Int_t k){ // compute chi variable (=v2*sqrt(N)) from external values Double_t x1=0; Double_t x2=15; Double_t y1,y2; if(k==1){ y1=ResolK1(x1)-res; y2=ResolK1(x2)-res; } else if(k==2){ y1=Pol(x1,2)-res; y2=Pol(x2,2)-res; } else return -1; if(y1*y2>0) return -1; if(y1==0) return y1; if(y2==0) return y2; Double_t xmed,ymed; Int_t jiter=0; while((x2-x1)>0.0001){ xmed=0.5*(x1+x2); if(k==1){ y1=ResolK1(x1)-res; y2=ResolK1(x2)-res; ymed=ResolK1(xmed)-res; } else if(k==2){ y1=Pol(x1,2)-res; y2=Pol(x2,2)-res; ymed=Pol(xmed,2)-res; } else return -1; if((y1*ymed)<0) x2=xmed; if((y2*ymed)<0)x1=xmed; if(ymed==0) return xmed; jiter++; } return 0.5*(x1+x2); } //______________________________________________________________________ Double_t AliVertexingHFUtils::GetFullEvResol(Double_t resSub, Int_t k){ // computes event plane resolution starting from sub event resolution Double_t chisub=FindChi(resSub,k); Double_t chifull=chisub*TMath::Sqrt(2); if(k==1) return ResolK1(chifull); else if(k==2) return Pol(chifull,2); else{ printf("k should be <=2\n"); return 1.; } } //______________________________________________________________________ Double_t AliVertexingHFUtils::GetFullEvResol(const TH1F* hSubEvCorr, Int_t k){ // computes event plane resolution starting from sub event correlation histogram if(!hSubEvCorr) return 1.; Double_t resSub=GetSubEvResol(hSubEvCorr); return GetFullEvResol(resSub,k); } //______________________________________________________________________ Double_t AliVertexingHFUtils::GetFullEvResolLowLim(const TH1F* hSubEvCorr, Int_t k){ // computes low limit event plane resolution starting from sub event correlation histogram if(!hSubEvCorr) return 1.; Double_t resSub=GetSubEvResolLowLim(hSubEvCorr); printf("%f\n",resSub); return GetFullEvResol(resSub,k); } //______________________________________________________________________ Double_t AliVertexingHFUtils::GetFullEvResolHighLim(const TH1F* hSubEvCorr, Int_t k){ // computes high limit event plane resolution starting from sub event correlation histogram if(!hSubEvCorr) return 1.; Double_t resSub=GetSubEvResolHighLim(hSubEvCorr); printf("%f\n",resSub); return GetFullEvResol(resSub,k); } //______________________________________________________________________ Int_t AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(AliAODEvent* ev, Double_t mineta, Double_t maxeta){ // counts tracklets in given eta range AliAODTracklets* tracklets=ev->GetTracklets(); Int_t nTr=tracklets->GetNumberOfTracklets(); Int_t count=0; for(Int_t iTr=0; iTrGetTheta(iTr); Double_t eta=-TMath::Log(TMath::Tan(theta/2.)); if(eta>mineta && eta