diff --git a/algo/ca/core/CMakeLists.txt b/algo/ca/core/CMakeLists.txt index 75e67fb76bf1d56f0b1bc3a91ccac030992386c2..83170ef902fca88d0e4f205cbab2aca9de3a9868 100644 --- a/algo/ca/core/CMakeLists.txt +++ b/algo/ca/core/CMakeLists.txt @@ -27,10 +27,9 @@ target_link_libraries(CaCore Boost::filesystem Boost::headers OnlineDataLog -# external::yaml-cpp # not needed external::fles_logging external::fles_ipc - external::fles_monitoring +# external::fles_monitoring # in test ) install(TARGETS CaCore DESTINATION lib) @@ -42,6 +41,7 @@ install( FILES data/CaTrackParam.h data/CaTrack.h + data/CaHit.h pars/CaConstants.h utils/CaSimd.h utils/CaSimdVc.h diff --git a/algo/ca/core/data/CaHit.h b/algo/ca/core/data/CaHit.h new file mode 100644 index 0000000000000000000000000000000000000000..bd6a44cae062aef23d49657171001e3ba8c031d2 --- /dev/null +++ b/algo/ca/core/data/CaHit.h @@ -0,0 +1,73 @@ +/* Copyright (C) 2007-2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Valentina Akishina, Igor Kulakov, Sergey Gorbunov [committer], Maksym Zyzak */ + +/// \file CaHit.h +/// \brief ca::Hit class describes a generic hit for the CA tracker +/// \date 2007-2023 + +#ifndef CaHit_h +#define CaHit_h 1 + +#include <boost/serialization/access.hpp> + +#include "CaSimd.h" + +namespace cbm::algo::ca +{ + using HitIndex_t = unsigned int; ///< Index of ca::Hit + using StripIndex_t = unsigned int; ///< Index of the station strip + + + /// \brief ca::Hit class describes a generic hit for the CA tracker + /// + struct Hit { + friend class boost::serialization::access; + + /// NOTE: For STS f and b correspond to the indexes of the front and back clusters of the hit in a dataset. For other + /// tracking detectors (MVD, MuCh, TRD, TOF) f == b and corresponds to the index of the hit. Indexes f and b + /// do not intersect between different detector stations. + StripIndex_t f {0}; ///< front hit key index + StripIndex_t b {0}; ///< back hit key index + + fscal x {0.}; ///< measured X coordinate [cm] + fscal y {0.}; ///< measured Y coordinate [cm] + fscal z {0.}; ///< fixed Z coordinate [cm] + fscal t {0.}; ///< measured time [ns] + fscal dx2 {0.}; ///< rms^2 of uncertainty of X coordinate [cm] + fscal dy2 {0.}; ///< rms^2 of uncertainty of Y coordinate [cm] + fscal dxy {0.}; ///< X/Y covariance [cm2] + fscal dt2 {0.}; ///< measured uncertainty of time [ns] + fscal rangeX {0.}; ///< +/- range of uncertainty of X coordinate [cm] + fscal rangeY {0.}; ///< +/- range of uncertainty of Y coordinate [cm] + fscal rangeT {0.}; ///< +/- range of uncertainty of time [ns] + + HitIndex_t Id {0}; ///< id of the hit + int iSt {-1}; ///< index of station in the active stations array + + private: + /// Serialization method, used to save ca::Hit objects into binary or text file in a defined order + template<class Archive> + void serialize(Archive& ar, const unsigned int /*version*/) + { + ar& f; + ar& b; + ar& x; + ar& y; + ar& z; + ar& t; + ar& dx2; + ar& dxy; + ar& dy2; + ar& dt2; + ar& rangeX; + ar& rangeY; + ar& rangeT; + ar& Id; + ar& iSt; + } + }; + +} // namespace cbm::algo::ca + +#endif diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index f0856280793041ed02048396127920f528c8e38d..b72aa3c63ee12045d2f0c8bc9804f59f038644c5 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -202,7 +202,6 @@ install(FILES CbmL1Counters.h L1Algo/L1EventEfficiencies.h L1Algo/L1Branch.h L1Algo/L1HitPoint.h - L1Algo/L1Hit.h L1Algo/L1Triplet.h L1Algo/L1Event.h L1Algo/L1EventMatch.h @@ -220,7 +219,6 @@ install(FILES CbmL1Counters.h install(FILES L1Algo/L1Algo.h L1Algo/L1Branch.h L1Algo/L1Field.h - L1Algo/L1Hit.h L1Algo/L1EArray.h DESTINATION include/L1Algo ) diff --git a/reco/L1/CbmCaTimeSliceReader.cxx b/reco/L1/CbmCaTimeSliceReader.cxx index 9a2cd9e21dfd99de97050da98bc4183dd68e3536..2a2bc919d1b813e0f75e6ff9c66f3d3ba2f157ab 100644 --- a/reco/L1/CbmCaTimeSliceReader.cxx +++ b/reco/L1/CbmCaTimeSliceReader.cxx @@ -395,7 +395,7 @@ void TimeSliceReader::StoreHitRecord(const HitRecord& hitRecord) { // Save the algo hit if (fpIODataManager.get()) { - L1Hit aHit; + ca::Hit aHit; aHit.f = hitRecord.fStripF; aHit.b = hitRecord.fStripB; aHit.x = hitRecord.fX; @@ -411,7 +411,7 @@ void TimeSliceReader::StoreHitRecord(const HitRecord& hitRecord) aHit.rangeY = hitRecord.fRangeY; aHit.rangeT = hitRecord.fRangeT; - aHit.ID = static_cast<int>(fpIODataManager->GetNofHits()); + aHit.Id = static_cast<int>(fpIODataManager->GetNofHits()); aHit.iSt = hitRecord.fStaId; fpIODataManager->PushBackHit(aHit, hitRecord.fDataStream); } diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index dfd4108e7c2a9e315a192072d6a45fd564120b0c..c9e50cf9b70b52b99d149efc8fcdce5d72744a3c 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -64,11 +64,11 @@ #include <iostream> #include <list> +#include "CaHit.h" #include "L1Algo/L1Algo.h" #include "L1Algo/L1Assert.h" #include "L1Algo/L1Branch.h" #include "L1Algo/L1Field.h" -#include "L1Algo/L1Hit.h" #include "L1Event.h" using std::cout; @@ -732,8 +732,8 @@ void CbmL1::Reconstruct(CbmEvent* event) // Material monitoring: mark active areas { - for (L1HitIndex_t i = 0; i < fpAlgo->GetInputData().GetNhits(); i++) { - const L1Hit& h = fpAlgo->GetInputData().GetHit(i); + for (ca::HitIndex_t i = 0; i < fpAlgo->GetInputData().GetNhits(); i++) { + const ca::Hit& h = fpAlgo->GetInputData().GetHit(i); fMaterialMonitor[h.iSt].MarkActiveBin(h.x, h.y); } } @@ -778,7 +778,7 @@ void CbmL1::Reconstruct(CbmEvent* event) for (int i = 0; i < it->fNofHits; i++) { int caHitId = fpAlgo->fRecoHits[trackFirstHit + i]; - int cbmHitID = fpAlgo->GetInputData().GetHit(caHitId).ID; + int cbmHitID = fpAlgo->GetInputData().GetHit(caHitId).Id; t.Hits.push_back(cbmHitID); } fvRecoTracks.push_back(t); diff --git a/reco/L1/CbmL1Hit.h b/reco/L1/CbmL1Hit.h index 5b3db374ae5b3fb381f8e3ae0eb57be3a0bcf6db..71a993e2eecb80346f085fa494edc75484bfaf8f 100644 --- a/reco/L1/CbmL1Hit.h +++ b/reco/L1/CbmL1Hit.h @@ -48,7 +48,7 @@ public: /// /// a helper class for performance evaluation that contains useful info about cbm hits with hit-mcpoint match information /// -class CbmL1HitDebugInfo { // TODO: SZh 21.09.2022: Replace instances of this class with L1Hit +class CbmL1HitDebugInfo { // TODO: SZh 21.09.2022: Replace instances of this class with ca::Hit public: /// @brief Gets detector type /// 0 - MVD diff --git a/reco/L1/CbmL1MCTrack.cxx b/reco/L1/CbmL1MCTrack.cxx index 689589533590c5246683b68c7e3258528fff8890..0b19922af3c269ad8ecbeae71fda200a81762c33 100644 --- a/reco/L1/CbmL1MCTrack.cxx +++ b/reco/L1/CbmL1MCTrack.cxx @@ -27,8 +27,8 @@ #include <sstream> #include "CaConstants.h" +#include "CaHit.h" #include "L1Algo/L1Algo.h" -#include "L1Algo/L1Hit.h" using cbm::algo::ca::constants::size::MaxNstations; diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 831438335a13c0f354f58cdbe5bc25633f39b1bb..016f136db6e1e30534efe60fa1efc538c827c9f8 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -336,7 +336,7 @@ void CbmL1::EfficienciesPerformance() cout << " n mc stations: " << t.NMCStations() << endl; } for (unsigned int i = 0; i < rtraIt->Hits.size(); i++) { - const L1Hit& h = fpAlgo->fInputData.GetHit(rtraIt->Hits[i]); + const ca::Hit& h = fpAlgo->fInputData.GetHit(rtraIt->Hits[i]); const CbmL1HitDebugInfo& s = fvHitDebugInfo[rtraIt->Hits[i]]; cout << " x y z t " << s.x << " " << s.y << " " << h.z << " dx " << s.dx << " dy " << s.dy << std::endl; cbm::ca::tools::Debugger::Instance().FillNtuple("ghost", statNghost, i, fabs(1. / tr.GetQp()[0]), s.x, s.y, h.z, diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index 89b62a5721bd1025f46ed07512fdc35a351b4044..e9f239417055b025d11c390e84e8ab33b5664409 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -746,7 +746,7 @@ void CbmL1::ReadEvent(CbmEvent* event) assert(th.iStripF >= 0 || th.iStripF < NStrips); assert(th.iStripB >= 0 || th.iStripB < NStrips); - L1Hit h; + ca::Hit h; h.f = th.iStripF; h.b = th.iStripB; @@ -763,7 +763,7 @@ void CbmL1::ReadEvent(CbmEvent* event) h.rangeY = th.rangeY; h.rangeT = th.rangeT; - h.ID = iHit; + h.Id = iHit; h.iSt = th.iStation; // save hit diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index 719d258018854a53cfd93fad49c48eb111266ab1..ae6c81db779ed1b8ccbbb53b5b3c4710695d1b34 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -93,7 +93,7 @@ void L1Algo::ReceiveParameters(L1Parameters&& parameters) L1FieldRegion::ForceUseOfOriginalField(fParameters.DevIsUseOfOriginalField()); } -std::pair<fscal, fscal> L1Algo::GetHitCoorOnGrid(const L1Hit& h) +std::pair<fscal, fscal> L1Algo::GetHitCoorOnGrid(const ca::Hit& h) { float dx = h.x - fParameters.GetTargetPositionX()[0]; float dy = h.y - fParameters.GetTargetPositionY()[0]; diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index b59f088f3f9694d3d038046486db5fb02baf3cc7..f733cb4a745fc06cfa367362ff0a540bf76510b5 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -29,6 +29,7 @@ class L1AlgoDraw; #include <map> #include "CaConstants.h" +#include "CaHit.h" #include "CaTrack.h" #include "CaTrackParam.h" #include "CaVector.h" @@ -37,7 +38,6 @@ class L1AlgoDraw; #include "L1Field.h" #include "L1Fit.h" #include "L1Grid.h" -#include "L1Hit.h" #include "L1HitPoint.h" #include "L1InputData.h" #include "L1Parameters.h" @@ -61,7 +61,7 @@ namespace using L1StationsArray_t = std::array<L1Station, constants::size::MaxNstations>; using L1MaterialArray_t = std::array<L1Material, constants::size::MaxNstations>; -using Tindex = int; // TODO: Replace with L1HitIndex_t, if suitable +using Tindex = int; // TODO: Replace with ca::HitIndex_t, if suitable #ifdef PULLS #define TRIP_PERFORMANCE @@ -157,7 +157,7 @@ public: const L1InputData& GetInputData() const { return fInputData; } /// Hit coordinates on the grid - std::pair<fscal, fscal> GetHitCoorOnGrid(const L1Hit& h); + std::pair<fscal, fscal> GetHitCoorOnGrid(const ca::Hit& h); inline int PackIndex(const int& a, const int& b, const int& c); @@ -301,10 +301,10 @@ public: double fCaRecoTime {0.}; // time of the track finder + fitter Vector<Track> fRecoTracks {"L1Algo::fRecoTracks"}; ///< reconstructed tracks - Vector<L1HitIndex_t> fRecoHits {"L1Algo::fRecoHits"}; ///< packed hits of reconstructed tracks + Vector<ca::HitIndex_t> fRecoHits {"L1Algo::fRecoHits"}; ///< packed hits of reconstructed tracks Vector<Track> fSliceRecoTracks {"L1Algo::fSliceRecoTracks"}; ///< reconstructed tracks in sub-timeslice - Vector<L1HitIndex_t> fSliceRecoHits {"L1Algo::fSliceRecoHits"}; ///< packed hits of reconstructed tracks + Vector<ca::HitIndex_t> fSliceRecoHits {"L1Algo::fSliceRecoHits"}; ///< packed hits of reconstructed tracks /// Created triplets vs station index Vector<L1Triplet> fTriplets[constants::size::MaxNstations] {{"L1Algo::fTriplets"}}; @@ -314,19 +314,19 @@ public: Vector<L1Branch> fTrackCandidates {"L1Algo::fTrackCandidates"}; ///< indices of the sub-slice hits - Vector<L1HitIndex_t> fSliceHitIds[constants::size::MaxNstations] {"L1Algo::fSliceHitIds"}; + Vector<ca::HitIndex_t> fSliceHitIds[constants::size::MaxNstations] {"L1Algo::fSliceHitIds"}; - Vector<L1Hit> fGridHits {"L1Algo::fGridHits"}; ///< hits, ordered with respect to their grid bins - Vector<L1Hit> fGridHitsBuf {"L1Algo::fGridHitsBuf"}; ///< hits, ordered with respect to their grid bins + Vector<ca::Hit> fGridHits {"L1Algo::fGridHits"}; ///< hits, ordered with respect to their grid bins + Vector<ca::Hit> fGridHitsBuf {"L1Algo::fGridHitsBuf"}; ///< hits, ordered with respect to their grid bins - Vector<L1HitIndex_t> fGridHitIds {"L1Algo::fGridHitIds"}; ///< indices of grid hits: iGridHit -> iCaHit - Vector<L1HitIndex_t> fGridHitIdsBuf {"L1Algo::fGridHitIdsBuf"}; ///< buffer for a new fGridHitIds + Vector<ca::HitIndex_t> fGridHitIds {"L1Algo::fGridHitIds"}; ///< indices of grid hits: iGridHit -> iCaHit + Vector<ca::HitIndex_t> fGridHitIdsBuf {"L1Algo::fGridHitIdsBuf"}; ///< buffer for a new fGridHitIds Vector<L1HitPoint> fGridPoints {"L1Algo::fGridPoints"}; ///< grid points parallel to fGridHits Vector<L1HitPoint> fGridPointsBuf {"L1Algo::fGridPointsBuf"}; - L1HitIndex_t fGridHitStartIndex[constants::size::MaxNstations + 1] {0}; - L1HitIndex_t fGridHitStopIndex[constants::size::MaxNstations + 1] {0}; + ca::HitIndex_t fGridHitStartIndex[constants::size::MaxNstations + 1] {0}; + ca::HitIndex_t fGridHitStopIndex[constants::size::MaxNstations + 1] {0}; Vector<int> fStripToTrack {"L1Algo::fStripToTrack"}; // strip to track pointers diff --git a/reco/L1/L1Algo/L1Branch.h b/reco/L1/L1Algo/L1Branch.h index 477d1ded22cca47263eb0a90c6d974aaea920fc8..fa983e8e3d3cd27eca645af8b8b8ef6064dcb77a 100644 --- a/reco/L1/L1Algo/L1Branch.h +++ b/reco/L1/L1Algo/L1Branch.h @@ -8,13 +8,14 @@ #ifndef L1Branch_h #define L1Branch_h +#include "CaHit.h" #include "CaVector.h" #include "L1Def.h" -#include "L1Hit.h" namespace { using namespace cbm::algo::ca; // TMP!! + using namespace cbm::algo; // TMP!! } /// @@ -30,7 +31,7 @@ struct L1Branch { fscal chi2 {0.}; int fID {0}; bool fIsAlive {0}; - Vector<L1HitIndex_t> fHits {"L1Branch::fHits"}; + Vector<ca::HitIndex_t> fHits {"L1Branch::fHits"}; // static bool compareCand(const L1Branch *a, const L1Branch *b){ // diff --git a/reco/L1/L1Algo/L1BranchExtender.cxx b/reco/L1/L1Algo/L1BranchExtender.cxx index bcb0f4c0cd3c2168fb882f36fb36857ead647294..69dd750fcb86b29714848a7424d107298c3a77cb 100644 --- a/reco/L1/L1Algo/L1BranchExtender.cxx +++ b/reco/L1/L1Algo/L1BranchExtender.cxx @@ -34,16 +34,16 @@ void L1Algo::BranchFitterFast(const L1Branch& t, TrackParamV& Tout, const bool u TrackParamV& T = fit.Tr(); // get hits of current track - const Vector<L1HitIndex_t>& hits = t.fHits; // array of indeses of hits of current track + const Vector<ca::HitIndex_t>& hits = t.fHits; // array of indeses of hits of current track const int nHits = t.NHits; const signed short int step = -2 * static_cast<int>(upstream) + 1; // increment for station index const int iFirstHit = (upstream) ? nHits - 1 : 0; const int iLastHit = (upstream) ? 0 : nHits - 1; - const L1Hit& hit0 = fInputData.GetHit(hits[iFirstHit]); - const L1Hit& hit1 = fInputData.GetHit(hits[iFirstHit + step]); - const L1Hit& hit2 = fInputData.GetHit(hits[iFirstHit + 2 * step]); + const ca::Hit& hit0 = fInputData.GetHit(hits[iFirstHit]); + const ca::Hit& hit1 = fInputData.GetHit(hits[iFirstHit + step]); + const ca::Hit& hit2 = fInputData.GetHit(hits[iFirstHit + 2 * step]); int ista0 = hit0.iSt; int ista1 = hit1.iSt; @@ -100,7 +100,7 @@ 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 L1Hit& hit = fInputData.GetHit(hits[i]); + const ca::Hit& hit = fInputData.GetHit(hits[i]); int ista = hit.iSt; const L1Station& sta = fParameters.GetStation(ista); @@ -139,7 +139,7 @@ void L1Algo::BranchFitter(const L1Branch& t, TrackParamV& T, const bool upstream /// initialize - should be params ititialized. 1 - yes. void L1Algo::FindMoreHits(L1Branch& t, TrackParamV& Tout, const bool upstream, const fvec qp0) { - Vector<L1HitIndex_t> newHits {"L1TrackExtender::newHits"}; + Vector<ca::HitIndex_t> newHits {"L1TrackExtender::newHits"}; newHits.reserve(fParameters.GetNstationsActive()); L1Fit fit; @@ -152,9 +152,9 @@ void L1Algo::FindMoreHits(L1Branch& t, TrackParamV& Tout, const bool upstream, c const int iFirstHit = (upstream) ? 2 : t.NHits - 3; // int ista = fInputData.GetHit(t.Hits[iFirstHit]).iSt + 2 * step; // current station. set to the end of track - const L1Hit& hit0 = fInputData.GetHit(t.fHits[iFirstHit]); // optimize - const L1Hit& hit1 = fInputData.GetHit(t.fHits[iFirstHit + step]); - const L1Hit& hit2 = fInputData.GetHit(t.fHits[iFirstHit + 2 * step]); + const ca::Hit& hit0 = fInputData.GetHit(t.fHits[iFirstHit]); // optimize + const ca::Hit& hit1 = fInputData.GetHit(t.fHits[iFirstHit + step]); + const ca::Hit& hit2 = fInputData.GetHit(t.fHits[iFirstHit + 2 * step]); const int ista0 = hit0.iSt; const int ista1 = hit1.iSt; @@ -209,22 +209,22 @@ void L1Algo::FindMoreHits(L1Branch& t, TrackParamV& Tout, const bool upstream, c (sqrt(fPickGather * tr.C11()) + fMaxRangeY[ista] + fMaxDZ * abs(tr.Ty()))[0] * iz, tr.Time()[0], sqrt(tr.C55()[0])); - for (L1HitIndex_t ih = -1; true;) { // loop over the hits in the area + for (ca::HitIndex_t ih = -1; true;) { // loop over the hits in the area if (fParameters.DevIsIgnoreHitSearchAreas()) { ih++; - if ((L1HitIndex_t) ih >= (fGridHitStopIndex[ista] - fGridHitStartIndex[ista])) { break; } + if ((ca::HitIndex_t) ih >= (fGridHitStopIndex[ista] - fGridHitStartIndex[ista])) { break; } } else { if (!area.GetNext(ih)) { break; } } - L1HitIndex_t globalInd = fGridHitStartIndex[ista] + ih; + ca::HitIndex_t globalInd = fGridHitStartIndex[ista] + ih; const L1HitPoint& hitPoint = fGridPoints[globalInd]; if (hitPoint.IsSuppressed()) { continue; } - const L1Hit& hit = fGridHits[globalInd]; + const ca::Hit& hit = fGridHits[globalInd]; if (sta.timeInfo && tr.NdfTime()[0] > -2.) { fscal dt = hit.t - tr.Time()[0]; @@ -263,7 +263,7 @@ void L1Algo::FindMoreHits(L1Branch& t, TrackParamV& Tout, const bool upstream, c newHits.push_back(fGridHitIds[iHit_best]); - const L1Hit& hit = fGridHits[iHit_best]; + const ca::Hit& hit = fGridHits[iHit_best]; fit.Extrapolate(hit.z, fld); fit.FilterHit(sta, hit); diff --git a/reco/L1/L1Algo/L1CAIteration.h b/reco/L1/L1Algo/L1CAIteration.h index 6dd2ba872d071ef1396d50e6b68646cd079f2f0f..213c9d65ef7880e3992ffa0e4b15f095a4a1602a 100644 --- a/reco/L1/L1Algo/L1CAIteration.h +++ b/reco/L1/L1Algo/L1CAIteration.h @@ -254,7 +254,7 @@ private: /// sequence and this iteration should be the last in the tracking sequence. bool fIsTrackFromTriplets = false; - /// Serialization method, used to save L1Hit objects into binary or text file in a defined order + /// Serialization method, used to save ca::Hit objects into binary or text file in a defined order friend class boost::serialization::access; template<class Archive> void serialize(Archive& ar, const unsigned int /*version*/) diff --git a/reco/L1/L1Algo/L1CaTrackFinder.cxx b/reco/L1/L1Algo/L1CaTrackFinder.cxx index 97eb09b4640ef8ddf5bca03e74b00006754db6a0..19d81566bcc53e69171efbc7b0240663ad6258f4 100644 --- a/reco/L1/L1Algo/L1CaTrackFinder.cxx +++ b/reco/L1/L1Algo/L1CaTrackFinder.cxx @@ -74,8 +74,8 @@ void L1Algo::CaTrackFinder() for (int ih = 0; ih < nStreamHits; ++ih) { - L1HitIndex_t caHitId = fInputData.GetStreamStartIndex(iStream) + ih; - const L1Hit& h = fInputData.GetHit(caHitId); + ca::HitIndex_t caHitId = fInputData.GetStreamStartIndex(iStream) + ih; + const ca::Hit& h = fInputData.GetHit(caHitId); const L1Station& st = fParameters.GetStation(h.iSt); fscal dx = h.x - targX; @@ -111,7 +111,7 @@ void L1Algo::CaTrackFinder() // loop in the reverse order to fill L1HitTimeInfo::fMinTimeAfterHit fields for (int ih = nStreamHits - 1; ih >= 0; --ih) { - L1HitIndex_t caHitId = fInputData.GetStreamStartIndex(iStream) + ih; + ca::HitIndex_t caHitId = fInputData.GetStreamStartIndex(iStream) + ih; L1HitTimeInfo& info = fHitTimeInfo[caHitId]; if (minTimeAfterHit > info.fEventTimeMin) { minTimeAfterHit = info.fEventTimeMin; } info.fMinTimeAfterHit = minTimeAfterHit; @@ -123,7 +123,7 @@ void L1Algo::CaTrackFinder() bool areDataLeft = true; // is the whole TS processed int nSubSlices = 0; - L1HitIndex_t sliceFirstHit[nDataStreams]; + ca::HitIndex_t sliceFirstHit[nDataStreams]; for (int iStream = 0; iStream < nDataStreams; ++iStream) { sliceFirstHit[iStream] = fInputData.GetStreamStartIndex(iStream); @@ -144,9 +144,10 @@ void L1Algo::CaTrackFinder() for (int iStream = 0; iStream < nDataStreams; ++iStream) { - for (L1HitIndex_t caHitId = sliceFirstHit[iStream]; caHitId < fInputData.GetStreamStopIndex(iStream); ++caHitId) { + for (ca::HitIndex_t caHitId = sliceFirstHit[iStream]; caHitId < fInputData.GetStreamStopIndex(iStream); + ++caHitId) { L1HitTimeInfo& info = fHitTimeInfo[caHitId]; - const L1Hit& h = fInputData.GetHit(caHitId); + const ca::Hit& h = fInputData.GetHit(caHitId); if (fvHitKeyFlags[h.f] || fvHitKeyFlags[h.b]) { // the hit is already reconstructed continue; } diff --git a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx index 0b9eae26719188526d63a8f72552702f831f5c0a..db87816857c3ea3d261bf23cedbd797a15c8ffb1 100644 --- a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx +++ b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx @@ -181,7 +181,7 @@ void L1Algo::CaTrackFinderSlice() ResetSliceData(); - L1HitIndex_t nGridHitsFilled = 0; + ca::HitIndex_t nGridHitsFilled = 0; for (int iS = 0; iS < fParameters.GetNstationsActive(); ++iS) { fMaxRangeX[iS] = 0.; @@ -197,8 +197,8 @@ void L1Algo::CaTrackFinderSlice() fscal gridMinY = -0.1; fscal gridMaxY = 0.1; - for (L1HitIndex_t ih = 0; ih < fSliceHitIds[iS].size(); ++ih) { - const L1Hit& h = fInputData.GetHit(fSliceHitIds[iS][ih]); + for (ca::HitIndex_t ih = 0; ih < fSliceHitIds[iS].size(); ++ih) { + const ca::Hit& h = fInputData.GetHit(fSliceHitIds[iS][ih]); if (fMaxRangeX[iS] < h.rangeX) { fMaxRangeX[iS] = h.rangeX; } if (fMaxRangeY[iS] < h.rangeY) { fMaxRangeY[iS] = h.rangeY; } @@ -289,7 +289,7 @@ void L1Algo::CaTrackFinderSlice() } // TODO: Replace NStations with fInitManager.GetNstationsGeom() (S.Zharko) for (int ist = 0; ist < fParameters.GetNstationsActive(); ++ist) { - for (L1HitIndex_t ih = fGridHitStartIndex[ist]; ih < fGridHitStopIndex[ist]; ++ih) { + for (ca::HitIndex_t ih = fGridHitStartIndex[ist]; ih < fGridHitStopIndex[ist]; ++ih) { //SG!! fHitFirstTriplet[ih] = 0; fHitNtriplets[ih] = 0; @@ -376,7 +376,7 @@ void L1Algo::CaTrackFinderSlice() fTriplets[istal].insert(fTriplets[istal].end(), constructor3.GetTriplets().begin(), constructor3.GetTriplets().end()); - const L1HitIndex_t ihitl = ih + fGridHitStartIndex[istal]; + const ca::HitIndex_t ihitl = ih + fGridHitStartIndex[istal]; fHitFirstTriplet[ihitl] = PackTripletId(istal, oldSize); fHitNtriplets[ihitl] = fTriplets[istal].size() - oldSize; } @@ -566,7 +566,7 @@ void L1Algo::CaTrackFinderSlice() if (tr.fIsAlive) continue; for (int iHit = 0; iHit < (int) tr.fHits.size(); ++iHit) { - const L1Hit& h = fInputData.GetHit(tr.fHits[iHit]); + const ca::Hit& h = fInputData.GetHit(tr.fHits[iHit]); bool isAlive = true; { // front strip auto& stripF = (fStripToTrack)[h.f]; @@ -608,13 +608,13 @@ void L1Algo::CaTrackFinderSlice() tr.fIsAlive = true; for (int iHit = 0; tr.fIsAlive && (iHit < (int) tr.fHits.size()); ++iHit) { - const L1Hit& h = fInputData.GetHit(tr.fHits[iHit]); + const ca::Hit& h = fInputData.GetHit(tr.fHits[iHit]); tr.fIsAlive = tr.fIsAlive && ((fStripToTrack)[h.f] == tr.fID) && ((fStripToTrack)[h.b] == tr.fID); } if (!tr.fIsAlive) { // release strips for (int iHit = 0; (iHit < (int) tr.fHits.size()); ++iHit) { - const L1Hit& h = fInputData.GetHit(tr.fHits[iHit]); + const ca::Hit& h = fInputData.GetHit(tr.fHits[iHit]); if (fStripToTrack[h.f] == tr.fID) { fStripToTrack[h.f] = -1; } if (fStripToTrack[h.b] == tr.fID) { fStripToTrack[h.b] = -1; } } @@ -647,7 +647,7 @@ void L1Algo::CaTrackFinderSlice() } for (auto iHit : tr.fHits) { - const L1Hit& hit = fInputData.GetHit(iHit); + const ca::Hit& hit = fInputData.GetHit(iHit); /// used strips are marked @@ -674,10 +674,10 @@ void L1Algo::CaTrackFinderSlice() // suppress strips of suppressed hits - for (L1HitIndex_t ip = 0; ip < fGridPoints.size(); ip++) { + for (ca::HitIndex_t ip = 0; ip < fGridPoints.size(); ip++) { const L1HitPoint& hp = fGridPoints[ip]; if (hp.IsSuppressed()) { - const L1Hit& hit = fGridHits[ip]; + const ca::Hit& hit = fGridHits[ip]; fvHitKeyFlags[hit.f] = 1; fvHitKeyFlags[hit.b] = 1; } @@ -689,8 +689,8 @@ void L1Algo::CaTrackFinderSlice() for (int ista = 0; ista < fParameters.GetNstationsActive(); ++ista) { int start = fGridHitStartIndex[ista]; int Nelements = fGridHitStopIndex[ista] - start; - L1Hit* staHits = nullptr; // to avoid out-of-range error in ..[start] - L1HitIndex_t* staHitIndices = nullptr; + ca::Hit* staHits = nullptr; // to avoid out-of-range error in ..[start] + ca::HitIndex_t* staHitIndices = nullptr; L1HitPoint* staHitPoints = nullptr; if (Nelements > 0) { staHits = &(fGridHits[start]); @@ -789,8 +789,8 @@ void L1Algo::CAFindTrack(int ista, L1Branch& best_tr, unsigned char& best_L, fsc { // -- finish with current track // add rest of hits - const L1HitIndex_t& ihitm = curr_trip->GetMHit(); - const L1HitIndex_t& ihitr = curr_trip->GetRHit(); + const ca::HitIndex_t& ihitm = curr_trip->GetMHit(); + const ca::HitIndex_t& ihitr = curr_trip->GetRHit(); //if (!GetFUsed((*fStripFlag)[fGridHits[ihitm].f] | (*fStripFlag)[fGridHits[ihitm].b])) { diff --git a/reco/L1/L1Algo/L1CloneMerger.cxx b/reco/L1/L1Algo/L1CloneMerger.cxx index a033d15082d3bdd509bd3de076cc9472fff47188..9d5fefaea44f533c662d221b5b86addf468d23a5 100644 --- a/reco/L1/L1Algo/L1CloneMerger.cxx +++ b/reco/L1/L1Algo/L1CloneMerger.cxx @@ -30,12 +30,12 @@ L1CloneMerger::~L1CloneMerger() {} // --------------------------------------------------------------------------------------------------------------------- // -void L1CloneMerger::Exec(Vector<Track>& extTracks, Vector<L1HitIndex_t>& extRecoHits) +void L1CloneMerger::Exec(Vector<Track>& extTracks, Vector<ca::HitIndex_t>& extRecoHits) { Vector<unsigned short>& firstStation = fTrackFirstStation; Vector<unsigned short>& lastStation = fTrackLastStation; - Vector<L1HitIndex_t>& firstHit = fTrackFirstHit; - Vector<L1HitIndex_t>& lastHit = fTrackLastHit; + Vector<ca::HitIndex_t>& firstHit = fTrackFirstHit; + Vector<ca::HitIndex_t>& lastHit = fTrackLastHit; Vector<unsigned short>& neighbour = fTrackNeighbour; Vector<float>& trackChi2 = fTrackChi2; Vector<char>& isStored = fTrackIsStored; @@ -61,7 +61,7 @@ void L1CloneMerger::Exec(Vector<Track>& extTracks, Vector<L1HitIndex_t>& extReco neighbour.reset(nTracks); isDownstreamNeighbour.reset(nTracks); - L1HitIndex_t start_hit = 0; + ca::HitIndex_t start_hit = 0; #ifdef OMP #pragma omp parallel for @@ -175,7 +175,7 @@ void L1CloneMerger::Exec(Vector<Track>& extTracks, Vector<L1HitIndex_t>& extReco fTracksNew.push_back(extTracks[iTr]); if (!isDownstreamNeighbour[iTr]) { - for (L1HitIndex_t HI = firstHit[iTr]; HI <= lastHit[iTr]; HI++) { + for (ca::HitIndex_t HI = firstHit[iTr]; HI <= lastHit[iTr]; HI++) { fRecoHitsNew.push_back(extRecoHits[HI]); } } @@ -183,12 +183,12 @@ void L1CloneMerger::Exec(Vector<Track>& extTracks, Vector<L1HitIndex_t>& extReco if (neighbour[iTr] < kNoNeighbour) { isStored[neighbour[iTr]] = true; fTracksNew.back().fNofHits += extTracks[neighbour[iTr]].fNofHits; - for (L1HitIndex_t HI = firstHit[neighbour[iTr]]; HI <= lastHit[neighbour[iTr]]; HI++) + for (ca::HitIndex_t HI = firstHit[neighbour[iTr]]; HI <= lastHit[neighbour[iTr]]; HI++) fRecoHitsNew.push_back(extRecoHits[HI]); } if (isDownstreamNeighbour[iTr]) { - for (L1HitIndex_t HI = firstHit[iTr]; HI <= lastHit[iTr]; HI++) { + for (ca::HitIndex_t HI = firstHit[iTr]; HI <= lastHit[iTr]; HI++) { fRecoHitsNew.push_back(extRecoHits[HI]); } } diff --git a/reco/L1/L1Algo/L1CloneMerger.h b/reco/L1/L1Algo/L1CloneMerger.h index 451dcd6da3e792cab305519487de0930b0753c5a..1cba7f6e606124747deb54a719aa458fee4af664 100644 --- a/reco/L1/L1Algo/L1CloneMerger.h +++ b/reco/L1/L1Algo/L1CloneMerger.h @@ -11,12 +11,13 @@ #define L1CloneMerger_h 1 #include "CaConstants.h" // TEMPORARY FOR fvec, fscal +#include "CaHit.h" // For ca::HitIndex_t #include "CaVector.h" #include "L1Def.h" -#include "L1Hit.h" // For L1HitIndex_t using namespace cbm::algo::ca; //TODO: remove +using namespace cbm::algo; //TODO: remove namespace cbm::algo::ca { @@ -58,7 +59,7 @@ public: /// Executes track clones merging algorithm and updates input containers /// \param extTracks Reference to the external container of reconstructed tracks /// \param extRecoHits Reference to the external container of reconstructed hit indexes - void Exec(Vector<Track>& extTracks, Vector<L1HitIndex_t>&); + void Exec(Vector<Track>& extTracks, Vector<ca::HitIndex_t>&); private: // *************** @@ -106,10 +107,10 @@ private: Vector<unsigned short> fTrackLastStation {"L1CloneMerger::fTrackLastStation"}; /// Index of the first hit of a track - Vector<L1HitIndex_t> fTrackFirstHit {"L1CloneMerger::fTrackFirstHit"}; + Vector<ca::HitIndex_t> fTrackFirstHit {"L1CloneMerger::fTrackFirstHit"}; /// Index of the last hit of a track - Vector<L1HitIndex_t> fTrackLastHit {"L1CloneMerger::fTrackLastHit"}; + Vector<ca::HitIndex_t> fTrackLastHit {"L1CloneMerger::fTrackLastHit"}; /// Index (TODO:??) of a track that can be merge with the given track Vector<unsigned short> fTrackNeighbour {"L1CloneMerger::fTrackNeighbour"}; @@ -125,7 +126,7 @@ private: Vector<Track> fTracksNew {"L1CAMergerClones::fTracksNew"}; ///< vector of tracks after the merge - Vector<L1HitIndex_t> fRecoHitsNew {"L1CAMergerClones::fRecoHitsNew"}; ///< vector of track hits after the merge + Vector<ca::HitIndex_t> fRecoHitsNew {"L1CAMergerClones::fRecoHitsNew"}; ///< vector of track hits after the merge const L1Algo& frAlgo; ///< Reference to the main track finder algorithm class }; diff --git a/reco/L1/L1Algo/L1Fit.cxx b/reco/L1/L1Algo/L1Fit.cxx index 6a250a9dbcbbb3b3b7c810dfef2d44943b3142d3..993ceb2774cb8e60fc95bdc7c961650e75328e03 100644 --- a/reco/L1/L1Algo/L1Fit.cxx +++ b/reco/L1/L1Algo/L1Fit.cxx @@ -4,7 +4,7 @@ #include "L1Fit.h" -#include "L1Hit.h" +#include "CaHit.h" #include "L1Station.h" #define cnst const fvec @@ -305,7 +305,7 @@ void L1Fit::FilterXY(const L1XYMeasurementInfo& info, cnst& x, cnst& y) fTr.C66() -= K60 * F60 + K61 * F61; } -void L1Fit::FilterHit(const L1Station& sta, const L1Hit& hit) +void L1Fit::FilterHit(const L1Station& sta, const ca::Hit& hit) { L1XYMeasurementInfo info; info.C00 = hit.dx2; diff --git a/reco/L1/L1Algo/L1Fit.h b/reco/L1/L1Algo/L1Fit.h index bdd619edb3735b1a79d2487cafd0b28126de1fd0..31ad3feef49c2e6001019a641b87759042480e0e 100644 --- a/reco/L1/L1Algo/L1Fit.h +++ b/reco/L1/L1Algo/L1Fit.h @@ -17,7 +17,16 @@ #include "L1UMeasurementInfo.h" #include "L1XYMeasurementInfo.h" -class L1Hit; +namespace +{ + using namespace cbm::algo; +} // namespace + +namespace cbm::algo::ca +{ + class Hit; +} + class L1Station; #define cnst const fvec @@ -89,7 +98,7 @@ public: void FilterU(const L1UMeasurementInfo& info, cnst& u, cnst& sigma2); void FilterXY(const L1XYMeasurementInfo& info, cnst& x, cnst& y); void FilterTime(cnst& t, cnst& dt2, cnst& timeInfo); - void FilterHit(const L1Station& s, const L1Hit& h); + void FilterHit(const L1Station& s, const ca::Hit& h); void FilterVi(fvec vi); diff --git a/reco/L1/L1Algo/L1Grid.cxx b/reco/L1/L1Algo/L1Grid.cxx index f5aa2dab4b98e07baf6290c591c14e0ae039fd80..e81f50e966261fd8190d6a03daac7ab285e394cb 100644 --- a/reco/L1/L1Algo/L1Grid.cxx +++ b/reco/L1/L1Algo/L1Grid.cxx @@ -10,12 +10,19 @@ #include <assert.h> #include <string.h> -#include "L1Def.h" +#include "CaHit.h" #include "L1Algo.h" - +#include "L1Def.h" using namespace std; // !! REMOVE -using cbm::algo::ca::Vector; // TMP; + +namespace +{ + using cbm::algo::ca::Vector; // TMP!! + using namespace cbm::algo::ca; //TODO: remove + using namespace cbm::algo; //TODO: remove +} // namespace + /// Copy to memory block [@dest, @dest+@num] num number of times the value of i of type @T with size @typesize. /// uses binary expansion of copied volume for speed up @@ -34,8 +41,8 @@ inline void memset(T* dest, T i, size_t num) } } -void L1Grid::UpdateIterGrid(unsigned int Nelements, L1Hit* hits, Vector<L1HitIndex_t>& indicesBuf, - L1HitIndex_t* indices, Vector<L1Hit>& hitsBuf, Vector<L1HitPoint>& pointsBuf, +void L1Grid::UpdateIterGrid(unsigned int Nelements, ca::Hit* hits, Vector<ca::HitIndex_t>& indicesBuf, + ca::HitIndex_t* indices, Vector<ca::Hit>& hitsBuf, Vector<L1HitPoint>& pointsBuf, L1HitPoint* points, int& NHitsOnStation, L1Algo& Algo, const Vector<unsigned char>& vSFlag) { //L1_SHOW(vSFlag.size()); @@ -44,13 +51,13 @@ void L1Grid::UpdateIterGrid(unsigned int Nelements, L1Hit* hits, Vector<L1HitInd fscal xs = 0; fscal ys = 0; - for (L1HitIndex_t x = 0; x < Nelements; x++) { + for (ca::HitIndex_t x = 0; x < Nelements; x++) { - const L1Hit& hit = hits[x]; + const ca::Hit& hit = hits[x]; if (!(vSFlag[hit.f] || vSFlag[hit.b])) { std::tie(xs, ys) = Algo.GetHitCoorOnGrid(hit); - const L1HitIndex_t& bin = GetBinBounded(xs, ys, hit.t); + const ca::HitIndex_t& bin = GetBinBounded(xs, ys, hit.t); fHitsInBin[x] = fFirstHitInBin[bin + 1]; fFirstHitInBin[bin + 1]++; @@ -74,18 +81,18 @@ void L1Grid::UpdateIterGrid(unsigned int Nelements, L1Hit* hits, Vector<L1HitInd } } - for (L1HitIndex_t x = 0; x < Nelements; x++) { + for (ca::HitIndex_t x = 0; x < Nelements; x++) { - const L1Hit& hit = hits[x]; + const ca::Hit& hit = hits[x]; if (!(vSFlag[hit.f] || vSFlag[hit.b])) { std::tie(xs, ys) = Algo.GetHitCoorOnGrid(hit); - const L1HitIndex_t& bin = GetBinBounded(xs, ys, hit.t); + const ca::HitIndex_t& bin = GetBinBounded(xs, ys, hit.t); { - const L1HitIndex_t& index1 = fHitsInBin[x] + fFirstHitInBin[bin]; + const ca::HitIndex_t& index1 = fHitsInBin[x] + fFirstHitInBin[bin]; hitsBuf[index1 + NHitsOnStation] = hits[x]; indicesBuf[index1 + NHitsOnStation] = indices[x]; @@ -130,17 +137,17 @@ void L1Grid::BuildBins(float xMin, float xMax, float yMin, float yMax, float tMi } -void L1Grid::StoreHits(L1Algo& algo, int iS, L1HitIndex_t& nGridHitsFilled) +void L1Grid::StoreHits(L1Algo& algo, int iS, ca::HitIndex_t& nGridHitsFilled) { - L1HitIndex_t nHits = algo.fSliceHitIds[iS].size(); + ca::HitIndex_t nHits = algo.fSliceHitIds[iS].size(); algo.fGridHitStartIndex[iS] = nGridHitsFilled; fFirstHitInBin.reset(fN + 2, 0); - for (L1HitIndex_t ih = 0; ih < nHits; ih++) { - L1HitIndex_t caHitId = algo.fSliceHitIds[iS][ih]; - const L1Hit& h = algo.GetInputData().GetHit(caHitId); + for (ca::HitIndex_t ih = 0; ih < nHits; ih++) { + 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); fHitsInBin[ih] = fFirstHitInBin[bin + 1]; @@ -164,13 +171,13 @@ void L1Grid::StoreHits(L1Algo& algo, int iS, L1HitIndex_t& nGridHitsFilled) } } - for (L1HitIndex_t ih = 0; ih < nHits; ih++) { - L1HitIndex_t caHitId = algo.fSliceHitIds[iS][ih]; - const L1Hit& h = algo.GetInputData().GetHit(caHitId); + for (ca::HitIndex_t ih = 0; ih < nHits; ih++) { + 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); { - const L1HitIndex_t& index1 = fFirstHitInBin[bin] + fHitsInBin[ih]; + const ca::HitIndex_t& index1 = fFirstHitInBin[bin] + fHitsInBin[ih]; algo.fGridHits[nGridHitsFilled + index1] = h; algo.fGridHitIds[nGridHitsFilled + index1] = caHitId; } diff --git a/reco/L1/L1Algo/L1Grid.h b/reco/L1/L1Algo/L1Grid.h index e232e1a6a41c08ec51b2abf67a25ee359f683fde..1024651c711da886da286d1a436855f08a4ae575 100644 --- a/reco/L1/L1Algo/L1Grid.h +++ b/reco/L1/L1Algo/L1Grid.h @@ -15,9 +15,9 @@ #include <assert.h> #include <string.h> +#include "CaHit.h" #include "CaVector.h" #include "L1Def.h" -#include "L1Hit.h" #include "L1HitPoint.h" class L1Algo; @@ -25,10 +25,11 @@ class L1Algo; namespace { - using cbm::algo::ca::Vector; // TMP!! -} + using cbm::algo::ca::Vector; // TMP!! + using namespace cbm::algo::ca; //TODO: remove + using namespace cbm::algo; //TODO: remove +} // namespace -using namespace cbm::algo::ca; //TODO: remove /** * @class L1Grid @@ -46,7 +47,7 @@ public: ~L1Grid() = default; - void StoreHits(L1Algo& Algo, int iS, L1HitIndex_t& nGridHitsFilled); + 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); @@ -54,8 +55,8 @@ public: void AllocateMemory(); void Create(float xMin, float xMax, float yMin, float yMax, float sx, float sy); - void Fill(const L1HitPoint* points, L1HitIndex_t n); // call after sort - void FillPar(const L1HitPoint* points, L1HitIndex_t n); + void Fill(const L1HitPoint* points, ca::HitIndex_t n); // call after sort + void FillPar(const L1HitPoint* points, ca::HitIndex_t n); int GetBin(float X, float Y) const; @@ -82,7 +83,7 @@ public: unsigned short Ny() const { return fNy; } unsigned short Nt() const { return fNt; } - L1HitIndex_t FirstHitInBin(unsigned int i) const + ca::HitIndex_t FirstHitInBin(unsigned int i) const { if (i < (fN + 1)) return fFirstHitInBin[i]; else @@ -98,9 +99,9 @@ public: // }; - void UpdateIterGrid(unsigned int Nelements, L1Hit* hits, Vector<L1HitIndex_t>& indicesBuf, L1HitIndex_t* indices, - Vector<L1Hit>& hitsBuf, Vector<L1HitPoint>& pointsBuf, L1HitPoint* points, int& NHitsOnStation, - L1Algo& Algo, const Vector<unsigned char>& vSFlag); + void UpdateIterGrid(unsigned int Nelements, ca::Hit* hits, Vector<ca::HitIndex_t>& indicesBuf, + ca::HitIndex_t* indices, Vector<ca::Hit>& hitsBuf, Vector<L1HitPoint>& pointsBuf, + L1HitPoint* points, int& NHitsOnStation, L1Algo& Algo, const Vector<unsigned char>& vSFlag); private: @@ -116,8 +117,8 @@ private: float fStepTInv {0.f}; //* inverse bin size in T int fBinInGrid {0}; - Vector<L1HitIndex_t> fFirstHitInBin {"L1Grid::fFirstHitInBin"}; - Vector<L1HitIndex_t> fHitsInBin {"L1Grid::fHitsInBin"}; + Vector<ca::HitIndex_t> fFirstHitInBin {"L1Grid::fFirstHitInBin"}; + Vector<ca::HitIndex_t> fHitsInBin {"L1Grid::fHitsInBin"}; // vector <omp_lock_t> lock; }; diff --git a/reco/L1/L1Algo/L1Hit.h b/reco/L1/L1Algo/L1Hit.h deleted file mode 100644 index 19c2b2ab8cd9983f8e8c9421bf655107bf441640..0000000000000000000000000000000000000000 --- a/reco/L1/L1Algo/L1Hit.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (C) 2007-2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Valentina Akishina, Igor Kulakov, Sergey Gorbunov [committer], Maksym Zyzak */ - -/// @file L1Hit.h -/// @author Sergey Gorbunov -/// @author Igor Kulakov -/// @author Valentina Akishina -/// @author Maksym Zyzak -/// @date 2007-2022 - -#ifndef L1Hit_h -#define L1Hit_h - -#include <boost/serialization/access.hpp> - -#include "CaSimd.h" - -using namespace cbm::algo::ca; //TODO: remove - -using L1HitIndex_t = unsigned int; ///< Index of L1Hit -using L1StripIndex_t = unsigned int; ///< Index of the station strip - -/// -/// L1Hit class describes a generic hit for CA tracker -/// Note: U is a transverse coordinate of the hit in the axis perpendicular to the front strip -/// Note: V is a transverse coordinate of the hit in the axis perpendicular to the back strip -/// -class /*alignas(L1Constants::misc::kAlignment)*/ L1Hit { - friend class boost::serialization::access; - -public: - L1StripIndex_t f {0}; ///< front hit key index - L1StripIndex_t b {0}; ///< back hit key index - /// NOTE: For STS f and b correspond to the indexes of the front and back clusters of the hit in a dataset. For other - /// tracking detectors (MVD, MuCh, TRD, TOF) f == b and corresponds to the index of the hit. Indexes f and b - /// do not intersect between different detector stations. - - float x {0.f}; ///< measured X coordinate [cm] - float y {0.f}; ///< measured Y coordinate [cm] - float z = 0.f; ///< fixed Z coordinate [cm] - float t = 0.f; ///< measured time [ns] - float dx2 {0.f}; ///< rms^2 of uncertainty of X coordinate [cm] - float dy2 {0.f}; ///< rms^2 of uncertainty of Y coordinate [cm] - float dxy {0.f}; ///< X/Y covariance [cm2] - float dt2 {0.f}; ///< measured uncertainty of time [ns] - float rangeX {0.f}; ///< +-range of uncertainty of X coordinate [cm] - float rangeY {0.f}; ///< +-range of uncertainty of Y coordinate [cm] - float rangeT {0.f}; ///< +-range of uncertainty of time [ns] - - int ID = 0; ///< index of hit before hit sorting - int iSt = 0; ///< index of station in the active stations array - -private: - /// Serialization method, used to save L1Hit objects into binary or text file in a defined order - template<class Archive> - void serialize(Archive& ar, const unsigned int /*version*/) - { - ar& f; - ar& b; - ar& x; - ar& y; - ar& z; - ar& t; - ar& dx2; - ar& dxy; - ar& dy2; - ar& dt2; - ar& rangeX; - ar& rangeY; - ar& rangeT; - ar& ID; - ar& iSt; - } -}; - -#endif diff --git a/reco/L1/L1Algo/L1HitArea.h b/reco/L1/L1Algo/L1HitArea.h index b9a94a291fb2c71729b47a363239ba26fdaca308..80720a621a6aa707460c54de2993cfb557d7ec9f 100644 --- a/reco/L1/L1Algo/L1HitArea.h +++ b/reco/L1/L1Algo/L1HitArea.h @@ -5,6 +5,7 @@ #ifndef L1HitArea_H #define L1HitArea_H +#include "CaHit.h" #include "L1Def.h" #include "L1Grid.h" @@ -12,6 +13,7 @@ class L1Row; class L1SliceData; using namespace cbm::algo::ca; //TODO: remove +using namespace cbm::algo; //TODO: remove class L1HitArea { public: @@ -21,7 +23,7 @@ public: * look up the next hit in the requested area. * Sets h to the coordinates and returns the index for the hit data */ - bool GetNext(L1HitIndex_t& i); + bool GetNext(ca::HitIndex_t& i); protected: const L1Grid& fGrid; @@ -30,8 +32,8 @@ protected: unsigned short fBDX; // X distance of bin indexes unsigned int fIndXmin; // minimum index for unsigned short fIy; // current Y bin index (incremented while iterating) - L1HitIndex_t fHitXlst; // last possible hit index in current y-line - L1HitIndex_t fIh; // hit index iterating inside the bins + 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 }; @@ -66,7 +68,7 @@ inline L1HitArea::L1HitArea(const L1Grid& grid, float x, float y, float dx, floa fHitXlst = fGrid.FirstHitInBin(fIndXmin + fBDX); } -inline bool L1HitArea::GetNext(L1HitIndex_t& i) +inline bool L1HitArea::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 @@ -107,7 +109,7 @@ public: * look up the next hit in the requested area. * Sets h to the coordinates and returns the index for the hit data */ - bool GetNext(L1HitIndex_t& i); + bool GetNext(ca::HitIndex_t& i); protected: const L1Grid& fGrid; @@ -116,8 +118,8 @@ protected: unsigned short fBDX; // X distance of bin indexes unsigned int fIndXmin; // minimum index for unsigned short fIy; // current Y bin index (incremented while iterating) - L1HitIndex_t fHitXlst; // last possible hit index in current y-line - L1HitIndex_t fIh; // hit index iterating inside the bins + 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; @@ -178,7 +180,7 @@ inline L1HitAreaTime::L1HitAreaTime(const L1Grid& grid, float x, float y, float fHitXlst = fGrid.FirstHitInBin(fIndXmin + fBDX); } -inline bool L1HitAreaTime::GetNext(L1HitIndex_t& i) +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 diff --git a/reco/L1/L1Algo/L1HitPoint.h b/reco/L1/L1Algo/L1HitPoint.h index 4fb86e34f073b7592d946ced93d989e1fdab246d..e2850075989165b79e07a16740ee990319cf24b7 100644 --- a/reco/L1/L1Algo/L1HitPoint.h +++ b/reco/L1/L1Algo/L1HitPoint.h @@ -6,9 +6,10 @@ #define _L1HitPoint_h_ #include "CaConstants.h" -#include "L1Hit.h" +#include "CaHit.h" using namespace cbm::algo::ca; //TODO: remove +using namespace cbm::algo; //TODO: remove /// contain strips positions and coordinates of the hit @@ -16,9 +17,9 @@ struct L1HitPoint { L1HitPoint() = default; - L1HitPoint(const L1Hit& hit) { Set(hit); }; + L1HitPoint(const ca::Hit& hit) { Set(hit); }; - void Set(const L1Hit& hit) + void Set(const ca::Hit& hit) { x = hit.x; y = hit.y; diff --git a/reco/L1/L1Algo/L1IODataManager.cxx b/reco/L1/L1Algo/L1IODataManager.cxx index dff5254d3ecc54216f14d344e7087bad1c7db88e..ca2719d1598e3549cb44f5c25e93a80001b6de02 100644 --- a/reco/L1/L1Algo/L1IODataManager.cxx +++ b/reco/L1/L1Algo/L1IODataManager.cxx @@ -75,7 +75,7 @@ void L1IODataManager::ReadInputData(const std::string& fileName) // --------------------------------------------------------------------------------------------------------------------- // -void L1IODataManager::ResetInputData(L1HitIndex_t nHits) noexcept +void L1IODataManager::ResetInputData(ca::HitIndex_t nHits) noexcept { L1InputData tmp; fInputData.Swap(tmp); diff --git a/reco/L1/L1Algo/L1IODataManager.h b/reco/L1/L1Algo/L1IODataManager.h index 3056db2dda6124def93de4c7c1efcf4629ef96f8..b37d409eda66b8d494e75acd0ae20e810fed184f 100644 --- a/reco/L1/L1Algo/L1IODataManager.h +++ b/reco/L1/L1Algo/L1IODataManager.h @@ -57,15 +57,15 @@ public: /// Reserve number of hits /// \param nHits Number of hits to be stored /// \note If one does not call this method, the underlying vector of hits will be filled with the time penalty - void ReserveNhits(L1HitIndex_t nHits) { fInputData.fHits.reserve(nHits); } + void ReserveNhits(ca::HitIndex_t nHits) { fInputData.fHits.reserve(nHits); } /// @brief Resets the input data block /// @param nHits Number of hits to reserve - void ResetInputData(L1HitIndex_t nHits = 0) noexcept; + void ResetInputData(ca::HitIndex_t nHits = 0) noexcept; /// Pushes back a hit - /// \param hit An L1Hit object - void PushBackHit(const L1Hit& hit, int64_t streamId) + /// \param hit An ca::Hit object + void PushBackHit(const ca::Hit& hit, int64_t streamId) { if (fInputData.fStreamStartIndices.size() == 0 || fLastStreamId != streamId) { // new data stream fLastStreamId = streamId; diff --git a/reco/L1/L1Algo/L1InputData.h b/reco/L1/L1Algo/L1InputData.h index d7c6283670c85aeb5ead8c6dbe0b8d20bb29aed4..3badad4eb8f8b35b8e1e69f6c856b3fe19fdc276 100644 --- a/reco/L1/L1Algo/L1InputData.h +++ b/reco/L1/L1Algo/L1InputData.h @@ -14,12 +14,14 @@ #include <boost/serialization/array.hpp> #include "CaConstants.h" +#include "CaHit.h" #include "CaVector.h" -#include "L1Hit.h" namespace { using cbm::algo::ca::Vector; + using namespace cbm::algo; + using namespace cbm::algo::ca; } /// Class L1InputData represents a block of the input data to the L1 tracking algorithm per event or time slice. @@ -59,7 +61,7 @@ public: L1InputData& operator=(L1InputData&& other) noexcept; /// Gets hits sample size - L1HitIndex_t GetSampleSize() const { return fHits.size(); } + ca::HitIndex_t GetSampleSize() const { return fHits.size(); } // ** Accessors ** @@ -69,28 +71,31 @@ public: /// Gets reference to hit by its index /// \param index Index of hit in the hits sample - const L1Hit& GetHit(L1HitIndex_t index) const { return fHits[index]; } + const ca::Hit& GetHit(ca::HitIndex_t index) const { return fHits[index]; } /// Gets reference to hits vector - const Vector<L1Hit>& GetHits() const { return fHits; } + const Vector<ca::Hit>& GetHits() const { return fHits; } /// Gets number of hits in the hits vector - L1HitIndex_t GetNhits() const { return fHits.size(); } + ca::HitIndex_t GetNhits() const { return fHits.size(); } /// Gets total number of stored keys int GetNhitKeys() const { return fNhitKeys; } /// Gets index of the first hit in the sorted hits vector /// \param iStream Index of the data stream - L1HitIndex_t GetStreamStartIndex(int iStream) const { return fStreamStartIndices[iStream]; } + ca::HitIndex_t GetStreamStartIndex(int iStream) const { return fStreamStartIndices[iStream]; } /// Gets index of (the last + 1) hit in the sorted hits vector /// \param iStream Index of the data stream - L1HitIndex_t GetStreamStopIndex(int iStream) const { return fStreamStopIndices[iStream]; } + ca::HitIndex_t GetStreamStopIndex(int iStream) const { return fStreamStopIndices[iStream]; } /// Gets n hits for the data stream /// \param iStream Index of the data stream - L1HitIndex_t GetStreamNhits(int iStream) const { return fStreamStopIndices[iStream] - fStreamStartIndices[iStream]; } + ca::HitIndex_t GetStreamNhits(int iStream) const + { + return fStreamStopIndices[iStream] - fStreamStartIndices[iStream]; + } private: @@ -112,11 +117,11 @@ private: // *************************** /// @brief Sample of input hits - Vector<L1Hit> fHits {"L1InputData::fHits"}; + Vector<ca::Hit> fHits {"L1InputData::fHits"}; /// @brief Index of the first hit in the sorted hits vector for a given data stream - Vector<L1HitIndex_t> fStreamStartIndices {"L1InputData::fStreamStartIndices"}; - Vector<L1HitIndex_t> fStreamStopIndices {"L1InputData::fStreamStopIndices"}; + Vector<ca::HitIndex_t> fStreamStartIndices {"L1InputData::fStreamStartIndices"}; + Vector<ca::HitIndex_t> fStreamStopIndices {"L1InputData::fStreamStopIndices"}; /// @brief Number of hit keys used for rejecting fake STS hits int fNhitKeys = -1; diff --git a/reco/L1/L1Algo/L1TrackFitter.cxx b/reco/L1/L1Algo/L1TrackFitter.cxx index 590326afb7551f7e2ba9558341ac4bcd5db17675..aea32e357e7ab8ea435ee206e2fe36892ab593b3 100644 --- a/reco/L1/L1Algo/L1TrackFitter.cxx +++ b/reco/L1/L1Algo/L1TrackFitter.cxx @@ -128,7 +128,7 @@ void L1Algo::L1KFTrackFitter() for (int ih = 0; ih < nHitsTrack; ih++) { - const L1Hit& hit = fInputData.GetHit(fSliceRecoHits[start_hit++]); + const ca::Hit& hit = fInputData.GetHit(fSliceRecoHits[start_hit++]); const int ista = hit.iSt; //if (sta[ista].fieldStatus) { isFieldPresent[iVec] = true; } diff --git a/reco/L1/L1Algo/L1Triplet.h b/reco/L1/L1Algo/L1Triplet.h index 4731592963044b944681c943004e91ecb6868848..09a1ab3fc6dd9d92fd0ccef0b8872cb75930597d 100644 --- a/reco/L1/L1Algo/L1Triplet.h +++ b/reco/L1/L1Algo/L1Triplet.h @@ -12,6 +12,11 @@ #include "L1Def.h" +namespace +{ + using namespace cbm::algo; +} + /// L1Triplet class represents a short 3-hit track segment called a "triplet". /// class L1Triplet { @@ -46,9 +51,9 @@ public: void SetLevel(unsigned char Level) { fLevel = Level; } unsigned char GetLevel() const { return fLevel; } - L1HitIndex_t GetLHit() const { return fHitL; } - L1HitIndex_t GetMHit() const { return fHitM; } - L1HitIndex_t GetRHit() const { return fHitR; } + ca::HitIndex_t GetLHit() const { return fHitL; } + ca::HitIndex_t GetMHit() const { return fHitM; } + ca::HitIndex_t GetRHit() const { return fHitR; } void SetNNeighbours(int n) { fNneighbours = n; } int GetNNeighbours() const { return fNneighbours; } @@ -86,9 +91,9 @@ private: fscal fCty = 0.f; ///< RMS of ty unsigned int fFirstNeighbour = 0; ///< ID of the first neighbouring triplet - L1HitIndex_t fHitL = 0; ///< left hit index (16b) in vHits array - L1HitIndex_t fHitM = 0; ///< middle hit index (16b) - L1HitIndex_t fHitR = 0; ///< right hit index (16b) + ca::HitIndex_t fHitL = 0; ///< left hit index (16b) in vHits array + ca::HitIndex_t fHitM = 0; ///< middle hit index (16b) + ca::HitIndex_t fHitR = 0; ///< right hit index (16b) int fNneighbours = 0; ///< n of neighbouring triplets /// Triplet level - its possible position on the longest track candidate it belongs to. diff --git a/reco/L1/L1Algo/L1TripletConstructor.cxx b/reco/L1/L1Algo/L1TripletConstructor.cxx index 22622617565b24e3e023ec118339778f9f3063aa..729355fcf28fd9c8bd27356aaaa3a4ad5b79eb01 100644 --- a/reco/L1/L1Algo/L1TripletConstructor.cxx +++ b/reco/L1/L1Algo/L1TripletConstructor.cxx @@ -79,7 +79,7 @@ void L1TripletConstructor::InitStations(int istal, int istam, int istar) } -void L1TripletConstructor::CreateTripletsForHit(int istal, int istam, int istar, L1HitIndex_t ihl) +void L1TripletConstructor::CreateTripletsForHit(int istal, int istam, int istar, ca::HitIndex_t ihl) { InitStations(istal, istam, istar); @@ -198,7 +198,7 @@ void L1TripletConstructor::FitDoublets() // ---- Add the middle hits to parameters estimation ---- - Vector<L1HitIndex_t> hitsMtmp("L1TripletConstructor::hitsMtmp", fHitsM_2); + Vector<ca::HitIndex_t> hitsMtmp("L1TripletConstructor::hitsMtmp", fHitsM_2); fHitsM_2.clear(); fTracks_2.clear(); @@ -208,7 +208,7 @@ void L1TripletConstructor::FitDoublets() for (unsigned int i2 = 0; i2 < hitsMtmp.size(); i2++) { - const L1HitIndex_t imh = hitsMtmp[i2]; + const ca::HitIndex_t imh = hitsMtmp[i2]; const L1HitPoint& hitm = fHitsM[imh]; if (hitm.IsSuppressed()) continue; @@ -338,7 +338,7 @@ void L1TripletConstructor::FindRightHit() if (iMC < 0 || iMC != fAlgo->GetMcTrackIdForGridHit(indM)) { continue; } } - Vector<L1HitIndex_t> collectedHits; + Vector<ca::HitIndex_t> collectedHits; CollectHits(T2, fIstaR, fAlgo->fTripletChi2Cut, iMC, collectedHits, fAlgo->fParameters.GetMaxTripletPerDoublets()); if (collectedHits.size() >= fAlgo->fParameters.GetMaxTripletPerDoublets()) { @@ -349,7 +349,7 @@ void L1TripletConstructor::FindRightHit() } for (unsigned int ih = 0; ih < collectedHits.size(); ih++) { - L1HitIndex_t irh = collectedHits[ih]; + ca::HitIndex_t irh = collectedHits[ih]; const L1HitPoint& hitr = fHitsR[irh]; if (hitr.IsSuppressed()) continue; @@ -406,9 +406,9 @@ void L1TripletConstructor::FitTriplets() for (int i3 = 0; i3 < n3; ++i3) { // prepare data - L1HitIndex_t ihit[NHits] = {fAlgo->fGridHitIds[fIhitL + fAlgo->fGridHitStartIndex[ista[0]]], - fAlgo->fGridHitIds[fHitsM_3[i3] + fAlgo->fGridHitStartIndex[ista[1]]], - fAlgo->fGridHitIds[fHitsR_3[i3] + fAlgo->fGridHitStartIndex[ista[2]]]}; + ca::HitIndex_t ihit[NHits] = {fAlgo->fGridHitIds[fIhitL + fAlgo->fGridHitStartIndex[ista[0]]], + fAlgo->fGridHitIds[fHitsM_3[i3] + fAlgo->fGridHitStartIndex[ista[1]]], + fAlgo->fGridHitIds[fHitsR_3[i3] + fAlgo->fGridHitStartIndex[ista[2]]]}; if (fAlgo->fParameters.DevIsMatchTripletsViaMc()) { int mc1 = fAlgo->GetMcTrackIdForCaHit(ihit[0]); @@ -422,7 +422,7 @@ void L1TripletConstructor::FitTriplets() L1XYMeasurementInfo cov[NHits]; for (int ih = 0; ih < NHits; ++ih) { - const L1Hit& hit = fAlgo->fInputData.GetHit(ihit[ih]); + const ca::Hit& hit = fAlgo->fInputData.GetHit(ihit[ih]); x[ih] = hit.x; y[ih] = hit.y; z[ih] = hit.z; @@ -542,9 +542,9 @@ void L1TripletConstructor::FitTriplets() int mc2 = fAlgo->GetMcTrackIdForCaHit(ih1); int mc3 = fAlgo->GetMcTrackIdForCaHit(ih2); - const L1Hit& h0 = fAlgo->fInputData.GetHit(ih0); - const L1Hit& h1 = fAlgo->fInputData.GetHit(ih1); - const L1Hit& h2 = fAlgo->fInputData.GetHit(ih2); + const ca::Hit& h0 = fAlgo->fInputData.GetHit(ih0); + const ca::Hit& h1 = fAlgo->fInputData.GetHit(ih1); + const ca::Hit& h2 = fAlgo->fInputData.GetHit(ih2); if ((mc1 >= 0) && (mc1 == mc2) && (mc1 == mc3)) { const CbmL1MCTrack& mctr = CbmL1::Instance()->GetMcTracks()[mc1]; @@ -577,9 +577,9 @@ void L1TripletConstructor::StoreTriplets() fscal chi2 = T3.GetChiSq()[0]; // / T3.NDF[0]; - const L1HitIndex_t ihitl = fIhitL + fAlgo->fGridHitStartIndex[fIstaL]; - const L1HitIndex_t ihitm = fHitsM_3[i3] + fAlgo->fGridHitStartIndex[fIstaM]; - const L1HitIndex_t ihitr = fHitsR_3[i3] + fAlgo->fGridHitStartIndex[fIstaR]; + const ca::HitIndex_t ihitl = fIhitL + fAlgo->fGridHitStartIndex[fIstaL]; + const ca::HitIndex_t ihitm = fHitsM_3[i3] + fAlgo->fGridHitStartIndex[fIstaM]; + const ca::HitIndex_t ihitr = fHitsR_3[i3] + fAlgo->fGridHitStartIndex[fIstaR]; L1_ASSERT(ihitl < fAlgo->fGridHitStopIndex[fIstaL], ihitl << " < " << fAlgo->fGridHitStopIndex[fIstaL]); L1_ASSERT(ihitm < fAlgo->fGridHitStopIndex[fIstaM], ihitm << " < " << fAlgo->fGridHitStopIndex[fIstaM]); @@ -609,7 +609,7 @@ void L1TripletConstructor::StoreTriplets() void L1TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, const double chi2Cut, const int iMC, - Vector<L1HitIndex_t>& collectedHits, int maxNhits) + Vector<ca::HitIndex_t>& collectedHits, int maxNhits) { /// Collect hits on a station @@ -618,7 +618,7 @@ void L1TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, co const L1Station& sta = fAlgo->fParameters.GetStation(iSta); const L1HitPoint* hits = &(fAlgo->fGridPoints[0]) + fAlgo->fGridHitStartIndex[iSta]; - const L1HitIndex_t nHits = fAlgo->fGridHitStopIndex[iSta] - fAlgo->fGridHitStartIndex[iSta]; + const ca::HitIndex_t nHits = fAlgo->fGridHitStopIndex[iSta] - fAlgo->fGridHitStartIndex[iSta]; fFit.SetTrack(Tr); TrackParamV& T = fFit.Tr(); @@ -636,7 +636,7 @@ void L1TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, co (sqrt(Pick_m22 * T.C11()) + fAlgo->fMaxRangeY[iSta] + fAlgo->fMaxDZ * abs(T.Ty()))[0] * iz, time, sqrt(timeError2) * 5 + fAlgo->fMaxRangeT[iSta]); - for (L1HitIndex_t ih = 0; (ih < nHits) && ((int) collectedHits.size() < maxNhits); + 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 diff --git a/reco/L1/L1Algo/L1TripletConstructor.h b/reco/L1/L1Algo/L1TripletConstructor.h index 94aacc43345d6768a4122e8795a1c7db006fb508..bfd88d1304e7874154e4aebc3ce34e5f6edbc600 100644 --- a/reco/L1/L1Algo/L1TripletConstructor.h +++ b/reco/L1/L1Algo/L1TripletConstructor.h @@ -50,7 +50,7 @@ public: void InitStations(int istal, int istam, int istar); - void CreateTripletsForHit(int istal, int istam, int istar, L1HitIndex_t ihl); + void CreateTripletsForHit(int istal, int istam, int istar, ca::HitIndex_t ihl); const Vector<L1Triplet>& GetTriplets() const { return fTriplets; } @@ -72,7 +72,7 @@ public: void StoreTriplets(); void CollectHits(const TrackParamV& Tr, const int iSta, const double chi2Cut, const int iMC, - Vector<L1HitIndex_t>& collectedHits, int maxNhits); + Vector<ca::HitIndex_t>& collectedHits, int maxNhits); private: /// left station @@ -101,16 +101,16 @@ private: const L1Station* fFld0Sta[2]; // two stations for approximating the field between the target and the left hit const L1Station* fFld1Sta[3]; // three stations for approximating the field between the left and the right hit - L1HitIndex_t fIhitL; + ca::HitIndex_t fIhitL; TrackParamV fTrL; L1FieldRegion fFldL; - Vector<L1HitIndex_t> fHitsM_2 {"L1TripletConstructor::fHitsM_2"}; + Vector<ca::HitIndex_t> fHitsM_2 {"L1TripletConstructor::fHitsM_2"}; Vector<TrackParamV> fTracks_2 {"L1TripletConstructor::fTracks_2"}; Vector<TrackParamV> fTracks_3 {"L1TripletConstructor::fTracks_3"}; - Vector<L1HitIndex_t> fHitsM_3 {"L1TripletConstructor::fHitsM_3"}; - Vector<L1HitIndex_t> fHitsR_3 {"L1TripletConstructor::fHitsR_3"}; + Vector<ca::HitIndex_t> fHitsM_3 {"L1TripletConstructor::fHitsM_3"}; + Vector<ca::HitIndex_t> fHitsR_3 {"L1TripletConstructor::fHitsR_3"}; Vector<L1Triplet> fTriplets {"L1TripletConstructor::fTriplets"}; diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx index 2b458eb4d0c6afd9b4da2631a2e5aa9e3a534e6d..555d4563823fb113f889de7d9b3b383969877e82 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx @@ -239,7 +239,7 @@ void L1AlgoDraw::DrawRecoTracks() // CbmL1 &L1 = *CbmL1::Instance(); int curRecoHit = 0; - cbm::algo::ca::Vector<L1HitIndex_t>& recoHits = algo->fSliceRecoHits; + cbm::algo::ca::Vector<ca::HitIndex_t>& recoHits = algo->fSliceRecoHits; for (vector<Track>::iterator it = algo->fSliceRecoTracks.begin(); it != algo->fSliceRecoTracks.end(); ++it) { Track& T = *it; int nHits = T.fNofHits; @@ -304,7 +304,7 @@ void L1AlgoDraw::DrawRecoTracks() XYZ->Update(); } -void L1AlgoDraw::DrawTriplets(vector<L1Triplet>& triplets, const L1HitIndex_t* realIHit) +void L1AlgoDraw::DrawTriplets(vector<L1Triplet>& triplets, const ca::HitIndex_t* realIHit) { // vector <L1Triplet> triplets = algo->vTriplets; for (unsigned int iTrip = 0; iTrip < triplets.size(); iTrip++) { @@ -368,14 +368,15 @@ void L1AlgoDraw::DrawTriplet(int il, int im, int ir) marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]); } -void L1AlgoDraw::DrawDoublets(vector<L1HitIndex_t>* Doublets_hits, map<L1HitIndex_t, L1HitIndex_t>* Doublets_start, - const int /*MaxArrSize*/, L1HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit) +void L1AlgoDraw::DrawDoublets(vector<ca::HitIndex_t>* Doublets_hits, + map<ca::HitIndex_t, ca::HitIndex_t>* Doublets_start, const int /*MaxArrSize*/, + ca::HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit) { for (int iSta = 0; iSta < NStations - 1; iSta++) { const int firstHitOnSta = StsRestHitsStartIndex[iSta]; const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1]; - L1HitIndex_t* staDoubletsHits = &(Doublets_hits[iSta][0]); - map<L1HitIndex_t, L1HitIndex_t>& staDoubletsStart = Doublets_start[iSta]; + ca::HitIndex_t* staDoubletsHits = &(Doublets_hits[iSta][0]); + map<ca::HitIndex_t, ca::HitIndex_t>& staDoubletsStart = Doublets_start[iSta]; for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) { const int ilh = iRestLHit - firstHitOnSta; @@ -401,13 +402,13 @@ void L1AlgoDraw::DrawDoublets(vector<L1HitIndex_t>* Doublets_hits, map<L1HitInde YX->Update(); }; -void L1AlgoDraw::DrawDoubletsOnSta(int iSta, L1HitIndex_t* Doublets_hits, L1HitIndex_t* Doublets_start, - const int MaxArrSize, L1HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit) +void L1AlgoDraw::DrawDoubletsOnSta(int iSta, ca::HitIndex_t* Doublets_hits, ca::HitIndex_t* Doublets_start, + const int MaxArrSize, ca::HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit) { const int firstHitOnSta = StsRestHitsStartIndex[iSta]; const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1]; - L1HitIndex_t* staDoubletsHits = Doublets_hits + MaxArrSize * iSta; - L1HitIndex_t* staDoubletsStart = Doublets_start + MaxArrSize * iSta; + ca::HitIndex_t* staDoubletsHits = Doublets_hits + MaxArrSize * iSta; + ca::HitIndex_t* staDoubletsStart = Doublets_start + MaxArrSize * iSta; for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) { const int ilh = iRestLHit - firstHitOnSta; @@ -560,7 +561,7 @@ void L1AlgoDraw::DrawInputHits() Int_t n_poly = 0; Int_t n_poly_fake = 0; for (int ih = HitsStartIndex[ista]; ih < HitsStopIndex[ista]; ih++) { - L1Hit& h = vHits[ih]; + ca::Hit& h = vHits[ih]; int iMC = CbmL1::Instance()->GetHitBestMcRefs()[ih]; //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used @@ -662,7 +663,7 @@ void L1AlgoDraw::DrawInputHits() } // DrawInputHits -void L1AlgoDraw::DrawRestHits(L1HitIndex_t* StsRestHitsStartIndex, L1HitIndex_t* StsRestHitsStopIndex, +void L1AlgoDraw::DrawRestHits(ca::HitIndex_t* StsRestHitsStartIndex, ca::HitIndex_t* StsRestHitsStopIndex, unsigned int* realIHit) { @@ -691,9 +692,9 @@ void L1AlgoDraw::DrawRestHits(L1HitIndex_t* StsRestHitsStartIndex, L1HitIndex_t* L1Station& st = vStations[ista]; Int_t n_poly = 0; Int_t n_poly_fake = 0; - for (L1HitIndex_t iRestHit = StsRestHitsStartIndex[ista]; iRestHit < StsRestHitsStopIndex[ista]; iRestHit++) { + for (ca::HitIndex_t iRestHit = StsRestHitsStartIndex[ista]; iRestHit < StsRestHitsStopIndex[ista]; iRestHit++) { int ih = realIHit[iRestHit]; - L1Hit& h = vHits[ih]; + ca::Hit& h = vHits[ih]; int iMC = CbmL1::Instance()->GetHitBestMcRefs()[ih]; //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used @@ -793,7 +794,7 @@ void L1AlgoDraw::ClearVeiw() L1AlgoDraw::Point L1AlgoDraw::GetHitCoor(int ih) { - L1Hit& hit = vHits[ih]; + ca::Hit& hit = vHits[ih]; return Point(hit.x, hit.y, hit.z); }; diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.h b/reco/L1/L1Algo/utils/L1AlgoDraw.h index be548cad4d1682eed89fff167b3ca42b0af7ddd8..ee3255a9e2033fa23029bd0cfff9f398cf8b06ec 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.h +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.h @@ -10,11 +10,16 @@ #include <map> #include <vector> +#include "CaHit.h" #include "L1Def.h" -#include "L1Hit.h" #include "L1Station.h" #include "L1Triplet.h" +namespace +{ + using namespace cbm::algo; +} + class TCanvas; class L1Algo; @@ -33,15 +38,16 @@ public: void DrawMCTracks(); void DrawRecoTracks(); - void DrawTriplets(std::vector<L1Triplet>& triplets, const L1HitIndex_t* realIHit); - void DrawDoublets(std::vector<L1HitIndex_t>* Doublets_hits, std::map<L1HitIndex_t, L1HitIndex_t>* Doublets_start, - const int MaxArrSize, L1HitIndex_t* HitsStartIndex, unsigned int* realIHit); - void DrawDoubletsOnSta(int iSta, L1HitIndex_t* Doublets_hits, L1HitIndex_t* Doublets_start, const int MaxArrSize, - L1HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit); + void DrawTriplets(std::vector<L1Triplet>& triplets, const ca::HitIndex_t* realIHit); + void DrawDoublets(std::vector<ca::HitIndex_t>* Doublets_hits, + std::map<ca::HitIndex_t, ca::HitIndex_t>* Doublets_start, const int MaxArrSize, + ca::HitIndex_t* HitsStartIndex, unsigned int* realIHit); + void DrawDoubletsOnSta(int iSta, ca::HitIndex_t* Doublets_hits, ca::HitIndex_t* Doublets_start, const int MaxArrSize, + ca::HitIndex_t* StsRestHitsStartIndex, unsigned int* realIHit); void DrawTarget(); void DrawInputHits(); // draw all hits, which TF have gotten - void DrawRestHits(L1HitIndex_t* StsRestHitsStartIndex, L1HitIndex_t* StsRestHitsStopIndex, + void DrawRestHits(ca::HitIndex_t* StsRestHitsStartIndex, ca::HitIndex_t* StsRestHitsStopIndex, unsigned int* realIHit); // draw only hits which leave on current iteration. void DrawInfo(); @@ -60,7 +66,7 @@ private: L1Algo* algo {nullptr}; - std::vector<L1Hit> vHits {}; + std::vector<ca::Hit> vHits {}; int HitsStartIndex[20] {0}; int HitsStopIndex[20] {0}; diff --git a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h index 5dc83b177ad0e61a6b5e3dbdf4bdbe159bc8d528..d4f0cb52b303149b9671cc173bec13f6d8f0bddd 100644 --- a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h +++ b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h @@ -49,7 +49,7 @@ template<int NHits> class L1RTracklet : public L1Tracklet<NHits> { public: L1RTracklet() = default; - L1RTracklet(L1HitIndex_t* ih_) : L1Tracklet<NHits>() + L1RTracklet(ca::HitIndex_t* ih_) : L1Tracklet<NHits>() { for (int iih = 0; iih < NHits; iih++) { i[iih] = ih_[iih]; @@ -71,7 +71,7 @@ public: } bool operator!=(const L1RTracklet<NHits>& a) { return !operator==(a); } - L1HitIndex_t i[NHits] {0}; // indices of left, middle and right hits + ca::HitIndex_t i[NHits] {0}; // indices of left, middle and right hits }; // MC Tracklet @@ -120,7 +120,7 @@ public: L1AlgoEfficiencyPerformance() = default; void Init(); - bool AddOne(L1HitIndex_t* ih_); // add one recoTracklets. Return is it reconstructed or not + bool AddOne(ca::HitIndex_t* ih_); // add one recoTracklets. Return is it reconstructed or not void CalculateEff(); void Print(); // Print efficiencies void Print(TString title = "Triplets performance statistic", @@ -215,7 +215,7 @@ void L1AlgoEfficiencyPerformance<NHits>::FillMC() template<int NHits> -bool L1AlgoEfficiencyPerformance<NHits>::AddOne(L1HitIndex_t* iHits) +bool L1AlgoEfficiencyPerformance<NHits>::AddOne(ca::HitIndex_t* iHits) { L1RecoTracklet trlet(iHits); @@ -266,7 +266,7 @@ bool L1AlgoEfficiencyPerformance<NHits>::AddOne(L1HitIndex_t* iHits) recoTracklets.push_back(trlet); return (trlet.mcTrackId >= 0); -}; // inline bool L1AlgoEfficiencyPerformance::AddOne(L1HitIndex_t ihl, L1HitIndex_t ihm, L1HitIndex_t ihr) +}; // inline bool L1AlgoEfficiencyPerformance::AddOne(ca::HitIndex_t ihl, ca::HitIndex_t ihm, ca::HitIndex_t ihr) template<int NHits> diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.cxx b/reco/L1/L1Algo/utils/L1AlgoPulls.cxx index 2c5a424102e4550f1f42edbe4981ff72624e90e5..2f842292765f078ddf7439d6cc3aeff49c3b204a 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.cxx +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.cxx @@ -99,13 +99,13 @@ void L1AlgoPulls::Init() } }; -// void L1AlgoPulls::AddVec(TrackParamV& T_, L1HitIndex_t ih) +// void L1AlgoPulls::AddVec(TrackParamV& T_, ca::HitIndex_t ih) // { // for (int i = 0; i < fvecLen; i++) // AddOne(T_,i,ih); // } -void L1AlgoPulls::AddOne(TrackParamV& T_, int i, L1HitIndex_t ih) +void L1AlgoPulls::AddOne(TrackParamV& T_, int i, ca::HitIndex_t ih) { fNAllPulls++; TL1TrackParameters T(T_, i); diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.h b/reco/L1/L1Algo/utils/L1AlgoPulls.h index 9efe5ed209be68c9cb6fcba8f5de27c351f9a018..3b105391a93eec34c892eb365a0f913971ad4e62 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.h +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.h @@ -90,8 +90,8 @@ public: void Init(); - // void AddVec(TrackParamV& T, L1HitIndex_t ih); - void AddOne(TrackParamV& T, int i, L1HitIndex_t ih); + // void AddVec(TrackParamV& T, ca::HitIndex_t ih); + void AddOne(TrackParamV& T, int i, ca::HitIndex_t ih); void Print(); // fast method to see pulls :) void Build(bool draw = 1);