]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSpidESD.cxx
negative indexes allowed
[u/mrichter/AliRoot.git] / ITS / AliITSpidESD.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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
16 //-----------------------------------------------------------------
17 //           Implementation of the ITS PID class
18 // Very naive one... Should be made better by the detector experts...
19 //      Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
20 //-----------------------------------------------------------------
21
22 #include "AliITSpidESD.h"
23 #include "AliESD.h"
24 #include "AliESDtrack.h"
25
26 ClassImp(AliITSpidESD)
27
28 //_________________________________________________________________________
29 AliITSpidESD::AliITSpidESD(Double_t *param)
30 {
31   //
32   //  The main constructor
33   //
34   fMIP=param[0];
35   fRes=param[1];
36   fRange=param[2];
37 }
38
39 Double_t AliITSpidESD::Bethe(Double_t bg) {
40   //
41   // This is the Bethe-Bloch function normalised to 1 at the minimum
42   //
43   Double_t bg2=bg*bg;
44   Double_t bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2));
45   return bethe/11.091;
46 }
47
48 //_________________________________________________________________________
49 Int_t AliITSpidESD::MakePID(AliESD *event)
50 {
51   //
52   //  This function calculates the "detector response" PID probabilities 
53   //
54   static const Double_t masses[]={
55     0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
56   };
57   Int_t ntrk=event->GetNumberOfTracks();
58   for (Int_t i=0; i<ntrk; i++) {
59     AliESDtrack *t=event->GetTrack(i);
60     if ((t->GetStatus()&AliESDtrack::kITSin )==0)
61       if ((t->GetStatus()&AliESDtrack::kITSout)==0) continue;
62     Int_t ns=AliESDtrack::kSPECIES;
63     Double_t p[10];
64     for (Int_t j=0; j<ns; j++) {
65       Double_t mass=masses[j];
66       Double_t mom=t->GetP();
67       Double_t dedx=t->GetITSsignal()/fMIP;
68       Double_t bethe=Bethe(mom/mass); 
69       Double_t sigma=fRes*bethe;
70       if (TMath::Abs(dedx-bethe) > fRange*sigma) {
71         p[j]=TMath::Exp(-0.5*fRange*fRange);
72         continue;
73       }
74       p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma));
75     }
76     t->SetITSpid(p);
77   }
78   return 0;
79 }