Retrofeed from 4-01-Release
[u/mrichter/AliRoot.git] / HBTAN / AliHBTCorrectOSLCorrelFctn.cxx
CommitLineData
e09fa876 1#include "AliHBTCorrectOSLCorrelFctn.h"
e09fa876 2//____________________
3///////////////////////////////////////////////////////
4// //
5// AliHBTCorrectOSLCorrelFctn //
6// //
7// Class for calculating Q Invariant correlation //
8// taking to the account resolution of the //
9// detector and coulomb effects. //
10// //
11///////////////////////////////////////////////////////
12
62e1b4fe 13#include <TH3.h>
14
15#include <AliAODParticle.h>
16#include <AliHBTPair.h>
e09fa876 17
18AliHBTCorrectOSLCorrelFctn::AliHBTCorrectOSLCorrelFctn(const char* name, const char* title):
19 AliHBTOnePairFctn3D(name,title),
62e1b4fe 20 AliHBTCorrectedCorrelFctn(),
e09fa876 21 fMeasCorrelFctn(0x0),
22 fSmearedNumer(0x0),
23 fSmearedDenom(0x0),
24 fMeasNumer(0x0),
62e1b4fe 25 fMeasDenom(0x0),
26 fLambda(0.0),
27 fROutSq(0.0),
28 fRSideSq(0.0),
29 fRLongSq(0.0)
e09fa876 30{
31//ctor
62e1b4fe 32 fWriteNumAndDen = kTRUE;//change default behaviour
e09fa876 33}
34/******************************************************************/
35
62e1b4fe 36AliHBTCorrectOSLCorrelFctn::AliHBTCorrectOSLCorrelFctn(const Char_t *name, const Char_t *title,
37 Int_t nXbins, Double_t maxXval, Double_t minXval,
38 Int_t nYbins, Double_t maxYval, Double_t minYval,
39 Int_t nZbins, Double_t maxZval, Double_t minZval):
40 AliHBTOnePairFctn3D(name,title,nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval),
41 AliHBTCorrectedCorrelFctn(),
42 fMeasCorrelFctn(0x0),
43 fSmearedNumer(0x0),
44 fSmearedDenom(0x0),
45 fMeasNumer(0x0),
46 fMeasDenom(0x0),
47 fLambda(0.0),
48 fROutSq(0.0),
49 fRSideSq(0.0),
50 fRLongSq(0.0)
51{
52//ctor
53 fWriteNumAndDen = kTRUE;//change default behaviour}
54}
55
56/******************************************************************/
e09fa876 57AliHBTCorrectOSLCorrelFctn::AliHBTCorrectOSLCorrelFctn(const AliHBTCorrectOSLCorrelFctn& in):
58 AliHBTOnePairFctn3D(in),
62e1b4fe 59 AliHBTCorrectedCorrelFctn(),
e09fa876 60 fMeasCorrelFctn(0x0),
61 fSmearedNumer(0x0),
62 fSmearedDenom(0x0),
63 fMeasNumer(0x0),
62e1b4fe 64 fMeasDenom(0x0),
65 fLambda(0.0),
66 fROutSq(0.0),
67 fRSideSq(0.0),
68 fRLongSq(0.0)
e09fa876 69{
70//cpy constructor
71 in.Copy(*this);
72}
73/******************************************************************/
74
75AliHBTCorrectOSLCorrelFctn::~AliHBTCorrectOSLCorrelFctn()
76{
77 //dtor
78 delete fMeasCorrelFctn;
79 delete fSmearedNumer;
80 delete fSmearedDenom;
81 delete fMeasNumer;
82 delete fMeasDenom;
83}
62e1b4fe 84/******************************************************************/
85
86void AliHBTCorrectOSLCorrelFctn::BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin,
87 Int_t nybins, Float_t ymax, Float_t ymin,
88 Int_t nzbins, Float_t zmax, Float_t zmin)
89{
90//build histograms
91 if (AliVAODParticle::GetDebug()>1) Info("BuildHistos","Enetered BuildHistos(...)");
92
93 AliHBTFunction3D::BuildHistos(nxbins,xmax,xmin,nybins,ymax,ymin,nzbins,zmax,zmin);
94
95 TString numstr = fName + " Smeared Numerator"; //title and name of the numerator histogram
96 TString denstr = fName + " Smeared Denominator";//title and name of the denominator histogram
97
98 fSmearedNumer = new TH3F(numstr.Data(),numstr.Data(),nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax);
99 fSmearedDenom = new TH3F(denstr.Data(),denstr.Data(),nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax);
100 fSmearedNumer->Sumw2();
101 fSmearedDenom->Sumw2();
102
103 if (fMeasCorrelFctn == 0x0)
104 {
105 numstr = fName + " Measured Numerator"; //title and name of the numerator histogram
106 denstr = fName + " Measured Denominator";//title and name of the denominator histogram
107
108 fMeasNumer = new TH3F(numstr.Data(),numstr.Data(),nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax);
109 fMeasDenom = new TH3F(denstr.Data(),denstr.Data(),nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax);
110 fMeasNumer->Sumw2();
111 fMeasDenom->Sumw2();
112 }
113
114}
115/******************************************************************/
116
117void AliHBTCorrectOSLCorrelFctn::Init()
118{
119//Init
120 AliHBTOnePairFctn3D::Init();
121 Info("Init","");
122 if ( (fSmearedNumer == 0x0) || (fSmearedDenom == 0x0) )
123 {
124 if (fNumerator == 0x0) Fatal("Init","Sth. goes wrong");
125 Int_t nxbins = fNumerator->GetNbinsX();
126 Float_t xmax = fNumerator->GetXaxis()->GetXmax();
127 Float_t xmin = fNumerator->GetXaxis()->GetXmin();
128 Int_t nybins = fNumerator->GetNbinsY();
129 Float_t ymax = fNumerator->GetYaxis()->GetXmax();
130 Float_t ymin = fNumerator->GetYaxis()->GetXmin();
131 Int_t nzbins = fNumerator->GetNbinsZ();
132 Float_t zmax = fNumerator->GetZaxis()->GetXmax();
133 Float_t zmin = fNumerator->GetZaxis()->GetXmin();
134 BuildHistos(nxbins,xmax,xmin, nybins,ymax,ymin, nzbins,zmax,zmin);
135 }
136
137 fSmearedNumer->Reset();
138 fSmearedDenom->Reset();
139 if (fMeasNumer) fMeasNumer->Reset();
140 if (fMeasDenom) fMeasDenom->Reset();
141}
142/******************************************************************/
143
144void AliHBTCorrectOSLCorrelFctn::SetInitialValues(Double_t lambda, Double_t rout, Double_t rside, Double_t rlong)
145{
146 //Sets assumed parameters
147 fLambda = lambda;
148 fROutSq = rout*rout;
149 fRSideSq = rside*rside;
150 fRLongSq = rlong*rlong;
151}
152
153/******************************************************************/
154
155void AliHBTCorrectOSLCorrelFctn::ProcessSameEventParticles(AliHBTPair* pair)
156{
157 //Processes particles that originates from the same event
158
159 return; //we already heave the measured in hand
160
161
162 if (fMeasNumer == 0x0) return;
163 pair = CheckPair(pair);
164 if( pair == 0x0) return;
165 fMeasNumer->Fill(pair->GetQInv());
166}
167/******************************************************************/
168
169void AliHBTCorrectOSLCorrelFctn::ProcessDiffEventParticles(AliHBTPair* pair)
170{
171//Process different events
172 static AliAODParticle part1, part2;
173 static AliHBTPair smearedpair(&part1,&part2);
174
175 pair = CheckPair(pair);
176 if( pair == 0x0) return;
177
178 Double_t cc = GetCoulombCorrection(pair);
179
180 Double_t qout,qside,qlong;
181 GetValues(pair,qout,qside,qlong);
182
183 //measured histogram -> if we are interested
184 //only if fMeasCorrelFctn is not specified by user
185
186// if (fMeasDenom) fMeasDenom->Fill(qout,qside,qlong,cc);
187
188 Smear(pair,smearedpair);
189 Double_t modelval = GetModelValue(qout,qside,qlong);
190 //Ideal histogram
191 fNumerator->Fill(qout,qside,qlong,modelval*cc);
192 fDenominator->Fill(qout,qside,qlong,cc);
193
194 //Smeared histogram
195
196 Double_t smearedqout,smearedqside,smearedqlong;
197
198 GetValues(&smearedpair,smearedqout,smearedqside,smearedqlong);
199
200 fSmearedNumer->Fill(smearedqout,smearedqside,smearedqlong,modelval);
201
202 Double_t smearedcc = GetCoulombCorrection(&smearedpair);
203 fSmearedDenom->Fill(smearedqout,smearedqside,smearedqlong,smearedcc);
204
205}
206/******************************************************************/
e09fa876 207
62e1b4fe 208void AliHBTCorrectOSLCorrelFctn::WriteFunction()
209{
210 AliHBTFunction::WriteFunction();
211 if (fSmearedNumer) fSmearedNumer->Write();
212 if (fSmearedDenom) fSmearedDenom->Write();
213
214}
e09fa876 215/******************************************************************/
62e1b4fe 216
217TH1* AliHBTCorrectOSLCorrelFctn::GetResult()
218{
219 //reuturns result histogram
220 delete fRatio;
221 fRatio = GetRatio(Scale());
222 return fRatio;
223}
224
225void AliHBTCorrectOSLCorrelFctn::GetValues(AliHBTPair* pair, Double_t& x, Double_t& y, Double_t& z) const
226{
227 //calculates values of that function
228 //qout qside and qlong
229
230 x=pair->GetQOutLCMS();
231 y=pair->GetQSideLCMS();
232 z=pair->GetQLongLCMS();
233 if (fAbs)
234 {
235 x = TMath::Abs(x);
236 y = TMath::Abs(y);
237 z = TMath::Abs(z);
238 }
239
240}