]>
Commit | Line | Data |
---|---|---|
2f399afc | 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 | ||
17 | #include "AliHLTVertexer.h" | |
18 | #include "AliTracker.h" | |
19 | #include "TMath.h" | |
20 | #include "AliESDtrack.h" | |
21 | #include "AliESDv0.h" | |
22 | #include "AliESDVertex.h" | |
23 | #include "AliESDEvent.h" | |
24 | #include "AliKFParticle.h" | |
25 | #include "AliKFVertex.h" | |
26 | ||
6edb0fb5 | 27 | ClassImp(AliHLTVertexer) |
2f399afc | 28 | |
29 | AliHLTVertexer::AliHLTVertexer(): | |
30 | fESD(0), | |
31 | fTrackInfos(0) | |
32 | { | |
33 | } | |
34 | ||
35 | AliHLTVertexer::AliHLTVertexer(const AliHLTVertexer & ): | |
36 | fESD(0), | |
37 | fTrackInfos(0) | |
38 | { | |
39 | } | |
40 | ||
41 | void AliHLTVertexer::SetESD( AliESDEvent *event ) | |
42 | { | |
43 | //* Fill fTrackInfo array | |
44 | ||
45 | delete[] fTrackInfos; | |
46 | fESD = event; | |
47 | ||
48 | AliKFParticle::SetField( fESD->GetMagneticField() ); | |
49 | ||
50 | Int_t nESDTracks=event->GetNumberOfTracks(); | |
51 | fTrackInfos = new AliESDTrackInfo[ nESDTracks ]; | |
52 | ||
53 | for (Int_t iTr=0; iTr<nESDTracks; iTr++){ | |
54 | ||
55 | AliESDTrackInfo &info = fTrackInfos[iTr]; | |
56 | info.fOK = 0; | |
57 | info.fPrimUsedFlag = 0; | |
58 | ||
59 | //* track quality check | |
60 | ||
61 | AliESDtrack *pTrack = event->GetTrack(iTr); | |
62 | if( !pTrack ) continue; | |
63 | if (pTrack->GetKinkIndex(0)>0) continue; | |
64 | if ( !( pTrack->GetStatus()&AliESDtrack::kTPCin ) ) continue; | |
65 | ||
66 | //* Construct KFParticle for the track | |
67 | ||
68 | info.fParticle = AliKFParticle( *pTrack, 211 ); | |
69 | info.fOK = 1; | |
70 | } | |
71 | } | |
72 | ||
73 | ||
74 | void AliHLTVertexer::FindPrimaryVertex( ) | |
75 | { | |
76 | //* Find event primary vertex | |
77 | ||
78 | int nTracks = fESD->GetNumberOfTracks(); | |
79 | ||
80 | const AliKFParticle **vSelected = new const AliKFParticle*[nTracks]; //* Selected particles for vertex fit | |
81 | Int_t *vIndex = new int [nTracks]; //* Indices of selected particles | |
82 | Bool_t *vFlag = new bool [nTracks]; //* Flags returned by the vertex finder | |
83 | ||
84 | Int_t nSelected = 0; | |
85 | for( Int_t i = 0; i<nTracks; i++){ | |
86 | if(fTrackInfos[i].fOK ){ | |
87 | vSelected[nSelected] = &(fTrackInfos[i].fParticle); | |
88 | vIndex[nSelected] = i; | |
89 | nSelected++; | |
90 | } | |
91 | } | |
92 | ||
93 | AliKFVertex primVtx; | |
94 | primVtx.SetBeamConstraint(fESD->GetDiamondX(),fESD->GetDiamondY(),0, | |
95 | TMath::Sqrt(fESD->GetSigma2DiamondX()),TMath::Sqrt(fESD->GetSigma2DiamondY()),5.3); | |
96 | ||
97 | primVtx.ConstructPrimaryVertex( vSelected, nSelected, vFlag, 3. ); | |
98 | for( Int_t i = 0; i<nSelected; i++){ | |
99 | if( vFlag[i] ) fTrackInfos[vIndex[i]].fPrimUsedFlag = 1; | |
100 | } | |
101 | ||
102 | ||
103 | AliESDVertex vESD( primVtx.Parameters(), primVtx.CovarianceMatrix(), primVtx.GetChi2(), primVtx.GetNContributors() ); | |
104 | fESD->SetPrimaryVertexTracks( &vESD ); | |
105 | ||
106 | delete[] vSelected; | |
107 | delete[] vIndex; | |
108 | delete[] vFlag; | |
109 | } | |
110 | ||
111 | ||
112 | void AliHLTVertexer::FindV0s( ) | |
113 | { | |
114 | //* V0 finder | |
115 | ||
116 | int nTracks = fESD->GetNumberOfTracks(); | |
117 | AliKFVertex primVtx( *fESD->GetPrimaryVertexTracks() ); | |
118 | ||
119 | for( Int_t iTr = 0; iTr<nTracks; iTr++ ){ //* first daughter | |
120 | ||
121 | AliESDTrackInfo &info = fTrackInfos[iTr]; | |
122 | if( !info.fOK ) continue; | |
123 | ||
124 | for( Int_t jTr = iTr+1; jTr<nTracks; jTr++ ){ //* second daughter | |
125 | AliESDTrackInfo &jnfo = fTrackInfos[jTr]; | |
126 | if( !jnfo.fOK ) continue; | |
127 | ||
128 | //* check for different charge | |
129 | ||
130 | if( info.fParticle.GetQ() == jnfo.fParticle.GetQ() ) continue; | |
131 | ||
132 | //* construct V0 mother | |
133 | ||
134 | AliKFParticle V0( info.fParticle, jnfo.fParticle ); | |
135 | ||
136 | //* check V0 Chi^2 | |
137 | ||
138 | if( V0.GetNDF()<1 ) continue; | |
139 | if( TMath::Sqrt(TMath::Abs(V0.GetChi2()/V0.GetNDF())) >3. ) continue; | |
140 | ||
141 | //* subtruct daughters from primary vertex | |
142 | ||
143 | AliKFVertex primVtxCopy = primVtx; | |
144 | ||
145 | if( info.fPrimUsedFlag ) primVtxCopy -= info.fParticle; | |
146 | if( jnfo.fPrimUsedFlag ) primVtxCopy -= jnfo.fParticle; | |
147 | ||
148 | //* Check V0 Chi^2 deviation from primary vertex | |
149 | ||
150 | if( V0.GetDeviationFromVertex( primVtxCopy ) >3. ) continue; | |
151 | ||
152 | //* Add V0 to primary vertex to improve the primary vertex resolution | |
153 | ||
154 | primVtxCopy += V0; | |
155 | ||
156 | //* Set production vertex for V0 | |
157 | ||
158 | V0.SetProductionVertex( primVtxCopy ); | |
159 | ||
160 | //* Check chi^2 for a case | |
161 | ||
162 | if( TMath::Sqrt( TMath::Abs(V0.GetChi2()/V0.GetNDF()) >3. )) continue; | |
163 | ||
164 | //* Get V0 decay length with estimated error | |
165 | ||
166 | Double_t length, sigmaLength; | |
167 | if( V0.GetDecayLength( length, sigmaLength ) ) continue; | |
168 | ||
169 | //* Reject V0 if it decays too close to the primary vertex | |
170 | ||
171 | if( length <3.*sigmaLength ) continue; | |
172 | ||
173 | //* Get V0 invariant mass | |
174 | ||
175 | // Double_t mass, sigmaMass; | |
176 | //if( V0.GetMass( mass, sigmaMass ) ) continue; | |
177 | ||
178 | //* add ESD v0 | |
179 | ||
180 | AliESDv0 v0ESD( *fESD->GetTrack( iTr ), iTr, *fESD->GetTrack( jTr ), jTr ); | |
181 | ||
182 | fESD->AddV0( &v0ESD ); | |
183 | } | |
184 | } | |
185 | } | |
186 |