From c5efb94636c6b1bb50139ba46eb3d0b6b8af9371 Mon Sep 17 00:00:00 2001 From: richterm Date: Mon, 22 Aug 2011 06:20:41 +0000 Subject: [PATCH] introducing track index grid; allowing more than one assigned spacepoint for track points --- HLT/BASE/AliHLTTrackGeometry.cxx | 26 +++++++++--- HLT/BASE/AliHLTTrackGeometry.h | 69 +++++++++++++++++++++----------- 2 files changed, 66 insertions(+), 29 deletions(-) diff --git a/HLT/BASE/AliHLTTrackGeometry.cxx b/HLT/BASE/AliHLTTrackGeometry.cxx index 1f153c68ae8..dc899c17c98 100644 --- a/HLT/BASE/AliHLTTrackGeometry.cxx +++ b/HLT/BASE/AliHLTTrackGeometry.cxx @@ -195,14 +195,12 @@ void AliHLTTrackGeometry::Draw(Option_t *option) } } -int AliHLTTrackGeometry::SetAssociatedSpacePoint(UInt_t planeId, UInt_t spacepointId, int status, float fdU, float fdV) +int AliHLTTrackGeometry::SetAssociatedSpacePoint(UInt_t planeId, UInt_t spacepointId, int /*status*/, float dU, float dV) { /// set the spacepoint associated with a track point vector::iterator element = find(fTrackPoints.begin(), fTrackPoints.end(), planeId); if (element==fTrackPoints.end()) return -ENOENT; - element->SetAssociatedSpacePoint(spacepointId, status); - element->SetResidual(0, fdU); - element->SetResidual(1, fdV); + element->AddAssociatedSpacePoint(spacepointId, dU, dV); return 0; } @@ -213,7 +211,20 @@ int AliHLTTrackGeometry::GetAssociatedSpacePoint(UInt_t planeId, UInt_t& spacepo vector::const_iterator element = find(fTrackPoints.begin(), fTrackPoints.end(), planeId); if (element==fTrackPoints.end()) return -ENOENT; if (!element->HaveAssociatedSpacePoint()) return -ENODATA; - return element->GetAssociatedSpacePoint(spacepointId); + spacepointId=(element->GetSpacepoints())[0].fId; + return 0; +} + +int AliHLTTrackGeometry::RegisterTrackPoints(AliHLTTrackGrid* /*pGrid*/) const +{ + /// default implementation, nothing to do + return -ENOSYS; +} + +int AliHLTTrackGeometry::FillTrackPoints(AliHLTTrackGrid* /*pGrid*/) const +{ + /// default implementation, nothing to do + return -ENOSYS; } const AliHLTTrackGeometry::AliHLTTrackPoint* AliHLTTrackGeometry::GetTrackPoint(AliHLTUInt32_t id) const @@ -332,7 +343,10 @@ int AliHLTTrackGeometry::FillResidual(int coordinate, TH2* histo) const for (vector::const_iterator trackpoint=trackPoints.begin(); trackpoint!=trackPoints.end(); trackpoint++) { if (!trackpoint->HaveAssociatedSpacePoint()) continue; - histo->Fill(GetPlaneR(trackpoint->GetId()), trackpoint->GetResidual(coordinate)); + for (vector::const_iterator sp=(trackpoint->GetSpacepoints()).begin(); + sp!=(trackpoint->GetSpacepoints()).end(); sp++) { + histo->Fill(GetPlaneR(trackpoint->GetId()), sp->GetResidual(coordinate)); + } } return 0; } diff --git a/HLT/BASE/AliHLTTrackGeometry.h b/HLT/BASE/AliHLTTrackGeometry.h index 451bc0979ca..e5bfd8690d3 100644 --- a/HLT/BASE/AliHLTTrackGeometry.h +++ b/HLT/BASE/AliHLTTrackGeometry.h @@ -18,6 +18,7 @@ #include "AliHLTDataTypes.h" #include "AliHLTStdIncludes.h" #include "AliHLTExternalTrackParam.h" +#include "AliHLTIndexGrid.h" class AliHLTGlobalBarrelTrack; class AliHLTSpacePointContainer; @@ -55,6 +56,8 @@ class AliHLTTrackGeometry : public TObject, public AliHLTLogging /// destructor ~AliHLTTrackGeometry(); + typedef AliHLTIndexGrid AliHLTTrackGrid; + /// set the track id void SetTrackId(int trackId) {fTrackId=trackId;} /// get the track id @@ -124,17 +127,38 @@ class AliHLTTrackGeometry : public TObject, public AliHLTLogging AliHLTTrackPlaneYZ(); }; + struct AliHLTTrackSpacepoint { + AliHLTTrackSpacepoint(AliHLTUInt32_t id, float dU=-1000., float dV=-1000.) + : fId(id), fdU(dU), fdV(dV) {} + + int SetResidual(int coordinate, float value) { + if (coordinate==0) fdU=value; + else if (coordinate==1) fdV=value; + return 0; + } + + float GetResidual(int coordinate) const { + if (coordinate==0) return fdU; + else if (coordinate==1) return fdV; + return 1000.; + } + + AliHLTUInt32_t fId; // space point id + float fdU; // residual of the spacepoint + float fdV; // residual of the spacepoint + }; + class AliHLTTrackPoint { public: // constructor AliHLTTrackPoint(AliHLTUInt32_t id, float u, float v) - : fId(id), fU(u), fV(v), fSpacePoint(0), fdU(0.), fdV(0.), fSpacePointStatus(-1) {} + : fId(id), fU(u), fV(v), fSpacePoints() {} // copy constructor AliHLTTrackPoint(const AliHLTTrackPoint& src) - : fId(src.fId), fU(src.fU), fV(src.fV), fSpacePoint(src.fSpacePoint), fdU(src.fdU), fdV(src.fdV), fSpacePointStatus(src.fSpacePointStatus) {} + : fId(src.fId), fU(src.fU), fV(src.fV), fSpacePoints(src.fSpacePoints) {} // assignment operator AliHLTTrackPoint& operator=(const AliHLTTrackPoint& src) { - if (this!=&src) {fId=src.fId; fU=src.fU; fV=src.fV; fSpacePoint=src.fSpacePoint; fdU=src.fdU; fdV=src.fdV; fSpacePointStatus=src.fSpacePointStatus;} + if (this!=&src) {fId=src.fId; fU=src.fU; fV=src.fV; fSpacePoints=src.fSpacePoints;} return *this; } ~AliHLTTrackPoint() {} @@ -155,28 +179,24 @@ class AliHLTTrackGeometry : public TObject, public AliHLTLogging /// check associate space point bool HaveAssociatedSpacePoint() const { - return fSpacePointStatus>=0; + return fSpacePoints.size()>0; } /// associate a space point - int SetAssociatedSpacePoint(AliHLTUInt32_t spacepointId, int status) { - fSpacePoint=spacepointId; fSpacePointStatus=status; return 0; - } - - int GetAssociatedSpacePoint(AliHLTUInt32_t& spacepointId) const { - spacepointId=fSpacePoint; return fSpacePointStatus<0?-ENOENT:fSpacePointStatus; - } - - int SetResidual(int coordinate, float value) { - if (coordinate==0) fdU=value; - else if (coordinate==1) fdV=value; + int AddAssociatedSpacePoint(AliHLTUInt32_t spacepointId, float dU=-1000., float dV=-1000.) { + fSpacePoints.push_back(AliHLTTrackSpacepoint(spacepointId, dU, dV)); return 0; } - float GetResidual(int coordinate) const { - if (coordinate==0) return fdU; - else if (coordinate==1) return fdV; - return 0.; + const vector& GetSpacepoints() const {return fSpacePoints;} + vector& GetSpacepoints() {return fSpacePoints;} + + int SetResidual(AliHLTUInt32_t id, int coordinate, float value) { + for (unsigned i=0; i fSpacePoints; }; // interface to plane description @@ -220,6 +237,12 @@ class AliHLTTrackGeometry : public TObject, public AliHLTLogging /// find the track point which can be associated to a spacepoint with coordinates and id virtual int FindMatchingTrackPoint(AliHLTUInt32_t spacepointId, float spacepoint[3], AliHLTUInt32_t& planeId) = 0; + /// register track points in the index grid + virtual int RegisterTrackPoints(AliHLTTrackGrid* pGrid) const; + + /// fill track points to index grid + virtual int FillTrackPoints(AliHLTTrackGrid* pGrid) const; + /// get track point of id const AliHLTTrackPoint* GetTrackPoint(AliHLTUInt32_t id) const; /// get track point of id -- 2.43.5