//-*- Mode: C++ -*- // @(#) $Id: AliHLTTPCCAHitArea.h,v 1.1.1.1 2010/07/26 20:55:38 ikulakov Exp $ // ************************************************************************ // 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 ALIHLTTPCCAHITAREA_H #define ALIHLTTPCCAHITAREA_H #include "AliHLTTPCCADef.h" #include "AliHLTVector.h" #include "AliHLTArray.h" struct AliHLTTPCCAGrid; class AliHLTTPCCARow; class AliHLTTPCCASliceData; /** * @class ALIHLTTPCCAHitArea * * This class is used to _iterate_ over the hit data via GetNext */ // class AliHLTTPCCAHitArea // { // public: // struct NeighbourData // { // short_m fValid; // short_v fLinks; // sfloat_v fY, fZ; // }; // AliHLTTPCCAHitArea( const AliHLTTPCCARow &row, const AliHLTTPCCASliceData &slice, const sfloat_v &y, const sfloat_v &z, float dy, float dz, short_m mask ); // /** // * look up the next hit in the requested area. // * Sets h to the coordinates and returns the index for the hit data // */ // ushort_m GetNext( NeighbourData *data ); // protected: // const AliHLTTPCCARow &fRow; // const AliHLTTPCCASliceData &fSlice; // ushort_v fBZmax; // maximal Z bin index // ushort_v fBDY; // Y distance of bin indexes // ushort_v fIndYmin; // minimum index for // ushort_v fIz; // current Z bin index (incremented while iterating) // ushort_v fHitYlst; // // ushort_v fIh; // hit index iterating inside the bins // int fNy; // Number of bins in Y direction // }; // area which doesn't use the Grid class AliHLTTPCCAHitArea { public: struct NeighbourData { short_m fValid; short_v fLinks; sfloat_v fY, fZ; }; AliHLTTPCCAHitArea( const AliHLTTPCCARow &row, const AliHLTTPCCASliceData &slice, const sfloat_v &y, const sfloat_v &z, float dy, float dz, short_m mask ); ushort_m GetNext( NeighbourData *data ); protected: sfloat_m IsInRange(sfloat_v& y, sfloat_v& z) { return ( y >= fMinY ) && ( y < fMaxY ) && ( z >= fMinZ ) && ( z < fMaxZ ); }; const AliHLTTPCCARow &fRow; const AliHLTTPCCASliceData &fSlice; sfloat_v fMinY, fMaxY, fMinZ, fMaxZ; short_v fCurHitI; // current hit index NeighbourData fCurHitData; }; typedef AliHLTTPCCAHitArea HitArea; // #include // static inline std::ostream &operator<<( std::ostream &out, const HitArea::NeighbourData &n ) // { // return out << n.fValid << " " << n.fLinks << " " << n.fY << " " << n.fZ << std::endl; // } // -- ArBB TODO find right place #include using arbb::dense; using arbb::f32; using arbb::i16; //using arbb::boolean; using arbb::fill; class AliHLTTPCCARow_ArBB; #include "AliHLTTPCCARow.h" class AliHLTTPCCAHitArea_ArBB { public: class NeighbourData { public: NeighbourData(): y(-10000),z(-10000),links(-1),valid(false){}; NeighbourData( f32 y_, f32 z_, THitI_ArBB links_, arbb::boolean valid_ ): y(y_),z(z_),links(links_),valid(valid_){}; // new conteiter with accesors template class TDense; friend class TDense<1>; NeighbourData& operator-=(const NeighbourData& a){ y -= a.y; z -= a.z; // valid = valid && a.valid; return *this; } NeighbourData& operator*=(const f32& a){ y *= a; z *= a; // valid = valid && a.valid; return *this; } ARBB_ELTWISE_METHOD_0(f32, NeighbourData, ArtKey); private: f32 y, z; THitI_ArBB links; arbb::boolean valid; typedef f32 TArtKey; TArtKey ArtKey(); }; // struct NeighbourData // new conteiter with accesors ARBB_UDT_DENSE_4( NeighbourData, f32, Y, f32, Z, THitI_ArBB, Links, arbb::boolean, Valid ); //AliHLTTPCCAHitArea_ArBB(); AliHLTTPCCAHitArea_ArBB( const AliHLTTPCCARowHit::TDense<1>& row, const dense &y, const dense &z, f32 dy, f32 dz, const dense& mask );// dbg AliHLTTPCCAHitArea_ArBB::NeighbourData::TDense<1> GetNext(); protected: dense IsInRange(const dense& y, const dense& z) { return ( y >= fMinY ) && ( y < fMaxY ) && ( z >= fMinZ ) && ( z < fMaxZ ); }; dense IsInRange(const NeighbourData::TDense<1>& nd) { const dense y = nd.Y(); const dense z = nd.Z(); return IsInRange(y, z); }; const AliHLTTPCCARowHit::TDense<1>& fRow; dense fMinY, fMaxY, fMinZ, fMaxZ; dense fCurHitI; // current hit index NeighbourData::TDense<1> fCurHitData; }; inline AliHLTTPCCAHitArea_ArBB::NeighbourData operator-(const AliHLTTPCCAHitArea_ArBB::NeighbourData& a, const AliHLTTPCCAHitArea_ArBB::NeighbourData& b) { return AliHLTTPCCAHitArea_ArBB::NeighbourData(a) -= b; } #ifdef _MSC_VER ARBB_ELTWISE_FUNCTION_2(AliHLTTPCCAHitArea_ArBB::NeighbourData, (operator-), const AliHLTTPCCAHitArea_ArBB::NeighbourData&, const AliHLTTPCCAHitArea_ArBB::NeighbourData&) #else ARBB_ELTWISE_FUNCTION_2(AliHLTTPCCAHitArea_ArBB::NeighbourData, operator-, const AliHLTTPCCAHitArea_ArBB::NeighbourData&, const AliHLTTPCCAHitArea_ArBB::NeighbourData&) #endif inline AliHLTTPCCAHitArea_ArBB::NeighbourData operator*(const AliHLTTPCCAHitArea_ArBB::NeighbourData& a, const f32& b) { return AliHLTTPCCAHitArea_ArBB::NeighbourData(a) *= b; } ARBB_ELTWISE_FUNCTION_2(AliHLTTPCCAHitArea_ArBB::NeighbourData, operator*, const AliHLTTPCCAHitArea_ArBB::NeighbourData&, const f32&) inline AliHLTTPCCAHitArea_ArBB::NeighbourData operator*(const f32& a, const AliHLTTPCCAHitArea_ArBB::NeighbourData& b) { return AliHLTTPCCAHitArea_ArBB::NeighbourData(b) *= a; } ARBB_ELTWISE_FUNCTION_2(AliHLTTPCCAHitArea_ArBB::NeighbourData, operator*, const f32&, const AliHLTTPCCAHitArea_ArBB::NeighbourData&) #endif