From 82da4b817e46c0a14748cb1900e8defa13f6797f Mon Sep 17 00:00:00 2001 From: "se.gorbunov" <se.gorbunov@gsi.de> Date: Thu, 12 Oct 2023 23:42:07 +0000 Subject: [PATCH] Ca: cleanup headers --- algo/ca/core/data/CaDataManager.h | 4 +--- algo/ca/core/data/CaGrid.h | 4 +--- algo/ca/core/data/CaGridArea.h | 5 +--- algo/ca/core/data/CaGridEntry.h | 4 +--- algo/ca/core/data/CaHit.h | 7 ++---- algo/ca/core/data/CaInputData.h | 5 +--- algo/ca/core/data/CaTrack.h | 5 +--- algo/ca/core/data/CaTrackParam.h | 4 +--- algo/ca/core/pars/CaConfigReader.h | 4 +--- algo/ca/core/pars/CaConstants.h | 5 +--- algo/ca/core/pars/CaField.h | 5 ++-- algo/ca/core/pars/CaInitManager.h | 5 +--- algo/ca/core/pars/CaIteration.h | 6 +---- algo/ca/core/pars/CaMaterialMap.h | 4 +--- algo/ca/core/pars/CaParameters.h | 4 +--- algo/ca/core/pars/CaSearchWindow.h | 5 +--- algo/ca/core/pars/CaStation.h | 5 +--- algo/ca/core/pars/CaStationInitializer.h | 5 +--- algo/ca/core/utils/CaDefines.h | 6 +---- algo/ca/core/utils/CaEnumArray.h | 5 +--- algo/ca/core/utils/CaMonitor.h | 6 ++--- algo/ca/core/utils/CaObjectInitController.h | 5 +--- algo/ca/core/utils/CaSimd.h | 5 +--- algo/ca/core/utils/CaSimdPseudo.h | 5 +--- algo/ca/core/utils/CaSimdVc.h | 6 +---- algo/ca/core/utils/CaUtils.h | 26 +++++---------------- algo/ca/core/utils/CaVector.h | 4 +--- 27 files changed, 35 insertions(+), 119 deletions(-) diff --git a/algo/ca/core/data/CaDataManager.h b/algo/ca/core/data/CaDataManager.h index a95b7383f8..ccf124a53d 100644 --- a/algo/ca/core/data/CaDataManager.h +++ b/algo/ca/core/data/CaDataManager.h @@ -7,8 +7,7 @@ /// \since 05.08.2022 /// \author S.Zharko <s.zharko@gsi.de> -#ifndef CaDataManager_h -#define CaDataManager_h 1 +#pragma once // include this header only once per compilation unit #include "CaConstants.h" #include "CaInputData.h" @@ -159,4 +158,3 @@ namespace cbm::algo::ca } } // namespace cbm::algo::ca -#endif // CaDataManager_h diff --git a/algo/ca/core/data/CaGrid.h b/algo/ca/core/data/CaGrid.h index 01f193c1da..eca4cd70b6 100644 --- a/algo/ca/core/data/CaGrid.h +++ b/algo/ca/core/data/CaGrid.h @@ -8,8 +8,7 @@ /// This code is based on the code of the ALICE HLT Project /// -#ifndef CaGrid_h -#define CaGrid_h 1 +#pragma once // include this header only once per compilation unit #include "CaGridEntry.h" #include "CaHit.h" @@ -193,4 +192,3 @@ namespace cbm::algo::ca } // namespace cbm::algo::ca -#endif diff --git a/algo/ca/core/data/CaGridArea.h b/algo/ca/core/data/CaGridArea.h index 5ec34be08f..a0c2efca09 100644 --- a/algo/ca/core/data/CaGridArea.h +++ b/algo/ca/core/data/CaGridArea.h @@ -4,8 +4,7 @@ /// \file CaGrid.h -#ifndef CaGridArea_H -#define CaGridArea_H 1 +#pragma once // include this header only once per compilation unit #include "CaGrid.h" #include "CaHit.h" @@ -114,6 +113,4 @@ namespace cbm::algo::ca fAreaCurrentBinY = 0; } - } // namespace cbm::algo::ca -#endif diff --git a/algo/ca/core/data/CaGridEntry.h b/algo/ca/core/data/CaGridEntry.h index 5fa81820fb..67502b1c6c 100644 --- a/algo/ca/core/data/CaGridEntry.h +++ b/algo/ca/core/data/CaGridEntry.h @@ -2,8 +2,7 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Valentina Akishina, Igor Kulakov [committer], Maksym Zyzak */ -#ifndef CaGridEntry_h -#define CaGridEntry_h +#pragma once // include this header only once per compilation unit #include "CaConstants.h" #include "CaHit.h" @@ -58,4 +57,3 @@ namespace cbm::algo::ca } // namespace cbm::algo::ca -#endif diff --git a/algo/ca/core/data/CaHit.h b/algo/ca/core/data/CaHit.h index ff7fb114ca..6273d38a0d 100644 --- a/algo/ca/core/data/CaHit.h +++ b/algo/ca/core/data/CaHit.h @@ -6,8 +6,7 @@ /// \brief ca::Hit class describes a generic hit for the CA tracker /// \date 2007-2023 -#ifndef CaHit_h -#define CaHit_h 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/access.hpp> @@ -20,7 +19,7 @@ namespace cbm::algo::ca /// \brief ca::Hit class describes a generic hit for the CA tracker /// - struct Hit { + class Hit { friend class boost::serialization::access; public: @@ -86,5 +85,3 @@ namespace cbm::algo::ca }; } // namespace cbm::algo::ca - -#endif diff --git a/algo/ca/core/data/CaInputData.h b/algo/ca/core/data/CaInputData.h index 22ddec7f0a..2172ad8b43 100644 --- a/algo/ca/core/data/CaInputData.h +++ b/algo/ca/core/data/CaInputData.h @@ -7,8 +7,7 @@ /// \since 08.08.2022 /// \author Sergei Zharko <s.zharko@gsi.de> -#ifndef CaInputData_h -#define CaInputData_h 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/access.hpp> #include <boost/serialization/array.hpp> @@ -125,5 +124,3 @@ namespace cbm::algo::ca } } // namespace cbm::algo::ca - -#endif // InputData_h diff --git a/algo/ca/core/data/CaTrack.h b/algo/ca/core/data/CaTrack.h index 37f919c345..647f7f18fa 100644 --- a/algo/ca/core/data/CaTrack.h +++ b/algo/ca/core/data/CaTrack.h @@ -7,8 +7,7 @@ /// \since 02.06.2022 /// \author S.Zharko <s.zharko@gsi.de> -#ifndef CaTrack_h -#define CaTrack_h 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/access.hpp> @@ -48,5 +47,3 @@ namespace cbm::algo::ca }; } // namespace cbm::algo::ca - -#endif // CaTrack_h diff --git a/algo/ca/core/data/CaTrackParam.h b/algo/ca/core/data/CaTrackParam.h index 1902b044af..eb2b4e33b2 100644 --- a/algo/ca/core/data/CaTrackParam.h +++ b/algo/ca/core/data/CaTrackParam.h @@ -8,8 +8,7 @@ /// \since 02.06.2022 /// \author Sergey Gorbunov -#ifndef CaTrackParam_h -#define CaTrackParam_h 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/access.hpp> @@ -720,4 +719,3 @@ namespace cbm::algo::ca } // namespace cbm::algo::ca -#endif // CaTrackParam_h diff --git a/algo/ca/core/pars/CaConfigReader.h b/algo/ca/core/pars/CaConfigReader.h index 2bbba170d2..7f3006eb4b 100644 --- a/algo/ca/core/pars/CaConfigReader.h +++ b/algo/ca/core/pars/CaConfigReader.h @@ -7,8 +7,7 @@ /// \author S.Zharko <s.zharko@gsi.de> /// \since 18.07.2022 -#ifndef CaConfigRW_h -#define CaConfigRW_h 1 +#pragma once // include this header only once per compilation unit #include <string> #include <unordered_map> @@ -101,4 +100,3 @@ namespace cbm::algo::ca YAML::Node fUserConfigNode {YAML::NodeType::Undefined}; ///< User configuration node }; } // namespace cbm::algo::ca -#endif // CaConfigRW_h diff --git a/algo/ca/core/pars/CaConstants.h b/algo/ca/core/pars/CaConstants.h index 2c1b7f8650..cff4ad0baf 100644 --- a/algo/ca/core/pars/CaConstants.h +++ b/algo/ca/core/pars/CaConstants.h @@ -7,8 +7,7 @@ /// \since 02.06.2022 /// \author S.Zharko <s.zharko@gsi.de> -#ifndef CaConstants_h -#define CaConstants_h 1 +#pragma once // include this header only once per compilation unit #include <limits> @@ -246,5 +245,3 @@ namespace cbm::algo::ca::constants } // namespace cbm::algo::ca::constants - -#endif // CaConstants_h diff --git a/algo/ca/core/pars/CaField.h b/algo/ca/core/pars/CaField.h index 0e56f96e03..39e93a59d5 100644 --- a/algo/ca/core/pars/CaField.h +++ b/algo/ca/core/pars/CaField.h @@ -2,8 +2,8 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Sergey Gorbunov [committer], Igor Kulakov, Maksym Zyzak, Sergei Zharko */ -#ifndef CaField_h -#define CaField_h 1 +#pragma once // include this header only once per compilation unit + #include <boost/serialization/access.hpp> @@ -229,4 +229,3 @@ namespace cbm::algo::ca } _fvecalignment; } // namespace cbm::algo::ca -#endif diff --git a/algo/ca/core/pars/CaInitManager.h b/algo/ca/core/pars/CaInitManager.h index 1b836d09fa..b75ac7cdc0 100644 --- a/algo/ca/core/pars/CaInitManager.h +++ b/algo/ca/core/pars/CaInitManager.h @@ -7,8 +7,7 @@ /// \since 24.12.2021 /// \author Sergei Zharko <s.zharko@gsi.de> -#ifndef CaInitManager_h -#define CaInitManager_h 1 +#pragma once // include this header only once per compilation unit #include <array> #include <bitset> @@ -305,5 +304,3 @@ namespace cbm::algo::ca std::string fConfigOutputName = ""; ///< name for the output configuration file }; } // namespace cbm::algo::ca - -#endif diff --git a/algo/ca/core/pars/CaIteration.h b/algo/ca/core/pars/CaIteration.h index 5198ecff6f..f3b06c3563 100644 --- a/algo/ca/core/pars/CaIteration.h +++ b/algo/ca/core/pars/CaIteration.h @@ -9,8 +9,7 @@ * @author S.Zharko <s.zharko@gsi.de> ***************************************************************************************************/ -#ifndef CaIteration_h -#define CaIteration_h 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/access.hpp> #include <boost/serialization/string.hpp> @@ -280,6 +279,3 @@ namespace cbm::algo::ca } }; } // namespace cbm::algo::ca - - -#endif // L1CAIteration_h diff --git a/algo/ca/core/pars/CaMaterialMap.h b/algo/ca/core/pars/CaMaterialMap.h index e12c6a2d8d..af77e37874 100644 --- a/algo/ca/core/pars/CaMaterialMap.h +++ b/algo/ca/core/pars/CaMaterialMap.h @@ -2,8 +2,7 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Igor Kulakov, Sergey Gorbunov [committer], Andrey Lebedev, Sergei Zharko */ -#ifndef CaMaterialMap_h -#define CaMaterialMap_h 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/vector.hpp> @@ -130,4 +129,3 @@ namespace cbm::algo::ca } // namespace cbm::algo::ca -#endif diff --git a/algo/ca/core/pars/CaParameters.h b/algo/ca/core/pars/CaParameters.h index f4faf7d6ec..01dfb21c6b 100644 --- a/algo/ca/core/pars/CaParameters.h +++ b/algo/ca/core/pars/CaParameters.h @@ -7,8 +7,7 @@ /// @since 19.12.2021 /// @author S.Zharko <s.zharko@gsi.de> -#ifndef L1Parameters_h -#define L1Parameters_h 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/array.hpp> #include <boost/serialization/utility.hpp> @@ -341,4 +340,3 @@ namespace cbm::algo::ca }; } // namespace cbm::algo::ca -#endif // L1Parameters_h diff --git a/algo/ca/core/pars/CaSearchWindow.h b/algo/ca/core/pars/CaSearchWindow.h index 3fe43fcb6d..ea7e73c18a 100644 --- a/algo/ca/core/pars/CaSearchWindow.h +++ b/algo/ca/core/pars/CaSearchWindow.h @@ -7,8 +7,7 @@ /// \date 08.11.2022 /// \author S.Zharko <s.zharko@gsi.de> -#ifndef CaSearchWindow_h -#define CaSearchWindow_h 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/array.hpp> #include <boost/serialization/string.hpp> @@ -174,5 +173,3 @@ namespace cbm::algo::ca } }; } // namespace cbm::algo::ca - -#endif // L1SearchWindow_h diff --git a/algo/ca/core/pars/CaStation.h b/algo/ca/core/pars/CaStation.h index 6f5bdc134c..3fb76957e9 100644 --- a/algo/ca/core/pars/CaStation.h +++ b/algo/ca/core/pars/CaStation.h @@ -2,8 +2,7 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Sergey Gorbunov [committer], Igor Kulakov, Sergei Zharko */ -#ifndef CaStation_h -#define CaStation_h 1 +#pragma once // include this header only once per compilation unit #include <string> @@ -87,5 +86,3 @@ namespace cbm::algo::ca } _fvecalignment; } // namespace cbm::algo::ca - -#endif // CaStation_h diff --git a/algo/ca/core/pars/CaStationInitializer.h b/algo/ca/core/pars/CaStationInitializer.h index 221438ed0e..0dc5a80f69 100644 --- a/algo/ca/core/pars/CaStationInitializer.h +++ b/algo/ca/core/pars/CaStationInitializer.h @@ -7,8 +7,7 @@ /// \since 18.12.2021 /// \author S.Zharko <s.zharko@gsi.de> -#ifndef CaStationInitializer_h -#define CaStationInitializer_h 1 +#pragma once // include this header only once per compilation unit #include <bitset> #include <functional> @@ -216,5 +215,3 @@ namespace cbm::algo::ca /// swap function for two StationInitializer objects, expected to be used instead of std::swap inline void swap(StationInitializer& a, StationInitializer& b) noexcept { a.Swap(b); } } // namespace cbm::algo::ca - -#endif // CaStationInitializer_h diff --git a/algo/ca/core/utils/CaDefines.h b/algo/ca/core/utils/CaDefines.h index d98b0fc592..ae101e651f 100644 --- a/algo/ca/core/utils/CaDefines.h +++ b/algo/ca/core/utils/CaDefines.h @@ -6,8 +6,7 @@ /// \brief Macros for the CA tracking algorithm /// \details Try to minimize the amount of macros. Try to call this header only from cxx files. -#ifndef CaDefines_h -#define CaDefines_h +#pragma once // include this header only once per compilation unit #include <iostream> @@ -27,6 +26,3 @@ #define CBMCA_DEBUG_ASSERT(v) #endif // CBMCA_DEBUG_MODE - - -#endif // CaDefines_h diff --git a/algo/ca/core/utils/CaEnumArray.h b/algo/ca/core/utils/CaEnumArray.h index 25ec11a725..bcf5a270e6 100644 --- a/algo/ca/core/utils/CaEnumArray.h +++ b/algo/ca/core/utils/CaEnumArray.h @@ -7,8 +7,7 @@ /// @since 02.05.2023 /// @author Sergei Zharko <s.zharko@gsi.de> -#ifndef CaEnumArray_h -#define CaEnumArray_h 1 +#pragma once // include this header only once per compilation unit #include <array> @@ -49,5 +48,3 @@ namespace cbm::algo::ca operator Arr&() const { return *this; } }; } // namespace cbm::algo::ca - -#endif // L1EArray_h diff --git a/algo/ca/core/utils/CaMonitor.h b/algo/ca/core/utils/CaMonitor.h index 39d3209b75..5ba1711a40 100644 --- a/algo/ca/core/utils/CaMonitor.h +++ b/algo/ca/core/utils/CaMonitor.h @@ -7,8 +7,8 @@ /// @since 25.08.2023 /// @author S.Zharko <s.zharko@gsi.de> -#ifndef CaMonitor_h -#define CaMonitor_h 1 +#pragma once // include this header only once per compilation unit + #include <iomanip> #include <sstream> @@ -110,5 +110,3 @@ namespace cbm::algo::ca return msg.str(); } } // namespace cbm::algo::ca - -#endif // CaMonitor_h diff --git a/algo/ca/core/utils/CaObjectInitController.h b/algo/ca/core/utils/CaObjectInitController.h index 31a88feb1b..45b5f7db3d 100644 --- a/algo/ca/core/utils/CaObjectInitController.h +++ b/algo/ca/core/utils/CaObjectInitController.h @@ -2,8 +2,7 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Sergey Gorbunov, Sergei Zharko [committer] */ -#ifndef CaObjectInitController_h -#define CaObjectInitController_h 1 +#pragma once // include this header only once per compilation unit /// @file CaObjectInitController.h /// @author Sergei Zharko @@ -97,5 +96,3 @@ namespace cbm::algo::ca } } // namespace cbm::algo::ca - -#endif // CaObjectInitController_h diff --git a/algo/ca/core/utils/CaSimd.h b/algo/ca/core/utils/CaSimd.h index 4c5406445d..06f4017fdc 100644 --- a/algo/ca/core/utils/CaSimd.h +++ b/algo/ca/core/utils/CaSimd.h @@ -2,10 +2,7 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Sergey Gorbunov [committer]*/ -#ifndef Ca_CaSimd_H -#define Ca_CaSimd_H 1 +#pragma once // include this header only once per compilation unit #include "CaSimdVc.h" //#include "CaSimdPseudo.h" - -#endif diff --git a/algo/ca/core/utils/CaSimdPseudo.h b/algo/ca/core/utils/CaSimdPseudo.h index 9bbd745d58..5bd20718e0 100644 --- a/algo/ca/core/utils/CaSimdPseudo.h +++ b/algo/ca/core/utils/CaSimdPseudo.h @@ -2,8 +2,7 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Igor Kulakov [committer] */ -#ifndef Ca_CaSimdPseudo_H -#define Ca_CaSimdPseudo_H 1 +#pragma once // include this header only once per compilation unit #include <boost/serialization/access.hpp> @@ -279,5 +278,3 @@ namespace cbm::algo::ca #define _fvecalignment __attribute__((aligned(fvec::size() * sizeof(fscal)))) } // namespace cbm::algo::ca - -#endif diff --git a/algo/ca/core/utils/CaSimdVc.h b/algo/ca/core/utils/CaSimdVc.h index f8b22b5d1c..656de918e8 100644 --- a/algo/ca/core/utils/CaSimdVc.h +++ b/algo/ca/core/utils/CaSimdVc.h @@ -2,8 +2,7 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Igor Kulakov [committer], Maksym Zyzak */ -#ifndef Ca_CaSimdVc_H -#define Ca_CaSimdVc_H +#pragma once // include this header only once per compilation unit #include <boost/serialization/access.hpp> #include <boost/serialization/array.hpp> @@ -53,6 +52,3 @@ namespace boost::serialization split_free(ar, vect, version); } } // namespace boost::serialization - - -#endif diff --git a/algo/ca/core/utils/CaUtils.h b/algo/ca/core/utils/CaUtils.h index a3e7cc0794..6a0fa0ee70 100644 --- a/algo/ca/core/utils/CaUtils.h +++ b/algo/ca/core/utils/CaUtils.h @@ -7,8 +7,8 @@ /// \since 02.06.2022 /// \author S.Zharko <s.zharko@gsi.de> -#ifndef CaUtils_h -#define CaUtils_h 1 +#pragma once // include this header only once per compilation unit + #include <sstream> @@ -37,24 +37,13 @@ namespace cbm::algo::ca::utils } /// tell the CPU that the bool condition is likely to be true - __always_inline bool IsLikely(bool b) - { #if defined(__GNUC__) && __GNUC__ - 0 >= 3 - return __builtin_expect(!!(b), 1); + __attribute__((always_inline)) inline bool IsLikely(bool b) { return __builtin_expect(!!(b), 1); } + __attribute__((always_inline)) inline bool IsUnlikely(bool b) { return __builtin_expect(!!(b), 0); } #else - return b; + inline bool IsLikely(bool b) { return b; } + inline bool IsUnlikely(bool b) { return b; } #endif - } - - /// tell the CPU that the bool condition is unlikely to be true - __always_inline bool IsUnlikely(bool b) - { -#if defined(__GNUC__) && __GNUC__ - 0 >= 3 - return __builtin_expect(!!(b), 0); -#else - return b; -#endif - } /// \brief Checks whether a variable of a particular type defined /// \param val Value to be checked @@ -137,6 +126,3 @@ namespace cbm::algo::ca::utils } }; } // namespace cbm::algo::ca::utils - - -#endif // CaUtils_h diff --git a/algo/ca/core/utils/CaVector.h b/algo/ca/core/utils/CaVector.h index 8fa8245a6b..5630dfbdf4 100644 --- a/algo/ca/core/utils/CaVector.h +++ b/algo/ca/core/utils/CaVector.h @@ -6,8 +6,7 @@ /// \author Sergey Gorbunov /// \date 2021-06-16 -#ifndef Ca_CaVector_H -#define Ca_CaVector_H +#pragma once // include this header only once per compilation unit #ifndef FAST_CODE @@ -293,4 +292,3 @@ namespace cbm::algo::ca class Vector<bool> { }; } // namespace cbm::algo::ca -#endif -- GitLab