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