]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSpidESD2.cxx
small correction for error calculation
[u/mrichter/AliRoot.git] / ITS / AliITSpidESD2.cxx
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
16 /* $Id$ */
17
18 //-----------------------------------------------------------------------//
19 // ITS PID class --- method # 2                                          //
20 //                                                                       //
21 //                                                                       //
22 //The PID is based on the likelihood of all the four ITS' layers,        //
23 //without using the truncated mean for the dE/dx. The response           //
24 //functions for each layer are convoluted Landau-Gaussian functions.     // 
25 // Origin: Elena Bruna bruna@to.infn.it, Massimo Masera masera@to.infn.it//
26 //-----------------------------------------------------------------------//
27
28 #include "AliITSpidESD2.h"
29 #include "AliESDEvent.h"
30 #include "AliESDtrack.h"
31 #include "AliITStrackV2.h"
32 #include "AliITSLoader.h"
33 #include "AliITSPident.h"
34 #include "AliITSSteerPid.h"
35 #include "AliLog.h"
36
37 ClassImp(AliITSpidESD2)
38 //_________________________________________________________________________
39 AliITSpidESD2::AliITSpidESD2():
40   AliITSpidESD(),
41   fSp(0)
42
43   //  The main constructor
44   fSp=new AliITSSteerPid();
45   fSp->InitLayer();
46 }
47
48
49 //_________________________________________________________________________
50 AliITSpidESD2::~AliITSpidESD2(){
51   //destructor
52
53   if(fSp)delete fSp;
54 }
55
56
57 //______________________________________________________________________
58 AliITSpidESD2::AliITSpidESD2(const AliITSpidESD2 &ob) :AliITSpidESD(ob),
59 fSp(ob.fSp) 
60 {
61   // Copy constructor
62 }
63
64
65 //______________________________________________________________________
66 AliITSpidESD2& AliITSpidESD2::operator=(const AliITSpidESD2& ob ){
67   // Assignment operator
68   this->~AliITSpidESD2();
69   new(this) AliITSpidESD2(ob);
70   return *this;
71 }
72
73     
74 //______________________________________________________________________
75 void AliITSpidESD2::GetITSpidSingleTrack(AliESDtrack* esdtr, Double_t condprobfun[]){
76   // Method to calculate PID probabilities for a single track
77   
78   Double_t dEdxsignal=esdtr->GetITSsignal();
79   Double_t momits=esdtr->GetP();
80   Double_t qclu[4];
81   esdtr->GetITSdEdxSamples(qclu);
82
83   Float_t qclucorr[8],nlay[8];
84   for(Int_t jj=0;jj<8;jj++){
85     if(jj<4 && qclu[jj]>0){
86       qclucorr[jj]=qclu[jj]; 
87       nlay[jj]=jj+2; // layers numbered from 0 to 5
88     }
89     else{ 
90       qclucorr[jj]=-1;
91       nlay[jj]=0;
92     }
93   }
94   
95   Float_t prip=0.33;
96   Float_t prik=0.33;
97   Float_t pripi=0.33;
98   Float_t prie=0.;
99   AliITSPident mypid(momits,dEdxsignal,fSp,qclucorr,nlay,prip,prik,pripi,prie);
100   condprobfun[0]=mypid.GetProdCondFunPi();//el --PID in the ITS does not distinguish among Pi,el,mu
101   condprobfun[1]=mypid.GetProdCondFunPi();//mu
102   condprobfun[2]=mypid.GetProdCondFunPi();//pi
103   condprobfun[3]=mypid.GetProdCondFunK();//kaon
104   condprobfun[4]=mypid.GetProdCondFunPro();//pro
105   return;
106 }
107
108
109
110 //_________________________________________________________________________
111 Int_t AliITSpidESD2::MakePID(AliESDEvent *event){
112   //  This function calculates the "detector response" PID probabilities 
113
114   Int_t ntrk=event->GetNumberOfTracks();
115   const Int_t kns=AliPID::kSPECIES;
116   Double_t condprobfun[kns];
117     
118   for (Int_t i=0; i<ntrk; i++) {
119     AliESDtrack *esdtr=event->GetTrack(i);
120     if ((esdtr->GetStatus()&AliESDtrack::kITSin )==0){
121       if ((esdtr->GetStatus()&AliESDtrack::kITSout)==0) continue;
122     }
123     GetITSpidSingleTrack(esdtr,condprobfun);
124     esdtr->SetITSpid(condprobfun);
125   }
126   return 0;
127 }