Added two missing includes to allow macro compilation (thanks to Laurent for remarkin...
[u/mrichter/AliRoot.git] / ITS / AliITSpidESD2.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 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"
af885e0f 29#include "AliESDEvent.h"
e62c1aea 30#include "AliESDtrack.h"
31#include "AliITStrackV2.h"
e62c1aea 32#include "AliITSLoader.h"
33#include "AliITSPident.h"
34#include "AliITSSteerPid.h"
35#include "AliLog.h"
36
37ClassImp(AliITSpidESD2)
38//_________________________________________________________________________
1919a678 39AliITSpidESD2::AliITSpidESD2():
40 AliITSpidESD(),
41 fSp(0)
42{
e62c1aea 43 // The main constructor
e62c1aea 44 fSp=new AliITSSteerPid();
45 fSp->InitLayer();
46}
1919a678 47
48
e62c1aea 49//_________________________________________________________________________
50AliITSpidESD2::~AliITSpidESD2(){
51 //destructor
52
53 if(fSp)delete fSp;
e62c1aea 54}
1919a678 55
56
e62c1aea 57//______________________________________________________________________
94631b2f 58AliITSpidESD2::AliITSpidESD2(const AliITSpidESD2 &ob) :AliITSpidESD(ob),
94631b2f 59fSp(ob.fSp)
60{
e62c1aea 61 // Copy constructor
e62c1aea 62}
63
1919a678 64
e62c1aea 65//______________________________________________________________________
94631b2f 66AliITSpidESD2& AliITSpidESD2::operator=(const AliITSpidESD2& ob ){
e62c1aea 67 // Assignment operator
94631b2f 68 this->~AliITSpidESD2();
69 new(this) AliITSpidESD2(ob);
e62c1aea 70 return *this;
71}
72
1919a678 73
74//______________________________________________________________________
75void 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
e62c1aea 108
1919a678 109
110//_________________________________________________________________________
111Int_t AliITSpidESD2::MakePID(AliESDEvent *event){
e62c1aea 112 // This function calculates the "detector response" PID probabilities
1919a678 113
e62c1aea 114 Int_t ntrk=event->GetNumberOfTracks();
1919a678 115 const Int_t kns=AliPID::kSPECIES;
116 Double_t condprobfun[kns];
117
e62c1aea 118 for (Int_t i=0; i<ntrk; i++) {
119 AliESDtrack *esdtr=event->GetTrack(i);
1919a678 120 if ((esdtr->GetStatus()&AliESDtrack::kITSin )==0){
e62c1aea 121 if ((esdtr->GetStatus()&AliESDtrack::kITSout)==0) continue;
e62c1aea 122 }
1919a678 123 GetITSpidSingleTrack(esdtr,condprobfun);
e62c1aea 124 esdtr->SetITSpid(condprobfun);
1fad94b4 125 }
e62c1aea 126 return 0;
127}