//-*- Mode: C++ -*- // ************************************************************************ // This file is property of and copyright by the ALICE HLT Project * // ALICE Experiment at CERN, All rights reserved. * // See cxx source for full Copyright notice * // * //************************************************************************* #ifndef ALIHLTTPCCAMERGER_H #define ALIHLTTPCCAMERGER_H #include "AliHLTTPCCADef.h" #include "AliHLTTPCCAParamArBB.h" #include "AliHLTTPCCATrackParamArBB.h" #include #include using std::fstream; class AliHLTTPCCAClusterInfo; using arbb::dense; using arbb::f32; using arbb::u16; using arbb::boolean; class AliHLTTPCCAFitter { // public: // class AliHLTTPCCAClusterInfo; private: struct ClusterInfoArBB { arbb::dense fISector; // Sector number arbb::dense fIRow; // row number arbb::dense fIClu; // cluster number arbb::dense fX; // x position (sector coord.system) arbb::dense fY; // y position (sector coord.system) arbb::dense fZ; // z position (sector coord.system) arbb::dense fValid; void Resize(arbb::i32 Size) { fISector = arbb::fill(0, Size); fIRow = arbb::fill(0, Size); fIClu = arbb::fill(0, Size); fX = arbb::fill(0.f, Size); fY = arbb::fill(0.f, Size); fZ = arbb::fill(0.f, Size); fValid = arbb::fill(1,Size); } void Pack() { fISector = pack(fISector,fValid); fIRow = pack(fIRow,fValid); fIClu = pack(fIClu,fValid); fX = pack(fX,fValid); fY = pack(fY,fValid); fZ = pack(fZ,fValid); fValid = arbb::fill(1,fX.length()); } void Gather(arbb::dense index, ClusterInfoArBB &a) { a.fISector = arbb::gather(fISector, index,0); a.fIRow = arbb::gather(fIRow, index,0); a.fIClu = arbb::gather(fIClu, index,0); a.fX = arbb::gather(fX, index,0); a.fY = arbb::gather(fY, index,0); a.fZ = arbb::gather(fZ, index,0); a.fValid = arbb::fill(1,a.fX.length()); } }; struct TrackInfoArBB { AliHLTTPCCATrackParamArBB fInnerParam; // inner track parameters AliHLTTPCCATrackParamArBB fOuterParam; // outer track parameters arbb::dense fInnerAlpha; // rotation angle of the coordinate system for inner parameters arbb::dense fOuterAlpha; // rotation angle of the coordinate system for outer parameters arbb::dense fChiPrev; arbb::dense fChiNext; arbb::dense fNClusters; // Number of clusters arbb::dense fFirstClusterRef; // index of the first track cluster in the global cluster array arbb::dense fPrevNeighbour; // neighbour in the previous sector arbb::dense fNextNeighbour; // neighbour in the next sector arbb::dense fSector; // number of the sector, to which the track belongs arbb::dense fInnerRow; // row number of the most inner track hit arbb::dense fOuterRow; // row number of the most inner track hit arbb::dense fSectorPrevNeighbour; // neighbour in the previous sector arbb::dense fSectorNextNeighbour; // neighbour in the next sector arbb::i32 fNSectors; arbb::dense fSectorTrackInfoStart; // Sector starting index in TrackInfo array; arbb::dense fSectorNTrackInfos; // N of sector track infos in TrackInfo array; #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE arbb::dense orig_track_id; // Identification number of the track #endif // DO_TPCCATRACKER_EFF_PERFORMANCE void Resize(arbb::i32 Size) { fInnerParam.Resize(Size); fOuterParam.Resize(Size); fInnerAlpha = arbb::fill(0.f, Size); fOuterAlpha = arbb::fill(0.f, Size); fChiPrev = arbb::fill(0.f, Size); fChiNext = arbb::fill(0.f, Size); fNClusters = arbb::fill(0, Size); fFirstClusterRef = arbb::fill(0, Size); fPrevNeighbour = arbb::fill(0, Size); fNextNeighbour = arbb::fill(0, Size); fSector = arbb::fill(0, Size); fInnerRow = arbb::fill(0, Size); fOuterRow = arbb::fill(0, Size); fSectorPrevNeighbour = arbb::fill(0, Size); fSectorNextNeighbour = arbb::fill(0, Size); #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE orig_track_id = arbb::fill(0, Size); #endif // DO_TPCCATRACKER_EFF_PERFORMANCE } void Pack(arbb::dense mask) { fChiPrev = arbb::pack(fChiPrev, mask); fChiNext = arbb::pack(fChiNext, mask); fNClusters = arbb::pack(fNClusters, mask); fFirstClusterRef = arbb::pack(fFirstClusterRef, mask); fPrevNeighbour = arbb::pack(fPrevNeighbour, mask); fNextNeighbour = arbb::pack(fNextNeighbour, mask); fSector = arbb::pack(fSector, mask); fInnerRow = arbb::pack(fInnerRow, mask); fOuterRow = arbb::pack(fOuterRow, mask); fSectorPrevNeighbour = arbb::pack(fSectorPrevNeighbour, mask); fSectorNextNeighbour = arbb::pack(fSectorNextNeighbour, mask); #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE orig_track_id = arbb::pack(orig_track_id, mask); #endif // DO_TPCCATRACKER_EFF_PERFORMANCE } void PackAll(arbb::dense mask) { fInnerParam.Pack(mask); fOuterParam.Pack(mask); fInnerAlpha = arbb::pack(fInnerAlpha,mask); fOuterAlpha = arbb::pack(fOuterAlpha,mask); fChiPrev = arbb::pack(fChiPrev, mask); fChiNext = arbb::pack(fChiNext, mask); fNClusters = arbb::pack(fNClusters, mask); fFirstClusterRef = arbb::pack(fFirstClusterRef, mask); fPrevNeighbour = arbb::pack(fPrevNeighbour, mask); fNextNeighbour = arbb::pack(fNextNeighbour, mask); fSector = arbb::pack(fSector, mask); fInnerRow = arbb::pack(fInnerRow, mask); fOuterRow = arbb::pack(fOuterRow, mask); fSectorPrevNeighbour = arbb::pack(fSectorPrevNeighbour, mask); fSectorNextNeighbour = arbb::pack(fSectorNextNeighbour, mask); #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE orig_track_id = arbb::pack(orig_track_id, mask); #endif // DO_TPCCATRACKER_EFF_PERFORMANCE } void Pack(arbb::dense mask, TrackInfoArBB &a) { fInnerParam.Pack(mask, a.fInnerParam); fOuterParam.Pack(mask, a.fOuterParam); a.fInnerAlpha = arbb::pack(fInnerAlpha,mask); a.fOuterAlpha = arbb::pack(fOuterAlpha,mask); a.fChiPrev = arbb::pack(fChiPrev, mask); a.fChiNext = arbb::pack(fChiNext, mask); a.fNClusters = arbb::pack(fNClusters, mask); a.fFirstClusterRef = arbb::pack(fFirstClusterRef, mask); a.fPrevNeighbour = arbb::pack(fPrevNeighbour, mask); a.fNextNeighbour = arbb::pack(fNextNeighbour, mask); a.fSector = arbb::pack(fSector, mask); a.fInnerRow = arbb::pack(fInnerRow, mask); a.fOuterRow = arbb::pack(fOuterRow, mask); a.fSectorPrevNeighbour = arbb::pack(fSectorPrevNeighbour, mask); a.fSectorNextNeighbour = arbb::pack(fSectorNextNeighbour, mask); #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE a.orig_track_id = arbb::pack(orig_track_id, mask); #endif // DO_TPCCATRACKER_EFF_PERFORMANCE } void Gather(arbb::dense index, TrackInfoArBB &a) { fInnerParam.Gather(index, a.fInnerParam); fOuterParam.Gather(index, a.fOuterParam); a.fInnerAlpha = arbb::gather(fInnerAlpha,index,0); a.fOuterAlpha = arbb::gather(fOuterAlpha,index,0); a.fChiPrev = arbb::gather(fChiPrev, index,0); a.fChiNext = arbb::gather(fChiNext, index,0); a.fNClusters = arbb::gather(fNClusters, index,0); a.fFirstClusterRef = arbb::gather(fFirstClusterRef, index,0); a.fPrevNeighbour = arbb::gather(fPrevNeighbour, index,0); a.fNextNeighbour = arbb::gather(fNextNeighbour, index,0); a.fSector = arbb::gather(fSector, index,0); a.fInnerRow = arbb::gather(fInnerRow, index,0); a.fOuterRow = arbb::gather(fOuterRow, index,0); a.fSectorPrevNeighbour = arbb::gather(fSectorPrevNeighbour, index,0); a.fSectorNextNeighbour = arbb::gather(fSectorNextNeighbour, index,0); #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE a.orig_track_id = arbb::gather(orig_track_id, index,0); #endif // DO_TPCCATRACKER_EFF_PERFORMANCE } }; public: AliHLTTPCCAFitter(); ~AliHLTTPCCAFitter(); void SetSectorParam( const AliHLTTPCCAParamArBB &p ) { fSectorParamArBB = p; } void SetSectorAlpha( const dense &d ) { fSectorAlpha = d; } void GetTrackInnerParam(AliHLTTPCCATrackParamArBB &p) { p = fTrInfo.fInnerParam; } f32 cBz() { return fSectorParamArBB.cBz(); } void ReadData(fstream &InputTraks, const int &NTracks, const int &NClusters); void FitTrack( bool dir = 0 ); i32 NTracks() { return fTrInfo.fInnerParam.ArraySize;} #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE dense GetTrackID() { return fTrInfo.orig_track_id; } #endif // DO_TPCCATRACKER_EFF_PERFORMANCE private: static void FitTrackArBB(boolean Dir, ClusterInfoArBB &Clusters, AliHLTTPCCATrackParamArBB &Param, dense &Alpha, TrackInfoArBB &TrInfo, const dense SectorAlpha, AliHLTTPCCAParamArBB &SectorParam, dense &ok, dense &ClusterMask, boolean &Refit); static void FitArBB(boolean Dir, ClusterInfoArBB &Clusters, TrackInfoArBB &TrInfo, dense SectorAlpha, AliHLTTPCCAParamArBB &SectorParam); AliHLTTPCCAFitter( const AliHLTTPCCAFitter& ); const AliHLTTPCCAFitter &operator=( const AliHLTTPCCAFitter& ) const; static const int fgkNSectors = AliHLTTPCCAParameters::NumberOfSectors; // Number of TPC sectors dense fSectorAlpha; // Array of the rotation angle of the coordinate system for all sectors AliHLTTPCCAParamArBB fSectorParamArBB; // Sector parameters (geometry, calibration for error calculation, magnetic field, etc.) ClusterInfoArBB fClusters; // Array of clusters TrackInfoArBB fTrInfo; // Array of tarcks }; #endif