]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDV0MI.cxx
Reset static data member fgReadField in destructor.
[u/mrichter/AliRoot.git] / STEER / AliESDV0MI.cxx
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
18 //-------------------------------------------------------------------------
19 //    Origin: Marian Ivanov marian.ivanov@cern.ch
20 //-------------------------------------------------------------------------
21
22 #include <Riostream.h>
23 #include <TMath.h>
24
25 #include "AliESDV0MI.h"
26 #include "AliHelix.h"
27
28
29 ClassImp(AliESDV0MI)
30
31 AliESDV0MI::AliESDV0MI() :
32   AliESDv0(),
33   fParamP(),
34   fParamM(),
35   fID(0),
36   fDist1(-1),
37   fDist2(-1),
38   fRr(-1),
39   fStatus(0),
40   fRow0(-1),
41   fDistNorm(0),
42   fDistSigma(0),
43   fChi2Before(0),
44   fNBefore(0),
45   fChi2After(0),
46   fNAfter(0),
47   fPointAngleFi(0),
48   fPointAngleTh(0),
49   fPointAngle(0)
50 {
51   //
52   //Dafault constructor
53   //
54   for (Int_t i=0;i<4;i++){fCausality[i]=0;}
55   for (Int_t i=0;i<6;i++){fClusters[0][i]=0; fClusters[1][i]=0;}
56 }
57
58
59 void AliESDV0MI::SetCausality(Float_t pb0, Float_t pb1, Float_t pa0, Float_t pa1)
60 {
61   //
62   // set probabilities
63   //
64   fCausality[0] = pb0;     // probability - track 0 exist before vertex
65   fCausality[1] = pb1;     // probability - track 1 exist before vertex
66   fCausality[2] = pa0;     // probability - track 0 exist close after vertex
67   fCausality[3] = pa1;     // probability - track 1 exist close after vertex
68 }
69 void  AliESDV0MI::SetClusters(Int_t *clp, Int_t *clm)
70 {
71   //
72   // Set its clusters indexes
73   //
74   for (Int_t i=0;i<6;i++) fClusters[0][i] = clp[i]; 
75   for (Int_t i=0;i<6;i++) fClusters[1][i] = clm[i]; 
76 }
77
78
79 void AliESDV0MI::SetP(const AliExternalTrackParam & paramp)  {
80   //
81   // set track +
82   //
83   fParamP   = paramp;
84 }
85
86 void AliESDV0MI::SetM(const AliExternalTrackParam & paramm){
87   //
88   //set track -
89   //
90   fParamM = paramm;
91 }
92   
93 void AliESDV0MI::SetRp(const Double_t *rp){
94   //
95   // set pid +
96   //
97   for (Int_t i=0;i<5;i++) fRP[i]=rp[i];
98 }
99
100 void AliESDV0MI::SetRm(const Double_t *rm){
101   //
102   // set pid -
103   //
104   for (Int_t i=0;i<5;i++) fRM[i]=rm[i];
105 }
106
107
108 void  AliESDV0MI::UpdatePID(Double_t pidp[5], Double_t pidm[5])
109 {
110   //
111   // set PID hypothesy
112   //
113   // norm PID to 1
114   Float_t sump =0;
115   Float_t summ =0;
116   for (Int_t i=0;i<5;i++){
117     fRP[i]=pidp[i];
118     sump+=fRP[i];
119     fRM[i]=pidm[i];
120     summ+=fRM[i];
121   }
122   for (Int_t i=0;i<5;i++){
123     fRP[i]/=sump;
124     fRM[i]/=summ;
125   }
126 }
127
128 Float_t AliESDV0MI::GetProb(UInt_t p1, UInt_t p2){
129   //
130   //
131   //
132   //
133   return TMath::Max(fRP[p1]+fRM[p2], fRP[p2]+fRM[p1]);
134 }
135
136 Float_t AliESDV0MI::GetEffMass(UInt_t p1, UInt_t p2){
137   //
138   // calculate effective mass
139   //
140   const Float_t kpmass[5] = {5.10000000000000037e-04,1.05660000000000004e-01,1.39570000000000000e-01,
141                       4.93599999999999983e-01, 9.38270000000000048e-01};
142   if (p1>4) return -1;
143   if (p2>4) return -1;
144   Float_t mass1 = kpmass[p1]; 
145   Float_t mass2 = kpmass[p2];   
146   Double_t *m1 = fPP;
147   Double_t *m2 = fPM;
148   //
149   //if (fRP[p1]+fRM[p2]<fRP[p2]+fRM[p1]){
150   //  m1 = fPM;
151   //  m2 = fPP;
152   //}
153   //
154   Float_t e1    = TMath::Sqrt(mass1*mass1+
155                               m1[0]*m1[0]+
156                               m1[1]*m1[1]+
157                               m1[2]*m1[2]);
158   Float_t e2    = TMath::Sqrt(mass2*mass2+
159                               m2[0]*m2[0]+
160                               m2[1]*m2[1]+
161                               m2[2]*m2[2]);  
162   Float_t mass =  
163     (m2[0]+m1[0])*(m2[0]+m1[0])+
164     (m2[1]+m1[1])*(m2[1]+m1[1])+
165     (m2[2]+m1[2])*(m2[2]+m1[2]);
166   
167   mass = TMath::Sqrt((e1+e2)*(e1+e2)-mass);
168   return mass;
169 }
170
171 void  AliESDV0MI::Update(Float_t vertex[3])
172 {
173   //
174   // updates Kink Info
175   //
176   //  Float_t distance1,distance2;
177   Float_t distance2;
178   //
179   AliHelix phelix(fParamP);
180   AliHelix mhelix(fParamM);    
181   //
182   //find intersection linear
183   //
184   Double_t phase[2][2],radius[2];
185   Int_t  points = phelix.GetRPHIintersections(mhelix, phase, radius,200);
186   Double_t delta1=10000,delta2=10000;  
187   /*
188   if (points<=0) return;
189   if (points>0){
190     phelix.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
191     phelix.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
192     phelix.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
193   }
194   if (points==2){    
195     phelix.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
196     phelix.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
197     phelix.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
198   }
199   distance1 = TMath::Min(delta1,delta2);
200   */
201   //
202   //find intersection parabolic
203   //
204   points = phelix.GetRPHIintersections(mhelix, phase, radius);
205   delta1=10000,delta2=10000;  
206   Double_t d1=1000.,d2=10000.;
207   if (points<=0) return;
208   if (points>0){
209     phelix.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
210     phelix.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
211     Double_t xd[3],xm[3];
212     phelix.Evaluate(phase[0][0],xd);
213     mhelix.Evaluate(phase[0][1],xm);
214     d1 = (xd[0]-xm[0])*(xd[0]-xm[0])+(xd[1]-xm[1])*(xd[1]-xm[1])+(xd[2]-xm[2])*(xd[2]-xm[2]);
215   }
216   if (points==2){    
217     phelix.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
218     phelix.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
219     Double_t xd[3],xm[3];
220     phelix.Evaluate(phase[1][0],xd);
221     mhelix.Evaluate(phase[1][1],xm);
222     d2 = (xd[0]-xm[0])*(xd[0]-xm[0])+(xd[1]-xm[1])*(xd[1]-xm[1])+(xd[2]-xm[2])*(xd[2]-xm[2]);
223   }
224   //
225   distance2 = TMath::Min(delta1,delta2);
226   if (delta1<delta2){
227     //get V0 info
228     Double_t xd[3],xm[3];
229     phelix.Evaluate(phase[0][0],xd);
230     mhelix.Evaluate(phase[0][1], xm);
231     fXr[0] = 0.5*(xd[0]+xm[0]);
232     fXr[1] = 0.5*(xd[1]+xm[1]);
233     fXr[2] = 0.5*(xd[2]+xm[2]);
234     //
235     phelix.GetMomentum(phase[0][0],fPP);
236     mhelix.GetMomentum(phase[0][1],fPM);
237     phelix.GetAngle(phase[0][0],mhelix,phase[0][1],fAngle);
238     fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
239   }
240   else{
241     Double_t xd[3],xm[3];
242     phelix.Evaluate(phase[1][0],xd);
243     mhelix.Evaluate(phase[1][1], xm);
244     fXr[0] = 0.5*(xd[0]+xm[0]);
245     fXr[1] = 0.5*(xd[1]+xm[1]);
246     fXr[2] = 0.5*(xd[2]+xm[2]);
247     //
248     phelix.GetMomentum(phase[1][0], fPP);
249     mhelix.GetMomentum(phase[1][1], fPM);
250     phelix.GetAngle(phase[1][0],mhelix,phase[1][1],fAngle);
251     fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
252   }
253   fDist1 = TMath::Sqrt(TMath::Min(d1,d2));
254   fDist2 = TMath::Sqrt(distance2);      
255   //            
256   //
257   Double_t v[3] = {fXr[0]-vertex[0],fXr[1]-vertex[1],fXr[2]-vertex[2]};
258   Double_t p[3] = {fPP[0]+fPM[0], fPP[1]+fPM[1],fPP[2]+fPM[2]};
259   Double_t vnorm2 = v[0]*v[0]+v[1]*v[1];
260   Double_t vnorm3 = TMath::Sqrt(v[2]*v[2]+vnorm2);
261   vnorm2 = TMath::Sqrt(vnorm2);
262   Double_t pnorm2 = p[0]*p[0]+p[1]*p[1];
263   Double_t pnorm3 = TMath::Sqrt(p[2]*p[2]+pnorm2);
264   pnorm2 = TMath::Sqrt(pnorm2);  
265   fPointAngleFi = (v[0]*p[0]+v[1]*p[1])/(vnorm2*pnorm2);
266   fPointAngleTh = (v[2]*p[2]+vnorm2*pnorm2)/(vnorm3*pnorm3);  
267   fPointAngle   = (v[0]*p[0]+v[1]*p[1]+v[2]*p[2])/(vnorm3*pnorm3);
268   //
269 }
270