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