]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/SPECTRA/AliProtonAnalysisBase.cxx
Updating the parameters
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonAnalysisBase.cxx
CommitLineData
0ab648ea 1/**************************************************************************
2 * Author: Panos Christakoglou. *
3 * Contributors are mentioned in the code where appropriate. *
4 * *
5 * Permission to use, copy, modify and distribute this software and its *
6 * documentation strictly for non-commercial purposes is hereby granted *
7 * without fee, provided that the above copyright notice appears in all *
8 * copies and that both the copyright notice and this permission notice *
9 * appear in the supporting documentation. The authors make no claims *
10 * about the suitability of this software for any purpose. It is *
11 * provided "as is" without express or implied warranty. *
12 **************************************************************************/
13
14/* $Id: AliProtonAnalysisBase.cxx 31056 2009-02-16 14:31:41Z pchrist $ */
15
16//-----------------------------------------------------------------
17// AliProtonAnalysisBase class
18// This is the class to deal with the proton analysis
19// Origin: Panos Christakoglou | Panos.Christakoglou@cern.ch
20//-----------------------------------------------------------------
21#include <Riostream.h>
0ab648ea 22#include <TCanvas.h>
23#include <TLatex.h>
73aba974 24#include <TF1.h>
735cc63d 25#include <TList.h>
26#include <TH1F.h>
0ab648ea 27
28#include <AliExternalTrackParam.h>
29#include <AliESDEvent.h>
0ab648ea 30#include <AliPID.h>
0ab648ea 31#include <AliVertexerTracks.h>
10d100d4 32#include <AliESDpid.h>
f81f1b19 33#include <AliTPCPIDResponse.h>
73aba974 34class AliLog;
35class AliESDVertex;
36
37#include "AliProtonAnalysisBase.h"
38
0ab648ea 39ClassImp(AliProtonAnalysisBase)
40
41//____________________________________________________________________//
42AliProtonAnalysisBase::AliProtonAnalysisBase() :
790140ac 43 TObject(), fProtonAnalysisLevel("ESD"), fAnalysisMC(kFALSE),
e56f08ed 44 fTriggerMode(kMB2), kUseOnlineTrigger(kFALSE), kUseOfflineTrigger(kFALSE),
45 fPhysicsSelection(0),
76161fe0 46 fProtonAnalysisMode(kTPC), fProtonPIDMode(kBayesian),
0ab648ea 47 fAnalysisEtaMode(kFALSE),
e56f08ed 48 fVxMax(100.), fVyMax(100.), fVzMax(100.), fMinNumOfContributors(0),
0ab648ea 49 fNBinsX(0), fMinX(0), fMaxX(0),
50 fNBinsY(0), fMinY(0), fMaxY(0),
51 fMinTPCClusters(0), fMinITSClusters(0),
52 fMaxChi2PerTPCCluster(0), fMaxChi2PerITSCluster(0),
53 fMaxCov11(0), fMaxCov22(0), fMaxCov33(0), fMaxCov44(0), fMaxCov55(0),
54 fMaxSigmaToVertex(0), fMaxSigmaToVertexTPC(0),
55 fMaxDCAXY(0), fMaxDCAXYTPC(0),
56 fMaxDCAZ(0), fMaxDCAZTPC(0),
57 fMaxDCA3D(0), fMaxDCA3DTPC(0),
87a55728 58 fMaxConstrainChi2(0), fMinTPCdEdxPoints(0),
0ab648ea 59 fMinTPCClustersFlag(kFALSE), fMinITSClustersFlag(kFALSE),
60 fMaxChi2PerTPCClusterFlag(kFALSE), fMaxChi2PerITSClusterFlag(kFALSE),
61 fMaxCov11Flag(kFALSE), fMaxCov22Flag(kFALSE),
62 fMaxCov33Flag(kFALSE), fMaxCov44Flag(kFALSE), fMaxCov55Flag(kFALSE),
63 fMaxSigmaToVertexFlag(kFALSE), fMaxSigmaToVertexTPCFlag(kFALSE),
64 fMaxDCAXYFlag(kFALSE), fMaxDCAXYTPCFlag(kFALSE),
65 fMaxDCAZFlag(kFALSE), fMaxDCAZTPCFlag(kFALSE),
66 fMaxDCA3DFlag(kFALSE), fMaxDCA3DTPCFlag(kFALSE),
67 fMaxConstrainChi2Flag(kFALSE),
68 fITSRefitFlag(kFALSE), fTPCRefitFlag(kFALSE),
f62e9410 69 fESDpidFlag(kFALSE), fTPCpidFlag(kFALSE), fTOFpidFlag(kFALSE),
4787e0ca 70 fPointOnSPDLayersFlag(0), fPointOnSDDLayersFlag(0), fPointOnSSDLayersFlag(0),
0ab648ea 71 fPointOnITSLayer1Flag(0), fPointOnITSLayer2Flag(0),
72 fPointOnITSLayer3Flag(0), fPointOnITSLayer4Flag(0),
73 fPointOnITSLayer5Flag(0), fPointOnITSLayer6Flag(0),
87a55728 74 fMinTPCdEdxPointsFlag(kFALSE),
0ab648ea 75 fFunctionProbabilityFlag(kFALSE),
c6909683 76 fNSigma(0), fNRatio(0),
0ab648ea 77 fElectronFunction(0), fMuonFunction(0),
78 fPionFunction(0), fKaonFunction(0), fProtonFunction(0),
df201289 79 fDebugMode(kFALSE), fListVertexQA(new TList()) {
0ab648ea 80 //Default constructor
81 for(Int_t i = 0; i < 5; i++) fPartFrac[i] = 0.0;
c6909683 82 /*for(Int_t i = 0; i < 24; i++) {
87a55728 83 fdEdxMean[i] = 0.0;
84 fdEdxSigma[i] = 0.0;
c6909683 85 }*/
735cc63d 86 fListVertexQA->SetName("fListVertexQA");
87 TH1F *gHistVx = new TH1F("gHistVx",
88 "Vx distribution;V_{x} [cm];Entries",
89 100,-5.,5.);
90 gHistVx->SetFillColor(kRed-2);
91 fListVertexQA->Add(gHistVx);
92 TH1F *gHistVxAccepted = new TH1F("gHistVxaccepted",
93 "Vx distribution;V_{x} [cm];Entries",
94 100,-5.,5.);
95 fListVertexQA->Add(gHistVxAccepted);
96 TH1F *gHistVy = new TH1F("gHistVy",
97 "Vy distribution;V_{y} [cm];Entries",
98 100,-5.,5.);
99 gHistVy->SetFillColor(kRed-2);
100 fListVertexQA->Add(gHistVy);
101 TH1F *gHistVyAccepted = new TH1F("gHistVyaccepted",
102 "Vy distribution;V_{y} [cm];Entries",
103 100,-5.,5.);
104 fListVertexQA->Add(gHistVyAccepted);
105 TH1F *gHistVz = new TH1F("gHistVz",
106 "Vz distribution;V_{z} [cm];Entries",
107 100,-25.,25.);
108 gHistVz->SetFillColor(kRed-2);
109 fListVertexQA->Add(gHistVz);
110 TH1F *gHistVzAccepted = new TH1F("gHistVzaccepted",
111 "Vz distribution;V_{z} [cm];Entries",
112 100,-25.,25.);
113 fListVertexQA->Add(gHistVzAccepted);
114
e56f08ed 115 TH1F *gHistNumberOfContributors = new TH1F("gHistNumberOfContributors",
116 "Number of contributors;N_{contr.};Entries",
117 100,0.,100.);
118 fListVertexQA->Add(gHistNumberOfContributors);
119
735cc63d 120
0ab648ea 121}
122
123//____________________________________________________________________//
124AliProtonAnalysisBase::~AliProtonAnalysisBase() {
125 //Default destructor
126 if(fElectronFunction) delete fElectronFunction;
127 if(fMuonFunction) delete fMuonFunction;
128 if(fPionFunction) delete fPionFunction;
129 if(fKaonFunction) delete fKaonFunction;
130 if(fProtonFunction) delete fProtonFunction;
735cc63d 131 if(fListVertexQA) delete fListVertexQA;
0ab648ea 132}
133
134//____________________________________________________________________//
135Double_t AliProtonAnalysisBase::GetParticleFraction(Int_t i, Double_t p) {
136 //Return the a priori probs
137 Double_t partFrac=0;
138 if(fFunctionProbabilityFlag) {
139 if(i == 0) partFrac = fElectronFunction->Eval(p);
140 if(i == 1) partFrac = fMuonFunction->Eval(p);
141 if(i == 2) partFrac = fPionFunction->Eval(p);
142 if(i == 3) partFrac = fKaonFunction->Eval(p);
143 if(i == 4) partFrac = fProtonFunction->Eval(p);
144 }
145 else partFrac = fPartFrac[i];
146
147 return partFrac;
148}
149
150//____________________________________________________________________//
151Bool_t AliProtonAnalysisBase::IsInPhaseSpace(AliESDtrack* const track) {
152 // Checks if the track is outside the analyzed y-Pt phase space
df201289 153 Double_t gP = 0.0, gPt = 0.0, gPx = 0.0, gPy = 0.0, gPz = 0.0;
0ab648ea 154 Double_t eta = 0.0;
155
afc2ac17 156 if((fProtonAnalysisMode == kTPC) || (fProtonAnalysisMode == kHybrid) || (fProtonAnalysisMode == kFullHybrid)) {
0ab648ea 157 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
158 if(!tpcTrack) {
df201289 159 gP = 0.0; gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0; eta = -10.0;
0ab648ea 160 }
161 else {
df201289 162 gP = tpcTrack->P();
0ab648ea 163 gPt = tpcTrack->Pt();
164 gPx = tpcTrack->Px();
165 gPy = tpcTrack->Py();
166 gPz = tpcTrack->Pz();
167 eta = tpcTrack->Eta();
168 }
a84984fa 169 }//standalone TPC or Hybrid TPC approaches
0ab648ea 170 else {
df201289 171 gP = track->P();
0ab648ea 172 gPt = track->Pt();
173 gPx = track->Px();
174 gPy = track->Py();
175 gPz = track->Pz();
176 eta = track->Eta();
177 }
178
e56f08ed 179 if((gPt < fMinY) || (gPt > fMaxY)) {
0ab648ea 180 if(fDebugMode)
181 Printf("IsInPhaseSpace: Track rejected because it has a Pt value of %lf (accepted interval: %lf - %lf)",gPt,fMinY,fMaxY);
182 return kFALSE;
183 }
e56f08ed 184 if((gP < fMinY) || (gP > fMaxY)) {
185 if(fDebugMode)
186 Printf("IsInPhaseSpace: Track rejected because it has a P value of %lf (accepted interval: %lf - %lf)",gP,fMinY,fMaxY);
187 return kFALSE;
188 }
0ab648ea 189 if(fAnalysisEtaMode) {
190 if((eta < fMinX) || (eta > fMaxX)) {
191 if(fDebugMode)
192 Printf("IsInPhaseSpace: Track rejected because it has an eta value of %lf (accepted interval: %lf - %lf)",eta,fMinX,fMaxX);
193 return kFALSE;
194 }
195 }
196 else {
197 if((Rapidity(gPx,gPy,gPz) < fMinX) || (Rapidity(gPx,gPy,gPz) > fMaxX)) {
198 if(fDebugMode)
199 Printf("IsInPhaseSpace: Track rejected because it has a y value of %lf (accepted interval: %lf - %lf)",Rapidity(gPx,gPy,gPz),fMinX,fMaxX);
200 return kFALSE;
201 }
202 }
203
204 return kTRUE;
205}
206
207//____________________________________________________________________//
30f87a5b 208Bool_t AliProtonAnalysisBase::IsAccepted(AliESDtrack* track) {
0ab648ea 209 // Checks if the track is excluded from the cuts
0ab648ea 210 Int_t fIdxInt[200];
211 Int_t nClustersITS = track->GetITSclusters(fIdxInt);
212 Int_t nClustersTPC = track->GetTPCclusters(fIdxInt);
213
214 Float_t chi2PerClusterITS = -1;
215 if (nClustersITS!=0)
216 chi2PerClusterITS = track->GetITSchi2()/Float_t(nClustersITS);
217 Float_t chi2PerClusterTPC = -1;
218 if (nClustersTPC!=0)
219 chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);
220
221 Double_t extCov[15];
222 track->GetExternalCovariance(extCov);
223
4787e0ca 224 if(fPointOnSPDLayersFlag) {
225 if((!track->HasPointOnITSLayer(0))&&(!track->HasPointOnITSLayer(1))) {
226 if(fDebugMode)
227 Printf("IsAccepted: Track rejected because it doesn't have a point on either SPD layers");
228 return kFALSE;
229 }
230 }
231 if(fPointOnSDDLayersFlag) {
232 if((!track->HasPointOnITSLayer(2))&&(!track->HasPointOnITSLayer(3))) {
233 if(fDebugMode)
234 Printf("IsAccepted: Track rejected because it doesn't have a point on either SDD layers");
235 return kFALSE;
236 }
237 }
238 if(fPointOnSSDLayersFlag) {
239 if((!track->HasPointOnITSLayer(4))&&(!track->HasPointOnITSLayer(5))) {
240 if(fDebugMode)
241 Printf("IsAccepted: Track rejected because it doesn't have a point on either SSD layers");
242 return kFALSE;
243 }
244 }
0ab648ea 245 if(fPointOnITSLayer1Flag) {
246 if(!track->HasPointOnITSLayer(0)) {
247 if(fDebugMode)
248 Printf("IsAccepted: Track rejected because it doesn't have a point on the 1st ITS layer");
249 return kFALSE;
250 }
251 }
252 if(fPointOnITSLayer2Flag) {
253 if(!track->HasPointOnITSLayer(1)) {
254 if(fDebugMode)
255 Printf("IsAccepted: Track rejected because it doesn't have a point on the 2nd ITS layer");
256 return kFALSE;
257 }
258 }
259 if(fPointOnITSLayer3Flag) {
260 if(!track->HasPointOnITSLayer(2)) {
261 if(fDebugMode)
262 Printf("IsAccepted: Track rejected because it doesn't have a point on the 3rd ITS layer");
263 return kFALSE;
264 }
265 }
266 if(fPointOnITSLayer4Flag) {
267 if(!track->HasPointOnITSLayer(3)) {
268 if(fDebugMode)
269 Printf("IsAccepted: Track rejected because it doesn't have a point on the 4th ITS layer");
270 return kFALSE;
271 }
272 }
273 if(fPointOnITSLayer5Flag) {
274 if(!track->HasPointOnITSLayer(4)) {
275 if(fDebugMode)
276 Printf("IsAccepted: Track rejected because it doesn't have a point on the 5th ITS layer");
277 return kFALSE;
278 }
279 }
280 if(fPointOnITSLayer6Flag) {
281 if(!track->HasPointOnITSLayer(5)) {
282 if(fDebugMode)
283 Printf("IsAccepted: Track rejected because it doesn't have a point on the 6th ITS layer");
284 return kFALSE;
285 }
286 }
287 if(fMinITSClustersFlag) {
288 if(nClustersITS < fMinITSClusters) {
289 if(fDebugMode)
290 Printf("IsAccepted: Track rejected because it has %d ITS points (min. requested: %d)",nClustersITS,fMinITSClusters);
291 return kFALSE;
292 }
293 }
294 if(fMaxChi2PerITSClusterFlag) {
295 if(chi2PerClusterITS > fMaxChi2PerITSCluster) {
296 if(fDebugMode)
297 Printf("IsAccepted: Track rejected because it has a chi2 per ITS cluster %lf (max. requested: %lf)",chi2PerClusterITS,fMaxChi2PerITSCluster);
298 return kFALSE;
299 }
300 }
301 if(fMinTPCClustersFlag) {
302 if(nClustersTPC < fMinTPCClusters) {
303 if(fDebugMode)
304 Printf("IsAccepted: Track rejected because it has %d TPC clusters (min. requested: %d)",nClustersTPC,fMinTPCClusters);
305 return kFALSE;
306 }
307 }
308 if(fMaxChi2PerTPCClusterFlag) {
309 if(chi2PerClusterTPC > fMaxChi2PerTPCCluster) {
310 if(fDebugMode)
311 Printf("IsAccepted: Track rejected because it has a chi2 per TPC cluster %lf (max. requested: %lf)",chi2PerClusterTPC,fMaxChi2PerTPCCluster);
312 return kFALSE;
313 }
314 }
315 if(fMaxCov11Flag) {
316 if(extCov[0] > fMaxCov11) {
317 if(fDebugMode)
318 Printf("IsAccepted: Track rejected because it has a cov11 value of %lf (max. requested: %lf)",extCov[0],fMaxCov11);
319 return kFALSE;
320 }
321 }
322 if(fMaxCov22Flag) {
323 if(extCov[2] > fMaxCov22) {
324 if(fDebugMode)
325 Printf("IsAccepted: Track rejected because it has a cov22 value of %lf (max. requested: %lf)",extCov[2],fMaxCov22);
326 return kFALSE;
327 }
328 }
329 if(fMaxCov33Flag) {
330 if(extCov[5] > fMaxCov33) {
331 if(fDebugMode)
332 Printf("IsAccepted: Track rejected because it has a cov33 value of %lf (max. requested: %lf)",extCov[5],fMaxCov33);
333 return kFALSE;
334 }
335 }
336 if(fMaxCov44Flag) {
337 if(extCov[9] > fMaxCov44) {
338 if(fDebugMode)
339 Printf("IsAccepted: Track rejected because it has a cov44 value of %lf (max. requested: %lf)",extCov[9],fMaxCov44);
340 return kFALSE;
341 }
342 }
343 if(fMaxCov55Flag) {
344 if(extCov[14] > fMaxCov55) {
345 if(fDebugMode)
346 Printf("IsAccepted: Track rejected because it has a cov55 value of %lf (max. requested: %lf)",extCov[14],fMaxCov55);
347 return kFALSE;
348 }
349 }
87a55728 350 if(fMinTPCdEdxPointsFlag) {
351 if(track->GetTPCsignalN() < fMinTPCdEdxPoints) {
352 if(fDebugMode)
353 Printf("IsAccepted: Track rejected because it has %d TPC points for the calculation of the energy loss (min. requested: %d)",track->GetTPCsignalN(),fMinTPCdEdxPoints);
354 return kFALSE;
355 }
356 }
0ab648ea 357 if(fITSRefitFlag) {
358 if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) {
359 if(fDebugMode)
360 Printf("IsAccepted: Track rejected because it has no ITS refit flag");
361 return kFALSE;
362 }
363 }
364 if(fTPCRefitFlag) {
365 if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) {
366 if(fDebugMode)
367 Printf("IsAccepted: Track rejected because it has no TPC refit flag");
368 return kFALSE;
369 }
370 }
371 if(fESDpidFlag) {
372 if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) {
373 if(fDebugMode)
374 Printf("IsAccepted: Track rejected because it has no ESD pid flag");
375 return kFALSE;
376 }
377 }
378 if(fTPCpidFlag) {
379 if ((track->GetStatus() & AliESDtrack::kTPCpid) == 0) {
380 if(fDebugMode)
381 Printf("IsAccepted: Track rejected because it has no TPC pid flag");
382 return kFALSE;
383 }
384 }
f62e9410 385 if(fTOFpidFlag) {
386 if ((track->GetStatus() & AliESDtrack::kTOFpid) == 0) {
387 if(fDebugMode)
388 Printf("IsAccepted: Track rejected because it has no TOF pid flag");
389 return kFALSE;
390 }
391 }
0ab648ea 392
393 return kTRUE;
394}
395
e56f08ed 396//____________________________________________________________________//
397Bool_t AliProtonAnalysisBase::IsPrimary(AliESDEvent *esd,
398 const AliESDVertex *vertex,
399 AliESDtrack* track) {
400 // Checks if the track is a primary-like candidate
401 Double_t gPt = 0.0, gPx = 0.0, gPy = 0.0, gPz = 0.0;
402 Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0}; //The impact parameters and their covariance.
403 Double_t dca3D = 0.0;
afc2ac17 404 Float_t dcaXY = 0.0, dcaZ = 0.0;
405
e56f08ed 406 if((fProtonAnalysisMode == kTPC)||(fProtonAnalysisMode == kHybrid)) {
407 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
408 if(!tpcTrack) {
409 gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
410 dca[0] = -100.; dca[1] = -100.; dca3D = -100.;
411 cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
412 }
413 else {
414 gPt = tpcTrack->Pt();
415 gPx = tpcTrack->Px();
416 gPy = tpcTrack->Py();
417 gPz = tpcTrack->Pz();
418 tpcTrack->PropagateToDCA(vertex,
419 esd->GetMagneticField(),
420 100.,dca,cov);
421 }
422 }//standalone TPC or hybrid TPC approaches
afc2ac17 423 if(fProtonAnalysisMode == kFullHybrid) {
424 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
425 AliExternalTrackParam cParam;
426 if(!tpcTrack) {
427 gPt = 0.0; gPx = 0.0; gPy = 0.0; gPz = 0.0;
428 dca[0] = -100.; dca[1] = -100.; dca3D = -100.;
429 cov[0] = -100.; cov[1] = -100.; cov[2] = -100.;
430 }
431 else {
432 gPt = tpcTrack->Pt();
433 gPx = tpcTrack->Px();
434 gPy = tpcTrack->Py();
435 gPz = tpcTrack->Pz();
436 track->RelateToVertex(vertex,
437 esd->GetMagneticField(),
438 100.,&cParam);
439 track->GetImpactParameters(dcaXY,dcaZ);
440 dca[0] = dcaXY; dca[1] = dcaZ;
441 }
442 }//standalone TPC or hybrid TPC approaches
e56f08ed 443 else {
444 gPt = track->Pt();
445 gPx = track->Px();
446 gPy = track->Py();
447 gPz = track->Pz();
448 track->PropagateToDCA(vertex,
449 esd->GetMagneticField(),
450 100.,dca,cov);
451 }
452 dca3D = TMath::Sqrt(TMath::Power(dca[0],2) +
453 TMath::Power(dca[1],2));
454
e56f08ed 455 if(fMaxSigmaToVertexFlag) {
456 if(GetSigmaToVertex(track) > fMaxSigmaToVertex) {
457 if(fDebugMode)
458 Printf("IsPrimary: Track rejected because it has a %lf sigmas to vertex (max. requested: %lf)",GetSigmaToVertex(track),fMaxSigmaToVertex);
459 return kFALSE;
460 }
461 }
462 if(fMaxSigmaToVertexTPCFlag) {
463 if(GetSigmaToVertex(track) > fMaxSigmaToVertexTPC) {
464 if(fDebugMode)
465 Printf("IsPrimary: Track rejected because it has a %lf sigmas to vertex TPC (max. requested: %lf)",GetSigmaToVertex(track),fMaxSigmaToVertexTPC);
466 return kFALSE;
467 }
468 }
469 if(fMaxDCAXYFlag) {
470 if(TMath::Abs(dca[0]) > fMaxDCAXY) {
471 if(fDebugMode)
472 Printf("IsPrimary: Track rejected because it has a value of dca(xy) of %lf (max. requested: %lf)",TMath::Abs(dca[0]),fMaxDCAXY);
473 return kFALSE;
474 }
475 }
476 if(fMaxDCAXYTPCFlag) {
477 if(TMath::Abs(dca[0]) > fMaxDCAXYTPC) {
478 if(fDebugMode)
479 Printf("IsPrimary: Track rejected because it has a value of dca(xy) (TPC) of %lf (max. requested: %lf)",TMath::Abs(dca[0]),fMaxDCAXYTPC);
480 return kFALSE;
481 }
482 }
483 if(fMaxDCAZFlag) {
484 if(TMath::Abs(dca[1]) > fMaxDCAZ) {
485 if(fDebugMode)
486 Printf("IsPrimary: Track rejected because it has a value of dca(z) of %lf (max. requested: %lf)",TMath::Abs(dca[1]),fMaxDCAZ);
487 return kFALSE;
488 }
489 }
490 if(fMaxDCAZTPCFlag) {
491 if(TMath::Abs(dca[1]) > fMaxDCAZTPC) {
492 if(fDebugMode)
493 Printf("IsPrimary: Track rejected because it has a value of dca(z) (TPC) of %lf (max. requested: %lf)",TMath::Abs(dca[1]),fMaxDCAZTPC);
494 return kFALSE;
495 }
496 }
497 if(fMaxDCA3DFlag) {
498 if(TMath::Abs(dca3D) > fMaxDCA3D) {
499 if(fDebugMode)
500 Printf("IsPrimary: Track rejected because it has a value of dca(3D) of %lf (max. requested: %lf)",TMath::Abs(dca3D),fMaxDCA3D);
501 return kFALSE;
502 }
503 }
504 if(fMaxDCA3DTPCFlag) {
505 if(TMath::Abs(dca3D) > fMaxDCA3DTPC) {
506 if(fDebugMode)
507 Printf("IsPrimary: Track rejected because it has a value of dca(3D) (TPC) of %lf (max. requested: %lf)",TMath::Abs(dca3D),fMaxDCA3DTPC);
508 return kFALSE;
509 }
510 }
511 if(fMaxConstrainChi2Flag) {
512 if(track->GetConstrainedChi2() > 0)
513 if(TMath::Log(track->GetConstrainedChi2()) > fMaxConstrainChi2) {
514 if(fDebugMode)
515 Printf("IsPrimary: Track rejected because it has a value of the constrained chi2 to the vertex of %lf (max. requested: %lf)",TMath::Log(track->GetConstrainedChi2()),fMaxConstrainChi2);
516 return kFALSE;
517 }
518 }
e56f08ed 519
520 return kTRUE;
521}
522
0ab648ea 523//____________________________________________________________________//
524Float_t AliProtonAnalysisBase::GetSigmaToVertex(AliESDtrack* esdTrack) const {
525 // Calculates the number of sigma to the vertex.
0ab648ea 526 Float_t b[2];
527 Float_t bRes[2];
528 Float_t bCov[3];
afc2ac17 529 if((fProtonAnalysisMode == kTPC)&&(fProtonAnalysisMode != kHybrid)&&(fProtonAnalysisMode != kFullHybrid))
0ab648ea 530 esdTrack->GetImpactParametersTPC(b,bCov);
531 else
532 esdTrack->GetImpactParameters(b,bCov);
533
534 if (bCov[0]<=0 || bCov[2]<=0) {
535 //AliDebug(1, "Estimated b resolution lower or equal zero!");
536 bCov[0]=0; bCov[2]=0;
537 }
538 bRes[0] = TMath::Sqrt(bCov[0]);
539 bRes[1] = TMath::Sqrt(bCov[2]);
540
541 if (bRes[0] == 0 || bRes[1] ==0) return -1;
542
543 Float_t d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
544
545 if (TMath::Exp(-d * d / 2) < 1e-10) return 1000;
546
547 d = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
548
549 return d;
550}
551
552//____________________________________________________________________//
553Double_t AliProtonAnalysisBase::Rapidity(Double_t gPx,
554 Double_t gPy,
555 Double_t gPz) const {
556 //returns the rapidity of the proton - to be removed
557 Double_t fMass = 9.38270000000000048e-01;
558
559 Double_t gP = TMath::Sqrt(TMath::Power(gPx,2) +
560 TMath::Power(gPy,2) +
561 TMath::Power(gPz,2));
562 Double_t energy = TMath::Sqrt(gP*gP + fMass*fMass);
563 Double_t y = -999;
564 if(energy != gPz)
565 y = 0.5*TMath::Log((energy + gPz)/(energy - gPz));
566
567 return y;
568}
569
570//________________________________________________________________________
571const AliESDVertex* AliProtonAnalysisBase::GetVertex(AliESDEvent* esd,
572 AnalysisMode mode,
573 Double_t gVxMax,
574 Double_t gVyMax,
575 Double_t gVzMax) {
576 // Get the vertex from the ESD and returns it if the vertex is valid
577 // Second argument decides which vertex is used (this selects
578 // also the quality criteria that are applied)
579 const AliESDVertex* vertex = 0;
afc2ac17 580 if((mode == kHybrid)||(mode == kFullHybrid))
0ab648ea 581 vertex = esd->GetPrimaryVertexSPD();
582 else if(mode == kTPC){
583 Double_t kBz = esd->GetMagneticField();
584 AliVertexerTracks vertexer(kBz);
585 vertexer.SetTPCMode();
586 AliESDVertex *vTPC = vertexer.FindPrimaryVertex(esd);
587 esd->SetPrimaryVertexTPC(vTPC);
588 for (Int_t i=0; i<esd->GetNumberOfTracks(); i++) {
589 AliESDtrack *t = esd->GetTrack(i);
590 t->RelateToVertexTPC(vTPC, kBz, kVeryBig);
591 }
592 delete vTPC;
593 vertex = esd->GetPrimaryVertexTPC();
594 }
595 else if(mode == kGlobal)
596 vertex = esd->GetPrimaryVertex();
597 else
598 Printf("GetVertex: ERROR: Invalid second argument %d", mode);
599
600 if(!vertex) {
601 if(fDebugMode)
602 Printf("GetVertex: Event rejected because there is no valid vertex object");
603 return 0;
604 }
605
606 // check Ncontributors
607 if(vertex->GetNContributors() <= 0) {
608 if(fDebugMode)
609 Printf("GetVertex: Event rejected because the number of contributors for the vertex determination is <= 0");
610 return 0;
611 }
612
613 // check resolution
614 Double_t zRes = vertex->GetZRes();
615 if(zRes == 0) {
616 if(fDebugMode)
617 Printf("GetVertex: Event rejected because the value of the vertex resolution in z is 0");
618 return 0;
619 }
735cc63d 620 ((TH1F *)(fListVertexQA->At(0)))->Fill(vertex->GetXv());
621 ((TH1F *)(fListVertexQA->At(2)))->Fill(vertex->GetYv());
622 ((TH1F *)(fListVertexQA->At(4)))->Fill(vertex->GetZv());
e56f08ed 623
0ab648ea 624 //check position
625 if(TMath::Abs(vertex->GetXv()) > gVxMax) {
626 if(fDebugMode)
627 Printf("GetVertex: Event rejected because it has a Vx value of %lf cm (accepted interval: -%lf - %lf)",TMath::Abs(vertex->GetXv()),gVxMax,gVxMax);
628 return 0;
629 }
630 if(TMath::Abs(vertex->GetYv()) > gVyMax) {
631 if(fDebugMode)
632 Printf("GetVertex: Event rejected because it has a Vy value of %lf cm (accepted interval: -%lf - %lf)",TMath::Abs(vertex->GetYv()),gVyMax,gVyMax);
633 return 0;
634 }
635 if(TMath::Abs(vertex->GetZv()) > gVzMax) {
636 if(fDebugMode)
637 Printf("GetVertex: Event rejected because it has a Vz value of %lf cm (accepted interval: -%lf - %lf)",TMath::Abs(vertex->GetZv()),gVzMax,gVzMax);
638 return 0;
639 }
735cc63d 640 ((TH1F *)(fListVertexQA->At(1)))->Fill(vertex->GetXv());
641 ((TH1F *)(fListVertexQA->At(3)))->Fill(vertex->GetYv());
642 ((TH1F *)(fListVertexQA->At(5)))->Fill(vertex->GetZv());
e56f08ed 643 ((TH1F *)(fListVertexQA->At(6)))->Fill(vertex->GetNContributors());
644
645 //check number of contributors
646 if(fMinNumOfContributors > 0) {
647 if(fMinNumOfContributors > vertex->GetNContributors()) {
648 if(fDebugMode)
649 Printf("GetVertex: Event rejected because it has %d number of contributors (requested minimum: %d)",vertex->GetNContributors(),fMinNumOfContributors);
650
651 return 0;
652 }
653 }
0ab648ea 654
655 return vertex;
656}
657
658//________________________________________________________________________
659Bool_t AliProtonAnalysisBase::IsEventTriggered(const AliESDEvent *esd,
660 TriggerMode trigger) {
661 // check if the event was triggered
662 ULong64_t triggerMask = esd->GetTriggerMask();
42270c4c 663 TString firedTriggerClass = esd->GetFiredTriggerClasses();
0ab648ea 664
42270c4c 665 if(fAnalysisMC) {
666 // definitions from p-p.cfg
667 ULong64_t spdFO = (1 << 14);
668 ULong64_t v0left = (1 << 11);
669 ULong64_t v0right = (1 << 12);
670
671 switch (trigger) {
672 case kMB1: {
673 if (triggerMask & spdFO || ((triggerMask & v0left) || (triggerMask & v0right)))
674 return kTRUE;
675 break;
676 }
677 case kMB2: {
678 if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right)))
679 return kTRUE;
680 break;
681 }
682 case kSPDFASTOR: {
683 if (triggerMask & spdFO)
684 return kTRUE;
685 break;
686 }
687 }//switch
0ab648ea 688 }
42270c4c 689 else {
4de4661f 690 if(kUseOnlineTrigger) {
691 if(firedTriggerClass.Contains("CINT1B-ABCE-NOPF-ALL"))
692 return kTRUE;
693 }
694 else if(!kUseOnlineTrigger)
0ab648ea 695 return kTRUE;
0ab648ea 696 }
0ab648ea 697
698 return kFALSE;
699}
700
701//________________________________________________________________________
702TCanvas *AliProtonAnalysisBase::GetListOfCuts() {
703 // return the list of cuts and their cut values for reference
704 TLatex l;
705 l.SetTextAlign(12);
706 l.SetTextSize(0.04);
707
708 TString listOfCuts;
709
710 TCanvas *c = new TCanvas("cListOfCuts","List of cuts",0,0,900,600);
711 c->SetFillColor(10); c->SetHighLightColor(41);
712 c->Divide(3,2);
713
714 c->cd(1)->SetFillColor(10);
715 l.DrawLatex(0.3,0.9,"Analysis details: List of cuts\n\n");
716
717 listOfCuts = "Analysis level: "; listOfCuts += fProtonAnalysisLevel;
718 l.DrawLatex(0.1,0.82,listOfCuts.Data());
719 listOfCuts = "Analysis mode: ";
720 if(fProtonAnalysisMode == kTPC) listOfCuts += "TPC standalone";
721 if(fProtonAnalysisMode == kHybrid) listOfCuts += "Hybrid TPC";
afc2ac17 722 if(fProtonAnalysisMode == kFullHybrid) listOfCuts += "Full Hybrid TPC";
0ab648ea 723 if(fProtonAnalysisMode == kGlobal) listOfCuts += "Global tracking";
724 l.DrawLatex(0.1,0.74,listOfCuts.Data());
725 listOfCuts = "Trigger mode: ";
726 if(fTriggerMode == kMB1) listOfCuts += "Minimum bias 1";
727 if(fTriggerMode == kMB2) listOfCuts += "Minimum bias 2";
728 if(fTriggerMode == kSPDFASTOR) listOfCuts += "FastOR (SPD)";
729 l.DrawLatex(0.1,0.66,listOfCuts.Data());
730 listOfCuts = "PID mode: ";
731 if(fProtonPIDMode == kBayesian) listOfCuts += "Bayesian PID";
c6909683 732 if(fProtonPIDMode == kRatio) {
733 listOfCuts += "Z = ln((dE/dx)_{exp.}/(dE/dx)_{theor.}) > ";
734 listOfCuts += fNRatio;
87a55728 735 }
c6909683 736 if(fProtonPIDMode == kSigma) {
737 listOfCuts += "N_{#sigma} area: "; listOfCuts += fNSigma;
87a55728 738 listOfCuts += " #sigma";
739 }
c6909683 740 //if(fProtonPIDMode == kSigma2) {
741 //listOfCuts += "N_{#sigma}(2) area: "; listOfCuts += fNSigma;
742 //listOfCuts += " #sigma";
743 //}
0ab648ea 744 l.DrawLatex(0.1,0.58,listOfCuts.Data());
745 listOfCuts = "Accepted vertex diamond: ";
c6909683 746 l.DrawLatex(0.1,0.52,listOfCuts.Data());
0ab648ea 747 listOfCuts = "|V_{x}| < "; listOfCuts += fVxMax; listOfCuts += " [cm]";
c6909683 748 l.DrawLatex(0.6,0.52,listOfCuts.Data());
0ab648ea 749 listOfCuts = "|V_{y}| < "; listOfCuts += fVyMax; listOfCuts += " [cm]";
c6909683 750 l.DrawLatex(0.6,0.45,listOfCuts.Data());
0ab648ea 751 listOfCuts = "|V_{z}| < "; listOfCuts += fVzMax; listOfCuts += " [cm]";
c6909683 752 l.DrawLatex(0.6,0.38,listOfCuts.Data());
753 listOfCuts = "N_{contributors} > "; listOfCuts += fMinNumOfContributors;
754 l.DrawLatex(0.6,0.31,listOfCuts.Data());
0ab648ea 755 listOfCuts = "Phase space: ";
756 l.DrawLatex(0.1,0.2,listOfCuts.Data());
757 if(fAnalysisEtaMode) listOfCuts = "|#eta| < ";
758 else listOfCuts = "|y| < ";
759 listOfCuts += TMath::Abs(fMinX);
760 l.DrawLatex(0.35,0.2,listOfCuts.Data());
761 listOfCuts = "N_{bins} = ";
762 listOfCuts += fNBinsX; listOfCuts += " (binning: ";
763 listOfCuts += (fMaxX-fMinX)/fNBinsX; listOfCuts += ")";
764 l.DrawLatex(0.35,0.15,listOfCuts.Data());
765 listOfCuts = ""; listOfCuts += fMinY; listOfCuts += " < P_{T} < ";
766 listOfCuts += fMaxY; listOfCuts += "GeV/c";
767 l.DrawLatex(0.35,0.1,listOfCuts.Data());
768 listOfCuts = "N_{bins} = ";
769 listOfCuts += fNBinsY; listOfCuts += " (binning: ";
770 listOfCuts += (fMaxY-fMinY)/fNBinsY; listOfCuts += ")";
771 l.DrawLatex(0.35,0.05,listOfCuts.Data());
772
773 c->cd(2)->SetFillColor(2);
4787e0ca 774 l.DrawLatex(0.3,0.95,"ITS related cuts");
775 listOfCuts = "Request a cluster on either of the SPD layers: ";
776 listOfCuts += fPointOnSPDLayersFlag;
777 l.DrawLatex(0.1,0.9,listOfCuts.Data());
778 listOfCuts = "Request a cluster on either of the SDD layers: ";
779 listOfCuts += fPointOnSDDLayersFlag;
780 l.DrawLatex(0.1,0.83,listOfCuts.Data());
781 listOfCuts = "Request a cluster on either of the SSD layers: ";
782 listOfCuts += fPointOnSSDLayersFlag;
783 l.DrawLatex(0.1,0.76,listOfCuts.Data());
784
0ab648ea 785 listOfCuts = "Request a cluster on SPD1: ";
786 listOfCuts += fPointOnITSLayer1Flag;
4787e0ca 787 l.DrawLatex(0.1,0.69,listOfCuts.Data());
0ab648ea 788 listOfCuts = "Request a cluster on SPD2: ";
789 listOfCuts += fPointOnITSLayer2Flag;
4787e0ca 790 l.DrawLatex(0.1,0.62,listOfCuts.Data());
0ab648ea 791 listOfCuts = "Request a cluster on SDD1: ";
792 listOfCuts += fPointOnITSLayer3Flag;
4787e0ca 793 l.DrawLatex(0.1,0.55,listOfCuts.Data());
0ab648ea 794 listOfCuts = "Request a cluster on SDD2: ";
795 listOfCuts += fPointOnITSLayer4Flag;
4787e0ca 796 l.DrawLatex(0.1,0.48,listOfCuts.Data());
0ab648ea 797 listOfCuts = "Request a cluster on SSD1: ";
798 listOfCuts += fPointOnITSLayer5Flag;
4787e0ca 799 l.DrawLatex(0.1,0.41,listOfCuts.Data());
0ab648ea 800 listOfCuts = "Request a cluster on SSD2: ";
801 listOfCuts += fPointOnITSLayer6Flag;
4787e0ca 802 l.DrawLatex(0.1,0.34,listOfCuts.Data());
0ab648ea 803 listOfCuts = "Minimum number of ITS clusters: ";
804 if(fMinITSClustersFlag) listOfCuts += fMinITSClusters;
805 else listOfCuts += "Not used";
4787e0ca 806 l.DrawLatex(0.1,0.27,listOfCuts.Data());
0ab648ea 807 listOfCuts = "Maximum #chi^{2} per ITS cluster: ";
808 if(fMaxChi2PerITSClusterFlag) listOfCuts += fMaxChi2PerITSCluster;
809 else listOfCuts += "Not used";
4787e0ca 810 l.DrawLatex(0.1,0.2,listOfCuts.Data());
0ab648ea 811
812 c->cd(3)->SetFillColor(3);
813 l.DrawLatex(0.3,0.9,"TPC related cuts");
814 listOfCuts = "Minimum number of TPC clusters: ";
815 if(fMinTPCClustersFlag) listOfCuts += fMinTPCClusters;
816 else listOfCuts += "Not used";
817 l.DrawLatex(0.1,0.7,listOfCuts.Data());
818 listOfCuts = "Maximum #chi^{2} per TPC cluster: ";
819 if(fMaxChi2PerTPCClusterFlag) listOfCuts += fMaxChi2PerTPCCluster;
820 else listOfCuts += "Not used";
821 l.DrawLatex(0.1,0.5,listOfCuts.Data());
57e749bb 822 listOfCuts = "Minimum number of TPC points for the dE/dx: ";
823 if(fMinTPCdEdxPointsFlag) listOfCuts += fMinTPCdEdxPoints;
824 else listOfCuts += "Not used";
825 l.DrawLatex(0.1,0.3,listOfCuts.Data());
0ab648ea 826
827 c->cd(4)->SetFillColor(4);
828 l.DrawLatex(0.3,0.9,"Tracking related cuts");
829 listOfCuts = "Maximum cov11: ";
830 if(fMaxCov11Flag) listOfCuts += fMaxCov11;
831 else listOfCuts += "Not used";
832 l.DrawLatex(0.1,0.75,listOfCuts.Data());
833 listOfCuts = "Maximum cov22: ";
834 if(fMaxCov22Flag) listOfCuts += fMaxCov22;
835 else listOfCuts += "Not used";
836 l.DrawLatex(0.1,0.6,listOfCuts.Data());
837 listOfCuts = "Maximum cov33: ";
838 if(fMaxCov33Flag) listOfCuts += fMaxCov33;
839 else listOfCuts += "Not used";
840 l.DrawLatex(0.1,0.45,listOfCuts.Data());
841 listOfCuts = "Maximum cov44: ";
842 if(fMaxCov44Flag) listOfCuts += fMaxCov44;
843 else listOfCuts += "Not used";
844 l.DrawLatex(0.1,0.3,listOfCuts.Data());
845 listOfCuts = "Maximum cov55: ";
846 if(fMaxCov55Flag) listOfCuts += fMaxCov55;
847 else listOfCuts += "Not used";
848 l.DrawLatex(0.1,0.15,listOfCuts.Data());
849
850 c->cd(5)->SetFillColor(5);
851 l.DrawLatex(0.3,0.9,"DCA related cuts");
852 listOfCuts = "Maximum sigma to vertex: ";
853 if(fMaxSigmaToVertexFlag) listOfCuts += fMaxSigmaToVertex;
854 else listOfCuts += "Not used";
855 l.DrawLatex(0.1,0.8,listOfCuts.Data());
856 listOfCuts = "Maximum sigma to vertex (TPC): ";
857 if(fMaxSigmaToVertexTPCFlag) listOfCuts += fMaxSigmaToVertexTPC;
858 else listOfCuts += "Not used";
859 l.DrawLatex(0.1,0.72,listOfCuts.Data());
860 listOfCuts = "Maximum DCA in xy: ";
861 if(fMaxDCAXYFlag) listOfCuts += fMaxDCAXY;
862 else listOfCuts += "Not used";
863 l.DrawLatex(0.1,0.64,listOfCuts.Data());
864 listOfCuts = "Maximum DCA in z: ";
865 if(fMaxDCAZFlag) listOfCuts += fMaxDCAZ;
866 else listOfCuts += "Not used";
867 l.DrawLatex(0.1,0.56,listOfCuts.Data());
868 listOfCuts = "Maximum DCA in 3D: ";
869 if(fMaxDCA3DFlag) listOfCuts += fMaxDCA3D;
870 else listOfCuts += "Not used";
871 l.DrawLatex(0.1,0.48,listOfCuts.Data());
872 listOfCuts = "Maximum DCA in xy (TPC): ";
873 if(fMaxDCAXYFlag) listOfCuts += fMaxDCAXYTPC;
874 else listOfCuts += "Not used";
875 l.DrawLatex(0.1,0.4,listOfCuts.Data());
876 listOfCuts = "Maximum DCA in z (TPC): ";
877 if(fMaxDCAZFlag) listOfCuts += fMaxDCAZTPC;
878 else listOfCuts += "Not used";
879 l.DrawLatex(0.1,0.32,listOfCuts.Data());
880 listOfCuts = "Maximum DCA in 3D (TPC): ";
881 if(fMaxDCA3DFlag) listOfCuts += fMaxDCA3DTPC;
882 else listOfCuts += "Not used";
883 l.DrawLatex(0.1,0.24,listOfCuts.Data());
884 listOfCuts = "Maximum constrained #chi^{2} (vertex): ";
885 if(fMaxConstrainChi2Flag) listOfCuts += fMaxConstrainChi2;
886 else listOfCuts += "Not used";
887 l.DrawLatex(0.1,0.16,listOfCuts.Data());
888
889 c->cd(6)->SetFillColor(6);
890 l.DrawLatex(0.3,0.9,"Tracking bits related cuts");
891 listOfCuts = "Request the ITS refit bit: "; listOfCuts += fITSRefitFlag;
892 l.DrawLatex(0.1,0.7,listOfCuts.Data());
893 listOfCuts = "Request the TPC refit bit: "; listOfCuts += fTPCRefitFlag;
894 l.DrawLatex(0.1,0.5,listOfCuts.Data());
895 listOfCuts = "Request the TPC pid bit: "; listOfCuts += fTPCpidFlag;
896 l.DrawLatex(0.1,0.3,listOfCuts.Data());
897 listOfCuts = "Request the ESD pid bit: "; listOfCuts += fESDpidFlag;
898 l.DrawLatex(0.1,0.1,listOfCuts.Data());
899
900 return c;
901}
902
903//________________________________________________________________________
904Bool_t AliProtonAnalysisBase::IsProton(AliESDtrack *track) {
905 //Function that checks if a track is a proton
906 Double_t probability[5];
87a55728 907 Double_t gPt = 0.0, gP = 0.0, gEta = 0.0;
0ab648ea 908 Long64_t fParticleType = 0;
909
910 //Bayesian approach for the PID
911 if(fProtonPIDMode == kBayesian) {
afc2ac17 912 if((fProtonAnalysisMode == kTPC)||(fProtonAnalysisMode == kHybrid)||(fProtonAnalysisMode == kFullHybrid)) {
0ab648ea 913 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
914 if(tpcTrack) {
915 gPt = tpcTrack->Pt();
916 gP = tpcTrack->P();
917 track->GetTPCpid(probability);
918 }
919 }//TPC standalone or Hybrid TPC
920 else if(fProtonAnalysisMode == kGlobal) {
921 gPt = track->Pt();
922 gP = track->P();
923 track->GetESDpid(probability);
924 }//Global tracking
925
926 Double_t rcc = 0.0;
927 for(Int_t i = 0; i < AliPID::kSPECIES; i++)
928 rcc += probability[i]*GetParticleFraction(i,gP);
929 if(rcc != 0.0) {
930 Double_t w[5];
931 for(Int_t i = 0; i < AliPID::kSPECIES; i++)
932 w[i] = probability[i]*GetParticleFraction(i,gP)/rcc;
933 fParticleType = TMath::LocMax(AliPID::kSPECIES,w);
934 }
935 if(fParticleType == 4)
936 return kTRUE;
937 }
938 //Ratio of the measured over the theoretical dE/dx a la STAR
939 else if(fProtonPIDMode == kRatio) {
c6909683 940 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
941 if(tpcTrack) {
942 gPt = tpcTrack->Pt();
b8cca027 943 gP = track->GetInnerParam()->P();
c6909683 944 gEta = tpcTrack->Eta();
945 }
946 Double_t fAlephParameters[5];
947 if(fAnalysisMC) {
948 fAlephParameters[0] = 2.15898e+00/50.;
949 fAlephParameters[1] = 1.75295e+01;
950 fAlephParameters[2] = 3.40030e-09;
951 fAlephParameters[3] = 1.96178e+00;
952 fAlephParameters[4] = 3.91720e+00;
953 }
954 else {
955 fAlephParameters[0] = 0.0283086;
956 fAlephParameters[1] = 2.63394e+01;
957 fAlephParameters[2] = 5.04114e-11;
958 fAlephParameters[3] = 2.12543e+00;
959 fAlephParameters[4] = 4.88663e+00;
960 }
961
962 AliESDpid *fESDpid = new AliESDpid();
963 AliTPCPIDResponse tpcResponse = fESDpid->GetTPCResponse();
964 tpcResponse.SetBetheBlochParameters(fAlephParameters[0],fAlephParameters[1],fAlephParameters[2],fAlephParameters[3],fAlephParameters[4]);
965 Double_t normalizeddEdx = TMath::Log(track->GetTPCsignal()/tpcResponse.GetExpectedSignal(gP,AliPID::kProton));
966
967 if(normalizeddEdx >= fNRatio)
968 return kTRUE;
969 }//kRatio PID mode
0ab648ea 970 //Definition of an N-sigma area around the dE/dx vs P band
c6909683 971 else if(fProtonPIDMode == kSigma) {
2c080079 972 Double_t fAlephParameters[5];
0bb8f6b4 973 if(fAnalysisMC) {
e56f08ed 974 fAlephParameters[0] = 2.15898e+00/50.;
975 fAlephParameters[1] = 1.75295e+01;
976 fAlephParameters[2] = 3.40030e-09;
977 fAlephParameters[3] = 1.96178e+00;
978 fAlephParameters[4] = 3.91720e+00;
0bb8f6b4 979 }
980 else {
e56f08ed 981 fAlephParameters[0] = 0.0283086;
982 fAlephParameters[1] = 2.63394e+01;
983 fAlephParameters[2] = 5.04114e-11;
984 fAlephParameters[3] = 2.12543e+00;
985 fAlephParameters[4] = 4.88663e+00;
0bb8f6b4 986 }
2c080079 987
30f87a5b 988 Double_t nsigma = 100.0;
10d100d4 989 AliESDpid *fESDpid = new AliESDpid();
e56f08ed 990 fESDpid->GetTPCResponse().SetBetheBlochParameters(fAlephParameters[0],fAlephParameters[1],fAlephParameters[2],fAlephParameters[3],fAlephParameters[4]);
2c080079 991
30f87a5b 992 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
993 if(tpcTrack)
994 nsigma = TMath::Abs(fESDpid->NumberOfSigmasTPC(track,AliPID::kProton));
995
2c080079 996 if(nsigma <= fNSigma)
87a55728 997 return kTRUE;
c6909683 998 }//kSigma PID method
87a55728 999 //Another definition of an N-sigma area around the dE/dx vs P band
c6909683 1000 /*else if(fProtonPIDMode == kSigma2) {
87a55728 1001 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
1002 if(tpcTrack) {
1003 gPt = tpcTrack->Pt();
1004 gP = tpcTrack->P();
1005 gEta = tpcTrack->Eta();
1006 }
f81f1b19 1007 Double_t fAlephParameters[5];
1008 if(fAnalysisMC) {
1009 fAlephParameters[0] = 2.15898e+00/50.;
1010 fAlephParameters[1] = 1.75295e+01;
1011 fAlephParameters[2] = 3.40030e-09;
1012 fAlephParameters[3] = 1.96178e+00;
1013 fAlephParameters[4] = 3.91720e+00;
1014 }
1015 else {
1016 fAlephParameters[0] = 0.0283086;
1017 fAlephParameters[1] = 2.63394e+01;
1018 fAlephParameters[2] = 5.04114e-11;
1019 fAlephParameters[3] = 2.12543e+00;
1020 fAlephParameters[4] = 4.88663e+00;
1021 }
1022
1023 AliESDpid *fESDpid = new AliESDpid();
1024 AliTPCPIDResponse tpcResponse = fESDpid->GetTPCResponse();
1025 tpcResponse.SetBetheBlochParameters(fAlephParameters[0],fAlephParameters[1],fAlephParameters[2],fAlephParameters[3],fAlephParameters[4]);
1026 Double_t normalizeddEdx = TMath::Log(track->GetTPCsignal()/tpcResponse.GetExpectedSignal(gP,AliPID::kProton));
1027
1028 if(normalizeddEdx >= -0.15)
87a55728 1029 return kTRUE;
c6909683 1030 }*/
0ab648ea 1031
1032 return kFALSE;
1033}
1034
1035
1036