]>
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 | ||
2f399afc | 120 | void AliHLTVertexer::FindV0s( ) |
121 | { | |
122 | //* V0 finder | |
123 | ||
124 | int nTracks = fESD->GetNumberOfTracks(); | |
9334b5cb | 125 | //AliKFVertex primVtx( *fESD->GetPrimaryVertexTracks() ); |
126 | AliKFVertex &primVtx = fPrimaryVtx; | |
d7e5ba24 | 127 | if( primVtx.GetNContributors()<3 ) return; |
d7e5ba24 | 128 | for( Int_t iTr = 0; iTr<nTracks; iTr++ ){ |
129 | AliESDTrackInfo &info = fTrackInfos[iTr]; | |
130 | info.fPrimDeviation = info.fParticle.GetDeviationFromVertex( primVtx ); | |
131 | } | |
2f399afc | 132 | |
133 | for( Int_t iTr = 0; iTr<nTracks; iTr++ ){ //* first daughter | |
134 | ||
135 | AliESDTrackInfo &info = fTrackInfos[iTr]; | |
136 | if( !info.fOK ) continue; | |
d7e5ba24 | 137 | if( info.fParticle.GetQ() >0 ) continue; |
138 | if( info.fPrimDeviation <2.5 ) continue; | |
2f399afc | 139 | |
d7e5ba24 | 140 | for( Int_t jTr = 0; jTr<nTracks; jTr++ ){ //* second daughter |
141 | ||
2f399afc | 142 | AliESDTrackInfo &jnfo = fTrackInfos[jTr]; |
143 | if( !jnfo.fOK ) continue; | |
d7e5ba24 | 144 | if( jnfo.fParticle.GetQ() < 0 ) continue; |
145 | if( jnfo.fPrimDeviation <2.5 ) continue; | |
146 | ||
2f399afc | 147 | //* construct V0 mother |
148 | ||
01ce7f55 | 149 | AliKFParticle v0( info.fParticle, jnfo.fParticle ); |
2f399afc | 150 | |
151 | //* check V0 Chi^2 | |
c08ab306 | 152 | |
01ce7f55 | 153 | if( v0.GetChi2()<0 || v0.GetChi2() > 9.*v0.GetNDF() ) continue; |
2f399afc | 154 | |
155 | //* subtruct daughters from primary vertex | |
156 | ||
9334b5cb | 157 | AliKFVertex primVtxCopy = primVtx; |
2f399afc | 158 | |
9334b5cb | 159 | if( info.fPrimUsedFlag ){ |
160 | if( primVtxCopy.GetNContributors()<=2 ) continue; | |
161 | primVtxCopy -= info.fParticle; | |
162 | } | |
163 | if( jnfo.fPrimUsedFlag ){ | |
164 | if( primVtxCopy.GetNContributors()<=2 ) continue; | |
165 | primVtxCopy -= jnfo.fParticle; | |
166 | } | |
01ce7f55 | 167 | //* Check v0 Chi^2 deviation from primary vertex |
2f399afc | 168 | |
01ce7f55 | 169 | if( v0.GetDeviationFromVertex( primVtxCopy ) >3. ) continue; |
2f399afc | 170 | |
171 | //* Add V0 to primary vertex to improve the primary vertex resolution | |
172 | ||
01ce7f55 | 173 | primVtxCopy += v0; |
2f399afc | 174 | |
175 | //* Set production vertex for V0 | |
176 | ||
01ce7f55 | 177 | v0.SetProductionVertex( primVtxCopy ); |
2f399afc | 178 | |
179 | //* Check chi^2 for a case | |
180 | ||
01ce7f55 | 181 | if( v0.GetChi2()<0 || v0.GetChi2()> 9.*v0.GetNDF() ) continue; |
182 | ||
183 | //* Get V0 decay length with estimated error | |
2f399afc | 184 | |
185 | Double_t length, sigmaLength; | |
01ce7f55 | 186 | if( v0.GetDecayLength( length, sigmaLength ) ) continue; |
2f399afc | 187 | |
d7e5ba24 | 188 | //* Reject V0 if it decays too close[sigma] to the primary vertex |
2f399afc | 189 | |
d7e5ba24 | 190 | if( length <3.5*sigmaLength ) continue; |
2f399afc | 191 | |
2f399afc | 192 | //* add ESD v0 |
193 | ||
9334b5cb | 194 | AliESDv0 v0ESD( *fESD->GetTrack( iTr ), iTr, *fESD->GetTrack( jTr ), jTr ); |
2f399afc | 195 | fESD->AddV0( &v0ESD ); |
196 | } | |
197 | } | |
198 | } | |
199 |