]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSSteerPid.cxx
Label for the ITS tracklets (Jan Fiete)
[u/mrichter/AliRoot.git] / ITS / AliITSSteerPid.cxx
CommitLineData
090026bf 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
e62c1aea 18/////////////////////////////////////////////////////////////////////////
19//Steering Class for PID in the ITS //
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
7ca4655f 26#include <TClonesArray.h>
090026bf 27#include <TMath.h>
28
e62c1aea 29#include "AliITSSteerPid.h"
30
31ClassImp(AliITSSteerPid)
32
33 //______________________________________________________________
94631b2f 34AliITSSteerPid::AliITSSteerPid():
35fClonarr2(0),
36fVect2(0),
37fVect2lay1(0),
38fVect2lay2(0),
39fVect2lay3(0),
40fVect2lay4(0),
41fFitTree(0),
42fItem(0),
43fPCenter(0),
44fPWidth(0)
45{
e62c1aea 46 // default constructor
94631b2f 47 }
e62c1aea 48//______________________________________________________________
49AliITSSteerPid::~AliITSSteerPid(){
50 // destructor
51 delete fClonarr2;
52 delete fFitTree;
53}
54
55//______________________________________________________________________
94631b2f 56AliITSSteerPid::AliITSSteerPid(const AliITSSteerPid &ob) :TObject(ob),
57fClonarr2(ob.fClonarr2),
58fVect2(ob.fVect2),
59fVect2lay1(ob.fVect2lay1),
60fVect2lay2(ob.fVect2lay2),
61fVect2lay3(ob.fVect2lay3),
62fVect2lay4(ob.fVect2lay4),
63fFitTree(ob.fFitTree),
64fItem(ob.fItem),
65fPCenter(ob.fPCenter),
66fPWidth(ob.fPWidth) {
e62c1aea 67 // Copy constructor
e62c1aea 68}
69
70//______________________________________________________________________
94631b2f 71AliITSSteerPid& AliITSSteerPid::operator=(const AliITSSteerPid& ob){
e62c1aea 72 // Assignment operator
94631b2f 73 this->~AliITSSteerPid();
74 new(this) AliITSSteerPid(ob);
e62c1aea 75 return *this;
76}
77
78//______________________________________________________________
79void AliITSSteerPid::InitLayer(TString fileITS,TString fileFitPar){
80 // it opens the files useful for the PID
e62c1aea 81 TFile *fClonarr2=new TFile (fileITS,"r");
82 fVect2=(TClonesArray*)fClonarr2->Get("vectfitits_0");//truncated mean
83 fVect2lay1=(TClonesArray*)fClonarr2->Get("vectfitits_1");//lay 1
84 fVect2lay2=(TClonesArray*)fClonarr2->Get("vectfitits_2");//lay 2
85 fVect2lay3=(TClonesArray*)fClonarr2->Get("vectfitits_3");//lay 3
86 fVect2lay4=(TClonesArray*)fClonarr2->Get("vectfitits_4");//lay 4
87
88 TFile *fFitPar=new TFile (fileFitPar);
89 fFitTree=(TTree*)fFitPar->Get("tree");
90
e62c1aea 91}
92
93//______________________________________________________________
94AliITSPidParItem* AliITSSteerPid::GetItemLayer(Int_t nolay,Float_t mom){
95 // it gives an AliITSPidParItem object for a given momentum and ITS layer
96 if(nolay==1) return Item(fVect2lay1,mom);
97 if(nolay==2) return Item(fVect2lay2,mom);
98 if(nolay==3) return Item(fVect2lay3,mom);
99 if(nolay==4) return Item(fVect2lay4,mom);
100 if(nolay!=1&&nolay!=2&&nolay!=3&&nolay!=4) {
101 fItem=new AliITSPidParItem();
102 return fItem;
103
104 }
105 return 0;
106}
107
108//______________________________________________________________
109void AliITSSteerPid::GetParFitLayer(Int_t nolay,Float_t mom,Double_t *parp,Double_t *park,Double_t *parpi){
149c4c59 110 //it gives the parameters of the convoluted functions (WL, MP, WG) for
111 //protons, kaons and pions for a given momentum and ITS layer
e62c1aea 112
113 Double_t parfit0pro[3]={0,0,0};
114 Double_t parfit1pro[3]={0,0,0};
115 Double_t parfit3pro[3]={0,0,0};
116 Double_t parfit0kao[3]={0,0,0};
117 Double_t parfit1kao[3]={0,0,0};
118 Double_t parfit3kao[3]={0,0,0};
119 Double_t parfit0pi[3]={0,0,0};
120 Double_t parfit1pi[3]={0,0,0};
121 Double_t parfit3pi[3]={0,0,0};
122
123 fFitTree->SetBranchAddress("par0pro",parfit0pro);
124 fFitTree->SetBranchAddress("par1pro",parfit1pro);
125 fFitTree->SetBranchAddress("par3pro",parfit3pro);
126
127 fFitTree->SetBranchAddress("par0kao",parfit0kao);
128 fFitTree->SetBranchAddress("par1kao",parfit1kao);
129 fFitTree->SetBranchAddress("par3kao",parfit3kao);
130
131 fFitTree->SetBranchAddress("par0pi",parfit0pi);
132 fFitTree->SetBranchAddress("par1pi",parfit1pi);
133 fFitTree->SetBranchAddress("par3pi",parfit3pi);
134 fFitTree->GetEvent(nolay);
135
136 GetLangausProPars(mom,parfit0pro,parfit1pro,parfit3pro,parp);
137 GetLangausKaoPars(mom,parfit0kao,parfit1kao,parfit3kao,park);
138 GetLangausPiPars(mom,parfit0pi,parfit1pi,parfit3pi,parpi);
139
140
141}//______________________________________________________________
142void AliITSSteerPid::GetLangausProPars(Float_t mom,Double_t *parfit0,Double_t *parfit1,Double_t *parfit3,Double_t *par){
143
149c4c59 144 //It finds the parameters of the convoluted Landau-Gaussian response
145 //function for protons (Width Landau, Most Probable, Width Gaussian)
e62c1aea 146 par[0]=parfit0[0]+parfit0[1]/mom;
147 par[1]=parfit1[0]/(mom*mom)+parfit1[1]/(mom*mom)*TMath::Log(mom*mom)+parfit1[2];
148 par[2]=parfit3[0]/(mom*mom)+parfit3[1]/(mom*mom)*TMath::Log(mom*mom)+parfit3[2];
149}
150//______________________________________________________________
151void AliITSSteerPid::GetLangausKaoPars(Float_t mom,Double_t *parfit0,Double_t *parfit1,Double_t *parfit3,Double_t *par){
149c4c59 152 // It finds the parameters of the convoluted Landau-Gaussian response
153 //function for kaons (Width Landau, Most Probable, Width Gaussian)
e62c1aea 154
155 par[0]=parfit0[0]+parfit0[1]/(mom*mom);
156 par[1]=parfit1[0]/(mom*mom)+parfit1[1]/(mom*mom)*TMath::Log(mom*mom)+parfit1[2];
157 par[2]=parfit3[0]/(mom*mom)+parfit3[1]/(mom*mom)*TMath::Log(mom*mom)+parfit3[2];
158}
159
160//______________________________________________________________
161void AliITSSteerPid::GetLangausPiPars(Float_t mom,Double_t *parfit0,Double_t *parfit1,Double_t *parfit3,Double_t *par){
149c4c59 162 //It finds the parameters of the convoluted Landau-Gaussian response
163 //function for pions (Width Landau, Most Probable, Width Gaussian)
e62c1aea 164
165 par[0]=parfit0[0]/(mom*mom)+parfit0[1]/(mom*mom)*TMath::Log(mom*mom)+parfit0[2];
166 par[1]=parfit1[0]/(mom)+parfit1[1]/(mom)*TMath::Log(mom*mom)+parfit1[2];
167 par[2]=parfit3[0]/(mom*mom)+parfit3[1]/(mom*mom)*TMath::Log(mom*mom)+parfit3[2];
168}
169
170
171
172//______________________________________________________________
173AliITSPidParItem* AliITSSteerPid::Item(TClonesArray *Vect,Float_t mom){
174
175 //it gives an AliITSPidParItem object taken from the TClonesArray.
176 Int_t mybin=-1;
177
178 AliITSPidParItem* punt;
179
180 for (Int_t a=0;a<50;a++){
181 punt=(AliITSPidParItem*)Vect->At(a);
182 Float_t centerp=punt->GetMomentumCenter();
183 Float_t widthp=punt->GetWidthMom();
184 if (mom>(centerp-widthp/2) && mom<=(centerp+widthp/2)) mybin=a;
185 }
186 if (mybin!=-1) fItem=(AliITSPidParItem*)Vect->At(mybin);
187 else {
188 fPCenter=0;
189 fPWidth=0;
190 for (Int_t ii=0;ii<52;ii++) fBuff[ii]=0;
191 fItem = new AliITSPidParItem(fPCenter,fPWidth,fBuff);
192 }
193
194 return fItem;
195
196
197
198}