+ return 0;
+}
+
+void AliITStrackerV2::UnloadClusters() {
+ //--------------------------------------------------------------------
+ //This function unloads ITS clusters
+ //--------------------------------------------------------------------
+ for (Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fgLayers[i].ResetClusters();
+}
+
+static Int_t CorrectForDeadZoneMaterial(AliITStrackV2 *t) {
+ //--------------------------------------------------------------------
+ // Correction for the material between the TPC and the ITS
+ // (should it belong to the TPC code ?)
+ //--------------------------------------------------------------------
+ Double_t riw=80., diw=0.0053, x0iw=30; // TPC inner wall ?
+ Double_t rcd=61., dcd=0.0053, x0cd=30; // TPC "central drum" ?
+ Double_t yr=12.8, dr=0.03; // rods ?
+ Double_t zm=0.2, dm=0.40; // membrane
+ //Double_t rr=52., dr=0.19, x0r=24., yyr=7.77; //rails
+ Double_t rs=50., ds=0.001; // something belonging to the ITS (screen ?)
+
+ if (t->GetX() > riw) {
+ if (!t->PropagateTo(riw,diw,x0iw)) return 1;
+ if (TMath::Abs(t->GetY())>yr) t->CorrectForMaterial(dr);
+ if (TMath::Abs(t->GetZ())<zm) t->CorrectForMaterial(dm);
+ if (!t->PropagateTo(rcd,dcd,x0cd)) return 1;
+ //Double_t x,y,z; t->GetGlobalXYZat(rr,x,y,z);
+ //if (TMath::Abs(y)<yyr) t->PropagateTo(rr,dr,x0r);
+ if (!t->PropagateTo(rs,ds)) return 1;
+ } else if (t->GetX() < rs) {
+ if (!t->PropagateTo(rs,-ds)) return 1;
+ //Double_t x,y,z; t->GetGlobalXYZat(rr,x,y,z);
+ //if (TMath::Abs(y)<yyr) t->PropagateTo(rr,-dr,x0r);
+ if (!t->PropagateTo(rcd,-dcd,x0cd)) return 1;
+ if (!t->PropagateTo(riw+0.001,-diw,x0iw)) return 1;
+ } else {
+ ::Error("CorrectForDeadZoneMaterial","track is already in the dead zone !");
+ return 1;
+ }
+
+ return 0;
+}
+
+Int_t AliITStrackerV2::Clusters2Tracks(AliESDEvent *event) {
+ //--------------------------------------------------------------------
+ // This functions reconstructs ITS tracks
+ // The clusters must be already loaded !
+ //--------------------------------------------------------------------
+ TObjArray itsTracks(15000);
+
+ {/* Read ESD tracks */
+ Int_t nentr=event->GetNumberOfTracks();
+ Info("Clusters2Tracks", "Number of ESD tracks: %d\n", nentr);
+ while (nentr--) {
+ AliESDtrack *esd=event->GetTrack(nentr);
+
+ if ((esd->GetStatus()&AliESDtrack::kTPCin)==0) continue;
+ if (esd->GetStatus()&AliESDtrack::kTPCout) continue;
+ if (esd->GetStatus()&AliESDtrack::kITSin) continue;
+
+ AliITStrackV2 *t=0;
+ try {
+ t=new AliITStrackV2(*esd);
+ } catch (const Char_t *msg) {
+ Warning("Clusters2Tracks",msg);
+ delete t;
+ continue;
+ }
+ if (TMath::Abs(t->GetD(GetX(),GetY()))>4) {
+ delete t;
+ continue;
+ }
+
+ if (CorrectForDeadZoneMaterial(t)!=0) {
+ Warning("Clusters2Tracks",
+ "failed to correct for the material in the dead zone !\n");
+ delete t;
+ continue;
+ }
+ itsTracks.AddLast(t);
+ }
+ } /* End Read ESD tracks */