]>
Commit | Line | Data |
---|---|---|
e43c066c | 1 | /************************************************************************** |
9a5326b1 | 2 | * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * |
e43c066c | 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 | **************************************************************************/ | |
9a5326b1 | 15 | /* $Id$ */ |
bf6adc12 | 16 | |
e43c066c | 17 | //------------------------------------------------------------------------- |
18 | // Implementation of the ITS tracker class | |
00a7cc50 | 19 | // It reads AliITSRecPoint clusters and creates AliITStrackMI tracks |
e43c066c | 20 | // and fills with them the ESD |
15dd636f | 21 | // Origin: Marian Ivanov, CERN, Marian.Ivanov@cern.ch |
afd25725 | 22 | // dE/dx analysis by: Boris Batyunya, JINR, Boris.Batiounia@cern.ch |
23 | // Params moved to AliITSRecoParam by: Andrea Dainese, INFN | |
24 | // Material budget from TGeo by: Ludovic Gaudichet & Andrea Dainese, INFN | |
e43c066c | 25 | //------------------------------------------------------------------------- |
bf6adc12 | 26 | |
27 | #include <TMatrixD.h> | |
e43c066c | 28 | #include <TTree.h> |
bf6adc12 | 29 | #include <TTreeStream.h> |
afd25725 | 30 | #include <TDatabasePDG.h> |
9a5326b1 | 31 | #include <TString.h> |
e50912db | 32 | #include <TRandom.h> |
afd25725 | 33 | |
bf6adc12 | 34 | |
af885e0f | 35 | #include "AliESDEvent.h" |
aad72f45 | 36 | #include "AliESDtrack.h" |
9a5326b1 | 37 | #include "AliESDVertex.h" |
6c94f330 | 38 | #include "AliV0.h" |
bf6adc12 | 39 | #include "AliHelix.h" |
00a7cc50 | 40 | #include "AliITSRecPoint.h" |
e341247d | 41 | #include "AliITSgeomTGeo.h" |
44347160 | 42 | #include "AliITSReconstructor.h" |
df29e9a4 | 43 | #include "AliTrackPointArray.h" |
44 | #include "AliAlignObj.h" | |
572f41f9 | 45 | #include "AliITSClusterParam.h" |
ae00569a | 46 | #include "AliCDBManager.h" |
47 | #include "AliCDBEntry.h" | |
48 | #include "AliITSCalibrationSPD.h" | |
49 | #include "AliITSCalibrationSDD.h" | |
50 | #include "AliITSCalibrationSSD.h" | |
7167ae53 | 51 | #include "AliITSPlaneEff.h" |
52 | #include "AliITSPlaneEffSPD.h" | |
53 | #include "AliITSPlaneEffSDD.h" | |
54 | #include "AliITSPlaneEffSSD.h" | |
ae00569a | 55 | #include "AliITStrackerMI.h" |
e43c066c | 56 | |
57 | ClassImp(AliITStrackerMI) | |
e43c066c | 58 | |
e50912db | 59 | AliITStrackerMI::AliITSlayer AliITStrackerMI::fgLayers[AliITSgeomTGeo::kNLayers]; // ITS layers |
44347160 | 60 | |
8221b41b | 61 | AliITStrackerMI::AliITStrackerMI():AliTracker(), |
62 | fI(0), | |
63 | fBestTrack(), | |
64 | fTrackToFollow(), | |
65 | fTrackHypothesys(), | |
66 | fBestHypothesys(), | |
67 | fOriginal(), | |
68 | fCurrentEsdTrack(), | |
69 | fPass(0), | |
70 | fAfterV0(kFALSE), | |
71 | fLastLayerToTrackTo(0), | |
afd25725 | 72 | fCoefficients(0), |
8221b41b | 73 | fEsd(0), |
e50912db | 74 | fTrackingPhase("Default"), |
6518a6c5 | 75 | fUseTGeo(3), |
e50912db | 76 | fNtracks(0), |
77 | fxOverX0Pipe(-1.), | |
78 | fxTimesRhoPipe(-1.), | |
79 | fxOverX0PipeTrks(0), | |
80 | fxTimesRhoPipeTrks(0), | |
81 | fxOverX0ShieldTrks(0), | |
82 | fxTimesRhoShieldTrks(0), | |
83 | fxOverX0LayerTrks(0), | |
84 | fxTimesRhoLayerTrks(0), | |
4a66240a | 85 | fDebugStreamer(0), |
ae00569a | 86 | fPlaneEff(0) { |
8221b41b | 87 | //Default constructor |
e50912db | 88 | Int_t i; |
89 | for(i=0;i<4;i++) fSPDdetzcentre[i]=0.; | |
90 | for(i=0;i<2;i++) {fxOverX0Shield[i]=-1.;fxTimesRhoShield[i]=-1.;} | |
91 | for(i=0;i<6;i++) {fxOverX0Layer[i]=-1.;fxTimesRhoLayer[i]=-1.;} | |
8221b41b | 92 | } |
44347160 | 93 | //------------------------------------------------------------------------ |
1f3e997f | 94 | AliITStrackerMI::AliITStrackerMI(const Char_t *geom) : AliTracker(), |
e50912db | 95 | fI(AliITSgeomTGeo::GetNLayers()), |
8221b41b | 96 | fBestTrack(), |
97 | fTrackToFollow(), | |
98 | fTrackHypothesys(), | |
99 | fBestHypothesys(), | |
100 | fOriginal(), | |
101 | fCurrentEsdTrack(), | |
102 | fPass(0), | |
103 | fAfterV0(kFALSE), | |
e50912db | 104 | fLastLayerToTrackTo(AliITSRecoParam::GetLastLayerToTrackTo()), |
afd25725 | 105 | fCoefficients(0), |
8221b41b | 106 | fEsd(0), |
e50912db | 107 | fTrackingPhase("Default"), |
6518a6c5 | 108 | fUseTGeo(3), |
e50912db | 109 | fNtracks(0), |
110 | fxOverX0Pipe(-1.), | |
111 | fxTimesRhoPipe(-1.), | |
112 | fxOverX0PipeTrks(0), | |
113 | fxTimesRhoPipeTrks(0), | |
114 | fxOverX0ShieldTrks(0), | |
115 | fxTimesRhoShieldTrks(0), | |
116 | fxOverX0LayerTrks(0), | |
117 | fxTimesRhoLayerTrks(0), | |
4a66240a | 118 | fDebugStreamer(0), |
ae00569a | 119 | fPlaneEff(0) { |
e43c066c | 120 | //-------------------------------------------------------------------- |
121 | //This is the AliITStrackerMI constructor | |
122 | //-------------------------------------------------------------------- | |
e341247d | 123 | if (geom) { |
124 | AliWarning("\"geom\" is actually a dummy argument !"); | |
125 | } | |
126 | ||
afd25725 | 127 | fCoefficients = 0; |
628e7bb0 | 128 | fAfterV0 = kFALSE; |
e341247d | 129 | |
e50912db | 130 | for (Int_t i=1; i<AliITSgeomTGeo::GetNLayers()+1; i++) { |
e341247d | 131 | Int_t nlad=AliITSgeomTGeo::GetNLadders(i); |
132 | Int_t ndet=AliITSgeomTGeo::GetNDetectors(i); | |
133 | ||
134 | Double_t xyz[3], &x=xyz[0], &y=xyz[1], &z=xyz[2]; | |
135 | AliITSgeomTGeo::GetOrigTranslation(i,1,1,xyz); | |
e43c066c | 136 | Double_t poff=TMath::ATan2(y,x); |
137 | Double_t zoff=z; | |
e341247d | 138 | Double_t r=TMath::Sqrt(x*x + y*y); |
e43c066c | 139 | |
e341247d | 140 | AliITSgeomTGeo::GetOrigTranslation(i,1,2,xyz); |
e43c066c | 141 | r += TMath::Sqrt(x*x + y*y); |
e341247d | 142 | AliITSgeomTGeo::GetOrigTranslation(i,2,1,xyz); |
e43c066c | 143 | r += TMath::Sqrt(x*x + y*y); |
e341247d | 144 | AliITSgeomTGeo::GetOrigTranslation(i,2,2,xyz); |
e43c066c | 145 | r += TMath::Sqrt(x*x + y*y); |
146 | r*=0.25; | |
147 | ||
148 | new (fgLayers+i-1) AliITSlayer(r,poff,zoff,nlad,ndet); | |
149 | ||
150 | for (Int_t j=1; j<nlad+1; j++) { | |
151 | for (Int_t k=1; k<ndet+1; k++) { //Fill this layer with detectors | |
e341247d | 152 | TGeoHMatrix m; AliITSgeomTGeo::GetOrigMatrix(i,j,k,m); |
1f3e997f | 153 | const TGeoHMatrix *tm=AliITSgeomTGeo::GetTracking2LocalMatrix(i,j,k); |
154 | m.Multiply(tm); | |
155 | Double_t txyz[3]={0.}, xyz[3]={0.}; | |
156 | m.LocalToMaster(txyz,xyz); | |
157 | Double_t r=TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]); | |
158 | Double_t phi=TMath::ATan2(xyz[1],xyz[0]); | |
e341247d | 159 | |
160 | if (phi<0) phi+=TMath::TwoPi(); | |
161 | else if (phi>=TMath::TwoPi()) phi-=TMath::TwoPi(); | |
162 | ||
e43c066c | 163 | AliITSdetector &det=fgLayers[i-1].GetDetector((j-1)*ndet + k-1); |
164 | new(&det) AliITSdetector(r,phi); | |
165 | } | |
166 | } | |
167 | ||
168 | } | |
169 | ||
e50912db | 170 | fI=AliITSgeomTGeo::GetNLayers(); |
e43c066c | 171 | |
172 | fPass=0; | |
173 | fConstraint[0]=1; fConstraint[1]=0; | |
174 | ||
afd25725 | 175 | Double_t xyzVtx[]={AliITSReconstructor::GetRecoParam()->GetXVdef(), |
176 | AliITSReconstructor::GetRecoParam()->GetYVdef(), | |
177 | AliITSReconstructor::GetRecoParam()->GetZVdef()}; | |
178 | Double_t ersVtx[]={AliITSReconstructor::GetRecoParam()->GetSigmaXVdef(), | |
179 | AliITSReconstructor::GetRecoParam()->GetSigmaYVdef(), | |
180 | AliITSReconstructor::GetRecoParam()->GetSigmaZVdef()}; | |
181 | SetVertex(xyzVtx,ersVtx); | |
e43c066c | 182 | |
e50912db | 183 | for (Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fLayersNotToSkip[i]=AliITSRecoParam::GetLayersNotToSkip(i); |
184 | fLastLayerToTrackTo=AliITSRecoParam::GetLastLayerToTrackTo(); | |
628e7bb0 | 185 | for (Int_t i=0;i<100000;i++){ |
186 | fBestTrackIndex[i]=0; | |
187 | } | |
afd25725 | 188 | |
189 | // store positions of centre of SPD modules (in z) | |
190 | Double_t tr[3]; | |
191 | AliITSgeomTGeo::GetTranslation(1,1,1,tr); | |
192 | fSPDdetzcentre[0] = tr[2]; | |
193 | AliITSgeomTGeo::GetTranslation(1,1,2,tr); | |
194 | fSPDdetzcentre[1] = tr[2]; | |
195 | AliITSgeomTGeo::GetTranslation(1,1,3,tr); | |
196 | fSPDdetzcentre[2] = tr[2]; | |
197 | AliITSgeomTGeo::GetTranslation(1,1,4,tr); | |
198 | fSPDdetzcentre[3] = tr[2]; | |
199 | ||
afd25725 | 200 | fUseTGeo = AliITSReconstructor::GetRecoParam()->GetUseTGeoInTracker(); |
6518a6c5 | 201 | if(AliITSReconstructor::GetRecoParam()->GetExtendedEtaAcceptance() && fUseTGeo!=1 && fUseTGeo!=3) { |
202 | AliWarning("fUseTGeo changed to 3 because fExtendedEtaAcceptance is kTRUE"); | |
203 | fUseTGeo = 3; | |
204 | } | |
e50912db | 205 | |
206 | for(Int_t i=0;i<2;i++) {fxOverX0Shield[i]=-1.;fxTimesRhoShield[i]=-1.;} | |
207 | for(Int_t i=0;i<6;i++) {fxOverX0Layer[i]=-1.;fxTimesRhoLayer[i]=-1.;} | |
208 | ||
81e97e0d | 209 | fDebugStreamer = new TTreeSRedirector("ITSdebug.root"); |
210 | ||
7167ae53 | 211 | // only for plane efficiency evaluation |
212 | if (AliITSReconstructor::GetRecoParam()->GetComputePlaneEff()) { | |
213 | for(Int_t ilay=0;ilay<6;ilay++) { | |
214 | if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(ilay)) { | |
215 | if (ilay<2) fPlaneEff = new AliITSPlaneEffSPD(); | |
216 | else if (ilay<4) fPlaneEff = new AliITSPlaneEffSDD(); | |
217 | else fPlaneEff = new AliITSPlaneEffSSD(); | |
218 | break; // only one layer type to skip at once | |
219 | } | |
220 | } | |
221 | if(!fPlaneEff->ReadFromCDB()) | |
222 | {AliWarning("AliITStrackerMI reading of AliITSPlaneEff from OCDB failed") ;} | |
223 | } | |
628e7bb0 | 224 | } |
44347160 | 225 | //------------------------------------------------------------------------ |
8221b41b | 226 | AliITStrackerMI::AliITStrackerMI(const AliITStrackerMI &tracker):AliTracker(tracker), |
227 | fI(tracker.fI), | |
228 | fBestTrack(tracker.fBestTrack), | |
229 | fTrackToFollow(tracker.fTrackToFollow), | |
230 | fTrackHypothesys(tracker.fTrackHypothesys), | |
231 | fBestHypothesys(tracker.fBestHypothesys), | |
232 | fOriginal(tracker.fOriginal), | |
233 | fCurrentEsdTrack(tracker.fCurrentEsdTrack), | |
234 | fPass(tracker.fPass), | |
235 | fAfterV0(tracker.fAfterV0), | |
236 | fLastLayerToTrackTo(tracker.fLastLayerToTrackTo), | |
afd25725 | 237 | fCoefficients(tracker.fCoefficients), |
8221b41b | 238 | fEsd(tracker.fEsd), |
e50912db | 239 | fTrackingPhase(tracker.fTrackingPhase), |
afd25725 | 240 | fUseTGeo(tracker.fUseTGeo), |
e50912db | 241 | fNtracks(tracker.fNtracks), |
242 | fxOverX0Pipe(tracker.fxOverX0Pipe), | |
243 | fxTimesRhoPipe(tracker.fxTimesRhoPipe), | |
244 | fxOverX0PipeTrks(0), | |
245 | fxTimesRhoPipeTrks(0), | |
246 | fxOverX0ShieldTrks(0), | |
247 | fxTimesRhoShieldTrks(0), | |
248 | fxOverX0LayerTrks(0), | |
249 | fxTimesRhoLayerTrks(0), | |
4a66240a | 250 | fDebugStreamer(tracker.fDebugStreamer), |
ae00569a | 251 | fPlaneEff(tracker.fPlaneEff) { |
8221b41b | 252 | //Copy constructor |
e50912db | 253 | Int_t i; |
254 | for(i=0;i<4;i++) { | |
255 | fSPDdetzcentre[i]=tracker.fSPDdetzcentre[i]; | |
256 | } | |
257 | for(i=0;i<6;i++) { | |
258 | fxOverX0Layer[i]=tracker.fxOverX0Layer[i]; | |
259 | fxTimesRhoLayer[i]=tracker.fxTimesRhoLayer[i]; | |
260 | } | |
261 | for(i=0;i<2;i++) { | |
262 | fxOverX0Shield[i]=tracker.fxOverX0Shield[i]; | |
263 | fxTimesRhoShield[i]=tracker.fxTimesRhoShield[i]; | |
264 | } | |
8221b41b | 265 | } |
44347160 | 266 | //------------------------------------------------------------------------ |
8221b41b | 267 | AliITStrackerMI & AliITStrackerMI::operator=(const AliITStrackerMI &tracker){ |
268 | //Assignment operator | |
269 | this->~AliITStrackerMI(); | |
270 | new(this) AliITStrackerMI(tracker); | |
271 | return *this; | |
272 | } | |
44347160 | 273 | //------------------------------------------------------------------------ |
628e7bb0 | 274 | AliITStrackerMI::~AliITStrackerMI() |
275 | { | |
276 | // | |
277 | //destructor | |
278 | // | |
e50912db | 279 | if (fCoefficients) delete [] fCoefficients; |
280 | DeleteTrksMaterialLUT(); | |
81e97e0d | 281 | if (fDebugStreamer) { |
282 | //fDebugStreamer->Close(); | |
283 | delete fDebugStreamer; | |
284 | } | |
e43c066c | 285 | } |
44347160 | 286 | //------------------------------------------------------------------------ |
e43c066c | 287 | void AliITStrackerMI::SetLayersNotToSkip(Int_t *l) { |
288 | //-------------------------------------------------------------------- | |
289 | //This function set masks of the layers which must be not skipped | |
290 | //-------------------------------------------------------------------- | |
e50912db | 291 | for (Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fLayersNotToSkip[i]=l[i]; |
e43c066c | 292 | } |
44347160 | 293 | //------------------------------------------------------------------------ |
e43c066c | 294 | Int_t AliITStrackerMI::LoadClusters(TTree *cTree) { |
295 | //-------------------------------------------------------------------- | |
296 | //This function loads ITS clusters | |
297 | //-------------------------------------------------------------------- | |
00a7cc50 | 298 | TBranch *branch=cTree->GetBranch("ITSRecPoints"); |
e43c066c | 299 | if (!branch) { |
300 | Error("LoadClusters"," can't get the branch !\n"); | |
301 | return 1; | |
302 | } | |
303 | ||
00a7cc50 | 304 | TClonesArray dummy("AliITSRecPoint",10000), *clusters=&dummy; |
e43c066c | 305 | branch->SetAddress(&clusters); |
306 | ||
307 | Int_t j=0; | |
308 | Int_t detector=0; | |
e50912db | 309 | for (Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) { |
e43c066c | 310 | Int_t ndet=fgLayers[i].GetNdetectors(); |
311 | Int_t jmax = j + fgLayers[i].GetNladders()*ndet; | |
312 | for (; j<jmax; j++) { | |
313 | if (!cTree->GetEvent(j)) continue; | |
314 | Int_t ncl=clusters->GetEntriesFast(); | |
315 | SignDeltas(clusters,GetZ()); | |
1f3e997f | 316 | |
e43c066c | 317 | while (ncl--) { |
00a7cc50 | 318 | AliITSRecPoint *c=(AliITSRecPoint*)clusters->UncheckedAt(ncl); |
75fb37cc | 319 | detector=c->GetDetectorIndex(); |
a504d56f | 320 | |
75fb37cc | 321 | if (!c->Misalign()) AliWarning("Can't misalign this cluster !"); |
a504d56f | 322 | |
00a7cc50 | 323 | fgLayers[i].InsertCluster(new AliITSRecPoint(*c)); |
e43c066c | 324 | } |
325 | clusters->Delete(); | |
afd25725 | 326 | // add dead zone "virtual" cluster in SPD, if there is a cluster within |
327 | // zwindow cm from the dead zone | |
328 | if (i<2 && AliITSReconstructor::GetRecoParam()->GetAddVirtualClustersInDeadZone()) { | |
e50912db | 329 | for (Float_t xdead = 0; xdead < AliITSRecoParam::GetSPDdetxlength(); xdead += (i+1.)*AliITSReconstructor::GetRecoParam()->GetXPassDeadZoneHits()) { |
afd25725 | 330 | Int_t lab[4] = {0,0,0,detector}; |
331 | Int_t info[3] = {0,0,i}; | |
6518a6c5 | 332 | Float_t q = 0.; // this identifies virtual clusters |
afd25725 | 333 | Float_t hit[5] = {xdead, |
334 | 0., | |
335 | AliITSReconstructor::GetRecoParam()->GetSigmaXDeadZoneHit2(), | |
336 | AliITSReconstructor::GetRecoParam()->GetSigmaZDeadZoneHit2(), | |
337 | q}; | |
338 | Bool_t local = kTRUE; | |
339 | Double_t zwindow = AliITSReconstructor::GetRecoParam()->GetZWindowDeadZone(); | |
e50912db | 340 | hit[1] = fSPDdetzcentre[0]+0.5*AliITSRecoParam::GetSPDdetzlength(); |
afd25725 | 341 | if (TMath::Abs(fgLayers[i].GetDetector(detector).GetZmax()-hit[1])<zwindow) |
342 | fgLayers[i].InsertCluster(new AliITSRecPoint(lab,hit,info,local)); | |
e50912db | 343 | hit[1] = fSPDdetzcentre[1]-0.5*AliITSRecoParam::GetSPDdetzlength(); |
afd25725 | 344 | if (TMath::Abs(fgLayers[i].GetDetector(detector).GetZmax()-hit[1])<zwindow) |
345 | fgLayers[i].InsertCluster(new AliITSRecPoint(lab,hit,info,local)); | |
e50912db | 346 | hit[1] = fSPDdetzcentre[1]+0.5*AliITSRecoParam::GetSPDdetzlength(); |
afd25725 | 347 | if (TMath::Abs(fgLayers[i].GetDetector(detector).GetZmax()-hit[1])<zwindow) |
348 | fgLayers[i].InsertCluster(new AliITSRecPoint(lab,hit,info,local)); | |
e50912db | 349 | hit[1] = fSPDdetzcentre[2]-0.5*AliITSRecoParam::GetSPDdetzlength(); |
afd25725 | 350 | if (TMath::Abs(fgLayers[i].GetDetector(detector).GetZmax()-hit[1])<zwindow) |
351 | fgLayers[i].InsertCluster(new AliITSRecPoint(lab,hit,info,local)); | |
e50912db | 352 | hit[1] = fSPDdetzcentre[2]+0.5*AliITSRecoParam::GetSPDdetzlength(); |
afd25725 | 353 | if (TMath::Abs(fgLayers[i].GetDetector(detector).GetZmax()-hit[1])<zwindow) |
354 | fgLayers[i].InsertCluster(new AliITSRecPoint(lab,hit,info,local)); | |
e50912db | 355 | hit[1] = fSPDdetzcentre[3]-0.5*AliITSRecoParam::GetSPDdetzlength(); |
afd25725 | 356 | if (TMath::Abs(fgLayers[i].GetDetector(detector).GetZmax()-hit[1])<zwindow) |
357 | fgLayers[i].InsertCluster(new AliITSRecPoint(lab,hit,info,local)); | |
e43c066c | 358 | } |
6518a6c5 | 359 | } // "virtual" clusters in SPD |
e43c066c | 360 | |
361 | } | |
362 | // | |
363 | fgLayers[i].ResetRoad(); //road defined by the cluster density | |
364 | fgLayers[i].SortClusters(); | |
365 | } | |
366 | ||
367 | return 0; | |
368 | } | |
44347160 | 369 | //------------------------------------------------------------------------ |
e43c066c | 370 | void AliITStrackerMI::UnloadClusters() { |
371 | //-------------------------------------------------------------------- | |
372 | //This function unloads ITS clusters | |
373 | //-------------------------------------------------------------------- | |
e50912db | 374 | for (Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fgLayers[i].ResetClusters(); |
e43c066c | 375 | } |
44347160 | 376 | //------------------------------------------------------------------------ |
afd25725 | 377 | static Int_t CorrectForTPCtoITSDeadZoneMaterial(AliITStrackMI *t) { |
e43c066c | 378 | //-------------------------------------------------------------------- |
379 | // Correction for the material between the TPC and the ITS | |
e43c066c | 380 | //-------------------------------------------------------------------- |
e50912db | 381 | if (t->GetX() > AliITSRecoParam::Getriw()) { // inward direction |
382 | if (!t->PropagateToTGeo(AliITSRecoParam::Getriw(),1)) return 0;// TPC inner wall | |
383 | if (!t->PropagateToTGeo(AliITSRecoParam::Getrcd(),1)) return 0;// TPC central drum | |
384 | if (!t->PropagateToTGeo(AliITSRecoParam::Getrs(),1)) return 0;// ITS screen | |
385 | } else if (t->GetX() < AliITSRecoParam::Getrs()) { // outward direction | |
386 | if (!t->PropagateToTGeo(AliITSRecoParam::Getrs(),1)) return 0;// ITS screen | |
387 | if (!t->PropagateToTGeo(AliITSRecoParam::Getrcd(),1)) return 0;// TPC central drum | |
388 | if (!t->PropagateToTGeo(AliITSRecoParam::Getriw()+0.001,1)) return 0;// TPC inner wall | |
e43c066c | 389 | } else { |
afd25725 | 390 | Error("CorrectForTPCtoITSDeadZoneMaterial","Track is already in the dead zone !"); |
e50912db | 391 | return 0; |
e43c066c | 392 | } |
393 | ||
e50912db | 394 | return 1; |
e43c066c | 395 | } |
44347160 | 396 | //------------------------------------------------------------------------ |
af885e0f | 397 | Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) { |
e43c066c | 398 | //-------------------------------------------------------------------- |
399 | // This functions reconstructs ITS tracks | |
400 | // The clusters must be already loaded ! | |
401 | //-------------------------------------------------------------------- | |
e50912db | 402 | fTrackingPhase="Clusters2Tracks"; |
403 | ||
e43c066c | 404 | TObjArray itsTracks(15000); |
628e7bb0 | 405 | fOriginal.Clear(); |
81e97e0d | 406 | fEsd = event; // store pointer to the esd |
afd25725 | 407 | |
9a5326b1 | 408 | // temporary (for cosmics) |
409 | if(event->GetVertex()) { | |
410 | TString title = event->GetVertex()->GetTitle(); | |
411 | if(title.Contains("cosmics")) { | |
412 | Double_t xyz[3]={GetX(),GetY(),GetZ()}; | |
413 | Double_t exyz[3]={0.1,0.1,0.1}; | |
414 | SetVertex(xyz,exyz); | |
415 | } | |
416 | } | |
417 | // temporary | |
afd25725 | 418 | |
e43c066c | 419 | {/* Read ESD tracks */ |
afd25725 | 420 | Double_t pimass = TDatabasePDG::Instance()->GetParticle(211)->Mass(); |
e43c066c | 421 | Int_t nentr=event->GetNumberOfTracks(); |
422 | Info("Clusters2Tracks", "Number of ESD tracks: %d\n", nentr); | |
423 | while (nentr--) { | |
424 | AliESDtrack *esd=event->GetTrack(nentr); | |
425 | ||
426 | if ((esd->GetStatus()&AliESDtrack::kTPCin)==0) continue; | |
427 | if (esd->GetStatus()&AliESDtrack::kTPCout) continue; | |
428 | if (esd->GetStatus()&AliESDtrack::kITSin) continue; | |
51ad6848 | 429 | if (esd->GetKinkIndex(0)>0) continue; //kink daughter |
15dd636f | 430 | AliITStrackMI *t=0; |
e43c066c | 431 | try { |
15dd636f | 432 | t=new AliITStrackMI(*esd); |
e43c066c | 433 | } catch (const Char_t *msg) { |
628e7bb0 | 434 | //Warning("Clusters2Tracks",msg); |
e43c066c | 435 | delete t; |
436 | continue; | |
437 | } | |
b9671574 | 438 | t->GetDZ(GetX(),GetY(),GetZ(),t->GetDP()); //I.B. |
439 | Double_t vdist = TMath::Sqrt(t->GetD(0)*t->GetD(0)+t->GetD(1)*t->GetD(1)); | |
6518a6c5 | 440 | |
441 | ||
afd25725 | 442 | // look at the ESD mass hypothesys ! |
443 | if (t->GetMass()<0.9*pimass) t->SetMass(pimass); | |
e43c066c | 444 | // write expected q |
b9671574 | 445 | t->SetExpQ(TMath::Max(0.8*t->GetESDtrack()->GetTPCsignal(),30.)); |
e43c066c | 446 | |
afd25725 | 447 | if (esd->GetV0Index(0)>0 && t->GetD(0)<AliITSReconstructor::GetRecoParam()->GetMaxDforV0dghtrForProlongation()){ |
81e97e0d | 448 | //track - can be V0 according to TPC |
afd25725 | 449 | } else { |
450 | if (TMath::Abs(t->GetD(0))>AliITSReconstructor::GetRecoParam()->GetMaxDForProlongation()) { | |
81e97e0d | 451 | delete t; |
452 | continue; | |
e50912db | 453 | } |
afd25725 | 454 | if (TMath::Abs(vdist)>AliITSReconstructor::GetRecoParam()->GetMaxDZForProlongation()) { |
81e97e0d | 455 | delete t; |
456 | continue; | |
457 | } | |
6c23ffed | 458 | if (t->Pt()<AliITSReconstructor::GetRecoParam()->GetMinPtForProlongation()) { |
81e97e0d | 459 | delete t; |
460 | continue; | |
461 | } | |
e50912db | 462 | if (!CorrectForTPCtoITSDeadZoneMaterial(t)) { |
81e97e0d | 463 | delete t; |
464 | continue; | |
465 | } | |
e43c066c | 466 | } |
b9671574 | 467 | t->SetReconstructed(kFALSE); |
e43c066c | 468 | itsTracks.AddLast(t); |
628e7bb0 | 469 | fOriginal.AddLast(t); |
e43c066c | 470 | } |
471 | } /* End Read ESD tracks */ | |
472 | ||
473 | itsTracks.Sort(); | |
628e7bb0 | 474 | fOriginal.Sort(); |
e43c066c | 475 | Int_t nentr=itsTracks.GetEntriesFast(); |
476 | fTrackHypothesys.Expand(nentr); | |
81e97e0d | 477 | fBestHypothesys.Expand(nentr); |
afd25725 | 478 | MakeCoefficients(nentr); |
513ab112 | 479 | if(fUseTGeo==3 || fUseTGeo==4) MakeTrksMaterialLUT(event->GetNumberOfTracks()); |
e43c066c | 480 | Int_t ntrk=0; |
afd25725 | 481 | // THE TWO TRACKING PASSES |
e43c066c | 482 | for (fPass=0; fPass<2; fPass++) { |
483 | Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue; | |
e50912db | 484 | for (fCurrentEsdTrack=0; fCurrentEsdTrack<nentr; fCurrentEsdTrack++) { |
2755f080 | 485 | //cerr<<fPass<<" "<<fCurrentEsdTrack<<'\n'; |
e50912db | 486 | AliITStrackMI *t=(AliITStrackMI*)itsTracks.UncheckedAt(fCurrentEsdTrack); |
e43c066c | 487 | if (t==0) continue; //this track has been already tracked |
b9671574 | 488 | if (t->GetReconstructed()&&(t->GetNUsed()<1.5)) continue; //this track was already "succesfully" reconstructed |
791f9a2a | 489 | Float_t dz[2]; t->GetDZ(GetX(),GetY(),GetZ(),dz); //I.B. |
afd25725 | 490 | if (fConstraint[fPass]) { |
491 | if (TMath::Abs(dz[0])>AliITSReconstructor::GetRecoParam()->GetMaxDZToUseConstraint() || | |
492 | TMath::Abs(dz[1])>AliITSReconstructor::GetRecoParam()->GetMaxDZToUseConstraint()) continue; | |
493 | } | |
e43c066c | 494 | |
495 | Int_t tpcLabel=t->GetLabel(); //save the TPC track label | |
496 | fI = 6; | |
497 | ResetTrackToFollow(*t); | |
498 | ResetBestTrack(); | |
6518a6c5 | 499 | |
e50912db | 500 | FollowProlongationTree(t,fCurrentEsdTrack,fConstraint[fPass]); |
e43c066c | 501 | |
502 | SortTrackHypothesys(fCurrentEsdTrack,20,0); //MI change | |
503 | // | |
ae00569a | 504 | AliITStrackMI *besttrack = GetBestHypothesys(fCurrentEsdTrack,t,15); |
e43c066c | 505 | if (!besttrack) continue; |
506 | besttrack->SetLabel(tpcLabel); | |
507 | // besttrack->CookdEdx(); | |
508 | CookdEdx(besttrack); | |
b9671574 | 509 | besttrack->SetFakeRatio(1.); |
e43c066c | 510 | CookLabel(besttrack,0.); //For comparison only |
e43c066c | 511 | UpdateESDtrack(besttrack,AliESDtrack::kITSin); |
628e7bb0 | 512 | |
628e7bb0 | 513 | if (fConstraint[fPass]&&(!besttrack->IsGoldPrimary())) continue; //to be tracked also without vertex constrain |
514 | ||
b9671574 | 515 | t->SetReconstructed(kTRUE); |
e43c066c | 516 | ntrk++; |
517 | } | |
518 | GetBestHypothesysMIP(itsTracks); | |
afd25725 | 519 | } // end loop on the two tracking passes |
e43c066c | 520 | |
521 | //GetBestHypothesysMIP(itsTracks); | |
afd25725 | 522 | if(event->GetNumberOfV0s()>0) UpdateTPCV0(event); |
523 | if(AliITSReconstructor::GetRecoParam()->GetFindV0s()) FindV02(event); | |
628e7bb0 | 524 | fAfterV0 = kTRUE; |
525 | //GetBestHypothesysMIP(itsTracks); | |
526 | // | |
e43c066c | 527 | itsTracks.Delete(); |
528 | // | |
529 | Int_t entries = fTrackHypothesys.GetEntriesFast(); | |
e50912db | 530 | for (Int_t ientry=0; ientry<entries; ientry++) { |
e43c066c | 531 | TObjArray * array =(TObjArray*)fTrackHypothesys.UncheckedAt(ientry); |
532 | if (array) array->Delete(); | |
533 | delete fTrackHypothesys.RemoveAt(ientry); | |
534 | } | |
535 | ||
536 | fTrackHypothesys.Delete(); | |
81e97e0d | 537 | fBestHypothesys.Delete(); |
628e7bb0 | 538 | fOriginal.Clear(); |
afd25725 | 539 | delete [] fCoefficients; |
540 | fCoefficients=0; | |
e50912db | 541 | DeleteTrksMaterialLUT(); |
542 | ||
e43c066c | 543 | Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk); |
e50912db | 544 | |
545 | fTrackingPhase="Default"; | |
628e7bb0 | 546 | |
e43c066c | 547 | return 0; |
548 | } | |
44347160 | 549 | //------------------------------------------------------------------------ |
af885e0f | 550 | Int_t AliITStrackerMI::PropagateBack(AliESDEvent *event) { |
e43c066c | 551 | //-------------------------------------------------------------------- |
552 | // This functions propagates reconstructed ITS tracks back | |
553 | // The clusters must be loaded ! | |
554 | //-------------------------------------------------------------------- | |
e50912db | 555 | fTrackingPhase="PropagateBack"; |
e43c066c | 556 | Int_t nentr=event->GetNumberOfTracks(); |
557 | Info("PropagateBack", "Number of ESD tracks: %d\n", nentr); | |
558 | ||
559 | Int_t ntrk=0; | |
560 | for (Int_t i=0; i<nentr; i++) { | |
561 | AliESDtrack *esd=event->GetTrack(i); | |
562 | ||
563 | if ((esd->GetStatus()&AliESDtrack::kITSin)==0) continue; | |
564 | if (esd->GetStatus()&AliESDtrack::kITSout) continue; | |
565 | ||
15dd636f | 566 | AliITStrackMI *t=0; |
e43c066c | 567 | try { |
15dd636f | 568 | t=new AliITStrackMI(*esd); |
e43c066c | 569 | } catch (const Char_t *msg) { |
628e7bb0 | 570 | //Warning("PropagateBack",msg); |
e43c066c | 571 | delete t; |
572 | continue; | |
573 | } | |
b9671574 | 574 | t->SetExpQ(TMath::Max(0.8*t->GetESDtrack()->GetTPCsignal(),30.)); |
e43c066c | 575 | |
576 | ResetTrackToFollow(*t); | |
577 | ||
9a5326b1 | 578 | // propagate to vertex [SR, GSI 17.02.2003] |
e43c066c | 579 | // Start Time measurement [SR, GSI 17.02.2003], corrected by I.Belikov |
e50912db | 580 | if (CorrectForPipeMaterial(&fTrackToFollow,"inward")) { |
581 | if (fTrackToFollow.PropagateToVertex(event->GetVertex())) | |
582 | fTrackToFollow.StartTimeIntegral(); | |
583 | // from vertex to outside pipe | |
584 | CorrectForPipeMaterial(&fTrackToFollow,"outward"); | |
e43c066c | 585 | } |
586 | ||
6c94f330 | 587 | fTrackToFollow.ResetCovariance(10.); fTrackToFollow.ResetClusters(); |
e50912db | 588 | if (RefitAt(AliITSRecoParam::GetrInsideITSscreen(),&fTrackToFollow,t)) { |
589 | if (!CorrectForTPCtoITSDeadZoneMaterial(&fTrackToFollow)) { | |
e43c066c | 590 | delete t; |
591 | continue; | |
592 | } | |
593 | fTrackToFollow.SetLabel(t->GetLabel()); | |
594 | //fTrackToFollow.CookdEdx(); | |
595 | CookLabel(&fTrackToFollow,0.); //For comparison only | |
596 | fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSout); | |
597 | //UseClusters(&fTrackToFollow); | |
598 | ntrk++; | |
599 | } | |
600 | delete t; | |
601 | } | |
602 | ||
603 | Info("PropagateBack","Number of back propagated ITS tracks: %d\n",ntrk); | |
604 | ||
e50912db | 605 | fTrackingPhase="Default"; |
606 | ||
e43c066c | 607 | return 0; |
608 | } | |
44347160 | 609 | //------------------------------------------------------------------------ |
af885e0f | 610 | Int_t AliITStrackerMI::RefitInward(AliESDEvent *event) { |
e43c066c | 611 | //-------------------------------------------------------------------- |
612 | // This functions refits ITS tracks using the | |
613 | // "inward propagated" TPC tracks | |
614 | // The clusters must be loaded ! | |
615 | //-------------------------------------------------------------------- | |
e50912db | 616 | fTrackingPhase="RefitInward"; |
afd25725 | 617 | if(AliITSReconstructor::GetRecoParam()->GetFindV0s()) RefitV02(event); |
e43c066c | 618 | Int_t nentr=event->GetNumberOfTracks(); |
619 | Info("RefitInward", "Number of ESD tracks: %d\n", nentr); | |
620 | ||
621 | Int_t ntrk=0; | |
622 | for (Int_t i=0; i<nentr; i++) { | |
623 | AliESDtrack *esd=event->GetTrack(i); | |
624 | ||
625 | if ((esd->GetStatus()&AliESDtrack::kITSout) == 0) continue; | |
626 | if (esd->GetStatus()&AliESDtrack::kITSrefit) continue; | |
627 | if (esd->GetStatus()&AliESDtrack::kTPCout) | |
628 | if ((esd->GetStatus()&AliESDtrack::kTPCrefit)==0) continue; | |
629 | ||
15dd636f | 630 | AliITStrackMI *t=0; |
e43c066c | 631 | try { |
15dd636f | 632 | t=new AliITStrackMI(*esd); |
e43c066c | 633 | } catch (const Char_t *msg) { |
628e7bb0 | 634 | //Warning("RefitInward",msg); |
e43c066c | 635 | delete t; |
636 | continue; | |
637 | } | |
b9671574 | 638 | t->SetExpQ(TMath::Max(0.8*t->GetESDtrack()->GetTPCsignal(),30.)); |
e50912db | 639 | if (!CorrectForTPCtoITSDeadZoneMaterial(t)) { |
e43c066c | 640 | delete t; |
641 | continue; | |
642 | } | |
643 | ||
644 | ResetTrackToFollow(*t); | |
645 | fTrackToFollow.ResetClusters(); | |
646 | ||
647 | if ((esd->GetStatus()&AliESDtrack::kTPCin)==0) | |
6c94f330 | 648 | fTrackToFollow.ResetCovariance(10.); |
e43c066c | 649 | |
650 | //Refitting... | |
7167ae53 | 651 | Bool_t pe=AliITSReconstructor::GetRecoParam()->GetComputePlaneEff(); |
652 | if (RefitAt(AliITSRecoParam::GetrInsideSPD1(),&fTrackToFollow,t,kTRUE,pe)) { | |
e43c066c | 653 | fTrackToFollow.SetLabel(t->GetLabel()); |
654 | // fTrackToFollow.CookdEdx(); | |
655 | CookdEdx(&fTrackToFollow); | |
656 | ||
657 | CookLabel(&fTrackToFollow,0.0); //For comparison only | |
658 | ||
9a5326b1 | 659 | //The beam pipe |
e50912db | 660 | if (CorrectForPipeMaterial(&fTrackToFollow,"inward")) { |
ae00569a | 661 | fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSrefit); |
9a5326b1 | 662 | AliESDtrack *esdTrack =fTrackToFollow.GetESDtrack(); |
ae00569a | 663 | //printf(" %d\n",esdTrack->GetITSModuleIndex(0)); |
664 | //esdTrack->UpdateTrackParams(&fTrackToFollow,AliESDtrack::kITSrefit); //original line | |
9a5326b1 | 665 | Float_t r[3]={0.,0.,0.}; |
666 | Double_t maxD=3.; | |
667 | esdTrack->RelateToVertex(event->GetVertex(),GetBz(r),maxD); | |
668 | ntrk++; | |
e43c066c | 669 | } |
670 | } | |
671 | delete t; | |
672 | } | |
673 | ||
674 | Info("RefitInward","Number of refitted tracks: %d\n",ntrk); | |
675 | ||
e50912db | 676 | fTrackingPhase="Default"; |
677 | ||
e43c066c | 678 | return 0; |
679 | } | |
44347160 | 680 | //------------------------------------------------------------------------ |
e43c066c | 681 | AliCluster *AliITStrackerMI::GetCluster(Int_t index) const { |
682 | //-------------------------------------------------------------------- | |
683 | // Return pointer to a given cluster | |
684 | //-------------------------------------------------------------------- | |
685 | Int_t l=(index & 0xf0000000) >> 28; | |
686 | Int_t c=(index & 0x0fffffff) >> 00; | |
687 | return fgLayers[l].GetCluster(c); | |
688 | } | |
9a5326b1 | 689 | //------------------------------------------------------------------------ |
df29e9a4 | 690 | Bool_t AliITStrackerMI::GetTrackPoint(Int_t index, AliTrackPoint& p) const { |
9a5326b1 | 691 | //-------------------------------------------------------------------- |
df29e9a4 | 692 | // Get track space point with index i |
9a5326b1 | 693 | //-------------------------------------------------------------------- |
60066577 | 694 | |
78b03929 | 695 | Int_t l=(index & 0xf0000000) >> 28; |
696 | Int_t c=(index & 0x0fffffff) >> 00; | |
00a7cc50 | 697 | AliITSRecPoint *cl = fgLayers[l].GetCluster(c); |
df29e9a4 | 698 | Int_t idet = cl->GetDetectorIndex(); |
4e65ff9e | 699 | |
60066577 | 700 | Float_t xyz[3]; |
701 | Float_t cov[6]; | |
702 | cl->GetGlobalXYZ(xyz); | |
703 | cl->GetGlobalCov(cov); | |
704 | p.SetXYZ(xyz, cov); | |
4e65ff9e | 705 | |
ae079791 | 706 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; |
df29e9a4 | 707 | switch (l) { |
708 | case 0: | |
ae079791 | 709 | iLayer = AliGeomManager::kSPD1; |
df29e9a4 | 710 | break; |
711 | case 1: | |
ae079791 | 712 | iLayer = AliGeomManager::kSPD2; |
df29e9a4 | 713 | break; |
714 | case 2: | |
ae079791 | 715 | iLayer = AliGeomManager::kSDD1; |
df29e9a4 | 716 | break; |
717 | case 3: | |
ae079791 | 718 | iLayer = AliGeomManager::kSDD2; |
9a5326b1 | 719 | break; |
720 | case 4: | |
721 | iLayer = AliGeomManager::kSSD1; | |
722 | break; | |
723 | case 5: | |
724 | iLayer = AliGeomManager::kSSD2; | |
725 | break; | |
726 | default: | |
727 | AliWarning(Form("Wrong layer index in ITS (%d) !",l)); | |
728 | break; | |
729 | }; | |
730 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,idet); | |
731 | p.SetVolumeID((UShort_t)volid); | |
732 | return kTRUE; | |
733 | } | |
734 | //------------------------------------------------------------------------ | |
735 | Bool_t AliITStrackerMI::GetTrackPointTrackingError(Int_t index, | |
736 | AliTrackPoint& p, const AliESDtrack *t) { | |
737 | //-------------------------------------------------------------------- | |
738 | // Get track space point with index i | |
739 | // (assign error estimated during the tracking) | |
740 | //-------------------------------------------------------------------- | |
741 | ||
742 | Int_t l=(index & 0xf0000000) >> 28; | |
743 | Int_t c=(index & 0x0fffffff) >> 00; | |
744 | const AliITSRecPoint *cl = fgLayers[l].GetCluster(c); | |
745 | Int_t idet = cl->GetDetectorIndex(); | |
746 | const AliITSdetector &det=fgLayers[l].GetDetector(idet); | |
747 | ||
748 | // tgphi and tglambda of the track in tracking frame with alpha=det.GetPhi | |
749 | Float_t detxy[2]; | |
750 | detxy[0] = det.GetR()*TMath::Cos(det.GetPhi()); | |
751 | detxy[1] = det.GetR()*TMath::Sin(det.GetPhi()); | |
752 | Double_t alpha = t->GetAlpha(); | |
753 | Double_t xdetintrackframe = detxy[0]*TMath::Cos(alpha)+detxy[1]*TMath::Sin(alpha); | |
754 | Float_t phi = TMath::ASin(t->GetSnpAt(xdetintrackframe,AliTracker::GetBz())); | |
755 | phi += alpha-det.GetPhi(); | |
756 | Float_t tgphi = TMath::Tan(phi); | |
757 | ||
758 | Float_t tgl = t->GetTgl(); // tgl about const along track | |
759 | Float_t expQ = TMath::Max(0.8*t->GetTPCsignal(),30.); | |
760 | ||
761 | Float_t errlocalx,errlocalz; | |
e50912db | 762 | AliITSClusterParam::GetError(l,cl,tgl,tgphi,expQ,errlocalx,errlocalz); |
9a5326b1 | 763 | |
764 | Float_t xyz[3]; | |
765 | Float_t cov[6]; | |
766 | cl->GetGlobalXYZ(xyz); | |
767 | // cl->GetGlobalCov(cov); | |
768 | Float_t pos[3] = {0.,0.,0.}; | |
769 | AliCluster tmpcl((UShort_t)cl->GetVolumeId(),pos[0],pos[1],pos[2],errlocalx*errlocalx,errlocalz*errlocalz,0); | |
770 | tmpcl.GetGlobalCov(cov); | |
771 | ||
772 | p.SetXYZ(xyz, cov); | |
773 | ||
774 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; | |
775 | switch (l) { | |
776 | case 0: | |
777 | iLayer = AliGeomManager::kSPD1; | |
778 | break; | |
779 | case 1: | |
780 | iLayer = AliGeomManager::kSPD2; | |
781 | break; | |
782 | case 2: | |
783 | iLayer = AliGeomManager::kSDD1; | |
784 | break; | |
785 | case 3: | |
786 | iLayer = AliGeomManager::kSDD2; | |
df29e9a4 | 787 | break; |
788 | case 4: | |
ae079791 | 789 | iLayer = AliGeomManager::kSSD1; |
df29e9a4 | 790 | break; |
791 | case 5: | |
ae079791 | 792 | iLayer = AliGeomManager::kSSD2; |
df29e9a4 | 793 | break; |
794 | default: | |
795 | AliWarning(Form("Wrong layer index in ITS (%d) !",l)); | |
796 | break; | |
797 | }; | |
ae079791 | 798 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,idet); |
df29e9a4 | 799 | p.SetVolumeID((UShort_t)volid); |
800 | return kTRUE; | |
801 | } | |
44347160 | 802 | //------------------------------------------------------------------------ |
81e97e0d | 803 | void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdindex, Bool_t constrain) |
e43c066c | 804 | { |
805 | //-------------------------------------------------------------------- | |
806 | // Follow prolongation tree | |
807 | //-------------------------------------------------------------------- | |
81e97e0d | 808 | // |
afd25725 | 809 | Double_t xyzVtx[]={GetX(),GetY(),GetZ()}; |
810 | Double_t ersVtx[]={GetSigmaX(),GetSigmaY(),GetSigmaZ()}; | |
811 | ||
2755f080 | 812 | |
b9671574 | 813 | AliESDtrack * esd = otrack->GetESDtrack(); |
afd25725 | 814 | if (esd->GetV0Index(0)>0) { |
81e97e0d | 815 | // TEMPORARY SOLLUTION: map V0 indexes to point to proper track |
afd25725 | 816 | // mapping of ESD track is different as ITS track in Containers |
81e97e0d | 817 | // Need something more stable |
44347160 | 818 | // Indexes are set back again to the ESD track indexes in UpdateTPCV0 |
81e97e0d | 819 | for (Int_t i=0;i<3;i++){ |
820 | Int_t index = esd->GetV0Index(i); | |
821 | if (index==0) break; | |
d6a49f20 | 822 | AliESDv0 * vertex = fEsd->GetV0(index); |
81e97e0d | 823 | if (vertex->GetStatus()<0) continue; // rejected V0 |
824 | // | |
afd25725 | 825 | if (esd->GetSign()>0) { |
826 | vertex->SetIndex(0,esdindex); | |
827 | } else { | |
828 | vertex->SetIndex(1,esdindex); | |
829 | } | |
81e97e0d | 830 | } |
831 | } | |
832 | TObjArray *bestarray = (TObjArray*)fBestHypothesys.At(esdindex); | |
833 | if (!bestarray){ | |
834 | bestarray = new TObjArray(5); | |
835 | fBestHypothesys.AddAt(bestarray,esdindex); | |
836 | } | |
e43c066c | 837 | |
81e97e0d | 838 | // |
e43c066c | 839 | //setup tree of the prolongations |
840 | // | |
15dd636f | 841 | static AliITStrackMI tracks[7][100]; |
842 | AliITStrackMI *currenttrack; | |
843 | static AliITStrackMI currenttrack1; | |
844 | static AliITStrackMI currenttrack2; | |
845 | static AliITStrackMI backuptrack; | |
e43c066c | 846 | Int_t ntracks[7]; |
847 | Int_t nindexes[7][100]; | |
848 | Float_t normalizedchi2[100]; | |
849 | for (Int_t ilayer=0;ilayer<6;ilayer++) ntracks[ilayer]=0; | |
b9671574 | 850 | otrack->SetNSkipped(0); |
15dd636f | 851 | new (&(tracks[6][0])) AliITStrackMI(*otrack); |
e43c066c | 852 | ntracks[6]=1; |
81e97e0d | 853 | for (Int_t i=0;i<7;i++) nindexes[i][0]=0; |
ae00569a | 854 | Int_t modstatus = 1; // found |
855 | Float_t xloc,zloc; | |
e43c066c | 856 | // |
857 | // | |
858 | // follow prolongations | |
e50912db | 859 | for (Int_t ilayer=5; ilayer>=0; ilayer--) { |
2755f080 | 860 | fI = ilayer; |
e43c066c | 861 | // |
2755f080 | 862 | AliITSlayer &layer=fgLayers[ilayer]; |
863 | Double_t r = layer.GetR(); | |
e43c066c | 864 | ntracks[ilayer]=0; |
865 | // | |
866 | // | |
2755f080 | 867 | Int_t nskipped=0; |
e43c066c | 868 | Float_t nused =0; |
e50912db | 869 | for (Int_t itrack =0; itrack<ntracks[ilayer+1]; itrack++) { |
e43c066c | 870 | //set current track |
871 | if (ntracks[ilayer]>=100) break; | |
b9671574 | 872 | if (tracks[ilayer+1][nindexes[ilayer+1][itrack]].GetNSkipped()>0) nskipped++; |
873 | if (tracks[ilayer+1][nindexes[ilayer+1][itrack]].GetNUsed()>2.) nused++; | |
e43c066c | 874 | if (ntracks[ilayer]>15+ilayer){ |
b9671574 | 875 | if (itrack>1&&tracks[ilayer+1][nindexes[ilayer+1][itrack]].GetNSkipped()>0 && nskipped>4+ilayer) continue; |
876 | if (itrack>1&&tracks[ilayer+1][nindexes[ilayer+1][itrack]].GetNUsed()>2. && nused>3) continue; | |
e43c066c | 877 | } |
878 | ||
15dd636f | 879 | new(¤ttrack1) AliITStrackMI(tracks[ilayer+1][nindexes[ilayer+1][itrack]]); |
44347160 | 880 | |
afd25725 | 881 | // material between SSD and SDD, SDD and SPD |
e50912db | 882 | if (ilayer==3) |
883 | if(!CorrectForShieldMaterial(¤ttrack1,"SDD","inward")) continue; | |
884 | if (ilayer==1) | |
885 | if(!CorrectForShieldMaterial(¤ttrack1,"SPD","inward")) continue; | |
8602c008 | 886 | |
2755f080 | 887 | // detector number |
8602c008 | 888 | Double_t phi,z; |
889 | if (!currenttrack1.GetPhiZat(r,phi,z)) continue; | |
e43c066c | 890 | Int_t idet=layer.FindDetectorIndex(phi,z); |
e50912db | 891 | |
892 | Double_t trackGlobXYZ1[3]; | |
893 | currenttrack1.GetXYZ(trackGlobXYZ1); | |
894 | ||
2755f080 | 895 | // Get the budget to the primary vertex for the current track being prolonged |
896 | Double_t budgetToPrimVertex = GetEffectiveThickness(); | |
897 | ||
898 | // check if we allow a prolongation without point | |
6518a6c5 | 899 | Int_t skip = CheckSkipLayer(¤ttrack1,ilayer,idet); |
2755f080 | 900 | if (skip) { |
901 | AliITStrackMI* vtrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(currenttrack1); | |
6518a6c5 | 902 | // propagate to the layer radius |
903 | Double_t xToGo; vtrack->GetLocalXat(r,xToGo); | |
904 | vtrack->AliExternalTrackParam::PropagateTo(xToGo,GetBz()); | |
2755f080 | 905 | // apply correction for material of the current layer |
906 | CorrectForLayerMaterial(vtrack,ilayer,trackGlobXYZ1,"inward"); | |
907 | vtrack->SetNDeadZone(vtrack->GetNDeadZone()+1); | |
908 | vtrack->SetClIndex(ilayer,0); | |
ae00569a | 909 | modstatus = (skip==1 ? 3 : 4); // skipped : out in z |
910 | LocalModuleCoord(ilayer,idet,vtrack,xloc,zloc); // local module coords | |
911 | vtrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc); | |
2755f080 | 912 | if(constrain) vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx); |
913 | ntracks[ilayer]++; | |
6518a6c5 | 914 | continue; |
2755f080 | 915 | } |
916 | ||
917 | // track outside layer acceptance in z | |
918 | if (idet<0) continue; | |
919 | ||
920 | //propagate to the intersection with the detector plane | |
921 | const AliITSdetector &det=layer.GetDetector(idet); | |
922 | new(¤ttrack2) AliITStrackMI(currenttrack1); | |
44347160 | 923 | if (!currenttrack1.Propagate(det.GetPhi(),det.GetR())) continue; |
ae00569a | 924 | LocalModuleCoord(ilayer,idet,¤ttrack1,xloc,zloc); // local module coords |
44347160 | 925 | currenttrack2.Propagate(det.GetPhi(),det.GetR()); |
e43c066c | 926 | currenttrack1.SetDetectorIndex(idet); |
927 | currenttrack2.SetDetectorIndex(idet); | |
6518a6c5 | 928 | |
afd25725 | 929 | //*************** |
930 | // DEFINITION OF SEARCH ROAD FOR CLUSTERS SELECTION | |
e43c066c | 931 | // |
44347160 | 932 | Double_t dz=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadZ()* |
933 | TMath::Sqrt(currenttrack1.GetSigmaZ2() + | |
934 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
935 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
936 | AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer)); | |
937 | Double_t dy=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadY()* | |
938 | TMath::Sqrt(currenttrack1.GetSigmaY2() + | |
939 | AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()* | |
940 | AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()* | |
941 | AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer)); | |
afd25725 | 942 | |
44347160 | 943 | // track at boundary between detectors, enlarge road |
e50912db | 944 | Double_t boundaryWidth=AliITSRecoParam::GetBoundaryWidth(); |
945 | if ( (currenttrack1.GetY()-dy < det.GetYmin()+boundaryWidth) || | |
946 | (currenttrack1.GetY()+dy > det.GetYmax()-boundaryWidth) || | |
947 | (currenttrack1.GetZ()-dz < det.GetZmin()+boundaryWidth) || | |
948 | (currenttrack1.GetZ()+dz > det.GetZmax()-boundaryWidth) ) { | |
afd25725 | 949 | Float_t tgl = TMath::Abs(currenttrack1.GetTgl()); |
950 | if (tgl > 1.) tgl=1.; | |
e50912db | 951 | Double_t deltaXNeighbDets=AliITSRecoParam::GetDeltaXNeighbDets(); |
952 | dz = TMath::Sqrt(dz*dz+deltaXNeighbDets*deltaXNeighbDets*tgl*tgl); | |
afd25725 | 953 | Float_t snp = TMath::Abs(currenttrack1.GetSnp()); |
954 | if (snp > AliITSReconstructor::GetRecoParam()->GetMaxSnp()) continue; | |
e50912db | 955 | dy = TMath::Sqrt(dy*dy+deltaXNeighbDets*deltaXNeighbDets*snp*snp); |
44347160 | 956 | } // boundary |
e43c066c | 957 | |
2755f080 | 958 | // road in global (rphi,z) [i.e. in tracking ref. system] |
44347160 | 959 | Double_t zmin = currenttrack1.GetZ() - dz; |
960 | Double_t zmax = currenttrack1.GetZ() + dz; | |
961 | Double_t ymin = currenttrack1.GetY() + r*det.GetPhi() - dy; | |
962 | Double_t ymax = currenttrack1.GetY() + r*det.GetPhi() + dy; | |
2755f080 | 963 | |
afd25725 | 964 | // select clusters in road |
e43c066c | 965 | layer.SelectClusters(zmin,zmax,ymin,ymax); |
afd25725 | 966 | //******************** |
44347160 | 967 | |
afd25725 | 968 | // Define criteria for track-cluster association |
44347160 | 969 | Double_t msz = currenttrack1.GetSigmaZ2() + |
970 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
971 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
972 | AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer); | |
973 | Double_t msy = currenttrack1.GetSigmaY2() + | |
974 | AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()* | |
975 | AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()* | |
976 | AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer); | |
977 | if (constrain) { | |
978 | msz *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadZC(); | |
979 | msy *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadYC(); | |
980 | } else { | |
981 | msz *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadZNonC(); | |
982 | msy *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadYNonC(); | |
983 | } | |
984 | msz = 1./msz; // 1/RoadZ^2 | |
985 | msy = 1./msy; // 1/RoadY^2 | |
e43c066c | 986 | // |
e43c066c | 987 | // |
afd25725 | 988 | // LOOP OVER ALL POSSIBLE TRACK PROLONGATIONS ON THIS LAYER |
e43c066c | 989 | // |
afd25725 | 990 | const AliITSRecPoint *cl=0; |
991 | Int_t clidx=-1; | |
992 | Double_t chi2trkcl=AliITSReconstructor::GetRecoParam()->GetMaxChi2(); // init with big value | |
6518a6c5 | 993 | Bool_t deadzoneSPD=kFALSE; |
e43c066c | 994 | currenttrack = ¤ttrack1; |
6518a6c5 | 995 | |
ae00569a | 996 | // check if the road contains a dead zone |
997 | Int_t dead = CheckDeadZone(ilayer,idet,zmin,zmax); | |
998 | // create a prolongation without clusters (check also if there are no clusters in the road) | |
999 | if (dead || | |
1000 | ((layer.GetNextCluster(clidx,kTRUE))==0 && | |
1001 | AliITSReconstructor::GetRecoParam()->GetAllowProlongationWithEmptyRoad())) { | |
6518a6c5 | 1002 | AliITStrackMI * updatetrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(*currenttrack); |
1003 | updatetrack->SetClIndex(ilayer,0); | |
ae00569a | 1004 | if (dead==0) { |
1005 | modstatus = 5; // no cls in road | |
1006 | } else if (dead==1) { | |
1007 | modstatus = 7; // holes in z in SPD | |
1008 | } else if (dead==2) { | |
1009 | modstatus = 2; // dead from OCDB | |
1010 | } | |
1011 | updatetrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc); | |
6518a6c5 | 1012 | // apply correction for material of the current layer |
1013 | CorrectForLayerMaterial(updatetrack,ilayer,trackGlobXYZ1,"inward"); | |
1014 | if (constrain) { // apply vertex constrain | |
1015 | updatetrack->SetConstrain(constrain); | |
1016 | Bool_t isPrim = kTRUE; | |
1017 | if (ilayer<4) { // check that it's close to the vertex | |
1018 | updatetrack->GetDZ(GetX(),GetY(),GetZ(),updatetrack->GetDP()); //I.B. | |
1019 | if (TMath::Abs(updatetrack->GetD(0)/(1.+ilayer)) > // y | |
1020 | AliITSReconstructor::GetRecoParam()->GetMaxDZforPrimTrk() || | |
1021 | TMath::Abs(updatetrack->GetD(1)/(1.+ilayer)) > // z | |
1022 | AliITSReconstructor::GetRecoParam()->GetMaxDZforPrimTrk()) isPrim=kFALSE; | |
1023 | } | |
1024 | if (isPrim) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx); | |
1025 | } | |
ae00569a | 1026 | if (dead) { |
1027 | updatetrack->SetNDeadZone(updatetrack->GetNDeadZone()+1); | |
1028 | if (dead==1) { // dead zone at z=0,+-7cm in SPD | |
1029 | updatetrack->SetDeadZoneProbability(GetSPDDeadZoneProbability(updatetrack->GetZ(),TMath::Sqrt(updatetrack->GetSigmaZ2()))); | |
1030 | deadzoneSPD=kTRUE; | |
1031 | } | |
6518a6c5 | 1032 | } |
1033 | ntracks[ilayer]++; | |
1034 | } | |
1035 | ||
ae00569a | 1036 | clidx=-1; |
6518a6c5 | 1037 | // loop over clusters in the road |
afd25725 | 1038 | while ((cl=layer.GetNextCluster(clidx))!=0) { |
e43c066c | 1039 | if (ntracks[ilayer]>95) break; //space for skipped clusters |
afd25725 | 1040 | Bool_t changedet =kFALSE; |
6518a6c5 | 1041 | if (cl->GetQ()==0 && deadzoneSPD==kTRUE) continue; |
afd25725 | 1042 | Int_t idet=cl->GetDetectorIndex(); |
1043 | ||
1044 | if (currenttrack->GetDetectorIndex()==idet) { // track already on the cluster's detector | |
1045 | // a first cut on track-cluster distance | |
1046 | if ( (currenttrack->GetZ()-cl->GetZ())*(currenttrack->GetZ()-cl->GetZ())*msz + | |
1047 | (currenttrack->GetY()-cl->GetY())*(currenttrack->GetY()-cl->GetY())*msy > 1. ) | |
1048 | continue; // cluster not associated to track | |
1049 | } else { // have to move track to cluster's detector | |
e43c066c | 1050 | const AliITSdetector &det=layer.GetDetector(idet); |
afd25725 | 1051 | // a first cut on track-cluster distance |
e43c066c | 1052 | Double_t y,z; |
1053 | if (!currenttrack2.GetProlongationFast(det.GetPhi(),det.GetR(),y,z)) continue; | |
afd25725 | 1054 | if ( (z-cl->GetZ())*(z-cl->GetZ())*msz + |
1055 | (y-cl->GetY())*(y-cl->GetY())*msy > 1. ) | |
44347160 | 1056 | continue; // cluster not associated to track |
e43c066c | 1057 | // |
15dd636f | 1058 | new (&backuptrack) AliITStrackMI(currenttrack2); |
afd25725 | 1059 | changedet = kTRUE; |
e43c066c | 1060 | currenttrack =¤ttrack2; |
1061 | if (!currenttrack->Propagate(det.GetPhi(),det.GetR())) { | |
15dd636f | 1062 | new (currenttrack) AliITStrackMI(backuptrack); |
afd25725 | 1063 | changedet = kFALSE; |
e43c066c | 1064 | continue; |
1065 | } | |
1066 | currenttrack->SetDetectorIndex(idet); | |
e50912db | 1067 | // Get again the budget to the primary vertex |
1068 | // for the current track being prolonged, if had to change detector | |
1069 | //budgetToPrimVertex = GetEffectiveThickness();// not needed at the moment because anyway we take a mean material for this correction | |
e43c066c | 1070 | } |
1071 | ||
afd25725 | 1072 | // calculate track-clusters chi2 |
1073 | chi2trkcl = GetPredictedChi2MI(currenttrack,cl,ilayer); | |
1074 | // chi2 cut | |
1075 | if (chi2trkcl < AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer)) { | |
6518a6c5 | 1076 | if (cl->GetQ()==0) deadzoneSPD=kTRUE; // only 1 prolongation with virtual cluster |
e43c066c | 1077 | if (ntracks[ilayer]>=100) continue; |
15dd636f | 1078 | AliITStrackMI * updatetrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(*currenttrack); |
b9671574 | 1079 | updatetrack->SetClIndex(ilayer,0); |
afd25725 | 1080 | if (changedet) new (¤ttrack2) AliITStrackMI(backuptrack); |
ae00569a | 1081 | |
6518a6c5 | 1082 | if (cl->GetQ()!=0) { // real cluster |
afd25725 | 1083 | if (!UpdateMI(updatetrack,cl,chi2trkcl,(ilayer<<28)+clidx)) continue; |
1084 | updatetrack->SetSampledEdx(cl->GetQ(),updatetrack->GetNumberOfClusters()-1); //b.b. | |
ae00569a | 1085 | modstatus = 1; // found |
6518a6c5 | 1086 | } else { // virtual cluster in dead zone |
b9671574 | 1087 | updatetrack->SetNDeadZone(updatetrack->GetNDeadZone()+1); |
6518a6c5 | 1088 | updatetrack->SetDeadZoneProbability(GetSPDDeadZoneProbability(updatetrack->GetZ(),TMath::Sqrt(updatetrack->GetSigmaZ2()))); |
ae00569a | 1089 | modstatus = 7; // holes in z in SPD |
1090 | } | |
1091 | ||
1092 | if (changedet) { | |
1093 | Float_t xlocnewdet,zlocnewdet; | |
1094 | LocalModuleCoord(ilayer,idet,updatetrack,xlocnewdet,zlocnewdet); // local module coords | |
1095 | updatetrack->SetModuleIndexInfo(ilayer,idet,modstatus,xlocnewdet,zlocnewdet); | |
1096 | } else { | |
1097 | updatetrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc); | |
e43c066c | 1098 | } |
afd25725 | 1099 | if (cl->IsUsed()) updatetrack->IncrementNUsed(); |
1100 | ||
1101 | // apply correction for material of the current layer | |
e50912db | 1102 | CorrectForLayerMaterial(updatetrack,ilayer,trackGlobXYZ1,"inward"); |
1103 | ||
afd25725 | 1104 | if (constrain) { // apply vertex constrain |
b9671574 | 1105 | updatetrack->SetConstrain(constrain); |
e43c066c | 1106 | Bool_t isPrim = kTRUE; |
afd25725 | 1107 | if (ilayer<4) { // check that it's close to the vertex |
b9671574 | 1108 | updatetrack->GetDZ(GetX(),GetY(),GetZ(),updatetrack->GetDP()); //I.B. |
afd25725 | 1109 | if (TMath::Abs(updatetrack->GetD(0)/(1.+ilayer)) > // y |
1110 | AliITSReconstructor::GetRecoParam()->GetMaxDZforPrimTrk() || | |
1111 | TMath::Abs(updatetrack->GetD(1)/(1.+ilayer)) > // z | |
1112 | AliITSReconstructor::GetRecoParam()->GetMaxDZforPrimTrk()) isPrim=kFALSE; | |
e43c066c | 1113 | } |
afd25725 | 1114 | if (isPrim) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx); |
e43c066c | 1115 | } //apply vertex constrain |
1116 | ntracks[ilayer]++; | |
afd25725 | 1117 | } // create new hypothesis |
2755f080 | 1118 | } // loop over possible prolongations |
1119 | ||
1120 | // allow one prolongation without clusters | |
6518a6c5 | 1121 | if (constrain && itrack<=1 && currenttrack1.GetNSkipped()==0 && deadzoneSPD==kFALSE && ntracks[ilayer]<100) { |
15dd636f | 1122 | AliITStrackMI* vtrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(currenttrack1); |
2755f080 | 1123 | // apply correction for material of the current layer |
1124 | CorrectForLayerMaterial(vtrack,ilayer,trackGlobXYZ1,"inward"); | |
b9671574 | 1125 | vtrack->SetClIndex(ilayer,0); |
ae00569a | 1126 | modstatus = 3; // skipped |
1127 | vtrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc); | |
afd25725 | 1128 | vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx); |
b9671574 | 1129 | vtrack->IncrementNSkipped(); |
e43c066c | 1130 | ntracks[ilayer]++; |
1131 | } | |
628e7bb0 | 1132 | |
2755f080 | 1133 | // allow one prolongation without clusters for tracks with |tgl|>1.1 |
1134 | if (constrain && itrack==0 && TMath::Abs(currenttrack1.GetTgl())>1.1) { //big theta - for low flux | |
628e7bb0 | 1135 | AliITStrackMI* vtrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(currenttrack1); |
2755f080 | 1136 | // apply correction for material of the current layer |
1137 | CorrectForLayerMaterial(vtrack,ilayer,trackGlobXYZ1,"inward"); | |
b9671574 | 1138 | vtrack->SetClIndex(ilayer,0); |
ae00569a | 1139 | modstatus = 3; // skipped |
1140 | vtrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc); | |
afd25725 | 1141 | vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx); |
b9671574 | 1142 | vtrack->SetNDeadZone(vtrack->GetNDeadZone()+1); |
628e7bb0 | 1143 | ntracks[ilayer]++; |
1144 | } | |
1145 | ||
e43c066c | 1146 | |
e50912db | 1147 | } // loop over tracks in layer ilayer+1 |
afd25725 | 1148 | |
1149 | //loop over track candidates for the current layer | |
e43c066c | 1150 | // |
1151 | // | |
1152 | Int_t accepted=0; | |
1153 | ||
afd25725 | 1154 | Int_t golden=0; |
e43c066c | 1155 | for (Int_t itrack=0;itrack<ntracks[ilayer];itrack++){ |
1156 | normalizedchi2[itrack] = NormalizedChi2(&tracks[ilayer][itrack],ilayer); | |
afd25725 | 1157 | if (normalizedchi2[itrack] < |
1158 | AliITSReconstructor::GetRecoParam()->GetMaxNormChi2ForGolden(ilayer)) golden++; | |
44347160 | 1159 | if (ilayer>4) { |
1160 | accepted++; | |
1161 | } else { | |
1162 | if (constrain) { // constrain | |
afd25725 | 1163 | if (normalizedchi2[itrack]<AliITSReconstructor::GetRecoParam()->GetMaxNormChi2C(ilayer)+1) |
1164 | accepted++; | |
44347160 | 1165 | } else { // !constrain |
afd25725 | 1166 | if (normalizedchi2[itrack]<AliITSReconstructor::GetRecoParam()->GetMaxNormChi2NonC(ilayer)+1) |
1167 | accepted++; | |
44347160 | 1168 | } |
e43c066c | 1169 | } |
1170 | } | |
afd25725 | 1171 | // sort tracks by increasing normalized chi2 |
1172 | TMath::Sort(ntracks[ilayer],normalizedchi2,nindexes[ilayer],kFALSE); | |
e43c066c | 1173 | ntracks[ilayer] = TMath::Min(accepted,7+2*ilayer); |
afd25725 | 1174 | if (ntracks[ilayer]<golden+2+ilayer) ntracks[ilayer]=TMath::Min(golden+2+ilayer,accepted); |
e43c066c | 1175 | if (ntracks[ilayer]>90) ntracks[ilayer]=90; |
afd25725 | 1176 | } // end loop over layers |
1177 | ||
afd25725 | 1178 | |
1179 | // | |
1180 | // Now select tracks to be kept | |
1181 | // | |
44347160 | 1182 | Int_t max = constrain ? 20 : 5; |
e43c066c | 1183 | |
afd25725 | 1184 | // tracks that reach layer 0 (SPD inner) |
44347160 | 1185 | for (Int_t i=0; i<TMath::Min(max,ntracks[0]); i++) { |
15dd636f | 1186 | AliITStrackMI & track= tracks[0][nindexes[0][i]]; |
628e7bb0 | 1187 | if (track.GetNumberOfClusters()<2) continue; |
afd25725 | 1188 | if (!constrain && track.GetNormChi2(0) > |
6518a6c5 | 1189 | AliITSReconstructor::GetRecoParam()->GetMaxNormChi2NonCForHypothesis()) { |
1190 | continue; | |
1191 | } | |
15dd636f | 1192 | AddTrackHypothesys(new AliITStrackMI(track), esdindex); |
e43c066c | 1193 | } |
afd25725 | 1194 | |
1195 | // tracks that reach layer 1 (SPD outer) | |
628e7bb0 | 1196 | for (Int_t i=0;i<TMath::Min(2,ntracks[1]);i++) { |
15dd636f | 1197 | AliITStrackMI & track= tracks[1][nindexes[1][i]]; |
e43c066c | 1198 | if (track.GetNumberOfClusters()<4) continue; |
afd25725 | 1199 | if (!constrain && track.GetNormChi2(1) > |
1200 | AliITSReconstructor::GetRecoParam()->GetMaxNormChi2NonCForHypothesis()) continue; | |
b9671574 | 1201 | if (constrain) track.IncrementNSkipped(); |
81e97e0d | 1202 | if (!constrain) { |
b9671574 | 1203 | track.SetD(0,track.GetD(GetX(),GetY())); |
afd25725 | 1204 | track.SetNSkipped(track.GetNSkipped()+4./(4.+8.*TMath::Abs(track.GetD(0)))); |
b9671574 | 1205 | if (track.GetNumberOfClusters()+track.GetNDeadZone()+track.GetNSkipped()>6) { |
1206 | track.SetNSkipped(6-track.GetNumberOfClusters()+track.GetNDeadZone()); | |
e43c066c | 1207 | } |
1208 | } | |
15dd636f | 1209 | AddTrackHypothesys(new AliITStrackMI(track), esdindex); |
e43c066c | 1210 | } |
afd25725 | 1211 | |
6518a6c5 | 1212 | // tracks that reach layer 2 (SDD inner), only during non-constrained pass |
81e97e0d | 1213 | if (!constrain){ |
628e7bb0 | 1214 | for (Int_t i=0;i<TMath::Min(2,ntracks[2]);i++) { |
15dd636f | 1215 | AliITStrackMI & track= tracks[2][nindexes[2][i]]; |
628e7bb0 | 1216 | if (track.GetNumberOfClusters()<3) continue; |
afd25725 | 1217 | if (!constrain && track.GetNormChi2(2) > |
1218 | AliITSReconstructor::GetRecoParam()->GetMaxNormChi2NonCForHypothesis()) continue; | |
b9671574 | 1219 | if (constrain) track.SetNSkipped(track.GetNSkipped()+2); |
81e97e0d | 1220 | if (!constrain){ |
b9671574 | 1221 | track.SetD(0,track.GetD(GetX(),GetY())); |
afd25725 | 1222 | track.SetNSkipped(track.GetNSkipped()+7./(7.+8.*TMath::Abs(track.GetD(0)))); |
b9671574 | 1223 | if (track.GetNumberOfClusters()+track.GetNDeadZone()+track.GetNSkipped()>6) { |
1224 | track.SetNSkipped(6-track.GetNumberOfClusters()+track.GetNDeadZone()); | |
e43c066c | 1225 | } |
1226 | } | |
15dd636f | 1227 | AddTrackHypothesys(new AliITStrackMI(track), esdindex); |
e43c066c | 1228 | } |
1229 | } | |
81e97e0d | 1230 | |
afd25725 | 1231 | if (!constrain) { |
81e97e0d | 1232 | // |
afd25725 | 1233 | // register best track of each layer - important for V0 finder |
81e97e0d | 1234 | // |
1235 | for (Int_t ilayer=0;ilayer<5;ilayer++){ | |
1236 | if (ntracks[ilayer]==0) continue; | |
1237 | AliITStrackMI & track= tracks[ilayer][nindexes[ilayer][0]]; | |
1238 | if (track.GetNumberOfClusters()<1) continue; | |
1239 | CookLabel(&track,0); | |
1240 | bestarray->AddAt(new AliITStrackMI(track),ilayer); | |
1241 | } | |
1242 | } | |
1243 | // | |
1244 | // update TPC V0 information | |
1245 | // | |
b9671574 | 1246 | if (otrack->GetESDtrack()->GetV0Index(0)>0){ |
81e97e0d | 1247 | Float_t fprimvertex[3]={GetX(),GetY(),GetZ()}; |
1248 | for (Int_t i=0;i<3;i++){ | |
b9671574 | 1249 | Int_t index = otrack->GetESDtrack()->GetV0Index(i); |
81e97e0d | 1250 | if (index==0) break; |
44347160 | 1251 | AliV0 *vertex = (AliV0*)fEsd->GetV0(index); |
81e97e0d | 1252 | if (vertex->GetStatus()<0) continue; // rejected V0 |
1253 | // | |
6c94f330 | 1254 | if (otrack->GetSign()>0) { |
81e97e0d | 1255 | vertex->SetIndex(0,esdindex); |
1256 | } | |
1257 | else{ | |
1258 | vertex->SetIndex(1,esdindex); | |
1259 | } | |
1260 | //find nearest layer with track info | |
b75d63a7 | 1261 | Double_t xrp[3]; vertex->GetXYZ(xrp[0],xrp[1],xrp[2]); //I.B. |
1262 | Int_t nearestold = GetNearestLayer(xrp); //I.B. | |
81e97e0d | 1263 | Int_t nearest = nearestold; |
1264 | for (Int_t ilayer =nearest;ilayer<8;ilayer++){ | |
1265 | if (ntracks[nearest]==0){ | |
1266 | nearest = ilayer; | |
1267 | } | |
1268 | } | |
1269 | // | |
1270 | AliITStrackMI & track= tracks[nearest][nindexes[nearest][0]]; | |
1271 | if (nearestold<5&&nearest<5){ | |
b9671574 | 1272 | Bool_t accept = track.GetNormChi2(nearest)<10; |
81e97e0d | 1273 | if (accept){ |
6c94f330 | 1274 | if (track.GetSign()>0) { |
b75d63a7 | 1275 | vertex->SetParamP(track); |
81e97e0d | 1276 | vertex->Update(fprimvertex); |
44347160 | 1277 | //vertex->SetIndex(0,track.fESDtrack->GetID()); |
81e97e0d | 1278 | if (track.GetNumberOfClusters()>2) AddTrackHypothesys(new AliITStrackMI(track), esdindex); |
1279 | }else{ | |
b75d63a7 | 1280 | vertex->SetParamN(track); |
81e97e0d | 1281 | vertex->Update(fprimvertex); |
1282 | //vertex->SetIndex(1,track.fESDtrack->GetID()); | |
1283 | if (track.GetNumberOfClusters()>2) AddTrackHypothesys(new AliITStrackMI(track), esdindex); | |
1284 | } | |
1285 | vertex->SetStatus(vertex->GetStatus()+1); | |
1286 | }else{ | |
44347160 | 1287 | //vertex->SetStatus(-2); // reject V0 - not enough clusters |
81e97e0d | 1288 | } |
1289 | } | |
81e97e0d | 1290 | } |
afd25725 | 1291 | } |
1292 | ||
e43c066c | 1293 | } |
44347160 | 1294 | //------------------------------------------------------------------------ |
e43c066c | 1295 | AliITStrackerMI::AliITSlayer & AliITStrackerMI::GetLayer(Int_t layer) const |
1296 | { | |
1297 | //-------------------------------------------------------------------- | |
1298 | // | |
1299 | // | |
1300 | return fgLayers[layer]; | |
1301 | } | |
44347160 | 1302 | //------------------------------------------------------------------------ |
8221b41b | 1303 | AliITStrackerMI::AliITSlayer::AliITSlayer(): |
1304 | fR(0), | |
1305 | fPhiOffset(0), | |
1306 | fNladders(0), | |
1307 | fZOffset(0), | |
1308 | fNdetectors(0), | |
1309 | fDetectors(0), | |
1310 | fN(0), | |
1311 | fDy5(0), | |
1312 | fDy10(0), | |
1313 | fDy20(0), | |
1314 | fClustersCs(0), | |
1315 | fClusterIndexCs(0), | |
1316 | fYcs(0), | |
1317 | fZcs(0), | |
1318 | fNcs(0), | |
1319 | fCurrentSlice(-1), | |
1320 | fZmax(0), | |
1321 | fYmin(0), | |
1322 | fYmax(0), | |
1323 | fI(0), | |
1324 | fImax(0), | |
1325 | fSkip(0), | |
1326 | fAccepted(0), | |
1327 | fRoad(0){ | |
e43c066c | 1328 | //-------------------------------------------------------------------- |
1329 | //default AliITSlayer constructor | |
1330 | //-------------------------------------------------------------------- | |
e50912db | 1331 | for (Int_t i=0; i<AliITSRecoParam::GetMaxClusterPerLayer(); i++) { |
e43c066c | 1332 | fClusterWeight[i]=0; |
1333 | fClusterTracks[0][i]=-1; | |
1334 | fClusterTracks[1][i]=-1; | |
1335 | fClusterTracks[2][i]=-1; | |
1336 | fClusterTracks[3][i]=-1; | |
1337 | } | |
1338 | } | |
44347160 | 1339 | //------------------------------------------------------------------------ |
e43c066c | 1340 | AliITStrackerMI::AliITSlayer:: |
8221b41b | 1341 | AliITSlayer(Double_t r,Double_t p,Double_t z,Int_t nl,Int_t nd): |
1342 | fR(r), | |
1343 | fPhiOffset(p), | |
1344 | fNladders(nl), | |
1345 | fZOffset(z), | |
1346 | fNdetectors(nd), | |
1347 | fDetectors(0), | |
1348 | fN(0), | |
1349 | fDy5(0), | |
1350 | fDy10(0), | |
1351 | fDy20(0), | |
1352 | fClustersCs(0), | |
1353 | fClusterIndexCs(0), | |
1354 | fYcs(0), | |
1355 | fZcs(0), | |
1356 | fNcs(0), | |
1357 | fCurrentSlice(-1), | |
1358 | fZmax(0), | |
1359 | fYmin(0), | |
1360 | fYmax(0), | |
1361 | fI(0), | |
1362 | fImax(0), | |
1363 | fSkip(0), | |
1364 | fAccepted(0), | |
1365 | fRoad(0) { | |
e43c066c | 1366 | //-------------------------------------------------------------------- |
1367 | //main AliITSlayer constructor | |
1368 | //-------------------------------------------------------------------- | |
e43c066c | 1369 | fDetectors=new AliITSdetector[fNladders*fNdetectors]; |
afd25725 | 1370 | fRoad=2*fR*TMath::Sqrt(TMath::Pi()/1.);//assuming that there's only one cluster |
e43c066c | 1371 | } |
44347160 | 1372 | //------------------------------------------------------------------------ |
8221b41b | 1373 | AliITStrackerMI::AliITSlayer::AliITSlayer(const AliITSlayer& layer): |
1374 | fR(layer.fR), | |
1375 | fPhiOffset(layer.fPhiOffset), | |
1376 | fNladders(layer.fNladders), | |
1377 | fZOffset(layer.fZOffset), | |
1378 | fNdetectors(layer.fNdetectors), | |
1379 | fDetectors(layer.fDetectors), | |
1380 | fN(layer.fN), | |
1381 | fDy5(layer.fDy5), | |
1382 | fDy10(layer.fDy10), | |
1383 | fDy20(layer.fDy20), | |
1384 | fClustersCs(layer.fClustersCs), | |
1385 | fClusterIndexCs(layer.fClusterIndexCs), | |
1386 | fYcs(layer.fYcs), | |
1387 | fZcs(layer.fZcs), | |
1388 | fNcs(layer.fNcs), | |
1389 | fCurrentSlice(layer.fCurrentSlice), | |
1390 | fZmax(layer.fZmax), | |
1391 | fYmin(layer.fYmin), | |
1392 | fYmax(layer.fYmax), | |
1393 | fI(layer.fI), | |
1394 | fImax(layer.fImax), | |
1395 | fSkip(layer.fSkip), | |
1396 | fAccepted(layer.fAccepted), | |
1397 | fRoad(layer.fRoad){ | |
1398 | //Copy constructor | |
1399 | } | |
44347160 | 1400 | //------------------------------------------------------------------------ |
e43c066c | 1401 | AliITStrackerMI::AliITSlayer::~AliITSlayer() { |
1402 | //-------------------------------------------------------------------- | |
1403 | // AliITSlayer destructor | |
1404 | //-------------------------------------------------------------------- | |
1405 | delete[] fDetectors; | |
1406 | for (Int_t i=0; i<fN; i++) delete fClusters[i]; | |
e50912db | 1407 | for (Int_t i=0; i<AliITSRecoParam::GetMaxClusterPerLayer(); i++) { |
e43c066c | 1408 | fClusterWeight[i]=0; |
1409 | fClusterTracks[0][i]=-1; | |
1410 | fClusterTracks[1][i]=-1; | |
1411 | fClusterTracks[2][i]=-1; | |
1412 | fClusterTracks[3][i]=-1; | |
1413 | } | |
1414 | } | |
44347160 | 1415 | //------------------------------------------------------------------------ |
e43c066c | 1416 | void AliITStrackerMI::AliITSlayer::ResetClusters() { |
1417 | //-------------------------------------------------------------------- | |
1418 | // This function removes loaded clusters | |
1419 | //-------------------------------------------------------------------- | |
1420 | for (Int_t i=0; i<fN; i++) delete fClusters[i]; | |
e50912db | 1421 | for (Int_t i=0; i<AliITSRecoParam::GetMaxClusterPerLayer(); i++){ |
e43c066c | 1422 | fClusterWeight[i]=0; |
1423 | fClusterTracks[0][i]=-1; | |
1424 | fClusterTracks[1][i]=-1; | |
1425 | fClusterTracks[2][i]=-1; | |
1426 | fClusterTracks[3][i]=-1; | |
1427 | } | |
1428 | ||
1429 | fN=0; | |
1430 | fI=0; | |
1431 | } | |
44347160 | 1432 | //------------------------------------------------------------------------ |
e43c066c | 1433 | void AliITStrackerMI::AliITSlayer::ResetWeights() { |
1434 | //-------------------------------------------------------------------- | |
1435 | // This function reset weights of the clusters | |
1436 | //-------------------------------------------------------------------- | |
e50912db | 1437 | for (Int_t i=0; i<AliITSRecoParam::GetMaxClusterPerLayer(); i++) { |
e43c066c | 1438 | fClusterWeight[i]=0; |
1439 | fClusterTracks[0][i]=-1; | |
1440 | fClusterTracks[1][i]=-1; | |
1441 | fClusterTracks[2][i]=-1; | |
1442 | fClusterTracks[3][i]=-1; | |
1443 | } | |
1444 | for (Int_t i=0; i<fN;i++) { | |
00a7cc50 | 1445 | AliITSRecPoint * cl = (AliITSRecPoint*)GetCluster(i); |
e43c066c | 1446 | if (cl&&cl->IsUsed()) cl->Use(); |
1447 | } | |
1448 | ||
1449 | } | |
44347160 | 1450 | //------------------------------------------------------------------------ |
e43c066c | 1451 | void AliITStrackerMI::AliITSlayer::ResetRoad() { |
1452 | //-------------------------------------------------------------------- | |
1453 | // This function calculates the road defined by the cluster density | |
1454 | //-------------------------------------------------------------------- | |
1455 | Int_t n=0; | |
1456 | for (Int_t i=0; i<fN; i++) { | |
1457 | if (TMath::Abs(fClusters[i]->GetZ())<fR) n++; | |
1458 | } | |
afd25725 | 1459 | if (n>1) fRoad=2*fR*TMath::Sqrt(TMath::Pi()/n); |
e43c066c | 1460 | } |
44347160 | 1461 | //------------------------------------------------------------------------ |
afd25725 | 1462 | Int_t AliITStrackerMI::AliITSlayer::InsertCluster(AliITSRecPoint *cl) { |
e43c066c | 1463 | //-------------------------------------------------------------------- |
1464 | //This function adds a cluster to this layer | |
1465 | //-------------------------------------------------------------------- | |
e50912db | 1466 | if (fN==AliITSRecoParam::GetMaxClusterPerLayer()) { |
e43c066c | 1467 | ::Error("InsertCluster","Too many clusters !\n"); |
1468 | return 1; | |
1469 | } | |
1470 | fCurrentSlice=-1; | |
afd25725 | 1471 | fClusters[fN]=cl; |
1d4090b7 | 1472 | fN++; |
afd25725 | 1473 | AliITSdetector &det=GetDetector(cl->GetDetectorIndex()); |
1474 | if (cl->GetY()<det.GetYmin()) det.SetYmin(cl->GetY()); | |
1475 | if (cl->GetY()>det.GetYmax()) det.SetYmax(cl->GetY()); | |
1476 | if (cl->GetZ()<det.GetZmin()) det.SetZmin(cl->GetZ()); | |
1477 | if (cl->GetZ()>det.GetZmax()) det.SetZmax(cl->GetZ()); | |
e43c066c | 1478 | |
1479 | return 0; | |
1480 | } | |
44347160 | 1481 | //------------------------------------------------------------------------ |
e43c066c | 1482 | void AliITStrackerMI::AliITSlayer::SortClusters() |
1483 | { | |
1484 | // | |
1485 | //sort clusters | |
1486 | // | |
00a7cc50 | 1487 | AliITSRecPoint **clusters = new AliITSRecPoint*[fN]; |
1d4090b7 | 1488 | Float_t *z = new Float_t[fN]; |
1489 | Int_t * index = new Int_t[fN]; | |
1490 | // | |
1491 | for (Int_t i=0;i<fN;i++){ | |
1492 | z[i] = fClusters[i]->GetZ(); | |
1493 | } | |
1494 | TMath::Sort(fN,z,index,kFALSE); | |
1495 | for (Int_t i=0;i<fN;i++){ | |
1496 | clusters[i] = fClusters[index[i]]; | |
1497 | } | |
1498 | // | |
1499 | for (Int_t i=0;i<fN;i++){ | |
1500 | fClusters[i] = clusters[i]; | |
1501 | fZ[i] = fClusters[i]->GetZ(); | |
1502 | AliITSdetector &det=GetDetector(fClusters[i]->GetDetectorIndex()); | |
1503 | Double_t y=fR*det.GetPhi() + fClusters[i]->GetY(); | |
1504 | if (y>2.*fR*TMath::Pi()) y -= 2.*fR*TMath::Pi(); | |
1505 | fY[i] = y; | |
1506 | } | |
1507 | delete[] index; | |
1508 | delete[] z; | |
1509 | delete[] clusters; | |
1510 | // | |
1511 | ||
e43c066c | 1512 | fYB[0]=10000000; |
1513 | fYB[1]=-10000000; | |
1514 | for (Int_t i=0;i<fN;i++){ | |
1515 | if (fY[i]<fYB[0]) fYB[0]=fY[i]; | |
1516 | if (fY[i]>fYB[1]) fYB[1]=fY[i]; | |
1517 | fClusterIndex[i] = i; | |
1518 | } | |
1519 | // | |
1520 | // fill slices | |
1521 | fDy5 = (fYB[1]-fYB[0])/5.; | |
1522 | fDy10 = (fYB[1]-fYB[0])/10.; | |
1523 | fDy20 = (fYB[1]-fYB[0])/20.; | |
1524 | for (Int_t i=0;i<6;i++) fN5[i] =0; | |
1525 | for (Int_t i=0;i<11;i++) fN10[i]=0; | |
1526 | for (Int_t i=0;i<21;i++) fN20[i]=0; | |
1527 | // | |
1528 | for (Int_t i=0;i<6;i++) {fBy5[i][0] = fYB[0]+(i-0.75)*fDy5; fBy5[i][1] = fYB[0]+(i+0.75)*fDy5;} | |
1529 | for (Int_t i=0;i<11;i++) {fBy10[i][0] = fYB[0]+(i-0.75)*fDy10; fBy10[i][1] = fYB[0]+(i+0.75)*fDy10;} | |
1530 | for (Int_t i=0;i<21;i++) {fBy20[i][0] = fYB[0]+(i-0.75)*fDy20; fBy20[i][1] = fYB[0]+(i+0.75)*fDy20;} | |
1531 | // | |
1532 | // | |
1d4090b7 | 1533 | for (Int_t i=0;i<fN;i++) |
1534 | for (Int_t irot=-1;irot<=1;irot++){ | |
1535 | Float_t curY = fY[i]+irot*TMath::TwoPi()*fR; | |
1536 | // slice 5 | |
1537 | for (Int_t slice=0; slice<6;slice++){ | |
e50912db | 1538 | if (fBy5[slice][0]<curY && curY<fBy5[slice][1]&&fN5[slice]<AliITSRecoParam::GetMaxClusterPerLayer5()){ |
1d4090b7 | 1539 | fClusters5[slice][fN5[slice]] = fClusters[i]; |
1540 | fY5[slice][fN5[slice]] = curY; | |
1541 | fZ5[slice][fN5[slice]] = fZ[i]; | |
1542 | fClusterIndex5[slice][fN5[slice]]=i; | |
1543 | fN5[slice]++; | |
1544 | } | |
e43c066c | 1545 | } |
1d4090b7 | 1546 | // slice 10 |
1547 | for (Int_t slice=0; slice<11;slice++){ | |
e50912db | 1548 | if (fBy10[slice][0]<curY && curY<fBy10[slice][1]&&fN10[slice]<AliITSRecoParam::GetMaxClusterPerLayer10()){ |
1d4090b7 | 1549 | fClusters10[slice][fN10[slice]] = fClusters[i]; |
1550 | fY10[slice][fN10[slice]] = curY; | |
1551 | fZ10[slice][fN10[slice]] = fZ[i]; | |
1552 | fClusterIndex10[slice][fN10[slice]]=i; | |
1553 | fN10[slice]++; | |
1554 | } | |
e43c066c | 1555 | } |
1d4090b7 | 1556 | // slice 20 |
1557 | for (Int_t slice=0; slice<21;slice++){ | |
e50912db | 1558 | if (fBy20[slice][0]<curY && curY<fBy20[slice][1]&&fN20[slice]<AliITSRecoParam::GetMaxClusterPerLayer20()){ |
1d4090b7 | 1559 | fClusters20[slice][fN20[slice]] = fClusters[i]; |
1560 | fY20[slice][fN20[slice]] = curY; | |
1561 | fZ20[slice][fN20[slice]] = fZ[i]; | |
1562 | fClusterIndex20[slice][fN20[slice]]=i; | |
1563 | fN20[slice]++; | |
1564 | } | |
1565 | } | |
e43c066c | 1566 | } |
1d4090b7 | 1567 | |
1568 | // | |
1569 | // consistency check | |
1570 | // | |
1571 | for (Int_t i=0;i<fN-1;i++){ | |
1572 | if (fZ[i]>fZ[i+1]){ | |
ae00569a | 1573 | printf("Bug\n"); |
e43c066c | 1574 | } |
1575 | } | |
1d4090b7 | 1576 | // |
1577 | for (Int_t slice=0;slice<21;slice++) | |
1578 | for (Int_t i=0;i<fN20[slice]-1;i++){ | |
1579 | if (fZ20[slice][i]>fZ20[slice][i+1]){ | |
ae00569a | 1580 | printf("Bug\n"); |
1d4090b7 | 1581 | } |
1582 | } | |
1583 | ||
1584 | ||
e43c066c | 1585 | } |
44347160 | 1586 | //------------------------------------------------------------------------ |
e43c066c | 1587 | Int_t AliITStrackerMI::AliITSlayer::FindClusterIndex(Float_t z) const { |
1588 | //-------------------------------------------------------------------- | |
1589 | // This function returns the index of the nearest cluster | |
1590 | //-------------------------------------------------------------------- | |
1591 | Int_t ncl=0; | |
1592 | const Float_t *zcl; | |
1593 | if (fCurrentSlice<0) { | |
1594 | ncl = fN; | |
1595 | zcl = fZ; | |
1596 | } | |
1597 | else{ | |
1598 | ncl = fNcs; | |
1599 | zcl = fZcs;; | |
1600 | } | |
1601 | ||
1602 | if (ncl==0) return 0; | |
1603 | Int_t b=0, e=ncl-1, m=(b+e)/2; | |
1604 | for (; b<e; m=(b+e)/2) { | |
1605 | // if (z > fClusters[m]->GetZ()) b=m+1; | |
1606 | if (z > zcl[m]) b=m+1; | |
1607 | else e=m; | |
1608 | } | |
1609 | return m; | |
1610 | } | |
44347160 | 1611 | //------------------------------------------------------------------------ |
e43c066c | 1612 | void AliITStrackerMI::AliITSlayer:: |
1613 | SelectClusters(Double_t zmin,Double_t zmax,Double_t ymin, Double_t ymax) { | |
1614 | //-------------------------------------------------------------------- | |
1615 | // This function sets the "window" | |
1616 | //-------------------------------------------------------------------- | |
1617 | ||
628e7bb0 | 1618 | Double_t circle=2*TMath::Pi()*fR; |
e43c066c | 1619 | fYmin = ymin; fYmax =ymax; |
1620 | Float_t ymiddle = (fYmin+fYmax)*0.5; | |
ae00569a | 1621 | if (ymiddle<fYB[0]) { |
1622 | fYmin+=circle; fYmax+=circle; ymiddle+=circle; | |
1623 | } else if (ymiddle>fYB[1]) { | |
1624 | fYmin-=circle; fYmax-=circle; ymiddle-=circle; | |
e43c066c | 1625 | } |
ae00569a | 1626 | |
e43c066c | 1627 | // |
1628 | fCurrentSlice =-1; | |
1629 | // defualt take all | |
1630 | fClustersCs = fClusters; | |
1631 | fClusterIndexCs = fClusterIndex; | |
1632 | fYcs = fY; | |
1633 | fZcs = fZ; | |
1634 | fNcs = fN; | |
628e7bb0 | 1635 | // |
e43c066c | 1636 | //is in 20 slice? |
1637 | if (fCurrentSlice<0&&TMath::Abs(fYmax-fYmin)<1.49*fDy20){ | |
1638 | Int_t slice = int(0.5+(ymiddle-fYB[0])/fDy20); | |
1639 | if (slice<0) slice=0; | |
1640 | if (slice>20) slice=20; | |
1641 | Bool_t isOK = (fYmin>fBy20[slice][0]&&fYmax<fBy20[slice][1]); | |
1642 | if (isOK) { | |
1643 | fCurrentSlice=slice; | |
1644 | fClustersCs = fClusters20[fCurrentSlice]; | |
1645 | fClusterIndexCs = fClusterIndex20[fCurrentSlice]; | |
1646 | fYcs = fY20[fCurrentSlice]; | |
1647 | fZcs = fZ20[fCurrentSlice]; | |
1648 | fNcs = fN20[fCurrentSlice]; | |
1649 | } | |
1650 | } | |
1651 | // | |
1652 | //is in 10 slice? | |
1653 | if (fCurrentSlice<0&&TMath::Abs(fYmax-fYmin)<1.49*fDy10){ | |
1654 | Int_t slice = int(0.5+(ymiddle-fYB[0])/fDy10); | |
1655 | if (slice<0) slice=0; | |
1656 | if (slice>10) slice=10; | |
1657 | Bool_t isOK = (fYmin>fBy10[slice][0]&&fYmax<fBy10[slice][1]); | |
1658 | if (isOK) { | |
1659 | fCurrentSlice=slice; | |
1660 | fClustersCs = fClusters10[fCurrentSlice]; | |
1661 | fClusterIndexCs = fClusterIndex10[fCurrentSlice]; | |
1662 | fYcs = fY10[fCurrentSlice]; | |
1663 | fZcs = fZ10[fCurrentSlice]; | |
1664 | fNcs = fN10[fCurrentSlice]; | |
1665 | } | |
1666 | } | |
1667 | // | |
1668 | //is in 5 slice? | |
1669 | if (fCurrentSlice<0&&TMath::Abs(fYmax-fYmin)<1.49*fDy5){ | |
1670 | Int_t slice = int(0.5+(ymiddle-fYB[0])/fDy5); | |
1671 | if (slice<0) slice=0; | |
1672 | if (slice>5) slice=5; | |
1673 | Bool_t isOK = (fYmin>fBy5[slice][0]&&fYmax<fBy5[slice][1]); | |
ae00569a | 1674 | if (isOK) { |
e43c066c | 1675 | fCurrentSlice=slice; |
1676 | fClustersCs = fClusters5[fCurrentSlice]; | |
1677 | fClusterIndexCs = fClusterIndex5[fCurrentSlice]; | |
1678 | fYcs = fY5[fCurrentSlice]; | |
1679 | fZcs = fZ5[fCurrentSlice]; | |
1680 | fNcs = fN5[fCurrentSlice]; | |
1681 | } | |
1682 | } | |
628e7bb0 | 1683 | // |
e43c066c | 1684 | fI=FindClusterIndex(zmin); fZmax=zmax; |
1685 | fImax = TMath::Min(FindClusterIndex(zmax)+1,fNcs); | |
1686 | fSkip = 0; | |
1687 | fAccepted =0; | |
6518a6c5 | 1688 | |
1689 | return; | |
e43c066c | 1690 | } |
44347160 | 1691 | //------------------------------------------------------------------------ |
628e7bb0 | 1692 | Int_t AliITStrackerMI::AliITSlayer:: |
1693 | FindDetectorIndex(Double_t phi, Double_t z) const { | |
1694 | //-------------------------------------------------------------------- | |
1695 | //This function finds the detector crossed by the track | |
1696 | //-------------------------------------------------------------------- | |
31fb8575 | 1697 | Double_t dphi; |
1698 | if (fZOffset<0) // old geometry | |
1699 | dphi = -(phi-fPhiOffset); | |
1700 | else // new geometry | |
1701 | dphi = phi-fPhiOffset; | |
1702 | ||
6518a6c5 | 1703 | |
628e7bb0 | 1704 | if (dphi < 0) dphi += 2*TMath::Pi(); |
1705 | else if (dphi >= 2*TMath::Pi()) dphi -= 2*TMath::Pi(); | |
1706 | Int_t np=Int_t(dphi*fNladders*0.5/TMath::Pi()+0.5); | |
1707 | if (np>=fNladders) np-=fNladders; | |
1708 | if (np<0) np+=fNladders; | |
1709 | ||
6518a6c5 | 1710 | |
628e7bb0 | 1711 | Double_t dz=fZOffset-z; |
6518a6c5 | 1712 | Double_t nnz = dz*(fNdetectors-1)*0.5/fZOffset+0.5; |
1713 | Int_t nz = (nnz<0 ? -1 : (Int_t)nnz); | |
628e7bb0 | 1714 | if (nz>=fNdetectors) return -1; |
1715 | if (nz<0) return -1; | |
1716 | ||
1717 | return np*fNdetectors + nz; | |
1718 | } | |
44347160 | 1719 | //------------------------------------------------------------------------ |
ae00569a | 1720 | const AliITSRecPoint *AliITStrackerMI::AliITSlayer::GetNextCluster(Int_t &ci,Bool_t test) |
1721 | { | |
e43c066c | 1722 | //-------------------------------------------------------------------- |
1723 | // This function returns clusters within the "window" | |
1724 | //-------------------------------------------------------------------- | |
1725 | ||
ae00569a | 1726 | if (fCurrentSlice<0) { |
e43c066c | 1727 | Double_t rpi2 = 2.*fR*TMath::Pi(); |
1728 | for (Int_t i=fI; i<fImax; i++) { | |
1729 | Double_t y = fY[i]; | |
1730 | if (fYmax<y) y -= rpi2; | |
1d4090b7 | 1731 | if (fYmin>y) y += rpi2; |
e43c066c | 1732 | if (y<fYmin) continue; |
1733 | if (y>fYmax) continue; | |
1734 | if (fClusters[i]->GetQ()==0&&fSkip==2) continue; | |
1735 | ci=i; | |
ae00569a | 1736 | if (!test) fI=i+1; |
e43c066c | 1737 | return fClusters[i]; |
1738 | } | |
ae00569a | 1739 | } else { |
e43c066c | 1740 | for (Int_t i=fI; i<fImax; i++) { |
1741 | if (fYcs[i]<fYmin) continue; | |
1742 | if (fYcs[i]>fYmax) continue; | |
1743 | if (fClustersCs[i]->GetQ()==0&&fSkip==2) continue; | |
1744 | ci=fClusterIndexCs[i]; | |
ae00569a | 1745 | if (!test) fI=i+1; |
e43c066c | 1746 | return fClustersCs[i]; |
1747 | } | |
1748 | } | |
1749 | return 0; | |
1750 | } | |
44347160 | 1751 | //------------------------------------------------------------------------ |
e43c066c | 1752 | Double_t AliITStrackerMI::AliITSlayer::GetThickness(Double_t y,Double_t z,Double_t &x0) |
1753 | const { | |
1754 | //-------------------------------------------------------------------- | |
afd25725 | 1755 | // This function returns the layer thickness at this point (units X0) |
e43c066c | 1756 | //-------------------------------------------------------------------- |
1757 | Double_t d=0.0085; | |
e50912db | 1758 | x0=AliITSRecoParam::GetX0Air(); |
e43c066c | 1759 | if (43<fR&&fR<45) { //SSD2 |
1760 | Double_t dd=0.0034; | |
1761 | d=dd; | |
1762 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
1763 | if (TMath::Abs(y-1.90)<0.45) {d+=(0.013-0.0034);} | |
1764 | if (TMath::Abs(y+1.90)<0.45) {d+=(0.013-0.0034);} | |
1765 | for (Int_t i=0; i<12; i++) { | |
1766 | if (TMath::Abs(z-3.9*(i+0.5))<0.15) { | |
1767 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
1768 | d+=0.0034; | |
1769 | break; | |
1770 | } | |
1771 | if (TMath::Abs(z+3.9*(i+0.5))<0.15) { | |
1772 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
1773 | d+=0.0034; | |
1774 | break; | |
1775 | } | |
1776 | if (TMath::Abs(z-3.4-3.9*i)<0.50) {d+=(0.016-0.0034); break;} | |
1777 | if (TMath::Abs(z+0.5+3.9*i)<0.50) {d+=(0.016-0.0034); break;} | |
1778 | } | |
1779 | } else | |
1780 | if (37<fR&&fR<41) { //SSD1 | |
1781 | Double_t dd=0.0034; | |
1782 | d=dd; | |
1783 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
1784 | if (TMath::Abs(y-1.90)<0.45) {d+=(0.013-0.0034);} | |
1785 | if (TMath::Abs(y+1.90)<0.45) {d+=(0.013-0.0034);} | |
1786 | for (Int_t i=0; i<11; i++) { | |
1787 | if (TMath::Abs(z-3.9*i)<0.15) { | |
1788 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
1789 | d+=dd; | |
1790 | break; | |
1791 | } | |
1792 | if (TMath::Abs(z+3.9*i)<0.15) { | |
1793 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
1794 | d+=dd; | |
1795 | break; | |
1796 | } | |
1797 | if (TMath::Abs(z-1.85-3.9*i)<0.50) {d+=(0.016-0.0034); break;} | |
1798 | if (TMath::Abs(z+2.05+3.9*i)<0.50) {d+=(0.016-0.0034); break;} | |
1799 | } | |
1800 | } else | |
1801 | if (13<fR&&fR<26) { //SDD | |
1802 | Double_t dd=0.0033; | |
1803 | d=dd; | |
1804 | if (TMath::Abs(y-0.00)>3.30) d+=dd; | |
1805 | ||
1806 | if (TMath::Abs(y-1.80)<0.55) { | |
1807 | d+=0.016; | |
1808 | for (Int_t j=0; j<20; j++) { | |
1809 | if (TMath::Abs(z+0.7+1.47*j)<0.12) {d+=0.08; x0=9.; break;} | |
1810 | if (TMath::Abs(z-0.7-1.47*j)<0.12) {d+=0.08; x0=9.; break;} | |
1811 | } | |
1812 | } | |
1813 | if (TMath::Abs(y+1.80)<0.55) { | |
1814 | d+=0.016; | |
1815 | for (Int_t j=0; j<20; j++) { | |
1816 | if (TMath::Abs(z-0.7-1.47*j)<0.12) {d+=0.08; x0=9.; break;} | |
1817 | if (TMath::Abs(z+0.7+1.47*j)<0.12) {d+=0.08; x0=9.; break;} | |
1818 | } | |
1819 | } | |
1820 | ||
1821 | for (Int_t i=0; i<4; i++) { | |
1822 | if (TMath::Abs(z-7.3*i)<0.60) { | |
1823 | d+=dd; | |
1824 | if (TMath::Abs(y-0.00)>3.30) d+=dd; | |
1825 | break; | |
1826 | } | |
1827 | if (TMath::Abs(z+7.3*i)<0.60) { | |
1828 | d+=dd; | |
1829 | if (TMath::Abs(y-0.00)>3.30) d+=dd; | |
1830 | break; | |
1831 | } | |
1832 | } | |
1833 | } else | |
1834 | if (6<fR&&fR<8) { //SPD2 | |
1835 | Double_t dd=0.0063; x0=21.5; | |
1836 | d=dd; | |
1837 | if (TMath::Abs(y-3.08)>0.5) d+=dd; | |
afd25725 | 1838 | if (TMath::Abs(y-3.03)<0.10) d+=0.014; |
e43c066c | 1839 | } else |
1840 | if (3<fR&&fR<5) { //SPD1 | |
1841 | Double_t dd=0.0063; x0=21.5; | |
1842 | d=dd; | |
1843 | if (TMath::Abs(y+0.21)>0.6) d+=dd; | |
afd25725 | 1844 | if (TMath::Abs(y+0.10)<0.10) d+=0.014; |
e43c066c | 1845 | } |
1846 | ||
1847 | return d; | |
1848 | } | |
44347160 | 1849 | //------------------------------------------------------------------------ |
e50912db | 1850 | Double_t AliITStrackerMI::GetEffectiveThickness() |
e43c066c | 1851 | { |
1852 | //-------------------------------------------------------------------- | |
afd25725 | 1853 | // Returns the thickness between the current layer and the vertex (units X0) |
e43c066c | 1854 | //-------------------------------------------------------------------- |
e43c066c | 1855 | |
e50912db | 1856 | if(fUseTGeo!=0) { |
1857 | if(fxOverX0Layer[0]<0) BuildMaterialLUT("Layers"); | |
1858 | if(fxOverX0Shield[0]<0) BuildMaterialLUT("Shields"); | |
1859 | if(fxOverX0Pipe<0) BuildMaterialLUT("Pipe"); | |
1860 | } | |
1861 | ||
afd25725 | 1862 | // beam pipe |
e50912db | 1863 | Double_t dPipe = (fUseTGeo==0 ? AliITSRecoParam::GetdPipe() : fxOverX0Pipe); |
1864 | Double_t d=dPipe*AliITSRecoParam::GetrPipe()*AliITSRecoParam::GetrPipe(); | |
afd25725 | 1865 | |
1866 | // layers | |
1867 | Double_t x0=0; | |
e43c066c | 1868 | Double_t xn=fgLayers[fI].GetR(); |
1869 | for (Int_t i=0; i<fI; i++) { | |
1870 | Double_t xi=fgLayers[i].GetR(); | |
e50912db | 1871 | Double_t dLayer = (fUseTGeo==0 ? fgLayers[i].GetThickness(0,0,x0) : fxOverX0Layer[i]); |
1872 | d+=dLayer*xi*xi; | |
e43c066c | 1873 | } |
1874 | ||
afd25725 | 1875 | // shields |
e43c066c | 1876 | if (fI>1) { |
e50912db | 1877 | Double_t dshieldSPD = (fUseTGeo==0 ? AliITSRecoParam::Getdshield(0) : fxOverX0Shield[0]); |
1878 | d+=dshieldSPD*AliITSRecoParam::GetrInsideShield(0)*AliITSRecoParam::GetrInsideShield(0); | |
e43c066c | 1879 | } |
e43c066c | 1880 | if (fI>3) { |
e50912db | 1881 | Double_t dshieldSDD = (fUseTGeo==0 ? AliITSRecoParam::Getdshield(1) : fxOverX0Shield[1]); |
1882 | d+=dshieldSDD*AliITSRecoParam::GetrInsideShield(1)*AliITSRecoParam::GetrInsideShield(1); | |
e43c066c | 1883 | } |
e43c066c | 1884 | return d/(xn*xn); |
1885 | } | |
44347160 | 1886 | //------------------------------------------------------------------------ |
e43c066c | 1887 | Int_t AliITStrackerMI::AliITSlayer::InRoad() const { |
ae00569a | 1888 | //------------------------------------------------------------------- |
e43c066c | 1889 | // This function returns number of clusters within the "window" |
1890 | //-------------------------------------------------------------------- | |
1891 | Int_t ncl=0; | |
1892 | for (Int_t i=fI; i<fN; i++) { | |
00a7cc50 | 1893 | const AliITSRecPoint *c=fClusters[i]; |
e43c066c | 1894 | if (c->GetZ() > fZmax) break; |
1895 | if (c->IsUsed()) continue; | |
1896 | const AliITSdetector &det=GetDetector(c->GetDetectorIndex()); | |
1897 | Double_t y=fR*det.GetPhi() + c->GetY(); | |
1898 | ||
1899 | if (y>2.*fR*TMath::Pi()) y -= 2*fR*TMath::Pi(); | |
1900 | if (y>1.*fR*TMath::Pi() && fYmax<y) y -= 2*fR*TMath::Pi(); | |
1901 | ||
1902 | if (y<fYmin) continue; | |
1903 | if (y>fYmax) continue; | |
1904 | ncl++; | |
1905 | } | |
1906 | return ncl; | |
1907 | } | |
44347160 | 1908 | //------------------------------------------------------------------------ |
ae00569a | 1909 | Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track, |
7167ae53 | 1910 | const AliITStrackMI *clusters,Bool_t extra, Bool_t planeeff) |
ae00569a | 1911 | { |
e43c066c | 1912 | //-------------------------------------------------------------------- |
ae00569a | 1913 | // This function refits the track "track" at the position "x" using |
1914 | // the clusters from "clusters" | |
ef7253ac | 1915 | // If "extra"==kTRUE, |
ae00569a | 1916 | // the clusters from overlapped modules get attached to "track" |
7167ae53 | 1917 | // If "planeff"==kTRUE, |
1918 | // special approach for plane efficiency evaluation is applyed | |
e43c066c | 1919 | //-------------------------------------------------------------------- |
6518a6c5 | 1920 | |
e50912db | 1921 | Int_t index[AliITSgeomTGeo::kNLayers]; |
e43c066c | 1922 | Int_t k; |
e50912db | 1923 | for (k=0; k<AliITSgeomTGeo::GetNLayers(); k++) index[k]=-1; |
ae00569a | 1924 | Int_t nc=clusters->GetNumberOfClusters(); |
e43c066c | 1925 | for (k=0; k<nc; k++) { |
ae00569a | 1926 | Int_t idx=clusters->GetClusterIndex(k); |
1927 | Int_t ilayer=(idx&0xf0000000)>>28; | |
1928 | index[ilayer]=idx; | |
e43c066c | 1929 | } |
67c1e979 | 1930 | |
7167ae53 | 1931 | return RefitAt(xx,track,index,extra,planeeff); // call the method below |
67c1e979 | 1932 | } |
44347160 | 1933 | //------------------------------------------------------------------------ |
ae00569a | 1934 | Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track, |
7167ae53 | 1935 | const Int_t *clusters,Bool_t extra, Bool_t planeeff) |
ae00569a | 1936 | { |
67c1e979 | 1937 | //-------------------------------------------------------------------- |
ae00569a | 1938 | // This function refits the track "track" at the position "x" using |
67c1e979 | 1939 | // the clusters from array |
ae00569a | 1940 | // If "extra"==kTRUE, |
1941 | // the clusters from overlapped modules get attached to "track" | |
7167ae53 | 1942 | // If "planeff"==kTRUE, |
1943 | // special approach for plane efficiency evaluation is applyed | |
67c1e979 | 1944 | //-------------------------------------------------------------------- |
e50912db | 1945 | Int_t index[AliITSgeomTGeo::kNLayers]; |
67c1e979 | 1946 | Int_t k; |
e50912db | 1947 | for (k=0; k<AliITSgeomTGeo::GetNLayers(); k++) index[k]=-1; |
67c1e979 | 1948 | // |
e50912db | 1949 | for (k=0; k<AliITSgeomTGeo::GetNLayers(); k++) { |
ae00569a | 1950 | index[k]=clusters[k]; |
67c1e979 | 1951 | } |
1952 | ||
afd25725 | 1953 | // special for cosmics: check which the innermost layer crossed |
1954 | // by the track | |
1955 | Int_t innermostlayer=5; | |
ae00569a | 1956 | Double_t drphi = TMath::Abs(track->GetD(0.,0.)); |
1957 | for(innermostlayer=0; innermostlayer<AliITSgeomTGeo::GetNLayers(); innermostlayer++) { | |
1958 | if(drphi < fgLayers[innermostlayer].GetR()) break; | |
1959 | } | |
1960 | //printf(" drphi %f innermost %d\n",drphi,innermostlayer); | |
afd25725 | 1961 | |
ae00569a | 1962 | Int_t modstatus=1; // found |
1963 | Float_t xloc,zloc; | |
67c1e979 | 1964 | Int_t from, to, step; |
ae00569a | 1965 | if (xx > track->GetX()) { |
e50912db | 1966 | from=innermostlayer; to=AliITSgeomTGeo::GetNLayers(); |
67c1e979 | 1967 | step=+1; |
1968 | } else { | |
e50912db | 1969 | from=AliITSgeomTGeo::GetNLayers()-1; to=innermostlayer-1; |
67c1e979 | 1970 | step=-1; |
1971 | } | |
ae00569a | 1972 | TString dir = (step>0 ? "outward" : "inward"); |
67c1e979 | 1973 | |
ae00569a | 1974 | for (Int_t ilayer = from; ilayer != to; ilayer += step) { |
6518a6c5 | 1975 | AliITSlayer &layer=fgLayers[ilayer]; |
67c1e979 | 1976 | Double_t r=layer.GetR(); |
afd25725 | 1977 | if (step<0 && xx>r) break; |
1978 | ||
1979 | // material between SSD and SDD, SDD and SPD | |
6518a6c5 | 1980 | Double_t hI=ilayer-0.5*step; |
e50912db | 1981 | if (TMath::Abs(hI-3.5)<0.01) // SDDouter |
ae00569a | 1982 | if(!CorrectForShieldMaterial(track,"SDD",dir)) return kFALSE; |
e50912db | 1983 | if (TMath::Abs(hI-1.5)<0.01) // SPDouter |
ae00569a | 1984 | if(!CorrectForShieldMaterial(track,"SPD",dir)) return kFALSE; |
67c1e979 | 1985 | |
1986 | // remember old position [SR, GSI 18.02.2003] | |
1987 | Double_t oldX=0., oldY=0., oldZ=0.; | |
ae00569a | 1988 | if (track->IsStartedTimeIntegral() && step==1) { |
1989 | track->GetGlobalXYZat(track->GetX(),oldX,oldY,oldZ); | |
67c1e979 | 1990 | } |
1991 | // | |
ae00569a | 1992 | |
afd25725 | 1993 | Double_t oldGlobXYZ[3]; |
ae00569a | 1994 | track->GetXYZ(oldGlobXYZ); |
afd25725 | 1995 | |
8602c008 | 1996 | Double_t phi,z; |
ae00569a | 1997 | if (!track->GetPhiZat(r,phi,z)) return kFALSE; |
67c1e979 | 1998 | |
67c1e979 | 1999 | Int_t idet=layer.FindDetectorIndex(phi,z); |
6518a6c5 | 2000 | |
2001 | // check if we allow a prolongation without point for large-eta tracks | |
ae00569a | 2002 | Int_t skip = CheckSkipLayer(track,ilayer,idet); |
6518a6c5 | 2003 | if (skip==2) { |
2004 | // propagate to the layer radius | |
ae00569a | 2005 | Double_t xToGo; track->GetLocalXat(r,xToGo); |
2006 | track->AliExternalTrackParam::PropagateTo(xToGo,GetBz()); | |
6518a6c5 | 2007 | // apply correction for material of the current layer |
ae00569a | 2008 | CorrectForLayerMaterial(track,ilayer,oldGlobXYZ,dir); |
2009 | modstatus = 4; // out in z | |
2010 | LocalModuleCoord(ilayer,idet,track,xloc,zloc); // local module coords | |
2011 | track->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc); | |
6518a6c5 | 2012 | // track time update [SR, GSI 17.02.2003] |
ae00569a | 2013 | if (track->IsStartedTimeIntegral() && step==1) { |
6518a6c5 | 2014 | Double_t newX, newY, newZ; |
ae00569a | 2015 | track->GetGlobalXYZat(track->GetX(),newX,newY,newZ); |
6518a6c5 | 2016 | Double_t dL2 = (oldX-newX)*(oldX-newX) + (oldY-newY)*(oldY-newY) + |
2017 | (oldZ-newZ)*(oldZ-newZ); | |
ae00569a | 2018 | track->AddTimeStep(TMath::Sqrt(dL2)); |
6518a6c5 | 2019 | } |
2020 | continue; | |
2021 | } | |
2022 | ||
e50912db | 2023 | if (idet<0) return kFALSE; |
ae00569a | 2024 | |
67c1e979 | 2025 | const AliITSdetector &det=layer.GetDetector(idet); |
2026 | phi=det.GetPhi(); | |
ae00569a | 2027 | if (!track->Propagate(phi,det.GetR())) return kFALSE; |
2028 | track->SetDetectorIndex(idet); | |
2029 | LocalModuleCoord(ilayer,idet,track,xloc,zloc); // local module coords | |
67c1e979 | 2030 | |
ae00569a | 2031 | Double_t dz,zmin,zmax; |
2032 | ||
2033 | const AliITSRecPoint *clAcc=0; | |
44347160 | 2034 | Double_t maxchi2=1000.*AliITSReconstructor::GetRecoParam()->GetMaxChi2(); |
67c1e979 | 2035 | |
6518a6c5 | 2036 | Int_t idx=index[ilayer]; |
ae00569a | 2037 | if (idx>=0) { // cluster in this layer |
2038 | modstatus = 6; // no refit | |
2039 | const AliITSRecPoint *cl=(AliITSRecPoint *)GetCluster(idx); | |
2040 | if (cl) { | |
2041 | if (idet != cl->GetDetectorIndex()) { | |
2042 | idet=cl->GetDetectorIndex(); | |
2043 | const AliITSdetector &det=layer.GetDetector(idet); | |
2044 | if (!track->Propagate(det.GetPhi(),det.GetR())) return kFALSE; | |
2045 | track->SetDetectorIndex(idet); | |
2046 | LocalModuleCoord(ilayer,idet,track,xloc,zloc); // local module coords | |
2047 | } | |
2048 | //Double_t chi2=track->GetPredictedChi2(cl); | |
2049 | Int_t cllayer = (idx & 0xf0000000) >> 28;; | |
2050 | Double_t chi2=GetPredictedChi2MI(track,cl,cllayer); | |
2051 | if (chi2<maxchi2) { | |
2052 | clAcc=cl; | |
2053 | maxchi2=chi2; | |
2054 | modstatus = 1; // found | |
2055 | } else { | |
7167ae53 | 2056 | return kFALSE; // |
ae00569a | 2057 | } |
2058 | } | |
2059 | } else { // no cluster in this layer | |
2060 | if (skip==1) { | |
2061 | modstatus = 3; // skipped | |
7167ae53 | 2062 | if (planeeff) { // Plane Eff determination: |
2063 | if (IsOKForPlaneEff(track,ilayer)) // only adequate track for plane eff. evaluation | |
2064 | UseTrackForPlaneEff(track,ilayer); | |
2065 | } | |
ae00569a | 2066 | } else { |
2067 | modstatus = 5; // no cls in road | |
2068 | // check dead | |
2069 | dz=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadZ()* | |
2070 | TMath::Sqrt(track->GetSigmaZ2() + | |
2071 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
2072 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
2073 | AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer)); | |
2074 | zmin=track->GetZ() - dz; | |
2075 | zmax=track->GetZ() + dz; | |
2076 | Int_t dead = CheckDeadZone(ilayer,idet,zmin,zmax); | |
2077 | if (dead==1) modstatus = 7; // holes in z in SPD | |
2078 | if (dead==2) modstatus = 2; // dead from OCDB | |
2079 | } | |
e43c066c | 2080 | } |
ae00569a | 2081 | |
2082 | if (clAcc) { | |
2083 | if (!UpdateMI(track,clAcc,maxchi2,idx)) return kFALSE; | |
2084 | track->SetSampledEdx(clAcc->GetQ(),track->GetNumberOfClusters()-1); | |
e43c066c | 2085 | } |
ae00569a | 2086 | track->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc); |
2087 | ||
2088 | ||
2089 | if (extra) { // search for extra clusters in overlapped modules | |
2090 | AliITStrackV2 tmp(*track); | |
2091 | Double_t dy,ymin,ymax; | |
2092 | dz=4*TMath::Sqrt(tmp.GetSigmaZ2()+AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer)); | |
2093 | if (dz < 0.5*TMath::Abs(tmp.GetTgl())) dz=0.5*TMath::Abs(tmp.GetTgl()); | |
2094 | dy=4*TMath::Sqrt(track->GetSigmaY2()+AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer)); | |
2095 | if (dy < 0.5*TMath::Abs(tmp.GetSnp())) dy=0.5*TMath::Abs(tmp.GetSnp()); | |
2096 | zmin=track->GetZ() - dz; | |
2097 | zmax=track->GetZ() + dz; | |
2098 | ymin=track->GetY() + phi*r - dy; | |
2099 | ymax=track->GetY() + phi*r + dy; | |
2100 | layer.SelectClusters(zmin,zmax,ymin,ymax); | |
2101 | ||
2102 | const AliITSRecPoint *clExtra=0; Int_t ci=-1,cci=-1; | |
2103 | Int_t idetExtra=-1; | |
2104 | Double_t maxchi2=1000.*AliITSReconstructor::GetRecoParam()->GetMaxChi2(), tolerance=0.1; | |
2105 | while ((clExtra=layer.GetNextCluster(ci))!=0) { | |
2106 | // only clusters in another module! (overlaps) | |
2107 | idetExtra = clExtra->GetDetectorIndex(); | |
2108 | if (idet == idetExtra) continue; | |
2109 | ||
2110 | const AliITSdetector &det=layer.GetDetector(idetExtra); | |
2111 | ||
2112 | if (!tmp.Propagate(det.GetPhi(),det.GetR())) continue; | |
2113 | ||
2114 | if (TMath::Abs(tmp.GetZ() - clExtra->GetZ()) > tolerance) continue; | |
2115 | if (TMath::Abs(tmp.GetY() - clExtra->GetY()) > tolerance) continue; | |
2116 | ||
2117 | Double_t chi2=tmp.GetPredictedChi2(clExtra); | |
2118 | if (chi2<maxchi2) { maxchi2=chi2; cci=ci; } | |
2119 | } | |
2120 | if (cci>=0) { | |
2121 | track->SetExtraCluster(ilayer,(ilayer<<28)+cci); | |
2122 | track->SetExtraModule(ilayer,idetExtra); | |
2123 | } | |
2124 | } // end search for extra clusters in overlapped modules | |
2125 | ||
afd25725 | 2126 | // Correct for material of the current layer |
ae00569a | 2127 | if(!CorrectForLayerMaterial(track,ilayer,oldGlobXYZ,dir)) return kFALSE; |
e43c066c | 2128 | |
2129 | // track time update [SR, GSI 17.02.2003] | |
ae00569a | 2130 | if (track->IsStartedTimeIntegral() && step==1) { |
e43c066c | 2131 | Double_t newX, newY, newZ; |
ae00569a | 2132 | track->GetGlobalXYZat(track->GetX(),newX,newY,newZ); |
e43c066c | 2133 | Double_t dL2 = (oldX-newX)*(oldX-newX) + (oldY-newY)*(oldY-newY) + |
2134 | (oldZ-newZ)*(oldZ-newZ); | |
ae00569a | 2135 | track->AddTimeStep(TMath::Sqrt(dL2)); |
e43c066c | 2136 | } |
2137 | // | |
2138 | ||
ae00569a | 2139 | } // end loop on layers |
2140 | ||
2141 | if (!track->PropagateTo(xx,0.,0.)) return kFALSE; | |
e43c066c | 2142 | |
e43c066c | 2143 | return kTRUE; |
2144 | } | |
44347160 | 2145 | //------------------------------------------------------------------------ |
15dd636f | 2146 | Double_t AliITStrackerMI::GetNormalizedChi2(AliITStrackMI * track, Int_t mode) |
e43c066c | 2147 | { |
2148 | // | |
2149 | // calculate normalized chi2 | |
2150 | // return NormalizedChi2(track,0); | |
2151 | Float_t chi2 = 0; | |
2152 | Float_t sum=0; | |
2153 | Float_t *erry = GetErrY(fCurrentEsdTrack), *errz = GetErrZ(fCurrentEsdTrack); | |
2154 | // track->fdEdxMismatch=0; | |
2155 | Float_t dedxmismatch =0; | |
2156 | Float_t *ny = GetNy(fCurrentEsdTrack), *nz = GetNz(fCurrentEsdTrack); | |
2157 | if (mode<100){ | |
2158 | for (Int_t i = 0;i<6;i++){ | |
b9671574 | 2159 | if (track->GetClIndex(i)>0){ |
e43c066c | 2160 | Float_t cerry, cerrz; |
2161 | if (ny[i]>0) {cerry = erry[i]; cerrz=errz[i];} | |
2162 | else | |
b9671574 | 2163 | { cerry= track->GetSigmaY(i); cerrz = track->GetSigmaZ(i);} |
e43c066c | 2164 | cerry*=cerry; |
2165 | cerrz*=cerrz; | |
b9671574 | 2166 | Float_t cchi2 = (track->GetDy(i)*track->GetDy(i)/cerry)+(track->GetDz(i)*track->GetDz(i)/cerrz); |
572f41f9 | 2167 | if (i>1 && AliITSReconstructor::GetRecoParam()->GetUseAmplitudeInfo(i)) { |
b9671574 | 2168 | Float_t ratio = track->GetNormQ(i)/track->GetExpQ(); |
e43c066c | 2169 | if (ratio<0.5) { |
2170 | cchi2+=(0.5-ratio)*10.; | |
2171 | //track->fdEdxMismatch+=(0.5-ratio)*10.; | |
2172 | dedxmismatch+=(0.5-ratio)*10.; | |
2173 | } | |
2174 | } | |
2175 | if (i<2 ||i>3){ | |
b9671574 | 2176 | AliITSRecPoint * cl = (AliITSRecPoint*)GetCluster( track->GetClIndex(i)); |
e43c066c | 2177 | Double_t delta = cl->GetNy()+cl->GetNz()-ny[i]-nz[i]; |
2178 | if (delta>1) chi2 +=0.5*TMath::Min(delta/2,2.); | |
2179 | if (i<2) chi2+=2*cl->GetDeltaProbability(); | |
2180 | } | |
2181 | chi2+=cchi2; | |
2182 | sum++; | |
2183 | } | |
2184 | } | |
b9671574 | 2185 | if (TMath::Abs(track->GetdEdxMismatch()-dedxmismatch)>0.0001){ |
2186 | track->SetdEdxMismatch(dedxmismatch); | |
e43c066c | 2187 | } |
2188 | } | |
2189 | else{ | |
2190 | for (Int_t i = 0;i<4;i++){ | |
b9671574 | 2191 | if (track->GetClIndex(i)>0){ |
e43c066c | 2192 | Float_t cerry, cerrz; |
2193 | if (ny[i]>0) {cerry = erry[i]; cerrz=errz[i];} | |
b9671574 | 2194 | else { cerry= track->GetSigmaY(i); cerrz = track->GetSigmaZ(i);} |
e43c066c | 2195 | cerry*=cerry; |
2196 | cerrz*=cerrz; | |
b9671574 | 2197 | chi2+= (track->GetDy(i)*track->GetDy(i)/cerry); |
2198 | chi2+= (track->GetDz(i)*track->GetDz(i)/cerrz); | |
e43c066c | 2199 | sum++; |
2200 | } | |
2201 | } | |
2202 | for (Int_t i = 4;i<6;i++){ | |
b9671574 | 2203 | if (track->GetClIndex(i)>0){ |
e43c066c | 2204 | Float_t cerry, cerrz; |
2205 | if (ny[i]>0) {cerry = erry[i]; cerrz=errz[i];} | |
b9671574 | 2206 | else { cerry= track->GetSigmaY(i); cerrz = track->GetSigmaZ(i);} |
e43c066c | 2207 | cerry*=cerry; |
2208 | cerrz*=cerrz; | |
2209 | Float_t cerryb, cerrzb; | |
2210 | if (ny[i+6]>0) {cerryb = erry[i+6]; cerrzb=errz[i+6];} | |
b9671574 | 2211 | else { cerryb= track->GetSigmaY(i+6); cerrzb = track->GetSigmaZ(i+6);} |
e43c066c | 2212 | cerryb*=cerryb; |
2213 | cerrzb*=cerrzb; | |
b9671574 | 2214 | chi2+= TMath::Min((track->GetDy(i+6)*track->GetDy(i+6)/cerryb),track->GetDy(i)*track->GetDy(i)/cerry); |
2215 | chi2+= TMath::Min((track->GetDz(i+6)*track->GetDz(i+6)/cerrzb),track->GetDz(i)*track->GetDz(i)/cerrz); | |
e43c066c | 2216 | sum++; |
2217 | } | |
2218 | } | |
2219 | } | |
b9671574 | 2220 | if (track->GetESDtrack()->GetTPCsignal()>85){ |
2221 | Float_t ratio = track->GetdEdx()/track->GetESDtrack()->GetTPCsignal(); | |
e43c066c | 2222 | if (ratio<0.5) { |
2223 | chi2+=(0.5-ratio)*5.; | |
2224 | } | |
2225 | if (ratio>2){ | |
2226 | chi2+=(ratio-2.0)*3; | |
2227 | } | |
2228 | } | |
2229 | // | |
b9671574 | 2230 | Double_t match = TMath::Sqrt(track->GetChi22()); |
2231 | if (track->GetConstrain()) match/=track->GetNumberOfClusters(); | |
2755f080 | 2232 | if (!track->GetConstrain()) { |
2233 | if (track->GetNumberOfClusters()>2) { | |
2234 | match/=track->GetNumberOfClusters()-2.; | |
2235 | } else { | |
2236 | match=0; | |
2237 | } | |
2238 | } | |
e43c066c | 2239 | if (match<0) match=0; |
b9671574 | 2240 | Float_t deadzonefactor = (track->GetNDeadZone()>0) ? 3*(1.1-track->GetDeadZoneProbability()):0.; |
2241 | Double_t normchi2 = 2*track->GetNSkipped()+match+deadzonefactor+(1+(2*track->GetNSkipped()+deadzonefactor)/track->GetNumberOfClusters())* | |
2242 | (chi2)/TMath::Max(double(sum-track->GetNSkipped()), | |
2243 | 1./(1.+track->GetNSkipped())); | |
e43c066c | 2244 | |
2245 | return normchi2; | |
2246 | } | |
44347160 | 2247 | //------------------------------------------------------------------------ |
15dd636f | 2248 | Double_t AliITStrackerMI::GetMatchingChi2(AliITStrackMI * track1, AliITStrackMI * track2) |
e43c066c | 2249 | { |
2250 | // | |
2251 | // return matching chi2 between two tracks | |
15dd636f | 2252 | AliITStrackMI track3(*track2); |
e43c066c | 2253 | track3.Propagate(track1->GetAlpha(),track1->GetX()); |
2254 | TMatrixD vec(5,1); | |
6c94f330 | 2255 | vec(0,0)=track1->GetY() - track3.GetY(); |
2256 | vec(1,0)=track1->GetZ() - track3.GetZ(); | |
2257 | vec(2,0)=track1->GetSnp() - track3.GetSnp(); | |
2258 | vec(3,0)=track1->GetTgl() - track3.GetTgl(); | |
6c23ffed | 2259 | vec(4,0)=track1->GetSigned1Pt() - track3.GetSigned1Pt(); |
e43c066c | 2260 | // |
2261 | TMatrixD cov(5,5); | |
6c94f330 | 2262 | cov(0,0) = track1->GetSigmaY2()+track3.GetSigmaY2(); |
2263 | cov(1,1) = track1->GetSigmaZ2()+track3.GetSigmaZ2(); | |
2264 | cov(2,2) = track1->GetSigmaSnp2()+track3.GetSigmaSnp2(); | |
2265 | cov(3,3) = track1->GetSigmaTgl2()+track3.GetSigmaTgl2(); | |
2266 | cov(4,4) = track1->GetSigma1Pt2()+track3.GetSigma1Pt2(); | |
e43c066c | 2267 | |
6c94f330 | 2268 | cov(0,1)=cov(1,0) = track1->GetSigmaZY()+track3.GetSigmaZY(); |
2269 | cov(0,2)=cov(2,0) = track1->GetSigmaSnpY()+track3.GetSigmaSnpY(); | |
2270 | cov(0,3)=cov(3,0) = track1->GetSigmaTglY()+track3.GetSigmaTglY(); | |
2271 | cov(0,4)=cov(4,0) = track1->GetSigma1PtY()+track3.GetSigma1PtY(); | |
e43c066c | 2272 | // |
6c94f330 | 2273 | cov(1,2)=cov(2,1) = track1->GetSigmaSnpZ()+track3.GetSigmaSnpZ(); |
2274 | cov(1,3)=cov(3,1) = track1->GetSigmaTglZ()+track3.GetSigmaTglZ(); | |
2275 | cov(1,4)=cov(4,1) = track1->GetSigma1PtZ()+track3.GetSigma1PtZ(); | |
e43c066c | 2276 | // |
6c94f330 | 2277 | cov(2,3)=cov(3,2) = track1->GetSigmaTglSnp()+track3.GetSigmaTglSnp(); |
2278 | cov(2,4)=cov(4,2) = track1->GetSigma1PtSnp()+track3.GetSigma1PtSnp(); | |
e43c066c | 2279 | // |
6c94f330 | 2280 | cov(3,4)=cov(4,3) = track1->GetSigma1PtTgl()+track3.GetSigma1PtTgl(); |
e43c066c | 2281 | |
2282 | cov.Invert(); | |
2283 | TMatrixD vec2(cov,TMatrixD::kMult,vec); | |
2284 | TMatrixD chi2(vec2,TMatrixD::kTransposeMult,vec); | |
2285 | return chi2(0,0); | |
2286 | } | |
44347160 | 2287 | //------------------------------------------------------------------------ |
6518a6c5 | 2288 | Double_t AliITStrackerMI::GetSPDDeadZoneProbability(Double_t zpos, Double_t zerr) |
e43c066c | 2289 | { |
2290 | // | |
afd25725 | 2291 | // return probability that given point (characterized by z position and error) |
2292 | // is in SPD dead zone | |
e43c066c | 2293 | // |
afd25725 | 2294 | Double_t probability = 0.; |
e43c066c | 2295 | Double_t absz = TMath::Abs(zpos); |
afd25725 | 2296 | Double_t nearestz = (absz<2.) ? 0.5*(fSPDdetzcentre[1]+fSPDdetzcentre[2]) : |
2297 | 0.5*(fSPDdetzcentre[2]+fSPDdetzcentre[3]); | |
2298 | if (TMath::Abs(absz-nearestz)>0.25+3.*zerr) return probability; | |
2299 | Double_t zmin, zmax; | |
2300 | if (zpos<-6.) { // dead zone at z = -7 | |
e50912db | 2301 | zmin = fSPDdetzcentre[0] + 0.5*AliITSRecoParam::GetSPDdetzlength(); |
2302 | zmax = fSPDdetzcentre[1] - 0.5*AliITSRecoParam::GetSPDdetzlength(); | |
afd25725 | 2303 | } else if (zpos>6.) { // dead zone at z = +7 |
e50912db | 2304 | zmin = fSPDdetzcentre[2] + 0.5*AliITSRecoParam::GetSPDdetzlength(); |
2305 | zmax = fSPDdetzcentre[3] - 0.5*AliITSRecoParam::GetSPDdetzlength(); | |
afd25725 | 2306 | } else if (absz<2.) { // dead zone at z = 0 |
e50912db | 2307 | zmin = fSPDdetzcentre[1] + 0.5*AliITSRecoParam::GetSPDdetzlength(); |
2308 | zmax = fSPDdetzcentre[2] - 0.5*AliITSRecoParam::GetSPDdetzlength(); | |
afd25725 | 2309 | } else { |
2310 | zmin = 0.; | |
2311 | zmax = 0.; | |
e43c066c | 2312 | } |
afd25725 | 2313 | // probability that the true z is in the range [zmin,zmax] (i.e. inside |
2314 | // dead zone) | |
2315 | probability = 0.5*( TMath::Erf((zpos-zmin)/zerr/TMath::Sqrt(2.)) - | |
2316 | TMath::Erf((zpos-zmax)/zerr/TMath::Sqrt(2.)) ); | |
e43c066c | 2317 | return probability; |
2318 | } | |
44347160 | 2319 | //------------------------------------------------------------------------ |
15dd636f | 2320 | Double_t AliITStrackerMI::GetTruncatedChi2(AliITStrackMI * track, Float_t fac) |
e43c066c | 2321 | { |
2322 | // | |
2323 | // calculate normalized chi2 | |
2324 | Float_t chi2[6]; | |
2325 | Float_t *erry = GetErrY(fCurrentEsdTrack), *errz = GetErrZ(fCurrentEsdTrack); | |
2326 | Float_t ncl = 0; | |
2327 | for (Int_t i = 0;i<6;i++){ | |
b9671574 | 2328 | if (TMath::Abs(track->GetDy(i))>0){ |
2329 | chi2[i]= (track->GetDy(i)/erry[i])*(track->GetDy(i)/erry[i]); | |
2330 | chi2[i]+= (track->GetDz(i)/errz[i])*(track->GetDz(i)/errz[i]); | |
e43c066c | 2331 | ncl++; |
2332 | } | |
2333 | else{chi2[i]=10000;} | |
2334 | } | |
2335 | Int_t index[6]; | |
2336 | TMath::Sort(6,chi2,index,kFALSE); | |
2337 | Float_t max = float(ncl)*fac-1.; | |
2338 | Float_t sumchi=0, sumweight=0; | |
2339 | for (Int_t i=0;i<max+1;i++){ | |
2340 | Float_t weight = (i<max)?1.:(max+1.-i); | |
2341 | sumchi+=weight*chi2[index[i]]; | |
2342 | sumweight+=weight; | |
2343 | } | |
2344 | Double_t normchi2 = sumchi/sumweight; | |
2345 | return normchi2; | |
2346 | } | |
44347160 | 2347 | //------------------------------------------------------------------------ |
15dd636f | 2348 | Double_t AliITStrackerMI::GetInterpolatedChi2(AliITStrackMI * forwardtrack, AliITStrackMI * backtrack) |
e43c066c | 2349 | { |
2350 | // | |
2351 | // calculate normalized chi2 | |
2352 | // if (forwardtrack->fNUsed>0.3*float(forwardtrack->GetNumberOfClusters())) return 10000; | |
2353 | Int_t npoints = 0; | |
2354 | Double_t res =0; | |
2355 | for (Int_t i=0;i<6;i++){ | |
b9671574 | 2356 | if ( (backtrack->GetSigmaY(i)<0.000000001) || (forwardtrack->GetSigmaY(i)<0.000000001)) continue; |
2357 | Double_t sy1 = forwardtrack->GetSigmaY(i); | |
2358 | Double_t sz1 = forwardtrack->GetSigmaZ(i); | |
2359 | Double_t sy2 = backtrack->GetSigmaY(i); | |
2360 | Double_t sz2 = backtrack->GetSigmaZ(i); | |
e43c066c | 2361 | if (i<2){ sy2=1000.;sz2=1000;} |
2362 | // | |
b9671574 | 2363 | Double_t dy0 = (forwardtrack->GetDy(i)/(sy1*sy1) +backtrack->GetDy(i)/(sy2*sy2))/(1./(sy1*sy1)+1./(sy2*sy2)); |
2364 | Double_t dz0 = (forwardtrack->GetDz(i)/(sz1*sz1) +backtrack->GetDz(i)/(sz2*sz2))/(1./(sz1*sz1)+1./(sz2*sz2)); | |
e43c066c | 2365 | // |
2366 | Double_t nz0 = dz0*TMath::Sqrt((1./(sz1*sz1)+1./(sz2*sz2))); | |
2367 | Double_t ny0 = dy0*TMath::Sqrt((1./(sy1*sy1)+1./(sy2*sy2))); | |
2368 | // | |
2369 | res+= nz0*nz0+ny0*ny0; | |
2370 | npoints++; | |
2371 | } | |
2372 | if (npoints>1) return | |
6c23ffed | 2373 | TMath::Max(0.3*forwardtrack->OneOverPt()-0.5,0.)+ |
e43c066c | 2374 | //2*forwardtrack->fNUsed+ |
b9671574 | 2375 | res/TMath::Max(double(npoints-forwardtrack->GetNSkipped()), |
2376 | 1./(1.+forwardtrack->GetNSkipped())); | |
e43c066c | 2377 | return 1000; |
2378 | } | |
44347160 | 2379 | //------------------------------------------------------------------------ |
e43c066c | 2380 | Float_t *AliITStrackerMI::GetWeight(Int_t index) { |
2381 | //-------------------------------------------------------------------- | |
2382 | // Return pointer to a given cluster | |
2383 | //-------------------------------------------------------------------- | |
2384 | Int_t l=(index & 0xf0000000) >> 28; | |
2385 | Int_t c=(index & 0x0fffffff) >> 00; | |
2386 | return fgLayers[l].GetWeight(c); | |
2387 | } | |
44347160 | 2388 | //------------------------------------------------------------------------ |
15dd636f | 2389 | void AliITStrackerMI::RegisterClusterTracks(AliITStrackMI* track,Int_t id) |
e43c066c | 2390 | { |
2391 | //--------------------------------------------- | |
2392 | // register track to the list | |
628e7bb0 | 2393 | // |
b9671574 | 2394 | if (track->GetESDtrack()->GetKinkIndex(0)!=0) return; //don't register kink tracks |
628e7bb0 | 2395 | // |
2396 | // | |
e43c066c | 2397 | for (Int_t icluster=0;icluster<track->GetNumberOfClusters();icluster++){ |
2398 | Int_t index = track->GetClusterIndex(icluster); | |
2399 | Int_t l=(index & 0xf0000000) >> 28; | |
2400 | Int_t c=(index & 0x0fffffff) >> 00; | |
b9671574 | 2401 | if (c>fgLayers[l].GetNumberOfClusters()) continue; |
e43c066c | 2402 | for (Int_t itrack=0;itrack<4;itrack++){ |
b9671574 | 2403 | if (fgLayers[l].GetClusterTracks(itrack,c)<0){ |
2404 | fgLayers[l].SetClusterTracks(itrack,c,id); | |
e43c066c | 2405 | break; |
2406 | } | |
2407 | } | |
2408 | } | |
2409 | } | |
44347160 | 2410 | //------------------------------------------------------------------------ |
15dd636f | 2411 | void AliITStrackerMI::UnRegisterClusterTracks(AliITStrackMI* track, Int_t id) |
e43c066c | 2412 | { |
2413 | //--------------------------------------------- | |
2414 | // unregister track from the list | |
2415 | for (Int_t icluster=0;icluster<track->GetNumberOfClusters();icluster++){ | |
2416 | Int_t index = track->GetClusterIndex(icluster); | |
2417 | Int_t l=(index & 0xf0000000) >> 28; | |
2418 | Int_t c=(index & 0x0fffffff) >> 00; | |
b9671574 | 2419 | if (c>fgLayers[l].GetNumberOfClusters()) continue; |
e43c066c | 2420 | for (Int_t itrack=0;itrack<4;itrack++){ |
b9671574 | 2421 | if (fgLayers[l].GetClusterTracks(itrack,c)==id){ |
2422 | fgLayers[l].SetClusterTracks(itrack,c,-1); | |
e43c066c | 2423 | } |
2424 | } | |
2425 | } | |
2426 | } | |
44347160 | 2427 | //------------------------------------------------------------------------ |
00a7cc50 | 2428 | Float_t AliITStrackerMI::GetNumberOfSharedClusters(AliITStrackMI* track,Int_t id, Int_t list[6], AliITSRecPoint *clist[6]) |
e43c066c | 2429 | { |
2430 | //------------------------------------------------------------- | |
2431 | //get number of shared clusters | |
2432 | //------------------------------------------------------------- | |
2433 | Float_t shared=0; | |
2434 | for (Int_t i=0;i<6;i++) { list[i]=-1, clist[i]=0;} | |
2435 | // mean number of clusters | |
2436 | Float_t *ny = GetNy(id), *nz = GetNz(id); | |
2437 | ||
2438 | ||
2439 | for (Int_t icluster=0;icluster<track->GetNumberOfClusters();icluster++){ | |
2440 | Int_t index = track->GetClusterIndex(icluster); | |
2441 | Int_t l=(index & 0xf0000000) >> 28; | |
2442 | Int_t c=(index & 0x0fffffff) >> 00; | |
b9671574 | 2443 | if (c>fgLayers[l].GetNumberOfClusters()) continue; |
e43c066c | 2444 | if (ny[l]==0){ |
2445 | printf("problem\n"); | |
2446 | } | |
00a7cc50 | 2447 | AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(index); |
e43c066c | 2448 | Float_t weight=1; |
2449 | // | |
2450 | Float_t deltan = 0; | |
2451 | if (l>3&&cl->GetNy()+cl->GetNz()>6) continue; | |
572f41f9 | 2452 | if (l>2&&AliITSReconstructor::GetRecoParam()->GetUseAmplitudeInfo(l)) |
2453 | if (track->GetNormQ(l)/track->GetExpQ()>3.5) continue; | |
e43c066c | 2454 | if (l<2 || l>3){ |
2455 | deltan = (cl->GetNy()+cl->GetNz()-ny[l]-nz[l]); | |
2456 | } | |
2457 | else{ | |
2458 | deltan = (cl->GetNz()-nz[l]); | |
2459 | } | |
2460 | if (deltan>2.0) continue; // extended - highly probable shared cluster | |
2461 | weight = 2./TMath::Max(3.+deltan,2.); | |
2462 | // | |
2463 | for (Int_t itrack=0;itrack<4;itrack++){ | |
b9671574 | 2464 | if (fgLayers[l].GetClusterTracks(itrack,c)>=0 && fgLayers[l].GetClusterTracks(itrack,c)!=id){ |
e43c066c | 2465 | list[l]=index; |
00a7cc50 | 2466 | clist[l] = (AliITSRecPoint*)GetCluster(index); |
e43c066c | 2467 | shared+=weight; |
2468 | break; | |
2469 | } | |
2470 | } | |
2471 | } | |
b9671574 | 2472 | track->SetNUsed(shared); |
e43c066c | 2473 | return shared; |
2474 | } | |
44347160 | 2475 | //------------------------------------------------------------------------ |
15dd636f | 2476 | Int_t AliITStrackerMI::GetOverlapTrack(AliITStrackMI *track, Int_t trackID, Int_t &shared, Int_t clusterlist[6],Int_t overlist[6]) |
e43c066c | 2477 | { |
2478 | // | |
2479 | // find first shared track | |
2480 | // | |
2481 | // mean number of clusters | |
2482 | Float_t *ny = GetNy(trackID), *nz = GetNz(trackID); | |
2483 | // | |
2484 | for (Int_t i=0;i<6;i++) overlist[i]=-1; | |
2485 | Int_t sharedtrack=100000; | |
2486 | Int_t tracks[24],trackindex=0; | |
2487 | for (Int_t i=0;i<24;i++) {tracks[i]=-1;} | |
2488 | // | |
2489 | for (Int_t icluster=0;icluster<6;icluster++){ | |
2490 | if (clusterlist[icluster]<0) continue; | |
2491 | Int_t index = clusterlist[icluster]; | |
2492 | Int_t l=(index & 0xf0000000) >> 28; | |
2493 | Int_t c=(index & 0x0fffffff) >> 00; | |
2494 | if (ny[l]==0){ | |
2495 | printf("problem\n"); | |
2496 | } | |
b9671574 | 2497 | if (c>fgLayers[l].GetNumberOfClusters()) continue; |
e43c066c | 2498 | //if (l>3) continue; |
00a7cc50 | 2499 | AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(index); |
e43c066c | 2500 | // |
2501 | Float_t deltan = 0; | |
2502 | if (l>3&&cl->GetNy()+cl->GetNz()>6) continue; | |
572f41f9 | 2503 | if (l>2&&AliITSReconstructor::GetRecoParam()->GetUseAmplitudeInfo(l)) |
2504 | if (track->GetNormQ(l)/track->GetExpQ()>3.5) continue; | |
e43c066c | 2505 | if (l<2 || l>3){ |
2506 | deltan = (cl->GetNy()+cl->GetNz()-ny[l]-nz[l]); | |
2507 | } | |
2508 | else{ | |
2509 | deltan = (cl->GetNz()-nz[l]); | |
2510 | } | |
2511 | if (deltan>2.0) continue; // extended - highly probable shared cluster | |
2512 | // | |
2513 | for (Int_t itrack=3;itrack>=0;itrack--){ | |
b9671574 | 2514 | if (fgLayers[l].GetClusterTracks(itrack,c)<0) continue; |
2515 | if (fgLayers[l].GetClusterTracks(itrack,c)!=trackID){ | |
2516 | tracks[trackindex] = fgLayers[l].GetClusterTracks(itrack,c); | |
e43c066c | 2517 | trackindex++; |
2518 | } | |
2519 | } | |
2520 | } | |
2521 | if (trackindex==0) return -1; | |
2522 | if (trackindex==1){ | |
2523 | sharedtrack = tracks[0]; | |
2524 | }else{ | |
2525 | if (trackindex==2) sharedtrack =TMath::Min(tracks[0],tracks[1]); | |
2526 | else{ | |
2527 | // | |
2528 | Int_t track[24], cluster[24]; | |
2529 | for (Int_t i=0;i<trackindex;i++){ track[i]=-1; cluster[i]=0;} | |
2530 | Int_t index =0; | |
2531 | // | |
2532 | for (Int_t i=0;i<trackindex;i++){ | |
2533 | if (tracks[i]<0) continue; | |
2534 | track[index] = tracks[i]; | |
2535 | cluster[index]++; | |
2536 | for (Int_t j=i+1;j<trackindex;j++){ | |
2537 | if (tracks[j]<0) continue; | |
2538 | if (tracks[j]==tracks[i]){ | |
2539 | cluster[index]++; | |
2540 | tracks[j]=-1; | |
2541 | } | |
2542 | } | |
2543 | index++; | |
2544 | } | |
2545 | Int_t max=0; | |
2546 | for (Int_t i=0;i<index;i++){ | |
2547 | if (cluster[index]>max) { | |
2548 | sharedtrack=track[index]; | |
2549 | max=cluster[index]; | |
2550 | } | |
2551 | } | |
2552 | } | |
2553 | } | |
2554 | ||
2555 | if (sharedtrack>=100000) return -1; | |
2556 | // | |
2557 | // make list of overlaps | |
2558 | shared =0; | |
2559 | for (Int_t icluster=0;icluster<6;icluster++){ | |
2560 | if (clusterlist[icluster]<0) continue; | |
2561 | Int_t index = clusterlist[icluster]; | |
2562 | Int_t l=(index & 0xf0000000) >> 28; | |
2563 | Int_t c=(index & 0x0fffffff) >> 00; | |
b9671574 | 2564 | if (c>fgLayers[l].GetNumberOfClusters()) continue; |
00a7cc50 | 2565 | AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(index); |
e43c066c | 2566 | if (l==0 || l==1){ |
2567 | if (cl->GetNy()>2) continue; | |
2568 | if (cl->GetNz()>2) continue; | |
2569 | } | |
2570 | if (l==4 || l==5){ | |
2571 | if (cl->GetNy()>3) continue; | |
2572 | if (cl->GetNz()>3) continue; | |
2573 | } | |
2574 | // | |
2575 | for (Int_t itrack=3;itrack>=0;itrack--){ | |
b9671574 | 2576 | if (fgLayers[l].GetClusterTracks(itrack,c)<0) continue; |
2577 | if (fgLayers[l].GetClusterTracks(itrack,c)==sharedtrack){ | |
e43c066c | 2578 | overlist[l]=index; |
2579 | shared++; | |
2580 | } | |
2581 | } | |
2582 | } | |
2583 | return sharedtrack; | |
2584 | } | |
44347160 | 2585 | //------------------------------------------------------------------------ |
15dd636f | 2586 | AliITStrackMI * AliITStrackerMI::GetBest2Tracks(Int_t trackID1, Int_t trackID2, Float_t th0, Float_t th1){ |
e43c066c | 2587 | // |
2588 | // try to find track hypothesys without conflicts | |
2589 | // with minimal chi2; | |
2590 | TClonesArray *arr1 = (TClonesArray*)fTrackHypothesys.At(trackID1); | |
2591 | Int_t entries1 = arr1->GetEntriesFast(); | |
2592 | TClonesArray *arr2 = (TClonesArray*)fTrackHypothesys.At(trackID2); | |
15dd636f | 2593 | if (!arr2) return (AliITStrackMI*) arr1->UncheckedAt(0); |
e43c066c | 2594 | Int_t entries2 = arr2->GetEntriesFast(); |
15dd636f | 2595 | if (entries2<=0) return (AliITStrackMI*) arr1->UncheckedAt(0); |
e43c066c | 2596 | // |
15dd636f | 2597 | AliITStrackMI * track10=(AliITStrackMI*) arr1->UncheckedAt(0); |
2598 | AliITStrackMI * track20=(AliITStrackMI*) arr2->UncheckedAt(0); | |
6c23ffed | 2599 | if (track10->Pt()>0.5+track20->Pt()) return track10; |
e43c066c | 2600 | |
2601 | for (Int_t itrack=0;itrack<entries1;itrack++){ | |
15dd636f | 2602 | AliITStrackMI * track=(AliITStrackMI*) arr1->UncheckedAt(itrack); |
e43c066c | 2603 | UnRegisterClusterTracks(track,trackID1); |
2604 | } | |
2605 | // | |
2606 | for (Int_t itrack=0;itrack<entries2;itrack++){ | |
15dd636f | 2607 | AliITStrackMI * track=(AliITStrackMI*) arr2->UncheckedAt(itrack); |
e43c066c | 2608 | UnRegisterClusterTracks(track,trackID2); |
2609 | } | |
2610 | Int_t index1=0; | |
2611 | Int_t index2=0; | |
2612 | Float_t maxconflicts=6; | |
2613 | Double_t maxchi2 =1000.; | |
2614 | // | |
2615 | // get weight of hypothesys - using best hypothesy | |
2616 | Double_t w1,w2; | |
2617 | ||
2618 | Int_t list1[6],list2[6]; | |
00a7cc50 | 2619 | AliITSRecPoint *clist1[6], *clist2[6] ; |
e43c066c | 2620 | RegisterClusterTracks(track10,trackID1); |
2621 | RegisterClusterTracks(track20,trackID2); | |
2622 | Float_t conflict1 = GetNumberOfSharedClusters(track10,trackID1,list1,clist1); | |
2623 | Float_t conflict2 = GetNumberOfSharedClusters(track20,trackID2,list2,clist2); | |
2624 | UnRegisterClusterTracks(track10,trackID1); | |
2625 | UnRegisterClusterTracks(track20,trackID2); | |
2626 | // | |
2627 | // normalized chi2 | |
2628 | Float_t chi21 =0,chi22=0,ncl1=0,ncl2=0; | |
2629 | Float_t nerry[6],nerrz[6]; | |
2630 | Float_t *erry1=GetErrY(trackID1),*errz1 = GetErrZ(trackID1); | |
2631 | Float_t *erry2=GetErrY(trackID2),*errz2 = GetErrZ(trackID2); | |
2632 | for (Int_t i=0;i<6;i++){ | |
2633 | if ( (erry1[i]>0) && (erry2[i]>0)) { | |
2634 | nerry[i] = TMath::Min(erry1[i],erry2[i]); | |
2635 | nerrz[i] = TMath::Min(errz1[i],errz2[i]); | |
2636 | }else{ | |
2637 | nerry[i] = TMath::Max(erry1[i],erry2[i]); | |
2638 | nerrz[i] = TMath::Max(errz1[i],errz2[i]); | |
2639 | } | |
b9671574 | 2640 | if (TMath::Abs(track10->GetDy(i))>0.000000000000001){ |
2641 | chi21 += track10->GetDy(i)*track10->GetDy(i)/(nerry[i]*nerry[i]); | |
2642 | chi21 += track10->GetDz(i)*track10->GetDz(i)/(nerrz[i]*nerrz[i]); | |
e43c066c | 2643 | ncl1++; |
2644 | } | |
b9671574 | 2645 | if (TMath::Abs(track20->GetDy(i))>0.000000000000001){ |
2646 | chi22 += track20->GetDy(i)*track20->GetDy(i)/(nerry[i]*nerry[i]); | |
2647 | chi22 += track20->GetDz(i)*track20->GetDz(i)/(nerrz[i]*nerrz[i]); | |
e43c066c | 2648 | ncl2++; |
2649 | } | |
2650 | } | |
2651 | chi21/=ncl1; | |
2652 | chi22/=ncl2; | |
2653 | // | |
2654 | // | |
b9671574 | 2655 | Float_t d1 = TMath::Sqrt(track10->GetD(0)*track10->GetD(0)+track10->GetD(1)*track10->GetD(1))+0.1; |
2656 | Float_t d2 = TMath::Sqrt(track20->GetD(0)*track20->GetD(0)+track20->GetD(1)*track20->GetD(1))+0.1; | |
e43c066c | 2657 | Float_t s1 = TMath::Sqrt(track10->GetSigmaY2()*track10->GetSigmaZ2()); |
2658 | Float_t s2 = TMath::Sqrt(track20->GetSigmaY2()*track20->GetSigmaZ2()); | |
2659 | // | |
2660 | w1 = (d2/(d1+d2)+ 2*s2/(s1+s2)+ | |
2661 | +s2/(s1+s2)*0.5*(chi22+2.)/(chi21+chi22+4.) | |
6c23ffed | 2662 | +1.*track10->Pt()/(track10->Pt()+track20->Pt()) |
e43c066c | 2663 | ); |
2664 | w2 = (d1/(d1+d2)+ 2*s1/(s1+s2)+ | |
2665 | s1/(s1+s2)*0.5*(chi21+2.)/(chi21+chi22+4.) | |
6c23ffed | 2666 | +1.*track20->Pt()/(track10->Pt()+track20->Pt()) |
e43c066c | 2667 | ); |
2668 | ||
2669 | Double_t sumw = w1+w2; | |
2670 | w1/=sumw; | |
2671 | w2/=sumw; | |
2672 | if (w1<w2*0.5) { | |
2673 | w1 = (d2+0.5)/(d1+d2+1.); | |
2674 | w2 = (d1+0.5)/(d1+d2+1.); | |
2675 | } | |
2676 | // Float_t maxmax = w1*track10->fChi2MIP[0]+w2*track20->fChi2MIP[0]+w1*conflict1+w2*conflict2+1.; | |
2677 | //Float_t maxconflicts0 = w1*conflict1+w2*conflict2; | |
2678 | // | |
2679 | // get pair of "best" hypothesys | |
2680 | // | |
2681 | Float_t * ny1 = GetNy(trackID1), * nz1 = GetNz(trackID1); | |
2682 | Float_t * ny2 = GetNy(trackID2), * nz2 = GetNz(trackID2); | |
2683 | ||
2684 | for (Int_t itrack1=0;itrack1<entries1;itrack1++){ | |
15dd636f | 2685 | AliITStrackMI * track1=(AliITStrackMI*) arr1->UncheckedAt(itrack1); |
e43c066c | 2686 | //if (track1->fFakeRatio>0) continue; |
2687 | RegisterClusterTracks(track1,trackID1); | |
2688 | for (Int_t itrack2=0;itrack2<entries2;itrack2++){ | |
15dd636f | 2689 | AliITStrackMI * track2=(AliITStrackMI*) arr2->UncheckedAt(itrack2); |
e43c066c | 2690 | |
2691 | // Float_t current = w1*track1->fChi2MIP[0]+w2*track2->fChi2MIP[0]; | |
2692 | //if (track2->fFakeRatio>0) continue; | |
2693 | Float_t nskipped=0; | |
2694 | RegisterClusterTracks(track2,trackID2); | |
2695 | Int_t list1[6],list2[6]; | |
00a7cc50 | 2696 | AliITSRecPoint *clist1[6], *clist2[6] ; |
e43c066c | 2697 | Float_t cconflict1 = GetNumberOfSharedClusters(track1,trackID1,list1,clist1); |
2698 | Float_t cconflict2 = GetNumberOfSharedClusters(track2,trackID2,list2,clist2); | |
2699 | UnRegisterClusterTracks(track2,trackID2); | |
2700 | // | |
b9671574 | 2701 | if (track1->GetConstrain()) nskipped+=w1*track1->GetNSkipped(); |
2702 | if (track2->GetConstrain()) nskipped+=w2*track2->GetNSkipped(); | |
e43c066c | 2703 | if (nskipped>0.5) continue; |
2704 | // | |
2705 | //if ( w1*conflict1+w2*conflict2>maxconflicts0) continue; | |
2706 | if (conflict1+1<cconflict1) continue; | |
2707 | if (conflict2+1<cconflict2) continue; | |
2708 | Float_t conflict=0; | |
2709 | Float_t sumchi2=0; | |
2710 | Float_t sum=0; | |
2711 | for (Int_t i=0;i<6;i++){ | |
2712 | // | |
2713 | Float_t c1 =0.; // conflict coeficients | |
2714 | Float_t c2 =0.; | |
2715 | if (clist1[i]&&clist2[i]){ | |
2716 | Float_t deltan = 0; | |
2717 | if (i<2 || i>3){ | |
2718 | deltan = (clist1[i]->GetNy()+clist1[i]->GetNz()-TMath::Max(ny1[i],ny2[i])-TMath::Max(nz1[i],nz2[i])); | |
2719 | } | |
2720 | else{ | |
2721 | deltan = (clist1[i]->GetNz()-TMath::Max(nz1[i],nz2[i])); | |
2722 | } | |
2723 | c1 = 2./TMath::Max(3.+deltan,2.); | |
2724 | c2 = 2./TMath::Max(3.+deltan,2.); | |
2725 | } | |
2726 | else{ | |
2727 | if (clist1[i]){ | |
2728 | Float_t deltan = 0; | |
2729 | if (i<2 || i>3){ | |
2730 | deltan = (clist1[i]->GetNy()+clist1[i]->GetNz()-ny1[i]-nz1[i]); | |
2731 | } | |
2732 | else{ | |
2733 | deltan = (clist1[i]->GetNz()-nz1[i]); | |
2734 | } | |
2735 | c1 = 2./TMath::Max(3.+deltan,2.); | |
2736 | c2 = 0; | |
2737 | } | |
2738 | ||
2739 | if (clist2[i]){ | |
2740 | Float_t deltan = 0; | |
2741 | if (i<2 || i>3){ | |
2742 | deltan = (clist2[i]->GetNy()+clist2[i]->GetNz()-ny2[i]-nz2[i]); | |
2743 | } | |
2744 | else{ | |
2745 | deltan = (clist2[i]->GetNz()-nz2[i]); | |
2746 | } | |
2747 | c2 = 2./TMath::Max(3.+deltan,2.); | |
2748 | c1 = 0; | |
2749 | } | |
2750 | } | |
2751 | // | |
2752 | Double_t chi21=0,chi22=0; | |
b9671574 | 2753 | if (TMath::Abs(track1->GetDy(i))>0.) { |
2754 | chi21 = (track1->GetDy(i)/track1->GetSigmaY(i))*(track1->GetDy(i)/track1->GetSigmaY(i))+ | |
2755 | (track1->GetDz(i)/track1->GetSigmaZ(i))*(track1->GetDz(i)/track1->GetSigmaZ(i)); | |
e43c066c | 2756 | //chi21 = (track1->fDy[i]*track1->fDy[i])/(nerry[i]*nerry[i])+ |
b9671574 | 2757 | // (track1->GetDz(i)*track1->GetDz(i))/(nerrz[i]*nerrz[i]); |
e43c066c | 2758 | }else{ |
b9671574 | 2759 | if (TMath::Abs(track1->GetSigmaY(i)>0.)) c1=1; |
e43c066c | 2760 | } |
2761 | // | |
b9671574 | 2762 | if (TMath::Abs(track2->GetDy(i))>0.) { |
2763 | chi22 = (track2->GetDy(i)/track2->GetSigmaY(i))*(track2->GetDy(i)/track2->GetSigmaY(i))+ | |
2764 | (track2->GetDz(i)/track2->GetSigmaZ(i))*(track2->GetDz(i)/track2->GetSigmaZ(i)); | |
e43c066c | 2765 | //chi22 = (track2->fDy[i]*track2->fDy[i])/(nerry[i]*nerry[i])+ |
2766 | // (track2->fDz[i]*track2->fDz[i])/(nerrz[i]*nerrz[i]); | |
2767 | } | |
2768 | else{ | |
b9671574 | 2769 | if (TMath::Abs(track2->GetSigmaY(i)>0.)) c2=1; |
e43c066c | 2770 | } |
2771 | sumchi2+=w1*(1.+c1)*(1+c1)*(chi21+c1)+w2*(1.+c2)*(1+c2)*(chi22+c2); | |
2772 | if (chi21>0) sum+=w1; | |
2773 | if (chi22>0) sum+=w2; | |
2774 | conflict+=(c1+c2); | |
2775 | } | |
b9671574 | 2776 | Double_t norm = sum-w1*track1->GetNSkipped()-w2*track2->GetNSkipped(); |
2777 | if (norm<0) norm =1/(w1*track1->GetNSkipped()+w2*track2->GetNSkipped()); | |
e43c066c | 2778 | Double_t normchi2 = 2*conflict+sumchi2/sum; |
2779 | if ( normchi2 <maxchi2 ){ | |
2780 | index1 = itrack1; | |
2781 | index2 = itrack2; | |
2782 | maxconflicts = conflict; | |
2783 | maxchi2 = normchi2; | |
2784 | } | |
2785 | } | |
2786 | UnRegisterClusterTracks(track1,trackID1); | |
2787 | } | |
2788 | // | |
2789 | // if (maxconflicts<4 && maxchi2<th0){ | |
2790 | if (maxchi2<th0*2.){ | |
b9671574 | 2791 | Float_t orig = track10->GetFakeRatio()*track10->GetNumberOfClusters(); |
15dd636f | 2792 | AliITStrackMI* track1=(AliITStrackMI*) arr1->UncheckedAt(index1); |
b9671574 | 2793 | track1->SetChi2MIP(5,maxconflicts); |
2794 | track1->SetChi2MIP(6,maxchi2); | |
2795 | track1->SetChi2MIP(7,0.01+orig-(track1->GetFakeRatio()*track1->GetNumberOfClusters())); | |
e43c066c | 2796 | // track1->UpdateESDtrack(AliESDtrack::kITSin); |
b9671574 | 2797 | track1->SetChi2MIP(8,index1); |
e43c066c | 2798 | fBestTrackIndex[trackID1] =index1; |
2799 | UpdateESDtrack(track1, AliESDtrack::kITSin); | |
2800 | } | |
b9671574 | 2801 | else if (track10->GetChi2MIP(0)<th1){ |
2802 | track10->SetChi2MIP(5,maxconflicts); | |
2803 | track10->SetChi2MIP(6,maxchi2); | |
e43c066c | 2804 | // track10->UpdateESDtrack(AliESDtrack::kITSin); |
2805 | UpdateESDtrack(track10,AliESDtrack::kITSin); | |
2806 | } | |
2807 | ||
2808 | for (Int_t itrack=0;itrack<entries1;itrack++){ | |
15dd636f | 2809 | AliITStrackMI * track=(AliITStrackMI*) arr1->UncheckedAt(itrack); |
e43c066c | 2810 | UnRegisterClusterTracks(track,trackID1); |
2811 | } | |
2812 | // | |
2813 | for (Int_t itrack=0;itrack<entries2;itrack++){ | |
15dd636f | 2814 | AliITStrackMI * track=(AliITStrackMI*) arr2->UncheckedAt(itrack); |
e43c066c | 2815 | UnRegisterClusterTracks(track,trackID2); |
2816 | } | |
2817 | ||
44347160 | 2818 | if (track10->GetConstrain()&&track10->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)&&track10->GetChi2MIP(1)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(1) |
2819 | &&track10->GetChi2MIP(2)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(2)&&track10->GetChi2MIP(3)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3)){ | |
2820 | // if (track10->fChi2MIP[0]<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)&&track10->fChi2MIP[1]<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(1) | |
2821 | // &&track10->fChi2MIP[2]<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(2)&&track10->fChi2MIP[3]<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3)){ | |
e43c066c | 2822 | RegisterClusterTracks(track10,trackID1); |
2823 | } | |
44347160 | 2824 | if (track20->GetConstrain()&&track20->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)&&track20->GetChi2MIP(1)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(1) |
2825 | &&track20->GetChi2MIP(2)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(2)&&track20->GetChi2MIP(3)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3)){ | |
2826 | //if (track20->fChi2MIP[0]<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)&&track20->fChi2MIP[1]<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(1) | |
2827 | // &&track20->fChi2MIP[2]<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(2)&&track20->fChi2MIP[3]<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3)){ | |
e43c066c | 2828 | RegisterClusterTracks(track20,trackID2); |
2829 | } | |
2830 | return track10; | |
2831 | ||
2832 | } | |
44347160 | 2833 | //------------------------------------------------------------------------ |
e43c066c | 2834 | void AliITStrackerMI::UseClusters(const AliKalmanTrack *t, Int_t from) const { |
2835 | //-------------------------------------------------------------------- | |
2836 | // This function marks clusters assigned to the track | |
2837 | //-------------------------------------------------------------------- | |
2838 | AliTracker::UseClusters(t,from); | |
2839 | ||
00a7cc50 | 2840 | AliITSRecPoint *c=(AliITSRecPoint *)GetCluster(t->GetClusterIndex(0)); |
e43c066c | 2841 | //if (c->GetQ()>2) c->Use(); |
2842 | if (c->GetSigmaZ2()>0.1) c->Use(); | |
00a7cc50 | 2843 | c=(AliITSRecPoint *)GetCluster(t->GetClusterIndex(1)); |
e43c066c | 2844 | //if (c->GetQ()>2) c->Use(); |
2845 | if (c->GetSigmaZ2()>0.1) c->Use(); | |
2846 | ||
2847 | } | |
44347160 | 2848 | //------------------------------------------------------------------------ |
15dd636f | 2849 | void AliITStrackerMI::AddTrackHypothesys(AliITStrackMI * track, Int_t esdindex) |
e43c066c | 2850 | { |
2851 | //------------------------------------------------------------------ | |
2852 | // add track to the list of hypothesys | |
2853 | //------------------------------------------------------------------ | |
2854 | ||
2855 | if (esdindex>=fTrackHypothesys.GetEntriesFast()) fTrackHypothesys.Expand(esdindex*2+10); | |
2856 | // | |
2857 | TObjArray * array = (TObjArray*) fTrackHypothesys.At(esdindex); | |
2858 | if (!array) { | |
2859 | array = new TObjArray(10); | |
2860 | fTrackHypothesys.AddAt(array,esdindex); | |
2861 | } | |
2862 | array->AddLast(track); | |
2863 | } | |
44347160 | 2864 | //------------------------------------------------------------------------ |
e43c066c | 2865 | void AliITStrackerMI::SortTrackHypothesys(Int_t esdindex, Int_t maxcut, Int_t mode) |
2866 | { | |
2867 | //------------------------------------------------------------------- | |
2868 | // compress array of track hypothesys | |
2869 | // keep only maxsize best hypothesys | |
2870 | //------------------------------------------------------------------- | |
2871 | if (esdindex>fTrackHypothesys.GetEntriesFast()) return; | |
2872 | if (! (fTrackHypothesys.At(esdindex)) ) return; | |
2873 | TObjArray * array = (TObjArray*) fTrackHypothesys.At(esdindex); | |
2874 | Int_t entries = array->GetEntriesFast(); | |
2875 | // | |
2876 | //- find preliminary besttrack as a reference | |
2877 | Float_t minchi2=10000; | |
2878 | Int_t maxn=0; | |
15dd636f | 2879 | AliITStrackMI * besttrack=0; |
e43c066c | 2880 | for (Int_t itrack=0;itrack<array->GetEntriesFast();itrack++){ |
15dd636f | 2881 | AliITStrackMI * track = (AliITStrackMI*)array->At(itrack); |
e43c066c | 2882 | if (!track) continue; |
2883 | Float_t chi2 = NormalizedChi2(track,0); | |
2884 | // | |
b9671574 | 2885 | Int_t tpcLabel=track->GetESDtrack()->GetTPCLabel(); |
e43c066c | 2886 | track->SetLabel(tpcLabel); |
2887 | CookdEdx(track); | |
b9671574 | 2888 | track->SetFakeRatio(1.); |
e43c066c | 2889 | CookLabel(track,0.); //For comparison only |
2890 | // | |
44347160 | 2891 | //if (chi2<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)&&track->fFakeRatio==0){ |
2892 | if (chi2<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)){ | |
e43c066c | 2893 | if (track->GetNumberOfClusters()<maxn) continue; |
2894 | maxn = track->GetNumberOfClusters(); | |
2895 | if (chi2<minchi2){ | |
2896 | minchi2=chi2; | |
2897 | besttrack=track; | |
2898 | } | |
2899 | } | |
2900 | else{ | |
b9671574 | 2901 | if (track->GetConstrain() || track->GetNumberOfClusters()>5){ //keep best short tracks - without vertex constrain |
628e7bb0 | 2902 | delete array->RemoveAt(itrack); |
2903 | } | |
e43c066c | 2904 | } |
2905 | } | |
2906 | if (!besttrack) return; | |
2907 | // | |
2908 | // | |
2909 | //take errors of best track as a reference | |
2910 | Float_t *erry = GetErrY(esdindex), *errz = GetErrZ(esdindex); | |
2911 | Float_t *ny = GetNy(esdindex), *nz = GetNz(esdindex); | |
2912 | for (Int_t i=0;i<6;i++) { | |
b9671574 | 2913 | if (besttrack->GetClIndex(i)>0){ |
2914 | erry[i] = besttrack->GetSigmaY(i); erry[i+6] = besttrack->GetSigmaY(i+6); | |
2915 | errz[i] = besttrack->GetSigmaZ(i); errz[i+6] = besttrack->GetSigmaZ(i+6); | |
2916 | ny[i] = besttrack->GetNy(i); | |
2917 | nz[i] = besttrack->GetNz(i); | |
e43c066c | 2918 | } |
2919 | } | |
2920 | // | |
2921 | // calculate normalized chi2 | |
2922 | // | |
2923 | Float_t * chi2 = new Float_t[entries]; | |
2924 | Int_t * index = new Int_t[entries]; | |
2925 | for (Int_t i=0;i<entries;i++) chi2[i] =10000; | |
2926 | for (Int_t itrack=0;itrack<entries;itrack++){ | |
15dd636f | 2927 | AliITStrackMI * track = (AliITStrackMI*)array->At(itrack); |
e43c066c | 2928 | if (track){ |
b9671574 | 2929 | track->SetChi2MIP(0,GetNormalizedChi2(track, mode)); |
44347160 | 2930 | if (track->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)) |
b9671574 | 2931 | chi2[itrack] = track->GetChi2MIP(0); |
628e7bb0 | 2932 | else{ |
b9671574 | 2933 | if (track->GetConstrain() || track->GetNumberOfClusters()>5){ //keep best short tracks - without vertex constrain |
628e7bb0 | 2934 | delete array->RemoveAt(itrack); |
2935 | } | |
2936 | } | |
e43c066c | 2937 | } |
2938 | } | |
2939 | // | |
2940 | TMath::Sort(entries,chi2,index,kFALSE); | |
15dd636f | 2941 | besttrack = (AliITStrackMI*)array->At(index[0]); |
44347160 | 2942 | if (besttrack&&besttrack->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)){ |
e43c066c | 2943 | for (Int_t i=0;i<6;i++){ |
b9671574 | 2944 | if (besttrack->GetClIndex(i)>0){ |
2945 | erry[i] = besttrack->GetSigmaY(i); erry[i+6] = besttrack->GetSigmaY(i+6); | |
2946 | errz[i] = besttrack->GetSigmaZ(i); erry[i+6] = besttrack->GetSigmaY(i+6); | |
2947 | ny[i] = besttrack->GetNy(i); | |
2948 | nz[i] = besttrack->GetNz(i); | |
e43c066c | 2949 | } |
2950 | } | |
2951 | } | |
2952 | // | |
2953 | // calculate one more time with updated normalized errors | |
2954 | for (Int_t i=0;i<entries;i++) chi2[i] =10000; | |
2955 | for (Int_t itrack=0;itrack<entries;itrack++){ | |
15dd636f | 2956 | AliITStrackMI * track = (AliITStrackMI*)array->At(itrack); |
e43c066c | 2957 | if (track){ |
b9671574 | 2958 | track->SetChi2MIP(0,GetNormalizedChi2(track,mode)); |
44347160 | 2959 | if (track->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)) |
b9671574 | 2960 | chi2[itrack] = track->GetChi2MIP(0)-0*(track->GetNumberOfClusters()+track->GetNDeadZone()); |
628e7bb0 | 2961 | else |
2962 | { | |
b9671574 | 2963 | if (track->GetConstrain() || track->GetNumberOfClusters()>5){ //keep best short tracks - without vertex constrain |
628e7bb0 | 2964 | delete array->RemoveAt(itrack); |
2965 | } | |
2966 | } | |
e43c066c | 2967 | } |
2968 | } | |
2969 | entries = array->GetEntriesFast(); | |
2970 | // | |
628e7bb0 | 2971 | // |
e43c066c | 2972 | if (entries>0){ |
2973 | TObjArray * newarray = new TObjArray(); | |
2974 | TMath::Sort(entries,chi2,index,kFALSE); | |
15dd636f | 2975 | besttrack = (AliITStrackMI*)array->At(index[0]); |
e43c066c | 2976 | if (besttrack){ |
2977 | // | |
2978 | for (Int_t i=0;i<6;i++){ | |
b9671574 | 2979 | if (besttrack->GetNz(i)>0&&besttrack->GetNy(i)>0){ |
2980 | erry[i] = besttrack->GetSigmaY(i); erry[i+6] = besttrack->GetSigmaY(i+6); | |
2981 | errz[i] = besttrack->GetSigmaZ(i); errz[i+6] = besttrack->GetSigmaZ(i+6); | |
2982 | ny[i] = besttrack->GetNy(i); | |
2983 | nz[i] = besttrack->GetNz(i); | |
e43c066c | 2984 | } |
2985 | } | |
b9671574 | 2986 | besttrack->SetChi2MIP(0,GetNormalizedChi2(besttrack,mode)); |
44347160 | 2987 | Float_t minchi2 = TMath::Min(besttrack->GetChi2MIP(0)+5.+besttrack->GetNUsed(), double(AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0))); |
e43c066c | 2988 | Float_t minn = besttrack->GetNumberOfClusters()-3; |
2989 | Int_t accepted=0; | |
2990 | for (Int_t i=0;i<entries;i++){ | |
15dd636f | 2991 | AliITStrackMI * track = (AliITStrackMI*)array->At(index[i]); |
e43c066c | 2992 | if (!track) continue; |
2993 | if (accepted>maxcut) break; | |
b9671574 | 2994 | track->SetChi2MIP(0,GetNormalizedChi2(track,mode)); |
2995 | if (track->GetConstrain() || track->GetNumberOfClusters()>5){ //keep best short tracks - without vertex constrain | |
2996 | if (track->GetNumberOfClusters()<6 && (track->GetChi2MIP(0)+track->GetNUsed()>minchi2)){ | |
628e7bb0 | 2997 | delete array->RemoveAt(index[i]); |
2998 | continue; | |
2999 | } | |
e43c066c | 3000 | } |
b9671574 | 3001 | Bool_t shortbest = !track->GetConstrain() && track->GetNumberOfClusters()<6; |
3002 | if ((track->GetChi2MIP(0)+track->GetNUsed()<minchi2 && track->GetNumberOfClusters()>=minn) ||shortbest){ | |
628e7bb0 | 3003 | if (!shortbest) accepted++; |
e43c066c | 3004 | // |
3005 | newarray->AddLast(array->RemoveAt(index[i])); | |
3006 | for (Int_t i=0;i<6;i++){ | |
3007 | if (nz[i]==0){ | |
b9671574 | 3008 | erry[i] = track->GetSigmaY(i); erry[i+6] = track->GetSigmaY(i+6); |
3009 | errz[i] = track->GetSigmaZ(i); errz[i] = track->GetSigmaZ(i+6); | |
3010 | ny[i] = track->GetNy(i); | |
3011 | nz[i] = track->GetNz(i); | |
e43c066c | 3012 | } |
3013 | } | |
3014 | } | |
3015 | else{ | |
3016 | delete array->RemoveAt(index[i]); | |
3017 | } | |
3018 | } | |
3019 | array->Delete(); | |
3020 | delete fTrackHypothesys.RemoveAt(esdindex); | |
3021 | fTrackHypothesys.AddAt(newarray,esdindex); | |
3022 | } | |
3023 | else{ | |
3024 | array->Delete(); | |
3025 | delete fTrackHypothesys.RemoveAt(esdindex); | |
3026 | } | |
3027 | } | |
3028 | delete [] chi2; | |
3029 | delete [] index; | |
3030 | } | |
44347160 | 3031 | //------------------------------------------------------------------------ |
15dd636f | 3032 | AliITStrackMI * AliITStrackerMI::GetBestHypothesys(Int_t esdindex, AliITStrackMI * original, Int_t checkmax) |
e43c066c | 3033 | { |
3034 | //------------------------------------------------------------- | |
3035 | // try to find best hypothesy | |
3036 | // currently - minimal chi2 of track+backpropagated track+matching to the tpc track | |
3037 | //------------------------------------------------------------- | |
3038 | if (fTrackHypothesys.GetEntriesFast()<=esdindex) return 0; | |
3039 | TObjArray * array = (TObjArray*) fTrackHypothesys.At(esdindex); | |
3040 | if (!array) return 0; | |
3041 | Int_t entries = array->GetEntriesFast(); | |
3042 | if (!entries) return 0; | |
3043 | Float_t minchi2 = 100000; | |
15dd636f | 3044 | AliITStrackMI * besttrack=0; |
e43c066c | 3045 | // |
15dd636f | 3046 | AliITStrackMI * backtrack = new AliITStrackMI(*original); |
3047 | AliITStrackMI * forwardtrack = new AliITStrackMI(*original); | |
afd25725 | 3048 | Double_t xyzVtx[]={GetX(),GetY(),GetZ()}; |
3049 | Double_t ersVtx[]={GetSigmaX()/3.,GetSigmaY()/3.,GetSigmaZ()/3.}; | |
e43c066c | 3050 | // |
3051 | for (Int_t i=0;i<entries;i++){ | |
15dd636f | 3052 | AliITStrackMI * track = (AliITStrackMI*)array->At(i); |
e43c066c | 3053 | if (!track) continue; |
628e7bb0 | 3054 | Float_t sigmarfi,sigmaz; |
3055 | GetDCASigma(track,sigmarfi,sigmaz); | |
b9671574 | 3056 | track->SetDnorm(0,sigmarfi); |
3057 | track->SetDnorm(1,sigmaz); | |
628e7bb0 | 3058 | // |
b9671574 | 3059 | track->SetChi2MIP(1,1000000); |
3060 | track->SetChi2MIP(2,1000000); | |
3061 | track->SetChi2MIP(3,1000000); | |
e43c066c | 3062 | // |
3063 | // backtrack | |
15dd636f | 3064 | backtrack = new(backtrack) AliITStrackMI(*track); |
afd25725 | 3065 | if (track->GetConstrain()) { |
e50912db | 3066 | if (!CorrectForPipeMaterial(backtrack,"inward")) continue; |
afd25725 | 3067 | if (!backtrack->Improve(0,xyzVtx,ersVtx)) continue; |
6c94f330 | 3068 | backtrack->ResetCovariance(10.); |
628e7bb0 | 3069 | }else{ |
6c94f330 | 3070 | backtrack->ResetCovariance(10.); |
628e7bb0 | 3071 | } |
e43c066c | 3072 | backtrack->ResetClusters(); |
628e7bb0 | 3073 | |
e43c066c | 3074 | Double_t x = original->GetX(); |
3075 | if (!RefitAt(x,backtrack,track)) continue; | |
628e7bb0 | 3076 | // |
b9671574 | 3077 | track->SetChi2MIP(1,NormalizedChi2(backtrack,0)); |
e43c066c | 3078 | //for (Int_t i=2;i<6;i++){track->fDy[i]+=backtrack->fDy[i]; track->fDz[i]+=backtrack->fDz[i];} |
44347160 | 3079 | if (track->GetChi2MIP(1)>AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(1)*6.) continue; |
b9671574 | 3080 | track->SetChi22(GetMatchingChi2(backtrack,original)); |
e43c066c | 3081 | |
b9671574 | 3082 | if ((track->GetConstrain()) && track->GetChi22()>90.) continue; |
3083 | if ((!track->GetConstrain()) && track->GetChi22()>30.) continue; | |
3084 | if ( track->GetChi22()/track->GetNumberOfClusters()>11.) continue; | |
e43c066c | 3085 | |
3086 | ||
44347160 | 3087 | if (!(track->GetConstrain())&&track->GetChi2MIP(1)>AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(1)) continue; |
e43c066c | 3088 | // |
3089 | //forward track - without constraint | |
15dd636f | 3090 | forwardtrack = new(forwardtrack) AliITStrackMI(*original); |
e43c066c | 3091 | forwardtrack->ResetClusters(); |
3092 | x = track->GetX(); | |
628e7bb0 | 3093 | RefitAt(x,forwardtrack,track); |
b9671574 | 3094 | track->SetChi2MIP(2,NormalizedChi2(forwardtrack,0)); |
44347160 | 3095 | if (track->GetChi2MIP(2)>AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(2)*6.0) continue; |
3096 | if (!(track->GetConstrain())&&track->GetChi2MIP(2)>AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(2)) continue; | |
e43c066c | 3097 | |
791f9a2a | 3098 | //track->fD[0] = forwardtrack->GetD(GetX(),GetY()); |
3099 | //track->fD[1] = forwardtrack->GetZat(GetX())-GetZ(); | |
b9671574 | 3100 | forwardtrack->GetDZ(GetX(),GetY(),GetZ(),track->GetDP()); //I.B. |
3101 | forwardtrack->SetD(0,track->GetD(0)); | |
3102 | forwardtrack->SetD(1,track->GetD(1)); | |
e43c066c | 3103 | { |
3104 | Int_t list[6]; | |
00a7cc50 | 3105 | AliITSRecPoint* clist[6]; |
b9671574 | 3106 | track->SetChi2MIP(4,GetNumberOfSharedClusters(track,esdindex,list,clist)); |
3107 | if ( (!track->GetConstrain()) && track->GetChi2MIP(4)>1.0) continue; | |
e43c066c | 3108 | } |
3109 | ||
b9671574 | 3110 | track->SetChi2MIP(3,GetInterpolatedChi2(forwardtrack,backtrack)); |
44347160 | 3111 | if ( (track->GetChi2MIP(3)>6.*AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3))) continue; |
3112 | if ( (!track->GetConstrain()) && (track->GetChi2MIP(3)>2*AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3))) { | |
b9671574 | 3113 | track->SetChi2MIP(3,1000); |
e43c066c | 3114 | continue; |
3115 | } | |
b9671574 | 3116 | Double_t chi2 = track->GetChi2MIP(0)+track->GetNUsed(); |
e43c066c | 3117 | // |
3118 | for (Int_t ichi=0;ichi<5;ichi++){ | |
b9671574 | 3119 | forwardtrack->SetChi2MIP(ichi, track->GetChi2MIP(ichi)); |
e43c066c | 3120 | } |
3121 | if (chi2 < minchi2){ | |
15dd636f | 3122 | //besttrack = new AliITStrackMI(*forwardtrack); |
99c2ee26 | 3123 | besttrack = track; |
e43c066c | 3124 | besttrack->SetLabel(track->GetLabel()); |
b9671574 | 3125 | besttrack->SetFakeRatio(track->GetFakeRatio()); |
e43c066c | 3126 | minchi2 = chi2; |
791f9a2a | 3127 | //original->fD[0] = forwardtrack->GetD(GetX(),GetY()); |
3128 | //original->fD[1] = forwardtrack->GetZat(GetX())-GetZ(); | |
b9671574 | 3129 | forwardtrack->GetDZ(GetX(),GetY(),GetZ(),original->GetDP()); //I.B. |
e43c066c | 3130 | } |
3131 | } | |
3132 | delete backtrack; | |
3133 | delete forwardtrack; | |
3134 | Int_t accepted=0; | |
3135 | for (Int_t i=0;i<entries;i++){ | |
15dd636f | 3136 | AliITStrackMI * track = (AliITStrackMI*)array->At(i); |
e43c066c | 3137 | if (!track) continue; |
628e7bb0 | 3138 | |
44347160 | 3139 | if (accepted>checkmax || track->GetChi2MIP(3)>AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3)*6. || |
e43c066c | 3140 | (track->GetNumberOfClusters()<besttrack->GetNumberOfClusters()-1.)|| |
b9671574 | 3141 | track->GetChi2MIP(0)>besttrack->GetChi2MIP(0)+2.*besttrack->GetNUsed()+3.){ |
3142 | if (track->GetConstrain() || track->GetNumberOfClusters()>5){ //keep best short tracks - without vertex constrain | |
628e7bb0 | 3143 | delete array->RemoveAt(i); |
3144 | continue; | |
3145 | } | |
e43c066c | 3146 | } |
3147 | else{ | |
3148 | accepted++; | |
3149 | } | |
3150 | } | |
3151 | // | |
3152 | array->Compress(); | |
3153 | SortTrackHypothesys(esdindex,checkmax,1); | |
3154 | array = (TObjArray*) fTrackHypothesys.At(esdindex); | |
afdf9b9c | 3155 | if (!array) return 0; // PH What can be the reason? Check SortTrackHypothesys |
15dd636f | 3156 | besttrack = (AliITStrackMI*)array->At(0); |
e43c066c | 3157 | if (!besttrack) return 0; |
b9671574 | 3158 | besttrack->SetChi2MIP(8,0); |
e43c066c | 3159 | fBestTrackIndex[esdindex]=0; |
3160 | entries = array->GetEntriesFast(); | |
15dd636f | 3161 | AliITStrackMI *longtrack =0; |
e43c066c | 3162 | minchi2 =1000; |
b9671574 | 3163 | Float_t minn=besttrack->GetNumberOfClusters()+besttrack->GetNDeadZone(); |
6518a6c5 | 3164 | for (Int_t itrack=entries-1;itrack>0;itrack--) { |
15dd636f | 3165 | AliITStrackMI * track = (AliITStrackMI*)array->At(itrack); |
b9671574 | 3166 | if (!track->GetConstrain()) continue; |
3167 | if (track->GetNumberOfClusters()+track->GetNDeadZone()<minn) continue; | |
3168 | if (track->GetChi2MIP(0)-besttrack->GetChi2MIP(0)>0.0) continue; | |
3169 | if (track->GetChi2MIP(0)>4.) continue; | |
3170 | minn = track->GetNumberOfClusters()+track->GetNDeadZone(); | |
e43c066c | 3171 | longtrack =track; |
3172 | } | |
3173 | //if (longtrack) besttrack=longtrack; | |
3174 | ||
3175 | Int_t list[6]; | |
00a7cc50 | 3176 | AliITSRecPoint * clist[6]; |
e43c066c | 3177 | Float_t shared = GetNumberOfSharedClusters(besttrack,esdindex,list,clist); |
44347160 | 3178 | if (besttrack->GetConstrain()&&besttrack->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)&&besttrack->GetChi2MIP(1)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(1) |
3179 | &&besttrack->GetChi2MIP(2)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(2)&&besttrack->GetChi2MIP(3)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3)){ | |
e43c066c | 3180 | RegisterClusterTracks(besttrack,esdindex); |
3181 | } | |
3182 | // | |
3183 | // | |
3184 | if (shared>0.0){ | |
3185 | Int_t nshared; | |
3186 | Int_t overlist[6]; | |
3187 | Int_t sharedtrack = GetOverlapTrack(besttrack, esdindex, nshared, list, overlist); | |
3188 | if (sharedtrack>=0){ | |
3189 | // | |
3190 | besttrack = GetBest2Tracks(esdindex,sharedtrack,10,5.5); | |
3191 | if (besttrack){ | |
3192 | shared = GetNumberOfSharedClusters(besttrack,esdindex,list,clist); | |
3193 | } | |
3194 | else return 0; | |
3195 | } | |
3196 | } | |
3197 | ||
3198 | if (shared>2.5) return 0; | |
3199 | if (shared>1.0) return besttrack; | |
3200 | // | |
628e7bb0 | 3201 | // Don't sign clusters if not gold track |
3202 | // | |
3203 | if (!besttrack->IsGoldPrimary()) return besttrack; | |
b9671574 | 3204 | if (besttrack->GetESDtrack()->GetKinkIndex(0)!=0) return besttrack; //track belong to kink |
628e7bb0 | 3205 | // |
e43c066c | 3206 | if (fConstraint[fPass]){ |
3207 | // | |
3208 | // sign clusters | |
3209 | // | |
3210 | Float_t *ny = GetNy(esdindex), *nz = GetNz(esdindex); | |
3211 | for (Int_t i=0;i<6;i++){ | |
b9671574 | 3212 | Int_t index = besttrack->GetClIndex(i); |
e43c066c | 3213 | if (index<=0) continue; |
3214 | Int_t ilayer = (index & 0xf0000000) >> 28; | |
b9671574 | 3215 | if (besttrack->GetSigmaY(ilayer)<0.00000000001) continue; |
00a7cc50 | 3216 | AliITSRecPoint *c = (AliITSRecPoint*)GetCluster(index); |
e43c066c | 3217 | if (!c) continue; |
3218 | if (ilayer>3&&c->GetNy()+c->GetNz()>6) continue; | |
3219 | if ( (c->GetNy()+c->GetNz() )> ny[i]+nz[i]+0.7) continue; //shared track | |
3220 | if ( c->GetNz()> nz[i]+0.7) continue; //shared track | |
572f41f9 | 3221 | if ( ilayer>2&& AliITSReconstructor::GetRecoParam()->GetUseAmplitudeInfo(ilayer)) |
3222 | if (besttrack->GetNormQ(ilayer)/besttrack->GetExpQ()>1.5) continue; | |
e43c066c | 3223 | //if ( c->GetNy()> ny[i]+0.7) continue; //shared track |
3224 | ||
3225 | Bool_t cansign = kTRUE; | |
3226 | for (Int_t itrack=0;itrack<entries; itrack++){ | |
15dd636f | 3227 | AliITStrackMI * track = (AliITStrackMI*)array->At(i); |
e43c066c | 3228 | if (!track) continue; |
b9671574 | 3229 | if (track->GetChi2MIP(0)>besttrack->GetChi2MIP(0)+2.*shared+1.) break; |
3230 | if ( (track->GetClIndex(ilayer)>0) && (track->GetClIndex(ilayer)!=besttrack->GetClIndex(ilayer))){ | |
e43c066c | 3231 | cansign = kFALSE; |
3232 | break; | |
3233 | } | |
3234 | } | |
3235 | if (cansign){ | |
b9671574 | 3236 | if (TMath::Abs(besttrack->GetDy(ilayer)/besttrack->GetSigmaY(ilayer))>3.) continue; |
3237 | if (TMath::Abs(besttrack->GetDz(ilayer)/besttrack->GetSigmaZ(ilayer))>3.) continue; | |
e43c066c | 3238 | if (!c->IsUsed()) c->Use(); |
3239 | } | |
3240 | } | |
3241 | } | |
3242 | return besttrack; | |
3243 | } | |
44347160 | 3244 | //------------------------------------------------------------------------ |
e43c066c | 3245 | void AliITStrackerMI::GetBestHypothesysMIP(TObjArray &itsTracks) |
3246 | { | |
3247 | // | |
3248 | // get "best" hypothesys | |
628e7bb0 | 3249 | // |
e43c066c | 3250 | |
3251 | Int_t nentries = itsTracks.GetEntriesFast(); | |
3252 | for (Int_t i=0;i<nentries;i++){ | |
15dd636f | 3253 | AliITStrackMI* track = (AliITStrackMI*)itsTracks.At(i); |
e43c066c | 3254 | if (!track) continue; |
3255 | TObjArray * array = (TObjArray*) fTrackHypothesys.At(i); | |
3256 | if (!array) continue; | |
3257 | if (array->GetEntriesFast()<=0) continue; | |
3258 | // | |
15dd636f | 3259 | AliITStrackMI* longtrack=0; |
e43c066c | 3260 | Float_t minn=0; |
3261 | Float_t maxchi2=1000; | |
3262 | for (Int_t j=0;j<array->GetEntriesFast();j++){ | |
15dd636f | 3263 | AliITStrackMI* track = (AliITStrackMI*)array->At(j); |
e43c066c | 3264 | if (!track) continue; |
b9671574 | 3265 | if (track->GetGoldV0()) { |
628e7bb0 | 3266 | longtrack = track; //gold V0 track taken |
3267 | break; | |
3268 | } | |
b9671574 | 3269 | if (track->GetNumberOfClusters()+track->GetNDeadZone()<minn) continue; |
3270 | Float_t chi2 = track->GetChi2MIP(0); | |
628e7bb0 | 3271 | if (fAfterV0){ |
b9671574 | 3272 | if (!track->GetGoldV0()&&track->GetConstrain()==kFALSE) chi2+=5; |
628e7bb0 | 3273 | } |
b9671574 | 3274 | if (track->GetNumberOfClusters()+track->GetNDeadZone()>minn) maxchi2 = track->GetChi2MIP(0); |
628e7bb0 | 3275 | // |
3276 | if (chi2 > maxchi2) continue; | |
b9671574 | 3277 | minn= track->GetNumberOfClusters()+track->GetNDeadZone(); |
628e7bb0 | 3278 | maxchi2 = chi2; |
e43c066c | 3279 | longtrack=track; |
e43c066c | 3280 | } |
628e7bb0 | 3281 | // |
3282 | // | |
3283 | // | |
15dd636f | 3284 | AliITStrackMI * besttrack = (AliITStrackMI*)array->At(0); |
e43c066c | 3285 | if (!longtrack) {longtrack = besttrack;} |
3286 | else besttrack= longtrack; | |
628e7bb0 | 3287 | // |
afd25725 | 3288 | if (besttrack) { |
e43c066c | 3289 | Int_t list[6]; |
00a7cc50 | 3290 | AliITSRecPoint * clist[6]; |
e43c066c | 3291 | Float_t shared = GetNumberOfSharedClusters(longtrack,i,list,clist); |
3292 | // | |
b9671574 | 3293 | track->SetNUsed(shared); |
3294 | track->SetNSkipped(besttrack->GetNSkipped()); | |
3295 | track->SetChi2MIP(0,besttrack->GetChi2MIP(0)); | |
afd25725 | 3296 | if (shared>0) { |
3297 | if(!AliITSReconstructor::GetRecoParam()->GetAllowSharedClusters()) continue; | |
e43c066c | 3298 | Int_t nshared; |
3299 | Int_t overlist[6]; | |
3300 | // | |
3301 | Int_t sharedtrack = GetOverlapTrack(longtrack, i, nshared, list, overlist); | |
3302 | //if (sharedtrack==-1) sharedtrack=0; | |
afd25725 | 3303 | if (sharedtrack>=0) { |
e43c066c | 3304 | besttrack = GetBest2Tracks(i,sharedtrack,10,5.5); |
3305 | } | |
3306 | } | |
afd25725 | 3307 | if (besttrack&&fAfterV0) { |
628e7bb0 | 3308 | UpdateESDtrack(besttrack,AliESDtrack::kITSin); |
3309 | } | |
e43c066c | 3310 | if (besttrack&&fConstraint[fPass]) |
3311 | UpdateESDtrack(besttrack,AliESDtrack::kITSin); | |
afd25725 | 3312 | if (besttrack->GetChi2MIP(0)+besttrack->GetNUsed()>1.5 && fConstraint[fPass]) { |
3313 | if ( TMath::Abs(besttrack->GetD(0))>0.1 || | |
3314 | TMath::Abs(besttrack->GetD(1))>0.1 ) track->SetReconstructed(kFALSE); | |
e43c066c | 3315 | } |
3316 | ||
3317 | } | |
3318 | } | |
3319 | } | |
44347160 | 3320 | //------------------------------------------------------------------------ |
15dd636f | 3321 | void AliITStrackerMI::CookLabel(AliITStrackMI *track,Float_t wrong) const { |
e43c066c | 3322 | //-------------------------------------------------------------------- |
3323 | //This function "cooks" a track label. If label<0, this track is fake. | |
3324 | //-------------------------------------------------------------------- | |
3325 | Int_t tpcLabel=-1; | |
3326 | ||
b9671574 | 3327 | if ( track->GetESDtrack()) tpcLabel = TMath::Abs(track->GetESDtrack()->GetTPCLabel()); |
e43c066c | 3328 | |
b9671574 | 3329 | track->SetChi2MIP(9,0); |
e43c066c | 3330 | Int_t nwrong=0; |
3331 | for (Int_t i=0;i<track->GetNumberOfClusters();i++){ | |
3332 | Int_t cindex = track->GetClusterIndex(i); | |
3333 | Int_t l=(cindex & 0xf0000000) >> 28; | |
00a7cc50 | 3334 | AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(cindex); |
e43c066c | 3335 | Int_t isWrong=1; |
3336 | for (Int_t ind=0;ind<3;ind++){ | |
3337 | if (tpcLabel>0) | |
3338 | if (cl->GetLabel(ind)==tpcLabel) isWrong=0; | |
3339 | } | |
b9671574 | 3340 | track->SetChi2MIP(9,track->GetChi2MIP(9)+isWrong*(2<<l)); |
e43c066c | 3341 | nwrong+=isWrong; |
3342 | } | |
7d43b4c4 | 3343 | Int_t nclusters = track->GetNumberOfClusters(); |
3344 | if (nclusters > 0) //PH Some tracks don't have any cluster | |
3345 | track->SetFakeRatio(double(nwrong)/double(nclusters)); | |
e43c066c | 3346 | if (tpcLabel>0){ |
b9671574 | 3347 | if (track->GetFakeRatio()>wrong) track->SetLabel(-tpcLabel); |
e43c066c | 3348 | else |
b9671574 | 3349 | track->SetLabel(tpcLabel); |
e43c066c | 3350 | } |
3351 | ||
3352 | } | |
44347160 | 3353 | //------------------------------------------------------------------------ |
15dd636f | 3354 | void AliITStrackerMI::CookdEdx(AliITStrackMI* track) |
e43c066c | 3355 | { |
3356 | // | |
3357 | // | |
3358 | // Int_t list[6]; | |
00a7cc50 | 3359 | //AliITSRecPoint * clist[6]; |
e43c066c | 3360 | // Int_t shared = GetNumberOfSharedClusters(track,index,list,clist); |
3361 | Float_t dedx[4]; | |
3362 | Int_t accepted=0; | |
b9671574 | 3363 | track->SetChi2MIP(9,0); |
e43c066c | 3364 | for (Int_t i=0;i<track->GetNumberOfClusters();i++){ |
3365 | Int_t cindex = track->GetClusterIndex(i); | |
3366 | Int_t l=(cindex & 0xf0000000) >> 28; | |
00a7cc50 | 3367 | AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(cindex); |
b9671574 | 3368 | Int_t lab = TMath::Abs(track->GetESDtrack()->GetTPCLabel()); |
e43c066c | 3369 | Int_t isWrong=1; |
3370 | for (Int_t ind=0;ind<3;ind++){ | |
3371 | if (cl->GetLabel(ind)==lab) isWrong=0; | |
3372 | } | |
b9671574 | 3373 | track->SetChi2MIP(9,track->GetChi2MIP(9)+isWrong*(2<<l)); |
e43c066c | 3374 | if (l<2) continue; |
3375 | //if (l>3 && (cl->GetNy()>4) || (cl->GetNz()>4)) continue; //shared track | |
3376 | //if (l>3&& !(cl->GetType()==1||cl->GetType()==10)) continue; | |
3377 | //if (l<4&& !(cl->GetType()==1)) continue; | |
b9671574 | 3378 | dedx[accepted]= track->GetSampledEdx(i); |
e43c066c | 3379 | //dedx[accepted]= track->fNormQ[l]; |
3380 | accepted++; | |
3381 | } | |
3382 | if (accepted<1) { | |
3383 | track->SetdEdx(0); | |
3384 | return; | |
3385 | } | |
3386 | Int_t indexes[4]; | |
3387 | TMath::Sort(accepted,dedx,indexes,kFALSE); | |
3388 | Double_t low=0.; | |
3389 | Double_t up=0.51; | |
3390 | Double_t nl=low*accepted, nu =up*accepted; | |
3391 | Float_t sumamp = 0; | |
3392 | Float_t sumweight =0; | |
3393 | for (Int_t i=0; i<accepted; i++) { | |
3394 | Float_t weight =1; | |
3395 | if (i<nl+0.1) weight = TMath::Max(1.-(nl-i),0.); | |
3396 | if (i>nu-1) weight = TMath::Max(nu-i,0.); | |
3397 | sumamp+= dedx[indexes[i]]*weight; | |
3398 | sumweight+=weight; | |
3399 | } | |
3400 | track->SetdEdx(sumamp/sumweight); | |
3401 | } | |
44347160 | 3402 | //------------------------------------------------------------------------ |
e50912db | 3403 | void AliITStrackerMI::MakeCoefficients(Int_t ntracks){ |
e43c066c | 3404 | // |
3405 | // | |
afd25725 | 3406 | if (fCoefficients) delete []fCoefficients; |
3407 | fCoefficients = new Float_t[ntracks*48]; | |
3408 | for (Int_t i=0;i<ntracks*48;i++) fCoefficients[i]=-1.; | |
e43c066c | 3409 | } |
44347160 | 3410 | //------------------------------------------------------------------------ |
00a7cc50 | 3411 | Double_t AliITStrackerMI::GetPredictedChi2MI(AliITStrackMI* track, const AliITSRecPoint *cluster,Int_t layer) |
e43c066c | 3412 | { |
3413 | // | |
3414 | // | |
3415 | // | |
3416 | Float_t erry,errz; | |
3417 | Float_t theta = track->GetTgl(); | |
3418 | Float_t phi = track->GetSnp(); | |
3419 | phi = TMath::Sqrt(phi*phi/(1.-phi*phi)); | |
e50912db | 3420 | AliITSClusterParam::GetError(layer,cluster,theta,phi,track->GetExpQ(),erry,errz); |
e43c066c | 3421 | Double_t chi2 = track->GetPredictedChi2MI(cluster->GetY(),cluster->GetZ(),erry,errz); |
3422 | Float_t ny,nz; | |
e50912db | 3423 | AliITSClusterParam::GetNTeor(layer,cluster,theta,phi,ny,nz); |
e43c066c | 3424 | Double_t delta = cluster->GetNy()+cluster->GetNz()-nz-ny; |
3425 | if (delta>1){ | |
3426 | chi2+=0.5*TMath::Min(delta/2,2.); | |
3427 | chi2+=2.*cluster->GetDeltaProbability(); | |
3428 | } | |
3429 | // | |
b9671574 | 3430 | track->SetNy(layer,ny); |
3431 | track->SetNz(layer,nz); | |
3432 | track->SetSigmaY(layer,erry); | |
3433 | track->SetSigmaZ(layer, errz); | |
e43c066c | 3434 | //track->fNormQ[layer] = cluster->GetQ()/TMath::Sqrt(1+theta*theta+phi*phi); |
b9671574 | 3435 | track->SetNormQ(layer,cluster->GetQ()/TMath::Sqrt((1.+ track->GetTgl()*track->GetTgl())/(1.- track->GetSnp()*track->GetSnp()))); |
e43c066c | 3436 | return chi2; |
3437 | ||
3438 | } | |
e50912db | 3439 | //------------------------------------------------------------------------ |
3440 | Int_t AliITStrackerMI::UpdateMI(AliITStrackMI* track, const AliITSRecPoint* cl,Double_t chi2,Int_t index) const | |
e43c066c | 3441 | { |
3442 | // | |
3443 | // | |
3444 | // | |
3445 | Int_t layer = (index & 0xf0000000) >> 28; | |
b9671574 | 3446 | track->SetClIndex(layer, index); |
572f41f9 | 3447 | if (layer>1&&AliITSReconstructor::GetRecoParam()->GetUseAmplitudeInfo(layer)) { |
3448 | if (track->GetNormQ(layer)/track->GetExpQ()<0.5 ) { | |
3449 | chi2+= (0.5-track->GetNormQ(layer)/track->GetExpQ())*10.; | |
3450 | track->SetdEdxMismatch(track->GetdEdxMismatch()+(0.5-track->GetNormQ(layer)/track->GetExpQ())*10.); | |
3451 | } | |
e43c066c | 3452 | } |
a504d56f | 3453 | |
1f3e997f | 3454 | if (cl->GetQ()<=0) return 0; // ingore the "virtual" clusters |
a504d56f | 3455 | |
afd25725 | 3456 | //Float_t clxyz[3]; cl->GetGlobalXYZ(clxyz);Double_t trxyz[3]; track->GetXYZ(trxyz);printf("gtr %f %f %f\n",trxyz[0],trxyz[1],trxyz[2]);printf("gcl %f %f %f\n",clxyz[0],clxyz[1],clxyz[2]); |
3457 | ||
3458 | ||
1f3e997f | 3459 | // Take into account the mis-alignment |
3460 | Double_t x=track->GetX()+cl->GetX(); | |
3461 | if (!track->PropagateTo(x,0.,0.)) return 0; | |
3462 | ||
150f264c | 3463 | AliCluster c(*cl); |
3464 | c.SetSigmaY2(track->GetSigmaY(layer)*track->GetSigmaY(layer)); | |
3465 | c.SetSigmaZ2(track->GetSigmaZ(layer)*track->GetSigmaZ(layer)); | |
3466 | ||
3467 | return track->UpdateMI(&c,chi2,index); | |
e43c066c | 3468 | } |
150f264c | 3469 | |
44347160 | 3470 | //------------------------------------------------------------------------ |
e50912db | 3471 | void AliITStrackerMI::GetDCASigma(AliITStrackMI* track, Float_t & sigmarfi, Float_t &sigmaz) |
628e7bb0 | 3472 | { |
3473 | // | |
3474 | //DCA sigmas parameterization | |
3475 | //to be paramterized using external parameters in future | |
3476 | // | |
3477 | // | |
afd25725 | 3478 | sigmarfi = 0.0040+1.4 *TMath::Abs(track->GetC())+332.*track->GetC()*track->GetC(); |
3479 | sigmaz = 0.0110+4.37*TMath::Abs(track->GetC()); | |
628e7bb0 | 3480 | } |
e50912db | 3481 | //------------------------------------------------------------------------ |
e43c066c | 3482 | void AliITStrackerMI::SignDeltas( TObjArray *ClusterArray, Float_t vz) |
3483 | { | |
3484 | // | |
3485 | // | |
3486 | Int_t entries = ClusterArray->GetEntriesFast(); | |
3487 | if (entries<4) return; | |
00a7cc50 | 3488 | AliITSRecPoint* cluster = (AliITSRecPoint*)ClusterArray->At(0); |
e43c066c | 3489 | Int_t layer = cluster->GetLayer(); |
3490 | if (layer>1) return; | |
3491 | Int_t index[10000]; | |
3492 | Int_t ncandidates=0; | |
3493 | Float_t r = (layer>0)? 7:4; | |
3494 | // | |
3495 | for (Int_t i=0;i<entries;i++){ | |
00a7cc50 | 3496 | AliITSRecPoint* cl0 = (AliITSRecPoint*)ClusterArray->At(i); |
e43c066c | 3497 | Float_t nz = 1+TMath::Abs((cl0->GetZ()-vz)/r); |
3498 | if (cl0->GetNy()+cl0->GetNz()<=5+2*layer+nz) continue; | |
3499 | index[ncandidates] = i; //candidate to belong to delta electron track | |
3500 | ncandidates++; | |
3501 | if (cl0->GetNy()+cl0->GetNz()>9+2*layer+nz) { | |
3502 | cl0->SetDeltaProbability(1); | |
3503 | } | |
3504 | } | |
3505 | // | |
3506 | // | |
3507 | // | |
3508 | for (Int_t i=0;i<ncandidates;i++){ | |
00a7cc50 | 3509 | AliITSRecPoint* cl0 = (AliITSRecPoint*)ClusterArray->At(index[i]); |
e43c066c | 3510 | if (cl0->GetDeltaProbability()>0.8) continue; |
3511 | // | |
3512 | Int_t ncl = 0; | |
3513 | Float_t y[100],z[100],sumy,sumz,sumy2, sumyz, sumw; | |
3514 | sumy=sumz=sumy2=sumyz=sumw=0.0; | |
3515 | for (Int_t j=0;j<ncandidates;j++){ | |
3516 | if (i==j) continue; | |
00a7cc50 | 3517 | AliITSRecPoint* cl1 = (AliITSRecPoint*)ClusterArray->At(index[j]); |
e43c066c | 3518 | // |
3519 | Float_t dz = cl0->GetZ()-cl1->GetZ(); | |
3520 | Float_t dy = cl0->GetY()-cl1->GetY(); | |
3521 | if (TMath::Sqrt(dz*dz+dy*dy)<0.2){ | |
3522 | Float_t weight = cl1->GetNy()+cl1->GetNz()-2; | |
3523 | y[ncl] = cl1->GetY(); | |
3524 | z[ncl] = cl1->GetZ(); | |
3525 | sumy+= y[ncl]*weight; | |
3526 | sumz+= z[ncl]*weight; | |
3527 | sumy2+=y[ncl]*y[ncl]*weight; | |
3528 | sumyz+=y[ncl]*z[ncl]*weight; | |
3529 | sumw+=weight; | |
3530 | ncl++; | |
3531 | } | |
3532 | } | |
3533 | if (ncl<4) continue; | |
3534 | Float_t det = sumw*sumy2 - sumy*sumy; | |
3535 | Float_t delta=1000; | |
3536 | if (TMath::Abs(det)>0.01){ | |
3537 | Float_t z0 = (sumy2*sumz - sumy*sumyz)/det; | |
3538 | Float_t k = (sumyz*sumw - sumy*sumz)/det; | |
3539 | delta = TMath::Abs(cl0->GetZ()-(z0+k*cl0->GetY())); | |
3540 | } | |
3541 | else{ | |
3542 | Float_t z0 = sumyz/sumy; | |
3543 | delta = TMath::Abs(cl0->GetZ()-z0); | |
3544 | } | |
3545 | if ( delta<0.05) { | |
3546 | cl0->SetDeltaProbability(1-20.*delta); | |
3547 | } | |
3548 | } | |
3549 | } | |
44347160 | 3550 | //------------------------------------------------------------------------ |
15dd636f | 3551 | void AliITStrackerMI::UpdateESDtrack(AliITStrackMI* track, ULong_t flags) const |
e43c066c | 3552 | { |
3553 | // | |
3554 | // | |
3555 | track->UpdateESDtrack(flags); | |
b9671574 | 3556 | AliITStrackMI * oldtrack = (AliITStrackMI*)(track->GetESDtrack()->GetITStrack()); |
99c2ee26 | 3557 | if (oldtrack) delete oldtrack; |
b9671574 | 3558 | track->GetESDtrack()->SetITStrack(new AliITStrackMI(*track)); |
3559 | if (TMath::Abs(track->GetDnorm(1))<0.000000001){ | |
628e7bb0 | 3560 | printf("Problem\n"); |
3561 | } | |
e43c066c | 3562 | } |
44347160 | 3563 | //------------------------------------------------------------------------ |
81e97e0d | 3564 | Int_t AliITStrackerMI::GetNearestLayer(const Double_t *xr) const{ |
3565 | // | |
ae00569a | 3566 | // Get nearest upper layer close to the point xr. |
81e97e0d | 3567 | // rough approximation |
3568 | // | |
bf6adc12 | 3569 | const Float_t kRadiuses[6]={4,6.5,15.03,24.,38.5,43.7}; |
81e97e0d | 3570 | Float_t radius = TMath::Sqrt(xr[0]*xr[0]+xr[1]*xr[1]); |
3571 | Int_t res =6; | |
3572 | for (Int_t i=0;i<6;i++){ | |
bf6adc12 | 3573 | if (radius<kRadiuses[i]){ |
81e97e0d | 3574 | res =i; |
3575 | break; | |
3576 | } | |
3577 | } | |
3578 | return res; | |
3579 | } | |
44347160 | 3580 | //------------------------------------------------------------------------ |
af885e0f | 3581 | void AliITStrackerMI::UpdateTPCV0(AliESDEvent *event){ |
81e97e0d | 3582 | // |
3583 | //try to update, or reject TPC V0s | |
3584 | // | |
d6a49f20 | 3585 | Int_t nv0s = event->GetNumberOfV0s(); |
81e97e0d | 3586 | Int_t nitstracks = fTrackHypothesys.GetEntriesFast(); |
51ad6848 | 3587 | |
81e97e0d | 3588 | for (Int_t i=0;i<nv0s;i++){ |
d6a49f20 | 3589 | AliESDv0 * vertex = event->GetV0(i); |
81e97e0d | 3590 | Int_t ip = vertex->GetIndex(0); |
3591 | Int_t im = vertex->GetIndex(1); | |
3592 | // | |
3593 | TObjArray * arrayp = (ip<nitstracks) ? (TObjArray*)fTrackHypothesys.At(ip):0; | |
3594 | TObjArray * arraym = (im<nitstracks) ? (TObjArray*)fTrackHypothesys.At(im):0; | |
3595 | AliITStrackMI * trackp = (arrayp!=0) ? (AliITStrackMI*)arrayp->At(0):0; | |
3596 | AliITStrackMI * trackm = (arraym!=0) ? (AliITStrackMI*)arraym->At(0):0; | |
3597 | // | |
3598 | // | |
3599 | if (trackp){ | |
b9671574 | 3600 | if (trackp->GetNumberOfClusters()+trackp->GetNDeadZone()>5.5){ |
3601 | if (trackp->GetConstrain()&&trackp->GetChi2MIP(0)<3) vertex->SetStatus(-100); | |
3602 | if (!trackp->GetConstrain()&&trackp->GetChi2MIP(0)<2) vertex->SetStatus(-100); | |
81e97e0d | 3603 | } |
3604 | } | |
51ad6848 | 3605 | |
81e97e0d | 3606 | if (trackm){ |
b9671574 | 3607 | if (trackm->GetNumberOfClusters()+trackm->GetNDeadZone()>5.5){ |
3608 | if (trackm->GetConstrain()&&trackm->GetChi2MIP(0)<3) vertex->SetStatus(-100); | |
3609 | if (!trackm->GetConstrain()&&trackm->GetChi2MIP(0)<2) vertex->SetStatus(-100); | |
81e97e0d | 3610 | } |
3611 | } | |
3612 | if (vertex->GetStatus()==-100) continue; | |
3613 | // | |
b75d63a7 | 3614 | Double_t xrp[3]; vertex->GetXYZ(xrp[0],xrp[1],xrp[2]); //I.B. |
3615 | Int_t clayer = GetNearestLayer(xrp); //I.B. | |
81e97e0d | 3616 | vertex->SetNBefore(clayer); // |
3617 | vertex->SetChi2Before(9*clayer); // | |
3618 | vertex->SetNAfter(6-clayer); // | |
3619 | vertex->SetChi2After(0); // | |
3620 | // | |
3621 | if (clayer >1 ){ // calculate chi2 before vertex | |
3622 | Float_t chi2p = 0, chi2m=0; | |
3623 | // | |
3624 | if (trackp){ | |
3625 | for (Int_t ilayer=0;ilayer<clayer;ilayer++){ | |
b9671574 | 3626 | if (trackp->GetClIndex(ilayer)>0){ |
3627 | chi2p+=trackp->GetDy(ilayer)*trackp->GetDy(ilayer)/(trackp->GetSigmaY(ilayer)*trackp->GetSigmaY(ilayer))+ | |
3628 | trackp->GetDz(ilayer)*trackp->GetDz(ilayer)/(trackp->GetSigmaZ(ilayer)*trackp->GetSigmaZ(ilayer)); | |
81e97e0d | 3629 | } |
3630 | else{ | |
3631 | chi2p+=9; | |
3632 | } | |
3633 | } | |
3634 | }else{ | |
3635 | chi2p = 9*clayer; | |
3636 | } | |
3637 | // | |
3638 | if (trackm){ | |
3639 | for (Int_t ilayer=0;ilayer<clayer;ilayer++){ | |
b9671574 | 3640 | if (trackm->GetClIndex(ilayer)>0){ |
3641 | chi2m+=trackm->GetDy(ilayer)*trackm->GetDy(ilayer)/(trackm->GetSigmaY(ilayer)*trackm->GetSigmaY(ilayer))+ | |
3642 | trackm->GetDz(ilayer)*trackm->GetDz(ilayer)/(trackm->GetSigmaZ(ilayer)*trackm->GetSigmaZ(ilayer)); | |
81e97e0d | 3643 | } |
3644 | else{ | |
3645 | chi2m+=9; | |
3646 | } | |
3647 | } | |
3648 | }else{ | |
3649 | chi2m = 9*clayer; | |
3650 | } | |
3651 | vertex->SetChi2Before(TMath::Min(chi2p,chi2m)); | |
3652 | if (TMath::Min(chi2p,chi2m)/Float_t(clayer)<4) vertex->SetStatus(-10); // track exist before vertex | |
3653 | } | |
3654 | ||
3655 | if (clayer < 5 ){ // calculate chi2 after vertex | |
3656 | Float_t chi2p = 0, chi2m=0; | |
3657 | // | |
6c94f330 | 3658 | if (trackp&&TMath::Abs(trackp->GetTgl())<1.){ |
81e97e0d | 3659 | for (Int_t ilayer=clayer;ilayer<6;ilayer++){ |
b9671574 | 3660 | if (trackp->GetClIndex(ilayer)>0){ |
3661 | chi2p+=trackp->GetDy(ilayer)*trackp->GetDy(ilayer)/(trackp->GetSigmaY(ilayer)*trackp->GetSigmaY(ilayer))+ | |
3662 | trackp->GetDz(ilayer)*trackp->GetDz(ilayer)/(trackp->GetSigmaZ(ilayer)*trackp->GetSigmaZ(ilayer)); | |
81e97e0d | 3663 | } |
3664 | else{ | |
3665 | chi2p+=9; | |
3666 | } | |
3667 | } | |
3668 | }else{ | |
3669 | chi2p = 0; | |
3670 | } | |
3671 | // | |
6c94f330 | 3672 | if (trackm&&TMath::Abs(trackm->GetTgl())<1.){ |
81e97e0d | 3673 | for (Int_t ilayer=clayer;ilayer<6;ilayer++){ |
b9671574 | 3674 | if (trackm->GetClIndex(ilayer)>0){ |
3675 | chi2m+=trackm->GetDy(ilayer)*trackm->GetDy(ilayer)/(trackm->GetSigmaY(ilayer)*trackm->GetSigmaY(ilayer))+ | |
3676 | trackm->GetDz(ilayer)*trackm->GetDz(ilayer)/(trackm->GetSigmaZ(ilayer)*trackm->GetSigmaZ(ilayer)); | |
81e97e0d | 3677 | } |
3678 | else{ | |
3679 | chi2m+=9; | |
3680 | } | |
3681 | } | |
3682 | }else{ | |
3683 | chi2m = 0; | |
3684 | } | |
3685 | vertex->SetChi2After(TMath::Max(chi2p,chi2m)); | |
3686 | if (TMath::Max(chi2m,chi2p)/Float_t(6-clayer)>9) vertex->SetStatus(-20); // track not found in ITS | |
3687 | } | |
3688 | } | |
3689 | // | |
3690 | } | |
44347160 | 3691 | //------------------------------------------------------------------------ |
e50912db | 3692 | void AliITStrackerMI::FindV02(AliESDEvent *event) |
e43c066c | 3693 | { |
3694 | // | |
81e97e0d | 3695 | // V0 finder |
3696 | // | |
3697 | // Cuts on DCA - R dependent | |
3698 | // max distance DCA between 2 tracks cut | |
3699 | // maxDist = TMath::Min(kMaxDist,kMaxDist0+pvertex->GetRr()*kMaxDist); | |
3700 | // | |
3701 | const Float_t kMaxDist0 = 0.1; | |
3702 | const Float_t kMaxDist1 = 0.1; | |
3703 | const Float_t kMaxDist = 1; | |
3704 | const Float_t kMinPointAngle = 0.85; | |
3705 | const Float_t kMinPointAngle2 = 0.99; | |
3706 | const Float_t kMinR = 0.5; | |
3707 | const Float_t kMaxR = 220; | |
3708 | //const Float_t kCausality0Cut = 0.19; | |
3709 | //const Float_t kLikelihood01Cut = 0.25; | |
3710 | //const Float_t kPointAngleCut = 0.9996; | |
3711 | const Float_t kCausality0Cut = 0.19; | |
3712 | const Float_t kLikelihood01Cut = 0.45; | |
3713 | const Float_t kLikelihood1Cut = 0.5; | |
3714 | const Float_t kCombinedCut = 0.55; | |
3715 | ||
3716 | // | |
3717 | // | |
3718 | TTreeSRedirector &cstream = *fDebugStreamer; | |
3719 | Int_t ntracks = event->GetNumberOfTracks(); | |
3720 | Int_t nitstracks = fTrackHypothesys.GetEntriesFast(); | |
3721 | fOriginal.Expand(ntracks); | |
3722 | fTrackHypothesys.Expand(ntracks); | |
3723 | fBestHypothesys.Expand(ntracks); | |
3724 | // | |
3725 | AliHelix * helixes = new AliHelix[ntracks+2]; | |
3726 | TObjArray trackarray(ntracks+2); //array with tracks - with vertex constrain | |
3727 | TObjArray trackarrayc(ntracks+2); //array of "best tracks" - without vertex constrain | |
3728 | TObjArray trackarrayl(ntracks+2); //array of "longest tracks" - without vertex constrain | |
3729 | Bool_t * forbidden = new Bool_t [ntracks+2]; | |
3730 | Int_t *itsmap = new Int_t [ntracks+2]; | |
3731 | Float_t *dist = new Float_t[ntracks+2]; | |
3732 | Float_t *normdist0 = new Float_t[ntracks+2]; | |
3733 | Float_t *normdist1 = new Float_t[ntracks+2]; | |
3734 | Float_t *normdist = new Float_t[ntracks+2]; | |
3735 | Float_t *norm = new Float_t[ntracks+2]; | |
3736 | Float_t *maxr = new Float_t[ntracks+2]; | |
3737 | Float_t *minr = new Float_t[ntracks+2]; | |
3738 | Float_t *minPointAngle= new Float_t[ntracks+2]; | |
3739 | // | |
6c94f330 | 3740 | AliV0 *pvertex = new AliV0; |
81e97e0d | 3741 | AliITStrackMI * dummy= new AliITStrackMI; |
3742 | dummy->SetLabel(0); | |
3743 | AliITStrackMI trackat0; //temporary track for DCA calculation | |
e43c066c | 3744 | // |
81e97e0d | 3745 | Float_t primvertex[3]={GetX(),GetY(),GetZ()}; |
628e7bb0 | 3746 | // |
afd25725 | 3747 | // make ITS - ESD map |
e43c066c | 3748 | // |
81e97e0d | 3749 | for (Int_t itrack=0;itrack<ntracks+2;itrack++) { |
3750 | itsmap[itrack] = -1; | |
3751 | forbidden[itrack] = kFALSE; | |
3752 | maxr[itrack] = kMaxR; | |
3753 | minr[itrack] = kMinR; | |
3754 | minPointAngle[itrack] = kMinPointAngle; | |
3755 | } | |
3756 | for (Int_t itrack=0;itrack<nitstracks;itrack++){ | |
3757 | AliITStrackMI * original = (AliITStrackMI*)(fOriginal.At(itrack)); | |
b9671574 | 3758 | Int_t esdindex = original->GetESDtrack()->GetID(); |
81e97e0d | 3759 | itsmap[esdindex] = itrack; |
3760 | } | |
3761 | // | |
afd25725 | 3762 | // create ITS tracks from ESD tracks if not done before |
81e97e0d | 3763 | // |
3764 | for (Int_t itrack=0;itrack<ntracks;itrack++){ | |
3765 | if (itsmap[itrack]>=0) continue; | |
3766 | AliITStrackMI * tpctrack = new AliITStrackMI(*(event->GetTrack(itrack))); | |
791f9a2a | 3767 | //tpctrack->fD[0] = tpctrack->GetD(GetX(),GetY()); |
3768 | //tpctrack->fD[1] = tpctrack->GetZat(GetX())-GetZ(); | |
b9671574 | 3769 | tpctrack->GetDZ(GetX(),GetY(),GetZ(),tpctrack->GetDP()); //I.B. |
3770 | if (tpctrack->GetD(0)<20 && tpctrack->GetD(1)<20){ | |
81e97e0d | 3771 | // tracks which can reach inner part of ITS |
3772 | // propagate track to outer its volume - with correction for material | |
afd25725 | 3773 | CorrectForTPCtoITSDeadZoneMaterial(tpctrack); |
81e97e0d | 3774 | } |
3775 | itsmap[itrack] = nitstracks; | |
3776 | fOriginal.AddAt(tpctrack,nitstracks); | |
3777 | nitstracks++; | |
3778 | } | |
3779 | // | |
3780 | // fill temporary arrays | |
3781 | // | |
3782 | for (Int_t itrack=0;itrack<ntracks;itrack++){ | |
3783 | AliESDtrack * esdtrack = event->GetTrack(itrack); | |
3784 | Int_t itsindex = itsmap[itrack]; | |
3785 | AliITStrackMI *original = (AliITStrackMI*)fOriginal.At(itsmap[itrack]); | |
3786 | if (!original) continue; | |
3787 | AliITStrackMI *bestConst = 0; | |
3788 | AliITStrackMI *bestLong = 0; | |
3789 | AliITStrackMI *best = 0; | |
3790 | // | |
628e7bb0 | 3791 | // |
81e97e0d | 3792 | TObjArray * array = (TObjArray*) fTrackHypothesys.At(itsindex); |
3793 | Int_t hentries = (array==0) ? 0 : array->GetEntriesFast(); | |
3794 | // Get best track with vertex constrain | |
628e7bb0 | 3795 | for (Int_t ih=0;ih<hentries;ih++){ |
3796 | AliITStrackMI * trackh = (AliITStrackMI*)array->At(ih); | |
b9671574 | 3797 | if (!trackh->GetConstrain()) continue; |
81e97e0d | 3798 | if (!bestConst) bestConst = trackh; |
b9671574 | 3799 | if (trackh->GetNumberOfClusters()>5.0){ |
81e97e0d | 3800 | bestConst = trackh; // full track - with minimal chi2 |
3801 | break; | |
3802 | } | |
b9671574 | 3803 | if (trackh->GetNumberOfClusters()+trackh->GetNDeadZone()<=bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()) continue; |
81e97e0d | 3804 | bestConst = trackh; |
628e7bb0 | 3805 | break; |
81e97e0d | 3806 | } |
3807 | // Get best long track without vertex constrain and best track without vertex constrain | |
628e7bb0 | 3808 | for (Int_t ih=0;ih<hentries;ih++){ |
3809 | AliITStrackMI * trackh = (AliITStrackMI*)array->At(ih); | |
b9671574 | 3810 | if (trackh->GetConstrain()) continue; |
81e97e0d | 3811 | if (!best) best = trackh; |
3812 | if (!bestLong) bestLong = trackh; | |
b9671574 | 3813 | if (trackh->GetNumberOfClusters()>5.0){ |
81e97e0d | 3814 | bestLong = trackh; // full track - with minimal chi2 |
3815 | break; | |
3816 | } | |
b9671574 | 3817 | if (trackh->GetNumberOfClusters()+trackh->GetNDeadZone()<=bestLong->GetNumberOfClusters()+bestLong->GetNDeadZone()) continue; |
81e97e0d | 3818 | bestLong = trackh; |
628e7bb0 | 3819 | } |
81e97e0d | 3820 | if (!best) { |
3821 | best = original; | |
3822 | bestLong = original; | |
628e7bb0 | 3823 | } |
6c94f330 | 3824 | //I.B. trackat0 = *bestLong; |
420c3064 | 3825 | new (&trackat0) AliITStrackMI(*bestLong); |
81e97e0d | 3826 | Double_t xx,yy,zz,alpha; |
3827 | bestLong->GetGlobalXYZat(bestLong->GetX(),xx,yy,zz); | |
3828 | alpha = TMath::ATan2(yy,xx); | |
3829 | trackat0.Propagate(alpha,0); | |
3830 | // calculate normalized distances to the vertex | |
628e7bb0 | 3831 | // |
6c94f330 | 3832 | Float_t ptfac = (1.+100.*TMath::Abs(trackat0.GetC())); |
b9671574 | 3833 | if ( bestLong->GetNumberOfClusters()>3 ){ |
6c94f330 | 3834 | dist[itsindex] = trackat0.GetY(); |
3835 | norm[itsindex] = ptfac*TMath::Sqrt(trackat0.GetSigmaY2()); | |
3836 | normdist0[itsindex] = TMath::Abs(trackat0.GetY()/norm[itsindex]); | |
3837 | normdist1[itsindex] = TMath::Abs((trackat0.GetZ()-primvertex[2])/(ptfac*TMath::Sqrt(trackat0.GetSigmaZ2()))); | |
81e97e0d | 3838 | normdist[itsindex] = TMath::Sqrt(normdist0[itsindex]*normdist0[itsindex]+normdist1[itsindex]*normdist1[itsindex]); |
29641977 | 3839 | if (!bestConst){ |
b9671574 | 3840 | if (bestLong->GetNumberOfClusters()+bestLong->GetNDeadZone()<6) normdist[itsindex]*=2.; |
3841 | if (bestLong->GetNumberOfClusters()+bestLong->GetNDeadZone()<5) normdist[itsindex]*=2.; | |
3842 | if (bestLong->GetNumberOfClusters()+bestLong->GetNDeadZone()<4) normdist[itsindex]*=2.; | |
29641977 | 3843 | }else{ |
b9671574 | 3844 | if (bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()<6) normdist[itsindex]*=1.5; |
3845 | if (bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()<5) normdist[itsindex]*=1.5; | |
29641977 | 3846 | } |
81e97e0d | 3847 | } |
3848 | else{ | |
b9671574 | 3849 | if (bestConst&&bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()>4.5){ |
3850 | dist[itsindex] = bestConst->GetD(0); | |
3851 | norm[itsindex] = bestConst->GetDnorm(0); | |
3852 | normdist0[itsindex] = TMath::Abs(bestConst->GetD(0)/norm[itsindex]); | |
3853 | normdist1[itsindex] = TMath::Abs(bestConst->GetD(0)/norm[itsindex]); | |
81e97e0d | 3854 | normdist[itsindex] = TMath::Sqrt(normdist0[itsindex]*normdist0[itsindex]+normdist1[itsindex]*normdist1[itsindex]); |
3855 | }else{ | |
6c94f330 | 3856 | dist[itsindex] = trackat0.GetY(); |
3857 | norm[itsindex] = ptfac*TMath::Sqrt(trackat0.GetSigmaY2()); | |
3858 | normdist0[itsindex] = TMath::Abs(trackat0.GetY()/norm[itsindex]); | |
3859 | normdist1[itsindex] = TMath::Abs((trackat0.GetZ()-primvertex[2])/(ptfac*TMath::Sqrt(trackat0.GetSigmaZ2()))); | |
81e97e0d | 3860 | normdist[itsindex] = TMath::Sqrt(normdist0[itsindex]*normdist0[itsindex]+normdist1[itsindex]*normdist1[itsindex]); |
6c94f330 | 3861 | if (TMath::Abs(trackat0.GetTgl())>1.05){ |
67c1e979 | 3862 | if (normdist[itsindex]<3) forbidden[itsindex]=kTRUE; |
3863 | if (normdist[itsindex]>3) { | |
3864 | minr[itsindex] = TMath::Max(Float_t(40.),minr[itsindex]); | |
3865 | } | |
81e97e0d | 3866 | } |
3867 | } | |
3868 | } | |
628e7bb0 | 3869 | // |
81e97e0d | 3870 | //----------------------------------------------------------- |
3871 | //Forbid primary track candidates - | |
628e7bb0 | 3872 | // |
81e97e0d | 3873 | //treetr->SetAlias("forbidden0","Tr0.fN<4&&Tr1.fN+Tr1.fNDeadZone>4.5"); |
3874 | //treetr->SetAlias("forbidden1","ND<3&&Tr1.fN+Tr1.fNDeadZone>5.5"); | |
3875 | //treetr->SetAlias("forbidden2","ND<2&&Tr1.fClIndex[0]>0&&Tr1.fClIndex[0]>0"); | |
3876 | //treetr->SetAlias("forbidden3","ND<1&&Tr1.fClIndex[0]>0"); | |
3877 | //treetr->SetAlias("forbidden4","ND<4&&Tr1.fNormChi2[0]<2"); | |
3878 | //treetr->SetAlias("forbidden5","ND<5&&Tr1.fNormChi2[0]<1"); | |
3879 | //----------------------------------------------------------- | |
3880 | if (bestConst){ | |
b9671574 | 3881 | if (bestLong->GetNumberOfClusters()<4 && bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()>4.5) forbidden[itsindex]=kTRUE; |
3882 | if (normdist[itsindex]<3 && bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()>5.5) forbidden[itsindex]=kTRUE; | |
3883 | if (normdist[itsindex]<2 && bestConst->GetClIndex(0)>0 && bestConst->GetClIndex(1)>0 ) forbidden[itsindex]=kTRUE; | |
3884 | if (normdist[itsindex]<1 && bestConst->GetClIndex(0)>0) forbidden[itsindex]=kTRUE; | |
3885 | if (normdist[itsindex]<4 && bestConst->GetNormChi2(0)<2) forbidden[itsindex]=kTRUE; | |
3886 | if (normdist[itsindex]<5 && bestConst->GetNormChi2(0)<1) forbidden[itsindex]=kTRUE; | |
3887 | if (bestConst->GetNormChi2(0)<2.5) { | |
81e97e0d | 3888 | minPointAngle[itsindex]= 0.9999; |
3889 | maxr[itsindex] = 10; | |
628e7bb0 | 3890 | } |
e43c066c | 3891 | } |
81e97e0d | 3892 | // |
3893 | //forbid daughter kink candidates | |
3894 | // | |
3895 | if (esdtrack->GetKinkIndex(0)>0) forbidden[itsindex] = kTRUE; | |
3896 | Bool_t isElectron = kTRUE; | |
29641977 | 3897 | Bool_t isProton = kTRUE; |
81e97e0d | 3898 | Double_t pid[5]; |
3899 | esdtrack->GetESDpid(pid); | |
3900 | for (Int_t i=1;i<5;i++){ | |
3901 | if (pid[0]<pid[i]) isElectron= kFALSE; | |
29641977 | 3902 | if (pid[4]<pid[i]) isProton= kFALSE; |
81e97e0d | 3903 | } |
3904 | if (isElectron){ | |
3905 | forbidden[itsindex]=kFALSE; | |
29641977 | 3906 | normdist[itsindex]*=-1; |
3907 | } | |
3908 | if (isProton){ | |
3909 | if (normdist[itsindex]>2) forbidden[itsindex]=kFALSE; | |
3910 | normdist[itsindex]*=-1; | |
81e97e0d | 3911 | } |
29641977 | 3912 | |
81e97e0d | 3913 | // |
3914 | // Causality cuts in TPC volume | |
3915 | // | |
3916 | if (esdtrack->GetTPCdensity(0,10) >0.6) maxr[itsindex] = TMath::Min(Float_t(110),maxr[itsindex]); | |
3917 | if (esdtrack->GetTPCdensity(10,30)>0.6) maxr[itsindex] = TMath::Min(Float_t(120),maxr[itsindex]); | |
3918 | if (esdtrack->GetTPCdensity(20,40)>0.6) maxr[itsindex] = TMath::Min(Float_t(130),maxr[itsindex]); | |
3919 | if (esdtrack->GetTPCdensity(30,50)>0.6) maxr[itsindex] = TMath::Min(Float_t(140),maxr[itsindex]); | |
3920 | // | |
b9671574 | 3921 | if (esdtrack->GetTPCdensity(0,60)<0.4&&bestLong->GetNumberOfClusters()<3) minr[itsindex]=100; |
81e97e0d | 3922 | // |
3923 | // | |
29641977 | 3924 | if (kFALSE){ |
81e97e0d | 3925 | cstream<<"Track"<< |
3926 | "Tr0.="<<best<< | |
3927 | "Tr1.="<<((bestConst)? bestConst:dummy)<< | |
3928 | "Tr2.="<<bestLong<< | |
3929 | "Tr3.="<<&trackat0<< | |
3930 | "Esd.="<<esdtrack<< | |
3931 | "Dist="<<dist[itsindex]<< | |
3932 | "ND0="<<normdist0[itsindex]<< | |
3933 | "ND1="<<normdist1[itsindex]<< | |
3934 | "ND="<<normdist[itsindex]<< | |
3935 | "Pz="<<primvertex[2]<< | |
3936 | "Forbid="<<forbidden[itsindex]<< | |
3937 | "\n"; | |
3938 | // | |
3939 | } | |
3940 | trackarray.AddAt(best,itsindex); | |
3941 | trackarrayc.AddAt(bestConst,itsindex); | |
3942 | trackarrayl.AddAt(bestLong,itsindex); | |
3943 | new (&helixes[itsindex]) AliHelix(*best); | |
e43c066c | 3944 | } |
628e7bb0 | 3945 | // |
3946 | // | |
81e97e0d | 3947 | // |
3948 | // first iterration of V0 finder | |
3949 | // | |
3950 | for (Int_t iesd0=0;iesd0<ntracks;iesd0++){ | |
3951 | Int_t itrack0 = itsmap[iesd0]; | |
3952 | if (forbidden[itrack0]) continue; | |
3953 | AliITStrackMI * btrack0 = (AliITStrackMI*)trackarray.At(itrack0); | |
3954 | if (!btrack0) continue; | |
420c3064 | 3955 | if (btrack0->GetSign()>0) continue; |
628e7bb0 | 3956 | AliITStrackMI *trackc0 = (AliITStrackMI*)trackarrayc.At(itrack0); |
3957 | // | |
81e97e0d | 3958 | for (Int_t iesd1=0;iesd1<ntracks;iesd1++){ |
3959 | Int_t itrack1 = itsmap[iesd1]; | |
3960 | if (forbidden[itrack1]) continue; | |
3961 | ||
3962 | AliITStrackMI * btrack1 = (AliITStrackMI*)trackarray.At(itrack1); | |
3963 | if (!btrack1) continue; | |
420c3064 | 3964 | if (btrack1->GetSign()<0) continue; |
81e97e0d | 3965 | Bool_t isGold = kFALSE; |
3966 | if (TMath::Abs(TMath::Abs(btrack0->GetLabel())-TMath::Abs(btrack1->GetLabel()))==1){ | |
3967 | isGold = kTRUE; | |
628e7bb0 | 3968 | } |
81e97e0d | 3969 | AliITStrackMI *trackc1 = (AliITStrackMI*)trackarrayc.At(itrack1); |
3970 | AliHelix &h1 = helixes[itrack0]; | |
3971 | AliHelix &h2 = helixes[itrack1]; | |
628e7bb0 | 3972 | // |
81e97e0d | 3973 | // find linear distance |
3974 | Double_t rmin =0; | |
628e7bb0 | 3975 | // |
51ad6848 | 3976 | // |
51ad6848 | 3977 | // |
81e97e0d | 3978 | Double_t phase[2][2],radius[2]; |
3979 | Int_t points = h1.GetRPHIintersections(h2, phase, radius); | |
3980 | if (points==0) continue; | |
c49fe0bf | 3981 | Double_t delta[2]={1000000,1000000}; |
81e97e0d | 3982 | rmin = radius[0]; |
3983 | h1.ParabolicDCA(h2,phase[0][0],phase[0][1],radius[0],delta[0]); | |
3984 | if (points==2){ | |
3985 | if (radius[1]<rmin) rmin = radius[1]; | |
3986 | h1.ParabolicDCA(h2,phase[1][0],phase[1][1],radius[1],delta[1]); | |
3987 | } | |
3988 | rmin = TMath::Sqrt(rmin); | |
3989 | Double_t distance = 0; | |
3990 | Double_t radiusC = 0; | |
3991 | Int_t iphase = 0; | |
c49fe0bf | 3992 | if (points==1 || delta[0]<delta[1]){ |
81e97e0d | 3993 | distance = TMath::Sqrt(delta[0]); |
3994 | radiusC = TMath::Sqrt(radius[0]); | |
3995 | }else{ | |
3996 | distance = TMath::Sqrt(delta[1]); | |
3997 | radiusC = TMath::Sqrt(radius[1]); | |
3998 | iphase=1; | |
3999 | } | |
4000 | if (radiusC<TMath::Max(minr[itrack0],minr[itrack1])) continue; | |
4001 | if (radiusC>TMath::Min(maxr[itrack0],maxr[itrack1])) continue; | |
4002 | Float_t maxDist = TMath::Min(kMaxDist,Float_t(kMaxDist0+radiusC*kMaxDist1)); | |
4003 | if (distance>maxDist) continue; | |
4004 | Float_t pointAngle = h1.GetPointAngle(h2,phase[iphase],primvertex); | |
4005 | if (pointAngle<TMath::Max(minPointAngle[itrack0],minPointAngle[itrack1])) continue; | |
628e7bb0 | 4006 | // |
51ad6848 | 4007 | // |
81e97e0d | 4008 | // Double_t distance = TestV0(h1,h2,pvertex,rmin); |
51ad6848 | 4009 | // |
81e97e0d | 4010 | // if (distance>maxDist) continue; |
4011 | // if (pvertex->GetRr()<kMinR) continue; | |
4012 | // if (pvertex->GetRr()>kMaxR) continue; | |
4013 | AliITStrackMI * track0=btrack0; | |
4014 | AliITStrackMI * track1=btrack1; | |
4015 | // if (pvertex->GetRr()<3.5){ | |
4016 | if (radiusC<3.5){ | |
4017 | //use longest tracks inside the pipe | |
4018 | track0 = (AliITStrackMI*)trackarrayl.At(itrack0); | |
4019 | track1 = (AliITStrackMI*)trackarrayl.At(itrack1); | |
4020 | } | |
51ad6848 | 4021 | // |
4022 | // | |
b75d63a7 | 4023 | pvertex->SetParamN(*track0); |
4024 | pvertex->SetParamP(*track1); | |
81e97e0d | 4025 | pvertex->Update(primvertex); |
b9671574 | 4026 | pvertex->SetClusters(track0->ClIndex(),track1->ClIndex()); // register clusters |
67c1e979 | 4027 | |
81e97e0d | 4028 | if (pvertex->GetRr()<kMinR) continue; |
4029 | if (pvertex->GetRr()>kMaxR) continue; | |
b75d63a7 | 4030 | if (pvertex->GetV0CosineOfPointingAngle()<kMinPointAngle) continue; |
4031 | //Bo: if (pvertex->GetDist2()>maxDist) continue; | |
4032 | if (pvertex->GetDcaV0Daughters()>maxDist) continue; | |
4033 | //Bo: pvertex->SetLab(0,track0->GetLabel()); | |
4034 | //Bo: pvertex->SetLab(1,track1->GetLabel()); | |
b9671574 | 4035 | pvertex->SetIndex(0,track0->GetESDtrack()->GetID()); |
4036 | pvertex->SetIndex(1,track1->GetESDtrack()->GetID()); | |
81e97e0d | 4037 | // |
4038 | AliITStrackMI * htrackc0 = trackc0 ? trackc0:dummy; | |
4039 | AliITStrackMI * htrackc1 = trackc1 ? trackc1:dummy; | |
51ad6848 | 4040 | |
81e97e0d | 4041 | // |
4042 | // | |
4043 | TObjArray * array0b = (TObjArray*)fBestHypothesys.At(itrack0); | |
513ab112 | 4044 | if (!array0b&&pvertex->GetRr()<40 && TMath::Abs(track0->GetTgl())<1.1) { |
4045 | fCurrentEsdTrack = itrack0; | |
81e97e0d | 4046 | FollowProlongationTree((AliITStrackMI*)fOriginal.At(itrack0),itrack0, kFALSE); |
513ab112 | 4047 | } |
81e97e0d | 4048 | TObjArray * array1b = (TObjArray*)fBestHypothesys.At(itrack1); |
513ab112 | 4049 | if (!array1b&&pvertex->GetRr()<40 && TMath::Abs(track1->GetTgl())<1.1) { |
4050 | fCurrentEsdTrack = itrack1; | |
81e97e0d | 4051 | FollowProlongationTree((AliITStrackMI*)fOriginal.At(itrack1),itrack1, kFALSE); |
513ab112 | 4052 | } |
81e97e0d | 4053 | // |
4054 | AliITStrackMI * track0b = (AliITStrackMI*)fOriginal.At(itrack0); | |
4055 | AliITStrackMI * track1b = (AliITStrackMI*)fOriginal.At(itrack1); | |
4056 | AliITStrackMI * track0l = (AliITStrackMI*)fOriginal.At(itrack0); | |
4057 | AliITStrackMI * track1l = (AliITStrackMI*)fOriginal.At(itrack1); | |
4058 | ||
4059 | Float_t minchi2before0=16; | |
4060 | Float_t minchi2before1=16; | |
4061 | Float_t minchi2after0 =16; | |
4062 | Float_t minchi2after1 =16; | |
b75d63a7 | 4063 | Double_t xrp[3]; pvertex->GetXYZ(xrp[0],xrp[1],xrp[2]); //I.B. |
4064 | Int_t maxLayer = GetNearestLayer(xrp); //I.B. | |
81e97e0d | 4065 | |
4066 | if (array0b) for (Int_t i=0;i<5;i++){ | |
4067 | // best track after vertex | |
4068 | AliITStrackMI * btrack = (AliITStrackMI*)array0b->At(i); | |
4069 | if (!btrack) continue; | |
b9671574 | 4070 | if (btrack->GetNumberOfClusters()>track0l->GetNumberOfClusters()) track0l = btrack; |
29641977 | 4071 | // if (btrack->fX<pvertex->GetRr()-2.-0.5/(0.1+pvertex->GetAnglep()[2])) { |
6c94f330 | 4072 | if (btrack->GetX()<pvertex->GetRr()-2.) { |
b9671574 | 4073 | if ( (maxLayer>i+2|| (i==0)) && btrack->GetNumberOfClusters()==(6-i)&&i<3){ |
81e97e0d | 4074 | Float_t sumchi2= 0; |
4075 | Float_t sumn = 0; | |
29641977 | 4076 | if (maxLayer<3){ // take prim vertex as additional measurement |
4077 | if (normdist[itrack0]>0 && htrackc0){ | |
97f754fa | 4078 | sumchi2 += TMath::Min((3.-maxLayer)*normdist[itrack0]*normdist[itrack0],16.); |
29641977 | 4079 | }else{ |
97f754fa | 4080 | sumchi2 += TMath::Min((3.-maxLayer)*(3*normdist[itrack0]*normdist[itrack0]+3.),16.); |
29641977 | 4081 | } |
4082 | sumn += 3-maxLayer; | |
4083 | } | |
81e97e0d | 4084 | for (Int_t ilayer=i;ilayer<maxLayer;ilayer++){ |
97f754fa | 4085 | sumn+=1.; |
b9671574 | 4086 | if (!btrack->GetClIndex(ilayer)){ |
81e97e0d | 4087 | sumchi2+=25; |
4088 | continue; | |
4089 | }else{ | |
b9671574 | 4090 | Int_t c=( btrack->GetClIndex(ilayer) & 0x0fffffff); |
97f754fa | 4091 | for (Int_t itrack=0;itrack<4;itrack++){ |
b9671574 | 4092 | if (fgLayers[ilayer].GetClusterTracks(itrack,c)>=0 && fgLayers[ilayer].GetClusterTracks(itrack,c)!=itrack0){ |
97f754fa | 4093 | sumchi2+=18.; //shared cluster |
4094 | break; | |
4095 | } | |
4096 | } | |
b9671574 | 4097 | sumchi2+=btrack->GetDy(ilayer)*btrack->GetDy(ilayer)/(btrack->GetSigmaY(ilayer)*btrack->GetSigmaY(ilayer)); |
4098 | sumchi2+=btrack->GetDz(ilayer)*btrack->GetDz(ilayer)/(btrack->GetSigmaZ(ilayer)*btrack->GetSigmaZ(ilayer)); | |
81e97e0d | 4099 | } |
4100 | } | |
4101 | sumchi2/=sumn; | |
4102 | if (sumchi2<minchi2before0) minchi2before0=sumchi2; | |
51ad6848 | 4103 | } |
81e97e0d | 4104 | continue; //safety space - Geo manager will give exact layer |
51ad6848 | 4105 | } |
81e97e0d | 4106 | track0b = btrack; |
b9671574 | 4107 | minchi2after0 = btrack->GetNormChi2(i); |
81e97e0d | 4108 | break; |
4109 | } | |
4110 | if (array1b) for (Int_t i=0;i<5;i++){ | |
4111 | // best track after vertex | |
4112 | AliITStrackMI * btrack = (AliITStrackMI*)array1b->At(i); | |
4113 | if (!btrack) continue; | |
b9671574 | 4114 | if (btrack->GetNumberOfClusters()>track1l->GetNumberOfClusters()) track1l = btrack; |
29641977 | 4115 | // if (btrack->fX<pvertex->GetRr()-2-0.5/(0.1+pvertex->GetAnglep()[2])){ |
6c94f330 | 4116 | if (btrack->GetX()<pvertex->GetRr()-2){ |
b9671574 | 4117 | if ((maxLayer>i+2 || (i==0))&&btrack->GetNumberOfClusters()==(6-i)&&(i<3)){ |
81e97e0d | 4118 | Float_t sumchi2= 0; |
4119 | Float_t sumn = 0; | |
29641977 | 4120 | if (maxLayer<3){ // take prim vertex as additional measurement |
4121 | if (normdist[itrack1]>0 && htrackc1){ | |
97f754fa | 4122 | sumchi2 += TMath::Min((3.-maxLayer)*normdist[itrack1]*normdist[itrack1],16.); |
29641977 | 4123 | }else{ |
97f754fa | 4124 | sumchi2 += TMath::Min((3.-maxLayer)*(3*normdist[itrack1]*normdist[itrack1]+3.),16.); |
29641977 | 4125 | } |
4126 | sumn += 3-maxLayer; | |
4127 | } | |
81e97e0d | 4128 | for (Int_t ilayer=i;ilayer<maxLayer;ilayer++){ |
4129 | sumn+=1.; | |
b9671574 | 4130 | if (!btrack->GetClIndex(ilayer)){ |
81e97e0d | 4131 | sumchi2+=30; |
4132 | continue; | |
4133 | }else{ | |
b9671574 | 4134 | Int_t c=( btrack->GetClIndex(ilayer) & 0x0fffffff); |
97f754fa | 4135 | for (Int_t itrack=0;itrack<4;itrack++){ |
b9671574 | 4136 | if (fgLayers[ilayer].GetClusterTracks(itrack,c)>=0 && fgLayers[ilayer].GetClusterTracks(itrack,c)!=itrack1){ |
97f754fa | 4137 | sumchi2+=18.; //shared cluster |
4138 | break; | |
4139 | } | |
4140 | } | |
b9671574 | 4141 | sumchi2+=btrack->GetDy(ilayer)*btrack->GetDy(ilayer)/(btrack->GetSigmaY(ilayer)*btrack->GetSigmaY(ilayer)); |
4142 | sumchi2+=btrack->GetDz(ilayer)*btrack->GetDz(ilayer)/(btrack->GetSigmaZ(ilayer)*btrack->GetSigmaZ(ilayer)); | |
81e97e0d | 4143 | } |
4144 | } | |
4145 | sumchi2/=sumn; | |
4146 | if (sumchi2<minchi2before1) minchi2before1=sumchi2; | |
51ad6848 | 4147 | } |
81e97e0d | 4148 | continue; //safety space - Geo manager will give exact layer |
51ad6848 | 4149 | } |
81e97e0d | 4150 | track1b = btrack; |
b9671574 | 4151 | minchi2after1 = btrack->GetNormChi2(i); |
81e97e0d | 4152 | break; |
e43c066c | 4153 | } |
628e7bb0 | 4154 | // |
81e97e0d | 4155 | // position resolution - used for DCA cut |
6c94f330 | 4156 | Float_t sigmad = track0b->GetSigmaY2()+track0b->GetSigmaZ2()+track1b->GetSigmaY2()+track1b->GetSigmaZ2()+ |
4157 | (track0b->GetX()-pvertex->GetRr())*(track0b->GetX()-pvertex->GetRr())*(track0b->GetSigmaSnp2()+track0b->GetSigmaTgl2())+ | |
4158 | (track1b->GetX()-pvertex->GetRr())*(track1b->GetX()-pvertex->GetRr())*(track1b->GetSigmaSnp2()+track1b->GetSigmaTgl2()); | |
81e97e0d | 4159 | sigmad =TMath::Sqrt(sigmad)+0.04; |
4160 | if (pvertex->GetRr()>50){ | |
4161 | Double_t cov0[15],cov1[15]; | |
b9671574 | 4162 | track0b->GetESDtrack()->GetInnerExternalCovariance(cov0); |
4163 | track1b->GetESDtrack()->GetInnerExternalCovariance(cov1); | |
81e97e0d | 4164 | sigmad = cov0[0]+cov0[2]+cov1[0]+cov1[2]+ |
4165 | (80.-pvertex->GetRr())*(80.-pvertex->GetRr())*(cov0[5]+cov0[9])+ | |
4166 | (80.-pvertex->GetRr())*(80.-pvertex->GetRr())*(cov1[5]+cov1[9]); | |
4167 | sigmad =TMath::Sqrt(sigmad)+0.05; | |
4168 | } | |
4169 | // | |
6c94f330 | 4170 | AliV0 vertex2; |
b75d63a7 | 4171 | vertex2.SetParamN(*track0b); |
4172 | vertex2.SetParamP(*track1b); | |
81e97e0d | 4173 | vertex2.Update(primvertex); |
b75d63a7 | 4174 | //Bo: if (vertex2.GetDist2()<=pvertex->GetDist2()&&(vertex2.GetV0CosineOfPointingAngle()>=pvertex->GetV0CosineOfPointingAngle())){ |
4175 | if (vertex2.GetDcaV0Daughters()<=pvertex->GetDcaV0Daughters()&&(vertex2.GetV0CosineOfPointingAngle()>=pvertex->GetV0CosineOfPointingAngle())){ | |
4176 | pvertex->SetParamN(*track0b); | |
4177 | pvertex->SetParamP(*track1b); | |
81e97e0d | 4178 | pvertex->Update(primvertex); |
b9671574 | 4179 | pvertex->SetClusters(track0b->ClIndex(),track1b->ClIndex()); // register clusters |
4180 | pvertex->SetIndex(0,track0->GetESDtrack()->GetID()); | |
4181 | pvertex->SetIndex(1,track1->GetESDtrack()->GetID()); | |
81e97e0d | 4182 | } |
4183 | pvertex->SetDistSigma(sigmad); | |
b75d63a7 | 4184 | //Bo: pvertex->SetDistNorm(pvertex->GetDist2()/sigmad); |
29641977 | 4185 | pvertex->SetNormDCAPrim(normdist[itrack0],normdist[itrack1]); |
628e7bb0 | 4186 | // |
81e97e0d | 4187 | // define likelihhod and causalities |
628e7bb0 | 4188 | // |
81e97e0d | 4189 | Float_t pa0=1, pa1=1, pb0=0.26, pb1=0.26; |
29641977 | 4190 | if (maxLayer<1){ |
4191 | Float_t fnorm0 = normdist[itrack0]; | |
4192 | if (fnorm0<0) fnorm0*=-3; | |
4193 | Float_t fnorm1 = normdist[itrack1]; | |
4194 | if (fnorm1<0) fnorm1*=-3; | |
4195 | if (pvertex->GetAnglep()[2]>0.1 || (pvertex->GetRr()<10.5)&& pvertex->GetAnglep()[2]>0.05 || pvertex->GetRr()<3){ | |
4196 | pb0 = TMath::Exp(-TMath::Min(fnorm0,Float_t(16.))/12.); | |
4197 | pb1 = TMath::Exp(-TMath::Min(fnorm1,Float_t(16.))/12.); | |
67c1e979 | 4198 | } |
81e97e0d | 4199 | pvertex->SetChi2Before(normdist[itrack0]); |
4200 | pvertex->SetChi2After(normdist[itrack1]); | |
4201 | pvertex->SetNAfter(0); | |
4202 | pvertex->SetNBefore(0); | |
4203 | }else{ | |
4204 | pvertex->SetChi2Before(minchi2before0); | |
4205 | pvertex->SetChi2After(minchi2before1); | |
29641977 | 4206 | if (pvertex->GetAnglep()[2]>0.1 || ( pvertex->GetRr()<10.5 && pvertex->GetAnglep()[2]>0.05) || pvertex->GetRr()<3){ |
4207 | pb0 = TMath::Exp(-TMath::Min(minchi2before0,Float_t(16))/12.); | |
4208 | pb1 = TMath::Exp(-TMath::Min(minchi2before1,Float_t(16))/12.); | |
4209 | } | |
4210 | pvertex->SetNAfter(maxLayer); | |
4211 | pvertex->SetNBefore(maxLayer); | |
628e7bb0 | 4212 | } |
81e97e0d | 4213 | if (pvertex->GetRr()<90){ |
f941f7fa | 4214 | pa0 *= TMath::Min(track0->GetESDtrack()->GetTPCdensity(0,60),Double_t(1.)); |
4215 | pa1 *= TMath::Min(track1->GetESDtrack()->GetTPCdensity(0,60),Double_t(1.)); | |
628e7bb0 | 4216 | } |
81e97e0d | 4217 | if (pvertex->GetRr()<20){ |
4218 | pa0 *= (0.2+TMath::Exp(-TMath::Min(minchi2after0,Float_t(16))/8.))/1.2; | |
4219 | pa1 *= (0.2+TMath::Exp(-TMath::Min(minchi2after1,Float_t(16))/8.))/1.2; | |
e43c066c | 4220 | } |
628e7bb0 | 4221 | // |
81e97e0d | 4222 | pvertex->SetCausality(pb0,pb1,pa0,pa1); |
628e7bb0 | 4223 | // |
81e97e0d | 4224 | // Likelihood calculations - apply cuts |
4225 | // | |
4226 | Bool_t v0OK = kTRUE; | |
4227 | Float_t p12 = pvertex->GetParamP()->GetParameter()[4]*pvertex->GetParamP()->GetParameter()[4]; | |
b75d63a7 | 4228 | p12 += pvertex->GetParamN()->GetParameter()[4]*pvertex->GetParamN()->GetParameter()[4]; |
81e97e0d | 4229 | p12 = TMath::Sqrt(p12); // "mean" momenta |
4230 | Float_t sigmap0 = 0.0001+0.001/(0.1+pvertex->GetRr()); | |
4231 | Float_t sigmap = 0.5*sigmap0*(0.6+0.4*p12); // "resolution: of point angle - as a function of radius and momenta | |
4232 | ||
bf6adc12 | 4233 | Float_t causalityA = (1.0-pvertex->GetCausalityP()[0])*(1.0-pvertex->GetCausalityP()[1]); |
f941f7fa | 4234 | Float_t causalityB = TMath::Sqrt(TMath::Min(pvertex->GetCausalityP()[2],Double_t(0.7))* |
4235 | TMath::Min(pvertex->GetCausalityP()[3],Double_t(0.7))); | |
628e7bb0 | 4236 | // |
b75d63a7 | 4237 | //Bo: Float_t likelihood0 = (TMath::Exp(-pvertex->GetDistNorm())+0.1) *(pvertex->GetDist2()<0.5)*(pvertex->GetDistNorm()<5); |
4238 | Float_t lDistNorm = pvertex->GetDcaV0Daughters()/pvertex->GetDistSigma(); | |
4239 | Float_t likelihood0 = (TMath::Exp(-lDistNorm)+0.1) *(pvertex->GetDcaV0Daughters()<0.5)*(lDistNorm<5); | |
4240 | ||
4241 | Float_t likelihood1 = TMath::Exp(-(1.0001-pvertex->GetV0CosineOfPointingAngle())/sigmap)+ | |
4242 | 0.4*TMath::Exp(-(1.0001-pvertex->GetV0CosineOfPointingAngle())/(4.*sigmap))+ | |
4243 | 0.4*TMath::Exp(-(1.0001-pvertex->GetV0CosineOfPointingAngle())/(8.*sigmap))+ | |
4244 | 0.1*TMath::Exp(-(1.0001-pvertex->GetV0CosineOfPointingAngle())/0.01); | |
628e7bb0 | 4245 | // |
bf6adc12 | 4246 | if (causalityA<kCausality0Cut) v0OK = kFALSE; |
4247 | if (TMath::Sqrt(likelihood0*likelihood1)<kLikelihood01Cut) v0OK = kFALSE; | |
4248 | if (likelihood1<kLikelihood1Cut) v0OK = kFALSE; | |
4249 | if (TMath::Power(likelihood0*likelihood1*causalityB,0.33)<kCombinedCut) v0OK = kFALSE; | |
81e97e0d | 4250 | |
628e7bb0 | 4251 | // |
628e7bb0 | 4252 | // |
67c1e979 | 4253 | if (kFALSE){ |
81e97e0d | 4254 | Bool_t gold = TMath::Abs(TMath::Abs(track0->GetLabel())-TMath::Abs(track1->GetLabel()))==1; |
4255 | cstream<<"It0"<< | |
4256 | "Tr0.="<<track0<< //best without constrain | |
4257 | "Tr1.="<<track1<< //best without constrain | |
4258 | "Tr0B.="<<track0b<< //best without constrain after vertex | |
4259 | "Tr1B.="<<track1b<< //best without constrain after vertex | |
4260 | "Tr0C.="<<htrackc0<< //best with constrain if exist | |
4261 | "Tr1C.="<<htrackc1<< //best with constrain if exist | |
4262 | "Tr0L.="<<track0l<< //longest best | |
4263 | "Tr1L.="<<track1l<< //longest best | |
b9671574 | 4264 | "Esd0.="<<track0->GetESDtrack()<< // esd track0 params |
4265 | "Esd1.="<<track1->GetESDtrack()<< // esd track1 params | |
81e97e0d | 4266 | "V0.="<<pvertex<< //vertex properties |
4267 | "V0b.="<<&vertex2<< //vertex properties at "best" track | |
4268 | "ND0="<<normdist[itrack0]<< //normalize distance for track0 | |
4269 | "ND1="<<normdist[itrack1]<< //normalize distance for track1 | |
4270 | "Gold="<<gold<< // | |
4271 | // "RejectBase="<<rejectBase<< //rejection in First itteration | |
4272 | "OK="<<v0OK<< | |
4273 | "rmin="<<rmin<< | |
4274 | "sigmad="<<sigmad<< | |
4275 | "\n"; | |
4276 | } | |
4277 | //if (rejectBase) continue; | |
628e7bb0 | 4278 | // |
81e97e0d | 4279 | pvertex->SetStatus(0); |
4280 | // if (rejectBase) { | |
4281 | // pvertex->SetStatus(-100); | |
4282 | //} | |
b75d63a7 | 4283 | if (pvertex->GetV0CosineOfPointingAngle()>kMinPointAngle2) { |
4284 | //Bo: pvertex->SetESDindexes(track0->GetESDtrack()->GetID(),track1->GetESDtrack()->GetID()); | |
4285 | pvertex->SetIndex(0,track0->GetESDtrack()->GetID());//Bo: consistency 0 for neg | |
4286 | pvertex->SetIndex(1,track1->GetESDtrack()->GetID());//Bo: consistency 1 for pos | |
67c1e979 | 4287 | if (v0OK){ |
4288 | // AliV0vertex vertexjuri(*track0,*track1); | |
4289 | // vertexjuri.SetESDindexes(track0->fESDtrack->GetID(),track1->fESDtrack->GetID()); | |
4290 | // event->AddV0(&vertexjuri); | |
81e97e0d | 4291 | pvertex->SetStatus(100); |
4292 | } | |
d6a49f20 | 4293 | pvertex->SetOnFlyStatus(kTRUE); |
b75d63a7 | 4294 | pvertex->ChangeMassHypothesis(kK0Short); |
d6a49f20 | 4295 | event->AddV0(pvertex); |
628e7bb0 | 4296 | } |
51ad6848 | 4297 | } |
4298 | } | |
628e7bb0 | 4299 | // |
4300 | // | |
81e97e0d | 4301 | // delete temporary arrays |
4302 | // | |
316c6cd9 | 4303 | delete[] forbidden; |
81e97e0d | 4304 | delete[] minPointAngle; |
4305 | delete[] maxr; | |
4306 | delete[] minr; | |
4307 | delete[] norm; | |
4308 | delete[] normdist; | |
4309 | delete[] normdist1; | |
4310 | delete[] normdist0; | |
4311 | delete[] dist; | |
4312 | delete[] itsmap; | |
4313 | delete[] helixes; | |
4314 | delete pvertex; | |
e43c066c | 4315 | } |
44347160 | 4316 | //------------------------------------------------------------------------ |
af885e0f | 4317 | void AliITStrackerMI::RefitV02(AliESDEvent *event) |
67c1e979 | 4318 | { |
4319 | // | |
4320 | //try to refit V0s in the third path of the reconstruction | |
4321 | // | |
4322 | TTreeSRedirector &cstream = *fDebugStreamer; | |
4323 | // | |
d6a49f20 | 4324 | Int_t nv0s = event->GetNumberOfV0s(); |
67c1e979 | 4325 | Float_t primvertex[3]={GetX(),GetY(),GetZ()}; |
6c94f330 | 4326 | AliV0 v0temp; |
67c1e979 | 4327 | for (Int_t iv0 = 0; iv0<nv0s;iv0++){ |
d6a49f20 | 4328 | AliV0 * v0mi = (AliV0*)event->GetV0(iv0); |
67c1e979 | 4329 | if (!v0mi) continue; |
4330 | Int_t itrack0 = v0mi->GetIndex(0); | |
4331 | Int_t itrack1 = v0mi->GetIndex(1); | |
4332 | AliESDtrack *esd0 = event->GetTrack(itrack0); | |
4333 | AliESDtrack *esd1 = event->GetTrack(itrack1); | |
4334 | if (!esd0||!esd1) continue; | |
4335 | AliITStrackMI tpc0(*esd0); | |
4336 | AliITStrackMI tpc1(*esd1); | |
b75d63a7 | 4337 | Double_t x,y,z; v0mi->GetXYZ(x,y,z); //I.B. |
4338 | Double_t alpha =TMath::ATan2(y,x); //I.B. | |
67c1e979 | 4339 | if (v0mi->GetRr()>85){ |
4340 | if (tpc0.Propagate(alpha,v0mi->GetRr())&&tpc1.Propagate(alpha,v0mi->GetRr())){ | |
b75d63a7 | 4341 | v0temp.SetParamN(tpc0); |
4342 | v0temp.SetParamP(tpc1); | |
67c1e979 | 4343 | v0temp.Update(primvertex); |
29641977 | 4344 | if (kFALSE) cstream<<"Refit"<< |
67c1e979 | 4345 | "V0.="<<v0mi<< |
4346 | "V0refit.="<<&v0temp<< | |
4347 | "Tr0.="<<&tpc0<< | |
4348 | "Tr1.="<<&tpc1<< | |
4349 | "\n"; | |
b75d63a7 | 4350 | //Bo: if (v0temp.GetDist2()<v0mi->GetDist2() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){ |
4351 | if (v0temp.GetDcaV0Daughters()<v0mi->GetDcaV0Daughters() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){ | |
4352 | v0mi->SetParamN(tpc0); | |
4353 | v0mi->SetParamP(tpc1); | |
67c1e979 | 4354 | v0mi->Update(primvertex); |
4355 | } | |
4356 | } | |
4357 | continue; | |
4358 | } | |
4359 | if (v0mi->GetRr()>35){ | |
afd25725 | 4360 | CorrectForTPCtoITSDeadZoneMaterial(&tpc0); |
4361 | CorrectForTPCtoITSDeadZoneMaterial(&tpc1); | |
67c1e979 | 4362 | if (tpc0.Propagate(alpha,v0mi->GetRr())&&tpc1.Propagate(alpha,v0mi->GetRr())){ |
b75d63a7 | 4363 | v0temp.SetParamN(tpc0); |
4364 | v0temp.SetParamP(tpc1); | |
67c1e979 | 4365 | v0temp.Update(primvertex); |
29641977 | 4366 | if (kFALSE) cstream<<"Refit"<< |
67c1e979 | 4367 | "V0.="<<v0mi<< |
4368 | "V0refit.="<<&v0temp<< | |
4369 | "Tr0.="<<&tpc0<< | |
4370 | "Tr1.="<<&tpc1<< | |
4371 | "\n"; | |
b75d63a7 | 4372 | //Bo: if (v0temp.GetDist2()<v0mi->GetDist2() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){ |
4373 | if (v0temp.GetDcaV0Daughters()<v0mi->GetDcaV0Daughters() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){ | |
4374 | v0mi->SetParamN(tpc0); | |
4375 | v0mi->SetParamP(tpc1); | |
67c1e979 | 4376 | v0mi->Update(primvertex); |
4377 | } | |
4378 | } | |
4379 | continue; | |
4380 | } | |
afd25725 | 4381 | CorrectForTPCtoITSDeadZoneMaterial(&tpc0); |
4382 | CorrectForTPCtoITSDeadZoneMaterial(&tpc1); | |
67c1e979 | 4383 | // if (tpc0.Propagate(alpha,v0mi->GetRr())&&tpc1.Propagate(alpha,v0mi->GetRr())){ |
4384 | if (RefitAt(v0mi->GetRr(),&tpc0, v0mi->GetClusters(0)) && RefitAt(v0mi->GetRr(),&tpc1, v0mi->GetClusters(1))){ | |
b75d63a7 | 4385 | v0temp.SetParamN(tpc0); |
4386 | v0temp.SetParamP(tpc1); | |
67c1e979 | 4387 | v0temp.Update(primvertex); |
29641977 | 4388 | if (kFALSE) cstream<<"Refit"<< |
67c1e979 | 4389 | "V0.="<<v0mi<< |
4390 | "V0refit.="<<&v0temp<< | |
4391 | "Tr0.="<<&tpc0<< | |
4392 | "Tr1.="<<&tpc1<< | |
4393 | "\n"; | |
b75d63a7 | 4394 | //Bo: if (v0temp.GetDist2()<v0mi->GetDist2() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){ |
4395 | if (v0temp.GetDcaV0Daughters()<v0mi->GetDcaV0Daughters() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){ | |
4396 | v0mi->SetParamN(tpc0); | |
4397 | v0mi->SetParamP(tpc1); | |
67c1e979 | 4398 | v0mi->Update(primvertex); |
4399 | } | |
4400 | } | |
4401 | } | |
4402 | } | |
44347160 | 4403 | //------------------------------------------------------------------------ |
e50912db | 4404 | void AliITStrackerMI::BuildMaterialLUT(TString material) { |
4405 | //-------------------------------------------------------------------- | |
4406 | // Fill a look-up table with mean material | |
4407 | //-------------------------------------------------------------------- | |
4408 | ||
4409 | Int_t n=1000; | |
4410 | Double_t mparam[7]; | |
4411 | Double_t point1[3],point2[3]; | |
4412 | Double_t phi,cosphi,sinphi,z; | |
4413 | // 0-5 layers, 6 pipe, 7-8 shields | |
4414 | Double_t rmin[9]={ 3.5, 5.5,13.0,22.0,35.0,41.0, 2.0, 7.5,25.0}; | |
4415 | Double_t rmax[9]={ 5.5, 7.3,17.0,26.0,41.0,47.0, 3.0,10.5,30.0}; | |
4416 | ||
4417 | Int_t ifirst=0,ilast=0; | |
4418 | if(material.Contains("Pipe")) { | |
4419 | ifirst=6; ilast=6; | |
4420 | } else if(material.Contains("Shields")) { | |
4421 | ifirst=7; ilast=8; | |
4422 | } else if(material.Contains("Layers")) { | |
4423 | ifirst=0; ilast=5; | |
4424 | } else { | |
4425 | Error("BuildMaterialLUT","Wrong layer name\n"); | |
4426 | } | |
4427 | ||
4428 | for(Int_t imat=ifirst; imat<=ilast; imat++) { | |
4429 | Double_t param[5]={0.,0.,0.,0.,0.}; | |
4430 | for (Int_t i=0; i<n; i++) { | |
4431 | phi = 2.*TMath::Pi()*gRandom->Rndm(); | |
4432 | cosphi = TMath::Cos(phi); sinphi = TMath::Sin(phi); | |
4433 | z = 14.*(-1.+2.*gRandom->Rndm()); // SPD barrel | |
4434 | point1[0] = rmin[imat]*cosphi; | |
4435 | point1[1] = rmin[imat]*sinphi; | |
4436 | point1[2] = z; | |
4437 | point2[0] = rmax[imat]*cosphi; | |
4438 | point2[1] = rmax[imat]*sinphi; | |
4439 | point2[2] = z; | |
4440 | AliTracker::MeanMaterialBudget(point1,point2,mparam); | |
4441 | for(Int_t j=0;j<5;j++) param[j]+=mparam[j]; | |
4442 | } | |
4443 | for(Int_t j=0;j<5;j++) param[j]/=(Float_t)n; | |
4444 | if(imat<=5) { | |
4445 | fxOverX0Layer[imat] = param[1]; | |
4446 | fxTimesRhoLayer[imat] = param[0]*param[4]; | |
4447 | } else if(imat==6) { | |
4448 | fxOverX0Pipe = param[1]; | |
4449 | fxTimesRhoPipe = param[0]*param[4]; | |
4450 | } else if(imat==7) { | |
4451 | fxOverX0Shield[0] = param[1]; | |
4452 | fxTimesRhoShield[0] = param[0]*param[4]; | |
4453 | } else if(imat==8) { | |
4454 | fxOverX0Shield[1] = param[1]; | |
4455 | fxTimesRhoShield[1] = param[0]*param[4]; | |
4456 | } | |
4457 | } | |
4458 | /* | |
4459 | printf("%s\n",material.Data()); | |
4460 | printf("%f %f\n",fxOverX0Pipe,fxTimesRhoPipe); | |
4461 | printf("%f %f\n",fxOverX0Shield[0],fxTimesRhoShield[0]); | |
4462 | printf("%f %f\n",fxOverX0Shield[1],fxTimesRhoShield[1]); | |
4463 | printf("%f %f\n",fxOverX0Layer[0],fxTimesRhoLayer[0]); | |
4464 | printf("%f %f\n",fxOverX0Layer[1],fxTimesRhoLayer[1]); | |
4465 | printf("%f %f\n",fxOverX0Layer[2],fxTimesRhoLayer[2]); | |
4466 | printf("%f %f\n",fxOverX0Layer[3],fxTimesRhoLayer[3]); | |
4467 | printf("%f %f\n",fxOverX0Layer[4],fxTimesRhoLayer[4]); | |
4468 | printf("%f %f\n",fxOverX0Layer[5],fxTimesRhoLayer[5]); | |
4469 | */ | |
4470 | return; | |
4471 | } | |
4472 | //------------------------------------------------------------------------ | |
4473 | Int_t AliITStrackerMI::CorrectForPipeMaterial(AliITStrackMI *t, | |
4474 | TString direction) { | |
4475 | //------------------------------------------------------------------- | |
4476 | // Propagate beyond beam pipe and correct for material | |
4477 | // (material budget in different ways according to fUseTGeo value) | |
4478 | //------------------------------------------------------------------- | |
4479 | ||
4480 | // Define budget mode: | |
4481 | // 0: material from AliITSRecoParam (hard coded) | |
4482 | // 1: material from TGeo (on the fly) | |
4483 | // 2: material from lut | |
4484 | // 3: material from TGeo (same for all hypotheses) | |
4485 | Int_t mode; | |
4486 | switch(fUseTGeo) { | |
4487 | case 0: | |
4488 | mode=0; | |
4489 | break; | |
4490 | case 1: | |
4491 | mode=1; | |
4492 | break; | |
4493 | case 2: | |
4494 | mode=2; | |
4495 | break; | |
4496 | case 3: | |
4497 | if(fTrackingPhase.Contains("Clusters2Tracks")) | |
4498 | { mode=3; } else { mode=1; } | |
4499 | break; | |
4500 | case 4: | |
4501 | if(fTrackingPhase.Contains("Clusters2Tracks")) | |
4502 | { mode=3; } else { mode=2; } | |
4503 | break; | |
4504 | default: | |
4505 | mode=0; | |
4506 | break; | |
4507 | } | |
4508 | if(fTrackingPhase.Contains("Default")) mode=0; | |
4509 | ||
4510 | Int_t index=fCurrentEsdTrack; | |
4511 | ||
4512 | Float_t dir = (direction.Contains("inward") ? 1. : -1.); | |
4513 | Double_t rToGo=(dir>0 ? AliITSRecoParam::GetrInsidePipe() : AliITSRecoParam::GetrOutsidePipe()); | |
4514 | Double_t xToGo; t->GetLocalXat(rToGo,xToGo); | |
4515 | ||
4516 | Double_t xOverX0,x0,lengthTimesMeanDensity; | |
4517 | Bool_t anglecorr=kTRUE; | |
4518 | ||
4519 | switch(mode) { | |
4520 | case 0: | |
4521 | xOverX0 = AliITSRecoParam::GetdPipe(); | |
4522 | x0 = AliITSRecoParam::GetX0Be(); | |
4523 | lengthTimesMeanDensity = xOverX0*x0; | |
4524 | break; | |
4525 | case 1: | |
4526 | if (!t->PropagateToTGeo(xToGo,1)) return 0; | |
4527 | return 1; | |
4528 | break; | |
4529 | case 2: | |
4530 | if(fxOverX0Pipe<0) BuildMaterialLUT("Pipe"); | |
4531 | xOverX0 = fxOverX0Pipe; | |
4532 | lengthTimesMeanDensity = fxTimesRhoPipe; | |
4533 | break; | |
4534 | case 3: | |
4535 | if(!fxOverX0PipeTrks || index<0 || index>=fNtracks) Error("CorrectForPipeMaterial","Incorrect usage of UseTGeo option!\n"); | |
4536 | if(fxOverX0PipeTrks[index]<0) { | |
4537 | if (!t->PropagateToTGeo(xToGo,1,xOverX0,lengthTimesMeanDensity)) return 0; | |
4538 | Double_t angle=TMath::Sqrt((1.+t->GetTgl()*t->GetTgl())/ | |
4539 | (1.-t->GetSnp()*t->GetSnp())); | |
4540 | fxOverX0PipeTrks[index] = TMath::Abs(xOverX0)/angle; | |
4541 | fxTimesRhoPipeTrks[index] = TMath::Abs(lengthTimesMeanDensity)/angle; | |
4542 | return 1; | |
4543 | } | |
4544 | xOverX0 = fxOverX0PipeTrks[index]; | |
4545 | lengthTimesMeanDensity = fxTimesRhoPipeTrks[index]; | |
4546 | break; | |
4547 | } | |
4548 | ||
4549 | lengthTimesMeanDensity *= dir; | |
4550 | ||
4551 | if (!t->AliExternalTrackParam::PropagateTo(xToGo,GetBz())) return 0; | |
4552 | if (!t->CorrectForMeanMaterial(xOverX0,lengthTimesMeanDensity,anglecorr)) return 0; | |
4553 | ||
4554 | return 1; | |
4555 | } | |
4556 | //------------------------------------------------------------------------ | |
4557 | Int_t AliITStrackerMI::CorrectForShieldMaterial(AliITStrackMI *t, | |
4558 | TString shield, | |
4559 | TString direction) { | |
4560 | //------------------------------------------------------------------- | |
4561 | // Propagate beyond SPD or SDD shield and correct for material | |
4562 | // (material budget in different ways according to fUseTGeo value) | |
4563 | //------------------------------------------------------------------- | |
4564 | ||
4565 | // Define budget mode: | |
4566 | // 0: material from AliITSRecoParam (hard coded) | |
4567 | // 1: material from TGeo (on the fly) | |
4568 | // 2: material from lut | |
4569 | // 3: material from TGeo (same for all hypotheses) | |
4570 | Int_t mode; | |
4571 | switch(fUseTGeo) { | |
4572 | case 0: | |
4573 | mode=0; | |
4574 | break; | |
4575 | case 1: | |
4576 | mode=1; | |
4577 | break; | |
4578 | case 2: | |
4579 | mode=2; | |
4580 | break; | |
4581 | case 3: | |
4582 | if(fTrackingPhase.Contains("Clusters2Tracks")) | |
4583 | { mode=3; } else { mode=1; } | |
4584 | break; | |
4585 | case 4: | |
4586 | if(fTrackingPhase.Contains("Clusters2Tracks")) | |
4587 | { mode=3; } else { mode=2; } | |
4588 | break; | |
4589 | default: | |
4590 | mode=0; | |
4591 | break; | |
4592 | } | |
4593 | if(fTrackingPhase.Contains("Default")) mode=0; | |
4594 | ||
4595 | Float_t dir = (direction.Contains("inward") ? 1. : -1.); | |
4596 | Double_t rToGo; | |
4597 | Int_t shieldindex=0; | |
4598 | if (shield.Contains("SDD")) { // SDDouter | |
4599 | rToGo=(dir>0 ? AliITSRecoParam::GetrInsideShield(1) : AliITSRecoParam::GetrOutsideShield(1)); | |
4600 | shieldindex=1; | |
4601 | } else if (shield.Contains("SPD")) { // SPDouter | |
4602 | rToGo=(dir>0 ? AliITSRecoParam::GetrInsideShield(0) : AliITSRecoParam::GetrOutsideShield(0)); | |
4603 | shieldindex=0; | |
4604 | } else { | |
4605 | Error("CorrectForShieldMaterial"," Wrong shield name\n"); | |
e50912db | 4606 | return 0; |
4607 | } | |
4608 | Double_t xToGo; t->GetLocalXat(rToGo,xToGo); | |
4609 | ||
4610 | Int_t index=2*fCurrentEsdTrack+shieldindex; | |
4611 | ||
4612 | Double_t xOverX0,x0,lengthTimesMeanDensity; | |
4613 | Bool_t anglecorr=kTRUE; | |
4614 | ||
4615 | switch(mode) { | |
4616 | case 0: | |
4617 | xOverX0 = AliITSRecoParam::Getdshield(shieldindex); | |
4618 | x0 = AliITSRecoParam::GetX0shield(shieldindex); | |
4619 | lengthTimesMeanDensity = xOverX0*x0; | |
4620 | break; | |
4621 | case 1: | |
4622 | if (!t->PropagateToTGeo(xToGo,1)) return 0; | |
4623 | return 1; | |
4624 | break; | |
4625 | case 2: | |
4626 | if(fxOverX0Shield[shieldindex]<0) BuildMaterialLUT("Shields"); | |
4627 | xOverX0 = fxOverX0Shield[shieldindex]; | |
4628 | lengthTimesMeanDensity = fxTimesRhoShield[shieldindex]; | |
4629 | break; | |
4630 | case 3: | |
4631 | if(!fxOverX0ShieldTrks || index<0 || index>=2*fNtracks) Error("CorrectForShieldMaterial","Incorrect usage of UseTGeo option!\n"); | |
4632 | if(fxOverX0ShieldTrks[index]<0) { | |
4633 | if (!t->PropagateToTGeo(xToGo,1,xOverX0,lengthTimesMeanDensity)) return 0; | |
4634 | Double_t angle=TMath::Sqrt((1.+t->GetTgl()*t->GetTgl())/ | |
4635 | (1.-t->GetSnp()*t->GetSnp())); | |
4636 | fxOverX0ShieldTrks[index] = TMath::Abs(xOverX0)/angle; | |
4637 | fxTimesRhoShieldTrks[index] = TMath::Abs(lengthTimesMeanDensity)/angle; | |
4638 | return 1; | |
4639 | } | |
4640 | xOverX0 = fxOverX0ShieldTrks[index]; | |
4641 | lengthTimesMeanDensity = fxTimesRhoShieldTrks[index]; | |
4642 | break; | |
4643 | } | |
4644 | ||
4645 | lengthTimesMeanDensity *= dir; | |
4646 | ||
4647 | if (!t->AliExternalTrackParam::PropagateTo(xToGo,GetBz())) return 0; | |
4648 | if (!t->CorrectForMeanMaterial(xOverX0,lengthTimesMeanDensity,anglecorr)) return 0; | |
4649 | ||
4650 | return 1; | |
4651 | } | |
4652 | //------------------------------------------------------------------------ | |
4653 | Int_t AliITStrackerMI::CorrectForLayerMaterial(AliITStrackMI *t, | |
4654 | Int_t layerindex, | |
4655 | Double_t oldGlobXYZ[3], | |
4656 | TString direction) { | |
4657 | //------------------------------------------------------------------- | |
4658 | // Propagate beyond layer and correct for material | |
4659 | // (material budget in different ways according to fUseTGeo value) | |
4660 | //------------------------------------------------------------------- | |
4661 | ||
4662 | // Define budget mode: | |
4663 | // 0: material from AliITSRecoParam (hard coded) | |
4664 | // 1: material from TGeo (on the fly) | |
4665 | // 2: material from lut | |
4666 | // 3: material from TGeo (same for all hypotheses) | |
4667 | Int_t mode; | |
4668 | switch(fUseTGeo) { | |
4669 | case 0: | |
4670 | mode=0; | |
4671 | break; | |
4672 | case 1: | |
4673 | mode=1; | |
4674 | break; | |
4675 | case 2: | |
4676 | mode=2; | |
4677 | break; | |
4678 | case 3: | |
4679 | if(fTrackingPhase.Contains("Clusters2Tracks")) | |
4680 | { mode=3; } else { mode=1; } | |
4681 | break; | |
4682 | case 4: | |
4683 | if(fTrackingPhase.Contains("Clusters2Tracks")) | |
4684 | { mode=3; } else { mode=2; } | |
4685 | break; | |
4686 | default: | |
4687 | mode=0; | |
4688 | break; | |
4689 | } | |
4690 | if(fTrackingPhase.Contains("Default")) mode=0; | |
4691 | ||
4692 | Float_t dir = (direction.Contains("inward") ? 1. : -1.); | |
4693 | ||
4694 | Double_t r=fgLayers[layerindex].GetR(); | |
4695 | Double_t deltar=(layerindex<2 ? 0.10*r : 0.05*r); | |
4696 | ||
4697 | Double_t rToGo=TMath::Sqrt(t->GetX()*t->GetX()+t->GetY()*t->GetY())-deltar*dir; | |
4698 | Double_t xToGo; t->GetLocalXat(rToGo,xToGo); | |
4699 | ||
4700 | Int_t index=6*fCurrentEsdTrack+layerindex; | |
4701 | ||
4702 | // Bring the track beyond the material | |
4703 | if (!t->AliExternalTrackParam::PropagateTo(xToGo,GetBz())) return 0; | |
4704 | Double_t globXYZ[3]; | |
4705 | t->GetXYZ(globXYZ); | |
4706 | ||
4707 | Double_t xOverX0=0.0,x0=0.0,lengthTimesMeanDensity=0.0; | |
4708 | Double_t mparam[7]; | |
4709 | Bool_t anglecorr=kTRUE; | |
4710 | ||
4711 | switch(mode) { | |
4712 | case 0: | |
4713 | xOverX0 = fgLayers[layerindex].GetThickness(t->GetY(),t->GetZ(),x0); | |
4714 | lengthTimesMeanDensity = xOverX0*x0; | |
4715 | break; | |
4716 | case 1: | |
4717 | AliTracker::MeanMaterialBudget(oldGlobXYZ,globXYZ,mparam); | |
4718 | if(mparam[1]>900000) return 0; | |
4719 | xOverX0=mparam[1]; | |
4720 | lengthTimesMeanDensity=mparam[0]*mparam[4]; | |
4721 | anglecorr=kFALSE; | |
4722 | break; | |
4723 | case 2: | |
4724 | if(fxOverX0Layer[layerindex]<0) BuildMaterialLUT("Layers"); | |
4725 | xOverX0 = fxOverX0Layer[layerindex]; | |
4726 | lengthTimesMeanDensity = fxTimesRhoLayer[layerindex]; | |
4727 | break; | |
4728 | case 3: | |
4729 | if(!fxOverX0LayerTrks || index<0 || index>=6*fNtracks) Error("CorrectForLayerMaterial","Incorrect usage of UseTGeo option!\n"); | |
4730 | if(fxOverX0LayerTrks[index]<0) { | |
4731 | AliTracker::MeanMaterialBudget(oldGlobXYZ,globXYZ,mparam); | |
4732 | if(mparam[1]>900000) return 0; | |
4733 | Double_t angle=TMath::Sqrt((1.+t->GetTgl()*t->GetTgl())/ | |
4734 | (1.-t->GetSnp()*t->GetSnp())); | |
4735 | xOverX0=mparam[1]/angle; | |
4736 | lengthTimesMeanDensity=mparam[0]*mparam[4]/angle; | |
4737 | fxOverX0LayerTrks[index] = TMath::Abs(xOverX0); | |
4738 | fxTimesRhoLayerTrks[index] = TMath::Abs(lengthTimesMeanDensity); | |
4739 | } | |
4740 | xOverX0 = fxOverX0LayerTrks[index]; | |
4741 | lengthTimesMeanDensity = fxTimesRhoLayerTrks[index]; | |
4742 | break; | |
4743 | } | |
4744 | ||
4745 | lengthTimesMeanDensity *= dir; | |
4746 | ||
4747 | if (!t->CorrectForMeanMaterial(xOverX0,lengthTimesMeanDensity,anglecorr)) return 0; | |
4748 | ||
4749 | return 1; | |
4750 | } | |
4751 | //------------------------------------------------------------------------ | |
4752 | void AliITStrackerMI::MakeTrksMaterialLUT(Int_t ntracks) { | |
4753 | //----------------------------------------------------------------- | |
4754 | // Initialize LUT for storing material for each prolonged track | |
4755 | //----------------------------------------------------------------- | |
4756 | fxOverX0PipeTrks = new Float_t[ntracks]; | |
4757 | fxTimesRhoPipeTrks = new Float_t[ntracks]; | |
4758 | fxOverX0ShieldTrks = new Float_t[ntracks*2]; | |
4759 | fxTimesRhoShieldTrks = new Float_t[ntracks*2]; | |
4760 | fxOverX0LayerTrks = new Float_t[ntracks*6]; | |
4761 | fxTimesRhoLayerTrks = new Float_t[ntracks*6]; | |
4762 | ||
4763 | for(Int_t i=0; i<ntracks; i++) { | |
4764 | fxOverX0PipeTrks[i] = -1.; | |
4765 | fxTimesRhoPipeTrks[i] = -1.; | |
4766 | } | |
4767 | for(Int_t j=0; j<ntracks*2; j++) { | |
4768 | fxOverX0ShieldTrks[j] = -1.; | |
4769 | fxTimesRhoShieldTrks[j] = -1.; | |
4770 | } | |
4771 | for(Int_t k=0; k<ntracks*6; k++) { | |
4772 | fxOverX0LayerTrks[k] = -1.; | |
4773 | fxTimesRhoLayerTrks[k] = -1.; | |
4774 | } | |
4775 | ||
4776 | fNtracks = ntracks; | |
4777 | ||
4778 | return; | |
4779 | } | |
4780 | //------------------------------------------------------------------------ | |
4781 | void AliITStrackerMI::DeleteTrksMaterialLUT() { | |
4782 | //----------------------------------------------------------------- | |
4783 | // Delete LUT for storing material for each prolonged track | |
4784 | //----------------------------------------------------------------- | |
4785 | if(fxOverX0PipeTrks) { | |
4786 | delete [] fxOverX0PipeTrks; fxOverX0PipeTrks = 0; | |
4787 | } | |
4788 | if(fxOverX0ShieldTrks) { | |
4789 | delete [] fxOverX0ShieldTrks; fxOverX0ShieldTrks = 0; | |
4790 | } | |
4791 | ||
4792 | if(fxOverX0LayerTrks) { | |
4793 | delete [] fxOverX0LayerTrks; fxOverX0LayerTrks = 0; | |
4794 | } | |
4795 | if(fxTimesRhoPipeTrks) { | |
4796 | delete [] fxTimesRhoPipeTrks; fxTimesRhoPipeTrks = 0; | |
4797 | } | |
4798 | if(fxTimesRhoShieldTrks) { | |
4799 | delete [] fxTimesRhoShieldTrks; fxTimesRhoShieldTrks = 0; | |
4800 | } | |
4801 | if(fxTimesRhoLayerTrks) { | |
4802 | delete [] fxTimesRhoLayerTrks; fxTimesRhoLayerTrks = 0; | |
4803 | } | |
4804 | return; | |
4805 | } | |
4806 | //------------------------------------------------------------------------ | |
6518a6c5 | 4807 | Int_t AliITStrackerMI::CheckSkipLayer(AliITStrackMI *track, |
4808 | Int_t ilayer,Int_t idet) const { | |
2755f080 | 4809 | //----------------------------------------------------------------- |
4810 | // This method is used to decide whether to allow a prolongation | |
4811 | // without clusters, because we want to skip the layer. | |
4812 | // In this case the return value is > 0: | |
4813 | // return 1: the user requested to skip a layer | |
4814 | // return 2: track outside z acceptance of SSD/SDD and will cross both SPD | |
4815 | //----------------------------------------------------------------- | |
e43c066c | 4816 | |
2755f080 | 4817 | if (AliITSReconstructor::GetRecoParam()->GetLayersToSkip(ilayer)) return 1; |
51ad6848 | 4818 | |
2755f080 | 4819 | if (idet<0 && ilayer>1 && AliITSReconstructor::GetRecoParam()->GetExtendedEtaAcceptance()) { |
4820 | // check if track will cross SPD outer layer | |
4821 | Double_t phiAtSPD2,zAtSPD2; | |
6518a6c5 | 4822 | if (track->GetPhiZat(fgLayers[1].GetR(),phiAtSPD2,zAtSPD2)) { |
2755f080 | 4823 | if (TMath::Abs(zAtSPD2)<2.*AliITSRecoParam::GetSPDdetzlength()) return 2; |
4824 | } | |
4825 | } | |
51ad6848 | 4826 | |
2755f080 | 4827 | return 0; |
4828 | } | |
4829 | //------------------------------------------------------------------------ | |
6518a6c5 | 4830 | Int_t AliITStrackerMI::CheckDeadZone(/*AliITStrackMI *track,*/ |
ae00569a | 4831 | Int_t ilayer,Int_t idet, |
6518a6c5 | 4832 | Double_t zmin,Double_t zmax/*,Double_t ymin,Double_t ymax*/) const { |
4833 | //----------------------------------------------------------------- | |
4834 | // This method is used to decide whether to allow a prolongation | |
ae00569a | 4835 | // without clusters, because there is a dead zone in the road. |
6518a6c5 | 4836 | // In this case the return value is > 0: |
4837 | // return 1: dead zone at z=0,+-7cm in SPD | |
ae00569a | 4838 | // return 2: dead area from the OCDB // NOT YET IMPLEMENTED |
6518a6c5 | 4839 | //----------------------------------------------------------------- |
4840 | ||
4841 | // check dead zones at z=0,+-7cm in the SPD | |
4842 | if (ilayer<2 && !AliITSReconstructor::GetRecoParam()->GetAddVirtualClustersInDeadZone()) { | |
4843 | Double_t zmindead[3]={fSPDdetzcentre[0] + 0.5*AliITSRecoParam::GetSPDdetzlength(), | |
4844 | fSPDdetzcentre[1] + 0.5*AliITSRecoParam::GetSPDdetzlength(), | |
4845 | fSPDdetzcentre[2] + 0.5*AliITSRecoParam::GetSPDdetzlength()}; | |
4846 | Double_t zmaxdead[3]={fSPDdetzcentre[1] - 0.5*AliITSRecoParam::GetSPDdetzlength(), | |
4847 | fSPDdetzcentre[2] - 0.5*AliITSRecoParam::GetSPDdetzlength(), | |
4848 | fSPDdetzcentre[3] - 0.5*AliITSRecoParam::GetSPDdetzlength()}; | |
4849 | for (Int_t i=0; i<3; i++) | |
ae00569a | 4850 | if (zmin<zmaxdead[i] && zmax>zmindead[i]) return 1; |
6518a6c5 | 4851 | } |
4852 | ||
ae00569a | 4853 | // check dead zones from OCDB |
4854 | if (!AliITSReconstructor::GetRecoParam()->GetUseDeadZonesFromOCDB()) return 0; | |
4855 | ||
4856 | if(idet<0) return 0; | |
4857 | ||
4858 | // look in OCDB (only entire dead modules for the moment) | |
4859 | if (ilayer==0 || ilayer==1) { // SPD | |
4860 | AliCDBEntry* cdbEntry = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead"); | |
4861 | if (!cdbEntry) { | |
4862 | Error("CheckDeadZone","Cannot get CDB entry for SPD\n"); | |
4863 | return 0; | |
4864 | } | |
4865 | TObjArray* spdEntry = (TObjArray*)cdbEntry->GetObject(); | |
4866 | if (!spdEntry) { | |
4867 | Error("CheckDeadZone","Cannot get CDB entry for SPD\n"); | |
4868 | return 0; | |
4869 | } | |
4870 | if(ilayer==1) idet += AliITSgeomTGeo::GetNLadders(1)*AliITSgeomTGeo::GetNDetectors(1); | |
4871 | //printf("SPD det: %d\n",idet); | |
4872 | AliITSCalibrationSPD *calibSPD = (AliITSCalibrationSPD*)spdEntry->At(idet); | |
4873 | if (calibSPD->IsBad()) return 2; | |
4874 | } else if (ilayer==2 || ilayer==3) { // SDD | |
4875 | AliCDBEntry* cdbEntry = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD"); | |
4876 | if (!cdbEntry) { | |
4877 | Error("CheckDeadZone","Cannot get CDB entry for SDD\n"); | |
4878 | return 0; | |
4879 | } | |
4880 | TObjArray* sddEntry = (TObjArray*)cdbEntry->GetObject(); | |
4881 | if (!sddEntry) { | |
4882 | Error("CheckDeadZone","Cannot get CDB entry for SDD\n"); | |
4883 | return 0; | |
4884 | } | |
4885 | if(ilayer==3) idet += AliITSgeomTGeo::GetNLadders(3)*AliITSgeomTGeo::GetNDetectors(3); | |
4886 | //printf("SDD det: %d\n",idet); | |
4887 | AliITSCalibrationSDD *calibSDD = (AliITSCalibrationSDD*)sddEntry->At(idet); | |
4888 | if (calibSDD->IsDead()) return 2; | |
4889 | } else if (ilayer==4 || ilayer==5) { // SSD | |
4890 | } else { | |
4891 | Error("CheckDeadZone","Wrong layer number\n"); | |
4892 | if(ilayer==5) idet += AliITSgeomTGeo::GetNLadders(5)*AliITSgeomTGeo::GetNDetectors(5); | |
4893 | return 0; | |
6518a6c5 | 4894 | } |
4895 | ||
4896 | return 0; | |
4897 | } | |
4898 | //------------------------------------------------------------------------ | |
ae00569a | 4899 | Bool_t AliITStrackerMI::LocalModuleCoord(Int_t ilayer,Int_t idet, |
4900 | AliITStrackMI *track, | |
4901 | Float_t &xloc,Float_t &zloc) const { | |
4902 | //----------------------------------------------------------------- | |
4903 | // Gives position of track in local module ref. frame | |
4904 | //----------------------------------------------------------------- | |
4905 | ||
4906 | xloc=0.; | |
4907 | zloc=0.; | |
4908 | ||
4909 | if(idet<0) return kFALSE; | |
4910 | ||
4911 | Int_t ndet=AliITSgeomTGeo::GetNDetectors(ilayer+1); // layers from 1 to 6 | |
4912 | ||
4913 | Int_t lad = Int_t(idet/ndet) + 1; | |
4a66240a | 4914 | |
ae00569a | 4915 | Int_t det = idet - (lad-1)*ndet + 1; |
4916 | ||
4917 | Double_t xyzGlob[3],xyzLoc[3]; | |
4918 | ||
4919 | track->GetXYZ(xyzGlob); | |
4920 | ||
4921 | AliITSgeomTGeo::GlobalToLocal(ilayer+1,lad,det,xyzGlob,xyzLoc); | |
4922 | ||
4923 | xloc = (Float_t)xyzLoc[0]; | |
4924 | zloc = (Float_t)xyzLoc[2]; | |
4925 | ||
4926 | return kTRUE; | |
4927 | } | |
4928 | //------------------------------------------------------------------------ | |
7167ae53 | 4929 | Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) const { |
4930 | // Method still to be implemented: | |
4931 | // | |
4932 | // it will apply a pre-selection to obtain good quality tracks. | |
4933 | // Here also you will have the possibility to put a control on the | |
4934 | // impact point of the track on the basic block, in order to exclude border regions | |
4935 | // this will be done by calling a proper method of the AliITSPlaneEff class. | |
4936 | // | |
4937 | // input: AliITStrackMI* track, ilayer= layer number [0,5] | |
4938 | // output: Bool_t -> kTRUE if usable track, kFALSE if not usable. | |
4939 | return kTRUE; | |
4940 | } | |
4941 | //------------------------------------------------------------------------ | |
4942 | void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) { | |
4943 | // | |
4944 | // This Method has to be optimized! For the time-being it uses the same criteria | |
4945 | // as those used in the search of extra clusters for overlapping modules. | |
4946 | // | |
4947 | // Method Purpose: estabilish whether a track has produced a recpoint or not | |
4948 | // in the layer under study (For Plane efficiency) | |
4949 | // | |
4950 | // inputs: AliITStrackMI* track (pointer to a usable track) | |
4951 | // outputs: none | |
4952 | // side effects: update (by 1 count) the Plane Efficiency statistics of the basic block | |
4953 | // traversed by this very track. In details: | |
4954 | // - if a cluster can be associated to the track then call | |
4955 | // AliITSPlaneEff::UpDatePlaneEff(key,kTRUE); | |
4956 | // - if not, the AliITSPlaneEff::UpDatePlaneEff(key,kFALSE) is called | |
4957 | // | |
4958 | AliITSlayer &layer=fgLayers[ilayer]; | |
4959 | Double_t r=layer.GetR(); | |
4960 | //AliITStrackV2 tmp(*track); | |
4961 | AliITStrackMI tmp(*track); | |
4962 | ||
4963 | // detector number | |
4964 | Double_t phi,z; | |
4965 | if (!tmp.GetPhiZat(r,phi,z)) return; | |
4966 | Int_t idet=layer.FindDetectorIndex(phi,z); | |
4967 | ||
4968 | if(idet<0) return; | |
4969 | ||
4970 | Double_t trackGlobXYZ1[3]; | |
4971 | tmp.GetXYZ(trackGlobXYZ1); | |
4972 | ||
4973 | // Get the budget to the primary vertex for the current track being prolonged | |
4974 | Double_t budgetToPrimVertex = GetEffectiveThickness(); | |
4975 | ||
4976 | //propagate to the intersection with the detector plane | |
4977 | const AliITSdetector &det=layer.GetDetector(idet); | |
4978 | if (!tmp.Propagate(det.GetPhi(),det.GetR())) return; | |
4979 | ||
4980 | //Float_t xloc,zloc; | |
4981 | ||
4982 | //*************** | |
4983 | // DEFINITION OF SEARCH ROAD FOR CLUSTERS SELECTION | |
4984 | // | |
4985 | Double_t dz=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadZ()* | |
4986 | TMath::Sqrt(tmp.GetSigmaZ2() + | |
4987 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
4988 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
4989 | AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer)); | |
4990 | Double_t dy=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadY()* | |
4991 | TMath::Sqrt(tmp.GetSigmaY2() + | |
4992 | AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()* | |
4993 | AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()* | |
4994 | AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer)); | |
4995 | ||
4996 | // road in global (rphi,z) [i.e. in tracking ref. system] | |
4997 | Double_t zmin = tmp.GetZ() - dz; | |
4998 | Double_t zmax = tmp.GetZ() + dz; | |
4999 | Double_t ymin = tmp.GetY() + r*det.GetPhi() - dy; | |
5000 | Double_t ymax = tmp.GetY() + r*det.GetPhi() + dy; | |
5001 | ||
5002 | // select clusters in road | |
5003 | layer.SelectClusters(zmin,zmax,ymin,ymax); | |
5004 | ||
5005 | // Define criteria for track-cluster association | |
5006 | Double_t msz = tmp.GetSigmaZ2() + | |
5007 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
5008 | AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()* | |
5009 | AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer); | |
5010 | Double_t msy = tmp.GetSigmaY2() + | |
5011 | AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()* | |
5012 | AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()* | |
5013 | AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer); | |
5014 | // if (constrain) { | |
5015 | msz *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadZC(); | |
5016 | msy *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadYC(); | |
5017 | // } else { | |
5018 | // msz *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadZNonC(); | |
5019 | // msy *= AliITSReconstructor::GetRecoParam()->GetNSigma2RoadYNonC(); | |
5020 | // } | |
5021 | msz = 1./msz; // 1/RoadZ^2 | |
5022 | msy = 1./msy; // 1/RoadY^2 | |
5023 | // | |
5024 | ||
5025 | const AliITSRecPoint *cl=0; Int_t clidx=-1, ci=-1; | |
5026 | Int_t idetc=-1; | |
5027 | Double_t maxchi2=1000.*AliITSReconstructor::GetRecoParam()->GetMaxChi2(), tolerance=0.1; | |
5028 | while ((cl=layer.GetNextCluster(clidx))!=0) { | |
5029 | idetc = cl->GetDetectorIndex(); | |
5030 | if(idet!=idetc) continue; | |
5031 | //Int_t ilay = cl->GetLayer(); | |
5032 | ||
5033 | if (TMath::Abs(tmp.GetZ() - cl->GetZ()) > tolerance) continue; | |
5034 | if (TMath::Abs(tmp.GetY() - cl->GetY()) > tolerance) continue; | |
5035 | ||
5036 | Double_t chi2=tmp.GetPredictedChi2(cl); | |
5037 | if (chi2<maxchi2) { maxchi2=chi2; ci=clidx; } | |
5038 | } | |
5039 | Float_t locx; // to be changed (if no cluster) | |
5040 | Float_t locz; // to be changed (if no cluster) | |
5041 | LocalModuleCoord(ilayer,idet,&tmp,locx,locz); | |
5042 | // | |
5043 | AliDebug(2,Form("ilayer= %d, idet=%d, x= %f, z=%f",ilayer,idet,locx,locz)); | |
5044 | UInt_t key=fPlaneEff->GetKeyFromDetLocCoord(ilayer,idet,locx,locz); | |
5045 | if(key>fPlaneEff->Nblock()) return; | |
5046 | Bool_t found=kFALSE; | |
5047 | if (ci>=0) { | |
5048 | cl=layer.GetCluster(ci); | |
5049 | // here real control to see whether the cluster can be associated to the track. | |
5050 | // if() .... | |
5051 | found=kTRUE; | |
5052 | // track->SetExtraCluster(ilayer,(ilayer<<28)+ci); | |
5053 | // track->SetExtraModule(ilayer,idetExtra); | |
5054 | } | |
5055 | if(!fPlaneEff->UpDatePlaneEff(found,key)) | |
5056 | AliError(Form("UseTrackForPlaneEff: cannot UpDate PlaneEff for key=%d",key)); | |
5057 | return; | |
5058 | } |