]>
Commit | Line | Data |
---|---|---|
47ed3090 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //_________________________________________________________________________ | |
19 | // Class to perform flattening of the event plane distribution | |
20 | // It stores necessary parameterizations and apply when requested | |
21 | // | |
22 | //*-- Author: Dmitri Peressounko (RRC KI) | |
23 | ||
24 | // --- ROOT system --- | |
25 | ||
26 | #include "TMath.h" | |
27 | #include "TH2.h" | |
28 | ||
29 | // --- Standard library --- | |
30 | ||
31 | // --- AliRoot header files --- | |
32 | ||
33 | #include "AliEPFlattener.h" | |
34 | ||
35 | ||
36 | ||
37 | ClassImp(AliEPFlattener) | |
38 | ||
39 | //____________________________________________________________________________ | |
40 | AliEPFlattener::AliEPFlattener() : | |
41 | TNamed(), | |
42 | fNCentrBins(0), | |
43 | fNHarmonics(0), | |
44 | fNparam(0), | |
45 | fParam(0x0) | |
46 | { | |
47 | // default ctor | |
48 | // Nothing to initialize | |
49 | } | |
50 | ||
51 | //____________________________________________________________________________ | |
52 | AliEPFlattener::AliEPFlattener(const char * name) : | |
53 | TNamed(name,"EPFlattener"), | |
54 | fNCentrBins(0), | |
55 | fNHarmonics(0), | |
56 | fNparam(0), | |
57 | fParam(0x0) | |
58 | { | |
59 | // Nothing to initialize | |
60 | } | |
61 | //____________________________________________________________________________ | |
62 | AliEPFlattener::AliEPFlattener(const AliEPFlattener & fl): | |
63 | TNamed(fl.GetName(),"EPFlattener"), | |
64 | fNCentrBins(0), | |
65 | fNHarmonics(0), | |
66 | fNparam(0), | |
67 | fParam(0x0) | |
68 | ||
69 | { | |
70 | ||
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] ; | |
77 | } | |
78 | ||
79 | //____________________________________________________________________________ | |
80 | AliEPFlattener & AliEPFlattener::operator = (const AliEPFlattener & fl) | |
81 | { | |
82 | if(this== &fl) | |
83 | return *this ; | |
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] ; | |
92 | ||
93 | return *this; | |
94 | } | |
95 | //____________________________________________________________________________ | |
96 | AliEPFlattener::~AliEPFlattener() | |
97 | { | |
98 | // Nothing to delete | |
99 | fNCentrBins = 0 ; | |
100 | fNHarmonics = 0 ; | |
101 | fNparam = 0 ; | |
102 | if(fParam) | |
103 | delete [] fParam ; | |
104 | fParam = 0x0 ; | |
105 | ||
106 | } | |
107 | //____________________________________________________________________________ | |
108 | Double_t AliEPFlattener::MakeFlat(Double_t oldPhi,Double_t centrality)const | |
109 | { | |
110 | //Apply flattening using existing parameterizations | |
111 | if(fNCentrBins==0) return oldPhi; //No correction encoded | |
112 | ||
113 | Double_t result = oldPhi ; | |
114 | //Centrality bin | |
115 | Int_t icen=(Int_t) (centrality*fNCentrBins/100.) ; | |
116 | if(icen>=fNCentrBins)icen = fNCentrBins-1 ; | |
117 | ||
118 | //Offset in the array | |
119 | icen=icen*fNHarmonics ; | |
120 | ||
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) ; | |
125 | } | |
126 | return result ; | |
127 | } | |
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 | |
133 | ||
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) ; | |
142 | } | |
143 |