reading RAW without data
[u/mrichter/AliRoot.git] / HBTAN / AliHBTWeightsPID.cxx
CommitLineData
99927f15 1/* $Id $ */
2
3//-----------------------------------------------------------
4//This class introduces the weights calculated according
5//with functions of efficiency of identification (TPC+TOF)
6//(calculated by B.V. Batyunia).
a6e49985 7//Author: Ludmila Malinina, JINR (malinina@sunhe.jinr.ru)
99927f15 8//-----------------------------------------------------------
9
dd82cadc 10#include "AliHBTWeightsPID.h"
a6e49985 11#include "AliHBTPair.h"
99927f15 12#include <TRandom.h>
13#include <TMath.h>
14#include <TH1.h>
15#include <TF1.h>
a6e49985 16
dd82cadc 17ClassImp(AliHBTWeightsPID)
a6e49985 18
dd82cadc 19AliHBTWeightsPID* AliHBTWeightsPID::fgWeightsPID=NULL;
a6e49985 20
dd82cadc 21AliHBTWeightsPID::AliHBTWeightsPID()
99927f15 22{
23 //ctor
24 //initial parameters of model
25
26 fPtK = new TH1F("fPtK"," pt of K+- ",40,0,4);
27 fPtKefftpc = new TH1F("fPtEfficKpos"," pt of K+ after efficiency cut ",40,0,4);
28 fPtKefftpcboth = new TH1F("fPtEfficKneg"," pt of K- after efficiency cut ",40,0,4);
29
30 // efficiency functions (from pt) for K+- in the TPC
31 fEffic1pol = new TF1("fEffic1pol4","pol4",100.,480.);
32 // for -0.9 < eta < -0.7
33 // for 0.7 < eta < 0.9
34 fEffic1pol->SetParameter(0,-0.266362);
35 fEffic1pol->SetParameter(1,0.00565461);
36 fEffic1pol->SetParameter(2,-4.06686e-05);
37 fEffic1pol->SetParameter(3,1.39387e-07);
38 fEffic1pol->SetParameter(4,-1.59674e-10);
39
40 fEffic2pol = new TF1("fEffic2pol4","pol4",100.,540.);
41
42 fEffic2pol->SetParameter(0,-0.324881);
43 fEffic2pol->SetParameter(1,0.00565381);
44 fEffic2pol->SetParameter(2,-3.23633e-05);
45 fEffic2pol->SetParameter(3,9.72523e-08);
46 fEffic2pol->SetParameter(4,-1.01013e-10);
a6e49985 47
99927f15 48 fEffic3pol = new TF1("fEffic3pol4","pol4",100.,585.);
49 // for -0.5 < eta < -0.3
50 // for 0.3 < eta < 0.5
51 fEffic3pol->SetParameter(0,-0.306572);
52 fEffic3pol->SetParameter(1,0.00557472);
53 fEffic3pol->SetParameter(2,-3.33752e-05);
54 fEffic3pol->SetParameter(3,9.83241e-08);
55 fEffic3pol->SetParameter(4,-9.5827e-11);
56 fEffic4pol = new TF1("fEffic4pol4","pol4",100.,600.);
57 // for -0.3 < eta < 0.3
58 fEffic4pol->SetParameter(0,-0.168648);
59 fEffic4pol->SetParameter(1,0.00252021);
60 fEffic4pol->SetParameter(2,-1.09113e-05);
61 fEffic4pol->SetParameter(3,3.34871e-08);
62 fEffic4pol->SetParameter(4,-3.31691e-11);
a6e49985 63
64 // efficiency functions (from pt) for K+- in the TOF
99927f15 65 fEffic1polTOF = new TF1("fEffic1pol4TOF","pol4",0.2,2.0);
66 // for -0.9 < eta < -0.7
67 // for 0.7 < eta < 0.9
68 fEffic1polTOF->SetParameter(0,-0.165885);
69 fEffic1polTOF->SetParameter(1,0.717459);
70 fEffic1polTOF->SetParameter(2,-0.457131);
71 fEffic1polTOF->SetParameter(3,0.284753);
72 fEffic1polTOF->SetParameter(4,-0.105215);
a6e49985 73
99927f15 74 fEffic2polTOF = new TF1("fEffic2pol4TOF","pol4",0.2,2.4);
75 // for -0.7 < eta < -0.5
76 // for 0.5 < eta < 0.7
77
78 fEffic2polTOF->SetParameter(0,-0.165947);
79 fEffic2polTOF->SetParameter(1,0.702475);
80 fEffic2polTOF->SetParameter(2,-0.300313);
81 fEffic2polTOF->SetParameter(3,0.127047);
82 fEffic2polTOF->SetParameter(4,-0.0489395);
a6e49985 83
84
99927f15 85 fEffic3polTOF = new TF1("fEffic3pol4TOF","pol4",0.2,2.4);
86 // for -0.5 < eta < -0.3
87 // for 0.3 < eta < 0.5
88 fEffic3polTOF->SetParameter(0,-0.339516);
89 fEffic3polTOF->SetParameter(1,1.56942);
90 fEffic3polTOF->SetParameter(2,-1.43132);
91 fEffic3polTOF->SetParameter(3,0.727148);
92 fEffic3polTOF->SetParameter(4,-0.158444);
93 fEffic4polTOF = new TF1("fEffic4pol4TOF","pol4",0.2,2.6);
94 // for -0.3 < eta < 0.3
95 fEffic4polTOF->SetParameter(0,-0.243435);
96 fEffic4polTOF->SetParameter(1,1.00928);
97 fEffic4polTOF->SetParameter(2,-0.594597);
98 fEffic4polTOF->SetParameter(3,0.212601);
99 fEffic4polTOF->SetParameter(4,-0.0453419);
100
101}
a6e49985 102
dd82cadc 103AliHBTWeightsPID* AliHBTWeightsPID::Instance()
99927f15 104{
105 //Creates an instance of the class
106 //or returns pointer to already existing one
107 if (fgWeightsPID) {
108 return fgWeightsPID;
109 } else {
dd82cadc 110 fgWeightsPID = new AliHBTWeightsPID();
99927f15 111 return fgWeightsPID;
112 }
113}
a6e49985 114
115
dd82cadc 116Double_t AliHBTWeightsPID::GetWeightPID(const AliHBTPair* trackpair)
a6e49985 117{
99927f15 118 //Calculates the weight of "trackpair"
78d7c6d3 119 AliVAODParticle *track1 = trackpair->Particle1();
120 AliVAODParticle *track2 = trackpair->Particle2();
a6e49985 121
99927f15 122 Double_t pt1=track1->Pt();
123 Double_t eta1=track1->Eta();
124
125 fPtK->Fill(pt1);
126
127 if(TMath::Abs(eta1) > 0.7 && TMath::Abs(eta1) < 0.9 && pt1 < 0.48) {
128 fEfficTPC1 = fEffic1pol->Eval(pt1*1000.);
129 }else if(TMath::Abs(eta1) > 0.5 && TMath::Abs(eta1) < 0.7 && pt1 < 0.54) {
130 fEfficTPC1 = fEffic2pol->Eval(pt1*1000.);
131 }else if(TMath::Abs(eta1) > 0.3 && TMath::Abs(eta1) < 0.5 && pt1 < 0.585) {
132 fEfficTPC1 = fEffic3pol->Eval(pt1*1000.);
133 }else if(eta1 > -0.3 && eta1 < 0.3 && pt1 < 0.6) {
134 fEfficTPC1 = fEffic4pol->Eval(pt1*1000.);
135 }
136
137 // TOF efficiency
138
139 if(pt1 > 0.2) {
140 if(TMath::Abs(eta1) > 0.7 && TMath::Abs(eta1) < 0.9 && pt1 < 2.0) {
141 fEfficTOF1 = fEffic1polTOF->Eval(pt1);
142 }else if(TMath::Abs(eta1) > 0.5 && TMath::Abs(eta1) < 0.7 && pt1 < 2.4) {
143 fEfficTOF1 = fEffic2polTOF->Eval(pt1);
144 }else if(TMath::Abs(eta1) > 0.3 && TMath::Abs(eta1) < 0.5 && pt1 < 2.4) {
145 fEfficTOF1 = fEffic3polTOF->Eval(pt1);
146 }else if(eta1 > -0.3 && eta1 < 0.3 && pt1 < 2.6) {
147 fEfficTOF1 = fEffic4polTOF->Eval(pt1);
148 }
149 }
150
151 Double_t rndmtpc=gRandom->Rndm();
152 Double_t rndmtof=gRandom->Rndm();
153 Double_t weightPID1=1.;
154 if(fEfficTPC1 < rndmtpc && fEfficTOF1 < rndmtof) { weightPID1=0.;}
155 fPtKefftpc->Fill(pt1,weightPID1);
156
157
158 Double_t pt2=track2->Pt();
159 Double_t eta2=track2->Eta();
160
161 // TPC efficiency
162
163 if(TMath::Abs(eta2) > 0.7 && TMath::Abs(eta2) < 0.9 && pt2 < 0.48) {
164 fEfficTPC1 = fEffic1pol->Eval(pt2*1000.);
165 }else if(TMath::Abs(eta2) > 0.5 && TMath::Abs(eta2) < 0.7 && pt2 < 0.54) {
166 fEfficTPC1 = fEffic2pol->Eval(pt2*1000.);
167 }else if(TMath::Abs(eta2) > 0.3 && TMath::Abs(eta2) < 0.5 && pt2 < 0.585) {
168 fEfficTPC1 = fEffic3pol->Eval(pt2*1000.);
169 }else if(eta2 > -0.3 && eta2 < 0.3 && pt2 < 0.6) {
170 fEfficTPC1 = fEffic4pol->Eval(pt2*1000.);
171 }
172
173 // TOF efficiency
174
175 if(pt2 > 0.2) {
176 if(TMath::Abs(eta2) > 0.7 && TMath::Abs(eta2) < 0.9 && pt2 < 2.0) {
177 fEfficTOF1 = fEffic1polTOF->Eval(pt2);
178 }else if(TMath::Abs(eta2) > 0.5 && TMath::Abs(eta2) < 0.7 && pt2 < 2.4) {
179 fEfficTOF1 = fEffic2polTOF->Eval(pt2);
180 }else if(TMath::Abs(eta2) > 0.3 && TMath::Abs(eta2) < 0.5 && pt2 < 2.4) {
181 fEfficTOF1 = fEffic3polTOF->Eval(pt2);
182 }else if(eta2 > -0.3 && eta2 < 0.3 && pt2 < 2.6) {
183 fEfficTOF1 = fEffic4polTOF->Eval(pt2);
184 }
185 }
186
187 rndmtpc=gRandom->Rndm();
188 rndmtof=gRandom->Rndm();
189
190 Double_t weightPID2=1.;
191 if(fEfficTPC1 < rndmtpc && fEfficTOF1 < rndmtof) { weightPID2=0.;}
192
193 Double_t weightPID=weightPID1*weightPID2;
194 fPtKefftpcboth->Fill(pt1,weightPID);
195
196 return weightPID;
a6e49985 197}