]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSpidESD2.cxx
Default changed: geometry file (.det) is not read by default
[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 //-----------------------------------------------------------------------//
17 // ITS PID class --- method # 2                                          //
18 //                                                                       //
19 //                                                                       //
20 //The PID is based on the likelihood of all the four ITS' layers,        //
21 //without using the truncated mean for the dE/dx. The response           //
22 //functions for each layer are convoluted Landau-Gaussian functions.     // 
23 // Origin: Elena Bruna bruna@to.infn.it, Massimo Masera masera@to.infn.it//
24 //-----------------------------------------------------------------------//
25
26 #include "AliITSpidESD2.h"
27 #include "AliESD.h"
28 #include "AliESDtrack.h"
29 #include "AliITStrackV2.h"
30 #include "AliITSclusterV2.h"
31 #include "AliITStrackerMI.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():AliITSpidESD()
40 { //
41   //  The main constructor
42   fTracker=0;
43   fLoader=0;
44   fSp=0;
45 }
46 //_________________________________________________________________________
47 AliITSpidESD2::AliITSpidESD2(AliITStrackerMI* tracker,AliITSLoader* loader):AliITSpidESD()
48 { //
49   //  The main constructor
50   fTracker=tracker;
51   fLoader=loader;
52   fSp=new AliITSSteerPid();
53   fSp->InitLayer();
54 }
55 //_________________________________________________________________________
56 AliITSpidESD2::~AliITSpidESD2(){
57   //destructor
58
59   if(fSp)delete fSp;
60
61 }
62 //______________________________________________________________________
63 AliITSpidESD2::AliITSpidESD2(const AliITSpidESD2 &ob) :AliITSpidESD(ob) {
64   // Copy constructor
65   // Copies are not allowed. The method is protected to avoid misuse.
66   Error("AliITSpidESD2","Copy constructor not allowed\n");
67 }
68
69 //______________________________________________________________________
70 AliITSpidESD2& AliITSpidESD2::operator=(const AliITSpidESD2& /* ob */){
71   // Assignment operator
72   // Assignment is not allowed. The method is protected to avoid misuse.
73   Error("= operator","Assignment operator not allowed\n");
74   return *this;
75 }
76
77 //_________________________________________________________________________
78 Int_t AliITSpidESD2::MakePID(AliESD *event)
79 {
80
81   //
82   //  This function calculates the "detector response" PID probabilities 
83   //
84   Double_t xr,par[5];
85   AliITStrackV2* track=0;
86   fLoader->LoadRecPoints();
87   TTree *cTree=fLoader->TreeR();
88   fTracker->LoadClusters(cTree);
89
90   Int_t ntrk=event->GetNumberOfTracks();
91   Double_t momits;
92   // for (Int_t i=0; i<ntrk; i++) {
93   for (Int_t i=0; i<ntrk; i++) {
94     AliESDtrack *esdtr=event->GetTrack(i);
95     if ((esdtr->GetStatus()&AliESDtrack::kITSin )==0)
96       if ((esdtr->GetStatus()&AliESDtrack::kITSout)==0) continue;
97
98     track = new AliITStrackV2(*esdtr);
99     Double_t dEdxsignal=track->GetdEdx();
100     track->GetExternalParameters(xr,par);
101     if (par[4]!=0) {
102       Float_t lamb=TMath::ATan(par[3]);
103       momits=1/(TMath::Abs(par[4])*TMath::Cos(lamb));
104     }
105     else {
106       AliWarning("Null particle momentum in ITS");
107       momits = 0.;
108     } 
109     Double_t snp=track->GetSnp();
110     Double_t tgl=track->GetTgl();
111     const Int_t kns=AliPID::kSPECIES;
112     Double_t condprobfun[kns];
113     for(Int_t ii=0;ii<kns;ii++)condprobfun[ii]=0;
114     Int_t cluindsdd1 = track->GetClusterIndex(3);
115     Int_t cluindsdd2 = track->GetClusterIndex(2);
116     Int_t cluindssd1 = track->GetClusterIndex(1);
117     Int_t cluindssd2 = track->GetClusterIndex(0);
118     Float_t q1,q1corr,q2,q2corr,q3,q3corr,q4,q4corr;
119     AliITSclusterV2* clu1=(AliITSclusterV2*)fTracker->GetCluster(cluindsdd1);
120     if(clu1!=0){
121       q1=clu1->GetQ(); 
122       q1corr=q1*TMath::Sqrt((1-snp*snp)/(1+tgl*tgl));
123     }
124     else{
125       q1=-99;
126       q1corr=-99;
127     }
128         
129     AliITSclusterV2* clu2=(AliITSclusterV2*)fTracker->GetCluster(cluindsdd2);
130     if(clu2!=0){
131       q2=clu2->GetQ();
132       q2corr=q2*TMath::Sqrt((1-snp*snp)/(1+tgl*tgl));
133     }
134     else{
135       q2=-99;
136       q2corr=-99;
137     }
138     
139     AliITSclusterV2* clu3=(AliITSclusterV2*)fTracker->GetCluster(cluindssd1);
140     if(clu3!=0){
141       q3=clu3->GetQ();
142       q3corr=q3*TMath::Sqrt((1-snp*snp)/(1+tgl*tgl));
143     }
144     else{
145       q3=-99;
146       q3corr=-99;
147     }
148     
149     AliITSclusterV2* clu4=(AliITSclusterV2*)fTracker->GetCluster(cluindssd2);
150     if(clu4!=0){
151       q4=clu4->GetQ();
152       q4corr=q4*TMath::Sqrt((1-snp*snp)/(1+tgl*tgl));
153     }
154     else{
155       q4=-99;
156       q4corr=-99;
157     }
158     Float_t qlay[4]={q1corr,q2corr,q3corr,q4corr};
159     Float_t prip=0.33;
160     Float_t prik=0.33;
161     Float_t pripi=0.33;
162     Float_t prie=0.;
163     Double_t invPt=track->Get1Pt();
164     AliITSPident mypid(momits,invPt,dEdxsignal,fSp,qlay,prip,prik,pripi,prie); 
165     condprobfun[0]=0.;//el
166     condprobfun[1]=0.;//mu
167     condprobfun[2]=mypid.GetProdCondFunPi();//pi
168     condprobfun[3]=mypid.GetProdCondFunK();//kaon
169     condprobfun[4]=mypid.GetProdCondFunPro();//pro
170
171     esdtr->SetITSpid(condprobfun);
172
173     delete track;
174    }
175   fTracker->UnloadClusters();
176   fLoader->UnloadRecPoints();
177   return 0;
178 }