1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
18 //_________________________________________________________________________
19 // Class to perform flattening of the event plane distribution
20 // It stores necessary parameterizations and apply when requested
22 //*-- Author: Dmitri Peressounko (RRC KI)
24 // --- ROOT system ---
29 // --- Standard library ---
31 // --- AliRoot header files ---
33 #include "AliEPFlattener.h"
37 ClassImp(AliEPFlattener)
39 //____________________________________________________________________________
40 AliEPFlattener::AliEPFlattener() :
48 // Nothing to initialize
51 //____________________________________________________________________________
52 AliEPFlattener::AliEPFlattener(const char * name) :
53 TNamed(name,"EPFlattener"),
59 // Nothing to initialize
61 //____________________________________________________________________________
62 AliEPFlattener::AliEPFlattener(const AliEPFlattener & fl):
63 TNamed(fl.GetName(),"EPFlattener"),
71 fNCentrBins = fl.fNCentrBins ;
72 fNHarmonics = fl.fNHarmonics ;
73 fNparam = fl.fNparam ;
74 fParam = new Double32_t[fNparam] ;
75 for(Int_t i=0; i<fNparam; i++)
76 fParam[i]=fl.fParam[i] ;
79 //____________________________________________________________________________
80 AliEPFlattener & AliEPFlattener::operator = (const AliEPFlattener & fl)
84 SetName(fl.GetName()) ;
85 fNCentrBins = fl.fNCentrBins ;
86 fNHarmonics = fl.fNHarmonics ;
87 fNparam = fl.fNparam ;
88 if(fParam) delete [] fParam ;
89 fParam = new Double32_t[fNparam] ;
90 for(Int_t i=0; i<fNparam; i++)
91 fParam[i]=fl.fParam[i] ;
95 //____________________________________________________________________________
96 AliEPFlattener::~AliEPFlattener()
107 //____________________________________________________________________________
108 Double_t AliEPFlattener::MakeFlat(Double_t oldPhi,Double_t centrality)const
110 //Apply flattening using existing parameterizations
111 if(fNCentrBins==0) return oldPhi; //No correction encoded
113 Double_t result = oldPhi ;
115 Int_t icen=(Int_t) (centrality*fNCentrBins/100.) ;
116 if(icen>=fNCentrBins)icen = fNCentrBins-1 ;
118 //Offset in the array
119 icen=icen*fNHarmonics ;
121 for(Int_t i = 1; i<=fNHarmonics/2; i++){
122 Double_t c = 2./i*fParam[icen+2*i-2] ; //fParam==Mean cos(n*phi) for a given centrality
123 Double_t s = 2./i*fParam[icen+2*i-1]; //fParam==Mean sin(n*phi) for a given centrality
124 result += c*TMath::Sin(i*oldPhi)-s*TMath::Cos(i*oldPhi) ;
128 //____________________________________________________________________________
129 void AliEPFlattener::SetParameterization(TH2 * h){
130 //Fill parameterizations
131 //We expect histogram with <cos(i*phi)>, <sin(i*phi)> with centrality bins in x axis
132 //and harmonics: <cos(x)>, <sin(x)>, <cos(2x)>, <sin(2x)>, .... in y axis
134 fNCentrBins = h->GetXaxis()->GetNbins() ;
135 fNHarmonics = h->GetYaxis()->GetNbins() ;
136 fNparam = fNCentrBins*fNHarmonics ;
137 if(fParam) delete [] fParam ;
138 fParam = new Double32_t[fNparam] ;
139 for(Int_t i=0; i<fNCentrBins; i++)
140 for(Int_t j=0; j<fNHarmonics; j++)
141 fParam[i*fNHarmonics+j]=h->GetBinContent(i+1,j+1) ;