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 **************************************************************************/
16 // coalescence parameter
17 // author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
22 #include <TGraphErrors.h>
30 AliLnBA::AliLnBA(const TString& protonSpectra, const TString& protonTag, const TString& nucleusSpectra, const TString& nucleusTag, const TString& outputFilename, const TString& otag, Int_t a, Int_t z)
32 , fProtonSpectra(protonSpectra)
33 , fProtonTag(protonTag)
34 , fNucleusSpectra(nucleusSpectra)
35 , fNucleusTag(nucleusTag)
36 , fOutputFilename(outputFilename)
40 , fNucleusName("Deuteron")
46 this->SetNucleus(a,z);
56 void AliLnBA::SetNucleus(Int_t a, Int_t z)
59 // set nucleus mass and name
64 Int_t zz = TMath::Abs(z);
66 if(a==1 && zz==1) fNucleusName = "Proton";
67 else if(a==2 && zz==1) fNucleusName = "Deuteron";
68 else if(a==3 && zz==1) fNucleusName = "Triton";
69 else if(a==3 && zz==2) fNucleusName = "He3";
70 else if(a==4 && zz==2) fNucleusName = "Alpha";
73 this->Warning("SetNucleus", "unknown nucleus A = %d, Z = %d", a, z);
74 fNucleusName = "Unknown";
77 if(z<0) fNucleusName.Prepend("Anti");
83 // coalescence parameter
85 TFile* finput1 = new TFile(fProtonSpectra.Data(), "read");
86 if (finput1->IsZombie()) exit(1);
88 TFile* finputA = new TFile(fNucleusSpectra.Data(), "read");
89 if (finputA->IsZombie()) exit(1);
91 // invariant differential yields
93 TString nucleonName = (fZ > 0) ? "Proton" : "AntiProton";
95 TGraphErrors* grPrtInvDYieldPt = FindObj<TGraphErrors>(finput1, fProtonTag, nucleonName + "_InvDiffYield_Pt");
96 TGraphErrors* grNucInvDYieldPt = FindObj<TGraphErrors>(finputA, fNucleusTag, fNucleusName + "_InvDiffYield_Pt");
98 TFile* foutput = new TFile(fOutputFilename.Data(),"recreate");
100 foutput->mkdir(fOutputTag.Data());
101 foutput->cd(fOutputTag.Data());
103 // coalescence parameter
105 TGraphErrors* grBAPt = this->GetBAPt(grPrtInvDYieldPt, grNucInvDYieldPt, fNucleusName + Form("_B%d_Pt",fA));
109 // homogeneity volume
110 TGraphErrors* grR3Pt = 0;
113 grR3Pt = this->Rside2Rlong(grBAPt, fNucleusName + "_R3_Pt", fCd);
117 // propagate systematic errors if possible
119 TString grPrtName = fProtonTag + "/" + nucleonName + "_SystErr_InvDiffYield_Pt;1";
120 TString grNucName = fNucleusTag + "/" + fNucleusName + "_SystErr_InvDiffYield_Pt;1";
122 TGraphErrors* grSystErrPrtInvDYieldPt = dynamic_cast<TGraphErrors*>(finput1->Get(grPrtName.Data()));
123 TGraphErrors* grSystErrNucInvDYieldPt = dynamic_cast<TGraphErrors*>(finputA->Get(grNucName.Data()));
125 if( (grSystErrPrtInvDYieldPt != 0) && (grSystErrNucInvDYieldPt != 0) )
127 TGraphErrors* grSystErrBAPt = this->GetBAPt(grSystErrPrtInvDYieldPt, grSystErrNucInvDYieldPt, fNucleusName + Form("_SystErr_B%d_Pt",fA));
131 TGraphErrors* grSystErrR3Pt = this->Rside2Rlong(grSystErrBAPt, fNucleusName + "_SystErr_R3_Pt", fCd);
132 grSystErrR3Pt->Write();
134 delete grSystErrR3Pt;
137 grSystErrBAPt->Write();
138 delete grSystErrBAPt;
142 this->Warning("Run", "systematic errors are not propagated");
155 TGraphErrors* AliLnBA::GetBAPt(const TGraphErrors* grPrtInvDYieldPt, const TGraphErrors* grNucInvDYieldPt, const TString& name) const
158 // coalescence parameter
160 TGraphErrors* grBAPt = new TGraphErrors();
161 grBAPt->SetName(name.Data());
163 for(Int_t i=0, j=0; i < grNucInvDYieldPt->GetN(); ++i)
165 Double_t ptNuc, yNuc;
167 grNucInvDYieldPt->GetPoint(i, ptNuc, yNuc);
169 if(ptNuc/fA < 0.4) continue; // acceptance
171 Double_t yPrt = grPrtInvDYieldPt->Eval(ptNuc/fA); // interpolate
173 if(yPrt == 0 || yNuc == 0 ) continue;
175 Double_t bA = yNuc/TMath::Power(yPrt,fA);
178 Double_t ePrt = this->GetErrorY(grPrtInvDYieldPt, ptNuc/fA);
179 Double_t eNuc = grNucInvDYieldPt->GetErrorY(i);
181 Double_t errPt = grNucInvDYieldPt->GetErrorX(i)/fA;
182 Double_t errBA = bA*TMath::Sqrt(TMath::Power(eNuc/yNuc,2) + TMath::Power(fA*ePrt/yPrt,2));
184 grBAPt->SetPoint(j, ptNuc/fA, bA);
185 grBAPt->SetPointError(j++, errPt, errBA);
191 Double_t AliLnBA::GetErrorY(const TGraphErrors* gr, Double_t x0) const
194 // estimate error of gr(x0) with the closest point to x0
196 const Double_t kEpsilon = 1.e-6;
197 const Double_t kUnknownError = 1.e+6;
199 for(Int_t i=0; i<gr->GetN(); ++i)
201 Double_t x = gr->GetX()[i];
203 if( TMath::Abs(x-x0) < kEpsilon) return gr->GetErrorY(i);
205 if( ((i == 0) && (x > x0)) || ((i == (gr->GetN()-1)) && (x < x0)) )
207 this->Warning("GetErrorY", "%f is out of bounds",x);
208 return kUnknownError;
213 this->Warning("GetErrorY", "Interpolating error at %f",x0);
214 return (gr->GetErrorY(i)+gr->GetErrorY(i-1))/2;
221 Double_t AliLnBA::Rside2Rlong(Double_t pt, Double_t B2, Double_t Cd) const
224 // Rside^2*Rlong from B2 value
225 // Phys. Rev. C, vol. 59, no. 3, pp. 1585--1602, 1999
226 // (for pp ignore the exponential term)
228 Double_t hbarc = 0.1973269631; // GeV*fm
229 Double_t m = 0.938272013; // GeV/c^2
230 Double_t pi = TMath::Pi();
234 Double_t mt = TMath::Sqrt(pt*pt + m*m);
235 Double_t r3 = 3.*TMath::Power(pi,3./2.)*TMath::Power(hbarc,3.)*Cd/(2.*mt*B2);
240 TGraphErrors* AliLnBA::Rside2Rlong(const TGraphErrors* grB2, const TString& name, Double_t Cd) const
243 // Rside^2*Rlong from B2 value
244 // Phys. Rev. C, vol. 59, no. 3, pp. 1585--1602, 1999
245 // (for pp ignore the exponential term)
247 TGraphErrors* grR3 = new TGraphErrors(*grB2);
248 grR3->SetName(name.Data());
252 for(Int_t i=0; i < grB2->GetN(); ++i)
254 grB2->GetPoint(i, pt, b2);
257 Double_t r3 = Rside2Rlong(pt, b2, Cd);
259 grR3->SetPoint(i, pt, r3);
261 // only statistical error propagation of B2
262 Double_t errPt = grB2->GetErrorX(i);
263 Double_t errB2 = grB2->GetErrorY(i);
264 Double_t errR = r3*errB2/b2;
266 grR3->SetPointError(i, errPt, errR);