diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index 6cdd33f5f289dc7d0276a884a732f3a7181a949e..c0a377eecda68cc82d2429550b86d608b3486b70 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -13,7 +13,7 @@ L1Algo::L1Algo() { for (unsigned int i = 0; i < constants::size::MaxNstations; i++) { - vGridTime[i].AllocateMemory(); + vGrid[i].AllocateMemory(); fTriplets[i].SetName(std::stringstream() << "L1Algo::fTriplets[" << i << "]"); } } diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 614b2af5f17f42acb0d24377ea8cafa57e3b5132..fa9a9779043355ac1ed7206268534d28db4f39c1 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -293,7 +293,6 @@ public: Vector<L1HitTimeInfo> fHitTimeInfo; L1Grid vGrid[constants::size::MaxNstations]; ///< - L1Grid vGridTime[constants::size::MaxNstations]; ///< fscal fMaxRangeX[constants::size::MaxNstations]; fscal fMaxRangeY[constants::size::MaxNstations]; diff --git a/reco/L1/L1Algo/L1BranchExtender.cxx b/reco/L1/L1Algo/L1BranchExtender.cxx index c23088c3e682f6d74e33e4ced93e4c944ab596df..a201d12c4237f672fba72838a4f4a7c874ee7577 100644 --- a/reco/L1/L1Algo/L1BranchExtender.cxx +++ b/reco/L1/L1Algo/L1BranchExtender.cxx @@ -99,8 +99,8 @@ void L1Algo::BranchFitterFast(const L1Branch& t, TrackParamV& Tout, const bool u fld.Set(fldB2, fldZ2, fldB1, fldZ1, fldB0, fldZ0); for (int i = iFirstHit + step; step * i <= step * iLastHit; i += step) { - const ca::Hit& hit = fInputData.GetHit(hits[i]); - int ista = hit.iSt; + const ca::Hit& hit = fInputData.GetHit(hits[i]); + int ista = hit.iSt; const ca::Station& sta = fParameters.GetStation(ista); fit.Extrapolate(hit.z, fld); @@ -202,10 +202,9 @@ void L1Algo::FindMoreHits(L1Branch& t, TrackParamV& Tout, const bool upstream, c const fscal iz = 1.f / (tr.Z()[0] - fParameters.GetTargetPositionZ()[0]); - L1HitAreaTime area(vGridTime[ista], tr.X()[0] * iz, tr.Y()[0] * iz, - (sqrt(fPickGather * tr.C00()) + fMaxRangeX[ista] + fMaxDZ * abs(tr.Tx()))[0] * iz, - (sqrt(fPickGather * tr.C11()) + fMaxRangeY[ista] + fMaxDZ * abs(tr.Ty()))[0] * iz, tr.Time()[0], - sqrt(tr.C55()[0])); + L1HitArea area(vGrid[ista], tr.X()[0] * iz, tr.Y()[0] * iz, + (sqrt(fPickGather * tr.C00()) + fMaxRangeX[ista] + fMaxDZ * abs(tr.Tx()))[0] * iz, + (sqrt(fPickGather * tr.C11()) + fMaxRangeY[ista] + fMaxDZ * abs(tr.Ty()))[0] * iz); for (ca::HitIndex_t ih = -1; true;) { // loop over the hits in the area diff --git a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx index e3cf3b34c611203ba47b3099ff0f7ed3bdc74566..b98b6fd075ff57d0b49d48f03110777cde2d3812 100644 --- a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx +++ b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx @@ -241,9 +241,8 @@ void L1Algo::CaTrackFinderSlice() if (xStep > 0.3) xStep = 0.3; if (xStep < 0.01) xStep = 0.01; - vGridTime[iS].BuildBins(gridMinX, gridMaxX, gridMinY, gridMaxY, starttime, lasttime, xStep, yStep, - (lasttime - starttime + 1)); - vGridTime[iS].StoreHits(*this, iS, nGridHitsFilled); + vGrid[iS].BuildBins(gridMinX, gridMaxX, gridMinY, gridMaxY, xStep, yStep); + vGrid[iS].StoreHits(*this, iS, nGridHitsFilled); } fGridHits.reduce(nGridHitsFilled); @@ -377,8 +376,8 @@ void L1Algo::CaTrackFinderSlice() constructor3.GetTriplets().end()); const ca::HitIndex_t ihitl = ih + fGridHitStartIndex[istal]; - fHitFirstTriplet[ihitl] = PackTripletId(istal, oldSize); - fHitNtriplets[ihitl] = fTriplets[istal].size() - oldSize; + fHitFirstTriplet[ihitl] = PackTripletId(istal, oldSize); + fHitNtriplets[ihitl] = fTriplets[istal].size() - oldSize; } } // istal @@ -567,7 +566,7 @@ void L1Algo::CaTrackFinderSlice() for (int iHit = 0; iHit < (int) tr.fHits.size(); ++iHit) { const ca::Hit& h = fInputData.GetHit(tr.fHits[iHit]); - bool isAlive = true; + bool isAlive = true; { // front strip auto& stripF = (fStripToTrack)[h.f]; if ((stripF >= 0) && (stripF != tr.fID)) { // strip is used by other candidate @@ -609,7 +608,7 @@ void L1Algo::CaTrackFinderSlice() tr.fIsAlive = true; for (int iHit = 0; tr.fIsAlive && (iHit < (int) tr.fHits.size()); ++iHit) { const ca::Hit& h = fInputData.GetHit(tr.fHits[iHit]); - tr.fIsAlive = tr.fIsAlive && ((fStripToTrack)[h.f] == tr.fID) && ((fStripToTrack)[h.b] == tr.fID); + tr.fIsAlive = tr.fIsAlive && ((fStripToTrack)[h.f] == tr.fID) && ((fStripToTrack)[h.b] == tr.fID); } if (!tr.fIsAlive) { // release strips @@ -687,8 +686,8 @@ void L1Algo::CaTrackFinderSlice() int NHitsOnStation = 0; for (int ista = 0; ista < fParameters.GetNstationsActive(); ++ista) { - int start = fGridHitStartIndex[ista]; - int Nelements = fGridHitStopIndex[ista] - start; + int start = fGridHitStartIndex[ista]; + int Nelements = fGridHitStopIndex[ista] - start; ca::Hit* staHits = nullptr; // to avoid out-of-range error in ..[start] ca::HitIndex_t* staHitIndices = nullptr; ca::GridEntry* staHitPoints = nullptr; @@ -700,8 +699,8 @@ void L1Algo::CaTrackFinderSlice() int NHitsOnStationTmp = NHitsOnStation; - vGridTime[ista].UpdateIterGrid(Nelements, staHits, fGridHitIdsBuf, staHitIndices, fGridHitsBuf, fGridPointsBuf, - staHitPoints, NHitsOnStation, *this, fvHitKeyFlags); + vGrid[ista].UpdateIterGrid(Nelements, staHits, fGridHitIdsBuf, staHitIndices, fGridHitsBuf, fGridPointsBuf, + staHitPoints, NHitsOnStation, *this, fvHitKeyFlags); fGridHitStartIndex[ista] = NHitsOnStationTmp; fGridHitStopIndex[ista] = NHitsOnStation; diff --git a/reco/L1/L1Algo/L1Grid.cxx b/reco/L1/L1Algo/L1Grid.cxx index f46ac439d901f4687b12aa6c791711ece76f8dac..4f546ee1eb69f1bbbc853cd62d3c1a4295ce7135 100644 --- a/reco/L1/L1Algo/L1Grid.cxx +++ b/reco/L1/L1Algo/L1Grid.cxx @@ -58,7 +58,7 @@ void L1Grid::UpdateIterGrid(unsigned int Nelements, ca::Hit* hits, Vector<ca::Hi if (!(vSFlag[hit.f] || vSFlag[hit.b])) { std::tie(xs, ys) = Algo.GetHitCoorOnGrid(hit); - const ca::HitIndex_t& bin = GetBinBounded(xs, ys, hit.t); + const ca::HitIndex_t& bin = GetBinBounded(xs, ys); fHitsInBin[x] = fFirstHitInBin[bin + 1]; fFirstHitInBin[bin + 1]++; @@ -89,7 +89,7 @@ void L1Grid::UpdateIterGrid(unsigned int Nelements, ca::Hit* hits, Vector<ca::Hi std::tie(xs, ys) = Algo.GetHitCoorOnGrid(hit); - const ca::HitIndex_t& bin = GetBinBounded(xs, ys, hit.t); + const ca::HitIndex_t& bin = GetBinBounded(xs, ys); { @@ -115,24 +115,20 @@ void L1Grid::AllocateMemory() } -void L1Grid::BuildBins(float xMin, float xMax, float yMin, float yMax, float tMin, float tMax, float sx, float sy, - float st) +void L1Grid::BuildBins(float xMin, float xMax, float yMin, float yMax, float sx, float sy) { - fStepXInv = 1.f / sx; fStepYInv = 1.f / sy; - fStepTInv = 1.f / st; fXMinOverStep = xMin * fStepXInv; fYMinOverStep = yMin * fStepYInv; - fTMinOverStep = tMin * fStepTInv; fNx = (xMax * fStepXInv - fXMinOverStep + 1.f); fNy = (yMax * fStepYInv - fYMinOverStep + 1.f); - fNt = (tMax * fStepTInv - fTMinOverStep + 1.f); + // unsigned int Nold = fN; - fN = fNx * fNy * fNt; + fN = fNx * fNy; fBinInGrid = fN + 1; } @@ -150,7 +146,7 @@ void L1Grid::StoreHits(L1Algo& algo, int iS, ca::HitIndex_t& nGridHitsFilled) ca::HitIndex_t caHitId = algo.fSliceHitIds[iS][ih]; const ca::Hit& h = algo.GetInputData().GetHit(caHitId); auto [x, y] = algo.GetHitCoorOnGrid(h); - auto bin = GetBinBounded(x, y, h.t); + auto bin = GetBinBounded(x, y); fHitsInBin[ih] = fFirstHitInBin[bin + 1]; fFirstHitInBin[bin + 1]++; } @@ -176,7 +172,7 @@ void L1Grid::StoreHits(L1Algo& algo, int iS, ca::HitIndex_t& nGridHitsFilled) ca::HitIndex_t caHitId = algo.fSliceHitIds[iS][ih]; const ca::Hit& h = algo.GetInputData().GetHit(caHitId); auto [x, y] = algo.GetHitCoorOnGrid(h); - auto bin = GetBinBounded(x, y, h.t); + auto bin = GetBinBounded(x, y); { const ca::HitIndex_t& index1 = fFirstHitInBin[bin] + fHitsInBin[ih]; algo.fGridHits[nGridHitsFilled + index1] = h; diff --git a/reco/L1/L1Algo/L1Grid.h b/reco/L1/L1Algo/L1Grid.h index 3b6703f0f11552d9877da06584206b33920cbd98..5335d39ca3c7fa1c213a64b0893cb5af51155127 100644 --- a/reco/L1/L1Algo/L1Grid.h +++ b/reco/L1/L1Algo/L1Grid.h @@ -36,14 +36,14 @@ class L1Grid { public: L1Grid() = default; - L1Grid(const L1Grid& grid) : fN(grid.N()), fNx(grid.Nx()), fNy(grid.Ny()), fNt(grid.Nt()) {} + L1Grid(const L1Grid& grid) : fN(grid.N()), fNx(grid.Nx()), fNy(grid.Ny()) {} ~L1Grid() = default; void StoreHits(L1Algo& Algo, int iS, ca::HitIndex_t& nGridHitsFilled); void CreatePar0(float xMin, float xMax, float yMin, float yMax, float sx, float sy); - void BuildBins(float xMin, float xMax, float yMin, float yMax, float tMin, float tMax, float sx, float sy, float st); + void BuildBins(float xMin, float xMax, float yMin, float yMax, float sx, float sy); void AllocateMemory(); void Create(float xMin, float xMax, float yMin, float yMax, float sx, float sy); @@ -57,24 +57,11 @@ public: unsigned int GetBinBounded(const float& X, const float& Y) const; void GetBinBounded(const float& X, const float& Y, unsigned short& bX, unsigned short& bY) const; - - int GetBin(float X, float Y, float T) const; - - // static unsigned short GetBinBounded( const L1Grid *array, const unsigned short &indexes, const float &X, const float &Y ); - // static void GetBinBounded( const L1Grid *array, const unsigned short &indexes, const float &X, const float &Y, unsigned short *bX, unsigned short *bY ); - // static unsigned short Nx( const L1Grid *array, const unsigned short &indexes ) { return unsigned short( array, &L1Grid::fNx, indexes ); } - void GetBinBounds(unsigned int iBin, float& Xmin, float& Xmax, float& Ymin, float& Ymax) const; - unsigned int GetBinBounded(const float& X, const float& Y, const float& T) const; - void GetBinBounded(const float& X, const float& Y, const float& T, unsigned short& bX, unsigned short& bY, - unsigned short& bT) const; - void GetBinBounds(unsigned int iBin, float& Xmin, float& Xmax, float& Ymin, float& Ymax, float& Tmin, - float& Tmax) const; unsigned int N() const { return fN; } unsigned short Nx() const { return fNx; } unsigned short Ny() const { return fNy; } - unsigned short Nt() const { return fNt; } ca::HitIndex_t FirstHitInBin(unsigned int i) const { @@ -84,13 +71,6 @@ public: } - // inline void UpdateGrid (fscal x, fscal y) - // { - // // #pragma omp atomic - // fNumberHitsInBin[GetBinBounded(x, y)]++; - // - // }; - void UpdateIterGrid(unsigned int Nelements, ca::Hit* hits, Vector<ca::HitIndex_t>& indicesBuf, ca::HitIndex_t* indices, Vector<ca::Hit>& hitsBuf, Vector<ca::GridEntry>& entriesBuf, @@ -101,13 +81,10 @@ private: unsigned int fN {0}; //* total N bins unsigned short fNx {0}; //* N bins in X unsigned short fNy {0}; //* N bins in Y - unsigned short fNt {0}; //* N bins in T float fXMinOverStep {0.f}; //* minimal X value * fStepXInv float fYMinOverStep {0.f}; //* minimal Y value * fStepYInv - float fTMinOverStep {0.f}; //* minimal T value * fStepTInv float fStepXInv {0.f}; //* inverse bin size in X float fStepYInv {0.f}; //* inverse bin size in Y - float fStepTInv {0.f}; //* inverse bin size in T int fBinInGrid {0}; Vector<ca::HitIndex_t> fFirstHitInBin {"L1Grid::fFirstHitInBin"}; @@ -116,41 +93,7 @@ private: // vector <omp_lock_t> lock; }; -// inline unsigned short L1Grid::GetBinBounded( const L1Grid *array, const unsigned short &indexes, const float &X, const float &Y ) -// { - -// const float fYMinOverStep( array, &L1Grid::fYMinOverStep, indexes ); -// const float fStepYInv( array, &L1Grid::fStepYInv, indexes ); -// const unsigned short fNy( array, &L1Grid::fNy, indexes ); -// short_v yBin = ( Y * fStepYInv - fYMinOverStep ).staticCast<short_v>(); -// unsigned short yBin2 = CAMath::Max( short_v( Vc::Zero ), CAMath::Min( short_v( fNy - 1 ), yBin ) ).staticCast<unsigned short>(); - -// const float fXMinOverStep( array, &L1Grid::fXMinOverStep, indexes ); -// const float fStepXInv( array, &L1Grid::fStepXInv, indexes ); -// const unsigned short fNx( array, &L1Grid::fNx, indexes ); -// short_v xBin = ( X * fStepXInv - fXMinOverStep ).staticCast<short_v>(); -// unsigned short xBin2 = CAMath::Max( short_v( Vc::Zero ), CAMath::Min( short_v( fNx - 1 ), xBin ) ).staticCast<unsigned short>(); -// return yBin2 * fNx + xBin2; -// } - -// inline void L1Grid::GetBinBounded( const L1Grid *array, const unsigned short &indexes, const float &X, const float &Y, unsigned short *bX, unsigned short *bY ) -// { -// const float fXMinOverStep( array, &L1Grid::fXMinOverStep, indexes ); -// const float fStepXInv( array, &L1Grid::fStepXInv, indexes ); -// const unsigned short fNx( array, &L1Grid::fNx, indexes ); -// const short fNx2 = fNx.staticCast<short_v>(); -// const short &xBin = static_cast<short>( X * fStepXInv - fXMinOverStep ); -// *bX = static_cast<unsigned short>(max( 0, min( fNx2 - 1, xBin ) )); - -// const float fYMinOverStep( array, &L1Grid::fYMinOverStep, indexes ); -// const float fStepYInv( array, &L1Grid::fStepYInv, indexes ); -// const unsigned short fNy( array, &L1Grid::fNy, indexes ); -// const short_v fNy2 = fNy.staticCast<short_v>(); -// const short_v &yBin = ( Y * fStepYInv - fYMinOverStep ).staticCast<short_v>(); -// *bY = CAMath::Max( short_v( Vc::Zero ), CAMath::Min( fNy2 - 1, yBin ) ).staticCast<unsigned short>(); - - -// } + inline int L1Grid::GetBin(float X, float Y) const { //* get the bin pointer @@ -164,22 +107,6 @@ inline int L1Grid::GetBin(float X, float Y) const return bin; } -inline int L1Grid::GetBin(float X, float Y, float T) const -{ - //* get the bin pointer - const int& xBin = static_cast<int>(X * fStepXInv - fXMinOverStep); - const int& yBin = static_cast<int>(Y * fStepYInv - fYMinOverStep); - const int& tBin = static_cast<int>(T * fStepTInv - fTMinOverStep); - assert(xBin >= 0); - assert(yBin >= 0); - assert(tBin >= 0); - assert(xBin < static_cast<int>(fNx)); - assert(yBin < static_cast<int>(fNy)); - assert(tBin < static_cast<int>(fNt)); - const int& bin = yBin * fNx + xBin + tBin * (fNx * fNy); - return bin; -} - inline void L1Grid::GetBinBounds(unsigned int iBin, float& Xmin, float& Xmax, float& Ymin, float& Ymax) const { @@ -191,20 +118,6 @@ inline void L1Grid::GetBinBounds(unsigned int iBin, float& Xmin, float& Xmax, fl Ymax = Ymin + 1. / fStepYInv; } -inline void L1Grid::GetBinBounds(unsigned int iBin, float& Xmin, float& Xmax, float& Ymin, float& Ymax, float& Tmin, - float& Tmax) const -{ - int yBin = (iBin % (fNx * fNy)) / fNx; - int xBin = (iBin % (fNx * fNy)) % fNx; - int tBin = (iBin / (fNx * fNy)); - Xmin = (fXMinOverStep + xBin) / fStepXInv; - Ymin = (fYMinOverStep + yBin) / fStepYInv; - Tmin = (fTMinOverStep + tBin) / fStepTInv; - Xmax = Xmin + 1. / fStepXInv; - Ymax = Ymin + 1. / fStepYInv; - Tmax = Tmin + 1. / fStepTInv; -} - inline unsigned int L1Grid::GetBinBounded(const float& X, const float& Y) const { @@ -215,15 +128,6 @@ inline unsigned int L1Grid::GetBinBounded(const float& X, const float& Y) const return (unsigned int) yBin * (unsigned int) fNx + (unsigned int) xBin; } -inline unsigned int L1Grid::GetBinBounded(const float& X, const float& Y, const float& T) const -{ - //* get the bin pointer at - - unsigned short xBin, yBin, tBin; - GetBinBounded(X, Y, T, xBin, yBin, tBin); - return (unsigned int) yBin * (unsigned int) fNx + (unsigned int) xBin - + tBin * ((unsigned int) fNx * (unsigned int) fNy); -} inline void L1Grid::GetBinBounded(const float& X, const float& Y, unsigned short& bX, unsigned short& bY) const { @@ -234,22 +138,5 @@ inline void L1Grid::GetBinBounded(const float& X, const float& Y, unsigned short bY = std::max(short(0), std::min(short(fNy - 1), yBin)); } -inline void L1Grid::GetBinBounded(const float& X, const float& Y, const float& T, unsigned short& bX, - unsigned short& bY, unsigned short& bT) const -{ - const short& xBin = (X * fStepXInv - fXMinOverStep); - const short& yBin = (Y * fStepYInv - fYMinOverStep); - const short& tBin = (T * fStepTInv - fTMinOverStep); - - - // cout<<fStepTInv<<" fStepTInv "<<fTMinOverStep<<" fTMinOverStep "<<T<<" T "<<endl; - - bX = std::max(short(0), std::min(short(fNx - 1), xBin)); - bY = std::max(short(0), std::min(short(fNy - 1), yBin)); - bT = std::max(short(0), std::min(short(fNt - 1), tBin)); - - // cout<<(fNt - 1)<<" (fNt - 1) "<<tBin<<" tBin "<<bT<<" bT "<<endl; -} - #endif diff --git a/reco/L1/L1Algo/L1HitArea.h b/reco/L1/L1Algo/L1HitArea.h index 80720a621a6aa707460c54de2993cfb557d7ec9f..bddd6868128c509e9055b4ca7c97e1fd70c0077c 100644 --- a/reco/L1/L1Algo/L1HitArea.h +++ b/reco/L1/L1Algo/L1HitArea.h @@ -101,135 +101,4 @@ inline bool L1HitArea::GetNext(ca::HitIndex_t& i) return !xIndexOutOfRange; } -class L1HitAreaTime { -public: - L1HitAreaTime(const L1Grid& grid, float x, float y, float dx, float dy, float t, float dt); - - /** - * look up the next hit in the requested area. - * Sets h to the coordinates and returns the index for the hit data - */ - bool GetNext(ca::HitIndex_t& i); - -protected: - const L1Grid& fGrid; - - unsigned short fBYmax; // maximal Y bin index - unsigned short fBDX; // X distance of bin indexes - unsigned int fIndXmin; // minimum index for - unsigned short fIy; // current Y bin index (incremented while iterating) - ca::HitIndex_t fHitXlst; // last possible hit index in current y-line - ca::HitIndex_t fIh; // hit index iterating inside the bins - int fNx; // Number of bins in X direction - int fNy; - - unsigned short fBTmax; // maximal Y bin index - unsigned short fIt; // current Y bin index (incremented while iterating) - - unsigned short fBYmin; - unsigned short fBXmin; - - - unsigned int fIndYmin; // minimum index for -}; - -inline L1HitAreaTime::L1HitAreaTime(const L1Grid& grid, float x, float y, float dx, float dy, float t, float dt) - : fGrid(grid) - , fBYmax(0) - , fBDX(0) - , fIndXmin(0) - , fIy(0) - , fHitXlst(0) - , fIh(0) - , fNx(fGrid.Nx()) - , fNy(fGrid.Ny()) - , fBTmax(0) - , fIt(0) - , fBYmin(0) - , fBXmin(0) - , fIndYmin(0) -{ - const float minX = x - dx; - const float maxX = x + dx; - const float minY = y - dy; - const float maxY = y + dy; - const float minT = t - dt; - - - const float maxT = t + dt; - - unsigned short bXmin, bYmin, bXmax, bTmin; // boundary bin indexes - fGrid.GetBinBounded(minX, minY, minT, bXmin, bYmin, bTmin); - fGrid.GetBinBounded(maxX, maxY, maxT, bXmax, fBYmax, fBTmax); - fBYmin = bYmin; - fBXmin = bXmin; - - - fBDX = (bXmax - bXmin + 1); // bin index span in x direction - - fIndXmin = (bTmin * fNx * fNy + bYmin * fNx + bXmin); - - //fGrid.GetBinBounds(fIndXmin, x, dx, y, dy, t, dt); - - fIy = bYmin; - - fIt = bTmin; - - fIh = fGrid.FirstHitInBin(fIndXmin); - - fHitXlst = fGrid.FirstHitInBin(fIndXmin + fBDX); -} - -inline bool L1HitAreaTime::GetNext(ca::HitIndex_t& i) -{ - bool xIndexOutOfRange = fIh >= fHitXlst; // current x is not in the area - bool nextYIndexOutOfRange = (fIy >= fBYmax); // there isn't any new y-line - bool nextTIndexOutOfRange = (fIt >= fBTmax); // there isn't any new y-line - - - if (xIndexOutOfRange && nextYIndexOutOfRange && nextTIndexOutOfRange) { // all iterators are over the end - return false; - } - - // at least one entry in the vector has (fIh >= fHitXlst && fIy < fBYmax) - bool needNextY = xIndexOutOfRange && !nextYIndexOutOfRange; - bool needNextT = xIndexOutOfRange && nextYIndexOutOfRange && !nextTIndexOutOfRange; - - - while (ISLIKELY((needNextY) || (needNextT))) { //ISLIKELY to speed the programm and optimise the use of registers - - if (needNextT) { - fIt++; - fIy = fBYmin; - - fIndXmin = (fIt * fNx * fNy + fBYmin * fNx + fBXmin); - fIh = fGrid.FirstHitInBin(fIndXmin); // get first hit in cell, if y-line is new - fHitXlst = fGrid.FirstHitInBin(fIndXmin + fBDX); - } - else { - - fIy++; // get new y-line - // get next hit - fIndXmin += fNx; - fIh = fGrid.FirstHitInBin(fIndXmin); // get first hit in cell, if y-line is new - - fHitXlst = fGrid.FirstHitInBin(fIndXmin + fBDX); - } - - xIndexOutOfRange = fIh >= fHitXlst; - nextYIndexOutOfRange = (fIy >= fBYmax); - needNextY = xIndexOutOfRange && !nextYIndexOutOfRange; - - nextTIndexOutOfRange = (fIt >= fBTmax); - needNextT = xIndexOutOfRange && nextYIndexOutOfRange && !nextTIndexOutOfRange; - } - - L1_ASSERT(fIh < fGrid.FirstHitInBin(fGrid.N() + 1) || xIndexOutOfRange, - fIh << " < " << fGrid.FirstHitInBin(fGrid.N() + 1) << " || " << xIndexOutOfRange); - i = fIh; // return - - fIh++; // go to next - return !xIndexOutOfRange; -} - #endif diff --git a/reco/L1/L1Algo/L1TripletConstructor.cxx b/reco/L1/L1Algo/L1TripletConstructor.cxx index f3ce47766fcf4794a243c53f25c92c25f12f0122..915e6707089400c0285f70005df535ab36ed3e02 100644 --- a/reco/L1/L1Algo/L1TripletConstructor.cxx +++ b/reco/L1/L1Algo/L1TripletConstructor.cxx @@ -206,7 +206,7 @@ void L1TripletConstructor::FitDoublets() for (unsigned int i2 = 0; i2 < hitsMtmp.size(); i2++) { - const ca::HitIndex_t imh = hitsMtmp[i2]; + const ca::HitIndex_t imh = hitsMtmp[i2]; const ca::GridEntry& hitm = fHitsM[imh]; if (hitm.IsSuppressed()) continue; @@ -347,7 +347,7 @@ void L1TripletConstructor::FindRightHit() } for (unsigned int ih = 0; ih < collectedHits.size(); ih++) { - ca::HitIndex_t irh = collectedHits[ih]; + ca::HitIndex_t irh = collectedHits[ih]; const ca::GridEntry& hitr = fHitsR[irh]; if (hitr.IsSuppressed()) continue; @@ -421,14 +421,14 @@ void L1TripletConstructor::FitTriplets() for (int ih = 0; ih < NHits; ++ih) { const ca::Hit& hit = fAlgo->fInputData.GetHit(ihit[ih]); - x[ih] = hit.x; - y[ih] = hit.y; - z[ih] = hit.z; - t[ih] = hit.t; - cov[ih].C00 = hit.dx2; - cov[ih].C10 = hit.dxy; - cov[ih].C11 = hit.dy2; - dt2[ih] = hit.dt2; + x[ih] = hit.x; + y[ih] = hit.y; + z[ih] = hit.z; + t[ih] = hit.t; + cov[ih].C00 = hit.dx2; + cov[ih].C10 = hit.dxy; + cov[ih].C11 = hit.dy2; + dt2[ih] = hit.dt2; }; // find the field along the track @@ -629,16 +629,15 @@ void L1TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, co const fscal timeError2 = T.C55()[0]; const fscal time = T.Time()[0]; - L1HitAreaTime areaTime(fAlgo->vGridTime[iSta], T.X()[0] * iz, T.Y()[0] * iz, - (sqrt(Pick_m22 * T.C00()) + fAlgo->fMaxRangeX[iSta] + fAlgo->fMaxDZ * abs(T.Tx()))[0] * iz, - (sqrt(Pick_m22 * T.C11()) + fAlgo->fMaxRangeY[iSta] + fAlgo->fMaxDZ * abs(T.Ty()))[0] * iz, - time, sqrt(timeError2) * 5 + fAlgo->fMaxRangeT[iSta]); + L1HitArea area(fAlgo->vGrid[iSta], T.X()[0] * iz, T.Y()[0] * iz, + (sqrt(Pick_m22 * T.C00()) + fAlgo->fMaxRangeX[iSta] + fAlgo->fMaxDZ * abs(T.Tx()))[0] * iz, + (sqrt(Pick_m22 * T.C11()) + fAlgo->fMaxRangeY[iSta] + fAlgo->fMaxDZ * abs(T.Ty()))[0] * iz); for (ca::HitIndex_t ih = 0; (ih < nHits) && ((int) collectedHits.size() < maxNhits); ih++) { // loop over all station hits if (!fAlgo->fParameters.DevIsIgnoreHitSearchAreas()) { // only loop over the hits in the area - if (!areaTime.GetNext(ih)) { break; } + if (!area.GetNext(ih)) { break; } } const ca::GridEntry& hit = hits[ih];