--- /dev/null
+
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#ifdef use_aliroot
+#pragma link C++ class AliL3ITStrack;
+#pragma link C++ class AliL3ITStracker;
+#endif
+
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-------------------------------------------------------------------------
+// Implementation of the HLT ITS track class
+//
+// Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
+//-------------------------------------------------------------------------
+
+#include <TMath.h>
+
+#include "AliL3StandardIncludes.h"
+
+#include "AliESDHLTtrack.h"
+#include "AliL3ITStrack.h"
+
+ClassImp(AliL3ITStrack)
+
+//____________________________________________________________________________
+AliL3ITStrack::AliL3ITStrack():AliITStrackV2(),
+ fESDHLTtrack(0)
+{
+ //------------------------------------------------------------------
+ //Constructor
+ //------------------------------------------------------------------
+}
+
+//____________________________________________________________________________
+AliL3ITStrack::AliL3ITStrack(const AliL3ITStrack& t) : AliITStrackV2(t) {
+ //------------------------------------------------------------------
+ //Copy constructor
+ //------------------------------------------------------------------
+ fESDHLTtrack=t.fESDHLTtrack;
+}
+
+//____________________________________________________________________________
+AliL3ITStrack::AliL3ITStrack(AliESDHLTtrack& t, Double_t zvertex) throw (const Char_t *) {
+ // The method constructs an AliL3ITStrack object from an ESD HLT track
+
+ SetChi2(0.);
+ if(t.GetNHits()==1)
+ SetNumberOfClusters(0);
+ else
+ SetNumberOfClusters(t.GetNHits());
+ SetLabel(t.GetMCid());
+ SetMass(0.13957);
+
+ fdEdx=0;
+ fAlpha = fmod((t.GetSector()+0.5)*(2*TMath::Pi()/18),2*TMath::Pi());
+ if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
+ else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
+
+ //First the emiision angle
+ Double_t psi = t.GetPsi()-(t.GetSector()+0.5)*(2*TMath::Pi()/18);
+
+ //Then local x,y coordinates
+ Double_t radius = t.GetPt()*GetConvConst();
+ Double_t xhit = 82.97; //Position at first TPC padrow
+ Double_t trackphi0 = psi + (-t.GetCharge())*TMath::Pi()/2;
+ Double_t x0 = t.GetFirstPointX()*TMath::Cos(fAlpha) + t.GetFirstPointY()*TMath::Sin(fAlpha);
+ Double_t y0 = t.GetFirstPointY()*TMath::Cos(fAlpha) - t.GetFirstPointX()*TMath::Sin(fAlpha);
+ Double_t centerx = radius * cos(trackphi0) + x0;
+ Double_t centery = radius * sin(trackphi0) + y0;
+ Double_t aa = (xhit - centerx)*(xhit - centerx);
+ Double_t r2 = radius*radius;
+ if(aa > r2) throw "AliITStrackV2: conversion failed !\n";
+ Double_t aa2 = sqrt(r2 - aa);
+ Double_t y1 = centery + aa2;
+ Double_t y2 = centery - aa2;
+ Double_t yhit = y1;
+ if(fabs(y2) < fabs(y1)) yhit = y2;
+
+ //Local z coordinate
+ Double_t angle1 = atan2((yhit - centery),(xhit - centerx));
+ if(angle1 < 0) angle1 += 2.*TMath::Pi();
+ Double_t angle2 = atan2((x0-centery),(y0-centerx));
+ if(angle2 < 0) angle2 += 2.*TMath::Pi();
+ Double_t diffangle = angle1 - angle2;
+ diffangle = fmod(diffangle,2.*TMath::Pi());
+ if(((-t.GetCharge())*diffangle) < 0) diffangle = diffangle - (-t.GetCharge())*2.*TMath::Pi();
+ Double_t stot = fabs(diffangle)*radius;
+ Double_t zhit;
+ if(t.GetNHits()==1)
+ zhit = zvertex + stot*t.GetTgl();
+ else
+ zhit = t.GetFirstPointZ() + stot*t.GetTgl();
+
+ //Local sine of track azimuthal angle
+ if((-t.GetCharge())<0)
+ radius = -radius;
+ Double_t sinbeta = -1.*(centerx - xhit)/radius;
+
+ //Filling of the track paramaters
+ fX=xhit;
+ fP0=yhit;
+ fP1=zhit;
+ fP2=sinbeta;
+ fP3=t.GetTgl();
+ fP4=1./radius;
+
+ //and covariance matrix
+ fC00=0.4*0.4;
+ fC11=0.4*0.4;
+ fC22=0.006*0.006;
+ fC33=0.006*0.006;
+ fC44=(0.005+0.025*t.GetPt())*(0.005+0.025*t.GetPt())*fP4*fP4;
+
+ fC10=0;
+ fC20=0; fC21=0;
+ fC30=0; fC31=0; fC32=0;
+ fC40=0; fC41=0; fC42=0; fC43=0;
+
+ fESDHLTtrack=&t;
+ fESDtrack=0;
+
+ SetFakeRatio(0.);
+
+}
+
+//_____________________________________________________________________________
+Int_t AliL3ITStrack::Compare(const TObject *o) const {
+ //-----------------------------------------------------------------
+ // This function compares tracks according to the their curvature
+ //-----------------------------------------------------------------
+ AliL3ITStrack *t=(AliL3ITStrack*)o;
+ Double_t co=TMath::Abs(t->Get1Pt());
+ Double_t c =TMath::Abs(Get1Pt());
+ // Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
+ // Double_t c =GetSigmaY2()*GetSigmaZ2();
+ if (c>co) return 1;
+ else if (c<co) return -1;
+ return 0;
+}
--- /dev/null
+#ifndef ALIL3ITSTRACK_H
+#define ALIL3ITSTRACK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//-------------------------------------------------------------------------
+// High Level Trigger ITS Track Class
+//
+// Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
+//-------------------------------------------------------------------------
+
+
+/*****************************************************************************
+ * October 11, 2004 *
+ * The class inherits all the properties of the off-line AliITStrackV2 class *
+ * and in addition it contains an interface to the HLT ESD track *
+ *****************************************************************************/
+
+#include <AliITStrackV2.h>
+
+class AliESDHLTtrack;
+
+class AliL3ITStrack : public AliITStrackV2 {
+public:
+ AliL3ITStrack();
+ AliL3ITStrack(AliESDHLTtrack& t, Double_t zvertex) throw (const Char_t *);
+ AliL3ITStrack(const AliL3ITStrack& t);
+
+ Int_t Compare(const TObject *o) const;
+
+ // Set and get the pointer to the HLT ESD track
+ AliESDHLTtrack *GetESDHLTtrack() const {return fESDHLTtrack; }
+ void SetESDHLTtrack(AliESDHLTtrack *esdhlttrack) { fESDHLTtrack = esdhlttrack; }
+
+protected:
+ AliESDHLTtrack *fESDHLTtrack; //! pointer to the connected ESD HLT track
+
+ ClassDef(AliL3ITStrack,1) //HLT ITS reconstructed track
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-------------------------------------------------------------------------
+// Implementation of the HLT ITS tracker class
+// It reads AliITSclusterV2 clusters and HLT ESD tracks and creates
+// AliITStrackV2 tracks. For details, see also RunHLTITS.C macro.
+// Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
+//-------------------------------------------------------------------------
+
+#include "AliESD.h"
+#include "AliL3ITStrack.h"
+#include "AliL3ITStracker.h"
+
+ClassImp(AliL3ITStracker)
+
+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 AliL3ITStracker::Clusters2Tracks(AliESD *event) {
+ //--------------------------------------------------------------------
+ // This functions reconstructs HLT ITS tracks
+ //--------------------------------------------------------------------
+ TObjArray itsTracks(15000);
+
+ {/* Read HLT ESD tracks */
+ Int_t nentr;
+ nentr=event->GetNumberOfHLTHoughTracks();
+ Info("Clusters2Tracks", "Number of ESD HLT tracks: %d\n", nentr);
+ while (nentr--) {
+
+ AliESDHLTtrack *esd=event->GetHLTHoughTrack(nentr);
+ if (esd->GetWeight() > 500) continue;
+
+ AliL3ITStrack *t=0;
+ try {
+ t=new AliL3ITStrack(*esd,GetZ());
+ } catch (const Char_t *msg) {
+ Warning("Clusters2Tracks",msg);
+ delete t;
+ continue;
+ }
+ if (TMath::Abs(t->GetD())>5) {
+ 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 HLT ESD tracks */
+
+ itsTracks.Sort();
+ Int_t nentr=itsTracks.GetEntriesFast();
+ Info("Clusters2Tracks", "Number of Selected for tracking HLT ESD tracks: %d\n", nentr);
+
+ Int_t ntrk=0;
+ for (fPass=0; fPass<2; fPass++) {
+ Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue;
+ for (Int_t i=0; i<nentr; i++) {
+ AliL3ITStrack *t=(AliL3ITStrack*)itsTracks.UncheckedAt(i);
+ if (t==0) continue; //this track has been already tracked
+ Int_t tpcLabel=t->GetLabel(); //save the TPC track label
+
+ ResetTrackToFollow(*t);
+ ResetBestTrack();
+
+ for (FollowProlongation(); fI<kMaxLayer; fI++) {
+ while (TakeNextProlongation()) FollowProlongation();
+ }
+
+ if (fBestTrack.GetNumberOfClusters() == 0) continue;
+
+ if (fConstraint[fPass]) {
+ ResetTrackToFollow(*t);
+ if (!RefitAt(3.7, &fTrackToFollow, &fBestTrack)) continue;
+ ResetBestTrack();
+ }
+
+ fBestTrack.SetLabel(tpcLabel);
+ fBestTrack.CookdEdx();
+ CookLabel(&fBestTrack,0.); //For comparison only
+ // Specific to the AliL3ITStracker
+ // fBestTrack.UpdateESDtrack(AliESDtrack::kITSin);
+ t->GetESDHLTtrack()->UpdateTrackParams(&fBestTrack);
+ //
+ UseClusters(&fBestTrack);
+ delete itsTracks.RemoveAt(i);
+ ntrk++;
+ }
+ }
+
+ itsTracks.Delete();
+
+ Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk);
+
+ return 0;
+}
+
+Int_t AliL3ITStracker::PropagateBack(AliESD *event) {
+ //--------------------------------------------------------------------
+ // This functions propagates reconstructed ITS tracks back
+ //--------------------------------------------------------------------
+ Int_t nentr=event->GetNumberOfHLTHoughTracks();
+ Info("PropagateBack", "Number of HLT ESD tracks: %d\n", nentr);
+
+ Int_t ntrk=0;
+ for (Int_t i=0; i<nentr; i++) {
+ AliESDHLTtrack *esd=event->GetHLTHoughTrack(i);
+ if (esd->GetWeight() > 500) continue;
+
+ AliL3ITStrack *t=0;
+ try {
+ t=new AliL3ITStrack(*esd,GetZ());
+ } catch (const Char_t *msg) {
+ Warning("PropagateBack",msg);
+ delete t;
+ continue;
+ }
+
+ ResetTrackToFollow(*t);
+
+ // propagete to vertex [SR, GSI 17.02.2003]
+ // Start Time measurement [SR, GSI 17.02.2003], corrected by I.Belikov
+ if (fTrackToFollow.PropagateTo(3.,0.0028,65.19)) {
+ if (fTrackToFollow.PropagateToVertex()) {
+ fTrackToFollow.StartTimeIntegral();
+ }
+ fTrackToFollow.PropagateTo(3.,-0.0028,65.19);
+ }
+
+ fTrackToFollow.ResetCovariance(); fTrackToFollow.ResetClusters();
+ if (RefitAt(49.,&fTrackToFollow,t)) {
+ if (CorrectForDeadZoneMaterial(&fTrackToFollow)!=0) {
+ Warning("PropagateBack",
+ "failed to correct for the material in the dead zone !\n");
+ delete t;
+ continue;
+ }
+ fTrackToFollow.SetLabel(t->GetLabel());
+ //fTrackToFollow.CookdEdx();
+ CookLabel(&fTrackToFollow,0.); //For comparison only
+ // cout<<" Backtrack "<<fTrackToFollow.GetLabel()<<" "<<fTrackToFollow.GetNumberOfClusters()<<" "<<fTrackToFollow.fFakeRatio<<endl;
+ fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSout);
+ //UseClusters(&fTrackToFollow);
+ ntrk++;
+ }
+ delete t;
+ }
+
+ Info("PropagateBack","Number of back propagated HLT ITS tracks: %d\n",ntrk);
+
+ return 0;
+}
+
+Int_t AliL3ITStracker::RefitInward(AliESD *event) {
+ //--------------------------------------------------------------------
+ // This functions refits ITS tracks using the
+ // "inward propagated" TPC tracks
+ //--------------------------------------------------------------------
+
+ Int_t nentr=event->GetNumberOfHLTHoughTracks();
+ Info("RefitInward", "The method is not yet implemented! %d",nentr);
+ return 0;
+}
--- /dev/null
+#ifndef ALIL3ITSTRACKER_H
+#define ALIL3ITSTRACKER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//-------------------------------------------------------------------------
+// High Level Trigger ITS tracker
+// reads AliITSclusterV2 clusters and HLT tracks as input and creates
+// AliITStrackV2 tracks which then can be stored to the HLT ESD.
+// The class inheritates all the main features of the off-line
+// AliITStrackerV2 with some changes in order to load the HLT tracks
+// instead of the off-line TPC tracks. For time performance reasons
+// the tracker is supposed to perform only one reconstruction pass
+// and eventually propagate the tracks back to TPC inner border.
+// For detals how to use it, see RunHLTITS.C macro.
+//
+// Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
+//-------------------------------------------------------------------------
+
+#include "AliITStrackerV2.h"
+
+class AliESD;
+class AliITSgeom;
+class AliL3ITStrack;
+
+//-------------------------------------------------------------------------
+class AliL3ITStracker : public AliITStrackerV2 {
+public:
+ AliL3ITStracker():AliITStrackerV2(){ fConstraint[0]=1; fConstraint[1]=0; }
+ AliL3ITStracker(const AliITSgeom *geom) : AliITStrackerV2(geom){ fConstraint[0]=1; fConstraint[1]=0; }
+
+ Int_t Clusters2Tracks(AliESD *event);
+ Int_t PropagateBack(AliESD *event);
+ Int_t RefitInward(AliESD *event);
+
+ ClassDef(AliL3ITStracker,1) //HLT ITS tracker
+};
+
+#endif
--- /dev/null
+// The following macro runs the HLT ITS tracker over the HLT
+// tracks stored in the ESD and stores the output tracks in a
+// separate ESD file AliESDits.root
+
+Int_t RunHLTITS(Int_t nev=1,Int_t run=0) {
+
+ TStopwatch timer;
+ timer.Start();
+
+ if (gAlice) {
+ delete gAlice->GetRunLoader();
+ delete gAlice;
+ gAlice=0;
+ }
+
+ AliRunLoader *rl = AliRunLoader::Open("galice.root");
+ if (rl == 0x0) {
+ cerr<<"Can not open session"<<endl;
+ return 1;
+ }
+ Int_t retval = rl->LoadgAlice();
+ if (retval) {
+ cerr<<"AliESDtest.C : LoadgAlice returned error"<<endl;
+ delete rl;
+ return 1;
+ }
+ retval = rl->LoadHeader();
+ if (retval) {
+ cerr<<"AliESDtest.C : LoadHeader returned error"<<endl;
+ delete rl;
+ return 2;
+ }
+ gAlice=rl->GetAliRun();
+
+
+ AliKalmanTrack::SetConvConst(
+ 1000/0.299792458/gAlice->Field()->SolenoidField()
+ );
+
+ AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
+ if (itsl == 0x0) {
+ cerr<<"AliESDtest.C : Can not get the ITS loader"<<endl;
+ return 3;
+ }
+ itsl->LoadRecPoints("read");
+
+ AliITS *dITS = (AliITS*)gAlice->GetDetector("ITS");
+ if (!dITS) {
+ cerr<<"AliESDtest.C : Can not find the ITS detector !"<<endl;
+ return 4;
+ }
+ AliITSgeom *geom = dITS->GetITSgeom();
+
+ //An instance of the HLT ITS tracker
+ AliL3ITStracker itsTracker(geom);
+
+ TFile *ef=TFile::Open("AliESDs.root");
+ if (!ef || !ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
+ AliESD* event = new AliESD;
+ TTree* tree = (TTree*) ef->Get("esdTree");
+ if (!tree) {cerr<<"no ESD tree found\n"; return 1;};
+ tree->SetBranchAddress("ESD", &event);
+
+ TFile *itsf=TFile::Open("AliESDits.root","RECREATE");
+ if ((!itsf)||(!itsf->IsOpen())) {
+ cerr<<"Can't AliESDits.root !\n"; return 1;
+ }
+
+ Int_t rc=0;
+ if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
+ //The loop over events
+ for (Int_t i=0; i<nev; i++) {
+
+ cerr<<"\n\nProcessing event number : "<<i<<endl;
+ tree->GetEvent(i);
+
+ rl->GetEvent(i);
+
+ TArrayF v(3);
+ rl->GetHeader()->GenEventHeader()->PrimaryVertex(v);
+ Double_t vtx[3]={v[0],v[1],v[2]};
+ Double_t cvtx[3]={0.005,0.005,0.010};
+ AliESDVertex vertex1(vtx,cvtx);
+ event->SetVertex(&vertex1);
+
+ Double_t vtx[3];
+ Double_t cvtx[3];
+ AliESDVertex *vertex = event->GetVertex();
+ vertex->GetXYZ(vtx);
+ vertex->GetSigmaXYZ(cvtx);
+ itsTracker.SetVertex(vtx,cvtx);
+
+ TTree *itsTree=itsl->TreeR();
+ if (!itsTree) {
+ cerr<<"Can't get the ITS cluster tree !\n";
+ return 4;
+ }
+ itsTracker.LoadClusters(itsTree);
+ rc+=itsTracker.Clusters2Tracks(event);
+ // rc+=itsTracker.PropagateBack(event);
+ itsTracker.UnloadClusters();
+
+ if (rc==0) {
+ TTree* tree = new TTree("esdTree", "Tree with ESD objects");
+ tree->Branch("ESD", "AliESD", &event);
+ tree->Fill();
+ itsf->cd();
+ tree->Write();
+ }
+ if (rc) {
+ cerr<<"Something bad happened...\n";
+ }
+
+ }
+ delete event;
+
+ itsf->Close();
+ ef->Close();
+
+ // delete rl;
+
+ timer.Stop();
+ timer.Print();
+
+ return rc;
+}
--- /dev/null
+#-*- Mode: Makefile -*-
+
+include HLT/hlt.conf
+
+SRCS:= ITS/AliL3ITStrack.cxx ITS/AliL3ITStracker.cxx
+
+HDRS:= $(SRCS:.cxx=.h) $(HLTEHDRS)
+
+DHDR:= ITS/AliL3ITSLinkDef.h
+
+EDEFINE := ${HLTDEFS}
+PACKCXXFLAGS := ${HLTCXXFLAGS}
+PACKCFLAGS := ${HLTCLFAGS}
+PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
+
+EINCLUDE += HLT/src HLT/hough HLT/comp HLT/misc TPC ITS STEER CONTAINERS
+
+SUBDIR:=ITS