diff --git a/algo/ca/core/pars/CaField.h b/algo/ca/core/pars/CaField.h index f7fbe1e0e58000cda0d494d9ce4d9a88ec795727..b00b4508da66fbc90942fd54433d84801b9f45a2 100644 --- a/algo/ca/core/pars/CaField.h +++ b/algo/ca/core/pars/CaField.h @@ -28,11 +28,11 @@ namespace cbm::algo::ca FieldValue() = default; /// \brief Copy constructor with type conversion - template<typename DataI> - FieldValue(const FieldValue<DataI>& other) - : x(other.template GetX<DataT>()) - , y(other.template GetY<DataT>()) - , z(other.template GetZ<DataT>()) + template<typename DataIn> + FieldValue(const FieldValue<DataIn>& other) + : x(utils::simd::Cast<DataIn, DataT>(other.x)) + , y(utils::simd::Cast<DataIn, DataT>(other.y)) + , z(utils::simd::Cast<DataIn, DataT>(other.z)) { } @@ -109,36 +109,6 @@ namespace cbm::algo::ca z(w) = B.z; } - /// \brief Inherited classes for type names renaming without altering functionality - // TODO: This is a temporary solution and should be removed in the future (G.Kozlov) - class FieldValueV : public FieldValue<fvec> { - using FieldValue<fvec>::FieldValue; /// inherit all the constructors - - public: - template<typename DataI> - FieldValueV(const FieldValue<DataI>& other) : FieldValue<fvec>(other) - { - } - }; - class FieldValueF : public FieldValue<float> { - using FieldValue<float>::FieldValue; /// inherit all the constructors - - public: - template<typename DataI> - FieldValueF(const FieldValue<DataI>& other) : FieldValue<float>(other) - { - } - }; - class FieldValueD : public FieldValue<double> { - using FieldValue<double>::FieldValue; /// inherit all the constructors - - public: - template<typename DataI> - FieldValueD(const FieldValue<DataI>& other) : FieldValue<double>(other) - { - } - }; - /// Class represents a set of magnetic field approximation coefficients /// // TODO: Crosscheck the default content (S.Zharko) @@ -148,6 +118,17 @@ namespace cbm::algo::ca /// Default constructor FieldSlice(); + /// \brief Copy constructor with type conversion + template<typename DataIn> + FieldSlice(const FieldSlice<DataIn>& other) : z(utils::simd::Cast<DataIn, DataT>(other.z)) + { + for (size_t i = 0; i < kMaxNFieldApproxCoefficients; i++) { + cx[i] = utils::simd::Cast<DataIn, DataT>(other.cx[i]); + cy[i] = utils::simd::Cast<DataIn, DataT>(other.cy[i]); + cz[i] = utils::simd::Cast<DataIn, DataT>(other.cz[i]); + } + } + /// Consistency checker void CheckConsistency() const; @@ -189,37 +170,6 @@ namespace cbm::algo::ca } } _fvecalignment; - /// \brief Inherited classes for type names renaming without altering functionality - // TODO: This is a temporary solution and should be removed in the future (G.Kozlov) - class FieldSliceV : public FieldSlice<fvec> { - using FieldSlice<fvec>::FieldSlice; /// inherit all the constructors - - public: - template<typename DataI> - FieldSliceV(const FieldSlice<DataI>& other) : FieldSlice<fvec>(other) - { - } - }; - class FieldSliceF : public FieldSlice<float> { - using FieldSlice<float>::FieldSlice; /// inherit all the constructors - - public: - template<typename DataI> - FieldSliceF(const FieldSlice<DataI>& other) : FieldSlice<float>(other) - { - } - }; - class FieldSliceD : public FieldSlice<double> { - using FieldSlice<double>::FieldSlice; /// inherit all the constructors - - public: - template<typename DataI> - FieldSliceD(const FieldSlice<DataI>& other) : FieldSlice<double>(other) - { - } - }; - - template<typename DataT> class FieldRegion { public: @@ -228,6 +178,23 @@ namespace cbm::algo::ca FieldRegion(float reg[10]) noexcept; + /// \brief Copy constructor with type conversion + template<typename DataIn> + FieldRegion(const FieldRegion<DataIn>& other) + : cx0(utils::simd::Cast<DataIn, DataT>(other.cx0)) + , cx1(utils::simd::Cast<DataIn, DataT>(other.cx1)) + , cx2(utils::simd::Cast<DataIn, DataT>(other.cx2)) + , cy0(utils::simd::Cast<DataIn, DataT>(other.cy0)) + , cy1(utils::simd::Cast<DataIn, DataT>(other.cy1)) + , cy2(utils::simd::Cast<DataIn, DataT>(other.cy2)) + , cz0(utils::simd::Cast<DataIn, DataT>(other.cz0)) + , cz1(utils::simd::Cast<DataIn, DataT>(other.cz1)) + , cz2(utils::simd::Cast<DataIn, DataT>(other.cz2)) + , z0(utils::simd::Cast<DataIn, DataT>(other.z0)) + , fUseOriginalField(other.fUseOriginalField) + { + } + /// Consistency checker void CheckConsistency() const; @@ -375,36 +342,6 @@ namespace cbm::algo::ca copy(z0, Tb.z0); } // CopyBase - /// \brief Inherited classes for type names renaming without altering functionality - // TODO: This is a temporary solution and should be removed in the future (G.Kozlov) - class FieldRegionV : public FieldRegion<fvec> { - using FieldRegion<fvec>::FieldRegion; /// inherit all the constructors - - public: - template<typename DataI> - FieldRegionV(const FieldRegion<DataI>& other) : FieldRegion<fvec>(other) - { - } - }; - class FieldRegionF : public FieldRegion<float> { - using FieldRegion<float>::FieldRegion; /// inherit all the constructors - - public: - template<typename DataI> - FieldRegionF(const FieldRegion<DataI>& other) : FieldRegion<float>(other) - { - } - }; - class FieldRegionD : public FieldRegion<double> { - using FieldRegion<double>::FieldRegion; /// inherit all the constructors - - public: - template<typename DataI> - FieldRegionD(const FieldRegion<DataI>& other) : FieldRegion<double>(other) - { - } - }; - /// \brief Explicit instantiation declarations for FieldRegion class with specific template types to ensure proper fgOdiginalField definition extern template class FieldRegion<fvec>; extern template class FieldRegion<float>; diff --git a/algo/ca/core/pars/CaInitManager.cxx b/algo/ca/core/pars/CaInitManager.cxx index 39ea1c7ea9133b742964b610b4c2daea68eafcb7..21106d195c8ea11f7e1ae809c839a1d7496113d7 100644 --- a/algo/ca/core/pars/CaInitManager.cxx +++ b/algo/ca/core/pars/CaInitManager.cxx @@ -66,8 +66,8 @@ void InitManager::ClearSetupInfo() fInitController.SetFlag(EInitKey::kActiveDetectorIDs, false); // Clear field info - fParameters.fVertexFieldRegion = ca::FieldRegionV(); - fParameters.fVertexFieldValue = ca::FieldValueV(); + fParameters.fVertexFieldRegion = ca::FieldRegion<fvec>(); + fParameters.fVertexFieldValue = ca::FieldValue<fvec>(); fInitController.SetFlag(EInitKey::kPrimaryVertexField, false); // Clear target position @@ -282,7 +282,7 @@ void InitManager::InitTargetField(double zStep) constexpr int nPointsNodal{3}; std::array<double, nPointsNodal> inputNodalZ{fTargetZ, fTargetZ + zStep, fTargetZ + 2. * zStep}; - std::array<ca::FieldValueV, nPointsNodal> B{}; + std::array<ca::FieldValue<fvec>, nPointsNodal> B{}; std::array<fvec, nPointsNodal> z{}; // loop over nodal points for (int idx = 0; idx < nPointsNodal; ++idx) { @@ -468,7 +468,7 @@ void InitManager::SetTargetPosition(double x, double y, double z) // ---------------------------------------------------------------------------------------------------------------------- // -Parameters&& InitManager::TakeParameters() { return std::move(fParameters); } +Parameters<fvec>&& InitManager::TakeParameters() { return std::move(fParameters); } // ---------------------------------------------------------------------------------------------------------------------- // diff --git a/algo/ca/core/pars/CaInitManager.h b/algo/ca/core/pars/CaInitManager.h index 8fc4d01785d2e544265051383c90b68f6da548eb..131e1fc69e37d5e4c36719ec62bfe46e45eaf9e4 100644 --- a/algo/ca/core/pars/CaInitManager.h +++ b/algo/ca/core/pars/CaInitManager.h @@ -261,7 +261,7 @@ namespace cbm::algo::ca /// \brief Takes parameters object from the init-manager instance /// \return A parameter object - Parameters&& TakeParameters(); + Parameters<fvec>&& TakeParameters(); /// \brief Writes parameters object from boost-serialized binary file /// \param fileName Name of input file @@ -321,7 +321,7 @@ namespace cbm::algo::ca // TODO: remove int fCAIterationsNumberCrosscheck{-1}; ///< Number of iterations to be passed (must be used for cross-checks) - Parameters fParameters{}; ///< CA parameters object + Parameters<fvec> fParameters{}; ///< CA parameters object std::string fsConfigInputMain = ""; ///< name for the input configuration file std::string fsConfigInputUser = ""; ///< name for the input configuration file diff --git a/algo/ca/core/pars/CaParameters.cxx b/algo/ca/core/pars/CaParameters.cxx index a6658f206d0f19f7ba0fbaf5a64951c29ef3fd14..aa1e70ec9353b5d78942cad114d07f30388e3ac4 100644 --- a/algo/ca/core/pars/CaParameters.cxx +++ b/algo/ca/core/pars/CaParameters.cxx @@ -21,14 +21,16 @@ using cbm::algo::ca::utils::CheckSimdVectorEquality; // --------------------------------------------------------------------------------------------------------------------- // -Parameters::Parameters() +template<typename DataT> +Parameters<DataT>::Parameters() { fvGeoToActiveMap.fill(-1); // by default, all stations are inactive, thus all the IDs must be -1 } // --------------------------------------------------------------------------------------------------------------------- // -void Parameters::CheckConsistency() const +template<typename DataT> +void Parameters<DataT>::CheckConsistency() const { LOG(info) << "Consistency test for L1 parameters object... "; /* @@ -79,9 +81,10 @@ void Parameters::CheckConsistency() const * In all the cases the fieldStatus flags should be sorted containing all non-zero elements in the beginning * (representing stations placed into magnetic field) and all zero elements in the end of z-axis. */ - bool ifFieldStatusFlagsOk = std::is_sorted( - fStations.cbegin(), fStations.cbegin() + fNstationsActiveTotal, - [&](const ca::StationV& lhs, const ca::StationV& rhs) { return bool(lhs.fieldStatus) > bool(rhs.fieldStatus); }); + bool ifFieldStatusFlagsOk = std::is_sorted(fStations.cbegin(), fStations.cbegin() + fNstationsActiveTotal, + [&](const ca::Station<DataT>& lhs, const ca::Station<DataT>& rhs) { + return bool(lhs.fieldStatus) > bool(rhs.fieldStatus); + }); if (!ifFieldStatusFlagsOk) { std::stringstream msg; @@ -119,10 +122,11 @@ void Parameters::CheckConsistency() const for (int iSt = 0; iSt < fNstationsActiveTotal; ++iSt) { fStations[iSt].CheckConsistency(); - if (fStations[iSt].fZ[0] < fTargetPos[2][0]) { + if (utils::simd::Cast<DataT, float>(fStations[iSt].fZ, 0) < utils::simd::Cast<DataT, float>(fTargetPos[2], 0)) { std::stringstream msg; msg << "L1Parameters: station with global ID = " << iSt << " is placed before target " - << "(z_st = " << fStations[iSt].fZ[0] << " [cm] < z_targ = " << fTargetPos[2][0] << " [cm])"; + << "(z_st = " << utils::simd::Cast<DataT, float>(fStations[iSt].fZ, 0) + << " [cm] < z_targ = " << utils::simd::Cast<DataT, float>(fTargetPos[2], 0) << " [cm])"; throw std::logic_error(msg.str()); } } @@ -198,7 +202,8 @@ void Parameters::CheckConsistency() const // --------------------------------------------------------------------------------------------------------------------- // -int Parameters::GetNstationsActive(EDetectorID detectorID) const +template<typename DataT> +int Parameters<DataT>::GetNstationsActive(EDetectorID detectorID) const { int nStations = 0; for (int iStLoc = 0; iStLoc < this->GetNstationsGeometry(detectorID); ++iStLoc) { @@ -212,11 +217,16 @@ int Parameters::GetNstationsActive(EDetectorID detectorID) const // --------------------------------------------------------------------------------------------------------------------- // -void Parameters::Print(int /*verbosityLevel*/) const { LOG(info) << ToString(); } +template<typename DataT> +void Parameters<DataT>::Print(int /*verbosityLevel*/) const +{ + LOG(info) << ToString(); +} // --------------------------------------------------------------------------------------------------------------------- // -std::string Parameters::ToString(int verbosity, int indentLevel) const +template<typename DataT> +std::string Parameters<DataT>::ToString(int verbosity, int indentLevel) const { using namespace constants; using std::setfill; @@ -250,7 +260,8 @@ std::string Parameters::ToString(int verbosity, int indentLevel) const msg << indent << indentCh << clrs::CLb << "TARGET:\n" << clrs::CL; msg << indent << indentCh << indentCh << "Position:\n"; for (int dim = 0; dim < 3 /*nDimensions*/; ++dim) { - msg << indent << indentCh << indentCh << indentCh << char(120 + dim) << " = " << fTargetPos[dim][0] << " cm\n"; + msg << indent << indentCh << indentCh << indentCh << char(120 + dim) << " = " + << utils::simd::Cast<DataT, float>(fTargetPos[dim], 0) << " cm\n"; } msg << indent << indentCh << clrs::CLb << "NUMBER OF STATIONS:\n" << clrs::CL; msg << indent << indentCh << indentCh << "Number of stations (Geometry): "; @@ -334,3 +345,10 @@ std::string Parameters::ToString(int verbosity, int indentLevel) const msg << '\n'; return msg.str(); } + +namespace cbm::algo::ca +{ + template class Parameters<fvec>; + template class Parameters<float>; + template class Parameters<double>; +} // namespace cbm::algo::ca diff --git a/algo/ca/core/pars/CaParameters.h b/algo/ca/core/pars/CaParameters.h index 3ec78880913a7bc521e7ae594bcebe5b1c420d5e..74b65e29c0fb603fc9df3ee9c34c6c27aac50269 100644 --- a/algo/ca/core/pars/CaParameters.h +++ b/algo/ca/core/pars/CaParameters.h @@ -34,7 +34,8 @@ namespace cbm::algo::ca /// Type definitions for used containers using IterationsContainer_t = cbm::algo::ca::Vector<cbm::algo::ca::Iteration>; - using StationsContainer_t = std::array<ca::StationV, constants::size::MaxNstations>; + template<typename DataT> + using StationsContainer_t = std::array<ca::Station<DataT>, constants::size::MaxNstations>; using MaterialContainer_t = std::array<ca::MaterialMap, constants::size::MaxNstations>; /// \class cbm::algo::ca::Parameters @@ -43,6 +44,7 @@ namespace cbm::algo::ca /// The class includes geometry parameters and physics cuts. The instance of the Parameters is constructed inside /// the InitManager class and then moved to the L1Algo instance. /// + template<typename DataT> class alignas(constants::misc::Alignment) Parameters { /// \note The init manager is responsible for the formation of the Parameters block friend class InitManager; @@ -61,6 +63,44 @@ namespace cbm::algo::ca /// \brief Copy constructor Parameters(const Parameters& other) = default; + /// \brief Copy constructor with type conversion + template<typename DataIn> + Parameters(const Parameters<DataIn>& other) + : fMaxDoubletsPerSinglet(other.GetMaxDoubletsPerSinglet()) + , fMaxTripletPerDoublets(other.GetMaxTripletPerDoublets()) + , fCAIterations(other.GetCAIterations()) + , fVertexFieldValue(other.GetVertexFieldValue()) + , fVertexFieldRegion(other.GetVertexFieldRegion()) + , fThickMap(other.GetThicknessMaps()) + , fvFirstGeoId(other.GetFirstGeoId()) + , fvLocalToGeoIdMap(other.GetLocalToGeoIdMap()) + , fvGeoToLocalIdMap(other.GetGeoToLocalIdMap()) + , fvGeoToActiveMap(other.GetGeoToActiveMap()) + , fvActiveToGeoMap(other.GetActiveToGeoMap()) + , fNstationsActiveTotal(other.GetNstationsActive()) + , fSearchWindows(other.GetSearchWindows()) + , fGhostSuppression(other.GetGhostSuppression()) + , fRandomSeed(other.GetRandomSeed()) + , fDefaultMass(other.GetDefaultMass()) + , fMisalignmentX(other.GetMisalignmentX()) + , fMisalignmentY(other.GetMisalignmentY()) + , fMisalignmentT(other.GetMisalignmentT()) + , fDevIsIgnoreHitSearchAreas(other.DevIsIgnoreHitSearchAreas()) + , fDevIsUseOfOriginalField(other.DevIsUseOfOriginalField()) + , fDevIsMatchDoubletsViaMc(other.DevIsMatchDoubletsViaMc()) + , fDevIsMatchTripletsViaMc(other.DevIsMatchTripletsViaMc()) + , fDevIsExtendTracksViaMc(other.DevIsExtendTracksViaMc()) + , fDevIsSuppressOverlapHitsViaMc(other.DevIsSuppressOverlapHitsViaMc()) + , fDevIsParSearchWUsed(other.DevIsParSearchWUsed()) + { + fTargetPos[0] = utils::simd::Cast<DataIn, DataT>(other.GetTargetPositionX()); + fTargetPos[1] = utils::simd::Cast<DataIn, DataT>(other.GetTargetPositionY()); + fTargetPos[2] = utils::simd::Cast<DataIn, DataT>(other.GetTargetPositionZ()); + for (size_t i = 0; i < constants::size::MaxNstations; i++) { + fStations[i] = other.GetStation(i); + } + } + /// \brief Copy assignment operator Parameters& operator=(const Parameters& other) = default; @@ -99,6 +139,9 @@ namespace cbm::algo::ca return fvFirstGeoId[static_cast<int>(detectorID) + 1] - fvFirstGeoId[static_cast<int>(detectorID)]; } + /// \brief Provides access to the first index of the station on each particular detector (const) + const std::array<int, constants::size::MaxNdetectors + 1>& GetFirstGeoId() const { return fvFirstGeoId; } + /// \brief Gets local index of station /// \param geoIndex geometry index of the tracking station /// \return A pair (detectorID, local index of the tracking station) @@ -107,6 +150,9 @@ namespace cbm::algo::ca return fvGeoToLocalIdMap[geoIndex]; } + /// \brief Provides access to local indexes of stations (const) + const StationArray_t<std::pair<EDetectorID, int>>& GetGeoToLocalIdMap() const { return fvGeoToLocalIdMap; } + /// \brief Calculates global index of station among geometry (accounts for inactive stations) /// \param localIndex local index of the tracking station (for a particular detector) /// \param detectorID ID of the detector subsystem @@ -118,6 +164,9 @@ namespace cbm::algo::ca return fvLocalToGeoIdMap[fvFirstGeoId[static_cast<int>(detectorID)] + localIndex]; } + /// \brief Provides access to global indexes of stations among geometry (const) + const StationArray_t<int>& GetLocalToGeoIdMap() const { return fvLocalToGeoIdMap; } + /// \brief Calculates global index of station used by track finder /// \param localIndex local index of the tracking station (for a particular detector) /// \param detectorID ID of the detector subsystem @@ -127,6 +176,12 @@ namespace cbm::algo::ca return (geoIndex < 0) ? -1 : fvGeoToActiveMap[geoIndex]; } + /// \brief Provides access to global indexes of stations used by track finder (const) + const StationArray_t<int>& GetGeoToActiveMap() const { return fvGeoToActiveMap; } + + /// \brief Provides access to the map of active to geo station indices (const) + const StationArray_t<int>& GetActiveToGeoMap() const { return fvActiveToGeoMap; } + /// \brief Provides access to L1CAIteration vector (const) const IterationsContainer_t& GetCAIterations() const { return fCAIterations; } @@ -134,11 +189,11 @@ namespace cbm::algo::ca int GetNcaIterations() const { return fCAIterations.size(); } /// \brief Provides access to L1Stations container (const) - const StationsContainer_t& GetStations() const { return fStations; } + const StationsContainer_t<DataT>& GetStations() const { return fStations; } /// \brief Gets reference to the particular station /// \param iStation Index of station in the active stations container - const StationV& GetStation(int iStation) const { return fStations[iStation]; } + const Station<DataT>& GetStation(int iStation) const { return fStations[iStation]; } /// \brief Gets a search window for a selected station and track group /// \note For a particular track finder iteration one can select a track group, which is defined by the minimal @@ -153,6 +208,13 @@ namespace cbm::algo::ca return fSearchWindows[iTrackGr * constants::size::MaxNstations + iStation]; } + /// \brief Provides access to the map of search windows vs. active station global index and tracks group (const) + const std::array<SearchWindow, constants::size::MaxNstations * constants::size::MaxNtrackGroups>& + GetSearchWindows() const + { + return fSearchWindows; + } + /// \brief Gets reference to the array of station thickness map const MaterialContainer_t& GetThicknessMaps() const { return fThickMap; } @@ -166,6 +228,18 @@ namespace cbm::algo::ca } /// \brief Gets material thickness in units of radiation length in a point on the XY plane for a selected station + /// Common implementation for non-SIMD operations + /// \param iStActive Global index of an active station + /// \param xPos Position of the point in X dimension [cm] (SIMDized vector) + /// \param yPos Position of the point in Y dimension [cm] (SIMDized vector) + template<typename T> + T GetMaterialThickness(int iStActive, T xPos, T yPos) const + { + return fThickMap[iStActive].GetRadThickScal(xPos, yPos); + } + + /// \brief Gets material thickness in units of radiation length in a point on the XY plane for a selected station + /// Specific implementation for SIMD operations /// \param iStActive Global index of an active station /// \param xPos Position of the point in X dimension [cm] (SIMDized vector) /// \param yPos Position of the point in Y dimension [cm] (SIMDized vector) @@ -175,19 +249,19 @@ namespace cbm::algo::ca } /// \brief Gets X component of target position - fvec GetTargetPositionX() const { return fTargetPos[0]; } + DataT GetTargetPositionX() const { return fTargetPos[0]; } /// \brief Gets Y component of target position - fvec GetTargetPositionY() const { return fTargetPos[1]; } + DataT GetTargetPositionY() const { return fTargetPos[1]; } /// \brief Gets Z component of target position - fvec GetTargetPositionZ() const { return fTargetPos[2]; } + DataT GetTargetPositionZ() const { return fTargetPos[2]; } /// \brief Gets ca::FieldRegion object at primary vertex - const FieldRegionV& GetVertexFieldRegion() const { return fVertexFieldRegion; } + const FieldRegion<DataT>& GetVertexFieldRegion() const { return fVertexFieldRegion; } /// \brief Gets ca::FieldValue object at primary vertex - const FieldValueV& GetVertexFieldValue() const { return fVertexFieldValue; } + const FieldValue<DataT>& GetVertexFieldValue() const { return fVertexFieldValue; } /// \brief Gets random seed /// @@ -222,6 +296,15 @@ namespace cbm::algo::ca return fMisalignmentT[iDet] * fMisalignmentT[iDet]; } + /// \brief Provides access to the misalignment of the detector systems in X + const std::array<float, constants::size::MaxNdetectors> GetMisalignmentX() const { return fMisalignmentX; } + + /// \brief Provides access to the misalignment of the detector systems in Y + const std::array<float, constants::size::MaxNdetectors> GetMisalignmentY() const { return fMisalignmentY; } + + /// \brief Provides access to the misalignment of the detector systems in Time + const std::array<float, constants::size::MaxNdetectors> GetMisalignmentT() const { return fMisalignmentT; } + /// \brief Class invariant checker void CheckConsistency() const; @@ -247,6 +330,8 @@ namespace cbm::algo::ca /// \brief Flag to match hits in overlaps using Mc information bool DevIsSuppressOverlapHitsViaMc() const { return fDevIsSuppressOverlapHitsViaMc; } + bool DevIsParSearchWUsed() const { return fDevIsParSearchWUsed; } + private: unsigned int fMaxDoubletsPerSinglet{150}; ///< Upper-bound cut on max number of doublets per one singlet unsigned int fMaxTripletPerDoublets{15}; ///< Upper-bound cut on max number of triplets per one doublet @@ -257,16 +342,16 @@ namespace cbm::algo::ca ** Geometry parameters ** *************************/ /// \brief Target position - alignas(constants::misc::Alignment) std::array<fvec, 3> fTargetPos{Undef<float>, Undef<float>, Undef<float>}; + alignas(constants::misc::Alignment) std::array<DataT, 3> fTargetPos{Undef<float>, Undef<float>, Undef<float>}; /// Field value object at primary vertex (between target and the first station) - alignas(constants::misc::Alignment) ca::FieldValueV fVertexFieldValue{}; + alignas(constants::misc::Alignment) ca::FieldValue<DataT> fVertexFieldValue{}; /// Field region object at primary vertex (between target and the first station) - alignas(constants::misc::Alignment) ca::FieldRegionV fVertexFieldRegion{}; + alignas(constants::misc::Alignment) ca::FieldRegion<DataT> fVertexFieldRegion{}; /// Array of stations - alignas(constants::misc::Alignment) StationsContainer_t fStations{}; + alignas(constants::misc::Alignment) StationsContainer_t<DataT> fStations{}; /// Array of station thickness map alignas(constants::misc::Alignment) MaterialContainer_t fThickMap{}; diff --git a/algo/ca/core/pars/CaStation.h b/algo/ca/core/pars/CaStation.h index a694f2cdd53b8fd4b01abc7f2127c0980c159e98..a12684de92bb7a2fcb047c45588e628891a52a6d 100644 --- a/algo/ca/core/pars/CaStation.h +++ b/algo/ca/core/pars/CaStation.h @@ -118,32 +118,4 @@ namespace cbm::algo::ca } _fvecalignment; - class StationV : public Station<fvec> { - using Station<fvec>::Station; /// inherit all the constructors - - public: - template<typename DataIn> - StationV(const Station<DataIn>& other) : Station<fvec>(other) - { - } - }; - class StationF : public Station<float> { - using Station<float>::Station; /// inherit all the constructors - - public: - template<typename DataIn> - StationF(const Station<DataIn>& other) : Station<float>(other) - { - } - }; - class StationD : public Station<double> { - using Station<double>::Station; /// inherit all the constructors - - public: - template<typename DataIn> - StationD(const Station<DataIn>& other) : Station<double>(other) - { - } - }; - } // namespace cbm::algo::ca diff --git a/algo/ca/core/pars/CaStationInitializer.cxx b/algo/ca/core/pars/CaStationInitializer.cxx index 691fa04968db83f204175c7c969fdec72c7b5708..ff18c0652a4c47f5aec78900c26003b37cb47594 100644 --- a/algo/ca/core/pars/CaStationInitializer.cxx +++ b/algo/ca/core/pars/CaStationInitializer.cxx @@ -18,9 +18,10 @@ #include <utility> using cbm::algo::ca::EDetectorID; +using cbm::algo::ca::fvec; using cbm::algo::ca::MaterialMap; +using cbm::algo::ca::Station; using cbm::algo::ca::StationInitializer; -using cbm::algo::ca::StationV; // --------------------------------------------------------------------------------------------------------------------- // @@ -42,7 +43,7 @@ void StationInitializer::Reset() // --------------------------------------------------------------------------------------------------------------------- // -const StationV& StationInitializer::GetStation() const +const Station<fvec>& StationInitializer::GetStation() const { if (!fInitController.IsFinalized()) { std::stringstream msg; diff --git a/algo/ca/core/pars/CaStationInitializer.h b/algo/ca/core/pars/CaStationInitializer.h index e1bf423d4827bbe61978061c370545ac1f83aa1e..5cf515bc8ff7f51ac5fbb060cc8434ff78c03dc1 100644 --- a/algo/ca/core/pars/CaStationInitializer.h +++ b/algo/ca/core/pars/CaStationInitializer.h @@ -101,7 +101,7 @@ namespace cbm::algo::ca const InitController_t& GetInitController() const { return fInitController; } /// \brief Gets a reference to ca::Station info field of the L1BaseStation info - const StationV& GetStation() const; + const Station<fvec>& GetStation() const; /// \brief Gets a reference to ca::MaterialMap map const MaterialMap& GetMaterialMap() const; @@ -206,7 +206,7 @@ namespace cbm::algo::ca double fZref{0}; ///< reference z double fZmin{0}; ///< min z double fZmax{0}; ///< max z - StationV fStation{}; ///< ca::Station structure, describes a station in L1Algo + Station<fvec> fStation{}; ///< ca::Station structure, describes a station in L1Algo MaterialMap fThicknessMap{}; ///< Map of station thickness in units of radiation length InitController_t fInitController{}; ///< Class fileds initialization flags ManagementFlags_t fManagementFlags{}; ///< bitset flags to manage internal behaviour of the class diff --git a/algo/ca/core/tracking/CaCloneMerger.cxx b/algo/ca/core/tracking/CaCloneMerger.cxx index 28bae59f2ca0de08b02b551e5b3e5dc744383b7d..53c1eba4bf35de44e949d62a923f766ac7e58e4b 100644 --- a/algo/ca/core/tracking/CaCloneMerger.cxx +++ b/algo/ca/core/tracking/CaCloneMerger.cxx @@ -89,8 +89,8 @@ void CloneMerger::Exec(Vector<Track>& extTracks, Vector<ca::HitIndex_t>& extReco TrackParamV& Tb = fitB.Tr(); TrackParamV& Tf = fitF.Tr(); - ca::FieldValueV fBm, fBb, fBf _fvecalignment; - ca::FieldRegionV fld _fvecalignment; + ca::FieldValue<fvec> fBm, fBb, fBf _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; // Max length for merging unsigned char maxLengthForMerge = static_cast<unsigned char>(frAlgo.GetParameters().GetNstationsActive() - 3); diff --git a/algo/ca/core/tracking/CaFramework.cxx b/algo/ca/core/tracking/CaFramework.cxx index 0bc41352f2afe3f443562103455be353c369e51f..f89059733a3f5f816fc828d273351a418bac728c 100644 --- a/algo/ca/core/tracking/CaFramework.cxx +++ b/algo/ca/core/tracking/CaFramework.cxx @@ -44,7 +44,7 @@ void Framework::ReceiveInputData(InputData&& inputData) // --------------------------------------------------------------------------------------------------------------------- // -void Framework::ReceiveParameters(Parameters&& parameters) +void Framework::ReceiveParameters(Parameters<fvec>&& parameters) { fParameters = std::move(parameters); @@ -56,10 +56,11 @@ void Framework::ReceiveParameters(Parameters&& parameters) fNfieldStations = std::lower_bound(fParameters.GetStations().cbegin(), fParameters.GetStations().cbegin() + fParameters.GetNstationsActive(), 0, // we are looking for the first zero element - [](const ca::StationV& s, int edge) { return bool(s.fieldStatus) > edge; }) + [](const ca::Station<fvec>& s, int edge) { return bool(s.fieldStatus) > edge; }) - fParameters.GetStations().cbegin(); - ca::FieldRegionV::ForceUseOfOriginalField(fParameters.DevIsUseOfOriginalField()); + + ca::FieldRegion<fvec>::ForceUseOfOriginalField(fParameters.DevIsUseOfOriginalField()); } int Framework::GetMcTrackIdForCaHit(int /*iHit*/) const diff --git a/algo/ca/core/tracking/CaFramework.h b/algo/ca/core/tracking/CaFramework.h index b3e0e8d86ddb2590dc2c4386c32c0eeb53a0a2a1..66ea7f788e4497849a793fa60a3b0a1684027aea 100644 --- a/algo/ca/core/tracking/CaFramework.h +++ b/algo/ca/core/tracking/CaFramework.h @@ -53,7 +53,7 @@ namespace cbm::algo::ca // ** Types definition (global) ** // ******************************* - using CaStationsArray_t = std::array<ca::StationV, constants::size::MaxNstations>; + using CaStationsArray_t = std::array<ca::Station<fvec>, constants::size::MaxNstations>; using CaMaterialArray_t = std::array<ca::MaterialMap, constants::size::MaxNstations>; using Tindex = int; // TODO: Replace with ca::HitIndex_t, if suitable @@ -132,17 +132,17 @@ namespace cbm::algo::ca /// Sets Framework parameters object /// \param other - reference to the Parameters object - void SetParameters(const Parameters& other) { fParameters = other; } + void SetParameters(const Parameters<fvec>& other) { fParameters = other; } // TODO: remove it (S.Zharko) /// Gets a pointer to the Framework parameters object - const Parameters& GetParameters() const { return fParameters; } + const Parameters<fvec>& GetParameters() const { return fParameters; } /// Receives input data void ReceiveInputData(InputData&& inputData); /// Receives tracking parameters - void ReceiveParameters(Parameters&& parameters); + void ReceiveParameters(Parameters<fvec>&& parameters); /// Gets pointer to input data object for external access const InputData& GetInputData() const { return fInputData; } @@ -210,7 +210,7 @@ namespace cbm::algo::ca // ** Member variables list ** // *************************** - Parameters fParameters; ///< Object of Framework parameters class + Parameters<fvec> fParameters; ///< Object of Framework parameters class InputData fInputData; ///< Tracking input data Vector<unsigned char> fvHitKeyFlags{ @@ -318,7 +318,7 @@ namespace cbm::algo::ca bool fIsTargetField{false}; ///< is the magnetic field present at the target - ca::FieldValueV fTargB _fvecalignment{}; // field in the target point (modifiable, do not touch!!) + ca::FieldValue<fvec> fTargB _fvecalignment{}; // field in the target point (modifiable, do not touch!!) ca::MeasurementXy<fvec> TargetMeasurement _fvecalignment{}; // target constraint [cm] } _fvecalignment; diff --git a/algo/ca/core/tracking/CaTrackExtender.cxx b/algo/ca/core/tracking/CaTrackExtender.cxx index 8b04c4a2548c40371185b53920fa742be955dc6b..8c7f292b1abd2d0175484d5f5c2a9eb9b6642969 100644 --- a/algo/ca/core/tracking/CaTrackExtender.cxx +++ b/algo/ca/core/tracking/CaTrackExtender.cxx @@ -61,9 +61,9 @@ void TrackExtender::FitBranchFast(const ca::Branch& t, TrackParamV& Tout, const int ista1 = hit1.Station(); int ista2 = hit2.Station(); - const ca::StationV& sta0 = frAlgo.GetParameters().GetStation(ista0); - const ca::StationV& sta1 = frAlgo.GetParameters().GetStation(ista1); - const ca::StationV& sta2 = frAlgo.GetParameters().GetStation(ista2); + const ca::Station<fvec>& sta0 = frAlgo.GetParameters().GetStation(ista0); + const ca::Station<fvec>& sta1 = frAlgo.GetParameters().GetStation(ista1); + const ca::Station<fvec>& sta2 = frAlgo.GetParameters().GetStation(ista2); fvec x0 = hit0.X(); fvec y0 = hit0.Y(); @@ -98,7 +98,7 @@ void TrackExtender::FitBranchFast(const ca::Branch& t, TrackParamV& Tout, const T.C10() = hit0.dXY(); T.C11() = hit0.dY2(); - ca::FieldRegionV fld _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; fvec fldZ0 = sta1.fZ; // suppose field is smoth fvec fldZ1 = sta2.fZ; fvec fldZ2 = sta0.fZ; @@ -113,7 +113,7 @@ void TrackExtender::FitBranchFast(const ca::Branch& t, TrackParamV& Tout, const for (int i = iFirstHit + step; step * i <= step * iLastHit; i += step) { const ca::Hit& hit = frAlgo.GetInputData().GetHit(hits[i]); int ista = hit.Station(); - const ca::StationV& sta = frAlgo.GetParameters().GetStation(ista); + const ca::Station<fvec>& sta = frAlgo.GetParameters().GetStation(ista); fit.Extrapolate(hit.Z(), fld); fit.FilterHit(sta, hit); @@ -168,9 +168,9 @@ void TrackExtender::FindMoreHits(ca::Branch& t, TrackParamV& Tout, const bool up const int ista1 = hit1.Station(); const int ista2 = hit2.Station(); - const ca::StationV& sta0 = frAlgo.GetParameters().GetStation(ista0); - const ca::StationV& sta1 = frAlgo.GetParameters().GetStation(ista1); - const ca::StationV& sta2 = frAlgo.GetParameters().GetStation(ista2); + const ca::Station<fvec>& sta0 = frAlgo.GetParameters().GetStation(ista0); + const ca::Station<fvec>& sta1 = frAlgo.GetParameters().GetStation(ista1); + const ca::Station<fvec>& sta2 = frAlgo.GetParameters().GetStation(ista2); fvec x0 = hit0.X(); fvec y0 = hit0.Y(); @@ -181,7 +181,7 @@ void TrackExtender::FindMoreHits(ca::Branch& t, TrackParamV& Tout, const bool up fvec x2 = hit2.X(); fvec y2 = hit2.Y(); - ca::FieldRegionV fld _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; fvec fldZ0 = sta1.fZ; fvec fldZ1 = sta2.fZ; fvec fldZ2 = sta0.fZ; @@ -200,7 +200,7 @@ void TrackExtender::FindMoreHits(ca::Branch& t, TrackParamV& Tout, const bool up for (; (ista < frAlgo.GetParameters().GetNstationsActive()) && (ista >= 0); ista += step) { // CHECKME why ista2? - const ca::StationV& sta = frAlgo.GetParameters().GetStation(ista); + const ca::Station<fvec>& sta = frAlgo.GetParameters().GetStation(ista); fit.Extrapolate(sta.fZ, fld); diff --git a/algo/ca/core/tracking/CaTrackFinder.cxx b/algo/ca/core/tracking/CaTrackFinder.cxx index edc473faac33ce083b3fce353f625ddb7be336b6..7ee4c05c8ca1061dfbb4b6f925a5d293c5b7a863 100644 --- a/algo/ca/core/tracking/CaTrackFinder.cxx +++ b/algo/ca/core/tracking/CaTrackFinder.cxx @@ -104,7 +104,7 @@ void TrackFinder::FindTracks() ca::HitIndex_t caHitId = frAlgo.fInputData.GetStreamStartIndex(iStream) + ih; const ca::Hit& h = frAlgo.fInputData.GetHit(caHitId); - const ca::StationV& st = frAlgo.GetParameters().GetStation(h.Station()); + const ca::Station<fvec>& st = frAlgo.GetParameters().GetStation(h.Station()); fscal dx = h.X() - targX; fscal dy = h.Y() - targY; diff --git a/algo/ca/core/tracking/CaTrackFit.cxx b/algo/ca/core/tracking/CaTrackFit.cxx index 136c47d422eaa226d22789f5d5e7460dece11d6a..b39fa3b7031bdb04c1041c34357ae4f724b9a051 100644 --- a/algo/ca/core/tracking/CaTrackFit.cxx +++ b/algo/ca/core/tracking/CaTrackFit.cxx @@ -317,7 +317,7 @@ namespace cbm::algo::ca fTr.C66() -= K60 * F60 + K61 * F61; } - void TrackFit::FilterHit(const ca::StationV& sta, const ca::Hit& hit) + void TrackFit::FilterHit(const ca::Station<fvec>& sta, const ca::Hit& hit) { ca::MeasurementXy<fvec> m; m.SetDx2(hit.dX2()); @@ -599,7 +599,7 @@ namespace cbm::algo::ca void TrackFit::Extrapolate // extrapolates track parameters and returns jacobian for extrapolation of CovMatrix (fvec z_out, // extrapolate to this z position - const ca::FieldRegionV& F) + const ca::FieldRegion<fvec>& F) { // use Q/p linearisation at fQp0 @@ -613,7 +613,7 @@ namespace cbm::algo::ca void TrackFit::ExtrapolateStep // extrapolates track parameters and returns jacobian for extrapolation of CovMatrix (fvec zOut, // extrapolate to this z position - const ca::FieldRegionV& Field) + const ca::FieldRegion<fvec>& Field) { // use Q/p linearisation at fQp0 // implementation of the Runge-Kutta method without optimization @@ -809,7 +809,7 @@ namespace cbm::algo::ca } - void TrackFit::ExtrapolateLine(fvec z_out, const ca::FieldRegionV& F) + void TrackFit::ExtrapolateLine(fvec z_out, const ca::FieldRegion<fvec>& F) { // extrapolate the track assuming fQp0 == 0 // TODO: write special simplified procedure @@ -1040,7 +1040,7 @@ namespace cbm::algo::ca } - void TrackFit::GetExtrapolatedXYline(fvec z, const ca::FieldRegionV& F, fvec& extrX, fvec& extrY, + void TrackFit::GetExtrapolatedXYline(fvec z, const ca::FieldRegion<fvec>& F, fvec& extrX, fvec& extrY, std::array<fvec, ca::TrackParamV::kNtrackParam>& Jx, std::array<fvec, ca::TrackParamV::kNtrackParam>& Jy) const { @@ -1094,7 +1094,8 @@ namespace cbm::algo::ca } - void TrackFit::FilterWithTargetAtLine(fvec targZ, const ca::MeasurementXy<fvec>& targXY, const ca::FieldRegionV& F) + void TrackFit::FilterWithTargetAtLine(fvec targZ, const ca::MeasurementXy<fvec>& targXY, + const ca::FieldRegion<fvec>& F) { // Add the target constraint to a straight line track diff --git a/algo/ca/core/tracking/CaTrackFit.h b/algo/ca/core/tracking/CaTrackFit.h index 61950cb662891957fe3f58695abca97fe4f7dd12..b9c9b5f1e77f3505a41a05808fa8534b541b5307 100644 --- a/algo/ca/core/tracking/CaTrackFit.h +++ b/algo/ca/core/tracking/CaTrackFit.h @@ -27,7 +27,8 @@ namespace cbm::algo::ca } // namespace class Hit; - class StationV; + template<typename DataT> + class Station; /// Track fit utilities for the CA tracking based on the Kalman Filter @@ -105,7 +106,7 @@ namespace cbm::algo::ca void FilterTime(MeasurementTime<fvec> mt) { FilterTime(mt.T(), mt.Dt2(), mt.NdfT()); } /// filter the track with the hit - void FilterHit(const ca::StationV& s, const ca::Hit& h); + void FilterHit(const ca::Station<fvec>& s, const ca::Hit& h); /// filter the inverse speed void FilterVi(fvec vi); @@ -117,14 +118,14 @@ namespace cbm::algo::ca /// it can do several extrapolation steps if the Z is far away /// \param z - Z coordinate to extrapolate to /// \param F - field region - void Extrapolate(fvec z, const ca::FieldRegionV& F); + void Extrapolate(fvec z, const ca::FieldRegion<fvec>& F); /// extrapolate the track to the given Z using the field F /// it does extrapolation in one step - void ExtrapolateStep(fvec z_out, const ca::FieldRegionV& F); + void ExtrapolateStep(fvec z_out, const ca::FieldRegion<fvec>& F); /// extrapolate the track to the given Z using linearization at the straight line - void ExtrapolateLine(fvec z_out, const ca::FieldRegionV& F); + void ExtrapolateLine(fvec z_out, const ca::FieldRegion<fvec>& F); /// extrapolate the track to the given Z assuming no magnetic field void ExtrapolateLineNoField(fvec z_out); @@ -159,7 +160,7 @@ namespace cbm::algo::ca /// special utilities needed by the combinatorial track finder /// extrapolate track as a line, return the extrapolated X, Y and the Jacobians - void GetExtrapolatedXYline(fvec z, const ca::FieldRegionV& F, fvec& extrX, fvec& extrY, + void GetExtrapolatedXYline(fvec z, const ca::FieldRegion<fvec>& F, fvec& extrX, fvec& extrY, std::array<fvec, ca::TrackParamV::kNtrackParam>& Jx, std::array<fvec, ca::TrackParamV::kNtrackParam>& Jy) const; @@ -189,7 +190,7 @@ namespace cbm::algo::ca fvec ExtrapolateLineDxy(fvec z_out) const; /// add target measuremet to the track using linearisation at a straight line - void FilterWithTargetAtLine(fvec targZ, const ca::MeasurementXy<fvec>& targXYInfo, const ca::FieldRegionV& F); + void FilterWithTargetAtLine(fvec targZ, const ca::MeasurementXy<fvec>& targXYInfo, const ca::FieldRegion<fvec>& F); /// \brief Approximate mean energy loss with Bethe-Bloch formula /// \param bg2 (beta*gamma)^2 diff --git a/algo/ca/core/tracking/CaTrackFitter.cxx b/algo/ca/core/tracking/CaTrackFitter.cxx index b85f1cfaf58547efd1fa5fc8408fb6de9d099dc4..f58e2ef8ac786261d66f1e1a3e8efcbdf5f1c46f 100644 --- a/algo/ca/core/tracking/CaTrackFitter.cxx +++ b/algo/ca/core/tracking/CaTrackFitter.cxx @@ -37,12 +37,12 @@ void TrackFitter::FitCaTracks() // static ca::FieldValue fldB0, fldB1, fldB2 _fvecalignment; // static ca::FieldRegion fld _fvecalignment; - ca::FieldValueV fldB0, fldB1, fldB2 _fvecalignment; - ca::FieldRegionV fld _fvecalignment; + ca::FieldValue<fvec> fldB0, fldB1, fldB2 _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; - ca::FieldValueV fldB01, fldB11, fldB21 _fvecalignment; - ca::FieldRegionV fld1 _fvecalignment; + ca::FieldValue<fvec> fldB01, fldB11, fldB21 _fvecalignment; + ca::FieldRegion<fvec> fld1 _fvecalignment; const int nStations = frAlgo.GetParameters().GetNstationsActive(); int nTracks_SIMD = fvec::size(); @@ -54,7 +54,7 @@ void TrackFitter::FitCaTracks() Track* t[fvec::size()]{nullptr}; - const ca::StationV* sta = frAlgo.GetParameters().GetStations().begin(); + const ca::Station<fvec>* sta = frAlgo.GetParameters().GetStations().begin(); // Spatial-time position of a hit vs. station and track in the portion @@ -95,7 +95,7 @@ void TrackFitter::FitCaTracks() fvec z_start; fvec z_end; - ca::FieldValueV fB[constants::size::MaxNstations], fB_temp _fvecalignment; + ca::FieldValue<fvec> fB[constants::size::MaxNstations], fB_temp _fvecalignment; fvec ZSta[constants::size::MaxNstations]; @@ -200,7 +200,7 @@ void TrackFitter::FitCaTracks() for (int ih = nHitsTrack - 1; ih >= 0; ih--) { const int ista = iSta[ih]; - const ca::StationV& st = frAlgo.GetParameters().GetStation(ista); + const ca::Station<fvec>& st = frAlgo.GetParameters().GetStation(ista); By[ista][iVec] = st.fieldSlice.cy[0][0]; } } @@ -287,7 +287,7 @@ void TrackFitter::FitCaTracks() vtxInfo.SetDy2(1.e-8); if (ca::Framework::TrackingMode::kGlobal == frAlgo.fTrackingMode) { - ca::FieldRegionV fldFull _fvecalignment; + ca::FieldRegion<fvec> fldFull _fvecalignment; fldFull.SetUseOriginalField(true); fitpv.SetMaxExtrapolationStep(1.); for (int vtxIter = 0; vtxIter < 2; vtxIter++) { diff --git a/algo/ca/core/tracking/CaTripletConstructor.cxx b/algo/ca/core/tracking/CaTripletConstructor.cxx index 4c41eee11eedcd842a535f067e3a95001d433cc3..53ddcc1d9de12c2e57ebdb0fc3b3c5363be69f85 100644 --- a/algo/ca/core/tracking/CaTripletConstructor.cxx +++ b/algo/ca/core/tracking/CaTripletConstructor.cxx @@ -105,8 +105,8 @@ void TripletConstructor::CreateTripletsForHit(int istal, int istam, int istar, c fFit.SetQp0(fAlgo->fMaxInvMom); - ca::FieldValueV lB, mB, cB, rB _fvecalignment; - ca::FieldValueV l_B_global, centB_global _fvecalignment; + ca::FieldValue<fvec> lB, mB, cB, rB _fvecalignment; + ca::FieldValue<fvec> l_B_global, centB_global _fvecalignment; // get the magnetic field along the track. // (suppose track is straight line with origin in the target) @@ -150,18 +150,18 @@ void TripletConstructor::CreateTripletsForHit(int istal, int istam, int istar, c // field made by the left hit, the target and the station istac in-between. // is used for extrapolation to the target and to the middle hit - ca::FieldRegionV fld0; + ca::FieldRegion<fvec> fld0; { - ca::FieldValueV B0 = fFld0Sta[0]->fieldSlice.GetFieldValueForLine(T); - ca::FieldValueV B1 = fFld0Sta[1]->fieldSlice.GetFieldValueForLine(T); + ca::FieldValue<fvec> B0 = fFld0Sta[0]->fieldSlice.GetFieldValueForLine(T); + ca::FieldValue<fvec> B1 = fFld0Sta[1]->fieldSlice.GetFieldValueForLine(T); fld0.Set(fAlgo->fTargB, fAlgo->fTargZ, B0, fFld0Sta[0]->fZ, B1, fFld0Sta[1]->fZ); } { // field, made by the left hit, the middle station and the right station // Will be used for extrapolation to the right hit - ca::FieldValueV B0 = fFld1Sta[0]->fieldSlice.GetFieldValueForLine(T); - ca::FieldValueV B1 = fFld1Sta[1]->fieldSlice.GetFieldValueForLine(T); - ca::FieldValueV B2 = fFld1Sta[2]->fieldSlice.GetFieldValueForLine(T); + ca::FieldValue<fvec> B0 = fFld1Sta[0]->fieldSlice.GetFieldValueForLine(T); + ca::FieldValue<fvec> B1 = fFld1Sta[1]->fieldSlice.GetFieldValueForLine(T); + ca::FieldValue<fvec> B2 = fFld1Sta[2]->fieldSlice.GetFieldValueForLine(T); fFldL.Set(B0, fFld1Sta[0]->fZ, B1, fFld1Sta[1]->fZ, B2, fFld1Sta[2]->fZ); } @@ -453,7 +453,7 @@ void TripletConstructor::FitTriplets() // prepare data int ista[NHits] = {fIstaL, fIstaM, fIstaR}; - ca::StationV sta[3]; + ca::Station<fvec> sta[3]; for (int is = 0; is < NHits; ++is) { sta[is] = fAlgo->fParameters.GetStation(ista[is]); }; @@ -497,9 +497,9 @@ void TripletConstructor::FitTriplets() // find the field along the track - ca::FieldValueV B[3] _fvecalignment; - ca::FieldRegionV fld _fvecalignment; - ca::FieldRegionV fldTarget _fvecalignment; + ca::FieldValue<fvec> B[3] _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; + ca::FieldRegion<fvec> fldTarget _fvecalignment; fvec tx[3] = {(x[1] - x[0]) / (z[1] - z[0]), (x[2] - x[0]) / (z[2] - z[0]), (x[2] - x[1]) / (z[2] - z[1])}; fvec ty[3] = {(y[1] - y[0]) / (z[1] - z[0]), (y[2] - y[0]) / (z[2] - z[0]), (y[2] - y[1]) / (z[2] - z[1])}; @@ -688,7 +688,7 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons collectedHits.clear(); collectedHits.reserve(maxNhits); - const ca::StationV& sta = fAlgo->fParameters.GetStation(iSta); + const ca::Station<fvec>& sta = fAlgo->fParameters.GetStation(iSta); fFit.SetTrack(Tr); TrackParamV& T = fFit.Tr(); diff --git a/algo/ca/core/tracking/CaTripletConstructor.h b/algo/ca/core/tracking/CaTripletConstructor.h index 444a20c7357a580af1ecc97e223334b2c915e887..524aab6f42228aa8d2e969f1e80a8bef9b3c1af3 100644 --- a/algo/ca/core/tracking/CaTripletConstructor.h +++ b/algo/ca/core/tracking/CaTripletConstructor.h @@ -81,11 +81,11 @@ namespace cbm::algo::ca private: /// left station - const ca::StationV& staL() { return *fStaL; } + const ca::Station<fvec>& staL() { return *fStaL; } /// middle station - const ca::StationV& staM() { return *fStaM; } + const ca::Station<fvec>& staM() { return *fStaM; } /// right station - const ca::StationV& staR() { return *fStaR; } + const ca::Station<fvec>& staR() { return *fStaR; } private: bool fIsInitialized{false}; ///< is initialized; @@ -95,16 +95,18 @@ namespace cbm::algo::ca int fIstaM{-1}; ///< middle station index int fIstaR{-1}; ///< right station index - const ca::StationV* fStaL{nullptr}; ///< left station - const ca::StationV* fStaM{nullptr}; ///< mid station - const ca::StationV* fStaR{nullptr}; ///< right station + const ca::Station<fvec>* fStaL{nullptr}; ///< left station + const ca::Station<fvec>* fStaM{nullptr}; ///< mid station + const ca::Station<fvec>* fStaR{nullptr}; ///< right station - const ca::StationV* fFld0Sta[2]; // two stations for approximating the field between the target and the left hit - const ca::StationV* fFld1Sta[3]; // three stations for approximating the field between the left and the right hit + const ca::Station<fvec>* + fFld0Sta[2]; // two stations for approximating the field between the target and the left hit + const ca::Station<fvec>* + fFld1Sta[3]; // three stations for approximating the field between the left and the right hit ca::HitIndex_t fIhitL; ///< index of the left hit in fAlgo->fWindowHits TrackParamV fTrL; - ca::FieldRegionV fFldL; + ca::FieldRegion<fvec> fFldL; Vector<ca::HitIndex_t> fHitsM_2{"TripletConstructor::fHitsM_2"}; Vector<TrackParamV> fTracks_2{"TripletConstructor::fTracks_2"}; diff --git a/algo/ca/qa/CaQaBuilder.h b/algo/ca/qa/CaQaBuilder.h index 8b6078aca01fd271ca1c801437d1dd1c96c9cebc..c2fb40ebe40c2a818518f40318434138015f3257 100644 --- a/algo/ca/qa/CaQaBuilder.h +++ b/algo/ca/qa/CaQaBuilder.h @@ -16,6 +16,7 @@ namespace cbm::algo::ca { + template<typename DataT> class Parameters; class InputData; class Track; @@ -73,11 +74,11 @@ namespace cbm::algo::ca::qa /// \brief Registers tracking parameters object /// \note Call per run - void RegisterParameters(const Parameters* pParameters) { fpParameters = pParameters; } + void RegisterParameters(const Parameters<fvec>* pParameters) { fpParameters = pParameters; } private: Config fConfig; ///< QA configuration - const Parameters* fpParameters = nullptr; ///< Pointer to tracking parameters + const Parameters<fvec>* fpParameters = nullptr; ///< Pointer to tracking parameters const Vector<Track>* fpvTracks = nullptr; ///< Pointer to tracks vector const InputData* fpInputData = nullptr; ///< Pointer to input data const Vector<HitIndex_t>* fpvRecoHits = nullptr; ///< Pointer to reco hit indices diff --git a/reco/KF/CbmKfTrackFitter.cxx b/reco/KF/CbmKfTrackFitter.cxx index 770826f5fa3c47dbd9ff9e53f21ffc4d9213d7c1..d86abbb70b5fc25f954a8e38988c332fd27a03f2 100644 --- a/reco/KF/CbmKfTrackFitter.cxx +++ b/reco/KF/CbmKfTrackFitter.cxx @@ -186,7 +186,7 @@ bool CbmKfTrackFitter::CreateGlobalTrack(CbmKfTrackFitter::Track& kfTrack, const return false; } - const ca::Parameters& caPar = CbmL1::Instance()->fpAlgo->GetParameters(); + const ca::Parameters<ca::fvec>& caPar = CbmL1::Instance()->fpAlgo->GetParameters(); int nStations = caPar.GetNstationsActive(); @@ -490,7 +490,7 @@ void CbmKfTrackFitter::FitTrack(CbmKfTrackFitter::Track& t) fFit.SetParticleMass(fMass); t.fIsMsQp0Set = false; - ca::FieldRegionV field _fvecalignment; + ca::FieldRegion<ca::fvec> field _fvecalignment; field.SetUseOriginalField(); int nNodes = t.fNodes.size(); diff --git a/reco/KF/ParticleFitter/CbmL1PFFitter.cxx b/reco/KF/ParticleFitter/CbmL1PFFitter.cxx index d29c56df12530c51783e6f74e55ccc882864b068..1bbbb3f3d27374b41b137a246efb8a3dbacfcbdc 100644 --- a/reco/KF/ParticleFitter/CbmL1PFFitter.cxx +++ b/reco/KF/ParticleFitter/CbmL1PFFitter.cxx @@ -56,7 +56,7 @@ namespace NS_L1TrackFitter using namespace NS_L1TrackFitter; -inline void CbmL1PFFitter::PFFieldRegion::setFromL1FieldRegion(const ca::FieldRegionV& fld, int i) +inline void CbmL1PFFitter::PFFieldRegion::setFromL1FieldRegion(const ca::FieldRegion<fvec>& fld, int i) { fP[0] = fld.cx0[i]; fP[1] = fld.cx1[i]; @@ -73,7 +73,7 @@ inline void CbmL1PFFitter::PFFieldRegion::setFromL1FieldRegion(const ca::FieldRe fP[9] = fld.z0[i]; } -inline void CbmL1PFFitter::PFFieldRegion::getL1FieldRegion(ca::FieldRegionV& fld, int i) +inline void CbmL1PFFitter::PFFieldRegion::getL1FieldRegion(ca::FieldRegion<fvec>& fld, int i) { fld.cx0[i] = fP[0]; fld.cx1[i] = fP[1]; @@ -90,7 +90,10 @@ inline void CbmL1PFFitter::PFFieldRegion::getL1FieldRegion(ca::FieldRegionV& fld fld.z0[i] = fP[9]; } -inline CbmL1PFFitter::PFFieldRegion::PFFieldRegion(const ca::FieldRegionV& fld, int i) { setFromL1FieldRegion(fld, i); } +inline CbmL1PFFitter::PFFieldRegion::PFFieldRegion(const ca::FieldRegion<fvec>& fld, int i) +{ + setFromL1FieldRegion(fld, i); +} CbmL1PFFitter::CbmL1PFFitter() {} @@ -167,8 +170,8 @@ void CbmL1PFFitter::Fit(std::vector<CbmStsTrack>& Tracks, const std::vector<CbmM Initialize(); - ca::FieldValueV b0, b1, b2 _fvecalignment; - ca::FieldRegionV fld _fvecalignment; + ca::FieldValue<fvec> b0, b1, b2 _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; // fld.SetUseOriginalField(); static int nHits = CbmL1::Instance()->fpAlgo->GetParameters().GetNstationsActive(); @@ -182,7 +185,7 @@ void CbmL1PFFitter::Fit(std::vector<CbmStsTrack>& Tracks, const std::vector<CbmM CbmStsTrack* tr[fvec::size()]{nullptr}; int ista; - const ca::StationV* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); + const ca::Station<fvec>* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); fvec x[nHits]; fvec y[nHits]; @@ -198,8 +201,8 @@ void CbmL1PFFitter::Fit(std::vector<CbmStsTrack>& Tracks, const std::vector<CbmM fvec dt2_first, dt2_last; fvec z0, z1, z2, dz, z_start, z_end; - ca::FieldValueV fB[nHits]; - ca::FieldValueV fB_temp _fvecalignment; + ca::FieldValue<fvec> fB[nHits]; + ca::FieldValue<fvec> fB_temp _fvecalignment; unsigned short N_vTracks = Tracks.size(); @@ -508,16 +511,16 @@ void CbmL1PFFitter::GetChiToVertex(vector<CbmStsTrack>& Tracks, vector<PFFieldRe int nStations = fNmvdStationsActive + fNstsStationsActive; - const ca::StationV* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); - fvec* zSta = new fvec[nStations]; + const ca::Station<fvec>* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); + fvec* zSta = new fvec[nStations]; for (int iSta = 0; iSta < nStations; iSta++) { zSta[iSta] = sta[iSta].fZ; } field.reserve(Tracks.size()); - ca::FieldRegionV fld _fvecalignment; - ca::FieldValueV fB[3], fB_temp _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; + ca::FieldValue<fvec> fB[3], fB_temp _fvecalignment; fvec zField[3]; unsigned short N_vTracks = Tracks.size(); @@ -662,7 +665,7 @@ void CbmL1PFFitter::CalculateFieldRegion(vector<CbmStsTrack>& Tracks, vector<PFF field.reserve(Tracks.size()); - ca::FieldRegionV fld _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; int nTracks_SIMD = fvec::size(); TrackParamV T; // fitting parametr coresponding to current track @@ -670,8 +673,8 @@ void CbmL1PFFitter::CalculateFieldRegion(vector<CbmStsTrack>& Tracks, vector<PFF CbmStsTrack* tr[fvec::size()]; int ista; - const ca::StationV* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); - ca::FieldValueV fB[3], fB_temp _fvecalignment; + const ca::Station<fvec>* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); + ca::FieldValue<fvec> fB[3], fB_temp _fvecalignment; fvec zField[3]; unsigned short N_vTracks = Tracks.size(); @@ -744,7 +747,7 @@ void CbmL1PFFitter::CalculateFieldRegionAtLastPoint(vector<CbmStsTrack>& Tracks, field.reserve(Tracks.size()); - ca::FieldRegionV fld _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; int nTracks_SIMD = fvec::size(); TrackParamV T; // fitting parametr coresponding to current track @@ -752,8 +755,8 @@ void CbmL1PFFitter::CalculateFieldRegionAtLastPoint(vector<CbmStsTrack>& Tracks, CbmStsTrack* tr[fvec::size()]; int ista; - const ca::StationV* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); - ca::FieldValueV fB[3], fB_temp _fvecalignment; + const ca::Station<fvec>* sta = CbmL1::Instance()->fpAlgo->GetParameters().GetStations().begin(); + ca::FieldValue<fvec> fB[3], fB_temp _fvecalignment; fvec zField[3]; unsigned short N_vTracks = Tracks.size(); diff --git a/reco/KF/ParticleFitter/CbmL1PFFitter.h b/reco/KF/ParticleFitter/CbmL1PFFitter.h index a7433653925ec4c337e314a7992181d82a28b30d..06e81d6d130b392c179b576c836eedbf6f7cbcfb 100644 --- a/reco/KF/ParticleFitter/CbmL1PFFitter.h +++ b/reco/KF/ParticleFitter/CbmL1PFFitter.h @@ -20,6 +20,8 @@ #ifndef _CbmL1PFFitter_h_ #define _CbmL1PFFitter_h_ +#include "CaSimd.h" + #include <vector> class CbmMvdHit; @@ -27,7 +29,8 @@ class CbmStsHit; class CbmStsTrack; namespace cbm::algo::ca { - class FieldRegionV; + template<typename DataT> + class FieldRegion; } using namespace cbm::algo; @@ -40,9 +43,9 @@ class CbmL1PFFitter { // A container for parameters of ca::FieldRegion struct PFFieldRegion { PFFieldRegion() {} - PFFieldRegion(const ca::FieldRegionV&, int i); - void setFromL1FieldRegion(const ca::FieldRegionV&, int i); - void getL1FieldRegion(ca::FieldRegionV&, int i); + PFFieldRegion(const ca::FieldRegion<ca::fvec>&, int i); + void setFromL1FieldRegion(const ca::FieldRegion<ca::fvec>&, int i); + void getL1FieldRegion(ca::FieldRegion<ca::fvec>&, int i); float fP[10]{0.}; }; diff --git a/reco/L1/CbmCaMCModule.h b/reco/L1/CbmCaMCModule.h index cff89752fc81f97107413e7f5be7bec3f24378b4..526eb622ff1a3878c5831fe4a4f6165bbe206041 100644 --- a/reco/L1/CbmCaMCModule.h +++ b/reco/L1/CbmCaMCModule.h @@ -147,7 +147,7 @@ namespace cbm::ca /// @brief Registers CA parameters object /// @param pParameters A shared pointer to the parameters object - void RegisterParameters(std::shared_ptr<ca::Parameters>& pParameters) { fpParameters = pParameters; } + void RegisterParameters(std::shared_ptr<ca::Parameters<fvec>>& pParameters) { fpParameters = pParameters; } /// @brief Registers debug hit container /// @param vQaHits Reference to debug hit container @@ -228,7 +228,7 @@ namespace cbm::ca int fVerbose = 1; ///< Verbosity level int fPerformanceMode = -1; ///< Mode of performance - std::shared_ptr<ca::Parameters> fpParameters = nullptr; ///< Pointer to tracking parameters object + std::shared_ptr<ca::Parameters<fvec>> fpParameters = nullptr; ///< Pointer to tracking parameters object // ------ Input data branches const CbmTimeSlice* fpTimeSlice = nullptr; ///< Current time slice CbmMCEventList* fpMCEventList = nullptr; ///< MC event list diff --git a/reco/L1/CbmCaTimeSliceReader.cxx b/reco/L1/CbmCaTimeSliceReader.cxx index e83ba5d01ba6f67a7bb49862a7f74df948b8bdc9..6117c8830d1af83cfb2b6ea1626c4cecd71d93cb 100644 --- a/reco/L1/CbmCaTimeSliceReader.cxx +++ b/reco/L1/CbmCaTimeSliceReader.cxx @@ -428,7 +428,7 @@ int cbm::ca::TimeSliceReader::ReadHitsForDetector() // Check if hit values are reasonable { - const ca::StationV& station = fpParameters->GetStation(iStActive); + const ca::Station<fvec>& station = fpParameters->GetStation(iStActive); if (pHit->GetX() < station.GetXmin<fscal>() * 1.2 || pHit->GetX() > station.GetXmax<fscal>() * 1.2 || pHit->GetY() < station.GetYmin<fscal>() * 1.2 || pHit->GetY() > station.GetYmax<fscal>() * 1.2 || fabs(pHit->GetZ() - station.GetZ<fscal>()) > 150) { diff --git a/reco/L1/CbmCaTimeSliceReader.h b/reco/L1/CbmCaTimeSliceReader.h index 6853a1423f0ffb97f36a07516a2002f07316c595..e1dd817b399c8c03c275357a5f65a44420c55a1b 100644 --- a/reco/L1/CbmCaTimeSliceReader.h +++ b/reco/L1/CbmCaTimeSliceReader.h @@ -35,6 +35,7 @@ class CbmTimeSlice; namespace cbm::algo::ca { class DataManager; + template<typename DataT> class Parameters; } // namespace cbm::algo::ca @@ -108,7 +109,7 @@ namespace cbm::ca /// @brief Registers CA parameters object /// @param pParameters A shared pointer to the parameters object - void RegisterParameters(std::shared_ptr<ca::Parameters>& pParameters) { fpParameters = pParameters; } + void RegisterParameters(std::shared_ptr<ca::Parameters<fvec>>& pParameters) { fpParameters = pParameters; } /// @brief Registers the CA IO data manager instance /// @param pIODataManager Shared pointer to the IO data manager instance @@ -184,7 +185,7 @@ namespace cbm::ca ca::Vector<CbmL1HitDebugInfo>* fpvQaHits = nullptr; ///< Pointer to array of debug hits ca::Vector<CbmL1Track>* fpvTracks = nullptr; ///< Pointer to array of reconstructed tracks std::shared_ptr<ca::DataManager> fpIODataManager = nullptr; ///< Pointer to input data manager - std::shared_ptr<ca::Parameters> fpParameters = nullptr; ///< Pointer to tracking parameters object + std::shared_ptr<ca::Parameters<fvec>> fpParameters = nullptr; ///< Pointer to tracking parameters object // Maps of hit indexes: ext -> int DetIdArr_t<std::unordered_map<int, int>> fvmHitExtToIntIndexMap; ///< Hit index map ext -> int diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 85dfd68fb666344d863aedcc276c1c8796dfe326..37921f3ba0b7d0eacc40bafa3faf2d00c6e3cc8c 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -550,7 +550,7 @@ InitStatus CbmL1::Init() // { auto parameters = fInitManager.TakeParameters(); - fpParameters = std::make_shared<ca::Parameters>(parameters); + fpParameters = std::make_shared<ca::Parameters<ca::fvec>>(parameters); fpAlgo->ReceiveParameters(std::move(parameters)); } diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 4f0548dd351d495293dfc6f2f6f8cbddb8f2b471..8bfd589ec32498af00f11b3c9b4c3bdb96e6f896 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -424,7 +424,7 @@ class CbmL1 : public FairTask { std::unique_ptr<cbm::ca::TimeSliceReader> fpTSReader = nullptr; ///< event/TS reader std::unique_ptr<cbm::ca::MCModule> fpMCModule = nullptr; ///< MC module - std::shared_ptr<ca::Parameters> fpParameters = nullptr; ///< External parameters object + std::shared_ptr<ca::Parameters<fvec>> fpParameters = nullptr; ///< External parameters object cbm::ca::tools::MCData fMCData; ///< MC Data object ca::InitManager fInitManager; ///< Tracking parameters data manager diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 1a15402da2426e41dfced6b68e2f16d2e3ed05cf..a14fa56e468519d53abbf1e713f0a54093936303 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -1299,7 +1299,7 @@ void CbmL1::TrackFitPerformance() if (!mc.IsPrimary()) { // secondary { // extrapolate to vertex - ca::FieldRegionV fld _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; fld.SetUseOriginalField(); fit.Extrapolate(mc.GetStartZ(), fld); // add material @@ -1367,7 +1367,7 @@ void CbmL1::TrackFitPerformance() else { // primary { // extrapolate to vertex - ca::FieldRegionV fld _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; fld.SetUseOriginalField(); // add material @@ -1516,7 +1516,7 @@ void CbmL1::FillFitHistos(TrackParamV& track, const cbm::ca::tools::MCPoint& mcP //fit.SetMaxExtrapolationStep(10.); fit.SetDoFitVelocity(true); fit.SetTrack(track); - ca::FieldRegionV fld _fvecalignment; + ca::FieldRegion<fvec> fld _fvecalignment; fld.SetUseOriginalField(); fit.Extrapolate(mcP.GetZOut(), fld); track = fit.Tr(); @@ -1570,7 +1570,7 @@ void CbmL1::FieldApproxCheck() for (int ist = 0; ist < fpAlgo->GetParameters().GetNstationsActive(); ist++) { - const ca::StationV& st = fpAlgo->GetParameters().GetStation(ist); + const ca::Station<fvec>& st = fpAlgo->GetParameters().GetStation(ist); double z = st.fZ[0]; double Xmax = st.Xmax[0]; @@ -1597,8 +1597,8 @@ void CbmL1::FieldApproxCheck() static_cast<int>(NbinsY + 1), -(Ymax + ddy / 2.), (Ymax + ddy / 2.)); Double_t r[3], B[3]; - ca::FieldSliceV FSl; - ca::FieldValueV B_L1; + ca::FieldSlice<fvec> FSl; + ca::FieldValue<fvec> B_L1; Double_t bbb, bbb_L1; const int M = 5; // polinom order diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx index 3321b5fea2abfaab488db4da7e7e3472ca2fb204..fc384e6de3b1737fed82126ece530ea470c191d5 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx @@ -568,7 +568,7 @@ void L1AlgoDraw::DrawInputHits() for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers - ca::StationV& st = vStations[ista]; + ca::Station<ca::fvec>& st = vStations[ista]; Int_t n_poly = 0; Int_t n_poly_fake = 0; for (int ih = HitsStartIndex[ista]; ih < HitsStopIndex[ista]; ih++) { @@ -701,7 +701,7 @@ void L1AlgoDraw::DrawRestHits(ca::HitIndex_t* StsRestHitsStartIndex, ca::HitInde for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers - ca::StationV& st = vStations[ista]; + ca::Station<ca::fvec>& st = vStations[ista]; Int_t n_poly = 0; Int_t n_poly_fake = 0; for (ca::HitIndex_t iRestHit = StsRestHitsStartIndex[ista]; iRestHit < StsRestHitsStopIndex[ista]; iRestHit++) { diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.h b/reco/L1/L1Algo/utils/L1AlgoDraw.h index 881c4f17189e9aed2913c6bcf67858732c4ac01a..4bbfbe7b87a1bec3d0ae64efa258a0b1278b1b4a 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.h +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.h @@ -76,7 +76,7 @@ class L1AlgoDraw { int HitsStopIndex[20]{0}; int NStations{0}; - ca::StationV vStations[20]{}; + ca::Station<ca::fvec> vStations[20]{}; int mcolor[10]{5, 7, 3, 8, 6, 2, 4, 1, 9, 14}; // color for hits on i-station int StaColor{17}; // color for stantions diff --git a/reco/L1/catools/CaToolsField.h b/reco/L1/catools/CaToolsField.h index 765920772cfd17c250d769da8b8dd98b7468a569..374e67effce431920e96f5de8a81a88eb98e404b 100644 --- a/reco/L1/catools/CaToolsField.h +++ b/reco/L1/catools/CaToolsField.h @@ -26,7 +26,7 @@ namespace cbm::ca::tools FairRunAna::Instance()->GetField()->GetFieldValue(pos, B); return std::tuple(B[0], B[1], B[2]); }; - ca::FieldRegionV::SetOriginalField(fld); + ca::FieldRegion<ca::fvec>::SetOriginalField(fld); } } // namespace cbm::ca::tools diff --git a/reco/L1/qa/CbmCaInputQaSetup.cxx b/reco/L1/qa/CbmCaInputQaSetup.cxx index f264ff6f08589476b6d52299df7e62132db19748..e7e20bd8249ace10e9332a72b8d51112b5eeb72c 100644 --- a/reco/L1/qa/CbmCaInputQaSetup.cxx +++ b/reco/L1/qa/CbmCaInputQaSetup.cxx @@ -209,10 +209,9 @@ try { LOG(info) << fName << ": initializing... "; // Tracking parameters { - ca::InitManager manager; manager.ReadParametersObject(fsParametersFilename.c_str()); - fpParameters = std::make_unique<ca::Parameters>(manager.TakeParameters()); + fpParameters = std::make_unique<ca::Parameters<ca::fvec>>(manager.TakeParameters()); LOG(info) << "CA tracking parameters object: " << fsParametersFilename << '\n' << fpParameters->ToString(1); } diff --git a/reco/L1/qa/CbmCaInputQaSetup.h b/reco/L1/qa/CbmCaInputQaSetup.h index e0b06e44df2c0f5dd55581f0e9a557f5e363e48f..112cefd6789587182a991717fa11d9be3991cee7 100644 --- a/reco/L1/qa/CbmCaInputQaSetup.h +++ b/reco/L1/qa/CbmCaInputQaSetup.h @@ -90,7 +90,7 @@ namespace cbm::ca DetIdArr_t<CbmMCDataArray*> fvpBrPoints = {{nullptr}}; ///< Input branch for MC points CbmMCDataObject* fpMCEventHeader = nullptr; ///< Pointer to MC event header - std::unique_ptr<ca::Parameters> fpParameters = nullptr; ///< Pointer to CA parameters object + std::unique_ptr<ca::Parameters<ca::fvec>> fpParameters = nullptr; ///< Pointer to CA parameters object std::string fsParametersFilename = ""; ///< Filename for the tracking parameters DetIdArr_t<std::vector<double>> fvXmin; diff --git a/reco/L1/qa/CbmCaOutputQa.cxx b/reco/L1/qa/CbmCaOutputQa.cxx index a84a66a92b95a09792334063d57dd78c4190a2ff..85f063f98d33924cb947803580e4295a76c277f9 100644 --- a/reco/L1/qa/CbmCaOutputQa.cxx +++ b/reco/L1/qa/CbmCaOutputQa.cxx @@ -1028,7 +1028,7 @@ void OutputQa::ReadParameters(const char* filename) { ca::InitManager manager; manager.ReadParametersObject(filename); - fpParameters = std::make_shared<ca::Parameters>(manager.TakeParameters()); + fpParameters = std::make_shared<ca::Parameters<ca::fvec>>(manager.TakeParameters()); LOG(info) << '\n' << fpParameters->ToString(1); } diff --git a/reco/L1/qa/CbmCaOutputQa.h b/reco/L1/qa/CbmCaOutputQa.h index 79cf1921c3470c3533c210159a2fb7c313bc666d..6b1bdd3b62d6719931a66d32bae492fd0c8c288a 100644 --- a/reco/L1/qa/CbmCaOutputQa.h +++ b/reco/L1/qa/CbmCaOutputQa.h @@ -265,7 +265,7 @@ namespace cbm::ca std::shared_ptr<MCModule> fpMCModule = nullptr; ///< MC module std::shared_ptr<ca::DataManager> fpDataManager = nullptr; ///< Data manager std::shared_ptr<tools::Debugger> fpDebugger = nullptr; ///< Debugger - std::shared_ptr<ca::Parameters> fpParameters = nullptr; ///< Tracking parameters object + std::shared_ptr<ca::Parameters<fvec>> fpParameters = nullptr; ///< Tracking parameters object ca::Vector<CbmL1HitId> fvHitIds{"CbmCaOutputQa::fvHitIds"}; ca::Vector<CbmL1HitDebugInfo> fvHits{"CbmCaOutputQa::fvHits"}; diff --git a/reco/L1/qa/CbmCaTrackFitQa.cxx b/reco/L1/qa/CbmCaTrackFitQa.cxx index 5c4de0006d15fc6bf152a412d9bd690526145fd3..11649c1bd13a96f6ad2056f4b8d91214c9a88083 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.cxx +++ b/reco/L1/qa/CbmCaTrackFitQa.cxx @@ -164,7 +164,7 @@ void TrackFitQa::Fill(const TrackParamV& trPar, const tools::MCPoint& mcPoint, b fitter.SetMask(fmask::One()); fitter.SetDoFitVelocity(true); fitter.SetTrack(trPar); - cbm::algo::ca::FieldRegionV fieldRegion; + cbm::algo::ca::FieldRegion<ca::fvec> fieldRegion; fieldRegion.SetUseOriginalField(); // Precised magnetic field is used fitter.Extrapolate(mcPoint.GetZ(), fieldRegion); diff --git a/reco/L1/qa/CbmCaTrackTypeQa.h b/reco/L1/qa/CbmCaTrackTypeQa.h index 1ebce85fcbdd108ac9731b6adf08b8f832732cab..551ed0b3def18f75ca6aae7cb85845f43f227e8d 100644 --- a/reco/L1/qa/CbmCaTrackTypeQa.h +++ b/reco/L1/qa/CbmCaTrackTypeQa.h @@ -160,7 +160,7 @@ namespace cbm::ca /// @brief Registers CA parameters object /// @param pParameters A shared pointer to the parameters object - void RegisterParameters(std::shared_ptr<ca::Parameters>& pParameters) { fpParameters = pParameters; } + void RegisterParameters(std::shared_ptr<ca::Parameters<ca::fvec>>& pParameters) { fpParameters = pParameters; } /// @brief Sets drawing attributes for histograms /// @param markerCol Marker color @@ -277,7 +277,7 @@ namespace cbm::ca TProfile* fph_stations_hit = nullptr; ///< Average number of stations with hit ca::TrackFit fTrackFit; ///< Track fitter - ca::FieldRegionV fFieldRegion; ///< Magnetic field + ca::FieldRegion<ca::fvec> fFieldRegion; ///< Magnetic field int fCounterMC = 0; ///< Counter of MC tracks int fCounterClones = 0; ///< Counter of clone tracks @@ -293,7 +293,7 @@ namespace cbm::ca ca::Vector<CbmL1Track>* fpvRecoTracks = nullptr; ///< Pointer to vector of reconstructed tracks ca::Vector<CbmL1HitDebugInfo>* fpvHits = nullptr; ///< Pointer to vector of reconstructed hits tools::MCData* fpMCData = nullptr; ///< Pointer to MC data object - std::shared_ptr<ca::Parameters> fpParameters = nullptr; ///< Pointer to parameters object + std::shared_ptr<ca::Parameters<ca::fvec>> fpParameters = nullptr; ///< Pointer to parameters object // ** Cuts on tracks for a given track class ** diff --git a/reco/alignment/CbmBbaAlignmentTask.cxx b/reco/alignment/CbmBbaAlignmentTask.cxx index 90b3ef89d70da2a1015643eefe2ae1131c36d82a..75af1c39247e99b59671247d4d21fdc19b78318d 100644 --- a/reco/alignment/CbmBbaAlignmentTask.cxx +++ b/reco/alignment/CbmBbaAlignmentTask.cxx @@ -153,7 +153,7 @@ InitStatus CbmBbaAlignmentTask::Init() ca::Framework* l1 = CbmL1::Instance()->fpAlgo; - const ca::Parameters& l1Param = l1->GetParameters(); + const ca::Parameters<ca::fvec>& l1Param = l1->GetParameters(); fNalignmentBodies = l1Param.GetNstationsActive(); TDirectory* curDirectory = gDirectory; @@ -187,7 +187,7 @@ void CbmBbaAlignmentTask::Exec(Option_t* /*opt*/) } ca::Framework* l1 = CbmL1::Instance()->fpAlgo; - const ca::Parameters& l1Par = l1->GetParameters(); + const ca::Parameters<ca::fvec>& l1Par = l1->GetParameters(); static int statGlobalTracks = 0; statGlobalTracks += fInputGlobalTracks->GetEntriesFast();