1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 #include "AliAODEvent.h"
18 #include "AliVertexingHFUtils.h"
22 ///////////////////////////////////////////////////////////////////
24 // Class with functions useful for different D2H analyses //
25 // - event plane resolution //
26 // - <pt> calculation with side band subtraction //
27 // - tracklet multiplcity calculation //
28 // Origin: F.Prino, Torino, prino@to.infn.it //
30 ///////////////////////////////////////////////////////////////////
32 ClassImp(AliVertexingHFUtils)
34 //______________________________________________________________________
35 AliVertexingHFUtils::AliVertexingHFUtils():TObject(),
38 fMinEtaForTracklets(-1.),
39 fMaxEtaForTracklets(1.)
45 //______________________________________________________________________
46 AliVertexingHFUtils::AliVertexingHFUtils(Int_t k):
50 fMinEtaForTracklets(-1.),
51 fMaxEtaForTracklets(1.)
53 // Standard constructor
57 //______________________________________________________________________
58 Double_t AliVertexingHFUtils::Pol(Double_t x, Int_t k){
59 // compute chi from polynomial approximation
62 c[0]=0.626657; c[1]=0.; c[2]=-0.09694; c[3]=0.02754; c[4]=-0.002283;
65 c[0]=0.; c[1]=0.25; c[2]=-0.011414; c[3]=-0.034726; c[4]=0.006815;
68 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;
71 //______________________________________________________________________
72 Double_t AliVertexingHFUtils:: ResolK1(Double_t x){
73 return TMath::Sqrt(TMath::Pi()/8)*x*TMath::Exp(-x*x/4)*(TMath::BesselI0(x*x/4)+TMath::BesselI1(x*x/4));
77 //______________________________________________________________________
78 Double_t AliVertexingHFUtils::FindChi(Double_t res, Int_t k){
79 // compute chi variable (=v2*sqrt(N)) from external values
94 if(y1*y2>0) return -1;
99 while((x2-x1)>0.0001){
104 ymed=ResolK1(xmed)-res;
109 ymed=Pol(xmed,2)-res;
112 if((y1*ymed)<0) x2=xmed;
113 if((y2*ymed)<0)x1=xmed;
114 if(ymed==0) return xmed;
120 //______________________________________________________________________
121 Double_t AliVertexingHFUtils::GetFullEvResol(Double_t resSub, Int_t k){
122 // computes event plane resolution starting from sub event resolution
123 Double_t chisub=FindChi(resSub,k);
124 Double_t chifull=chisub*TMath::Sqrt(2);
125 if(k==1) return ResolK1(chifull);
126 else if(k==2) return Pol(chifull,2);
128 printf("k should be <=2\n");
133 //______________________________________________________________________
134 Double_t AliVertexingHFUtils::GetFullEvResol(const TH1F* hSubEvCorr, Int_t k){
135 // computes event plane resolution starting from sub event correlation histogram
136 if(!hSubEvCorr) return 1.;
137 Double_t resSub=GetSubEvResol(hSubEvCorr);
138 return GetFullEvResol(resSub,k);
140 //______________________________________________________________________
141 Double_t AliVertexingHFUtils::GetFullEvResolLowLim(const TH1F* hSubEvCorr, Int_t k){
142 // computes low limit event plane resolution starting from sub event correlation histogram
143 if(!hSubEvCorr) return 1.;
144 Double_t resSub=GetSubEvResolLowLim(hSubEvCorr);
145 printf("%f\n",resSub);
146 return GetFullEvResol(resSub,k);
148 //______________________________________________________________________
149 Double_t AliVertexingHFUtils::GetFullEvResolHighLim(const TH1F* hSubEvCorr, Int_t k){
150 // computes high limit event plane resolution starting from sub event correlation histogram
151 if(!hSubEvCorr) return 1.;
152 Double_t resSub=GetSubEvResolHighLim(hSubEvCorr);
153 printf("%f\n",resSub);
154 return GetFullEvResol(resSub,k);
156 //______________________________________________________________________
157 Int_t AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(AliAODEvent* ev, Double_t mineta, Double_t maxeta){
158 // counts tracklets in given eta range
159 AliAODTracklets* tracklets=ev->GetTracklets();
160 Int_t nTr=tracklets->GetNumberOfTracklets();
162 for(Int_t iTr=0; iTr<nTr; iTr++){
163 Double_t theta=tracklets->GetTheta(iTr);
164 Double_t eta=-TMath::Log(TMath::Tan(theta/2.));
165 if(eta>mineta && eta<maxeta) count++;