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