]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSpidESD2.cxx
No optimization with gcc 4.3.0
[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 "AliITSRecPoint.h"
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 //_________________________________________________________________________
41   AliITSpidESD2::AliITSpidESD2():AliITSpidESD(),
42 fTracker(0),
43 fSp(0)
44 { //
45   //  The main constructor
46 }
47 //_________________________________________________________________________
48 AliITSpidESD2::AliITSpidESD2(AliITStrackerMI* tracker):AliITSpidESD(),
49 fTracker(tracker),
50 fSp(0)
51 { //
52   //  The main constructor
53   fSp=new AliITSSteerPid();
54   fSp->InitLayer();
55 }
56 //_________________________________________________________________________
57 AliITSpidESD2::~AliITSpidESD2(){
58   //destructor
59
60   if(fSp)delete fSp;
61
62 }
63 //______________________________________________________________________
64 AliITSpidESD2::AliITSpidESD2(const AliITSpidESD2 &ob) :AliITSpidESD(ob),
65 fTracker(ob.fTracker),
66 fSp(ob.fSp) 
67 {
68   // Copy constructor
69  
70 }
71
72 //______________________________________________________________________
73 AliITSpidESD2& AliITSpidESD2::operator=(const AliITSpidESD2& ob ){
74   // Assignment operator
75   this->~AliITSpidESD2();
76   new(this) AliITSpidESD2(ob);
77   return *this;
78 }
79
80 //_________________________________________________________________________
81 Int_t AliITSpidESD2::MakePID(TTree *clustersTree, AliESDEvent *event)
82 {
83
84   //
85   //  This function calculates the "detector response" PID probabilities 
86   //
87   Double_t xr,par[5];
88   AliITStrackV2* track=0;
89   fTracker->LoadClusters(clustersTree);
90   printf("==== Landau Fit PID ITS ====== \n");
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;
115     Int_t cluind[12];
116     for(Int_t ii=0;ii<12;ii++){
117       cluind[ii]=track->GetClusterIndex(ii);
118     }
119     AliITSRecPoint* cluarr[12];
120     Float_t qclu[8],qclucorr[8],nlay[8];
121     for(Int_t ii=0;ii<8;ii++){
122       qclu[ii]=0;
123       qclucorr[ii]=0;
124       nlay[ii]=0;
125     }
126     Int_t jj=0;
127     for(Int_t ij=0;ij<12;ij++){
128       cluind[ij]=track->GetClusterIndex(ij);
129       if(cluind[ij]>0){
130         cluarr[ij]=(AliITSRecPoint*)fTracker->GetCluster(cluind[ij]);
131         Int_t lay=cluarr[ij]->GetLayer();
132         if(lay>1){//sdd+ssd only
133           qclu[jj]=cluarr[ij]->GetQ(); 
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       }
140     }
141
142     Float_t prip=0.33;
143     Float_t prik=0.33;
144     Float_t pripi=0.33;
145     Float_t prie=0.;
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
150     condprobfun[3]=mypid.GetProdCondFunK();//kaon
151     condprobfun[4]=mypid.GetProdCondFunPro();//pro
152
153     esdtr->SetITSpid(condprobfun);
154
155     delete track;
156   }
157   fTracker->UnloadClusters();
158   return 0;
159 }