]>
Commit | Line | Data |
---|---|---|
b509e3a5 | 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 | ||
b8bea077 | 16 | /* $Id$ */ |
b509e3a5 | 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" | |
b8bea077 | 27 | #include "TH2.h" |
b509e3a5 | 28 | |
29 | // --- Standard library --- | |
30 | ||
31 | // --- AliRoot header files --- | |
32 | ||
33 | #include "AliPHOSEPFlattener.h" | |
34 | ||
35 | ||
36 | ||
37 | ClassImp(AliPHOSEPFlattener) | |
38 | ||
39 | //____________________________________________________________________________ | |
40 | AliPHOSEPFlattener::AliPHOSEPFlattener() : | |
41 | TNamed(), | |
42 | fNCentrBins(0), | |
43 | fNHarmonics(0), | |
b8bea077 | 44 | fNparam(0), |
b509e3a5 | 45 | fParam(0x0) |
46 | { | |
47 | // default ctor | |
48 | // Nothing to initialize | |
49 | } | |
50 | ||
51 | //____________________________________________________________________________ | |
52 | AliPHOSEPFlattener::AliPHOSEPFlattener(const char * name) : | |
53 | TNamed(name,"PHOSEPFlattener"), | |
54 | fNCentrBins(0), | |
55 | fNHarmonics(0), | |
b8bea077 | 56 | fNparam(0), |
b509e3a5 | 57 | fParam(0x0) |
58 | { | |
59 | // Nothing to initialize | |
60 | } | |
61 | //____________________________________________________________________________ | |
62 | AliPHOSEPFlattener::AliPHOSEPFlattener(const AliPHOSEPFlattener & fl): | |
63 | TNamed(fl.GetName(),"PHOSEPFlattener"), | |
64 | fNCentrBins(0), | |
65 | fNHarmonics(0), | |
b8bea077 | 66 | fNparam(0), |
b509e3a5 | 67 | fParam(0x0) |
68 | ||
69 | { | |
70 | ||
71 | fNCentrBins = fl.fNCentrBins ; | |
72 | fNHarmonics = fl.fNHarmonics ; | |
b8bea077 | 73 | fNparam = fl.fNparam ; |
74 | fParam = new Double32_t[fNparam] ; | |
75 | for(Int_t i=0; i<fNparam; i++) | |
b509e3a5 | 76 | fParam[i]=fl.fParam[i] ; |
77 | } | |
78 | ||
79 | //____________________________________________________________________________ | |
80 | AliPHOSEPFlattener & AliPHOSEPFlattener::operator = (const AliPHOSEPFlattener & fl) | |
81 | { | |
82 | SetName(fl.GetName()) ; | |
83 | fNCentrBins = fl.fNCentrBins ; | |
84 | fNHarmonics = fl.fNHarmonics ; | |
b8bea077 | 85 | fNparam = fl.fNparam ; |
b509e3a5 | 86 | if(fParam) delete [] fParam ; |
b8bea077 | 87 | fParam = new Double32_t[fNparam] ; |
88 | for(Int_t i=0; i<fNparam; i++) | |
b509e3a5 | 89 | fParam[i]=fl.fParam[i] ; |
90 | ||
91 | return *this; | |
92 | } | |
93 | //____________________________________________________________________________ | |
94 | AliPHOSEPFlattener::~AliPHOSEPFlattener() | |
95 | { | |
96 | // Nothing to delete | |
97 | fNCentrBins = 0 ; | |
98 | fNHarmonics = 0 ; | |
b8bea077 | 99 | fNparam = 0 ; |
b509e3a5 | 100 | if(fParam) |
101 | delete [] fParam ; | |
102 | fParam = 0x0 ; | |
103 | ||
104 | } | |
105 | //____________________________________________________________________________ | |
106 | Double_t AliPHOSEPFlattener::MakeFlat(Double_t oldPhi,Double_t centrality)const | |
107 | { | |
108 | //Apply flattening using existing parameterizations | |
109 | if(fNCentrBins==0) return oldPhi; //No correction encoded | |
110 | ||
111 | Double_t result = oldPhi ; | |
112 | //Centrality bin | |
113 | Int_t icen=(Int_t) (centrality*fNCentrBins/100.) ; | |
114 | if(icen>=fNCentrBins)icen = fNCentrBins-1 ; | |
115 | ||
116 | //Offset in the array | |
117 | icen=icen*fNHarmonics ; | |
118 | ||
119 | for(Int_t i = 0; i<fNHarmonics; i+=2){ | |
120 | Double_t c = fParam[icen+i] ; //Mean cos(n*phi) for a given centrality | |
121 | Double_t s = fParam[icen+i+1]; //Mean sin(n*phi) for a given centrality | |
122 | result += c*TMath::Sin((i/2+1)*oldPhi)-s*TMath::Cos((i/2+1)*oldPhi) ; | |
123 | } | |
124 | return result ; | |
125 | } | |
126 | //____________________________________________________________________________ | |
b8bea077 | 127 | void AliPHOSEPFlattener::SetParameterization(TH2 * h){ |
b509e3a5 | 128 | //Fill parameterizations |
129 | //We expect histogram with <cos(i*phi)>, <sin(i*phi)> with centrality bins in x axis | |
130 | //and harmonics: <cos(x)>, <sin(x)>, <cos(2x)>, <sin(2x)>, .... in y axis | |
131 | ||
132 | fNCentrBins = h->GetXaxis()->GetNbins() ; | |
133 | fNHarmonics = h->GetYaxis()->GetNbins() ; | |
b8bea077 | 134 | fNparam = fNCentrBins*fNHarmonics ; |
b509e3a5 | 135 | if(fParam) delete [] fParam ; |
b8bea077 | 136 | fParam = new Double32_t[fNparam] ; |
b509e3a5 | 137 | for(Int_t i=0; i<fNCentrBins; i++) |
138 | for(Int_t j=0; j<fNHarmonics; j++) | |
e2139d72 | 139 | fParam[i*fNHarmonics+j]=h->GetBinContent(i+1,j+1) ; |
b509e3a5 | 140 | } |
141 |