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 #include "AliHBTCorrectOSLCorrelFctn.h"
21 //____________________
22 ///////////////////////////////////////////////////////
24 // AliHBTCorrectOSLCorrelFctn //
26 // Class for calculating Q Invariant correlation //
27 // taking to the account resolution of the //
28 // detector and coulomb effects. //
30 ///////////////////////////////////////////////////////
34 #include <AliAODParticle.h>
35 #include <AliHBTPair.h>
37 AliHBTCorrectOSLCorrelFctn::AliHBTCorrectOSLCorrelFctn(const char* name, const char* title):
38 AliHBTOnePairFctn3D(name,title),
39 AliHBTCorrectedCorrelFctn(),
51 fWriteNumAndDen = kTRUE;//change default behaviour
53 /******************************************************************/
55 AliHBTCorrectOSLCorrelFctn::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(),
72 fWriteNumAndDen = kTRUE;//change default behaviour}
75 /******************************************************************/
76 AliHBTCorrectOSLCorrelFctn::AliHBTCorrectOSLCorrelFctn(const AliHBTCorrectOSLCorrelFctn& in):
77 AliHBTOnePairFctn3D(in),
78 AliHBTCorrectedCorrelFctn(),
92 /******************************************************************/
94 AliHBTCorrectOSLCorrelFctn::~AliHBTCorrectOSLCorrelFctn()
97 delete fMeasCorrelFctn;
103 /******************************************************************/
105 void 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)
110 AliDebug(1,"Entered");
112 AliHBTFunction3D::BuildHistos(nxbins,xmax,xmin,nybins,ymax,ymin,nzbins,zmax,zmin);
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
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();
122 if (fMeasCorrelFctn == 0x0)
124 numstr = fName + " Measured Numerator"; //title and name of the numerator histogram
125 denstr = fName + " Measured Denominator";//title and name of the denominator histogram
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);
134 /******************************************************************/
136 void AliHBTCorrectOSLCorrelFctn::Init()
139 AliHBTOnePairFctn3D::Init();
141 if ( (fSmearedNumer == 0x0) || (fSmearedDenom == 0x0) )
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);
156 fSmearedNumer->Reset();
157 fSmearedDenom->Reset();
158 if (fMeasNumer) fMeasNumer->Reset();
159 if (fMeasDenom) fMeasDenom->Reset();
161 /******************************************************************/
163 void AliHBTCorrectOSLCorrelFctn::SetInitialValues(Double_t lambda, Double_t rout, Double_t rside, Double_t rlong)
165 //Sets assumed parameters
168 fRSideSq = rside*rside;
169 fRLongSq = rlong*rlong;
172 /******************************************************************/
174 void AliHBTCorrectOSLCorrelFctn::ProcessSameEventParticles(AliHBTPair* pair)
176 //Processes particles that originates from the same event
178 return; //we already heave the measured in hand
181 if (fMeasNumer == 0x0) return;
182 pair = CheckPair(pair);
183 if( pair == 0x0) return;
184 fMeasNumer->Fill(pair->GetQInv());
186 /******************************************************************/
188 void AliHBTCorrectOSLCorrelFctn::ProcessDiffEventParticles(AliHBTPair* pair)
190 //Process different events
191 static AliAODParticle part1, part2;
192 static AliHBTPair smearedpair(&part1,&part2);
194 pair = CheckPair(pair);
195 if( pair == 0x0) return;
197 Double_t cc = GetCoulombCorrection(pair);
199 Double_t qout,qside,qlong;
200 GetValues(pair,qout,qside,qlong);
202 //measured histogram -> if we are interested
203 //only if fMeasCorrelFctn is not specified by user
205 // if (fMeasDenom) fMeasDenom->Fill(qout,qside,qlong,cc);
207 Smear(pair,smearedpair);
208 Double_t modelval = GetModelValue(qout,qside,qlong);
210 fNumerator->Fill(qout,qside,qlong,modelval*cc);
211 fDenominator->Fill(qout,qside,qlong,cc);
215 Double_t smearedqout,smearedqside,smearedqlong;
217 GetValues(&smearedpair,smearedqout,smearedqside,smearedqlong);
219 fSmearedNumer->Fill(smearedqout,smearedqside,smearedqlong,modelval);
221 Double_t smearedcc = GetCoulombCorrection(&smearedpair);
222 fSmearedDenom->Fill(smearedqout,smearedqside,smearedqlong,smearedcc);
225 /******************************************************************/
227 Int_t AliHBTCorrectOSLCorrelFctn::WriteFunction()
229 //Writes the function
231 retval += AliHBTFunction::WriteFunction();
232 if (fSmearedNumer) retval += fSmearedNumer->Write();
233 if (fSmearedDenom) retval += fSmearedDenom->Write();
236 /******************************************************************/
238 TH1* AliHBTCorrectOSLCorrelFctn::GetResult()
240 //reuturns result histogram
242 fRatio = GetRatio(Scale());
246 void AliHBTCorrectOSLCorrelFctn::GetValues(AliHBTPair* pair, Double_t& x, Double_t& y, Double_t& z) const
248 //calculates values of that function
249 //qout qside and qlong
251 x=pair->GetQOutLCMS();
252 y=pair->GetQSideLCMS();
253 z=pair->GetQLongLCMS();