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" |
60b9526b |
32 | #include "AliITSRecPoint.h" |
e62c1aea |
33 | #include "AliITStrackerMI.h" |
34 | #include "AliITSLoader.h" |
35 | #include "AliITSPident.h" |
36 | #include "AliITSSteerPid.h" |
37 | #include "AliLog.h" |
38 | |
39 | ClassImp(AliITSpidESD2) |
40 | //_________________________________________________________________________ |
94631b2f |
41 | AliITSpidESD2::AliITSpidESD2():AliITSpidESD(), |
42 | fTracker(0), |
94631b2f |
43 | fSp(0) |
e62c1aea |
44 | { // |
45 | // The main constructor |
e62c1aea |
46 | } |
47 | //_________________________________________________________________________ |
d76c31f4 |
48 | AliITSpidESD2::AliITSpidESD2(AliITStrackerMI* tracker):AliITSpidESD(), |
49 | fTracker(tracker), |
94631b2f |
50 | fSp(0) |
e62c1aea |
51 | { // |
52 | // The main constructor |
e62c1aea |
53 | fSp=new AliITSSteerPid(); |
54 | fSp->InitLayer(); |
55 | } |
56 | //_________________________________________________________________________ |
57 | AliITSpidESD2::~AliITSpidESD2(){ |
58 | //destructor |
59 | |
60 | if(fSp)delete fSp; |
61 | |
62 | } |
63 | //______________________________________________________________________ |
94631b2f |
64 | AliITSpidESD2::AliITSpidESD2(const AliITSpidESD2 &ob) :AliITSpidESD(ob), |
65 | fTracker(ob.fTracker), |
94631b2f |
66 | fSp(ob.fSp) |
67 | { |
e62c1aea |
68 | // Copy constructor |
94631b2f |
69 | |
e62c1aea |
70 | } |
71 | |
72 | //______________________________________________________________________ |
94631b2f |
73 | AliITSpidESD2& AliITSpidESD2::operator=(const AliITSpidESD2& ob ){ |
e62c1aea |
74 | // Assignment operator |
94631b2f |
75 | this->~AliITSpidESD2(); |
76 | new(this) AliITSpidESD2(ob); |
e62c1aea |
77 | return *this; |
78 | } |
79 | |
80 | //_________________________________________________________________________ |
d76c31f4 |
81 | Int_t AliITSpidESD2::MakePID(TTree *clustersTree, AliESDEvent *event) |
e62c1aea |
82 | { |
83 | |
84 | // |
85 | // This function calculates the "detector response" PID probabilities |
86 | // |
87 | Double_t xr,par[5]; |
88 | AliITStrackV2* track=0; |
d76c31f4 |
89 | fTracker->LoadClusters(clustersTree); |
b68da4a2 |
90 | printf("==== Landau Fit PID ITS ====== \n"); |
e62c1aea |
91 | Int_t ntrk=event->GetNumberOfTracks(); |
92 | Double_t momits; |
93 | // for (Int_t i=0; i<ntrk; i++) { |
94 | for (Int_t i=0; i<ntrk; i++) { |
95 | AliESDtrack *esdtr=event->GetTrack(i); |
96 | if ((esdtr->GetStatus()&AliESDtrack::kITSin )==0) |
97 | if ((esdtr->GetStatus()&AliESDtrack::kITSout)==0) continue; |
98 | |
99 | track = new AliITStrackV2(*esdtr); |
100 | Double_t dEdxsignal=track->GetdEdx(); |
101 | track->GetExternalParameters(xr,par); |
102 | if (par[4]!=0) { |
103 | Float_t lamb=TMath::ATan(par[3]); |
104 | momits=1/(TMath::Abs(par[4])*TMath::Cos(lamb)); |
105 | } |
106 | else { |
107 | AliWarning("Null particle momentum in ITS"); |
108 | momits = 0.; |
109 | } |
110 | Double_t snp=track->GetSnp(); |
111 | Double_t tgl=track->GetTgl(); |
112 | const Int_t kns=AliPID::kSPECIES; |
113 | Double_t condprobfun[kns]; |
114 | for(Int_t ii=0;ii<kns;ii++)condprobfun[ii]=0; |
b68da4a2 |
115 | Int_t cluind[12]; |
116 | for(Int_t ii=0;ii<12;ii++){ |
117 | cluind[ii]=track->GetClusterIndex(ii); |
e62c1aea |
118 | } |
b68da4a2 |
119 | AliITSRecPoint* cluarr[12]; |
120 | Float_t qclu[8],qclucorr[8],nlay[8]; |
1fad94b4 |
121 | for(Int_t ii=0;ii<8;ii++){ |
122 | qclu[ii]=0; |
123 | qclucorr[ii]=0; |
124 | nlay[ii]=0; |
e62c1aea |
125 | } |
b68da4a2 |
126 | Int_t jj=0; |
1fad94b4 |
127 | for(Int_t ij=0;ij<12;ij++){ |
128 | cluind[ij]=track->GetClusterIndex(ij); |
1fad94b4 |
129 | if(cluind[ij]>0){ |
130 | cluarr[ij]=(AliITSRecPoint*)fTracker->GetCluster(cluind[ij]); |
131 | Int_t lay=cluarr[ij]->GetLayer(); |
b68da4a2 |
132 | if(lay>1){//sdd+ssd only |
1fad94b4 |
133 | qclu[jj]=cluarr[ij]->GetQ(); |
b68da4a2 |
134 | qclucorr[jj]=qclu[jj]*TMath::Sqrt((1-snp*snp)/(1+tgl*tgl)); |
135 | nlay[jj]=lay; |
136 | jj++; |
137 | } |
138 | else qclucorr[jj]=-1; |
139 | } |
e62c1aea |
140 | } |
b68da4a2 |
141 | |
e62c1aea |
142 | Float_t prip=0.33; |
143 | Float_t prik=0.33; |
144 | Float_t pripi=0.33; |
145 | Float_t prie=0.; |
b68da4a2 |
146 | AliITSPident mypid(momits,dEdxsignal,fSp,qclucorr,nlay,prip,prik,pripi,prie); |
147 | condprobfun[0]=mypid.GetProdCondFunPi();//el --PID in the ITS does not distinguish among Pi,el,mu |
148 | condprobfun[1]=mypid.GetProdCondFunPi();//mu |
149 | condprobfun[2]=mypid.GetProdCondFunPi();//pi |
e62c1aea |
150 | condprobfun[3]=mypid.GetProdCondFunK();//kaon |
151 | condprobfun[4]=mypid.GetProdCondFunPro();//pro |
152 | |
153 | esdtr->SetITSpid(condprobfun); |
154 | |
155 | delete track; |
1fad94b4 |
156 | } |
e62c1aea |
157 | fTracker->UnloadClusters(); |
e62c1aea |
158 | return 0; |
159 | } |