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