]>
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), | |
9334b5cb | 31 | fTrackInfos(0), |
32 | fPrimaryVtx() | |
2f399afc | 33 | { |
34 | } | |
35 | ||
36 | AliHLTVertexer::AliHLTVertexer(const AliHLTVertexer & ): | |
37 | fESD(0), | |
9334b5cb | 38 | fTrackInfos(0), |
39 | fPrimaryVtx() | |
2f399afc | 40 | { |
41 | } | |
42 | ||
43 | void AliHLTVertexer::SetESD( AliESDEvent *event ) | |
44 | { | |
45 | //* Fill fTrackInfo array | |
46 | ||
47 | delete[] fTrackInfos; | |
48 | fESD = event; | |
36d0f159 | 49 | |
d7e5ba24 | 50 | AliKFParticle::SetField( fESD->GetMagneticField() ); |
2f399afc | 51 | |
52 | Int_t nESDTracks=event->GetNumberOfTracks(); | |
53 | fTrackInfos = new AliESDTrackInfo[ nESDTracks ]; | |
54 | ||
55 | for (Int_t iTr=0; iTr<nESDTracks; iTr++){ | |
56 | ||
57 | AliESDTrackInfo &info = fTrackInfos[iTr]; | |
58 | info.fOK = 0; | |
59 | info.fPrimUsedFlag = 0; | |
60 | ||
61 | //* track quality check | |
62 | ||
63 | AliESDtrack *pTrack = event->GetTrack(iTr); | |
64 | if( !pTrack ) continue; | |
65 | if (pTrack->GetKinkIndex(0)>0) continue; | |
66 | if ( !( pTrack->GetStatus()&AliESDtrack::kTPCin ) ) continue; | |
67 | ||
68 | //* Construct KFParticle for the track | |
69 | ||
9334b5cb | 70 | info.fParticle = AliKFParticle( *pTrack->GetInnerParam(), 211 ); |
71 | info.fOK = 1; | |
2f399afc | 72 | } |
73 | } | |
74 | ||
75 | ||
76 | void AliHLTVertexer::FindPrimaryVertex( ) | |
77 | { | |
78 | //* Find event primary vertex | |
79 | ||
80 | int nTracks = fESD->GetNumberOfTracks(); | |
81 | ||
82 | const AliKFParticle **vSelected = new const AliKFParticle*[nTracks]; //* Selected particles for vertex fit | |
83 | Int_t *vIndex = new int [nTracks]; //* Indices of selected particles | |
84 | Bool_t *vFlag = new bool [nTracks]; //* Flags returned by the vertex finder | |
9334b5cb | 85 | |
86 | fPrimaryVtx.Initialize(); | |
87 | fPrimaryVtx.SetBeamConstraint(fESD->GetDiamondX(),fESD->GetDiamondY(),0, | |
88 | TMath::Sqrt(fESD->GetSigma2DiamondX()),TMath::Sqrt(fESD->GetSigma2DiamondY()),5.3); | |
2f399afc | 89 | |
90 | Int_t nSelected = 0; | |
91 | for( Int_t i = 0; i<nTracks; i++){ | |
9334b5cb | 92 | if(!fTrackInfos[i].fOK ) continue; |
d7e5ba24 | 93 | if( fESD->GetTrack(i)->GetTPCNcls()<60 ) continue; |
9334b5cb | 94 | const AliKFParticle &p = fTrackInfos[i].fParticle; |
95 | Double_t chi = p.GetDeviationFromVertex( fPrimaryVtx ); | |
96 | if( chi > 3.5 ) continue; | |
97 | vSelected[nSelected] = &(fTrackInfos[i].fParticle); | |
98 | vIndex[nSelected] = i; | |
99 | nSelected++; | |
2f399afc | 100 | } |
9334b5cb | 101 | fPrimaryVtx.ConstructPrimaryVertex( vSelected, nSelected, vFlag, 3. ); |
2f399afc | 102 | for( Int_t i = 0; i<nSelected; i++){ |
103 | if( vFlag[i] ) fTrackInfos[vIndex[i]].fPrimUsedFlag = 1; | |
104 | } | |
105 | ||
9334b5cb | 106 | if( fPrimaryVtx.GetNContributors()>3 ){ |
107 | AliESDVertex vESD( fPrimaryVtx.Parameters(), fPrimaryVtx.CovarianceMatrix(), fPrimaryVtx.GetChi2(), fPrimaryVtx.GetNContributors() ); | |
108 | fESD->SetPrimaryVertexTracks( &vESD ); | |
36d0f159 | 109 | } else { |
110 | for( Int_t i = 0; i<nTracks; i++) | |
111 | fTrackInfos[i].fPrimUsedFlag = 0; | |
9334b5cb | 112 | } |
36d0f159 | 113 | |
114 | ||
2f399afc | 115 | delete[] vSelected; |
116 | delete[] vIndex; | |
117 | delete[] vFlag; | |
118 | } | |
119 | ||
120 | ||
121 | void AliHLTVertexer::FindV0s( ) | |
122 | { | |
123 | //* V0 finder | |
124 | ||
125 | int nTracks = fESD->GetNumberOfTracks(); | |
9334b5cb | 126 | //AliKFVertex primVtx( *fESD->GetPrimaryVertexTracks() ); |
127 | AliKFVertex &primVtx = fPrimaryVtx; | |
d7e5ba24 | 128 | if( primVtx.GetNContributors()<3 ) return; |
129 | ||
130 | for( Int_t iTr = 0; iTr<nTracks; iTr++ ){ | |
131 | AliESDTrackInfo &info = fTrackInfos[iTr]; | |
132 | info.fPrimDeviation = info.fParticle.GetDeviationFromVertex( primVtx ); | |
133 | } | |
2f399afc | 134 | |
135 | for( Int_t iTr = 0; iTr<nTracks; iTr++ ){ //* first daughter | |
136 | ||
d7e5ba24 | 137 | if( fESD->GetTrack(iTr)->GetTPCNcls()<60 ) continue; |
2f399afc | 138 | AliESDTrackInfo &info = fTrackInfos[iTr]; |
139 | if( !info.fOK ) continue; | |
d7e5ba24 | 140 | if( info.fParticle.GetQ() >0 ) continue; |
141 | if( info.fPrimDeviation <2.5 ) continue; | |
2f399afc | 142 | |
d7e5ba24 | 143 | for( Int_t jTr = 0; jTr<nTracks; jTr++ ){ //* second daughter |
144 | ||
145 | if( fESD->GetTrack(jTr)->GetTPCNcls()<60 ) continue; | |
2f399afc | 146 | AliESDTrackInfo &jnfo = fTrackInfos[jTr]; |
147 | if( !jnfo.fOK ) continue; | |
d7e5ba24 | 148 | if( jnfo.fParticle.GetQ() < 0 ) continue; |
149 | if( jnfo.fPrimDeviation <2.5 ) continue; | |
150 | ||
2f399afc | 151 | //* construct V0 mother |
152 | ||
153 | AliKFParticle V0( info.fParticle, jnfo.fParticle ); | |
154 | ||
155 | //* check V0 Chi^2 | |
156 | ||
157 | if( V0.GetNDF()<1 ) continue; | |
d7e5ba24 | 158 | if( V0.GetChi2()<0 || V0.GetChi2() > 9.*V0.GetNDF() ) continue; |
2f399afc | 159 | |
160 | //* subtruct daughters from primary vertex | |
161 | ||
9334b5cb | 162 | AliKFVertex primVtxCopy = primVtx; |
2f399afc | 163 | |
9334b5cb | 164 | if( info.fPrimUsedFlag ){ |
165 | if( primVtxCopy.GetNContributors()<=2 ) continue; | |
166 | primVtxCopy -= info.fParticle; | |
167 | } | |
168 | if( jnfo.fPrimUsedFlag ){ | |
169 | if( primVtxCopy.GetNContributors()<=2 ) continue; | |
170 | primVtxCopy -= jnfo.fParticle; | |
171 | } | |
2f399afc | 172 | //* Check V0 Chi^2 deviation from primary vertex |
173 | ||
174 | if( V0.GetDeviationFromVertex( primVtxCopy ) >3. ) continue; | |
175 | ||
176 | //* Add V0 to primary vertex to improve the primary vertex resolution | |
177 | ||
178 | primVtxCopy += V0; | |
179 | ||
180 | //* Set production vertex for V0 | |
181 | ||
182 | V0.SetProductionVertex( primVtxCopy ); | |
183 | ||
184 | //* Check chi^2 for a case | |
185 | ||
d7e5ba24 | 186 | if( V0.GetChi2()<0 || V0.GetChi2()> 9.*V0.GetNDF() ) continue; |
187 | ||
188 | // Abschtand in [cm] | |
189 | ||
190 | double dx = V0.GetX()-primVtxCopy.GetX(); | |
191 | double dy = V0.GetY()-primVtxCopy.GetY(); | |
192 | double r = sqrt(dx*dx + dy*dy); | |
193 | //if( r>30 ) continue; | |
194 | if( r<.2 ) continue; | |
2f399afc | 195 | |
d7e5ba24 | 196 | //* Get V0 decay length with estimated error |
2f399afc | 197 | |
198 | Double_t length, sigmaLength; | |
199 | if( V0.GetDecayLength( length, sigmaLength ) ) continue; | |
200 | ||
d7e5ba24 | 201 | //* Reject V0 if it decays too close[sigma] to the primary vertex |
2f399afc | 202 | |
d7e5ba24 | 203 | if( length <3.5*sigmaLength ) continue; |
2f399afc | 204 | |
205 | //* Get V0 invariant mass | |
206 | ||
207 | // Double_t mass, sigmaMass; | |
208 | //if( V0.GetMass( mass, sigmaMass ) ) continue; | |
209 | ||
210 | //* add ESD v0 | |
211 | ||
9334b5cb | 212 | AliESDv0 v0ESD( *fESD->GetTrack( iTr ), iTr, *fESD->GetTrack( jTr ), jTr ); |
2f399afc | 213 | fESD->AddV0( &v0ESD ); |
214 | } | |
215 | } | |
216 | } | |
217 |