]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDkink.cxx
Adding new calibration flavours for trigger
[u/mrichter/AliRoot.git] / STEER / AliESDkink.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 #include <TPDGCode.h>
25 #include "AliESDkink.h"
26 #include "AliHelix.h"
27
28
29 ClassImp(AliESDkink)
30
31 //____________________________________________________________________
32 AliESDkink::AliESDkink() :
33   TObject(),
34   fID(0),
35   fParamDaughter(),
36   fParamMother(),
37   fDist1(-1),
38   fDist2(-1),
39   fRr(-1),
40   fShapeFactor(0),
41   fRow0(-1)
42 {
43   //
44   //Dafault constructor
45   //
46   for (Int_t i=0;i<12;i++) fStatus[i]=0;
47   for (Int_t i=0;i<2;i++)
48     for (Int_t j=0;j<2;j++){
49       fTPCdensity[i][j]=-1;
50       fTPCdensity2[i][j]=-1;
51     }
52   fTPCncls[0]=0;
53   fTPCncls[1]=0;
54 }
55
56 void AliESDkink::SetMother(const AliExternalTrackParam & pmother)  {
57   //
58   // set mother
59   //
60   fParamMother   = pmother;
61 }
62
63 void AliESDkink::SetDaughter(const AliExternalTrackParam & pdaughter){
64   //
65   //set daughter
66   //
67   fParamDaughter = pdaughter;
68
69 }
70   
71 void  AliESDkink::Update()
72 {
73   //
74   // updates Kink Info
75   //
76   Float_t distance2=1000;
77   //
78   AliHelix dhelix1(fParamDaughter);
79   AliHelix mhelix(fParamMother);    
80   //
81   //find intersection linear
82   //
83   Double_t phase[2][2],radius[2];
84   Double_t delta1=10000,delta2=10000;  
85   Int_t points=0;
86   /*
87     Float_t distance1=0;
88   Int_t  points = dhelix1.GetRPHIintersections(mhelix, phase, radius,200);
89   
90   if (points>0){
91     dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
92   }
93   if (points==2){    
94     dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
95   }
96   distance1 = TMath::Min(delta1,delta2);
97   */
98   //
99   //find intersection parabolic
100   //
101   points = dhelix1.GetRPHIintersections(mhelix, phase, radius,7);
102
103   delta1=10000,delta2=10000;  
104   Double_t d1=1000.,d2=10000.;
105   if (points>0){
106     dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1,6);
107     //    dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
108     Double_t xd[3],xm[3];
109     dhelix1.Evaluate(phase[0][0],xd);
110     mhelix.Evaluate(phase[0][1],xm);
111     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]);
112   }
113   if (points==2){    
114     dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2,6);
115     //dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
116     Double_t xd[3],xm[3];
117     dhelix1.Evaluate(phase[1][0],xd);
118     mhelix.Evaluate(phase[1][1],xm);
119     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]);
120   }
121   //
122   distance2 = TMath::Min(delta1,delta2);
123   if (delta1<delta2){
124     //get V0 info
125     //    dhelix1.Evaluate(phase[0][0],fXr);
126     Double_t xd[3],xm[3];
127     dhelix1.Evaluate(phase[0][0],xd);
128     mhelix.Evaluate(phase[0][1], xm);
129     fXr[0] = 0.5*(xd[0]+xm[0]);
130     fXr[1] = 0.5*(xd[1]+xm[1]);
131     fXr[2] = 0.5*(xd[2]+xm[2]);
132     //
133     dhelix1.GetMomentum(phase[0][0],fPdr);
134     mhelix.GetMomentum(phase[0][1],fPm);
135     dhelix1.GetAngle(phase[0][0],mhelix,phase[0][1],fAngle);
136     //fRr = TMath::Sqrt(radius[0]);
137     fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
138   }
139   else{
140     //dhelix1.Evaluate(phase[1][0],fXr);
141     Double_t xd[3],xm[3];
142     dhelix1.Evaluate(phase[1][0],xd);
143     mhelix.Evaluate(phase[1][1], xm);
144     fXr[0] = 0.5*(xd[0]+xm[0]);
145     fXr[1] = 0.5*(xd[1]+xm[1]);
146     fXr[2] = 0.5*(xd[2]+xm[2]);
147     //
148     dhelix1.GetMomentum(phase[1][0], fPdr);
149     mhelix.GetMomentum(phase[1][1], fPm);
150     dhelix1.GetAngle(phase[1][0],mhelix,phase[1][1],fAngle);
151     //    fRr = TMath::Sqrt(radius[1]); 
152     fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
153   }
154   fDist1 = TMath::Sqrt(TMath::Min(d1,d2));
155   fDist2 = TMath::Sqrt(distance2);      
156   //            
157   //
158
159 }
160
161  
162 Float_t AliESDkink::GetTPCDensityFactor() const
163 {
164   //
165   //
166   return fTPCdensity[0][0]+fTPCdensity[1][1]-TMath::Max(fTPCdensity[0][1],Float_t(0.0))-TMath::Max(fTPCdensity[1][0],Float_t(0.0)); 
167 }
168
169 Float_t AliESDkink::GetQt() const
170 {
171   Float_t dmomentum = TMath::Sqrt(fPdr[0]*fPdr[0]+fPdr[1]*fPdr[1]+fPdr[2]*fPdr[2]);
172   return TMath::Sin(fAngle[2])*dmomentum;
173 }