Correct formula for phi, in case of current local X <0, in GetLocalXat and GetPhiZat
[u/mrichter/AliRoot.git] / ITS / AliITSpidESD1.cxx
CommitLineData
e62c1aea 1/**************************************************************************
2 * Copyright(c) 2005-2007, 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
1fad94b4 16/* $Id$ */
17
e62c1aea 18//-----------------------------------------------------------------
19// ITS PID method # 1
20// Implementation of the ITS PID class
21// Very naive one... Should be made better by the detector experts...
22// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
23//-----------------------------------------------------------------
24#include "AliITSpidESD.h"
25#include "AliITSpidESD1.h"
af885e0f 26#include "AliESDEvent.h"
e62c1aea 27#include "AliESDtrack.h"
28
29ClassImp(AliITSpidESD1)
30
94631b2f 31AliITSpidESD1::AliITSpidESD1(): AliITSpidESD(),
38013a1a 32fMIP(0),
94631b2f 33fRes(0),
34fRange(0)
35{
e62c1aea 36 //Default constructor
e62c1aea 37}
38//_________________________________________________________________________
94631b2f 39AliITSpidESD1::AliITSpidESD1(Double_t *param): AliITSpidESD(),
38013a1a 40fMIP(param[0]),
41fRes(param[1]),
42fRange(param[2])
e62c1aea 43{
44 //
45 // The main constructor
46 //
e62c1aea 47}
48
49
50//_________________________________________________________________________
af885e0f 51Int_t AliITSpidESD1::MakePID(AliESDEvent *event)
e62c1aea 52{
53 //
54 // This function calculates the "detector response" PID probabilities
55 //
56 Int_t ntrk=event->GetNumberOfTracks();
57 for (Int_t i=0; i<ntrk; i++) {
58 AliESDtrack *t=event->GetTrack(i);
59 if ((t->GetStatus()&AliESDtrack::kITSin )==0)
60 if ((t->GetStatus()&AliESDtrack::kITSout)==0) continue;
61 Double_t mom=t->GetP();
38013a1a 62 Double_t dedx=t->GetITSsignal()/fMIP;
e62c1aea 63 Double_t p[10];
7a8614f3 64 Bool_t mismatch=kTRUE, heavy=kTRUE;
65 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
25fee9b6 66 Double_t mass=AliPID::ParticleMass(j);//GeV/c^2
67 Double_t bethe=AliITSpidESD::Bethe(mom,mass);
e62c1aea 68 Double_t sigma=fRes*bethe;
69 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
70 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
7a8614f3 71 } else {
72 p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
73 mismatch=kFALSE;
e62c1aea 74 }
7a8614f3 75
76 // Check for particles heavier than (AliPID::kSPECIES - 1)
77 if (dedx < (bethe + fRange*sigma)) heavy=kFALSE;
78
e62c1aea 79 }
7a8614f3 80
81 if (mismatch)
82 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1/AliPID::kSPECIES;
83
e62c1aea 84 t->SetITSpid(p);
7a8614f3 85
86 if (heavy) t->ResetStatus(AliESDtrack::kITSpid);
87
e62c1aea 88 }
89 return 0;
90}