From e0172663baefadd04e2872befe445452836de249 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer Date: Tue, 20 May 2025 10:14:49 +0200 Subject: [PATCH] [EMCAL-1152] EMCAL: Fix cpplint errors This commit includes changes to: - DataFormats/Detectors/EMCA - Detectors/EMCAL/base --- .../DataFormatsEMCAL/AnalysisCluster.h | 48 +- .../EMCAL/include/DataFormatsEMCAL/Cell.h | 47 +- .../include/DataFormatsEMCAL/CellLabel.h | 28 +- .../EMCAL/include/DataFormatsEMCAL/Cluster.h | 26 +- .../include/DataFormatsEMCAL/ClusterLabel.h | 35 +- .../DataFormatsEMCAL/CompressedTriggerData.h | 11 +- .../include/DataFormatsEMCAL/Constants.h | 22 +- .../EMCAL/include/DataFormatsEMCAL/Digit.h | 42 +- .../include/DataFormatsEMCAL/EventData.h | 33 +- .../include/DataFormatsEMCAL/EventHandler.h | 59 +-- .../EMCAL/include/DataFormatsEMCAL/MCLabel.h | 28 +- .../include/DataFormatsEMCAL/TriggerRecord.h | 22 +- .../Detectors/EMCAL/src/AnalysisCluster.cxx | 18 +- DataFormats/Detectors/EMCAL/src/CTF.cxx | 4 + DataFormats/Detectors/EMCAL/src/Cell.cxx | 22 +- DataFormats/Detectors/EMCAL/src/CellLabel.cxx | 5 + DataFormats/Detectors/EMCAL/src/Cluster.cxx | 14 +- .../Detectors/EMCAL/src/ClusterLabel.cxx | 16 +- .../EMCAL/src/CompressedTriggerData.cxx | 8 +- DataFormats/Detectors/EMCAL/src/Constants.cxx | 16 +- DataFormats/Detectors/EMCAL/src/Digit.cxx | 22 +- .../Detectors/EMCAL/src/EventHandler.cxx | 8 + .../Detectors/EMCAL/src/TriggerRecord.cxx | 12 +- Detectors/EMCAL/base/CMakeLists.txt | 2 +- .../base/include/EMCALBase/ClusterFactory.h | 53 ++- .../EMCAL/base/include/EMCALBase/Geometry.h | 339 ++++++++------- .../base/include/EMCALBase/GeometryBase.h | 12 +- Detectors/EMCAL/base/include/EMCALBase/Hit.h | 34 +- .../EMCAL/base/include/EMCALBase/Mapper.h | 46 +- .../include/EMCALBase/NonlinearityHandler.h | 32 +- .../EMCAL/base/include/EMCALBase/RCUTrailer.h | 46 +- .../include/EMCALBase/ShishKebabTrd1Module.h | 112 ++--- .../include/EMCALBase/TriggerMappingErrors.h | 25 +- .../base/include/EMCALBase/TriggerMappingV2.h | 29 +- Detectors/EMCAL/base/src/ClusterFactory.cxx | 181 ++++---- Detectors/EMCAL/base/src/Geometry.cxx | 411 +++++++++--------- Detectors/EMCAL/base/src/Hit.cxx | 8 +- Detectors/EMCAL/base/src/Mapper.cxx | 24 +- .../EMCAL/base/src/NonlinearityHandler.cxx | 35 +- Detectors/EMCAL/base/src/RCUTrailer.cxx | 22 +- .../EMCAL/base/src/ShishKebabTrd1Module.cxx | 182 ++++---- Detectors/EMCAL/base/src/TriggerMappingV2.cxx | 62 +-- Detectors/EMCAL/base/test/testGeometry.cxx | 11 +- .../base/test/testGeometryRowColIndexing.C | 2 +- Detectors/EMCAL/base/test/testMapper.cxx | 13 +- Detectors/EMCAL/base/test/testRCUTrailer.cxx | 3 +- 46 files changed, 1231 insertions(+), 999 deletions(-) diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/AnalysisCluster.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/AnalysisCluster.h index e19fd17dea2ce..ac4e3c08c6072 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/AnalysisCluster.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/AnalysisCluster.h @@ -9,30 +9,30 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_ANALYSISCLUSTER_H_ -#define ALICEO2_EMCAL_ANALYSISCLUSTER_H_ +/// \file AnalysisCluster.h +/// \class AnalysisCluster +/// \brief Cluster class for kinematic cluster parameters +/// \ingroup EMCALDataFormat +/// ported from AliVCluster in AliRoot +/// \author Hadi Hassan , Oak Ridge National Laboratory +/// \since March 05, 2020 + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_ANALYSISCLUSTER_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_ANALYSISCLUSTER_H_ #include #include #include +#include +#include #include "Rtypes.h" #include "MathUtils/Cartesian.h" -#include "TLorentzVector.h" +#include "Math/Vector4D.h" namespace o2 { - namespace emcal { - -/// \class AnalysisCluster -/// \brief Cluster class for kinematic cluster parameters -/// \ingroup EMCALDataFormat -/// ported from AliVCluster in AliRoot -/// \author Hadi Hassan , Oak Ridge National Laboratory -/// \since March 05, 2020 -/// - class AnalysisCluster { @@ -45,9 +45,9 @@ class AnalysisCluster public: /// \brief Constructor, setting cell wrong cell index raising the exception /// \param cellIndex Cell index raising the exception - CellOutOfRangeException(Int_t cellIndex) : std::exception(), - mCellIndex(cellIndex), - mMessage("Cell index " + std::to_string(mCellIndex) + " out of range.") + CellOutOfRangeException(int cellIndex) : std::exception(), + mCellIndex(cellIndex), + mMessage("Cell index " + std::to_string(mCellIndex) + " out of range.") { } @@ -56,14 +56,14 @@ class AnalysisCluster /// \brief Access to cell ID raising the exception /// \return Cell ID - Int_t getCellIndex() const noexcept { return mCellIndex; } + int getCellIndex() const noexcept { return mCellIndex; } /// \brief Access to error message of the exception /// \return Error message const char* what() const noexcept final { return mMessage.data(); } private: - Int_t mCellIndex; ///< Cell index raising the exception + int mCellIndex; ///< Cell index raising the exception std::string mMessage; ///< error Message }; @@ -128,12 +128,12 @@ class AnalysisCluster /// /// Set the array of cell indices. - void setCellsIndices(const std::vector& array) + void setCellsIndices(const std::vector& array) { mCellsIndices = array; } - const std::vector& getCellsIndices() const { return mCellsIndices; } + const std::vector& getCellsIndices() const { return mCellsIndices; } /// /// Set the array of cell amplitude fractions. @@ -186,10 +186,10 @@ class AnalysisCluster void setFCross(float fCross) { mFCross = fCross; } /// - /// Returns TLorentzVector with momentum of the cluster. Only valid for clusters + /// Returns ROOT::Math::PxPyPzEVector with momentum of the cluster. Only valid for clusters /// identified as photons or pi0 (overlapped gamma) produced on the vertex /// Vertex can be recovered with esd pointer doing: - TLorentzVector getMomentum(std::array vertexPosition) const; + ROOT::Math::PxPyPzEVector getMomentum(std::array vertexPosition) const; protected: /// TODO to replace later by o2::MCLabel when implementing the MC handling @@ -198,7 +198,7 @@ class AnalysisCluster int mNCells = 0; ///< Number of cells in cluster. /// Array of cell indices contributing to this cluster. - std::vector mCellsIndices; //[mNCells] + std::vector mCellsIndices; //[mNCells] /// Array with cell amplitudes fraction. Only usable for unfolded clusters, where cell can be shared. /// here we store what fraction of the cell energy is assigned to a given cluster. @@ -235,4 +235,4 @@ class AnalysisCluster } // namespace emcal } // namespace o2 -#endif // ANALYSISCLUSTER_H +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_ANALYSISCLUSTER_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cell.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cell.h index cf29f1d79381c..b919310bfb6a7 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cell.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cell.h @@ -9,19 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_CELL_H_ -#define ALICEO2_EMCAL_CELL_H_ - -#include -#include -#include -#include "DataFormatsEMCAL/Constants.h" - -namespace o2 -{ -namespace emcal -{ - +/// \file Cell.h /// \class Cell /// \brief EMCAL compressed cell information /// \author Anders Knospe, University of Houston @@ -55,6 +43,19 @@ namespace emcal /// | Cell type | 2 | - | 0=LG, 1=HG, 2=LEMon, 4=TRU | /// /// The remaining bits are 0 + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELL_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELL_H_ + +#include +#include +#include +#include "DataFormatsEMCAL/Constants.h" + +namespace o2 +{ +namespace emcal +{ class Cell { public: @@ -71,7 +72,7 @@ class Cell /// \param energy Energy /// \param timestamp Cell time /// \param ctype Channel type - Cell(short tower, float energy, float timestamp, ChannelType_t ctype = ChannelType_t::LOW_GAIN); + Cell(int16_t tower, float energy, float timestamp, ChannelType_t ctype = ChannelType_t::LOW_GAIN); /// \brief Constructor, from encoded bit representation /// \param tower Tower bitsets @@ -86,11 +87,11 @@ class Cell /// \brief Set the tower ID /// \param tower Tower ID - void setTower(short tower) { mTowerID = tower; } + void setTower(int16_t tower) { mTowerID = tower; } /// \brief Get the tower ID /// \return Tower ID - short getTower() const { return mTowerID; } + int16_t getTower() const { return mTowerID; } /// \brief Set the time stamp /// \param timestamp Time in ns @@ -134,28 +135,28 @@ class Cell /// \brief Check whether the cell is a low gain cell /// \return True if the cell type is low gain, false otherwise - Bool_t getLowGain() const { return isChannelType(ChannelType_t::LOW_GAIN); } + bool getLowGain() const { return isChannelType(ChannelType_t::LOW_GAIN); } /// \brief Mark cell as high gain cell void setHighGain() { setType(ChannelType_t::HIGH_GAIN); } /// \brief Check whether the cell is a high gain cell /// \return True if the cell type is high gain, false otherwise - Bool_t getHighGain() const { return isChannelType(ChannelType_t::HIGH_GAIN); }; + bool getHighGain() const { return isChannelType(ChannelType_t::HIGH_GAIN); } /// \brief Mark cell as LED monitor cell void setLEDMon() { setType(ChannelType_t::LEDMON); } /// \brief Check whether the cell is a LED monitor cell /// \return True if the cell type is LED monitor, false otherwise - Bool_t getLEDMon() const { return isChannelType(ChannelType_t::LEDMON); } + bool getLEDMon() const { return isChannelType(ChannelType_t::LEDMON); } /// \brief Mark cell as TRU cell void setTRU() { setType(ChannelType_t::TRU); } /// \brief Check whether the cell is a TRU cell /// \return True if the cell type is TRU, false otherwise - Bool_t getTRU() const { return isChannelType(ChannelType_t::TRU); } + bool getTRU() const { return isChannelType(ChannelType_t::TRU); } /// \brief Apply compression as done during writing to / reading from CTF /// \param version Encoder version @@ -214,7 +215,7 @@ class Cell static float getEnergyFromPackedBitfieldV0(const char* bitfield); static float getTimeFromPackedBitfieldV0(const char* bitfield); static ChannelType_t getCellTypeFromPackedBitfieldV0(const char* bitfield); - static short getTowerFromPackedBitfieldV0(const char* bitfield); + static int16_t getTowerFromPackedBitfieldV0(const char* bitfield); static uint16_t encodeTime(float timestamp); static uint16_t encodeEnergyV0(float energy); @@ -248,7 +249,7 @@ class Cell float mEnergy = FLT_MIN; ///< Energy float mTimestamp = FLT_MIN; ///< Timestamp - short mTowerID = SHRT_MAX; ///< Tower ID + int16_t mTowerID = SHRT_MAX; ///< Tower ID ChannelType_t mChannelType = ChannelType_t::HIGH_GAIN; ///< Cell type ClassDefNV(Cell, 3); @@ -262,4 +263,4 @@ std::ostream& operator<<(std::ostream& stream, const Cell& cell); } // namespace emcal } // namespace o2 -#endif +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELL_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h index f0181e01f84c5..ba0b634e351e9 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h @@ -9,8 +9,16 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_CELLLABEL_H_ -#define ALICEO2_EMCAL_CELLLABEL_H_ +/// \file CellLabel.h +/// \class CellLabel +/// \brief cell class for MC particle IDs and their respective amplitude fraction +/// \ingroup EMCALDataFormat +/// \author Marvin Hemmer , Goethe university Frankfurt +/// \since December 13, 2023 +/// + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELLLABEL_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELLLABEL_H_ #include #include @@ -22,14 +30,6 @@ namespace o2 namespace emcal { - -/// \class CellLabel -/// \brief cell class for MC particle IDs and their respective amplitude fraction -/// \ingroup EMCALDataFormat -/// \author Marvin Hemmer , Goethe university Frankfurt -/// \since December 13, 2023 -/// - class CellLabel { public: @@ -46,15 +46,15 @@ class CellLabel /// \brief Getter of label size /// \param index index which label to get - size_t GetLabelSize(void) const { return mLabels.size(); } + size_t getLabelSize(void) const { return mLabels.size(); } /// \brief Getter for label /// \param index index which label to get - int32_t GetLabel(size_t index) const { return mLabels[index]; } + int32_t getLabel(size_t index) const { return mLabels[index]; } /// \brief Getter for amplitude fraction /// \param index index which amplitude fraction to get - float GetAmplitudeFraction(size_t index) const { return mAmplitudeFraction[index]; } + float getAmplitudeFraction(size_t index) const { return mAmplitudeFraction[index]; } protected: gsl::span mLabels; ///< List of MC particles that generated the cluster, ordered in deposited energy. @@ -63,4 +63,4 @@ class CellLabel } // namespace emcal } // namespace o2 -#endif // ALICEO2_EMCAL_CELLLABEL_H_ +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELLLABEL_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cluster.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cluster.h index f6e99983c3b83..4f4a4e5ac5d9d 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cluster.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cluster.h @@ -8,8 +8,16 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_CLUSTER_H_ -#define ALICEO2_EMCAL_CLUSTER_H_ + +/// \file Cluster.h +/// \class Cluster +/// \brief EMCAL Cluster +/// \ingroup EMCALDataFormat +/// \author Markus Fasel , Oak Ridge National Laboratory +/// + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTER_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTER_H_ #include #include @@ -20,25 +28,19 @@ namespace o2 { - namespace emcal { - -/// \class Cluster -/// \brief EMCAL Cluster -/// \ingroup EMCALDataFormat -/// class Cluster : public o2::dataformats::TimeStamp { using CellIndexRange = o2::dataformats::RangeRefComp<8>; public: Cluster() = default; - Cluster(Float_t time, int firstcell, int ncells); + Cluster(float time, int firstcell, int ncells); ~Cluster() noexcept = default; - Int_t getNCells() const { return mCellIndices.getEntries(); } - Int_t getCellIndexFirst() const { return mCellIndices.getFirstEntry(); } + int getNCells() const { return mCellIndices.getEntries(); } + int getCellIndexFirst() const { return mCellIndices.getFirstEntry(); } CellIndexRange getCellIndexRange() const { return mCellIndices; } void setCellIndices(int firstcell, int ncells) @@ -62,4 +64,4 @@ std::ostream& operator<<(std::ostream& stream, const o2::emcal::Cluster& cluster } // namespace o2 -#endif +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTER_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/ClusterLabel.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/ClusterLabel.h index b6db76f91ff34..94e33a601ee9c 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/ClusterLabel.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/ClusterLabel.h @@ -9,8 +9,16 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_CLUSTERLABEL_H_ -#define ALICEO2_EMCAL_CLUSTERLABEL_H_ +/// \file ClusterLabel.h +/// \class ClusterLabel +/// \brief cluster class for MC particle IDs and their respective energy fraction +/// \ingroup EMCALDataFormat +/// \author Marvin Hemmer , Goethe university Frankfurt +/// \since December 13, 2023 +/// + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTERLABEL_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTERLABEL_H_ #include #include @@ -19,31 +27,22 @@ namespace o2 { - namespace emcal { - -/// \class ClusterLabel -/// \brief cluster class for MC particle IDs and their respective energy fraction -/// \ingroup EMCALDataFormat -/// \author Marvin Hemmer , Goethe university Frankfurt -/// \since December 13, 2023 -/// - class ClusterLabel { public: - /// \struct labelWithE + /// \struct LabelWithE /// \brief Wrapper structure to make cluster label sortable in energy fraction - struct labelWithE { + struct LabelWithE { /// \brief Constructor - labelWithE() : label(0), energyFraction(0.) {} + LabelWithE() : label(0), energyFraction(0.) {} /// \brief Constructor /// \param l MC label /// \param e Energy fraction - labelWithE(int l, float e) : label(l), energyFraction(e) {} + LabelWithE(int l, float e) : label(l), energyFraction(e) {} /// \brief Comparison lower operator comparing cells based on energy /// @@ -51,7 +50,7 @@ class ClusterLabel /// /// \param rhs Label to compare to /// \return True if this cell is has a lower energy, false otherwise - bool operator>=(labelWithE const& rhs) const + bool operator>=(LabelWithE const& rhs) const { return energyFraction >= rhs.energyFraction; } @@ -87,9 +86,9 @@ class ClusterLabel void orderLabels(); protected: - std::vector mClusterLabels; ///< List of MC particles that generated the cluster, paired with energy fraction + std::vector mClusterLabels; ///< List of MC particles that generated the cluster, paired with energy fraction }; } // namespace emcal } // namespace o2 -#endif // ALICEO2_EMCAL_CLUSTERLABEL_H_ +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTERLABEL_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CompressedTriggerData.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CompressedTriggerData.h index 5fbf2187ab5dd..61039d3a08501 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CompressedTriggerData.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CompressedTriggerData.h @@ -8,8 +8,13 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_COMPRESSEDTRIGGERDATA_H -#define ALICEO2_EMCAL_COMPRESSEDTRIGGERDATA_H + +/// \file CompressedTriggerData.h +/// \brief compressed trigger data structs +/// \author Markus Fasel , Oak Ridge National Laboratory + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_COMPRESSEDTRIGGERDATA_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_COMPRESSEDTRIGGERDATA_H_ #include #include @@ -65,4 +70,4 @@ std::ostream& operator<<(std::ostream& stream, const CompressedL0TimeSum& timesu } // namespace o2::emcal -#endif // ALICEO2_EMCAL_COMPRESSEDTRIGGERDATA_H \ No newline at end of file +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_COMPRESSEDTRIGGERDATA_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Constants.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Constants.h index 015c77deccc46..9b60a5d1c3a48 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Constants.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Constants.h @@ -8,13 +8,19 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_CONSTANTS_H_ -#define ALICEO2_EMCAL_CONSTANTS_H_ + +/// \file Constants.h +/// \brief EMCal related constants +/// \author Markus Fasel , Oak Ridge National Laboratory + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CONSTANTS_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CONSTANTS_H_ #include #include #include #include +#include namespace o2 { @@ -94,11 +100,11 @@ constexpr int OVERFLOWCUT = 950; ///< sample overflow constexpr int LG_SUPPRESSION_CUT = 880; ///< LG bunch suppression ADC value constexpr int ORDER = 2; ///< Order of shaping stages of the signal conditioning unit constexpr double TAU = 2.35; ///< Approximate shaping time -constexpr Double_t EMCAL_TIMESAMPLE = 100.; ///< Width of a timebin in nanoseconds -constexpr Double_t EMCAL_ADCENERGY = 0.0162; ///< Energy of one ADC count in GeV/c^2 -constexpr Int_t EMCAL_HGLGFACTOR = 16; ///< Conversion from High to Low Gain -constexpr Int_t EMCAL_HGLGTRANSITION = 1024; ///< Transition from High to Low Gain -constexpr Int_t EMCAL_MAXTIMEBINS = 15; ///< Maximum number of time bins for time response +constexpr double EMCAL_TIMESAMPLE = 100.; ///< Width of a timebin in nanoseconds +constexpr double EMCAL_ADCENERGY = 0.0162; ///< Energy of one ADC count in GeV/c^2 +constexpr int EMCAL_HGLGFACTOR = 16; ///< Conversion from High to Low Gain +constexpr int EMCAL_HGLGTRANSITION = 1024; ///< Transition from High to Low Gain +constexpr int EMCAL_MAXTIMEBINS = 15; ///< Maximum number of time bins for time response constexpr int MAX_RANGE_ADC = 0x3FF; ///< Dynamic range of the ADCs (10 bit ADC) constexpr double EMCAL_TRU_ADCENERGY = 0.0786; ///< resolution of the TRU digitizer, @TODO check exact value } // namespace constants @@ -146,4 +152,4 @@ constexpr int NchannelsOverPhi_long = 4; ///< number of FastORs over Phi for 1/ } // namespace emcal } // namespace o2 -#endif +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CONSTANTS_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Digit.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Digit.h index d1c515df0282a..37d2ac237dcf6 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Digit.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Digit.h @@ -9,8 +9,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_DIGIT_H_ -#define ALICEO2_EMCAL_DIGIT_H_ +/// \file Digit.h +/// \author anders.knospe@cern.ch +/// \brief Definition of EMCal Digit class + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_DIGIT_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_DIGIT_H_ #include #include @@ -35,8 +39,8 @@ class Digit : public DigitBase public: Digit() = default; - Digit(Short_t tower, Double_t amplitudeGeV, Double_t time); - Digit(Short_t tower, uint16_t noiseLG, uint16_t noiseHG, double time); + Digit(int16_t tower, double amplitudeGeV, double time); + Digit(int16_t tower, uint16_t noiseLG, uint16_t noiseHG, double time); ~Digit() = default; // override bool operator<(const Digit& other) const { return getTimeStamp() < other.getTimeStamp(); } @@ -55,33 +59,33 @@ class Digit : public DigitBase return lhs; } - void setTower(Short_t tower) { mTower = tower; } - Short_t getTower() const { return mTower; } + void setTower(int16_t tower) { mTower = tower; } + int16_t getTower() const { return mTower; } - void setAmplitude(Double_t amplitude) { mAmplitudeGeV = amplitude; } - Double_t getAmplitude() const; + void setAmplitude(double amplitude) { mAmplitudeGeV = amplitude; } + double getAmplitude() const; - void setEnergy(Double_t energy) { mAmplitudeGeV = energy; } - Double_t getEnergy() const { return mAmplitudeGeV; } + void setEnergy(double energy) { mAmplitudeGeV = energy; } + double getEnergy() const { return mAmplitudeGeV; } - void setAmplitudeADC(Short_t amplitude, ChannelType_t ctype = ChannelType_t::HIGH_GAIN); - Int_t getAmplitudeADC(ChannelType_t ctype) const; - Int_t getAmplitudeADC() const { return getAmplitudeADC(getType()); }; + void setAmplitudeADC(int16_t amplitude, ChannelType_t ctype = ChannelType_t::HIGH_GAIN); + int getAmplitudeADC(ChannelType_t ctype) const; + int getAmplitudeADC() const { return getAmplitudeADC(getType()); } void setType(ChannelType_t ctype) {} ChannelType_t getType() const; void setHighGain() {} - Bool_t getHighGain() const { return (getType() == ChannelType_t::HIGH_GAIN); }; + bool getHighGain() const { return (getType() == ChannelType_t::HIGH_GAIN); } void setLowGain() {} - Bool_t getLowGain() const { return (getType() == ChannelType_t::LOW_GAIN); }; + bool getLowGain() const { return (getType() == ChannelType_t::LOW_GAIN); } void setTRU() { mIsTRU = true; } - Bool_t getTRU() const { return mIsTRU; } + bool getTRU() const { return mIsTRU; } void setLEDMon() {} - Bool_t getLEDMon() const { return false; } + bool getLEDMon() const { return false; } void PrintStream(std::ostream& stream) const; @@ -98,7 +102,7 @@ class Digit : public DigitBase friend class boost::serialization::access; double mAmplitudeGeV = 0.; ///< Amplitude (GeV) - Short_t mTower = -1; ///< Tower index (absolute cell ID) + int16_t mTower = -1; ///< Tower index (absolute cell ID) bool mIsTRU = false; ///< TRU flag uint16_t mNoiseLG = 0; ///< Noise of the low gain digits uint16_t mNoiseHG = 0; ///< Noise of the high gain digits or TRU digits (can never be at the same time) @@ -109,4 +113,4 @@ class Digit : public DigitBase std::ostream& operator<<(std::ostream& stream, const Digit& dig); } // namespace emcal } // namespace o2 -#endif +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_DIGIT_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/EventData.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/EventData.h index 90c56e7a354d9..d869f9f6f1e74 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/EventData.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/EventData.h @@ -8,22 +8,8 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_EVENTDATA_H_ -#define ALICEO2_EMCAL_EVENTDATA_H_ -#include -#include -#include -#include "CommonDataFormat/InteractionRecord.h" -#include "DataFormatsEMCAL/Cell.h" -#include "DataFormatsEMCAL/Cluster.h" -#include "DataFormatsEMCAL/MCLabel.h" - -namespace o2 -{ - -namespace emcal -{ +/// \file EventData.h /// \struct EventData /// \brief EMCAL event information (per trigger) /// \ingroup EMCALDataFormat @@ -34,6 +20,21 @@ namespace emcal /// same collision (hardware trigger). Collision information is provided via the /// interaction record. Attention: Lists (ranges) might be empty in case the /// objects are not filled when creating the event structure. + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_EVENTDATA_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_EVENTDATA_H_ +#include +#include +#include +#include "CommonDataFormat/InteractionRecord.h" +#include "DataFormatsEMCAL/Cell.h" +#include "DataFormatsEMCAL/Cluster.h" +#include "DataFormatsEMCAL/MCLabel.h" + +namespace o2 +{ +namespace emcal +{ template struct EventData { InteractionRecord mInteractionRecord; ///< Interaction record for the trigger corresponding to this event @@ -61,4 +62,4 @@ struct EventData { } // namespace o2 -#endif // ALICEO2_EMCAL_EVENTDATA_H_ +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_EVENTDATA_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/EventHandler.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/EventHandler.h index 326a256d7a802..11ed1dff2f2e0 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/EventHandler.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/EventHandler.h @@ -8,29 +8,8 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_EVENTHANDLER_H_ -#define ALICEO2_EMCAL_EVENTHANDLER_H_ - -#include -#include -#include -#include -#include -#include "Rtypes.h" -#include "fmt/format.h" -#include "DataFormatsEMCAL/Cell.h" -#include "DataFormatsEMCAL/Cluster.h" -#include "DataFormatsEMCAL/Digit.h" -#include "DataFormatsEMCAL/EventData.h" -#include "DataFormatsEMCAL/MCLabel.h" -#include "DataFormatsEMCAL/TriggerRecord.h" -#include "SimulationDataFormat/MCTruthContainer.h" - -namespace o2 -{ -namespace emcal -{ +/// \file EventHandler.h /// \class EventHandler /// \brief Handler for EMCAL event data /// \ingroup EMCALbase @@ -82,6 +61,30 @@ namespace emcal /// /// #Supported cell input types /// The event handler can support o2::emcal::Digit or o2::emcal::Cell as input type for cells. + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_EVENTHANDLER_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_EVENTHANDLER_H_ + +#include +#include +#include +#include +#include +#include +#include "Rtypes.h" +#include "fmt/format.h" +#include "DataFormatsEMCAL/Cell.h" +#include "DataFormatsEMCAL/Cluster.h" +#include "DataFormatsEMCAL/Digit.h" +#include "DataFormatsEMCAL/EventData.h" +#include "DataFormatsEMCAL/MCLabel.h" +#include "DataFormatsEMCAL/TriggerRecord.h" +#include "SimulationDataFormat/MCTruthContainer.h" + +namespace o2 +{ +namespace emcal +{ template class EventHandler { @@ -270,9 +273,9 @@ class EventHandler /// \return Pointer to the current event EventData* operator*() { return &mCurrentEvent; } - /// \brief Get reference to the current event - /// \return Reference to the current event of the iterator - EventData& operator&() { return mCurrentEvent; } + // /// \brief Get reference to the current event + // /// \return Reference to the current event of the iterator + // EventData& operator&() { return mCurrentEvent; } /// \brief Get the index of the current event /// \return Index of the current event @@ -321,11 +324,11 @@ class EventHandler /// \brief Get backward start iterator /// \return Start iterator - EventIterator rbegin() const { return EventIterator(*this, getNumberOfEvents() - 1, false); }; + EventIterator rbegin() const { return EventIterator(*this, getNumberOfEvents() - 1, false); } /// \brief Get backward end iteration marker /// \return Iteration end marker - EventIterator rend() const { return EventIterator(*this, -1, false); }; + EventIterator rend() const { return EventIterator(*this, -1, false); } /// \brief Get the number of events handled by the event handler /// \return Number of events @@ -461,4 +464,4 @@ class EventHandler } // namespace emcal } // namespace o2 -#endif // ALICEO2_EMCAL_EVENTHANDLER_H__ +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_EVENTHANDLER_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/MCLabel.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/MCLabel.h index ff851b2692edb..a426df20fc805 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/MCLabel.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/MCLabel.h @@ -9,10 +9,14 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// Declaration of a transient MC label class for EMCal +/// \file MCLabel.h +/// \class MCLabel +/// \brief Declaration of a transient MC label class for EMCal +/// \ingroup EMCALDataFormat +/// \author anders.knospe@cern.ch -#ifndef ALICEO2_EMCAL_MCLABEL_H_ -#define ALICEO2_EMCAL_MCLABEL_H_ +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_MCLABEL_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_MCLABEL_H_ #include "SimulationDataFormat/MCCompLabel.h" @@ -20,25 +24,21 @@ namespace o2 { namespace emcal { - -/// \class MCLabel -/// \brief Monte-Carlo label for EMCAL clusters / digits -/// \ingroup EMCALDataFormat class MCLabel : public o2::MCCompLabel { private: - Double_t mAmplitudeFraction; + double mAmplitudeFraction; public: MCLabel() = default; - MCLabel(Int_t trackID, Int_t eventID, Int_t srcID, Bool_t fake, Double_t afraction) : o2::MCCompLabel(trackID, eventID, srcID, fake), mAmplitudeFraction(afraction) {} - MCLabel(Bool_t noise, Double_t afraction) : o2::MCCompLabel(noise), mAmplitudeFraction(afraction) {} - void setAmplitudeFraction(Double_t afraction) { mAmplitudeFraction = afraction; } - Double_t getAmplitudeFraction() const { return mAmplitudeFraction; } + MCLabel(int trackID, int eventID, int srcID, bool fake, double afraction) : o2::MCCompLabel(trackID, eventID, srcID, fake), mAmplitudeFraction(afraction) {} + MCLabel(bool noise, double afraction) : o2::MCCompLabel(noise), mAmplitudeFraction(afraction) {} + void setAmplitudeFraction(double afraction) { mAmplitudeFraction = afraction; } + double getAmplitudeFraction() const { return mAmplitudeFraction; } ClassDefNV(MCLabel, 1); }; } // namespace emcal -} //namespace o2 +} // namespace o2 -#endif +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_MCLABEL_H_ diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/TriggerRecord.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/TriggerRecord.h index 1529eff104400..51506358da9ef 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/TriggerRecord.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/TriggerRecord.h @@ -9,8 +9,16 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_TRIGGERRECORD_H -#define ALICEO2_EMCAL_TRIGGERRECORD_H +/// \file TriggerRecord.h +/// \class TriggerRecord +/// \brief Header for data corresponding to the same hardware trigger +/// \ingroup EMCALDataFormat +/// \author Markus Fasel +/// \since Nov 17, 2019 +/// adapted from DataFormatsITSMFT/ROFRecord + +#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_TRIGGERRECORD_H_ +#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_TRIGGERRECORD_H_ #include #include @@ -20,16 +28,8 @@ namespace o2 { - namespace emcal { - -/// \class TriggerRecord -/// \brief Header for data corresponding to the same hardware trigger -/// \ingroup EMCALDataFormat -/// \author Markus Fasel -/// \since Nov 17, 2019 -/// adapted from DataFormatsITSMFT/ROFRecord class TriggerRecord { using BCData = o2::InteractionRecord; @@ -78,4 +78,4 @@ std::ostream& operator<<(std::ostream& stream, const TriggerRecord& trg); } // namespace o2 -#endif +#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_TRIGGERRECORD_H_ diff --git a/DataFormats/Detectors/EMCAL/src/AnalysisCluster.cxx b/DataFormats/Detectors/EMCAL/src/AnalysisCluster.cxx index 05006b2618fd5..9d1bee84a84f9 100644 --- a/DataFormats/Detectors/EMCAL/src/AnalysisCluster.cxx +++ b/DataFormats/Detectors/EMCAL/src/AnalysisCluster.cxx @@ -10,36 +10,42 @@ // or submit itself to any jurisdiction. /// \file AnalysisCluster.cxx +/// \class AnalysisCluster +/// \brief Cluster class for kinematic cluster parameters +/// \ingroup EMCALDataFormat +/// ported from AliVCluster in AliRoot +/// \author Hadi Hassan , Oak Ridge National Laboratory +/// \since March 05, 2020 #include #include #include -#include #include "DataFormatsEMCAL/AnalysisCluster.h" +#include "Math/Vector4D.h" using namespace o2::emcal; //_______________________________________________________________________ void AnalysisCluster::clear() { - //if(mTracksMatched) delete mTracksMatched; - //mTracksMatched = 0; + // if(mTracksMatched) delete mTracksMatched; + // mTracksMatched = 0; mCellsAmpFraction.clear(); mCellsIndices.clear(); } //_______________________________________________________________________ -TLorentzVector AnalysisCluster::getMomentum(std::array vertex) const +ROOT::Math::PxPyPzEVector AnalysisCluster::getMomentum(std::array vertex) const { - TLorentzVector p; + ROOT::Math::PxPyPzEVector p; float pos[3] = {mGlobalPos.X(), mGlobalPos.Y(), mGlobalPos.Z()}; pos[0] -= vertex[0]; pos[1] -= vertex[1]; pos[2] -= vertex[2]; - float r = TMath::Sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]); + float r = std::sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]); if (r > 0) { p.SetPxPyPzE(mEnergy * pos[0] / r, mEnergy * pos[1] / r, mEnergy * pos[2] / r, mEnergy); diff --git a/DataFormats/Detectors/EMCAL/src/CTF.cxx b/DataFormats/Detectors/EMCAL/src/CTF.cxx index 1a897026f2e38..288399cb8d81a 100644 --- a/DataFormats/Detectors/EMCAL/src/CTF.cxx +++ b/DataFormats/Detectors/EMCAL/src/CTF.cxx @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file CTF.cxx +/// \author ruben.shahoyan@cern.ch +/// \brief Definitions for EMC CTF data + #include #include #include "DataFormatsEMCAL/CTF.h" diff --git a/DataFormats/Detectors/EMCAL/src/Cell.cxx b/DataFormats/Detectors/EMCAL/src/Cell.cxx index 261384d53ca2a..8a577b7ca5512 100644 --- a/DataFormats/Detectors/EMCAL/src/Cell.cxx +++ b/DataFormats/Detectors/EMCAL/src/Cell.cxx @@ -9,11 +9,19 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "DataFormatsEMCAL/Constants.h" -#include "DataFormatsEMCAL/Cell.h" -#include +/// \file Cell.cxx +/// \class Cell +/// \brief EMCAL compressed cell information +/// \author Anders Knospe, University of Houston +/// \author Markus Fasel , Oak Ridge National Laboratory +/// \since March 6, 2019 +/// \ingroup EMCALDataFormat + +#include #include #include +#include "DataFormatsEMCAL/Constants.h" +#include "DataFormatsEMCAL/Cell.h" using namespace o2::emcal; @@ -43,7 +51,7 @@ const float ENERGY_RESOLUTION_HG = HGLGTRANSITION / ENERGY_BITS, ENERGY_RESOLUTION_TRU = ENERGY_TRUNCATION / ENERGY_BITS, ENERGY_RESOLUTION_LEDMON = ENERGY_TRUNCATION / ENERGY_BITS; -} +} // namespace v1 namespace v2 { @@ -58,7 +66,7 @@ const float ENERGY_RESOLUTION_TRU = ENERGY_TRUNCATION / ENERGY_BITS, ENERGY_RESOLUTION_LEDMON = ENERGY_TRUNCATION / ENERGY_BITS; -} +} // namespace v2 } // namespace EnergyEncoding namespace DecodingV0 @@ -72,7 +80,7 @@ struct __attribute__((packed)) CellDataPacked { }; } // namespace DecodingV0 -Cell::Cell(short tower, float energy, float timestamp, ChannelType_t ctype) : mTowerID(tower), mEnergy(energy), mTimestamp(timestamp), mChannelType(ctype) +Cell::Cell(int16_t tower, float energy, float timestamp, ChannelType_t ctype) : mTowerID(tower), mEnergy(energy), mTimestamp(timestamp), mChannelType(ctype) { } @@ -169,7 +177,7 @@ ChannelType_t Cell::getCellTypeFromPackedBitfieldV0(const char* bitfield) return static_cast(reinterpret_cast(bitfield)->mCellStatus); } -short Cell::getTowerFromPackedBitfieldV0(const char* bitfield) +int16_t Cell::getTowerFromPackedBitfieldV0(const char* bitfield) { return reinterpret_cast(bitfield)->mTowerID; } diff --git a/DataFormats/Detectors/EMCAL/src/CellLabel.cxx b/DataFormats/Detectors/EMCAL/src/CellLabel.cxx index 8dde7ea90c435..0a7cb238f553d 100644 --- a/DataFormats/Detectors/EMCAL/src/CellLabel.cxx +++ b/DataFormats/Detectors/EMCAL/src/CellLabel.cxx @@ -10,6 +10,11 @@ // or submit itself to any jurisdiction. /// \file CellLabel.cxx +/// \class CellLabel +/// \brief cell class for MC particle IDs and their respective amplitude fraction +/// \ingroup EMCALDataFormat +/// \author Marvin Hemmer , Goethe university Frankfurt +/// \since December 13, 2023 #include "DataFormatsEMCAL/CellLabel.h" diff --git a/DataFormats/Detectors/EMCAL/src/Cluster.cxx b/DataFormats/Detectors/EMCAL/src/Cluster.cxx index 4b9dc713b9b65..5bcff06a8082e 100644 --- a/DataFormats/Detectors/EMCAL/src/Cluster.cxx +++ b/DataFormats/Detectors/EMCAL/src/Cluster.cxx @@ -8,15 +8,23 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. + +/// \file Cluster.h +/// \class Cluster +/// \brief EMCAL Cluster +/// \ingroup EMCALDataFormat +/// \author Markus Fasel , Oak Ridge National Laboratory +/// + #include #include -#include +#include #include "DataFormatsEMCAL/Cluster.h" using namespace o2::emcal; -Cluster::Cluster(Float_t time, int firstcell, int ncells) : o2::dataformats::TimeStamp(time), - mCellIndices(firstcell, ncells) +Cluster::Cluster(float time, int firstcell, int ncells) : o2::dataformats::TimeStamp(time), + mCellIndices(firstcell, ncells) { } diff --git a/DataFormats/Detectors/EMCAL/src/ClusterLabel.cxx b/DataFormats/Detectors/EMCAL/src/ClusterLabel.cxx index 9ad1f9be5459f..994c097f63be9 100644 --- a/DataFormats/Detectors/EMCAL/src/ClusterLabel.cxx +++ b/DataFormats/Detectors/EMCAL/src/ClusterLabel.cxx @@ -10,6 +10,14 @@ // or submit itself to any jurisdiction. /// \file ClusterLabel.cxx +/// \class ClusterLabel +/// \brief cluster class for MC particle IDs and their respective energy fraction +/// \ingroup EMCALDataFormat +/// \author Marvin Hemmer , Goethe university Frankfurt +/// \since December 13, 2023 + +#include +#include #include "DataFormatsEMCAL/ClusterLabel.h" @@ -25,7 +33,7 @@ void ClusterLabel::clear() void ClusterLabel::addValue(int label, float energyFraction) { auto it = std::find_if(mClusterLabels.begin(), mClusterLabels.end(), - [label](const labelWithE& lWE) { return lWE.label == label; }); + [label](const LabelWithE& lWE) { return lWE.label == label; }); if (it != mClusterLabels.end()) { // label already exists, accumulate energy fraction @@ -49,7 +57,7 @@ std::vector ClusterLabel::getLabels() { std::vector vLabels; vLabels.reserve(mClusterLabels.size()); - for (auto& clusterlabel : mClusterLabels) { + for (const auto& clusterlabel : mClusterLabels) { vLabels.push_back(clusterlabel.label); } return vLabels; @@ -60,7 +68,7 @@ std::vector ClusterLabel::getEnergyFractions() { std::vector vEnergyFractions; vEnergyFractions.reserve(mClusterLabels.size()); - for (auto& clusterlabel : mClusterLabels) { + for (const auto& clusterlabel : mClusterLabels) { vEnergyFractions.push_back(clusterlabel.energyFraction); } return vEnergyFractions; @@ -71,5 +79,5 @@ void ClusterLabel::orderLabels() { // Sort the pairs based on values in descending order std::sort(mClusterLabels.begin(), mClusterLabels.end(), - [](const labelWithE& a, const labelWithE& b) { return a.energyFraction > b.energyFraction; }); + [](const LabelWithE& a, const LabelWithE& b) { return a.energyFraction > b.energyFraction; }); } diff --git a/DataFormats/Detectors/EMCAL/src/CompressedTriggerData.cxx b/DataFormats/Detectors/EMCAL/src/CompressedTriggerData.cxx index e60b58c958d03..87699e4324c67 100644 --- a/DataFormats/Detectors/EMCAL/src/CompressedTriggerData.cxx +++ b/DataFormats/Detectors/EMCAL/src/CompressedTriggerData.cxx @@ -9,7 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include +/// \file CompressedTriggerData.cxx +/// \brief compressed trigger data structs +/// \author Markus Fasel , Oak Ridge National Laboratory + +#include #include "DataFormatsEMCAL/CompressedTriggerData.h" std::ostream& o2::emcal::operator<<(std::ostream& stream, const o2::emcal::CompressedTRU& tru) @@ -28,4 +32,4 @@ std::ostream& o2::emcal::operator<<(std::ostream& stream, const o2::emcal::Compr { stream << "FastOR " << timesum.mIndex << ": " << timesum.mTimesum << " ADC counts"; return stream; -} \ No newline at end of file +} diff --git a/DataFormats/Detectors/EMCAL/src/Constants.cxx b/DataFormats/Detectors/EMCAL/src/Constants.cxx index 0b9230ff07dbb..59d2e81fe0888 100644 --- a/DataFormats/Detectors/EMCAL/src/Constants.cxx +++ b/DataFormats/Detectors/EMCAL/src/Constants.cxx @@ -8,7 +8,13 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include + +/// \file Constants.cxx +/// \brief EMCal related constants, mainly streamer functionality +/// \author Markus Fasel , Oak Ridge National Laboratory + +#include +#include #include "DataFormatsEMCAL/Constants.h" std::ostream& o2::emcal::operator<<(std::ostream& stream, o2::emcal::ChannelType_t chantype) @@ -33,7 +39,7 @@ std::string o2::emcal::channelTypeToString(o2::emcal::ChannelType_t chantype) case o2::emcal::ChannelType_t::LEDMON: typestring = "LEDmon"; break; - }; + } return typestring; } @@ -48,8 +54,8 @@ int o2::emcal::channelTypeToInt(o2::emcal::ChannelType_t chantype) return 2; case o2::emcal::ChannelType_t::LEDMON: return 3; - }; - throw o2::emcal::InvalidChanneltypeException(int(chantype)); + } + throw o2::emcal::InvalidChanneltypeException(static_cast(chantype)); } o2::emcal::ChannelType_t o2::emcal::intToChannelType(int chantype) @@ -63,6 +69,6 @@ o2::emcal::ChannelType_t o2::emcal::intToChannelType(int chantype) return o2::emcal::ChannelType_t::TRU; case 3: return o2::emcal::ChannelType_t::LEDMON; - }; + } throw o2::emcal::InvalidChanneltypeException(chantype); } diff --git a/DataFormats/Detectors/EMCAL/src/Digit.cxx b/DataFormats/Detectors/EMCAL/src/Digit.cxx index a88cc652cdd6d..d1882ec3279e9 100644 --- a/DataFormats/Detectors/EMCAL/src/Digit.cxx +++ b/DataFormats/Detectors/EMCAL/src/Digit.cxx @@ -9,17 +9,21 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file Digit.cxx +/// \author anders.knospe@cern.ch +/// \brief Definition of EMCal Digit class + #include "DataFormatsEMCAL/Digit.h" -#include +#include using namespace o2::emcal; -Digit::Digit(Short_t tower, Double_t amplitudeGeV, Double_t time) +Digit::Digit(int16_t tower, double amplitudeGeV, double time) : DigitBase(time), mTower(tower), mAmplitudeGeV(amplitudeGeV) { } -Digit::Digit(Short_t tower, uint16_t noiseLG, uint16_t noiseHG, Double_t time) +Digit::Digit(int16_t tower, uint16_t noiseLG, uint16_t noiseHG, double time) : DigitBase(time), mNoiseLG(noiseLG), mNoiseHG(noiseHG), mTower(tower) { } @@ -34,7 +38,7 @@ Digit& Digit::operator+=(const Digit& other) return *this; } -void Digit::setAmplitudeADC(Short_t amplitude, ChannelType_t ctype) +void Digit::setAmplitudeADC(int16_t amplitude, ChannelType_t ctype) { // truncate energy in case dynamic range is saturated @@ -60,10 +64,10 @@ void Digit::setAmplitudeADC(Short_t amplitude, ChannelType_t ctype) // can only be LEDMon which is not simulated mAmplitudeGeV = 0.; break; - }; + } } -Int_t Digit::getAmplitudeADC(ChannelType_t ctype) const +int Digit::getAmplitudeADC(ChannelType_t ctype) const { switch (ctype) { @@ -95,10 +99,10 @@ Int_t Digit::getAmplitudeADC(ChannelType_t ctype) const default: // can only be LEDMon which is not simulated return 0; - }; + } } -Double_t Digit::getAmplitude() const +double Digit::getAmplitude() const { double noise = 0; @@ -119,7 +123,7 @@ Double_t Digit::getAmplitude() const default: // can only be LEDMon which is not simulated return 0; - }; + } } ChannelType_t Digit::getType() const diff --git a/DataFormats/Detectors/EMCAL/src/EventHandler.cxx b/DataFormats/Detectors/EMCAL/src/EventHandler.cxx index 79483f18c3635..6d3187baef920 100644 --- a/DataFormats/Detectors/EMCAL/src/EventHandler.cxx +++ b/DataFormats/Detectors/EMCAL/src/EventHandler.cxx @@ -9,7 +9,15 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file EventHandler.cxx +/// \class EventHandler +/// \brief Handler for EMCAL event data +/// \ingroup EMCALbase +/// \author Markus Fasel , Oak Ridge National Laboratory +/// \since March 1st, 2020 + #include "DataFormatsEMCAL/EventHandler.h" +#include #include using namespace o2::emcal; diff --git a/DataFormats/Detectors/EMCAL/src/TriggerRecord.cxx b/DataFormats/Detectors/EMCAL/src/TriggerRecord.cxx index 7ca716dbb4ea2..56a1a102b5d9b 100644 --- a/DataFormats/Detectors/EMCAL/src/TriggerRecord.cxx +++ b/DataFormats/Detectors/EMCAL/src/TriggerRecord.cxx @@ -9,8 +9,16 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file TriggerRecord.cxx +/// \class TriggerRecord +/// \brief Header for data corresponding to the same hardware trigger +/// \ingroup EMCALDataFormat +/// \author Markus Fasel +/// \since Nov 17, 2019 +/// adapted from DataFormatsITSMFT/ROFRecord + #include -#include +#include #include "DataFormatsEMCAL/TriggerRecord.h" #include "CommonConstants/Triggers.h" #include "DataFormatsEMCAL/Constants.h" @@ -61,4 +69,4 @@ std::ostream& operator<<(std::ostream& stream, const TriggerRecord& trg) return stream; } } // namespace emcal -} // namespace o2 \ No newline at end of file +} // namespace o2 diff --git a/Detectors/EMCAL/base/CMakeLists.txt b/Detectors/EMCAL/base/CMakeLists.txt index 62a0cb6d9a25b..07882f580ee98 100644 --- a/Detectors/EMCAL/base/CMakeLists.txt +++ b/Detectors/EMCAL/base/CMakeLists.txt @@ -58,4 +58,4 @@ o2_add_test(RCUTrailer o2_add_test_root_macro(test/testGeometryRowColIndexing.C PUBLIC_LINK_LIBRARIES O2::EMCALBase - LABELS emcal) \ No newline at end of file + LABELS emcal) diff --git a/Detectors/EMCAL/base/include/EMCALBase/ClusterFactory.h b/Detectors/EMCAL/base/include/EMCALBase/ClusterFactory.h index 3ce7003fe9814..8444cfcdb81fb 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/ClusterFactory.h +++ b/Detectors/EMCAL/base/include/EMCALBase/ClusterFactory.h @@ -8,15 +8,27 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_CLUSTERFACTORY_H_ -#define ALICEO2_EMCAL_CLUSTERFACTORY_H_ + +/// \file ClusterFactory.h +/// \brief Header file for EMCal cluster factory class that creates clusters from cells +/// \author Markus Fasel, markus.fasel@cern.ch +/// \author Hadi Hassan, hadi.hassan@cern.ch +/// \author M. Hemmer, marvin.hemmer@cern.ch + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_CLUSTERFACTORY_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_CLUSTERFACTORY_H_ +#include + #include #include #include #include -#include +#include +#include + #include "Rtypes.h" #include "fmt/format.h" + #include "DataFormatsEMCAL/Cluster.h" #include "DataFormatsEMCAL/Digit.h" #include "DataFormatsEMCAL/Cell.h" @@ -175,13 +187,14 @@ class ClusterFactory /// \return Pointer to the current event AnalysisCluster* operator*() { return &mCurrentCluster; } - /// \brief Get reference to the current cluster - /// \return Reference to the current event of the iterator - AnalysisCluster& operator&() { return mCurrentCluster; } + // Unary operator& is dangerous. We should not use it! + // /// \brief Get reference to the current cluster + // /// \return Reference to the current event of the iterator + // AnalysisCluster& operator&() { return mCurrentCluster; } /// \brief Get the index of the current event /// \return Index of the current event - int current_index() const { return mClusterID; } + int currentIndex() const { return mClusterID; } private: const ClusterFactory& mClusterFactory; ///< Event factory connected to the iterator @@ -223,11 +236,11 @@ class ClusterFactory /// \brief Get backward start iterator /// \return Start iterator - ClusterIterator rbegin() const { return ClusterIterator(*this, getNumberOfClusters() - 1, false); }; + ClusterIterator rbegin() const { return ClusterIterator(*this, getNumberOfClusters() - 1, false); } /// \brief Get backward end iteration marker /// \return Iteration end marker - ClusterIterator rend() const { return ClusterIterator(*this, -1, false); }; + ClusterIterator rend() const { return ClusterIterator(*this, -1, false); } /// \brief Reset containers void reset(); @@ -236,8 +249,8 @@ class ClusterFactory /// evaluates cluster parameters: position, shower shape, primaries ... AnalysisCluster buildCluster(int index, o2::emcal::ClusterLabel* clusterLabel = nullptr) const; - void SetECALogWeight(Float_t w) { mLogWeight = w; } - float GetECALogWeight() const { return mLogWeight; } + void setECALogWeight(float w) { mLogWeight = w; } + float getECALogWeight() const { return mLogWeight; } void doEvalLocal2tracking(bool justCluster) { @@ -256,14 +269,14 @@ class ClusterFactory /// /// evaluates local position of clusters in SM - void evalLocalPositionFit(Double_t deff, Double_t w0, Double_t phiSlope, gsl::span inputsIndices, AnalysisCluster& cluster) const; + void evalLocalPositionFit(double deff, double w0, double phiSlope, gsl::span inputsIndices, AnalysisCluster& cluster) const; /// /// Applied for simulation data with threshold 3 adc /// Calculate efective distance (deff) and weigh parameter (w0) /// for coordinate calculation; 0.5 GeV < esum <100 GeV. /// Look to: http://rhic.physics.wayne.edu/~pavlinov/ALICE/SHISHKEBAB/RES/CALIB/GEOMCORR/deffandW0VaEgamma_2.gif - static void getDeffW0(const Double_t esum, Double_t& deff, Double_t& w0); + static void getDeffW0(const double esum, double& deff, double& w0); /// /// Finds the maximum energy in the cluster @@ -280,19 +293,19 @@ class ClusterFactory /// \param exoticTime: time of the cell with largest energy fraction in cluster /// \param fCross: exoticity parameter (1-E_cross/E_cell^max) will be caluclated for this check /// \return bool true if cell is found exotic - bool isExoticCell(short towerId, float ecell, float const exoticTime, float& fCross) const; + bool isExoticCell(int16_t towerId, float ecell, float const exoticTime, float& fCross) const; /// \brief Calculate the energy in the cross around the energy of a given cell. /// \param absID: controlled cell absolute ID number /// \param energy: cluster or cell max energy, used for weight calculation /// \param exoticTime time of the cell with largest energy fraction in cluster /// \return the energy in the cross around the energy of a given cell - float getECross(short absID, float energy, float const exoticTime) const; + float getECross(int16_t absID, float energy, float const exoticTime) const; /// \param eCell: cluster cell energy /// \param eCluster: cluster or cell max energy /// \return weight of cell for shower shape calculation - float GetCellWeight(float eCell, float eCluster) const; + float getCellWeight(float eCell, float eCluster) const; /// /// Calculates the multiplicity of digits/cells with energy larger than level*energy @@ -314,7 +327,7 @@ class ClusterFactory /// /// \param e: energy in GeV) /// \param key: = 0(gamma, default); != 0(electron) - Double_t tMaxInCm(const Double_t e = 0.0, const int key = 0) const; + double tMaxInCm(const double e = 0.0, const int key = 0) const; bool getLookUpInit() const { return mLookUpInit; } @@ -352,7 +365,7 @@ class ClusterFactory void setLookUpTable(void) { mLoolUpTowerToIndex.fill(-1); - for (auto iCellIndex : mCellsIndices) { + for (const auto& iCellIndex : mCellsIndices) { mLoolUpTowerToIndex[mInputsContainer[iCellIndex].getTower()] = iCellIndex; } mLookUpInit = true; @@ -436,7 +449,7 @@ class ClusterFactory gsl::span mClustersContainer; ///< Container for all the clusters in the event gsl::span mInputsContainer; ///< Container for all the cells/digits in the event gsl::span mCellsIndices; ///< Container for cells indices in the event - std::array mLoolUpTowerToIndex; ///< Lookup table to match tower id with cell index, needed for exotic check + std::array mLoolUpTowerToIndex; ///< Lookup table to match tower id with cell index, needed for exotic check gsl::span mCellLabelContainer; ///< Container for all the cell labels in the event ClassDefNV(ClusterFactory, 2); @@ -444,4 +457,4 @@ class ClusterFactory } // namespace emcal } // namespace o2 -#endif // ALICEO2_EMCAL_CLUSTERFACTORY_H_ +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_CLUSTERFACTORY_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/Geometry.h b/Detectors/EMCAL/base/include/EMCALBase/Geometry.h index 4d4a947de88ca..a0de9a64f0d23 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/Geometry.h +++ b/Detectors/EMCAL/base/include/EMCALBase/Geometry.h @@ -9,8 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_GEOMETRY_H_ -#define ALICEO2_EMCAL_GEOMETRY_H_ +/// \file Geometry.h +/// \brief Header file for EMCal geometry class +/// \author Markus Fasel, markus.fasel@cern.ch +/// \author Hadi Hassan, hadi.hassan@cern.ch + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_GEOMETRY_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_GEOMETRY_H_ #include #include @@ -93,7 +98,7 @@ class Geometry /// \param mcname Geant3/4, Fluka, needed for settings of transport (check). Not really needed to be specified. /// \param mctitle Geant4 physics list (check). Not really needed to be specified. /// \return the pointer of the unique instance - static Geometry* GetInstanceFromRunNumber(Int_t runNumber, const std::string_view = "", + static Geometry* GetInstanceFromRunNumber(int runNumber, const std::string_view = "", const std::string_view mcname = "TGeant3", const std::string_view mctitle = ""); @@ -110,9 +115,9 @@ class Geometry const std::string& GetName() const { return mGeoName; } - static const std::string& GetDefaultGeometryName() { return DEFAULT_GEOMETRY; } + static const char* GetDefaultGeometryName() { return DEFAULT_GEOMETRY; } - static Bool_t IsInitialized() { return Geometry::sGeom != nullptr; } + static bool IsInitialized() { return Geometry::sGeom != nullptr; } /// /// Generate the list of Trd1 modules @@ -125,14 +130,14 @@ class Geometry /// \brief Get the Module parameters for a eta /// \return the shishkebabmodule at a given eta index point. - const ShishKebabTrd1Module& GetShishKebabModule(Int_t neta) const; + const ShishKebabTrd1Module& GetShishKebabModule(int neta) const; /// \brief Check if particle falls in the EMCal/DCal geometry /// \param particle Particle to be checked /// \return true in EMCal/DCa; /// /// Call ImpactOnEmcal. - Bool_t Impact(const TParticle* particle) const; + bool Impact(const TParticle* particle) const; /// \brief Get the impact coordinates on EMCAL /// \param[in] vtx TVector3 with vertex @@ -144,21 +149,21 @@ class Geometry /// Calculates the impact coordinates on EMCAL (centre of a tower/not on EMCAL surface) /// of a neutral particle emitted in the vertex vtx[3] with direction theta and phi in /// the global coordinate system - void ImpactOnEmcal(const math_utils::Point3D& vtx, Double_t theta, Double_t phi, Int_t& absId, math_utils::Point3D& vimpact) const; + void ImpactOnEmcal(const math_utils::Point3D& vtx, double theta, double phi, int& absId, math_utils::Point3D& vimpact) const; /// \brief Checks whether point is inside the EMCal volume /// \param pnt Point to be checked /// \return True if the point is inside EMCAL, false otherwise /// /// See IsInEMCALOrDCAL for the definition of the acceptance check - Bool_t IsInEMCAL(const math_utils::Point3D& pnt) const; + bool IsInEMCAL(const math_utils::Point3D& pnt) const; /// \brief Checks whether point is inside the DCal volume /// \param pnt Point to be checked /// \return True if the point is inside DCAL, false otherwise /// /// See IsInEMCALOrDCAL for the definition of the acceptance check - Bool_t IsInDCAL(const math_utils::Point3D& pnt) const; + bool IsInDCAL(const math_utils::Point3D& pnt) const; /// \brief Checks whether point is inside the EMCal volume (included DCal) /// \param pnt Point to be checked @@ -174,74 +179,74 @@ class Geometry // Return EMCAL geometrical parameters // - const Char_t* GetNameOfEMCALEnvelope() const { return "XEN1"; } - Float_t GetArm1PhiMin() const { return mArm1PhiMin; } - Float_t GetArm1PhiMax() const { return mArm1PhiMax; } - Float_t GetArm1EtaMin() const { return mArm1EtaMin; } - Float_t GetArm1EtaMax() const { return mArm1EtaMax; } - Float_t GetIPDistance() const { return mIPDistance; } - Float_t GetEnvelop(Int_t index) const { return mEnvelop[index]; } - Float_t GetShellThickness() const { return mShellThickness; } - Float_t GetZLength() const { return mZLength; } - Float_t GetDCALInnerEdge() const { return mDCALInnerEdge; } - Float_t GetDCALPhiMin() const { return mDCALPhiMin; } - Float_t GetDCALPhiMax() const { return mDCALPhiMax; } - Float_t GetEMCALPhiMax() const { return mEMCALPhiMax; } - Float_t GetDCALStandardPhiMax() const { return mDCALStandardPhiMax; } - Int_t GetNECLayers() const { return mNECLayers; } - Float_t GetDCALInnerExtandedEta() const { return mDCALInnerExtandedEta; } + const char* GetNameOfEMCALEnvelope() const { return "XEN1"; } + float GetArm1PhiMin() const { return mArm1PhiMin; } + float GetArm1PhiMax() const { return mArm1PhiMax; } + float GetArm1EtaMin() const { return mArm1EtaMin; } + float GetArm1EtaMax() const { return mArm1EtaMax; } + float GetIPDistance() const { return mIPDistance; } + float GetEnvelop(int index) const { return mEnvelop[index]; } + float GetShellThickness() const { return mShellThickness; } + float GetZLength() const { return mZLength; } + float GetDCALInnerEdge() const { return mDCALInnerEdge; } + float GetDCALPhiMin() const { return mDCALPhiMin; } + float GetDCALPhiMax() const { return mDCALPhiMax; } + float GetEMCALPhiMax() const { return mEMCALPhiMax; } + float GetDCALStandardPhiMax() const { return mDCALStandardPhiMax; } + int GetNECLayers() const { return mNECLayers; } + float GetDCALInnerExtandedEta() const { return mDCALInnerExtandedEta; } /// \brief Get the number of modules in supermodule in z- (beam) direction /// \return Number of modules - Int_t GetNZ() const { return mNZ; } + int GetNZ() const { return mNZ; } /// \brief Get the number of modules in supermodule in #eta direction /// \return Number of modules - Int_t GetNEta() const { return mNZ; } + int GetNEta() const { return mNZ; } /// \brief Get the number of modules in supermodule in #phi direction /// \return Number of modules - Int_t GetNPhi() const { return mNPhi; } - - Float_t GetECPbRadThick() const { return mECPbRadThickness; } - Float_t GetECScintThick() const { return mECScintThick; } - Float_t GetSampling() const { return mSampling; } - Int_t GetNumberOfSuperModules() const { return mNumberOfSuperModules; } - Float_t GetPhiGapForSuperModules() const { return mPhiGapForSM; } - Float_t GetPhiModuleSize() const { return mPhiModuleSize; } - Float_t GetEtaModuleSize() const { return mEtaModuleSize; } - Float_t GetFrontSteelStrip() const { return mFrontSteelStrip; } - Float_t GetLateralSteelStrip() const { return mLateralSteelStrip; } - Float_t GetPassiveScintThick() const { return mPassiveScintThick; } - Float_t GetPhiTileSize() const { return mPhiTileSize; } - Float_t GetEtaTileSize() const { return mEtaTileSize; } - Float_t GetPhiSuperModule() const { return mPhiSuperModule; } - Int_t GetNPhiSuperModule() const { return mNPhiSuperModule; } - Int_t GetNPHIdiv() const { return mNPHIdiv; } - Int_t GetNETAdiv() const { return mNETAdiv; } - Int_t GetNCells() const { return mNCells; } - Float_t GetLongModuleSize() const { return mLongModuleSize; } - Float_t GetTrd1Angle() const { return mTrd1Angle; } - Float_t Get2Trd1Dx2() const { return m2Trd1Dx2; } - Float_t GetTrd1AlFrontThick() const { return mTrd1AlFrontThick; } - Float_t GetTrd1BondPaperThick() const { return mTrd1BondPaperThick; } + int GetNPhi() const { return mNPhi; } + + float GetECPbRadThick() const { return mECPbRadThickness; } + float GetECScintThick() const { return mECScintThick; } + float GetSampling() const { return mSampling; } + int GetNumberOfSuperModules() const { return mNumberOfSuperModules; } + float GetPhiGapForSuperModules() const { return mPhiGapForSM; } + float GetPhiModuleSize() const { return mPhiModuleSize; } + float GetEtaModuleSize() const { return mEtaModuleSize; } + float GetFrontSteelStrip() const { return mFrontSteelStrip; } + float GetLateralSteelStrip() const { return mLateralSteelStrip; } + float GetPassiveScintThick() const { return mPassiveScintThick; } + float GetPhiTileSize() const { return mPhiTileSize; } + float GetEtaTileSize() const { return mEtaTileSize; } + float GetPhiSuperModule() const { return mPhiSuperModule; } + int GetNPhiSuperModule() const { return mNPhiSuperModule; } + int GetNPHIdiv() const { return mNPHIdiv; } + int GetNETAdiv() const { return mNETAdiv; } + int GetNCells() const { return mNCells; } + float GetLongModuleSize() const { return mLongModuleSize; } + float GetTrd1Angle() const { return mTrd1Angle; } + float Get2Trd1Dx2() const { return m2Trd1Dx2; } + float GetTrd1AlFrontThick() const { return mTrd1AlFrontThick; } + float GetTrd1BondPaperThick() const { return mTrd1BondPaperThick; } // -- - Int_t GetNCellsInSupMod() const { return mNCellsInSupMod; } - Int_t GetNCellsInModule() const { return mNCellsInModule; } - Int_t GetKey110DEG() const { return mKey110DEG; } - Int_t GetnSupModInDCAL() const { return mnSupModInDCAL; } - Int_t GetILOSS() const { return mILOSS; } - Int_t GetIHADR() const { return mIHADR; } + int GetNCellsInSupMod() const { return mNCellsInSupMod; } + int GetNCellsInModule() const { return mNCellsInModule; } + int GetKey110DEG() const { return mKey110DEG; } + int GetnSupModInDCAL() const { return mnSupModInDCAL; } + int GetILOSS() const { return mILOSS; } + int GetIHADR() const { return mIHADR; } // -- - Float_t GetDeltaEta() const { return (mArm1EtaMax - mArm1EtaMin) / ((Float_t)mNZ); } - Float_t GetDeltaPhi() const { return (mArm1PhiMax - mArm1PhiMin) / ((Float_t)mNPhi); } - Int_t GetNTowers() const { return mNPhi * mNZ; } + float GetDeltaEta() const { return (mArm1EtaMax - mArm1EtaMin) / (static_cast(mNZ)); } + float GetDeltaPhi() const { return (mArm1PhiMax - mArm1PhiMin) / (static_cast(mNPhi)); } + int GetNTowers() const { return mNPhi * mNZ; } // - Double_t GetPhiCenterOfSM(Int_t nsupmod) const; - Double_t GetPhiCenterOfSMSec(Int_t nsupmod) const; - Float_t GetSuperModulesPar(Int_t ipar) const { return mParSM[ipar]; } + double GetPhiCenterOfSM(int nsupmod) const; + double GetPhiCenterOfSMSec(int nsupmod) const; + float GetSuperModulesPar(int ipar) const { return mParSM[ipar]; } // - EMCALSMType GetSMType(Int_t nSupMod) const + EMCALSMType GetSMType(int nSupMod) const { if (nSupMod >= mNumberOfSuperModules) { throw SupermoduleIndexException(nSupMod, mNumberOfSuperModules); @@ -252,28 +257,28 @@ class Geometry /// \brief Check if iSupMod is a valid DCal standard SM /// \param nSupMod ID of the supermodule to check /// \return True if the supermodule is a DCAL supermodule - Bool_t IsDCALSM(Int_t nSupMod) const; + bool IsDCALSM(int nSupMod) const; /// \brief Check if iSupMod is a valid DCal 1/3rd SM /// \param nSupMod ID of the supermodule to check /// \return True if the supermodule is a DCAL supermodule - Bool_t IsDCALExtSM(Int_t nSupMod) const; + bool IsDCALExtSM(int nSupMod) const; // Methods needed for SM in extension, where center of SM != center of the SM-section. // Used in AliEMCALv0 to calculate position. - std::tuple GetPhiBoundariesOfSM(Int_t nSupMod) const; - std::tuple GetPhiBoundariesOfSMGap(Int_t nPhiSec) const; + std::tuple GetPhiBoundariesOfSM(int nSupMod) const; + std::tuple GetPhiBoundariesOfSMGap(int nPhiSec) const; // Obsolete? - Float_t GetSteelFrontThickness() const { return mSteelFrontThick; } + float GetSteelFrontThickness() const { return mSteelFrontThick; } /////////////////////////////// // Geometry data member setters // - void SetNZ(Int_t nz) { mNZ = nz; } - void SetNPhi(Int_t nphi) { mNPhi = nphi; } + void SetNZ(int nz) { mNZ = nz; } + void SetNPhi(int nphi) { mNPhi = nphi; } // - void SetSampling(Float_t samp) { mSampling = samp; } + void SetSampling(float samp) { mSampling = samp; } ////////////////////////// // Global geometry methods @@ -285,7 +290,7 @@ class Geometry /// \param[in] ind super module number /// /// Use the supermodule alignment. - void GetGlobal(const Double_t* loc, Double_t* glob, int ind) const; + void GetGlobal(const double* loc, double* glob, int ind) const; /// \brief Figure out the global coordinates from local coordinates on a supermodule. /// \param[in] vloc local coordinates @@ -301,14 +306,14 @@ class Geometry /// \param absId cell absolute id. number. /// \param glob 3-double coordinates, output /// - void GetGlobal(Int_t absId, Double_t glob[3]) const; + void GetGlobal(int absId, double glob[3]) const; /// \brief Figure out the global coordinates of a cell. /// \param absId cell absolute id. number. /// \param vglob TVector3 coordinates, output /// /// Use the supermodule alignment. Use TVector3. - void GetGlobal(Int_t absId, TVector3& vglob) const; + void GetGlobal(int absId, TVector3& vglob) const; //////////////////////////////////////// // May 31, 2006; ALICE numbering scheme: @@ -338,7 +343,7 @@ class Geometry /// \return tuple with (pseudorapidity, polar angle) /// /// Call to GetGlobal(). - std::tuple EtaPhiFromIndex(Int_t absId) const; + std::tuple EtaPhiFromIndex(int absId) const; /// \brief Get cell absolute ID number from eta and phi location. /// @@ -346,7 +351,7 @@ class Geometry /// \param phi azimutal location /// \return cell absolute ID number /// \throw InvalidPositionException - int GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi) const; + int GetAbsCellIdFromEtaPhi(double eta, double phi) const; /// \brief get (Column,Row) pair of cell in global numbering scheme /// \param cellID Absolute cell ID @@ -392,7 +397,7 @@ class Geometry /// \param phi azimutal location /// \return super module number /// \throw InvalidPositionException - int SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi) const; + int SuperModuleNumberFromEtaPhi(double eta, double phi) const; /// \brief Get cell absolute ID number from location module (2 times 2 cells) of a super module /// \param supermoduleID super module number @@ -407,13 +412,13 @@ class Geometry /// \brief Check whether a cell number is valid /// \param absId input absolute cell ID number to check /// \return true if cell ID number exists - Bool_t CheckAbsCellId(Int_t absId) const; + bool CheckAbsCellId(int absId) const; /// \brief Get cell SM, module numbers from absolute ID number /// \param absId cell absolute id. number /// \return tuple(supermodule ID, module number, index of cell in module in phi, index of cell in module in eta) /// \throw InvalidCellIDException - std::tuple GetCellIndex(Int_t absId) const; + std::tuple GetCellIndex(int absId) const; /// \brief Get eta-phi indexes of module in SM /// \param supermoduleID super module number, input @@ -442,7 +447,7 @@ class Geometry /// /// Here shift the online cols or rows depending on the /// super-module number to match the offline mapping. - std::tuple ShiftOnlineToOfflineCellIndexes(Int_t supermoduleID, Int_t iphi, Int_t ieta) const; + std::tuple ShiftOnlineToOfflineCellIndexes(int supermoduleID, int iphi, int ieta) const; /// \brief Adapt cell indices in supermodule to offline indexing /// \param supermoduleID super module number of the channel/cell @@ -455,13 +460,13 @@ class Geometry /// /// Reverse procedure to the one in the method above /// ShiftOnlineToOfflineCellIndexes(). - std::tuple ShiftOfflineToOnlineCellIndexes(Int_t supermoduleID, Int_t iphi, Int_t ieta) const; + std::tuple ShiftOfflineToOnlineCellIndexes(int supermoduleID, int iphi, int ieta) const; /// \brief Get cell SM, from absolute ID number /// \param absId cell absolute id. number /// \return super module number - Int_t GetSuperModuleNumber(Int_t absId) const; - Int_t GetNumberOfModuleInPhiDirection(Int_t nSupMod) const + int GetSuperModuleNumber(int absId) const; + int GetNumberOfModuleInPhiDirection(int nSupMod) const { if (GetSMType(nSupMod) == EMCAL_HALF) { return mNPhi / 2; @@ -490,7 +495,7 @@ class Geometry /// \param iphi index of cell in phi direction inside super module /// \param ieta index of cell in eta direction inside super module /// \return cell absolute ID number - Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const; + int GetAbsCellIdFromCellIndexes(int nSupMod, int iphi, int ieta) const; /// \brief Look to see what the relative position inside a given cell is for a recpoint. /// \param absId cell absolute id. number, input @@ -498,15 +503,15 @@ class Geometry /// \return Point3D with x,y,z coordinates of cell with absId inside SM /// \throw InvalidCellIDException if cell ID does not exist /// - /// Same as RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) + /// Same as RelPosCellInSModule(int absId, double &xr, double &yr, double &zr) /// but taking into account position of shower max. - math_utils::Point3D RelPosCellInSModule(Int_t absId, Double_t distEf) const; + math_utils::Point3D RelPosCellInSModule(int absId, double distEf) const; /// \brief Look to see what the relative position inside a given cell is for a recpoint. /// \param absId cell absolute id. number, input /// \return Point3D with x,y,z coordinates of cell with absId inside SM /// \throw InvalidCellIDException if cell ID does not exist - math_utils::Point3D RelPosCellInSModule(Int_t absId) const; + math_utils::Point3D RelPosCellInSModule(int absId) const; /// \brief Get link ID, row and column from cell ID, have a look here: https://alice.its.cern.ch/jira/browse/EMCAL-660 /// \param towerID Cell ID @@ -521,28 +526,28 @@ class Geometry /// \param ddlID DDL ID /// \return CRORC ID /// \return CRORC Link - std::tuple getLinkAssignment(int ddlID) const { return std::make_tuple(mCRORCID[ddlID], mCRORCLink[ddlID]); }; + std::tuple getLinkAssignment(int ddlID) const { return std::make_tuple(mCRORCID[ddlID], mCRORCLink[ddlID]); } std::vector GetEMCSystem() const { return mEMCSMSystem; } // EMC System, SM type list // Local Coordinates of SM - std::vector GetCentersOfCellsEtaDir() const + std::vector GetCentersOfCellsEtaDir() const { return mCentersOfCellsEtaDir; } // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm) - std::vector GetCentersOfCellsXDir() const + std::vector GetCentersOfCellsXDir() const { return mCentersOfCellsXDir; } // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm) - std::vector GetCentersOfCellsPhiDir() const + std::vector GetCentersOfCellsPhiDir() const { return mCentersOfCellsPhiDir; } // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm) // - std::vector GetEtaCentersOfCells() const + std::vector GetEtaCentersOfCells() const { return mEtaCentersOfCells; } // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; - std::vector GetPhiCentersOfCells() const + std::vector GetPhiCentersOfCells() const { return mPhiCentersOfCells; } // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.) @@ -550,21 +555,21 @@ class Geometry /////////////////// // useful utilities // - Float_t AngleFromEta(Float_t eta) const + float AngleFromEta(float eta) const { // returns theta in radians for a given pseudorapidity - return 2.0 * TMath::ATan(TMath::Exp(-eta)); + return 2.0 * std::atan(std::exp(-eta)); } - Float_t ZFromEtaR(Float_t r, Float_t eta) const + float ZFromEtaR(float r, float eta) const { // returns z in for a given // pseudorapidity and r=sqrt(x*x+y*y). - return r / TMath::Tan(AngleFromEta(eta)); + return r / std::tan(AngleFromEta(eta)); } /// /// Method to set shift-rotational matrixes from ESDHeader /// Move from header due to coding violations : Dec 2,2011 by PAI /// - void SetMisalMatrix(const TGeoHMatrix* m, Int_t smod) const; + void SetMisalMatrix(const TGeoHMatrix* m, int smod) const; /// /// Method to set shift-rotational matrixes from CCDB @@ -580,20 +585,20 @@ class Geometry /// * misalignment shifts to global position in case of need. /// /// Federico.Ronchetti@cern.ch - void RecalculateTowerPosition(Float_t drow, Float_t dcol, const Int_t sm, const Float_t depth, - const Float_t misaligTransShifts[15], const Float_t misaligRotShifts[15], - Float_t global[3]) const; + void RecalculateTowerPosition(float drow, float dcol, const int sm, const float depth, + const float misaligTransShifts[15], const float misaligRotShifts[15], + float global[3]) const; /// \brief Provides shift-rotation matrix for EMCAL from externally set matrix or /// from TGeoManager /// \param smod super module number /// \return alignment matrix for a super module number - const TGeoHMatrix* GetMatrixForSuperModule(Int_t smod) const; + const TGeoHMatrix* GetMatrixForSuperModule(int smod) const; /// \brief Provides shift-rotation matrix for EMCAL from the TGeoManager. /// \param smod super module number /// \return alignment matrix for a super module number - const TGeoHMatrix* GetMatrixForSuperModuleFromGeoManager(Int_t smod) const; + const TGeoHMatrix* GetMatrixForSuperModuleFromGeoManager(int smod) const; /// \brief Provides shift-rotation matrix for EMCAL from fkSModuleMatrix[smod] /// \param smod super module number @@ -601,7 +606,7 @@ class Geometry /// /// Unsafe method, not to be used in reconstruction, just check there is /// something in the array of matrices without crashing, for EVE checks. - const TGeoHMatrix* GetMatrixForSuperModuleFromArray(Int_t smod) const; + const TGeoHMatrix* GetMatrixForSuperModuleFromArray(int smod) const; protected: /// \brief initializes the parameters of EMCAL @@ -616,86 +621,86 @@ class Geometry /// \throw InvalidCellIDException /// /// Used in order to fill the lookup table of cell indices - std::tuple CalculateCellIndex(Int_t absId) const; - - std::string mGeoName; ///< Geometry name string - Int_t mKey110DEG; ///< For calculation abs cell id; 19-oct-05 - Int_t mnSupModInDCAL; ///< For calculation abs cell id; 06-nov-12 - Int_t mNCellsInSupMod; ///< Number cell in super module - Int_t mNETAdiv; ///< Number eta division of module - Int_t mNPHIdiv; ///< Number phi division of module - Int_t mNCellsInModule; ///< Number cell in module - std::vector mPhiBoundariesOfSM; ///< Phi boundaries of SM in rad; size is fNumberOfSuperModules; - std::vector mPhiCentersOfSM; ///< Phi of centers of SM; size is fNumberOfSuperModules/2 - std::vector mPhiCentersOfSMSec; ///< Phi of centers of section where SM lies; size is fNumberOfSuperModules/2 + std::tuple CalculateCellIndex(int absId) const; + + std::string mGeoName; ///< Geometry name string + int mKey110DEG; ///< For calculation abs cell id; 19-oct-05 + int mnSupModInDCAL; ///< For calculation abs cell id; 06-nov-12 + int mNCellsInSupMod; ///< Number cell in super module + int mNETAdiv; ///< Number eta division of module + int mNPHIdiv; ///< Number phi division of module + int mNCellsInModule; ///< Number cell in module + std::vector mPhiBoundariesOfSM; ///< Phi boundaries of SM in rad; size is fNumberOfSuperModules; + std::vector mPhiCentersOfSM; ///< Phi of centers of SM; size is fNumberOfSuperModules/2 + std::vector mPhiCentersOfSMSec; ///< Phi of centers of section where SM lies; size is fNumberOfSuperModules/2 // Local Coordinates of SM - std::vector mPhiCentersOfCells; ///< [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.) - std::vector mCentersOfCellsEtaDir; ///< Size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm) - std::vector mCentersOfCellsPhiDir; ///< Size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm) - std::vector + std::vector mPhiCentersOfCells; ///< [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.) + std::vector mCentersOfCellsEtaDir; ///< Size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm) + std::vector mCentersOfCellsPhiDir; ///< Size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm) + std::vector mEtaCentersOfCells; ///< [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; - Int_t mNCells; ///< Number of cells in calo - Int_t mNPhi; ///< Number of Towers in the PHI direction - std::vector mCentersOfCellsXDir; ///< Size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm) - Float_t mEnvelop[3]; ///< The GEANT TUB for the detector - Float_t mArm1EtaMin; ///< Minimum pseudorapidity position of EMCAL in Eta - Float_t mArm1EtaMax; ///< Maximum pseudorapidity position of EMCAL in Eta - Float_t mArm1PhiMin; ///< Minimum angular position of EMCAL in Phi (degrees) - Float_t mArm1PhiMax; ///< Maximum angular position of EMCAL in Phi (degrees) - Float_t mEtaMaxOfTRD1; ///< Max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module) - Float_t mDCALPhiMin; ///< Minimum angular position of DCAL in Phi (degrees) - Float_t mDCALPhiMax; ///< Maximum angular position of DCAL in Phi (degrees) - Float_t mEMCALPhiMax; ///< Maximum angular position of EMCAL in Phi (degrees) - Float_t mDCALStandardPhiMax; ///< Special edge for the case that DCAL contian extension - Float_t mDCALInnerExtandedEta; ///< DCAL inner edge in Eta (with some extension) - Float_t mDCALInnerEdge; ///< Inner edge for DCAL + int mNCells; ///< Number of cells in calo + int mNPhi; ///< Number of Towers in the PHI direction + std::vector mCentersOfCellsXDir; ///< Size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm) + float mEnvelop[3]; ///< The GEANT TUB for the detector + float mArm1EtaMin; ///< Minimum pseudorapidity position of EMCAL in Eta + float mArm1EtaMax; ///< Maximum pseudorapidity position of EMCAL in Eta + float mArm1PhiMin; ///< Minimum angular position of EMCAL in Phi (degrees) + float mArm1PhiMax; ///< Maximum angular position of EMCAL in Phi (degrees) + float mEtaMaxOfTRD1; ///< Max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module) + float mDCALPhiMin; ///< Minimum angular position of DCAL in Phi (degrees) + float mDCALPhiMax; ///< Maximum angular position of DCAL in Phi (degrees) + float mEMCALPhiMax; ///< Maximum angular position of EMCAL in Phi (degrees) + float mDCALStandardPhiMax; ///< Special edge for the case that DCAL contian extension + float mDCALInnerExtandedEta; ///< DCAL inner edge in Eta (with some extension) + float mDCALInnerEdge; ///< Inner edge for DCAL std::vector mShishKebabTrd1Modules; ///< List of modules - Float_t mParSM[3]; ///< SM sizes as in GEANT (TRD1) - Float_t mPhiModuleSize; ///< Phi -> X - Float_t mEtaModuleSize; ///< Eta -> Y - Float_t mPhiTileSize; ///< Size of phi tile - Float_t mEtaTileSize; ///< Size of eta tile - Int_t mNZ; ///< Number of Towers in the Z direction - Float_t mIPDistance; ///< Radial Distance of the inner surface of the EMCAL - Float_t mLongModuleSize; ///< Size of long module + float mParSM[3]; ///< SM sizes as in GEANT (TRD1) + float mPhiModuleSize; ///< Phi -> X + float mEtaModuleSize; ///< Eta -> Y + float mPhiTileSize; ///< Size of phi tile + float mEtaTileSize; ///< Size of eta tile + int mNZ; ///< Number of Towers in the Z direction + float mIPDistance; ///< Radial Distance of the inner surface of the EMCAL + float mLongModuleSize; ///< Size of long module // Geometry Parameters - Float_t mShellThickness; ///< Total thickness in (x,y) direction - Float_t mZLength; ///< Total length in z direction - Float_t mSampling; ///< Sampling factor + float mShellThickness; ///< Total thickness in (x,y) direction + float mZLength; ///< Total length in z direction + float mSampling; ///< Sampling factor // Members from the EMCGeometry class - Float_t mECPbRadThickness; ///< cm, Thickness of the Pb radiators - Float_t mECScintThick; ///< cm, Thickness of the scintillators - Int_t mNECLayers; ///< number of scintillator layers + float mECPbRadThickness; ///< cm, Thickness of the Pb radiators + float mECScintThick; ///< cm, Thickness of the scintillators + int mNECLayers; ///< number of scintillator layers // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2 - Int_t mNumberOfSuperModules; ///< default is 12 = 6 * 2 + int mNumberOfSuperModules; ///< default is 12 = 6 * 2 /// geometry structure std::vector mEMCSMSystem; ///< Type of the supermodule (size number of supermodules - Float_t mFrontSteelStrip; ///< 13-may-05 - Float_t mLateralSteelStrip; ///< 13-may-05 - Float_t mPassiveScintThick; ///< 13-may-05 + float mFrontSteelStrip; ///< 13-may-05 + float mLateralSteelStrip; ///< 13-may-05 + float mPassiveScintThick; ///< 13-may-05 - Float_t mPhiSuperModule; ///< Phi of normal supermodule (20, in degree) - Int_t mNPhiSuperModule; ///< 9 - number supermodule in phi direction + float mPhiSuperModule; ///< Phi of normal supermodule (20, in degree) + int mNPhiSuperModule; ///< 9 - number supermodule in phi direction // TRD1 options - 30-sep-04 - Float_t mTrd1Angle; ///< angle in x-z plane (in degree) - Float_t m2Trd1Dx2; ///< 2*dx2 for TRD1 - Float_t mPhiGapForSM; ///< Gap betweeen supermodules in phi direction + float mTrd1Angle; ///< angle in x-z plane (in degree) + float m2Trd1Dx2; ///< 2*dx2 for TRD1 + float mPhiGapForSM; ///< Gap betweeen supermodules in phi direction // Oct 26,2010 - Float_t mTrd1AlFrontThick; ///< Thickness of the Al front plate - Float_t mTrd1BondPaperThick; ///< Thickness of the Bond Paper sheet + float mTrd1AlFrontThick; ///< Thickness of the Al front plate + float mTrd1BondPaperThick; ///< Thickness of the Bond Paper sheet - Int_t mILOSS; ///< Options for Geant (MIP business) - will call in AliEMCAL - Int_t mIHADR; ///< Options for Geant (MIP business) - will call in AliEMCAL + int mILOSS; ///< Options for Geant (MIP business) - will call in AliEMCAL + int mIHADR; ///< Options for Geant (MIP business) - will call in AliEMCAL - Float_t mSteelFrontThick; ///< Thickness of the front stell face of the support box - 9-sep-04; obsolete? + float mSteelFrontThick; ///< Thickness of the front stell face of the support box - 9-sep-04; obsolete? std::array mCRORCID = {110, 110, 112, 112, 110, 110, 112, 112, 110, 110, 112, 112, 111, 111, 113, 113, 111, 111, 113, 113, 111, 111, 113, 113, 114, 114, 116, 116, 114, 114, 116, 116, 115, 115, 117, 117, 115, 115, 117, 117, -1, -1, -1, -1, 111, 117}; // CRORC ID w.r.t SM std::array mCRORCLink = {0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 0, 1, 0, 1, 2, 3, 2, 3, 4, -1, 4, 5, 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, -1, -1, -1, -1, -1, 5, 3}; // CRORC limk w.r.t FEE ID @@ -707,7 +712,7 @@ class Geometry static Geometry* sGeom; ///< Pointer to the unique instance of the singleton }; -inline Bool_t Geometry::CheckAbsCellId(Int_t absId) const +inline bool Geometry::CheckAbsCellId(int absId) const { if (absId < 0 || absId >= mNCells) { return kFALSE; @@ -717,4 +722,4 @@ inline Bool_t Geometry::CheckAbsCellId(Int_t absId) const } } // namespace emcal } // namespace o2 -#endif +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_GEOMETRY_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/GeometryBase.h b/Detectors/EMCAL/base/include/EMCALBase/GeometryBase.h index 3fda26cbbfbc6..a6c1f7b955ac6 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/GeometryBase.h +++ b/Detectors/EMCAL/base/include/EMCALBase/GeometryBase.h @@ -9,8 +9,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_GEOMETRYBASE_H -#define ALICEO2_EMCAL_GEOMETRYBASE_H +/// \file GeometryBase.h +/// \brief Header file for EMCal geometry class for error handling and enums +/// \author Markus Fasel, markus.fasel@cern.ch + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_GEOMETRYBASE_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_GEOMETRYBASE_H_ #include @@ -31,7 +35,7 @@ enum AcceptanceType_t { EMCAL_ACCEPTANCE = 1, DCAL_ACCEPTANCE = 2, NON_ACCEPTANCE = 0 }; -const std::string DEFAULT_GEOMETRY = "EMCAL_COMPLETE12SMV1_DCAL_8SM"; +const char DEFAULT_GEOMETRY[] = "EMCAL_COMPLETE12SMV1_DCAL_8SM"; /// \class GeometryNotInitializedException /// \brief Error handling access to non-initialized geometry @@ -244,4 +248,4 @@ class RowColException final : public std::exception } // namespace emcal } // namespace o2 -#endif +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_GEOMETRYBASE_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/Hit.h b/Detectors/EMCAL/base/include/EMCALBase/Hit.h index 345a0918c3831..b969fb02c7700 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/Hit.h +++ b/Detectors/EMCAL/base/include/EMCALBase/Hit.h @@ -9,8 +9,14 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_HIT_H -#define ALICEO2_EMCAL_HIT_H +/// \file Hit.h +/// \brief Header file for EMCal cell hit class +/// \author Markus Fasel, markus.fasel@cern.ch + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_HIT_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_HIT_H_ + +#include #include "SimulationDataFormat/BaseHits.h" #include "CommonUtils/ShmAllocator.h" @@ -43,8 +49,8 @@ class Hit : public o2::BasicXYZEHit /// \param mom Momentum vector for the particle at the point /// \param tof Time of the hit /// \param eLoss Energy loss - Hit(Int_t primary, Int_t trackID, Int_t detID, Double_t initialEnergy, const math_utils::Point3D& pos, - const math_utils::Vector3D& mom, Double_t tof, Double_t eLoss) + Hit(int primary, int trackID, int detID, double initialEnergy, const math_utils::Point3D& pos, + const math_utils::Vector3D& mom, double tof, double eLoss) : o2::BasicXYZEHit(pos.X(), pos.Y(), pos.Z(), tof, eLoss, trackID, detID), mPvector(mom), mPrimary(primary), @@ -54,11 +60,11 @@ class Hit : public o2::BasicXYZEHit /// \brief Check whether the points are from the same parent and in the same detector volume /// \return True if points are the same (origin and detector), false otherwise - Bool_t operator==(const Hit& rhs) const; + bool operator==(const Hit& rhs) const; /// \brief Sorting points according to parent particle and detector volume /// \return True if this point is smaller, false otherwise - Bool_t operator<(const Hit& rhs) const; + bool operator<(const Hit& rhs) const; /// \brief Adds energy loss from the other point to this point /// \param rhs EMCAL point to add to this point @@ -70,19 +76,19 @@ class Hit : public o2::BasicXYZEHit /// \brief Get the initial energy of the primary particle entering EMCAL /// \return Energy of the primary particle entering EMCAL - Double_t GetInitialEnergy() const { return mInitialEnergy; } + double GetInitialEnergy() const { return mInitialEnergy; } /// \brief Get Primary particles at the origin of the hit /// \return Primary particles at the origin of the hit - Int_t GetPrimary() const { return mPrimary; } + int GetPrimary() const { return mPrimary; } /// \brief Set initial energy of the primary particle entering EMCAL /// \param energy Energy of the primary particle entering EMCAL - void SetInitialEnergy(Double_t energy) { mInitialEnergy = energy; } + void SetInitialEnergy(double energy) { mInitialEnergy = energy; } /// \brief Set primary particles at the origin of the hit /// \param primary Primary particles at the origin of the hit - void SetPrimary(Int_t primary) { mPrimary = primary; } + void SetPrimary(int primary) { mPrimary = primary; } /// \brief Writing point information to an output stream; /// \param stream target output stream @@ -90,10 +96,10 @@ class Hit : public o2::BasicXYZEHit private: math_utils::Vector3D mPvector; ///< Momentum Vector - Int_t mPrimary; ///< Primary particles at the origin of the hit + int mPrimary; ///< Primary particles at the origin of the hit Double32_t mInitialEnergy; ///< Energy of the parent particle that entered the EMCAL - ClassDefNV(Hit, 1); + ClassDefNV(Hit, 2); }; /// \brief Creates a new point base on this point but adding the energy loss of the right hand side @@ -118,6 +124,6 @@ class allocator : public o2::utils::ShmAllocator { }; } // namespace std -#endif +#endif // USESHM -#endif /* Point_h */ +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_HIT_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/Mapper.h b/Detectors/EMCAL/base/include/EMCALBase/Mapper.h index 6c7aaf329fcc3..0f03d88a0ceb7 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/Mapper.h +++ b/Detectors/EMCAL/base/include/EMCALBase/Mapper.h @@ -8,8 +8,18 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef __O2_EMCAL_MAPPER_H__ -#define __O2_EMCAL_MAPPER_H__ + +/// \file Mapper.h +/// \brief ALTRO mapping for calorimeters +/// \author Markus Fasel , Oak Ridge National Laboratory +/// \class Mapper +/// \ingroup EMCALbase +/// \since Aug 19, 2019 +/// +/// Based on AliAltroMapping by C. Cheshkov and AliCaloAltroMapping by G. Balbastre + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_MAPPER_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_MAPPER_H_ #include #include @@ -28,17 +38,8 @@ namespace o2 { - namespace emcal { - -/// \class Mapper -/// \brief ALTRO mapping for calorimeters -/// \ingroup EMCALbase -/// \author Markus Fasel , Oak Ridge National Laboratory -/// \since Aug 19, 2019 -/// -/// Based on AliAltroMapping by C. Cheshkov and AliCaloAltroMapping by G. Balbastre class Mapper { public: @@ -70,6 +71,7 @@ class Mapper boost::hash_combine(seed, s.mColumn); boost::hash_combine(seed, o2::emcal::channelTypeToInt(s.mChannelType)); return seed; + /* size_t h1 = std::hash()(s.mRow); size_t h2 = std::hash()(s.mColumn); @@ -86,9 +88,9 @@ class Mapper public: /// \brief Constructor initializing the exception /// \param address Hardware address raising the exception - AddressNotFoundException(int address) : exception(), - mAddress(address), - mMessage() + explicit AddressNotFoundException(int address) : exception(), + mAddress(address), + mMessage() { std::stringstream msgbuilder; msgbuilder << "Hardware address " << address << "(0x" << std::hex << address << std::dec << ") not found"; @@ -154,9 +156,9 @@ class Mapper public: /// \brief Constructor initializing the exception /// \param id Channel ID rausing the exception - ChannelNotFoundException(ChannelID id) : std::exception(), - mChannelID(id), - mMessage() + explicit ChannelNotFoundException(ChannelID id) : std::exception(), + mChannelID(id), + mMessage() { std::stringstream msgbuilder; msgbuilder << "Channel with " << mChannelID << " not found."; @@ -189,8 +191,8 @@ class Mapper public: /// \brief Constructor initializing exception /// \param errormessage Error message from input stream - FileFormatException(const std::string_view errormessage) : std::exception(), - mMessage(std::string("Failure reading input file: ") + errormessage.data()) + explicit FileFormatException(const std::string_view errormessage) : std::exception(), + mMessage(std::string("Failure reading input file: ") + errormessage.data()) { } @@ -232,7 +234,7 @@ class Mapper /// \throw FileFormatException in case entries in the mapping file are not in the expected format /// \throw AddressRangeException in case addresses outside the valid range are found /// \throw ChannelTypeException in case hardware address with unkknown channel types are found - Mapper(const std::string_view inputfile); + explicit Mapper(const std::string_view inputfile); /// \brief Destructor ~Mapper() = default; @@ -320,7 +322,7 @@ class MappingHandler class DDLInvalid final : public std::exception { public: - DDLInvalid(int ddlID) : mDDL(ddlID) { mMessage = fmt::format("DDL {0} not existing for EMCAL", mDDL); }; + DDLInvalid(int ddlID) : mDDL(ddlID) { mMessage = fmt::format("DDL {0} not existing for EMCAL", mDDL); } /// \brief Destructor ~DDLInvalid() noexcept final = default; @@ -372,4 +374,4 @@ std::ostream& operator<<(std::ostream& stream, const Mapper::ChannelID& channel) } // namespace o2 -#endif //__O2_EMCAL_MAPPER_H__ +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_MAPPER_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/NonlinearityHandler.h b/Detectors/EMCAL/base/include/EMCALBase/NonlinearityHandler.h index b3dd3bd111835..f1f43840cc047 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/NonlinearityHandler.h +++ b/Detectors/EMCAL/base/include/EMCALBase/NonlinearityHandler.h @@ -8,19 +8,8 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_NONLINEARITYHANDLER__H -#define ALICEO2_EMCAL_NONLINEARITYHANDLER__H - -#include -#include -#include -#include -#include -#include "DataFormatsEMCAL/AnalysisCluster.h" - -namespace o2::emcal -{ +/// \file NonlinearityHandler.h /// \class NonlinearityHandler /// \brief Nonlinearity functions for energy correction /// \ingroup EMCALbase @@ -39,6 +28,19 @@ namespace o2::emcal /// without a cluster nonlinearity parameterisation. /// /// based on nonlinearity implementation in AliEMCALRecoUtils + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_NONLINEARITYHANDLER_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_NONLINEARITYHANDLER_H_ + +#include +#include +#include +#include +#include +#include "DataFormatsEMCAL/AnalysisCluster.h" + +namespace o2::emcal +{ class NonlinearityHandler { public: @@ -102,7 +104,7 @@ class NonlinearityHandler /// Initializing all parameters and settings of the nonlinearity function. /// Nonlinearity correction at cluster level can be obtained using /// objects constructed by this. - NonlinearityHandler(NonlinType_t nonlintype); + explicit NonlinearityHandler(NonlinType_t nonlintype); /// \brief Destructor ~NonlinearityHandler() = default; @@ -193,7 +195,7 @@ class NonlinearityFactory public: /// \brief Constructor /// \param Name of the nonlinearity function raising the exception - FunctionNotFoundExcpetion(const std::string_view name) : mName(name), mMessage() + explicit FunctionNotFoundExcpetion(const std::string_view name) : mName(name), mMessage() { mMessage = "Nonlinearity funciton " + mName + " not found"; } @@ -293,4 +295,4 @@ std::ostream& operator<<(std::ostream& in, const NonlinearityHandler& handler); } // namespace o2::emcal -#endif // ALICEO2_EMCAL_NONLINEARITYHANDLER__H \ No newline at end of file +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_NONLINEARITYHANDLER_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/RCUTrailer.h b/Detectors/EMCAL/base/include/EMCALBase/RCUTrailer.h index 0fcb87f20f2ff..92a037f73f805 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/RCUTrailer.h +++ b/Detectors/EMCAL/base/include/EMCALBase/RCUTrailer.h @@ -8,25 +8,12 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_RCUTRAILER_H -#define ALICEO2_EMCAL_RCUTRAILER_H - -#include -#include -#include -#include -#include -#include - -namespace o2 -{ - -namespace emcal -{ +/// \file RCUTrailer.h /// \class RCUTrailer /// \brief Information stored in the RCU trailer /// \ingroup EMCALbase +/// \author Markus Fasel , Oak Ridge National Laboratory /// /// The RCU trailer can be found at the end of /// the payload and contains general information @@ -71,6 +58,22 @@ namespace emcal /// | 24 | ALTRO buffers (0 - 4 buffers, 1 - 8 buffers) | /// | 25 - 31 | Zeroed (used for trailer word markers) | /// + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_RCUTRAILER_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_RCUTRAILER_H_ + +#include +#include +#include +#include +#include +#include +#include + +namespace o2 +{ +namespace emcal +{ class RCUTrailer { public: @@ -405,11 +408,12 @@ class RCUTrailer uint32_t mNumPresamples : 2; ///< Number of presamples uint32_t mNumPostsamples : 4; ///< Number of postsamples uint32_t mSecondBaselineCorrection : 1; ///< Second baseline correction - uint32_t mGlitchFilter : 2; ///< Glitch filter - uint32_t mNumPostsamplesNoZS : 3; ///< Number of postsamples without zero suppression - uint32_t mNumPresamplesNoZS : 2; ///< Number of presamples without zero suppression - uint32_t mZeroSuppression : 1; ///< Zero suppression - uint32_t mZero1_1 : 12; ///< Zeroed bits + + uint32_t mGlitchFilter : 2; ///< Glitch filter + uint32_t mNumPostsamplesNoZS : 3; ///< Number of postsamples without zero suppression + uint32_t mNumPresamplesNoZS : 2; ///< Number of presamples without zero suppression + uint32_t mZeroSuppression : 1; ///< Zero suppression + uint32_t mZero1_1 : 12; ///< Zeroed bits }; }; @@ -465,4 +469,4 @@ std::ostream& operator<<(std::ostream& stream, const RCUTrailer& trailer); } // namespace o2 -#endif \ No newline at end of file +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_RCUTRAILER_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/ShishKebabTrd1Module.h b/Detectors/EMCAL/base/include/EMCALBase/ShishKebabTrd1Module.h index 43f7df3a5757c..0d9537a19ecdb 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/ShishKebabTrd1Module.h +++ b/Detectors/EMCAL/base/include/EMCALBase/ShishKebabTrd1Module.h @@ -9,9 +9,23 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_SHISHKEBABTRD1MODULE_H -#define ALICEO2_EMCAL_SHISHKEBABTRD1MODULE_H +/// \file ShishKebabTrd1Module.h +/// \class ShishKebabTrd1Module +/// \brief Main class for TRD1 geometry of Shish-Kebab case. +/// \ingroup EMCALbase +/// \author Alexei Pavlinov (WSU). +/// +/// Sep 20004 - Nov 2006; Apr 2010 +/// See web page with description of Shish-Kebab geometries: +/// http://pdsfweb01.nersc.gov/~pavlinov/ALICE/SHISHKEBAB/RES/shishkebabALICE.html +/// Nov 9,2006 - added case of 3X3 +/// +/// +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_SHISHKEBABTRD1MODULE_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_SHISHKEBABTRD1MODULE_H_ + +#include #include #include @@ -19,35 +33,21 @@ #include #include -#include - namespace o2 { namespace emcal { - -/// \class ShishKebabTrd1Module -/// \brief Main class for TRD1 geometry of Shish-Kebab case. -/// \ingroup EMCALbase -/// -/// Sep 20004 - Nov 2006; Apr 2010 -/// See web page with description of Shish-Kebab geometries: -/// http://pdsfweb01.nersc.gov/~pavlinov/ALICE/SHISHKEBAB/RES/shishkebabALICE.html -/// Nov 9,2006 - added case of 3X3 -/// -/// \author: Alexei Pavlinov (WSU). -/// class ShishKebabTrd1Module { public: /// \brief Constructor. - ShishKebabTrd1Module(Double_t theta = 0.0, Geometry* g = nullptr); + explicit ShishKebabTrd1Module(double theta = 0.0, Geometry* g = nullptr); /// \brief Constructor. ShishKebabTrd1Module(ShishKebabTrd1Module& leftNeighbor); /// \brief Init (add explanation) - void Init(Double_t A, Double_t B); + void Init(double A, double B); /// \brief Define more things (add explanation) void DefineAllStuff(); @@ -64,7 +64,7 @@ class ShishKebabTrd1Module ~ShishKebabTrd1Module() = default; /// \brief Recover module parameters stored in geometry - Bool_t SetParameters(); + bool SetParameters(); /// /// This is what we have in produced SM. (add explanation) @@ -72,22 +72,22 @@ class ShishKebabTrd1Module /// key=0 - zero tilt of first module; /// key=1 - angle=fgangle/2 = 0.75 degree. /// - void DefineFirstModule(const Int_t key = 0); // key=0-zero tilt of first module + void DefineFirstModule(const int key = 0); // key=0-zero tilt of first module - Double_t GetTheta() const { return mTheta; } + double GetTheta() const { return mTheta; } const TVector2& GetCenterOfModule() const { return mOK; } - Double_t GetPosX() const { return mOK.Y(); } - Double_t GetPosZ() const { return mOK.X(); } - Double_t GetPosXfromR() const { return mOK.Y() - sr; } - Double_t GetA() const { return mA; } - Double_t GetB() const { return mB; } - Double_t GetRadius() const { return sr; } + double GetPosX() const { return mOK.Y(); } + double GetPosZ() const { return mOK.X(); } + double GetPosXfromR() const { return mOK.Y() - sr; } + double GetA() const { return mA; } + double GetB() const { return mB; } + double GetRadius() const { return sr; } TVector2 GetORB() const { return mORB; } TVector2 GetORT() const { return mORT; } // Additional offline stuff // ieta=0 or 1 - Jun 02, 2006 - const TVector2& GetCenterOfCellInLocalCoordinateofSM(Int_t ieta) const + const TVector2& GetCenterOfCellInLocalCoordinateofSM(int ieta) const { if (ieta <= 0) { return mOK2; @@ -96,7 +96,7 @@ class ShishKebabTrd1Module } } - void GetCenterOfCellInLocalCoordinateofSM(Int_t ieta, Double_t& xr, Double_t& zr) const + void GetCenterOfCellInLocalCoordinateofSM(int ieta, double& xr, double& zr) const { if (ieta <= 0) { xr = mOK2.Y(); @@ -109,7 +109,7 @@ class ShishKebabTrd1Module << std::setprecision(4) << xr << " zr " << std::setw(8) << std::setprecision(4) << zr; } - void GetCenterOfCellInLocalCoordinateofSM3X3(Int_t ieta, Double_t& xr, Double_t& zr) const + void GetCenterOfCellInLocalCoordinateofSM3X3(int ieta, double& xr, double& zr) const { // 3X3 case - Nov 9,2006 if (ieta < 0) { ieta = 0; // ieta = ieta<0? ieta=0 : ieta; // check index @@ -121,7 +121,7 @@ class ShishKebabTrd1Module zr = mOK3X3[2 - ieta].X(); } - void GetCenterOfCellInLocalCoordinateofSM1X1(Double_t& xr, Double_t& zr) const + void GetCenterOfCellInLocalCoordinateofSM1X1(double& xr, double& zr) const { // 1X1 case - Nov 27,2006 // Center of cell is center of module xr = mOK.Y() - sr; zr = mOK.X(); @@ -129,7 +129,7 @@ class ShishKebabTrd1Module // 15-may-06 const TVector2& GetCenterOfModuleFace() const { return mOB; } - const TVector2& GetCenterOfModuleFace(Int_t ieta) const + const TVector2& GetCenterOfModuleFace(int ieta) const { if (ieta <= 0) { return mOB2; @@ -139,34 +139,34 @@ class ShishKebabTrd1Module } // Jul 30, 2007 - void GetPositionAtCenterCellLine(Int_t ieta, Double_t dist, TVector2& v) const; + void GetPositionAtCenterCellLine(int ieta, double dist, TVector2& v) const; // - Double_t GetTanBetta() const { return stanBetta; } - Double_t Getb() const { return sb; } + double GetTanBetta() const { return stanBetta; } + double Getb() const { return sb; } // service methods - void PrintShish(Int_t pri = 1) const; // *MENU* - Double_t GetThetaInDegree() const; - Double_t GetEtaOfCenterOfModule() const; - Double_t GetMaxEtaOfModule() const; - static Double_t ThetaToEta(Double_t theta) { return -TMath::Log(TMath::Tan(theta / 2.)); } + void PrintShish(int pri = 1) const; // *MENU* + double GetThetaInDegree() const; + double GetEtaOfCenterOfModule() const; + double GetMaxEtaOfModule() const; + static double ThetaToEta(double theta) { return -std::log(std::tan(theta / 2.)); } protected: // geometry info - Geometry* mGeometry; //!y; z->x; - Double_t mA{0.}; ///< parameters of right line : y = A*z + B - Double_t mB{0.}; ///< system where zero point is IP. - Double_t mThetaA{0.}; ///< angle coresponding fA - for convinience - Double_t mTheta; ///< theta angle of perpendicular to SK module + Geometry* mGeometry; //!y; z->x; + double mA{0.}; ///< parameters of right line : y = A*z + B + double mB{0.}; ///< system where zero point is IP. + double mThetaA{0.}; ///< angle coresponding fA - for convinience + double mTheta; ///< theta angle of perpendicular to SK module // position of towers(cells) with differents ieta (1 or 2) in local coordinate of SM // Nov 04,2004; Feb 19,2006 @@ -179,8 +179,8 @@ class ShishKebabTrd1Module TVector2 mOB2; ///< ieta=0 // Jul 30, 2007 - Double_t mThetaOB1{0.}; ///< theta of cell center line (go through OB1) - Double_t mThetaOB2{0.}; ///< theta of cell center line (go through OB2) + double mThetaOB1{0.}; ///< theta of cell center line (go through OB1) + double mThetaOB2{0.}; ///< theta of cell center line (go through OB2) // 3X3 case - Nov 9,2006 TVector2 mOK3X3[3]; @@ -191,4 +191,4 @@ class ShishKebabTrd1Module }; } // namespace emcal } // namespace o2 -#endif +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_SHISHKEBABTRD1MODULE_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/TriggerMappingErrors.h b/Detectors/EMCAL/base/include/EMCALBase/TriggerMappingErrors.h index a9388849a1cd8..0efa33bf2072e 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/TriggerMappingErrors.h +++ b/Detectors/EMCAL/base/include/EMCALBase/TriggerMappingErrors.h @@ -9,27 +9,28 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_TRIGGERMAPPINGERRORS_H -#define ALICEO2_EMCAL_TRIGGERMAPPINGERRORS_H +/// \file TriggerMappingErrors.h +/// \class TRUIndexException +/// \brief Error handling of faulty TRU indices +/// \ingroup EMCALbase +/// \author Markus Fasel , Oak Ridge National Laboratory + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_TRIGGERMAPPINGERRORS_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_TRIGGERMAPPINGERRORS_H_ #include #include namespace o2 { - namespace emcal { - -/// \class TRUIndexException -/// \brief Error handling of faulty TRU indices -/// \ingroup EMCALbase class TRUIndexException : public std::exception { public: /// \brief Constructor /// \param truindex Index of the TRU - TRUIndexException(unsigned int truindex) : std::exception(), mTRUIndex(truindex), mErrorMessage() + explicit TRUIndexException(unsigned int truindex) : std::exception(), mTRUIndex(truindex), mErrorMessage() { mErrorMessage = "Invalid TRU Index: " + std::to_string(truindex); } @@ -61,7 +62,7 @@ class FastORIndexException : public std::exception public: /// \brief Constructor /// \param fastorindex Index of the FastOR - FastORIndexException(unsigned int fastorindex) : std::exception(), mFastORIndex(fastorindex), mErrorMessage() + explicit FastORIndexException(unsigned int fastorindex) : std::exception(), mFastORIndex(fastorindex), mErrorMessage() { mErrorMessage = "Invalid FastOR Index: " + std::to_string(fastorindex); } @@ -227,7 +228,7 @@ class PHOSRegionException : public std::exception public: /// \brief Constructor /// \param phosregion Index of the PHOS region - PHOSRegionException(unsigned int phosregion) : std::exception(), mErrorMessage(), mPHOSRegion(phosregion) + explicit PHOSRegionException(unsigned int phosregion) : std::exception(), mErrorMessage(), mPHOSRegion(phosregion) { mErrorMessage = "Invalid PHOS region: " + std::to_string(phosregion); } @@ -279,7 +280,7 @@ class L0sizeInvalidException : public std::exception public: /// \brief Constructor /// \param l0size Size of the L0 patch - L0sizeInvalidException(unsigned int l0size) : std::exception(), mErrorMessage(), mL0size(l0size) + explicit L0sizeInvalidException(unsigned int l0size) : std::exception(), mErrorMessage(), mL0size(l0size) { mErrorMessage = "L0 patch size invalid: " + std::to_string(l0size); } @@ -307,4 +308,4 @@ class L0sizeInvalidException : public std::exception } // namespace o2 -#endif // ALICEO2_EMCAL_TRIGGERMAPPINGERRORS_H \ No newline at end of file +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_TRIGGERMAPPINGERRORS_H_ diff --git a/Detectors/EMCAL/base/include/EMCALBase/TriggerMappingV2.h b/Detectors/EMCAL/base/include/EMCALBase/TriggerMappingV2.h index 24d8c1686f005..d3e656b56822c 100644 --- a/Detectors/EMCAL/base/include/EMCALBase/TriggerMappingV2.h +++ b/Detectors/EMCAL/base/include/EMCALBase/TriggerMappingV2.h @@ -8,8 +8,17 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef ALICEO2_EMCAL_TRIGGERMAPPINGV2_H_ -#define ALICEO2_EMCAL_TRIGGERMAPPINGV2_H_ + +/// \file TriggerMappingV2.h +/// \class TriggerMappingV2 +/// \brief Trigger mapping starting from Run2 +/// \ingroup EMCALbase +/// \author H. YOKOYAMA Tsukuba University +/// \author R. GUERNANE LPSC Grenoble CNRS/IN2P3 +/// \author Markus Fasel , Oak Ridge National Laboratory + +#ifndef DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_TRIGGERMAPPINGV2_H_ +#define DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_TRIGGERMAPPINGV2_H_ #include #include @@ -20,15 +29,7 @@ namespace o2 { namespace emcal { - class Geometry; - -/// \class TriggerMappingV2 -/// \brief Trigger mapping starting from Run2 -/// \ingroup EMCALbase -/// \author H. YOKOYAMA Tsukuba University -/// \author R. GUERNANE LPSC Grenoble CNRS/IN2P3 -/// \author Markus Fasel , Oak Ridge National Laboratory class TriggerMappingV2 { public: @@ -74,7 +75,7 @@ class TriggerMappingV2 TriggerMappingV2(); /// \brief Default constructor. - TriggerMappingV2(Geometry* geo); + explicit TriggerMappingV2(Geometry* geo); /// \brief Destructor ~TriggerMappingV2() = default; @@ -308,7 +309,7 @@ class TriggerMappingV2 /// \brief Get the online index from the TRU index /// \return Online index (= TRU index) - IndexOnline getOnlineIndexFromTRUIndex(IndexTRU truIndex) const { return truIndex; }; + IndexOnline getOnlineIndexFromTRUIndex(IndexTRU truIndex) const { return truIndex; } /// \brief Get the TRU Index from the hardware address of the ALTRO channel (TRU rawdata) /// \param hardwareAddress hardware address @@ -373,7 +374,7 @@ class TriggerMappingV2 std::array mNFastORInSMPhi; // SM size std::array mNFastORInSMEta; // - std::array mNModuleInEMCALPhi; //#FastOR/EMCAL in Phi + std::array mNModuleInEMCALPhi; // #FastOR/EMCAL in Phi //******************************************** // Initialization of FastOR index offset of each SM/TRU @@ -460,4 +461,4 @@ class TriggerMappingV2 } // namespace emcal } // namespace o2 -#endif // ALIEMCALTRIGGERMAPPINGV2_H +#endif // DETECTORS_EMCAL_BASE_INCLUDE_EMCALBASE_TRIGGERMAPPINGV2_H_ diff --git a/Detectors/EMCAL/base/src/ClusterFactory.cxx b/Detectors/EMCAL/base/src/ClusterFactory.cxx index 342f54fd94591..1fc7f8cd1f685 100644 --- a/Detectors/EMCAL/base/src/ClusterFactory.cxx +++ b/Detectors/EMCAL/base/src/ClusterFactory.cxx @@ -10,9 +10,20 @@ // or submit itself to any jurisdiction. /// \file ClusterFactory.cxx -#include +/// \brief Source file for EMCal cluster factory class that creates clusters from cells +/// \author Markus Fasel, markus.fasel@cern.ch +/// \author Hadi Hassan, hadi.hassan@cern.ch +/// \author M. Hemmer, marvin.hemmer@cern.ch + #include + +#include +#include +#include +#include + #include "Rtypes.h" + #include "DataFormatsEMCAL/Cluster.h" #include "DataFormatsEMCAL/Digit.h" #include "DataFormatsEMCAL/Cell.h" @@ -69,7 +80,7 @@ o2::emcal::AnalysisCluster ClusterFactory::buildCluster(int clusterIn auto [inputIndMax, inputEnergyMax, cellAmp, shared] = getMaximalEnergyIndex(inputsIndices); - short towerId = mInputsContainer[inputIndMax].getTower(); + int16_t towerId = mInputsContainer[inputIndMax].getTower(); float exoticTime = mInputsContainer[inputIndMax].getTimeStamp(); @@ -90,18 +101,18 @@ o2::emcal::AnalysisCluster ClusterFactory::buildCluster(int clusterIn clusterAnalysis.setNCells(inputsIndices.size()); - std::vector cellsIdices; + std::vector cellsIdices; bool addClusterLabels = ((clusterLabel != nullptr) && (mCellLabelContainer.size() > 0)); - for (auto cellIndex : inputsIndices) { + for (const auto& cellIndex : inputsIndices) { cellsIdices.push_back(cellIndex); if (addClusterLabels) { - for (size_t iLabel = 0; iLabel < mCellLabelContainer[cellIndex].GetLabelSize(); iLabel++) { - if (mCellLabelContainer[cellIndex].GetAmplitudeFraction(iLabel) <= 0.f) { + for (size_t iLabel = 0; iLabel < mCellLabelContainer[cellIndex].getLabelSize(); iLabel++) { + if (mCellLabelContainer[cellIndex].getAmplitudeFraction(iLabel) <= 0.f) { continue; // skip 0 entries } - clusterLabel->addValue(mCellLabelContainer[cellIndex].GetLabel(iLabel), - mCellLabelContainer[cellIndex].GetAmplitudeFraction(iLabel) * mInputsContainer[cellIndex].getEnergy()); + clusterLabel->addValue(mCellLabelContainer[cellIndex].getLabel(iLabel), + mCellLabelContainer[cellIndex].getAmplitudeFraction(iLabel) * mInputsContainer[cellIndex].getEnergy()); } } } @@ -150,7 +161,7 @@ void ClusterFactory::evalDispersion(gsl::span inputsIndice double etaMean = 0.0, phiMean = 0.0; // Calculate mean values - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { if (clusterAnalysis.E() > 0 && mInputsContainer[iInput].getEnergy() > 0) { auto [nSupMod, nModule, nIphi, nIeta] = mGeomPtr->GetCellIndex(mInputsContainer[iInput].getTower()); @@ -162,9 +173,9 @@ void ClusterFactory::evalDispersion(gsl::span inputsIndice ieta += EMCAL_COLS; } - double etai = (double)ieta; - double phii = (double)iphi; - double w = TMath::Max(0., mLogWeight + TMath::Log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); + double etai = static_cast(ieta); + double phii = static_cast(iphi); + double w = std::max(0., static_cast(mLogWeight) + std::log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); if (w > 0.0) { phiMean += phii * w; @@ -182,7 +193,7 @@ void ClusterFactory::evalDispersion(gsl::span inputsIndice } // Calculate dispersion - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { if (clusterAnalysis.E() > 0 && mInputsContainer[iInput].getEnergy() > 0) { auto [nSupMod, nModule, nIphi, nIeta] = mGeomPtr->GetCellIndex(mInputsContainer[iInput].getTower()); @@ -194,9 +205,9 @@ void ClusterFactory::evalDispersion(gsl::span inputsIndice ieta += EMCAL_COLS; } - double etai = (double)ieta; - double phii = (double)iphi; - double w = TMath::Max(0., mLogWeight + TMath::Log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); + double etai = static_cast(ieta); + double phii = static_cast(iphi); + double w = std::max(0., static_cast(mLogWeight) + std::log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); if (w > 0.0) { nstat++; @@ -211,7 +222,7 @@ void ClusterFactory::evalDispersion(gsl::span inputsIndice d = 0.; } - clusterAnalysis.setDispersion(TMath::Sqrt(d)); + clusterAnalysis.setDispersion(std::sqrt(d)); } /// @@ -222,12 +233,13 @@ void ClusterFactory::evalLocalPosition(gsl::span inputsInd { int nstat = 0; + const int nDim = 3; - double dist = tMaxInCm(double(clusterAnalysis.E())); + double dist = tMaxInCm(static_cast(clusterAnalysis.E())); - double clXYZ[3] = {0., 0., 0.}, clRmsXYZ[3] = {0., 0., 0.}, xyzi[3], wtot = 0., w = 0.; + double clXYZ[nDim] = {0., 0., 0.}, clRmsXYZ[nDim] = {0., 0., 0.}, xyzi[nDim], wtot = 0., w = 0.; - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { try { mGeomPtr->RelPosCellInSModule(mInputsContainer[iInput].getTower(), dist).GetCoordinates(xyzi[0], xyzi[1], xyzi[2]); @@ -242,7 +254,7 @@ void ClusterFactory::evalLocalPosition(gsl::span inputsInd } if (mLogWeight > 0.0) { - w = TMath::Max(0., mLogWeight + TMath::Log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); + w = std::max(0., static_cast(mLogWeight) + std::log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); } else { w = mInputsContainer[iInput].getEnergy(); // just energy } @@ -251,7 +263,7 @@ void ClusterFactory::evalLocalPosition(gsl::span inputsInd wtot += w; nstat++; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < nDim; i++) { clXYZ[i] += (w * xyzi[i]); clRmsXYZ[i] += (w * xyzi[i] * xyzi[i]); } @@ -261,8 +273,8 @@ void ClusterFactory::evalLocalPosition(gsl::span inputsInd // cout << " wtot " << wtot << endl; if (wtot > 0) { - // xRMS = TMath::Sqrt(x2m - xMean*xMean); - for (int i = 0; i < 3; i++) { + // xRMS = std::sqrt(x2m - xMean*xMean); + for (int i = 0; i < nDim; i++) { clXYZ[i] /= wtot; if (nstat > 1) { @@ -270,7 +282,7 @@ void ClusterFactory::evalLocalPosition(gsl::span inputsInd clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i] * clXYZ[i]; if (clRmsXYZ[i] > 0.0) { - clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]); + clRmsXYZ[i] = std::sqrt(clRmsXYZ[i]); } else { clRmsXYZ[i] = 0; } @@ -279,7 +291,7 @@ void ClusterFactory::evalLocalPosition(gsl::span inputsInd } } } else { - for (int i = 0; i < 3; i++) { + for (int i = 0; i < nDim; i++) { clXYZ[i] = clRmsXYZ[i] = -1.; } } @@ -295,12 +307,13 @@ void ClusterFactory::evalGlobalPosition(gsl::span inputsIn { int i = 0, nstat = 0; + const int nDim = 3; - double dist = tMaxInCm(double(clusterAnalysis.E())); + double dist = tMaxInCm(static_cast(clusterAnalysis.E())); - double clXYZ[3] = {0., 0., 0.}, clRmsXYZ[3] = {0., 0., 0.}, lxyzi[3], xyzi[3], wtot = 0., w = 0.; + double clXYZ[nDim] = {0., 0., 0.}, clRmsXYZ[nDim] = {0., 0., 0.}, lxyzi[nDim], xyzi[nDim], wtot = 0., w = 0.; - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { // get the local coordinates of the cell try { @@ -314,7 +327,7 @@ void ClusterFactory::evalGlobalPosition(gsl::span inputsIn mGeomPtr->GetGlobal(lxyzi, xyzi, mGeomPtr->GetSuperModuleNumber(mInputsContainer[iInput].getTower())); if (mLogWeight > 0.0) { - w = TMath::Max(0., mLogWeight + TMath::Log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); + w = std::max(0., static_cast(mLogWeight) + std::log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); } else { w = mInputsContainer[iInput].getEnergy(); // just energy } @@ -323,7 +336,7 @@ void ClusterFactory::evalGlobalPosition(gsl::span inputsIn wtot += w; nstat++; - for (i = 0; i < 3; i++) { + for (i = 0; i < nDim; i++) { clXYZ[i] += (w * xyzi[i]); clRmsXYZ[i] += (w * xyzi[i] * xyzi[i]); } @@ -333,8 +346,8 @@ void ClusterFactory::evalGlobalPosition(gsl::span inputsIn // cout << " wtot " << wtot << endl; if (wtot > 0) { - // xRMS = TMath::Sqrt(x2m - xMean*xMean); - for (i = 0; i < 3; i++) { + // xRMS = std::sqrt(x2m - xMean*xMean); + for (i = 0; i < nDim; i++) { clXYZ[i] /= wtot; if (nstat > 1) { @@ -342,7 +355,7 @@ void ClusterFactory::evalGlobalPosition(gsl::span inputsIn clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i] * clXYZ[i]; if (clRmsXYZ[i] > 0.0) { - clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]); + clRmsXYZ[i] = std::sqrt(clRmsXYZ[i]); } else { clRmsXYZ[i] = 0; } @@ -351,7 +364,7 @@ void ClusterFactory::evalGlobalPosition(gsl::span inputsIn } } } else { - for (i = 0; i < 3; i++) { + for (i = 0; i < nDim; i++) { clXYZ[i] = clRmsXYZ[i] = -1.; } } @@ -367,9 +380,10 @@ void ClusterFactory::evalLocalPositionFit(double deff, double mLogWei double phiSlope, gsl::span inputsIndices, AnalysisCluster& clusterAnalysis) const { int i = 0, nstat = 0; - double clXYZ[3] = {0., 0., 0.}, clRmsXYZ[3] = {0., 0., 0.}, xyzi[3], wtot = 0., w = 0.; + const int nDim = 3; + double clXYZ[nDim] = {0., 0., 0.}, clRmsXYZ[nDim] = {0., 0., 0.}, xyzi[nDim], wtot = 0., w = 0.; - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { try { mGeomPtr->RelPosCellInSModule(mInputsContainer[iInput].getTower(), deff).GetCoordinates(xyzi[0], xyzi[1], xyzi[2]); @@ -379,7 +393,7 @@ void ClusterFactory::evalLocalPositionFit(double deff, double mLogWei } if (mLogWeight > 0.0) { - w = TMath::Max(0., mLogWeight + TMath::Log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); + w = std::max(0., static_cast(mLogWeight) + std::log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); } else { w = mInputsContainer[iInput].getEnergy(); // just energy } @@ -388,7 +402,7 @@ void ClusterFactory::evalLocalPositionFit(double deff, double mLogWei wtot += w; nstat++; - for (i = 0; i < 3; i++) { + for (i = 0; i < nDim; i++) { clXYZ[i] += (w * xyzi[i]); clRmsXYZ[i] += (w * xyzi[i] * xyzi[i]); } @@ -398,8 +412,8 @@ void ClusterFactory::evalLocalPositionFit(double deff, double mLogWei // cout << " wtot " << wtot << endl; if (wtot > 0) { - // xRMS = TMath::Sqrt(x2m - xMean*xMean); - for (i = 0; i < 3; i++) { + // xRMS = std::sqrt(x2m - xMean*xMean); + for (i = 0; i < nDim; i++) { clXYZ[i] /= wtot; if (nstat > 1) { @@ -407,7 +421,7 @@ void ClusterFactory::evalLocalPositionFit(double deff, double mLogWei clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i] * clXYZ[i]; if (clRmsXYZ[i] > 0.0) { - clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]); + clRmsXYZ[i] = std::sqrt(clRmsXYZ[i]); } else { clRmsXYZ[i] = 0; } @@ -416,7 +430,7 @@ void ClusterFactory::evalLocalPositionFit(double deff, double mLogWei } } } else { - for (i = 0; i < 3; i++) { + for (i = 0; i < nDim; i++) { clXYZ[i] = clRmsXYZ[i] = -1.; } } @@ -444,15 +458,17 @@ template void ClusterFactory::getDeffW0(const double esum, double& deff, double& w0) { double e = 0.0; + const double minESum = 0.5; + const double maxESu = 100.; const double kdp0 = 9.25147, kdp1 = 1.16700; // Hard coded now const double kwp0 = 4.83713, kwp1 = -2.77970e-01, kwp2 = 4.41116; // No extrapolation here - e = esum < 0.5 ? 0.5 : esum; - e = e > 100. ? 100. : e; + e = esum < minESum ? minESum : esum; + e = e > maxESu ? maxESu : e; - deff = kdp0 + kdp1 * TMath::Log(e); - w0 = kwp0 / (1. + TMath::Exp(kwp1 * (e + kwp2))); + deff = kdp0 + kdp1 * std::log(e); + w0 = kwp0 / (1. + std::exp(kwp1 * (e + kwp2))); } /// @@ -475,12 +491,12 @@ void ClusterFactory::evalCoreEnergy(gsl::span inputsIndice double phiPoint = clusterAnalysis.getLocalPosition().Phi(); double etaPoint = clusterAnalysis.getLocalPosition().Eta(); - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { auto [eta, phi] = mGeomPtr->EtaPhiFromIndex(mInputsContainer[iInput].getTower()); phi = phi * TMath::DegToRad(); - double distance = TMath::Sqrt((eta - etaPoint) * (eta - etaPoint) + (phi - phiPoint) * (phi - phiPoint)); + double distance = std::sqrt((eta - etaPoint) * (eta - etaPoint) + (phi - phiPoint) * (phi - phiPoint)); if (distance < mCoreRadius) { coreEnergy += mInputsContainer[iInput].getEnergy(); @@ -505,7 +521,7 @@ void ClusterFactory::evalElipsAxis(gsl::span inputsIndices std::array lambda; - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { auto [nSupMod, nModule, nIphi, nIeta] = mGeomPtr->GetCellIndex(mInputsContainer[iInput].getTower()); auto [iphi, ieta] = mGeomPtr->GetCellPhiEtaIndexInSModule(nSupMod, nModule, nIphi, nIeta); @@ -516,10 +532,10 @@ void ClusterFactory::evalElipsAxis(gsl::span inputsIndices ieta += EMCAL_COLS; } - double etai = (double)ieta; - double phii = (double)iphi; + double etai = static_cast(ieta); + double phii = static_cast(iphi); - double w = TMath::Max(0., mLogWeight + TMath::Log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); + double w = std::max(0., static_cast(mLogWeight) + std::log(mInputsContainer[iInput].getEnergy() / clusterAnalysis.E())); // clusterAnalysis.E() summed amplitude of inputs, i.e. energy of cluster // Gives smaller value of lambda than log weight // w = mEnergyList[iInput] / clusterAnalysis.E(); // Nov 16, 2006 - try just energy @@ -544,18 +560,18 @@ void ClusterFactory::evalElipsAxis(gsl::span inputsIndices dxz /= wtot; dxz -= x * z; - lambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt(0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz); + lambda[0] = 0.5 * (dxx + dzz) + std::sqrt(0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz); if (lambda[0] > 0) { - lambda[0] = TMath::Sqrt(lambda[0]); + lambda[0] = std::sqrt(lambda[0]); } else { lambda[0] = 0; } - lambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt(0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz); + lambda[1] = 0.5 * (dxx + dzz) - std::sqrt(0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz); if (lambda[1] > 0) { // To avoid exception if numerical errors lead to negative lambda. - lambda[1] = TMath::Sqrt(lambda[1]); + lambda[1] = std::sqrt(lambda[1]); } else { lambda[1] = 0.; } @@ -580,7 +596,7 @@ std::tuple ClusterFactory::getMaximalEnergyI float cellAmp = 0; int iSupMod0 = -1; bool shared = false; - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { if (iInput >= mInputsContainer.size()) { throw CellIndexRangeException(iInput, mInputsContainer.size()); } @@ -603,7 +619,7 @@ std::tuple ClusterFactory::getMaximalEnergyI /// Look to cell neighbourhood and reject if it seems exotic //____________________________________________________________________________ template -bool ClusterFactory::isExoticCell(short towerId, float ecell, float const exoticTime, float& fCross) const +bool ClusterFactory::isExoticCell(int16_t towerId, float ecell, float const exoticTime, float& fCross) const { if (ecell < mExoticCellMinAmplitude) { return false; // do not reject low energy cells @@ -629,15 +645,15 @@ bool ClusterFactory::isExoticCell(short towerId, float ecell, float c /// Calculate the energy in the cross around the energy of a given cell. //____________________________________________________________________________ template -float ClusterFactory::getECross(short towerId, float energy, float const exoticTime) const +float ClusterFactory::getECross(int16_t towerId, float energy, float const exoticTime) const { auto [iSM, iMod, iIphi, iIeta] = mGeomPtr->GetCellIndex(towerId); auto [iphi, ieta] = mGeomPtr->GetCellPhiEtaIndexInSModule(iSM, iMod, iIphi, iIeta); // Get close cells index, energy and time, not in corners - short towerId1 = -1; - short towerId2 = -1; + int16_t towerId1 = -1; + int16_t towerId2 = -1; if (iphi < o2::emcal::EMCAL_ROWS - 1) { try { @@ -656,8 +672,8 @@ float ClusterFactory::getECross(short towerId, float energy, float co // In case of cell in eta = 0 border, depending on SM shift the cross cell index - short towerId3 = -1; - short towerId4 = -1; + int16_t towerId3 = -1; + int16_t towerId4 = -1; if (ieta == o2::emcal::EMCAL_COLS - 1 && !(iSM % 2)) { try { @@ -700,10 +716,10 @@ float ClusterFactory::getECross(short towerId, float energy, float co LOG(debug) << "iSM " << iSM << ", towerId " << towerId << ", a " << towerId1 << ", b " << towerId2 << ", c " << towerId3 << ", e " << towerId3; - short index1 = (towerId1 > -1) ? mLoolUpTowerToIndex.at(towerId1) : -1; - short index2 = (towerId2 > -1) ? mLoolUpTowerToIndex.at(towerId2) : -1; - short index3 = (towerId3 > -1) ? mLoolUpTowerToIndex.at(towerId3) : -1; - short index4 = (towerId4 > -1) ? mLoolUpTowerToIndex.at(towerId4) : -1; + int16_t index1 = (towerId1 > -1) ? mLoolUpTowerToIndex.at(towerId1) : -1; + int16_t index2 = (towerId2 > -1) ? mLoolUpTowerToIndex.at(towerId2) : -1; + int16_t index3 = (towerId3 > -1) ? mLoolUpTowerToIndex.at(towerId3) : -1; + int16_t index4 = (towerId4 > -1) ? mLoolUpTowerToIndex.at(towerId4) : -1; std::array, 4> cellData = { {{(index1 > -1) ? mInputsContainer[index1].getEnergy() : 0., (index1 > -1) ? mInputsContainer[index1].getTimeStamp() : 0.}, @@ -719,10 +735,10 @@ float ClusterFactory::getECross(short towerId, float energy, float co float w1 = 1, w2 = 1, w3 = 1, w4 = 1; if (mUseWeightExotic) { - w1 = GetCellWeight(cellData[0].first, energy); - w2 = GetCellWeight(cellData[1].first, energy); - w3 = GetCellWeight(cellData[2].first, energy); - w4 = GetCellWeight(cellData[3].first, energy); + w1 = getCellWeight(cellData[0].first, energy); + w2 = getCellWeight(cellData[1].first, energy); + w3 = getCellWeight(cellData[2].first, energy); + w4 = getCellWeight(cellData[3].first, energy); } if (cellData[0].first < mExoticCellInCrossMinAmplitude || w1 <= 0) { @@ -745,7 +761,7 @@ float ClusterFactory::getECross(short towerId, float energy, float co /// return weight of cell for shower shape calculation //____________________________________________________________________________ template -float ClusterFactory::GetCellWeight(float eCell, float eCluster) const +float ClusterFactory::getCellWeight(float eCell, float eCluster) const { if (eCell > 0 && eCluster > 0) { if (mLogWeight > 0) { @@ -765,7 +781,7 @@ template int ClusterFactory::getMultiplicityAtLevel(float H, gsl::span inputsIndices, AnalysisCluster& clusterAnalysis) const { int multipl = 0; - for (auto iInput : inputsIndices) { + for (const auto& iInput : inputsIndices) { if (mInputsContainer[iInput].getEnergy() > H * clusterAnalysis.E()) { multipl++; } @@ -781,8 +797,8 @@ template void ClusterFactory::evalTime(gsl::span inputsIndices, AnalysisCluster& clusterAnalysis) const { float maxE = 0; - unsigned short maxAt = 0; - for (auto iInput : inputsIndices) { + uint16_t maxAt = 0; + for (const auto& iInput : inputsIndices) { if (mInputsContainer[iInput].getEnergy() > maxE) { maxE = mInputsContainer[iInput].getEnergy(); maxAt = iInput; @@ -799,13 +815,14 @@ void ClusterFactory::evalTime(gsl::span inputsIndices, Ana template double ClusterFactory::tMaxInCm(const double e, const int key) const { - const double ca = 4.82; // shower max parameter - first guess; ca=TMath::Log(1000./8.07) - double tmax = 0.; // position of electromagnetic shower max in cm + const double ca = 4.82; // shower max parameter - first guess; ca=std::log(1000./8.07) + double tmax = 0.; // position of electromagnetic shower max in cm + const double eMin = 0.1; // minimum energy const double x0 = 1.31; // radiation lenght (cm) - if (e > 0.1) { - tmax = TMath::Log(e) + ca; + if (e > eMin) { + tmax = std::log(e) + ca; if (key == 0) { tmax += 0.5; } else { @@ -823,7 +840,7 @@ double ClusterFactory::tMaxInCm(const double e, const int key) const template float ClusterFactory::etaToTheta(float arg) const { - return (2. * TMath::ATan(TMath::Exp(-arg))); + return (2. * std::atan(std::exp(-arg))); } /// @@ -832,7 +849,7 @@ float ClusterFactory::etaToTheta(float arg) const template float ClusterFactory::thetaToEta(float arg) const { - return (-1 * TMath::Log(TMath::Tan(0.5 * arg))); + return (-1 * std::log(std::tan(0.5 * arg))); } template diff --git a/Detectors/EMCAL/base/src/Geometry.cxx b/Detectors/EMCAL/base/src/Geometry.cxx index 6eff6c161f2a1..e78fedcfa0c1f 100644 --- a/Detectors/EMCAL/base/src/Geometry.cxx +++ b/Detectors/EMCAL/base/src/Geometry.cxx @@ -8,6 +8,12 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. + +/// \file Geometry.cxx +/// \brief Source file for EMCal geometry class +/// \author Markus Fasel, markus.fasel@cern.ch +/// \author Hadi Hassan, hadi.hassan@cern.ch + #include "EMCALBase/Geometry.h" #include @@ -24,6 +30,7 @@ #include #include "EMCALBase/ShishKebabTrd1Module.h" +#include "CommonConstants/MathConstants.h" #include @@ -92,8 +99,8 @@ Geometry::Geometry(const Geometry& geo) mSteelFrontThick(geo.mSteelFrontThick), // obsolete data member? mCellIndexLookup(geo.mCellIndexLookup) { - memcpy(mEnvelop, geo.mEnvelop, sizeof(Float_t) * 3); - memcpy(mParSM, geo.mParSM, sizeof(Float_t) * 3); + memcpy(mEnvelop, geo.mEnvelop, sizeof(float) * 3); + memcpy(mParSM, geo.mParSM, sizeof(float) * 3); memset(SMODULEMATRIX, 0, sizeof(TGeoHMatrix*) * EMCAL_MODULES); } @@ -185,7 +192,7 @@ Geometry::~Geometry() return; } - for (Int_t smod = 0; smod < mNumberOfSuperModules; smod++) { + for (int smod = 0; smod < mNumberOfSuperModules; smod++) { if (SMODULEMATRIX[smod]) { delete SMODULEMATRIX[smod]; } @@ -221,14 +228,19 @@ Geometry* Geometry::GetInstance(const std::string_view name, const std::string_v return nullptr; } -Geometry* Geometry::GetInstanceFromRunNumber(Int_t runNumber, const std::string_view geoName, +Geometry* Geometry::GetInstanceFromRunNumber(int runNumber, const std::string_view geoName, const std::string_view mcname, const std::string_view mctitle) { using boost::algorithm::contains; // printf("AliEMCALGeometry::GetInstanceFromRunNumber() - run %d, geoName <<%s>> \n",runNumber,geoName.Data()); - if (runNumber >= 104064 && runNumber < 140000) { + const int minRunNumber2009 = 104064; + const int maxRunNumber2010 = 140000; + const int maxRunNumber2011 = 170593; + const int minRunNumber2012 = 176000; + const int maxRunNumberRun2 = 197692; + if (runNumber >= minRunNumber2009 && runNumber < maxRunNumber2010) { // 2009-2010 runs // First year geometry, 4 SM. @@ -243,7 +255,7 @@ Geometry* Geometry::GetInstanceFromRunNumber(Int_t runNumber, const std::string_ } return Geometry::GetInstance("EMCAL_FIRSTYEARV1", mcname, mctitle); - } else if (runNumber >= 140000 && runNumber <= 170593) { + } else if (runNumber >= maxRunNumber2010 && runNumber <= maxRunNumber2011) { // Almost complete EMCAL geometry, 10 SM. Year 2011 configuration if (contains(geoName, "COMPLETEV1") && geoName != std::string("")) { @@ -256,7 +268,7 @@ Geometry* Geometry::GetInstanceFromRunNumber(Int_t runNumber, const std::string_ << "o2::emcal::Geometry::GetInstanceFromRunNumber() - Initialized geometry with name <>"; } return Geometry::GetInstance("EMCAL_COMPLETEV1", mcname, mctitle); - } else if (runNumber > 176000 && runNumber <= 197692) { + } else if (runNumber > minRunNumber2012 && runNumber <= maxRunNumberRun2) { // Complete EMCAL geometry, 12 SM. Year 2012 and on // The last 2 SM were not active, anyway they were there. @@ -270,8 +282,7 @@ Geometry* Geometry::GetInstanceFromRunNumber(Int_t runNumber, const std::string_ "<>"; } return Geometry::GetInstance("EMCAL_COMPLETE12SMV1", mcname, mctitle); - } else // Run 2 - { + } else { // Run 2 // EMCAL + DCAL geometry, 20 SM. Year 2015 and on if (contains(geoName, "DCAL_8SM") && geoName != std::string("")) { @@ -313,7 +324,7 @@ void Geometry::DefineSamplingFraction(const std::string_view mcname, const std:: } } - Float_t samplingFactorTranportModel = 1.; + float samplingFactorTranportModel = 1.; // Note: The sampling factors are chosen so that results from the simulation // engines correspond well with testbeam data @@ -415,12 +426,12 @@ void Geometry::DefineEMC(std::string_view mcname, std::string_view mctitle) mECScintThick = 0.176; // scintillator layer thickness mECPbRadThickness = 0.144; // lead layer thickness - mPhiModuleSize = 12.26 - mPhiGapForSM / Float_t(mNPhi); // first assumption + mPhiModuleSize = 12.26 - mPhiGapForSM / static_cast(mNPhi); // first assumption mEtaModuleSize = mPhiModuleSize; mZLength = 700.; // Z coverage (cm) mPhiSuperModule = 20.; // phi in degree - mDCALInnerEdge = mIPDistance * TMath::Tan(mTrd1Angle * 8. * TMath::DegToRad()); + mDCALInnerEdge = mIPDistance * std::tan(mTrd1Angle * 8. * o2::constants::math::Deg2Rad); // modifications to the above for PDC06 geometry if (contains(mGeoName, "PDC06")) { // 18-may-05 - about common structure @@ -485,11 +496,11 @@ void Geometry::DefineEMC(std::string_view mcname, std::string_view mctitle) mEMCSMSystem.clear(); mEMCSMSystem.resize(mNumberOfSuperModules); - for (Int_t i = 0; i < mNumberOfSuperModules; i++) { + for (int i = 0; i < mNumberOfSuperModules; i++) { mEMCSMSystem[i] = NOT_EXISTENT; } - Int_t iSM = 0; + int iSM = 0; // // BASIC EMCAL SM @@ -567,19 +578,19 @@ void Geometry::DefineEMC(std::string_view mcname, std::string_view mctitle) mNPhiSuperModule = 1; } - mPhiTileSize = mPhiModuleSize / double(mNPHIdiv) - mLateralSteelStrip; // 13-may-05 - mEtaTileSize = mEtaModuleSize / double(mNETAdiv) - mLateralSteelStrip; // 13-may-05 + mPhiTileSize = mPhiModuleSize / static_cast(mNPHIdiv) - mLateralSteelStrip; // 13-may-05 + mEtaTileSize = mEtaModuleSize / static_cast(mNETAdiv) - mLateralSteelStrip; // 13-may-05 mLongModuleSize = mNECLayers * (mECScintThick + mECPbRadThickness); if (contains(mGeoName, "V1")) { - Double_t ws = mECScintThick + mECPbRadThickness + 2. * mTrd1BondPaperThick; // sampling width + double ws = mECScintThick + mECPbRadThickness + 2. * mTrd1BondPaperThick; // sampling width // Number of Pb tiles = Number of Sc tiles - 1 mLongModuleSize = mTrd1AlFrontThick + (ws * mNECLayers - mECPbRadThickness); } - m2Trd1Dx2 = mEtaModuleSize + 2. * mLongModuleSize * TMath::Tan(mTrd1Angle * TMath::DegToRad() / 2.); + m2Trd1Dx2 = mEtaModuleSize + 2. * mLongModuleSize * std::tan(mTrd1Angle * o2::constants::math::Deg2Rad / 2.); if (!contains(mGeoName, "WSUC")) { - mShellThickness = TMath::Sqrt(mLongModuleSize * mLongModuleSize + m2Trd1Dx2 * m2Trd1Dx2); + mShellThickness = std::sqrt(mLongModuleSize * mLongModuleSize + m2Trd1Dx2 * m2Trd1Dx2); } // These parameters are used to create the mother volume to hold the supermodules @@ -597,14 +608,14 @@ void Geometry::DefineEMC(std::string_view mcname, std::string_view mctitle) mPhiBoundariesOfSM.resize(mNumberOfSuperModules); mPhiCentersOfSM.resize(mNumberOfSuperModules / 2); mPhiCentersOfSMSec.resize(mNumberOfSuperModules / 2); - Double_t kfSupermodulePhiWidth = mPhiSuperModule * TMath::DegToRad(); - mPhiCentersOfSM[0] = (mArm1PhiMin + mPhiSuperModule / 2.) * TMath::DegToRad(); // Define from First SM - mPhiCentersOfSMSec[0] = mPhiCentersOfSM[0]; // the same in the First SM - mPhiBoundariesOfSM[0] = mPhiCentersOfSM[0] - TMath::ATan2(mParSM[1], mIPDistance); // 1th and 2th modules) - mPhiBoundariesOfSM[1] = mPhiCentersOfSM[0] + TMath::ATan2(mParSM[1], mIPDistance); + double kfSupermodulePhiWidth = mPhiSuperModule * o2::constants::math::Deg2Rad; + mPhiCentersOfSM[0] = (mArm1PhiMin + mPhiSuperModule / 2.) * o2::constants::math::Deg2Rad; // Define from First SM + mPhiCentersOfSMSec[0] = mPhiCentersOfSM[0]; // the same in the First SM + mPhiBoundariesOfSM[0] = mPhiCentersOfSM[0] - std::atan2(mParSM[1], mIPDistance); // 1th and 2th modules) + mPhiBoundariesOfSM[1] = mPhiCentersOfSM[0] + std::atan2(mParSM[1], mIPDistance); if (mNumberOfSuperModules > 2) { // 2 to Max - Int_t tmpSMType = GetSMType(2); + int tmpSMType = GetSMType(2); for (int i = 1; i < mNPhiSuperModule; i++) { mPhiBoundariesOfSM[2 * i] += mPhiBoundariesOfSM[2 * i - 2] + kfSupermodulePhiWidth; if (tmpSMType == GetSMType(2 * i)) { @@ -617,24 +628,24 @@ void Geometry::DefineEMC(std::string_view mcname, std::string_view mctitle) mPhiBoundariesOfSM[2 * i + 1] = mPhiBoundariesOfSM[2 * i] + kfSupermodulePhiWidth; break; case EMCAL_HALF: - mPhiBoundariesOfSM[2 * i + 1] = mPhiBoundariesOfSM[2 * i] + 2. * TMath::ATan2((mParSM[1]) / 2, mIPDistance); + mPhiBoundariesOfSM[2 * i + 1] = mPhiBoundariesOfSM[2 * i] + 2. * std::atan2((mParSM[1]) / 2, mIPDistance); break; case EMCAL_THIRD: - mPhiBoundariesOfSM[2 * i + 1] = mPhiBoundariesOfSM[2 * i] + 2. * TMath::ATan2((mParSM[1]) / 3, mIPDistance); + mPhiBoundariesOfSM[2 * i + 1] = mPhiBoundariesOfSM[2 * i] + 2. * std::atan2((mParSM[1]) / 3, mIPDistance); break; case DCAL_STANDARD: - mPhiBoundariesOfSM[2 * i] = (mDCALPhiMin - mArm1PhiMin) * TMath::DegToRad() + mPhiBoundariesOfSM[0]; - mPhiBoundariesOfSM[2 * i + 1] = (mDCALPhiMin - mArm1PhiMin) * TMath::DegToRad() + mPhiBoundariesOfSM[1]; + mPhiBoundariesOfSM[2 * i] = (mDCALPhiMin - mArm1PhiMin) * o2::constants::math::Deg2Rad + mPhiBoundariesOfSM[0]; + mPhiBoundariesOfSM[2 * i + 1] = (mDCALPhiMin - mArm1PhiMin) * o2::constants::math::Deg2Rad + mPhiBoundariesOfSM[1]; break; case DCAL_EXT: - mPhiBoundariesOfSM[2 * i + 1] = mPhiBoundariesOfSM[2 * i] + 2. * TMath::ATan2((mParSM[1]) / 3, mIPDistance); + mPhiBoundariesOfSM[2 * i + 1] = mPhiBoundariesOfSM[2 * i] + 2. * std::atan2((mParSM[1]) / 3, mIPDistance); break; default: break; - }; + } } mPhiCentersOfSM[i] = (mPhiBoundariesOfSM[2 * i] + mPhiBoundariesOfSM[2 * i + 1]) / 2.; - mPhiCentersOfSMSec[i] = mPhiBoundariesOfSM[2 * i] + TMath::ATan2(mParSM[1], mIPDistance); + mPhiCentersOfSMSec[i] = mPhiBoundariesOfSM[2 * i] + std::atan2(mParSM[1], mIPDistance); } } @@ -642,14 +653,14 @@ void Geometry::DefineEMC(std::string_view mcname, std::string_view mctitle) // 80-degree-edge), const double INNNER_EXTENDED_PHI = 1.102840997; // calculated from the smallest gap (1# cell to the 80-degree-edge), too complicatd to explain... - mDCALInnerExtandedEta = -TMath::Log( - TMath::Tan((TMath::Pi() / 2. - 8 * mTrd1Angle * TMath::DegToRad() + - (TMath::Pi() / 2 - mNZ * mTrd1Angle * TMath::DegToRad() - TMath::ATan(TMath::Exp(mArm1EtaMin)) * 2)) / - 2.)); + mDCALInnerExtandedEta = -std::log( + std::tan((o2::constants::math::PIHalf - 8. * mTrd1Angle * o2::constants::math::Deg2Rad + + (o2::constants::math::PIHalf - mNZ * mTrd1Angle * o2::constants::math::Deg2Rad - std::atan(std::exp(mArm1EtaMin)) * 2.)) / + 2.)); mEMCALPhiMax = mArm1PhiMin; mDCALPhiMax = mDCALPhiMin; // DCAl extention will not be included - for (Int_t i = 0; i < mNumberOfSuperModules; i += 2) { + for (int i = 0; i < mNumberOfSuperModules; i += 2) { switch (GetSMType(i)) { case EMCAL_STANDARD: mEMCALPhiMax += 20.; @@ -670,7 +681,7 @@ void Geometry::DefineEMC(std::string_view mcname, std::string_view mctitle) default: LOG(error) << "Unkown SM Type!!\n"; break; - }; + } } // for compatible reason // if(fNumberOfSuperModules == 4) {fEMCALPhiMax = fArm1PhiMax ;} @@ -683,7 +694,7 @@ void Geometry::DefineEMC(std::string_view mcname, std::string_view mctitle) // DefineSamplingFraction(mcname,mctitle); } -void Geometry::GetGlobal(const Double_t* loc, Double_t* glob, int iSM) const +void Geometry::GetGlobal(const double* loc, double* glob, int iSM) const { const TGeoHMatrix* m = GetMatrixForSuperModule(iSM); if (m) { @@ -695,17 +706,17 @@ void Geometry::GetGlobal(const Double_t* loc, Double_t* glob, int iSM) const void Geometry::GetGlobal(const TVector3& vloc, TVector3& vglob, int iSM) const { - Double_t tglob[3], tloc[3]; + double tglob[3], tloc[3]; vloc.GetXYZ(tloc); GetGlobal(tloc, tglob, iSM); vglob.SetXYZ(tglob[0], tglob[1], tglob[2]); } -void Geometry::GetGlobal(Int_t absId, Double_t glob[3]) const +void Geometry::GetGlobal(int absId, double glob[3]) const { double loc[3]; - memset(glob, 0, sizeof(Double_t) * 3); + memset(glob, 0, sizeof(double) * 3); try { auto cellpos = RelPosCellInSModule(absId); loc[0] = cellpos.X(); @@ -716,7 +727,7 @@ void Geometry::GetGlobal(Int_t absId, Double_t glob[3]) const return; } - Int_t nSupMod = std::get<0>(GetCellIndex(absId)); + int nSupMod = std::get<0>(GetCellIndex(absId)); const TGeoHMatrix* m = GetMatrixForSuperModule(nSupMod); if (m) { m->LocalToMaster(loc, glob); @@ -725,15 +736,15 @@ void Geometry::GetGlobal(Int_t absId, Double_t glob[3]) const } } -void Geometry::GetGlobal(Int_t absId, TVector3& vglob) const +void Geometry::GetGlobal(int absId, TVector3& vglob) const { - Double_t glob[3]; + double glob[3]; GetGlobal(absId, glob); vglob.SetXYZ(glob[0], glob[1], glob[2]); } -std::tuple Geometry::EtaPhiFromIndex(Int_t absId) const +std::tuple Geometry::EtaPhiFromIndex(int absId) const { TVector3 vglob; GetGlobal(absId, vglob); @@ -767,7 +778,7 @@ int Geometry::GetAbsCellId(int supermoduleID, int moduleID, int phiInModule, int break; default: throw InvalidSupermoduleTypeException(); - }; + } } cellid += mNCellsInModule * moduleID; @@ -793,7 +804,7 @@ std::tuple Geometry::GetModuleIndexesFromCellIndexesInSModule(int return std::make_tuple(phiInModule, etaInModule, moduleID); } -Int_t Geometry::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const +int Geometry::GetAbsCellIdFromCellIndexes(int nSupMod, int iphi, int ieta) const { // Check if the indeces correspond to existing SM or tower indeces if (iphi < 0 || iphi >= EMCAL_ROWS || ieta < 0 || ieta >= EMCAL_COLS || nSupMod < 0 || @@ -804,8 +815,8 @@ Int_t Geometry::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t iet auto indexmod = GetModuleIndexesFromCellIndexesInSModule(nSupMod, iphi, ieta); - Int_t nIeta = ieta % mNETAdiv, - nIphi = iphi % mNPHIdiv; + int nIeta = ieta % mNETAdiv, + nIphi = iphi % mNPHIdiv; nIeta = mNETAdiv - 1 - nIeta; return GetAbsCellId(nSupMod, std::get<2>(indexmod), nIphi, nIeta); } @@ -887,8 +898,8 @@ std::tuple Geometry::GetCellIndexFromGlobalRowCol(int row, i auto [supermodule, rowSM, colSM] = GetPositionInSupermoduleFromGlobalRowCol(row, col); auto indexmod = GetModuleIndexesFromCellIndexesInSModule(supermodule, rowSM, colSM); - Int_t colInModule = colSM % mNETAdiv, - rowInMOdule = rowSM % mNPHIdiv; + int colInModule = colSM % mNETAdiv, + rowInMOdule = rowSM % mNPHIdiv; colInModule = mNETAdiv - 1 - colInModule; return std::make_tuple(supermodule, std::get<2>(indexmod), rowInMOdule, colInModule); } @@ -903,16 +914,16 @@ int Geometry::GlobalRow(int cellID) const return std::get<0>(GlobalRowColFromIndex(cellID)); } -Int_t Geometry::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi) const +int Geometry::SuperModuleNumberFromEtaPhi(double eta, double phi) const { - if (TMath::Abs(eta) > mEtaMaxOfTRD1) { + if (std::abs(eta) > mEtaMaxOfTRD1) { throw InvalidPositionException(eta, phi); } phi = TVector2::Phi_0_2pi(phi); // move phi to (0,2pi) boundaries - Int_t nphism = mNumberOfSuperModules / 2; - Int_t nSupMod = 0; - for (Int_t i = 0; i < nphism; i++) { + int nphism = mNumberOfSuperModules / 2; + int nSupMod = 0; + for (int i = 0; i < nphism; i++) { LOG(debug) << "Sec " << i << ": Min " << mPhiBoundariesOfSM[2 * i] << ", Max " << mPhiBoundariesOfSM[2 * i + 1]; if (phi >= mPhiBoundariesOfSM[2 * i] && phi <= mPhiBoundariesOfSM[2 * i + 1]) { nSupMod = 2 * i; @@ -921,7 +932,7 @@ Int_t Geometry::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi) const } if (GetSMType(nSupMod) == DCAL_STANDARD) { // Gap between DCAL - if (TMath::Abs(eta) < GetNEta() / 3 * mTrd1Angle * TMath::DegToRad()) { + if (std::abs(eta) < GetNEta() / 3. * mTrd1Angle * o2::constants::math::Deg2Rad) { throw InvalidPositionException(eta, phi); } } @@ -934,14 +945,14 @@ Int_t Geometry::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi) const throw InvalidPositionException(eta, phi); } -Int_t Geometry::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi) const +int Geometry::GetAbsCellIdFromEtaPhi(double eta, double phi) const { - Int_t nSupMod = SuperModuleNumberFromEtaPhi(eta, phi); + int nSupMod = SuperModuleNumberFromEtaPhi(eta, phi); // phi index first phi = TVector2::Phi_0_2pi(phi); - Double_t phiLoc = phi - mPhiCentersOfSMSec[nSupMod / 2]; - Int_t nphi = mPhiCentersOfCells.size(); + double phiLoc = phi - mPhiCentersOfSMSec[nSupMod / 2]; + int nphi = mPhiCentersOfCells.size(); switch (GetSMType(nSupMod)) { case EMCAL_HALF: nphi /= 2; @@ -952,13 +963,13 @@ Int_t Geometry::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi) const default: // All other supermodules have full number of cells in phi break; - }; + } - Double_t dmin = TMath::Abs(mPhiCentersOfCells[0] - phiLoc), - d = 0.; - Int_t iphi = 0; - for (Int_t i = 1; i < nphi; i++) { - d = TMath::Abs(mPhiCentersOfCells[i] - phiLoc); + double dmin = std::abs(mPhiCentersOfCells[0] - phiLoc), + d = 0.; + int iphi = 0; + for (int i = 1; i < nphi; i++) { + d = std::abs(mPhiCentersOfCells[i] - phiLoc); if (d < dmin) { dmin = d; iphi = i; @@ -969,16 +980,16 @@ Int_t Geometry::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi) const LOG(debug2) << " iphi " << iphi << " : dmin " << dmin << " (phi " << phi << ", phiLoc " << phiLoc << ")\n"; // eta index - Double_t absEta = TMath::Abs(eta); - Int_t neta = mCentersOfCellsEtaDir.size(), - etaShift = iphi * neta, - ieta = 0; + double absEta = std::abs(eta); + int neta = mCentersOfCellsEtaDir.size(), + etaShift = iphi * neta, + ieta = 0; if (GetSMType(nSupMod) == DCAL_STANDARD) { ieta += 16; // jump 16 cells for DCSM } - dmin = TMath::Abs(mEtaCentersOfCells[etaShift + ieta] - absEta); - for (Int_t i = ieta + 1; i < neta; i++) { - d = TMath::Abs(mEtaCentersOfCells[i + etaShift] - absEta); + dmin = std::abs(mEtaCentersOfCells[etaShift + ieta] - absEta); + for (int i = ieta + 1; i < neta; i++) { + d = std::abs(mEtaCentersOfCells[i + etaShift] - absEta); if (d < dmin) { dmin = d; ieta = i; @@ -1003,16 +1014,16 @@ Int_t Geometry::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi) const return GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta); } -std::tuple Geometry::CalculateCellIndex(Int_t absId) const +std::tuple Geometry::CalculateCellIndex(int absId) const { if (!CheckAbsCellId(absId)) { throw InvalidCellIDException(absId); } - Int_t tmp = absId; - Int_t test = absId; + int tmp = absId; + int test = absId; - Int_t nSupMod; + int nSupMod; for (nSupMod = -1; test >= 0;) { nSupMod++; tmp = test; @@ -1032,16 +1043,16 @@ std::tuple Geometry::CalculateCellIndex(Int_t absId) const break; default: throw InvalidSupermoduleTypeException(); - }; + } } - Int_t nModule = tmp / mNCellsInModule; + int nModule = tmp / mNCellsInModule; tmp = tmp % mNCellsInModule; - Int_t nIphi = tmp / mNPHIdiv, nIeta = tmp % mNETAdiv; + int nIphi = tmp / mNPHIdiv, nIeta = tmp % mNETAdiv; return std::make_tuple(nSupMod, nModule, nIphi, nIeta); } -std::tuple Geometry::GetCellIndex(Int_t absId) const +std::tuple Geometry::GetCellIndex(int absId) const { if (!CheckAbsCellId(absId)) { throw InvalidCellIDException(absId); @@ -1049,7 +1060,7 @@ std::tuple Geometry::GetCellIndex(Int_t absId) const return mCellIndexLookup[absId]; } -Int_t Geometry::GetSuperModuleNumber(Int_t absId) const { return std::get<0>(GetCellIndex(absId)); } +int Geometry::GetSuperModuleNumber(int absId) const { return std::get<0>(GetCellIndex(absId)); } std::tuple Geometry::GetModulePhiEtaIndexInSModule(int supermoduleID, int moduleID) const { @@ -1065,8 +1076,8 @@ std::tuple Geometry::GetModulePhiEtaIndexInSModule(int supermoduleID, default: nModulesInPhi = mNPhi; // full SM break; - }; - return std::make_tuple(int(moduleID % nModulesInPhi), int(moduleID / nModulesInPhi)); + } + return std::make_tuple(static_cast(moduleID % nModulesInPhi), static_cast(moduleID / nModulesInPhi)); } std::tuple Geometry::GetCellPhiEtaIndexInSModule(int supermoduleID, int moduleID, int phiInModule, @@ -1085,7 +1096,7 @@ std::tuple Geometry::GetCellPhiEtaIndexInSModule(int supermoduleID, in return std::make_tuple(phiInSupermodule, etaInSupermodule); } -std::tuple Geometry::ShiftOnlineToOfflineCellIndexes(Int_t supermoduleID, Int_t iphi, Int_t ieta) const +std::tuple Geometry::ShiftOnlineToOfflineCellIndexes(int supermoduleID, int iphi, int ieta) const { if (supermoduleID == 13 || supermoduleID == 15 || supermoduleID == 17) { // DCal odd SMs @@ -1097,7 +1108,7 @@ std::tuple Geometry::ShiftOnlineToOfflineCellIndexes(Int_t supermodule return std::tuple(iphi, ieta); } -std::tuple Geometry::ShiftOfflineToOnlineCellIndexes(Int_t supermoduleID, Int_t iphi, Int_t ieta) const +std::tuple Geometry::ShiftOfflineToOnlineCellIndexes(int supermoduleID, int iphi, int ieta) const { if (supermoduleID == 13 || supermoduleID == 15 || supermoduleID == 17) { // DCal odd SMs @@ -1109,27 +1120,27 @@ std::tuple Geometry::ShiftOfflineToOnlineCellIndexes(Int_t supermodule return std::tuple(iphi, ieta); } -o2::math_utils::Point3D Geometry::RelPosCellInSModule(Int_t absId) const +o2::math_utils::Point3D Geometry::RelPosCellInSModule(int absId) const { // Shift index taking into account the difference between standard SM // and SM of half (or one third) size in phi direction - Int_t phiindex = mCentersOfCellsPhiDir.size(); - Double_t zshift = 0.5 * GetDCALInnerEdge(); - Double_t xr, yr, zr; + int phiindex = mCentersOfCellsPhiDir.size(); + double zshift = 0.5 * GetDCALInnerEdge(); + double xr, yr, zr; if (!CheckAbsCellId(absId)) { throw InvalidCellIDException(absId); } auto cellindex = GetCellIndex(absId); - Int_t nSupMod = std::get<0>(cellindex), nModule = std::get<1>(cellindex), nIphi = std::get<2>(cellindex), - nIeta = std::get<3>(cellindex); + int nSupMod = std::get<0>(cellindex), nModule = std::get<1>(cellindex), nIphi = std::get<2>(cellindex), + nIeta = std::get<3>(cellindex); auto indexinsm = GetCellPhiEtaIndexInSModule(nSupMod, nModule, nIphi, nIeta); - Int_t iphi = std::get<0>(indexinsm), ieta = std::get<1>(indexinsm); + int iphi = std::get<0>(indexinsm), ieta = std::get<1>(indexinsm); // Get eta position. Careful with ALICE conventions (increase index decrease eta) - Int_t ieta2 = ieta; + int ieta2 = ieta; if (nSupMod % 2 == 0) { ieta2 = (mCentersOfCellsEtaDir.size() - 1) - ieta; // 47-ieta, revert the ordering on A side in order to keep convention. @@ -1145,7 +1156,7 @@ o2::math_utils::Point3D Geometry::RelPosCellInSModule(Int_t absId) const xr = mCentersOfCellsXDir[ieta2]; // Get phi position. Careful with ALICE conventions (increase index increase phi) - Int_t iphi2 = iphi; + int iphi2 = iphi; if (GetSMType(nSupMod) == DCAL_EXT) { if (nSupMod % 2 != 0) { iphi2 = (phiindex / 3 - 1) - iphi; // 7-iphi [1/3SM], revert the ordering on C side in order to keep convention. @@ -1174,29 +1185,29 @@ o2::math_utils::Point3D Geometry::RelPosCellInSModule(Int_t absId) const return o2::math_utils::Point3D(xr, yr, zr); } -o2::math_utils::Point3D Geometry::RelPosCellInSModule(Int_t absId, Double_t distEff) const +o2::math_utils::Point3D Geometry::RelPosCellInSModule(int absId, double distEff) const { // Shift index taking into account the difference between standard SM // and SM of half (or one third) size in phi direction - Double_t xr, yr, zr; - Int_t nphiIndex = mCentersOfCellsPhiDir.size(); - Double_t zshift = 0.5 * GetDCALInnerEdge(); - Int_t kDCalshift = 8; // wangml DCal cut first 8 modules(16 cells) + double xr, yr, zr; + int nphiIndex = mCentersOfCellsPhiDir.size(); + double zshift = 0.5 * GetDCALInnerEdge(); + int kDCalshift = 8; // wangml DCal cut first 8 modules(16 cells) - Int_t iphim = -1, ietam = -1; + int iphim = -1, ietam = -1; TVector2 v; if (!CheckAbsCellId(absId)) { throw InvalidCellIDException(absId); } auto cellindex = GetCellIndex(absId); - Int_t nSupMod = std::get<0>(cellindex), nModule = std::get<1>(cellindex), nIphi = std::get<2>(cellindex), - nIeta = std::get<3>(cellindex); + int nSupMod = std::get<0>(cellindex), nModule = std::get<1>(cellindex), nIphi = std::get<2>(cellindex), + nIeta = std::get<3>(cellindex); auto indmodep = GetModulePhiEtaIndexInSModule(nSupMod, nModule); iphim = std::get<0>(indmodep); ietam = std::get<1>(indmodep); auto indexinsm = GetCellPhiEtaIndexInSModule(nSupMod, nModule, nIphi, nIeta); - Int_t iphi = std::get<0>(indexinsm), ieta = std::get<1>(indexinsm); + int iphi = std::get<0>(indexinsm), ieta = std::get<1>(indexinsm); // Get eta position. Careful with ALICE conventions (increase index decrease eta) if (nSupMod % 2 == 0) { @@ -1221,7 +1232,7 @@ o2::math_utils::Point3D Geometry::RelPosCellInSModule(Int_t absId, Doubl } // Get phi position. Careful with ALICE conventions (increase index increase phi) - Int_t iphi2 = iphi; + int iphi2 = iphi; if (GetSMType(nSupMod) == DCAL_EXT) { if (nSupMod % 2 != 0) { iphi2 = (nphiIndex / 3 - 1) - iphi; // 7-iphi [1/3SM], revert the ordering on C side in order to keep convention. @@ -1258,7 +1269,7 @@ void Geometry::CreateListOfTrd1Modules() for (int iz = 0; iz < mNZ; iz++) { if (iz == 0) { // mod = new AliEMCALShishKebabTrd1Module(TMath::Pi()/2.,this); - mShishKebabTrd1Modules.emplace_back(ShishKebabTrd1Module(TMath::Pi() / 2., this)); + mShishKebabTrd1Modules.emplace_back(ShishKebabTrd1Module(o2::constants::math::PIHalf, this)); } else { mShishKebabTrd1Modules.emplace_back(ShishKebabTrd1Module(mShishKebabTrd1Modules.back())); } @@ -1281,19 +1292,19 @@ void Geometry::CreateListOfTrd1Modules() // LOG(debug2) << " Cells grid in phi directions : size " << mCentersOfCellsPhiDir.size(); - Int_t ind = 0; // this is phi index - Int_t ieta = 0, nModule = 0; - Double_t xr = 0., zr = 0., theta = 0., phi = 0., eta = 0., r = 0., x = 0., y = 0.; + int ind = 0; // this is phi index + int ieta = 0, nModule = 0; + double xr = 0., zr = 0., theta = 0., phi = 0., eta = 0., r = 0., x = 0., y = 0.; TVector3 vglob; - Double_t ytCenterModule = 0.0, ytCenterCell = 0.0; + double ytCenterModule = 0.0, ytCenterCell = 0.0; mCentersOfCellsPhiDir.resize(mNPhi * mNPHIdiv); mPhiCentersOfCells.resize(mNPhi * mNPHIdiv); - Double_t r0 = mIPDistance + mLongModuleSize / 2.; - for (Int_t it = 0; it < mNPhi; it++) { // cycle on modules + double r0 = mIPDistance + mLongModuleSize / 2.; + for (int it = 0; it < mNPhi; it++) { // cycle on modules ytCenterModule = -mParSM[1] + mPhiModuleSize * (2 * it + 1) / 2; // center of module - for (Int_t ic = 0; ic < mNPHIdiv; ic++) { // cycle on cells in module + for (int ic = 0; ic < mNPHIdiv; ic++) { // cycle on cells in module if (mNPHIdiv == 2) { ytCenterCell = ytCenterModule + mPhiTileSize * (2 * ic - 1) / 2.; } else if (mNPHIdiv == 3) { @@ -1305,7 +1316,7 @@ void Geometry::CreateListOfTrd1Modules() // Define grid on phi direction // Grid is not the same for different eta bin; // Effect is small but is still here - phi = TMath::ATan2(ytCenterCell, r0); + phi = std::atan2(ytCenterCell, r0); mPhiCentersOfCells[ind] = phi; LOG(debug2) << " ind " << std::setw(2) << std::setprecision(2) << ind << " : y " << std::setw(8) @@ -1320,10 +1331,10 @@ void Geometry::CreateListOfTrd1Modules() LOG(debug2) << " Cells grid in eta directions : size " << mCentersOfCellsEtaDir.size(); - for (Int_t it = 0; it < mNZ; it++) { + for (int it = 0; it < mNZ; it++) { const ShishKebabTrd1Module& trd1 = GetShishKebabModule(it); nModule = mNPhi * it; - for (Int_t ic = 0; ic < mNETAdiv; ic++) { + for (int ic = 0; ic < mNETAdiv; ic++) { if (mNPHIdiv == 2) { trd1.GetCenterOfCellInLocalCoordinateofSM(ic, xr, zr); // case of 2X2 auto indexinsm = GetCellPhiEtaIndexInSModule(0, nModule, 0, ic); @@ -1339,14 +1350,14 @@ void Geometry::CreateListOfTrd1Modules() auto indexinsm = GetCellPhiEtaIndexInSModule(0, nModule, 0, ic); ieta = std::get<1>(indexinsm); } - mCentersOfCellsXDir[ieta] = float(xr) - mParSM[0]; - mCentersOfCellsEtaDir[ieta] = float(zr) - mParSM[2]; + mCentersOfCellsXDir[ieta] = static_cast(xr) - mParSM[0]; + mCentersOfCellsEtaDir[ieta] = static_cast(zr) - mParSM[2]; // Define grid on eta direction for each bin in phi for (int iphi = 0; iphi < mCentersOfCellsPhiDir.size(); iphi++) { x = xr + trd1.GetRadius(); y = mCentersOfCellsPhiDir[iphi]; - r = TMath::Sqrt(x * x + y * y + zr * zr); - theta = TMath::ACos(zr / r); + r = std::sqrt(x * x + y * y + zr * zr); + theta = std::acos(zr / r); eta = ShishKebabTrd1Module::ThetaToEta(theta); // ind = ieta*fCentersOfCellsPhiDir.GetSize() + iphi; ind = iphi * mCentersOfCellsEtaDir.size() + ieta; @@ -1356,14 +1367,14 @@ void Geometry::CreateListOfTrd1Modules() } } - for (Int_t i = 0; i < mCentersOfCellsEtaDir.size(); i++) { + for (int i = 0; i < mCentersOfCellsEtaDir.size(); i++) { LOG(debug2) << " ind " << std::setw(2) << std::setprecision(2) << i + 1 << " : z " << std::setw(8) << std::setprecision(3) << mCentersOfCellsEtaDir[i] << " : x " << std::setw(8) << std::setprecision(3) << mCentersOfCellsXDir[i]; } } -const ShishKebabTrd1Module& Geometry::GetShishKebabModule(Int_t neta) const +const ShishKebabTrd1Module& Geometry::GetShishKebabModule(int neta) const { if (mShishKebabTrd1Modules.size() && neta >= 0 && neta < mShishKebabTrd1Modules.size()) { return mShishKebabTrd1Modules.at(neta); @@ -1371,10 +1382,10 @@ const ShishKebabTrd1Module& Geometry::GetShishKebabModule(Int_t neta) const throw InvalidModuleException(neta, mShishKebabTrd1Modules.size()); } -Bool_t Geometry::Impact(const TParticle* particle) const +bool Geometry::Impact(const TParticle* particle) const { - Bool_t in = kFALSE; - Int_t absID = 0; + bool in = kFALSE; + int absID = 0; math_utils::Point3D vimpact = {0, 0, 0}; ImpactOnEmcal({particle->Vx(), particle->Vy(), particle->Vz()}, particle->Theta(), particle->Phi(), absID, vimpact); @@ -1386,9 +1397,9 @@ Bool_t Geometry::Impact(const TParticle* particle) const return in; } -void Geometry::ImpactOnEmcal(const math_utils::Point3D& vtx, Double_t theta, Double_t phi, Int_t& absId, math_utils::Point3D& vimpact) const +void Geometry::ImpactOnEmcal(const math_utils::Point3D& vtx, double theta, double phi, int& absId, math_utils::Point3D& vimpact) const { - math_utils::Vector3D p(TMath::Sin(theta) * TMath::Cos(phi), TMath::Sin(theta) * TMath::Sin(phi), TMath::Cos(theta)); + math_utils::Vector3D p(std::sin(theta) * std::cos(phi), std::sin(theta) * std::sin(phi), std::cos(theta)); vimpact.SetXYZ(0, 0, 0); absId = -1; @@ -1397,7 +1408,7 @@ void Geometry::ImpactOnEmcal(const math_utils::Point3D& vtx, Double_t th } math_utils::Vector3D direction; - Double_t factor = (mIPDistance - vtx.Y()) / p.Y(); + double factor = (mIPDistance - vtx.Y()) / p.Y(); direction = vtx + factor * p; // from particle direction -> tower hitted @@ -1405,8 +1416,8 @@ void Geometry::ImpactOnEmcal(const math_utils::Point3D& vtx, Double_t th // tower absID hitted -> tower/module plane (evaluated at the center of the tower) - Double_t loc[3], loc2[3], loc3[3]; - Double_t glob[3] = {}, glob2[3] = {}, glob3[3] = {}; + double loc[3], loc2[3], loc3[3]; + double glob[3] = {}, glob2[3] = {}, glob3[3] = {}; try { RelPosCellInSModule(absId).GetCoordinates(loc[0], loc[1], loc[2]); @@ -1417,10 +1428,10 @@ void Geometry::ImpactOnEmcal(const math_utils::Point3D& vtx, Double_t th // loc is cell center of tower auto cellindex = GetCellIndex(absId); - Int_t nSupMod = std::get<0>(cellindex), nModule = std::get<1>(cellindex), nIphi = std::get<2>(cellindex), - nIeta = std::get<3>(cellindex); + int nSupMod = std::get<0>(cellindex), nModule = std::get<1>(cellindex), nIphi = std::get<2>(cellindex), + nIeta = std::get<3>(cellindex); // look at 2 neighbours-s cell using nIphi={0,1} and nIeta={0,1} - Int_t nIphi2 = -1, nIeta2 = -1, absId2 = -1, absId3 = -1; + int nIphi2 = -1, nIeta2 = -1, absId2 = -1, absId3 = -1; if (nIeta == 0) { nIeta2 = 1; } else { @@ -1461,18 +1472,18 @@ void Geometry::ImpactOnEmcal(const math_utils::Point3D& vtx, Double_t th } // Equation of Plane from glob,glob2,glob3 (Ax+By+Cz+D=0) - Double_t a = glob[1] * (glob2[2] - glob3[2]) + glob2[1] * (glob3[2] - glob[2]) + glob3[1] * (glob[2] - glob2[2]); - Double_t b = glob[2] * (glob2[0] - glob3[0]) + glob2[2] * (glob3[0] - glob[0]) + glob3[2] * (glob[0] - glob2[0]); - Double_t c = glob[0] * (glob2[1] - glob3[1]) + glob2[0] * (glob3[1] - glob[1]) + glob3[0] * (glob[1] - glob2[1]); - Double_t d = glob[0] * (glob2[1] * glob3[2] - glob3[1] * glob2[2]) + - glob2[0] * (glob3[1] * glob[2] - glob[1] * glob3[2]) + - glob3[0] * (glob[1] * glob2[2] - glob2[1] * glob[2]); + double a = glob[1] * (glob2[2] - glob3[2]) + glob2[1] * (glob3[2] - glob[2]) + glob3[1] * (glob[2] - glob2[2]); + double b = glob[2] * (glob2[0] - glob3[0]) + glob2[2] * (glob3[0] - glob[0]) + glob3[2] * (glob[0] - glob2[0]); + double c = glob[0] * (glob2[1] - glob3[1]) + glob2[0] * (glob3[1] - glob[1]) + glob3[0] * (glob[1] - glob2[1]); + double d = glob[0] * (glob2[1] * glob3[2] - glob3[1] * glob2[2]) + + glob2[0] * (glob3[1] * glob[2] - glob[1] * glob3[2]) + + glob3[0] * (glob[1] * glob2[2] - glob2[1] * glob[2]); d = -d; // shift equation of plane from tower/module center to surface along vector (A,B,C) normal to tower/module plane - Double_t dist = mLongModuleSize / 2.; - Double_t norm = TMath::Sqrt(a * a + b * b + c * c); - Double_t glob4[3] = {}; + double dist = mLongModuleSize / 2.; + double norm = std::sqrt(a * a + b * b + c * c); + double glob4[3] = {}; math_utils::Vector3D dir = {a, b, c}; math_utils::Point3D point = {glob[0], glob[1], glob[2]}; if (point.Dot(dir) < 0) { @@ -1486,13 +1497,13 @@ void Geometry::ImpactOnEmcal(const math_utils::Point3D& vtx, Double_t th // Line determination (2 points for equation of line : vtx and direction) // impact between line (particle) and plane (module/tower plane) - Double_t den = a * (vtx.X() - direction.X()) + b * (vtx.Y() - direction.Y()) + c * (vtx.Z() - direction.Z()); + double den = a * (vtx.X() - direction.X()) + b * (vtx.Y() - direction.Y()) + c * (vtx.Z() - direction.Z()); if (den == 0) { LOG(error) << "ImpactOnEmcal() No solution :\n"; return; } - Double_t length = a * vtx.X() + b * vtx.Y() + c * vtx.Z() + d; + double length = a * vtx.X() + b * vtx.Y() + c * vtx.Z() + d; length /= den; vimpact.SetXYZ(vtx.X() + length * (direction.X() - vtx.X()), vtx.Y() + length * (direction.Y() - vtx.Y()), @@ -1502,7 +1513,7 @@ void Geometry::ImpactOnEmcal(const math_utils::Point3D& vtx, Double_t th vimpact.SetXYZ(vimpact.Z() + dist * a / norm, vimpact.Y() + dist * b / norm, vimpact.Z() + dist * c / norm); } -Bool_t Geometry::IsInEMCAL(const math_utils::Point3D& pnt) const +bool Geometry::IsInEMCAL(const math_utils::Point3D& pnt) const { if (IsInEMCALOrDCAL(pnt) == EMCAL_ACCEPTANCE) { return kTRUE; @@ -1511,7 +1522,7 @@ Bool_t Geometry::IsInEMCAL(const math_utils::Point3D& pnt) const } } -Bool_t Geometry::IsInDCAL(const math_utils::Point3D& pnt) const +bool Geometry::IsInDCAL(const math_utils::Point3D& pnt) const { if (IsInEMCALOrDCAL(pnt) == DCAL_ACCEPTANCE) { return kTRUE; @@ -1522,30 +1533,30 @@ Bool_t Geometry::IsInDCAL(const math_utils::Point3D& pnt) const o2::emcal::AcceptanceType_t Geometry::IsInEMCALOrDCAL(const math_utils::Point3D& pnt) const { - Double_t r = sqrt(pnt.X() * pnt.X() + pnt.Y() * pnt.Y()); + double r = std::sqrt(pnt.X() * pnt.X() + pnt.Y() * pnt.Y()); if (r <= mEnvelop[0]) { return NON_ACCEPTANCE; } else { - Double_t theta = TMath::ATan2(r, pnt.Z()); - Double_t eta; + double theta = std::atan2(r, pnt.Z()); + double eta; if (theta == 0) { eta = 9999; } else { - eta = -TMath::Log(TMath::Tan(theta / 2.)); + eta = -std::log(std::tan(theta / 2.)); } if (eta < mArm1EtaMin || eta > mArm1EtaMax) { return NON_ACCEPTANCE; } - Double_t phi = TMath::ATan2(pnt.Y(), pnt.X()) * 180. / TMath::Pi(); + double phi = std::atan2(pnt.Y(), pnt.X()) * o2::constants::math::Rad2Deg; if (phi < 0) { phi += 360; // phi should go from 0 to 360 in this case } if (phi >= mArm1PhiMin && phi <= mEMCALPhiMax) { return EMCAL_ACCEPTANCE; - } else if (phi >= mDCALPhiMin && phi <= mDCALStandardPhiMax && TMath::Abs(eta) > mDCALInnerExtandedEta) { + } else if (phi >= mDCALPhiMin && phi <= mDCALStandardPhiMax && std::abs(eta) > mDCALInnerExtandedEta) { return DCAL_ACCEPTANCE; } else if (phi > mDCALStandardPhiMax && phi <= mDCALPhiMax) { return DCAL_ACCEPTANCE; @@ -1554,7 +1565,7 @@ o2::emcal::AcceptanceType_t Geometry::IsInEMCALOrDCAL(const math_utils::Point3D< } } -const TGeoHMatrix* Geometry::GetMatrixForSuperModule(Int_t smod) const +const TGeoHMatrix* Geometry::GetMatrixForSuperModule(int smod) const { if (smod < 0 || smod > mNumberOfSuperModules) { LOG(fatal) << "Wrong supermodule index -> " << smod; @@ -1569,15 +1580,15 @@ const TGeoHMatrix* Geometry::GetMatrixForSuperModule(Int_t smod) const << "\t - importing TGeoManager from file geometry.root or \n" << "\t - from OADB in file OADB/EMCAL/EMCALlocal2master.root or \n" << "\t - from OCDB in directory OCDB/EMCAL/Align/Data/ or \n" - << "\t - from AliESDs (not in AliAOD) via AliESDRun::GetEMCALMatrix(Int_t superModIndex). \n" - << "Store them via AliEMCALGeometry::SetMisalMatrix(Int_t superModIndex)"; + << "\t - from AliESDs (not in AliAOD) via AliESDRun::GetEMCALMatrix(int superModIndex). \n" + << "Store them via AliEMCALGeometry::SetMisalMatrix(int superModIndex)"; } } return SMODULEMATRIX[smod]; } -const TGeoHMatrix* Geometry::GetMatrixForSuperModuleFromArray(Int_t smod) const +const TGeoHMatrix* Geometry::GetMatrixForSuperModuleFromArray(int smod) const { if (smod < 0 || smod > mNumberOfSuperModules) { LOG(fatal) << "Wrong supermodule index -> " << smod; @@ -1586,15 +1597,15 @@ const TGeoHMatrix* Geometry::GetMatrixForSuperModuleFromArray(Int_t smod) const return SMODULEMATRIX[smod]; } -const TGeoHMatrix* Geometry::GetMatrixForSuperModuleFromGeoManager(Int_t smod) const +const TGeoHMatrix* Geometry::GetMatrixForSuperModuleFromGeoManager(int smod) const { - const Int_t buffersize = 255; - char path[buffersize]; - Int_t tmpType = -1; - Int_t smOrder = 0; + const int kBuffersize = 255; + char path[kBuffersize]; + int tmpType = -1; + int smOrder = 0; // Get the order for SM - for (Int_t i = 0; i < smod + 1; i++) { + for (int i = 0; i < smod + 1; i++) { if (GetSMType(i) == tmpType) { smOrder++; } else { @@ -1603,7 +1614,7 @@ const TGeoHMatrix* Geometry::GetMatrixForSuperModuleFromGeoManager(Int_t smod) c } } - Int_t smType = GetSMType(smod); + int smType = GetSMType(smod); TString smName = ""; if (smType == EMCAL_STANDARD) { @@ -1620,7 +1631,7 @@ const TGeoHMatrix* Geometry::GetMatrixForSuperModuleFromGeoManager(Int_t smod) c LOG(error) << "Unkown SM Type!!\n"; } - snprintf(path, buffersize, "/cave/barrel_1/%s_%d", smName.Data(), smOrder); + snprintf(path, kBuffersize, "/cave/barrel_1/%s_%d", smName.Data(), smOrder); if (!gGeoManager->cd(path)) { LOG(fatal) << "Geo manager can not find path " << path << "!\n"; @@ -1629,18 +1640,18 @@ const TGeoHMatrix* Geometry::GetMatrixForSuperModuleFromGeoManager(Int_t smod) c return gGeoManager->GetCurrentMatrix(); } -void Geometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, const Int_t sm, const Float_t depth, - const Float_t misaligTransShifts[15], const Float_t misaligRotShifts[15], - Float_t global[3]) const +void Geometry::RecalculateTowerPosition(float drow, float dcol, const int sm, const float depth, + const float misaligTransShifts[15], const float misaligRotShifts[15], + float global[3]) const { // To use in a print later - Float_t droworg = drow; - Float_t dcolorg = dcol; + float droworg = drow; + float dcolorg = dcol; if (gGeoManager) { // Recover some stuff - const Int_t nSMod = mNumberOfSuperModules; + const int nSMod = mNumberOfSuperModules; gGeoManager->cd("/cave/barrel_1/"); TGeoNode* geoXEn1 = gGeoManager->GetCurrentNode(); @@ -1663,24 +1674,24 @@ void Geometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, const Int_t drow = 23. - drow; } - Int_t istrip = 0; - Float_t z0 = 0; - Float_t zb = 0; - Float_t zIs = 0; + int istrip = 0; + float z0 = 0; + float zb = 0; + float zIs = 0; - Float_t x, y, z; // return variables in terry's RF + float x, y, z; // return variables in terry's RF //*********************************************************** // Do not like this: too many hardcoded values, is it not already stored somewhere else? // : need more comments in the code //*********************************************************** - Float_t dz = 6.0; // base cell width in eta - Float_t dx = 6.004; // base cell width in phi + float dz = 6.0; // base cell width in eta + float dx = 6.004; // base cell width in phi - // Float_t L = 26.04; // active tower length for hadron (lead+scint+paper) + // float L = 26.04; // active tower length for hadron (lead+scint+paper) // we use the geant numbers 13.87*2=27.74 - Float_t teta1 = 0.; + float teta1 = 0.; // Do some basic checks if (dcol >= 47.5 || dcol < -0.5) { @@ -1696,29 +1707,29 @@ void Geometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, const Int_t return; } - istrip = int((dcol + 0.5) / 2); + istrip = static_cast((dcol + 0.5) / 2); // tapering angle - teta1 = TMath::DegToRad() * istrip * 1.5; + teta1 = o2::constants::math::Deg2Rad * istrip * 1.5; // calculation of module corner along z // as a function of strip for (int is = 0; is <= istrip; is++) { - teta1 = TMath::DegToRad() * (is * 1.5 + 0.75); + teta1 = o2::constants::math::Deg2Rad * (is * 1.5 + 0.75); if (is == 0) { - zIs = zIs + 2 * dz * TMath::Cos(teta1); + zIs = zIs + 2. * dz * std::cos(teta1); } else { zIs = - zIs + 2 * dz * TMath::Cos(teta1) + 2 * dz * TMath::Sin(teta1) * TMath::Tan(teta1 - 0.75 * TMath::DegToRad()); + zIs + 2. * dz * std::cos(teta1) + 2. * dz * std::sin(teta1) * std::tan(teta1 - 0.75 * o2::constants::math::Deg2Rad); } } - z0 = dz * (dcol - 2 * istrip + 0.5); - zb = (2 * dz - z0 - depth * TMath::Tan(teta1)); + z0 = dz * (dcol - 2. * istrip + 0.5); + zb = (2. * dz - z0 - depth * std::tan(teta1)); - z = zIs - zb * TMath::Cos(teta1); - y = depth / TMath::Cos(teta1) + zb * TMath::Sin(teta1); + z = zIs - zb * std::cos(teta1); + y = depth / std::cos(teta1) + zb * std::sin(teta1); x = (drow + 0.5) * dx; @@ -1739,8 +1750,8 @@ void Geometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, const Int_t // apply global shifts if (sm == 2 || sm == 3) { // sector 1 - global[0] = dglobal[0] + misaligTransShifts[3] + misaligRotShifts[3] * TMath::Sin(TMath::DegToRad() * 20); - global[1] = dglobal[1] + misaligTransShifts[4] + misaligRotShifts[4] * TMath::Cos(TMath::DegToRad() * 20); + global[0] = dglobal[0] + misaligTransShifts[3] + misaligRotShifts[3] * std::sin(o2::constants::math::Deg2Rad * 20); + global[1] = dglobal[1] + misaligTransShifts[4] + misaligRotShifts[4] * std::cos(o2::constants::math::Deg2Rad * 20); global[2] = dglobal[2] + misaligTransShifts[5]; } else if (sm == 0 || sm == 1) { // sector 0 global[0] = dglobal[0] + misaligTransShifts[0]; @@ -1757,7 +1768,7 @@ void Geometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, const Int_t } } -void Geometry::SetMisalMatrix(const TGeoHMatrix* m, Int_t smod) const +void Geometry::SetMisalMatrix(const TGeoHMatrix* m, int smod) const { if (smod >= 0 && smod < mNumberOfSuperModules) { if (!SMODULEMATRIX[smod]) { @@ -1787,7 +1798,7 @@ void Geometry::SetMisalMatrixFromCcdb(const char* path, int timestamp) const } } -Bool_t Geometry::IsDCALSM(Int_t iSupMod) const +bool Geometry::IsDCALSM(int iSupMod) const { if (mEMCSMSystem[iSupMod] == DCAL_STANDARD || mEMCSMSystem[iSupMod] == DCAL_EXT) { return kTRUE; @@ -1796,7 +1807,7 @@ Bool_t Geometry::IsDCALSM(Int_t iSupMod) const return kFALSE; } -Bool_t Geometry::IsDCALExtSM(Int_t iSupMod) const +bool Geometry::IsDCALExtSM(int iSupMod) const { if (mEMCSMSystem[iSupMod] == DCAL_EXT) { return kTRUE; @@ -1805,29 +1816,29 @@ Bool_t Geometry::IsDCALExtSM(Int_t iSupMod) const return kFALSE; } -Double_t Geometry::GetPhiCenterOfSMSec(Int_t nsupmod) const +double Geometry::GetPhiCenterOfSMSec(int nsupmod) const { int i = nsupmod / 2; return mPhiCentersOfSMSec[i]; } -Double_t Geometry::GetPhiCenterOfSM(Int_t nsupmod) const +double Geometry::GetPhiCenterOfSM(int nsupmod) const { int i = nsupmod / 2; return mPhiCentersOfSM[i]; } -std::tuple Geometry::GetPhiBoundariesOfSM(Int_t nSupMod) const +std::tuple Geometry::GetPhiBoundariesOfSM(int nSupMod) const { int i; if (nSupMod < 0 || nSupMod > 12 + mnSupModInDCAL - 1) { throw InvalidModuleException(nSupMod, 12 + mnSupModInDCAL); } i = nSupMod / 2; - return std::make_tuple((Double_t)mPhiBoundariesOfSM[2 * i], (Double_t)mPhiBoundariesOfSM[2 * i + 1]); + return std::make_tuple(static_cast(mPhiBoundariesOfSM[2 * i]), static_cast(mPhiBoundariesOfSM[2 * i + 1])); } -std::tuple Geometry::GetPhiBoundariesOfSMGap(Int_t nPhiSec) const +std::tuple Geometry::GetPhiBoundariesOfSMGap(int nPhiSec) const { if (nPhiSec < 0 || nPhiSec > 5 + mnSupModInDCAL / 2 - 1) { throw InvalidModuleException(nPhiSec, 5 + mnSupModInDCAL / 2); diff --git a/Detectors/EMCAL/base/src/Hit.cxx b/Detectors/EMCAL/base/src/Hit.cxx index 898d86dc2e2c4..dac25ec15df67 100644 --- a/Detectors/EMCAL/base/src/Hit.cxx +++ b/Detectors/EMCAL/base/src/Hit.cxx @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file Hit.cxx +/// \brief Source file for EMCal cell hit class +/// \author Markus Fasel, markus.fasel@cern.ch + #include "EMCALBase/Hit.h" ClassImp(o2::emcal::Hit); @@ -22,7 +26,7 @@ void Hit::PrintStream(std::ostream& stream) const << ", initial (parent) energy " << mInitialEnergy; } -Bool_t Hit::operator<(const Hit& rhs) const +bool Hit::operator<(const Hit& rhs) const { if (GetTrackID() != rhs.GetTrackID()) { return GetTrackID() < rhs.GetTrackID(); @@ -30,7 +34,7 @@ Bool_t Hit::operator<(const Hit& rhs) const return GetDetectorID() < rhs.GetDetectorID(); } -Bool_t Hit::operator==(const Hit& rhs) const +bool Hit::operator==(const Hit& rhs) const { return (GetDetectorID() == rhs.GetDetectorID()) && (GetTrackID() == rhs.GetTrackID()); } diff --git a/Detectors/EMCAL/base/src/Mapper.cxx b/Detectors/EMCAL/base/src/Mapper.cxx index 529fa74cebce9..c9e79cbbd81bd 100644 --- a/Detectors/EMCAL/base/src/Mapper.cxx +++ b/Detectors/EMCAL/base/src/Mapper.cxx @@ -9,9 +9,19 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file Mapper.cxx +/// \brief ALTRO mapping for calorimeters +/// \author Markus Fasel , Oak Ridge National Laboratory +/// \class Mapper +/// \ingroup EMCALbase +/// \since Aug 19, 2019 +/// +/// Based on AliAltroMapping by C. Cheshkov and AliCaloAltroMapping by G. Balbastre + #include -#include #include +#include +#include #include #include "EMCALBase/Mapper.h" @@ -101,8 +111,8 @@ unsigned int Mapper::getHardwareAddress(uint8_t row, uint8_t col, ChannelType_t MappingHandler::MappingHandler() { const std::array SIDES = {{'A', 'C'}}; - const unsigned int NDDL = 2; - for (unsigned int iside = 0; iside < 2; iside++) { + const unsigned int NDDL = 2, NSIDES = 2; + for (unsigned int iside = 0; iside < NSIDES; iside++) { for (unsigned int iddl = 0; iddl < NDDL; iddl++) { mMappings[iside * NDDL + iddl].setMapping(Form("%s/share/Detectors/EMC/files/RCU%d%c.data", gSystem->Getenv("O2_ROOT"), iddl, SIDES[iside])); } @@ -111,7 +121,8 @@ MappingHandler::MappingHandler() Mapper& MappingHandler::getMappingForDDL(unsigned int ddl) { - if (ddl >= 40) { + const int maxDDL = 40; + if (ddl >= maxDDL) { throw MappingHandler::DDLInvalid(ddl); } const unsigned int NDDLSM = 2, NSIDES = 2; @@ -119,7 +130,7 @@ Mapper& MappingHandler::getMappingForDDL(unsigned int ddl) sideID = (ddl / NDDLSM) % NSIDES; unsigned int mappingIndex = sideID * NDDLSM + ddlInSM; if (mappingIndex < 0 || mappingIndex >= mMappings.size()) { - std::cout << "Access to invalid mapping position for ddl " << ddl << std::endl; + LOG(info) << "Access to invalid mapping position for ddl " << ddl; throw MappingHandler::DDLInvalid(ddl); } return mMappings[mappingIndex]; @@ -127,7 +138,8 @@ Mapper& MappingHandler::getMappingForDDL(unsigned int ddl) int MappingHandler::getFEEForChannelInDDL(unsigned int ddl, unsigned int channelFEC, unsigned int branch) { - if (ddl >= 40) { + const int maxDDL = 40; + if (ddl >= maxDDL) { throw MappingHandler::DDLInvalid(ddl); } int ddlInSupermodule = ddl % 2; diff --git a/Detectors/EMCAL/base/src/NonlinearityHandler.cxx b/Detectors/EMCAL/base/src/NonlinearityHandler.cxx index 026c86a08c63f..854b3d824b133 100644 --- a/Detectors/EMCAL/base/src/NonlinearityHandler.cxx +++ b/Detectors/EMCAL/base/src/NonlinearityHandler.cxx @@ -8,11 +8,32 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. + +/// \file NonlinearityHandler.cxx +/// \class NonlinearityHandler +/// \brief Nonlinearity functions for energy correction +/// \ingroup EMCALbase +/// \author Markus Fasel , Oak Ridge National Laboratory +/// \since Feb 27, 2023 +/// +/// Calculating a corrected cluster energy based on the raw cluster energy. +/// Several parameterisations are provided. The function is selected during +/// construction of the object. The corrected cluster energy is obtained via +/// the function getCorrectedClusterEnergy. +/// +/// The correction for the shaper sturation must be applied at cell energy level. +/// Only one parameterisation for the shaper nonlinearity exists, for which the +/// parameterisation does not depend on the type of the cluster nonlinearity. The +/// function evaluateShaperCorrectionCellEnergy is static and can therefore be applied +/// without a cluster nonlinearity parameterisation. +/// +/// based on nonlinearity implementation in AliEMCALRecoUtils + #include -#include #include -#include // for TMath::Pi() - to be removed once we switch to c++20 +#include #include "EMCALBase/NonlinearityHandler.h" +#include "CommonConstants/MathConstants.h" using namespace o2::emcal; @@ -182,13 +203,13 @@ double NonlinearityHandler::evaluateTestbeamCorrected(double energy) const double NonlinearityHandler::evaluatePi0MC(double energy) const { return energy * (mNonlinearityParam[0] * std::exp(-mNonlinearityParam[1] / energy)) + - ((mNonlinearityParam[2] / (mNonlinearityParam[3] * 2. * TMath::Pi()) * + ((mNonlinearityParam[2] / (mNonlinearityParam[3] * o2::constants::math::TwoPI) * std::exp(-(energy - mNonlinearityParam[4]) * (energy - mNonlinearityParam[4]) / (2. * mNonlinearityParam[3] * mNonlinearityParam[3])))); } double NonlinearityHandler::evaluatePi0MCv2(double energy) const { - return energy * mNonlinearityParam[0] / TMath::Power(energy + mNonlinearityParam[1], mNonlinearityParam[2]) + 1; + return energy * mNonlinearityParam[0] / std::pow(energy + mNonlinearityParam[1], mNonlinearityParam[2]) + 1; } double NonlinearityHandler::evaluateShaperCorrectionCellEnergy(double energy, double ecalibHG) @@ -215,7 +236,7 @@ void NonlinearityHandler::printStream(std::ostream& stream) const stream << "Nonlinearity function: " << getNonlinName(mNonlinearyFunction) << "(Parameters:"; bool first = true; - for (auto& param : mNonlinearityParam) { + for (const auto& param : mNonlinearityParam) { if (first) { first = false; } else { @@ -347,7 +368,7 @@ void NonlinearityFactory::initNonlinNames() NLType::DATA_TESTBEAM_SHAPER_WOSCALE }}; - for (auto nonlin : nonlintypes) { + for (const auto& nonlin : nonlintypes) { mNonlinNames[NonlinearityHandler::getNonlinName(nonlin)] = nonlin; } } @@ -356,4 +377,4 @@ std::ostream& o2::emcal::operator<<(std::ostream& in, const NonlinearityHandler& { handler.printStream(in); return in; -} \ No newline at end of file +} diff --git a/Detectors/EMCAL/base/src/RCUTrailer.cxx b/Detectors/EMCAL/base/src/RCUTrailer.cxx index 24aac7b5bb25a..9ac3e97162437 100644 --- a/Detectors/EMCAL/base/src/RCUTrailer.cxx +++ b/Detectors/EMCAL/base/src/RCUTrailer.cxx @@ -8,13 +8,21 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. + +/// \file RCUTrailer.cxx +/// \class RCUTrailer +/// \brief Information stored in the RCU trailer +/// \ingroup EMCALbase +/// \author Markus Fasel , Oak Ridge National Laboratory + +#include +#include #include #include -#include -#include +#include +#include #include "CommonConstants/LHCConstants.h" #include "EMCALBase/RCUTrailer.h" -#include using namespace o2::emcal; @@ -68,7 +76,7 @@ void RCUTrailer::constructFromRawPayload(const gsl::span payload } mFirmwareVersion = (word >> 16) & 0xFF; - mRCUId = (int)((word >> 7) & 0x1FF); + mRCUId = static_cast((word >> 7) & 0x1FF); int trailerSize = (word & 0x7F); if (trailerSize < 2) { @@ -86,7 +94,7 @@ void RCUTrailer::constructFromRawPayload(const gsl::span payload foundTrailerWords++; int parCode = (word >> 26) & 0xF; int parData = word & 0x3FFFFFF; - // std::cout << "Found trailer word 0x" << std::hex << word << "(Par code: " << std::dec << parCode << ", Par data: 0x" << std::hex << parData << std::dec << ")" << std::endl; + // LOG(info) << "Found trailer word 0x" << std::hex << word << "(Par code: " << std::dec << parCode << ", Par data: 0x" << std::hex << parData << std::dec << ")" << std::endl; switch (parCode) { case 1: // ERR_REG1 @@ -152,7 +160,7 @@ double RCUTrailer::getTimeSampleNS() const tSample = 8.; break; default: - throw Error(Error::ErrorType_t::SAMPLINGFREQ_INVALID, fmt::format("Invalid sampling frequency value {:d} !", int(fq)).data()); + throw Error(Error::ErrorType_t::SAMPLINGFREQ_INVALID, fmt::format("Invalid sampling frequency value {:d} !", static_cast(fq)).data()); } return tSample * o2::constants::lhc::LHCBunchSpacingNS; @@ -173,7 +181,7 @@ void RCUTrailer::setTimeSamplePhaseNS(uint64_t triggertime, uint64_t timesample) break; default: throw Error(Error::ErrorType_t::SAMPLINGFREQ_INVALID, fmt::format(fmt::runtime("invalid time sample: {:f}"), timesample).data()); - }; + } mAltroConfig.mSampleTime = sample; // calculate L1 phase mAltroConfig.mL1Phase = (triggertime % timesample) / 25; diff --git a/Detectors/EMCAL/base/src/ShishKebabTrd1Module.cxx b/Detectors/EMCAL/base/src/ShishKebabTrd1Module.cxx index 1e5f077748894..8f54e39c8cdf8 100644 --- a/Detectors/EMCAL/base/src/ShishKebabTrd1Module.cxx +++ b/Detectors/EMCAL/base/src/ShishKebabTrd1Module.cxx @@ -9,23 +9,33 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file ShishKebabTrd1Module.cxx +/// \class ShishKebabTrd1Module +/// \brief Main class for TRD1 geometry of Shish-Kebab case. +/// \ingroup EMCALbase +/// \author Alexei Pavlinov (WSU). + #include +#include +#include #include "RStringView.h" #include "EMCALBase/Geometry.h" #include "EMCALBase/ShishKebabTrd1Module.h" +#include "CommonConstants/MathConstants.h" using namespace o2::emcal; +using namespace o2::constants::math; -Double_t ShishKebabTrd1Module::sa = 0.; -Double_t ShishKebabTrd1Module::sa2 = 0.; -Double_t ShishKebabTrd1Module::sb = 0.; -Double_t ShishKebabTrd1Module::sr = 0.; -Double_t ShishKebabTrd1Module::sangle = 0.; // around one degree -Double_t ShishKebabTrd1Module::stanBetta = 0; // +double ShishKebabTrd1Module::sa = 0.; +double ShishKebabTrd1Module::sa2 = 0.; +double ShishKebabTrd1Module::sb = 0.; +double ShishKebabTrd1Module::sr = 0.; +double ShishKebabTrd1Module::sangle = 0.; // around one degree +double ShishKebabTrd1Module::stanBetta = 0; // -ShishKebabTrd1Module::ShishKebabTrd1Module(Double_t theta, Geometry* g) +ShishKebabTrd1Module::ShishKebabTrd1Module(double theta, Geometry* g) : mGeometry(g), mOK(), mTheta(theta), @@ -39,7 +49,7 @@ ShishKebabTrd1Module::ShishKebabTrd1Module(Double_t theta, Geometry* g) mORT() { std::string_view sname = g->GetName(); - Int_t key = 0; + int key = 0; if (sname.find("v1") != std::string::npos || sname.find("V1") != std::string::npos) { key = 1; // EMCAL_COMPLETEV1 vs EMCAL_COMPLETEv1 (or other) } @@ -88,35 +98,35 @@ ShishKebabTrd1Module::ShishKebabTrd1Module(const ShishKebabTrd1Module& mod) mORB(mod.mORB), mORT(mod.mORT) { - for (Int_t i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { mOK3X3[i] = mod.mOK3X3[i]; } } -void ShishKebabTrd1Module::Init(Double_t A, Double_t B) +void ShishKebabTrd1Module::Init(double A, double B) { // Define parameter module from parameters A,B from previous. - Double_t yl = (sb / 2) * TMath::Sin(mTheta) + (sa / 2) * TMath::Cos(mTheta) + sr, y = yl; - Double_t xl = (yl - B) / A; // y=A*x+B + double yl = (sb / 2) * std::sin(mTheta) + (sa / 2) * std::cos(mTheta) + sr, y = yl; + double xl = (yl - B) / A; // y=A*x+B - // Double_t xp1 = (fga/2. + fgb/2.*fgtanBetta)/(TMath::Sin(fTheta) + fgtanBetta*TMath::Cos(fTheta)); + // double xp1 = (fga/2. + fgb/2.*fgtanBetta)/(std::sin(fTheta) + fgtanBetta*std::cos(fTheta)); // printf(" xp1 %9.3f \n ", xp1); // xp1 == xp => both methods give the same results - 3-feb-05 - Double_t alpha = TMath::Pi() / 2. + sangle / 2; - Double_t xt = - (sa + sa2) * TMath::Tan(mTheta) * TMath::Tan(alpha) / (4. * (1. - TMath::Tan(mTheta) * TMath::Tan(alpha))); - Double_t yt = xt / TMath::Tan(mTheta), xp = TMath::Sqrt(xt * xt + yt * yt); - Double_t x = xl + xp; + double alpha = PIHalf + sangle / 2; + double xt = + (sa + sa2) * std::tan(mTheta) * std::tan(alpha) / (4. * (1. - std::tan(mTheta) * std::tan(alpha))); + double yt = xt / std::tan(mTheta), xp = std::sqrt(xt * xt + yt * yt); + double x = xl + xp; mOK.Set(x, y); // printf(" yl %9.3f | xl %9.3f | xp %9.3f \n", yl, xl, xp); // have to define A and B; - Double_t yCprev = sr + sa * TMath::Cos(mTheta); - Double_t xCprev = (yCprev - B) / A; - Double_t xA = xCprev + sa * TMath::Sin(mTheta), yA = sr; + double yCprev = sr + sa * std::cos(mTheta); + double xCprev = (yCprev - B) / A; + double xA = xCprev + sa * std::sin(mTheta), yA = sr; mThetaA = mTheta - sangle / 2.; - mA = TMath::Tan(mThetaA); // !! + mA = std::tan(mThetaA); // !! mB = yA - mA * xA; DefineAllStuff(); @@ -127,14 +137,14 @@ void ShishKebabTrd1Module::DefineAllStuff() // Define some parameters // DefineName(mTheta); // Centers of cells - 2X2 case - Double_t kk1 = (sa + sa2) / (2. * 4.); // kk1=kk2 + double kk1 = (sa + sa2) / (2. * 4.); // kk1=kk2 - Double_t xk1 = mOK.X() - kk1 * TMath::Sin(mTheta); - Double_t yk1 = mOK.Y() + kk1 * TMath::Cos(mTheta) - sr; + double xk1 = mOK.X() - kk1 * std::sin(mTheta); + double yk1 = mOK.Y() + kk1 * std::cos(mTheta) - sr; mOK1.Set(xk1, yk1); - Double_t xk2 = mOK.X() + kk1 * TMath::Sin(mTheta); - Double_t yk2 = mOK.Y() - kk1 * TMath::Cos(mTheta) - sr; + double xk2 = mOK.X() + kk1 * std::sin(mTheta); + double yk2 = mOK.Y() - kk1 * std::cos(mTheta) - sr; mOK2.Set(xk2, yk2); // Centers of cells - 3X3 case; Nov 9,2006 @@ -142,60 +152,60 @@ void ShishKebabTrd1Module::DefineAllStuff() kk1 = ((sa + sa2) / 4. + sa / 6.) / 2.; - xk1 = mOK.X() - kk1 * TMath::Sin(mTheta); - yk1 = mOK.Y() + kk1 * TMath::Cos(mTheta) - sr; + xk1 = mOK.X() - kk1 * std::sin(mTheta); + yk1 = mOK.Y() + kk1 * std::cos(mTheta) - sr; mOK3X3[0].Set(xk1, yk1); - xk2 = mOK.X() + kk1 * TMath::Sin(mTheta); - yk2 = mOK.Y() - kk1 * TMath::Cos(mTheta) - sr; + xk2 = mOK.X() + kk1 * std::sin(mTheta); + yk2 = mOK.Y() - kk1 * std::cos(mTheta) - sr; mOK3X3[2].Set(xk2, yk2); // May 15, 2006; position of module(cells) center face - mOB.Set(mOK.X() - sb / 2. * TMath::Cos(mTheta), mOK.Y() - sb / 2. * TMath::Sin(mTheta) - sr); - mOB1.Set(mOB.X() - sa / 4. * TMath::Sin(mTheta), mOB.Y() + sa / 4. * TMath::Cos(mTheta)); - mOB2.Set(mOB.X() + sa / 4. * TMath::Sin(mTheta), mOB.Y() - sa / 4. * TMath::Cos(mTheta)); + mOB.Set(mOK.X() - sb / 2. * std::cos(mTheta), mOK.Y() - sb / 2. * std::sin(mTheta) - sr); + mOB1.Set(mOB.X() - sa / 4. * std::sin(mTheta), mOB.Y() + sa / 4. * std::cos(mTheta)); + mOB2.Set(mOB.X() + sa / 4. * std::sin(mTheta), mOB.Y() - sa / 4. * std::cos(mTheta)); // Jul 30, 2007 - for taking into account a position of shower maximum mThetaOB1 = mTheta - sangle / 4.; // ?? mThetaOB2 = mTheta + sangle / 4.; // Position of right/top point of module // Gives the posibility to estimate SM size in z direction - Double_t xBottom = (sr - mB) / mA; - Double_t yBottom = sr; + double xBottom = (sr - mB) / mA; + double yBottom = sr; mORB.Set(xBottom, yBottom); - Double_t l = sb / TMath::Cos(sangle / 2.); // length of lateral module side - Double_t xTop = xBottom + l * TMath::Cos(TMath::ATan(mA)); - Double_t yTop = mA * xTop + mB; + double l = sb / std::cos(sangle / 2.); // length of lateral module side + double xTop = xBottom + l * std::cos(std::atan(mA)); + double yTop = mA * xTop + mB; mORT.Set(xTop, yTop); } -void ShishKebabTrd1Module::DefineFirstModule(const Int_t key) +void ShishKebabTrd1Module::DefineFirstModule(const int key) { // Define first module if (key == 0) { // theta in radians ; first object theta=pi/2. - mTheta = TMath::PiOver2(); + mTheta = PIHalf; mOK.Set(sa2 / 2., sr + sb / 2.); // position the center of module vs o // parameters of right line : y = A*z + B in system where zero point is IP. mThetaA = mTheta - sangle / 2.; - mA = TMath::Tan(mThetaA); - Double_t xA = sa / 2. + sa2 / 2.; - Double_t yA = sr; + mA = std::tan(mThetaA); + double xA = sa / 2. + sa2 / 2.; + double yA = sr; mB = yA - mA * xA; } else if (key == 1) { // theta in radians ; first object theta = 90-0.75 = 89.25 degree - mTheta = 89.25 * TMath::DegToRad(); - Double_t al1 = sangle / 2.; - Double_t x = 0.5 * (sa * TMath::Cos(al1) + sb * TMath::Sin(al1)); - Double_t y = 0.5 * (sb + sa * TMath::Sin(al1)) * TMath::Cos(al1); + mTheta = 89.25 * Deg2Rad; + double al1 = sangle / 2.; + double x = 0.5 * (sa * std::cos(al1) + sb * std::sin(al1)); + double y = 0.5 * (sb + sa * std::sin(al1)) * std::cos(al1); mOK.Set(x, sr + y); // parameters of right line : y = A*z + B in system where zero point is IP. mThetaA = mTheta - sangle / 2.; - mA = TMath::Tan(mThetaA); - Double_t xA = sa * TMath::Cos(al1); - Double_t yA = sr; + mA = std::tan(mThetaA); + double xA = sa * std::cos(al1); + double yA = sr; mB = yA - mA * xA; } else { LOG(error) << "key=" << key << " : wrong case \n"; @@ -205,7 +215,7 @@ void ShishKebabTrd1Module::DefineFirstModule(const Int_t key) DefineAllStuff(); } -Bool_t ShishKebabTrd1Module::SetParameters() +bool ShishKebabTrd1Module::SetParameters() { if (!mGeometry) { LOG(warning) << "GetParameters(): << No geometry\n"; @@ -215,15 +225,15 @@ Bool_t ShishKebabTrd1Module::SetParameters() TString sn(mGeometry->GetName()); // 2-Feb-05 sn.ToUpper(); - sa = (Double_t)mGeometry->GetEtaModuleSize(); - sb = (Double_t)mGeometry->GetLongModuleSize(); - sangle = Double_t(mGeometry->GetTrd1Angle()) * TMath::DegToRad(); - stanBetta = TMath::Tan(sangle / 2.); - sr = (Double_t)mGeometry->GetIPDistance(); + sa = static_cast(mGeometry->GetEtaModuleSize()); + sb = static_cast(mGeometry->GetLongModuleSize()); + sangle = static_cast(mGeometry->GetTrd1Angle()) * Deg2Rad; + stanBetta = std::tan(sangle / 2.); + sr = static_cast(mGeometry->GetIPDistance()); sr += mGeometry->GetSteelFrontThickness(); - sa2 = Double_t(mGeometry->Get2Trd1Dx2()); + sa2 = static_cast(mGeometry->Get2Trd1Dx2()); // PH PrintShish(0); return kTRUE; } @@ -236,26 +246,26 @@ void ShishKebabTrd1Module::PrintShish(int pri) const { if (pri >= 0) { if (pri >= 1) { - printf("PrintShish() \n a %7.3f:%7.3f | b %7.2f | r %7.2f \n TRD1 angle %7.6f(%5.2f) | tanBetta %7.6f", sa, sa2, - sb, sr, sangle, sangle * TMath::RadToDeg(), stanBetta); - printf(" fTheta %f : %5.2f : cos(theta) %f\n", mTheta, GetThetaInDegree(), TMath::Cos(mTheta)); - printf(" OK : theta %f : phi = %f(%5.2f) \n", mTheta, mOK.Phi(), mOK.Phi() * TMath::RadToDeg()); + LOGF(info, "PrintShish() \n a %7.3f:%7.3f | b %7.2f | r %7.2f \n TRD1 angle %7.6f(%5.2f) | tanBetta %7.6f", sa, sa2, + sb, sr, sangle, sangle * Rad2Deg, stanBetta); + LOGF(info, " fTheta %f : %5.2f : cos(theta) %f", mTheta, GetThetaInDegree(), std::cos(mTheta)); + LOGF(info, " OK : theta %f : phi = %f(%5.2f)", mTheta, mOK.Phi(), mOK.Phi() * Rad2Deg); } - printf(" y %9.3f x %9.3f xrb %9.3f (right bottom on r=%9.3f ) \n", mOK.X(), mOK.Y(), mORB.X(), mORB.Y()); + LOGF(info, " y %9.3f x %9.3f xrb %9.3f (right bottom on r=%9.3f )", mOK.X(), mOK.Y(), mORB.X(), mORB.Y()); if (pri >= 2) { - printf(" A %f B %f | fThetaA %7.6f(%5.2f)\n", mA, mB, mThetaA, mThetaA * TMath::RadToDeg()); - printf(" fOK : X %9.4f: Y %9.4f : eta %5.3f\n", mOK.X(), mOK.Y(), GetEtaOfCenterOfModule()); - printf(" fOK1 : X %9.4f: Y %9.4f : (local, ieta=2)\n", mOK1.X(), mOK1.Y()); - printf(" fOK2 : X %9.4f: Y %9.4f : (local, ieta=1)\n\n", mOK2.X(), mOK2.Y()); - printf(" fOB : X %9.4f: Y %9.4f \n", mOB.X(), mOB.Y()); - printf(" fOB1 : X %9.4f: Y %9.4f (local, ieta=2)\n", mOB1.X(), mOB1.Y()); - printf(" fOB2 : X %9.4f: Y %9.4f (local, ieta=1)\n", mOB2.X(), mOB2.Y()); + LOGF(info, " A %f B %f | fThetaA %7.6f(%5.2f)", mA, mB, mThetaA, mThetaA * Rad2Deg); + LOGF(info, " fOK : X %9.4f: Y %9.4f : eta %5.3f", mOK.X(), mOK.Y(), GetEtaOfCenterOfModule()); + LOGF(info, " fOK1 : X %9.4f: Y %9.4f : (local, ieta=2)", mOK1.X(), mOK1.Y()); + LOGF(info, " fOK2 : X %9.4f: Y %9.4f : (local, ieta=1)\n", mOK2.X(), mOK2.Y()); + LOGF(info, " fOB : X %9.4f: Y %9.4f", mOB.X(), mOB.Y()); + LOGF(info, " fOB1 : X %9.4f: Y %9.4f (local, ieta=2)", mOB1.X(), mOB1.Y()); + LOGF(info, " fOB2 : X %9.4f: Y %9.4f (local, ieta=1)", mOB2.X(), mOB2.Y()); // 3X3 - printf(" 3X3 \n"); + LOGF(info, " 3X3"); for (int ieta = 0; ieta < 3; ieta++) { - printf(" fOK3X3[%i] : X %9.4f: Y %9.4f (local) \n", ieta, mOK3X3[ieta].X(), mOK3X3[ieta].Y()); + LOGF(info, " fOK3X3[%i] : X %9.4f: Y %9.4f (local)", ieta, mOK3X3[ieta].X(), mOK3X3[ieta].Y()); } // fOK.Dump(); GetMaxEtaOfModule(); @@ -263,14 +273,14 @@ void ShishKebabTrd1Module::PrintShish(int pri) const } } -Double_t ShishKebabTrd1Module::GetThetaInDegree() const { return mTheta * TMath::RadToDeg(); } +double ShishKebabTrd1Module::GetThetaInDegree() const { return mTheta * Rad2Deg; } -Double_t ShishKebabTrd1Module::GetEtaOfCenterOfModule() const { return -TMath::Log(TMath::Tan(mOK.Phi() / 2.)); } +double ShishKebabTrd1Module::GetEtaOfCenterOfModule() const { return -std::log(std::tan(mOK.Phi() / 2.)); } -void ShishKebabTrd1Module::GetPositionAtCenterCellLine(Int_t ieta, Double_t dist, TVector2& v) const +void ShishKebabTrd1Module::GetPositionAtCenterCellLine(int ieta, double dist, TVector2& v) const { // Jul 30, 2007 - Double_t theta = 0., x = 0., y = 0.; + double theta = 0., x = 0., y = 0.; if (ieta == 0) { v = mOB2; theta = mTheta; @@ -281,30 +291,30 @@ void ShishKebabTrd1Module::GetPositionAtCenterCellLine(Int_t ieta, Double_t dist assert(0); } - x = v.X() + TMath::Cos(theta) * dist; - y = v.Y() + TMath::Sin(theta) * dist; + x = v.X() + std::cos(theta) * dist; + y = v.Y() + std::sin(theta) * dist; // printf(" GetPositionAtCenterCellLine() %s : dist %f : ieta %i : x %f %f v.X() | y %f %f v.Y() : cos %f sin %f \n", - // GetName(), dist, ieta, v.X(),x, y,v.Y(),TMath::Cos(theta),TMath::Sin(theta)); + // GetName(), dist, ieta, v.X(),x, y,v.Y(),std::cos(theta),std::sin(theta)); v.Set(x, y); } -Double_t ShishKebabTrd1Module::GetMaxEtaOfModule() const +double ShishKebabTrd1Module::GetMaxEtaOfModule() const { // Right bottom point of module - Double_t thetaBottom = TMath::ATan2(mORB.Y(), mORB.X()); - Double_t etaBottom = ThetaToEta(thetaBottom); + double thetaBottom = std::atan2(mORB.Y(), mORB.X()); + double etaBottom = ThetaToEta(thetaBottom); // Right top point of module - Double_t thetaTop = TMath::ATan2(mORT.Y(), mORT.X()); - Double_t etaTop = ThetaToEta(thetaTop); + double thetaTop = std::atan2(mORT.Y(), mORT.X()); + double etaTop = ThetaToEta(thetaTop); LOG(debug) << " Right bottom point of module : eta " << std::setw(5) << std::setprecision(4) << etaBottom << " : theta " << std::setw(6) << std::setprecision(4) << thetaBottom << " (" << std::setw(6) - << std::setprecision(2) << thetaBottom * TMath::RadToDeg() << " ) : x(zglob) " << std::setw(7) + << std::setprecision(2) << thetaBottom * Rad2Deg << " ) : x(zglob) " << std::setw(7) << std::setprecision(2) << mORB.X() << " y(phi) " << std::setw(5) << std::setprecision(2) << mORB.Y(); LOG(debug) << " Right top point of module : eta " << std::setw(5) << std::setprecision(4) << etaTop << ": theta " << std::setw(6) << std::setprecision(4) << thetaTop << " (" << std::setw(6) << std::setprecision(2) - << thetaTop * TMath::RadToDeg() << ") : x(zglob) " << std::setw(7) << std::setprecision(2) << mORT.X() + << thetaTop * Rad2Deg << ") : x(zglob) " << std::setw(7) << std::setprecision(2) << mORT.X() << " y(phi) " << std::setw(5) << std::setprecision(2) << mORT.Y(); return etaBottom > etaTop ? etaBottom : etaTop; } diff --git a/Detectors/EMCAL/base/src/TriggerMappingV2.cxx b/Detectors/EMCAL/base/src/TriggerMappingV2.cxx index e60d7b31e5305..d4622c4369e27 100644 --- a/Detectors/EMCAL/base/src/TriggerMappingV2.cxx +++ b/Detectors/EMCAL/base/src/TriggerMappingV2.cxx @@ -9,6 +9,16 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file TriggerMappingV2.cxx +/// \class TriggerMappingV2 +/// \brief Trigger mapping starting from Run2 +/// \ingroup EMCALbase +/// \author H. YOKOYAMA Tsukuba University +/// \author R. GUERNANE LPSC Grenoble CNRS/IN2P3 +/// \author Markus Fasel , Oak Ridge National Laboratory + +#include + #include "EMCALBase/Geometry.h" #include "EMCALBase/TriggerMappingV2.h" #include "EMCALBase/TriggerMappingErrors.h" @@ -106,10 +116,10 @@ void TriggerMappingV2::init_TRU_offset() mTRUFastOROffsetX[currentTRU + 1] = 0; mTRUFastOROffsetY[currentTRU + 1] = mTRUFastOROffsetY[currentTRU] + nModule_inTRU_phi; break; - }; + } currentTRU++; } // TRU loop - } // SM loop + } // SM loop } /// Initialize mapping offsets of SM (add more description) @@ -215,8 +225,8 @@ TriggerMappingV2::IndexFastOR TriggerMappingV2::getAbsFastORIndexFromPositionInS throw FastORPositionExceptionSupermodule(supermoduleID, etaColumn, phiRow); } - // Int_t iEtatmp = (GetSMIsCside(iSM) && GetSMType(iSM) == kDCAL_Standard)?(iEta + 8):iEta ; - // Int_t x = fSMFastOROffsetX[iSM] + iEtatmp ; + // int iEtatmp = (GetSMIsCside(iSM) && GetSMType(iSM) == kDCAL_Standard)?(iEta + 8):iEta ; + // int x = fSMFastOROffsetX[iSM] + iEtatmp ; IndexColumnEta x = mSMFastOROffsetX[supermoduleID] + etaColumn; IndexRowPhi y = mSMFastOROffsetY[supermoduleID] + phiRow; @@ -344,7 +354,7 @@ TriggerMappingV2::IndexTRU TriggerMappingV2::convertTRUIndexSTUtoTRU(IndexTRU tr if (detector == DetType_t::DET_EMCAL) { return truIndexSTU; } else { - return 32 + ((int)(truIndexSTU / 4) * 6) + ((truIndexSTU % 4 < 2) ? (truIndexSTU % 4) : (truIndexSTU % 4 + 2)); + return 32 + (static_cast(truIndexSTU / 4) * 6) + ((truIndexSTU % 4 < 2) ? (truIndexSTU % 4) : (truIndexSTU % 4 + 2)); } } @@ -388,7 +398,7 @@ TriggerMappingV2::IndexTRU TriggerMappingV2::getTRUIndexFromOnlineHardareAddree( // Standard EMCal/DCal SMs - unsigned short branch = (hardwareAddress >> 11) & 0x1; // 0/1 + uint16_t branch = (hardwareAddress >> 11) & 0x1; // 0/1 IndexTRU truIndex = (((ddlID % 2) << 1) | branch) - 1; // 0..2 @@ -427,7 +437,7 @@ std::array TriggerMappingV2::getFastORIndexFromL0Index(IndexTRU break; case 4: // Standard L0 patch for (int index = 0; index < 4; index++) { - IndexFastOR fastorInTRU = mNFastORInTRUPhi[truIndex] * int(l0index / (mNFastORInTRUPhi[truIndex] - 1)) + (l0index % (mNFastORInTRUPhi[truIndex] - 1)) + motif[index]; + IndexFastOR fastorInTRU = mNFastORInTRUPhi[truIndex] * static_cast(l0index / (mNFastORInTRUPhi[truIndex] - 1)) + (l0index % (mNFastORInTRUPhi[truIndex] - 1)) + motif[index]; fastorIndex[index] = getAbsFastORIndexFromIndexInTRU(truIndex, fastorInTRU); } break; @@ -460,9 +470,9 @@ TriggerMappingV2::FastORInformation TriggerMappingV2::getInfoFromAbsFastORIndex( IndexColumnEta etaColumnGlobal = fastOrAbsID % FASTORSETA; IndexRowPhi rowPhiGlobal = fastOrAbsID / FASTORSETA; - Int_t idtmp = (rowPhiGlobal < mNModuleInEMCALPhi[2]) ? fastOrAbsID : (fastOrAbsID + FASTORSTRU * 4); + int idtmp = (rowPhiGlobal < mNModuleInEMCALPhi[2]) ? fastOrAbsID : (fastOrAbsID + FASTORSTRU * 4); - IndexSupermodule supermoduleID = 2 * (int)(idtmp / (2 * FASTORSETASM * FASTORSPHISM)) + (int)(mTRUIsCside[truIndex]); + IndexSupermodule supermoduleID = 2 * static_cast(idtmp / (2 * FASTORSETASM * FASTORSPHISM)) + static_cast(mTRUIsCside[truIndex]); if (supermoduleID >= SUPERMODULES) { throw SupermoduleIndexException(supermoduleID, SUPERMODULES); } @@ -481,9 +491,9 @@ TriggerMappingV2::FastORInformation TriggerMappingV2::getInfoFromAbsFastORIndex( TriggerMappingV2::IndexFastOR TriggerMappingV2::rotateAbsFastOrIndexEtaToPhi(IndexFastOR fastorIndexInEta) const { - Int_t det_phi = int(fastorIndexInEta / FASTORSETA); - Int_t nModule_inSM_phi = FASTORSPHISM; // number of modules in current supermodule - Int_t fastOrIndexInPhi = 0; + int det_phi = static_cast(fastorIndexInEta / FASTORSETA); + int nModule_inSM_phi = FASTORSPHISM; // number of modules in current supermodule + int fastOrIndexInPhi = 0; // Calculate FastOR offset relative to previous SM type for (int i = 1; i < 5; i++) { if (det_phi < mNModuleInEMCALPhi[i]) { @@ -496,23 +506,23 @@ TriggerMappingV2::IndexFastOR TriggerMappingV2::rotateAbsFastOrIndexEtaToPhi(Ind } // fastOrIndexInPhi := Number of FastORs of the previous range with same SM type - Int_t fastorInSMType = fastorIndexInEta - fastOrIndexInPhi; - Int_t sectorInSMType = (int)(fastorInSMType / (FASTORSETA * nModule_inSM_phi)); - Int_t fastOrInSector = (int)(fastorInSMType % (FASTORSETA * nModule_inSM_phi)); + int fastorInSMType = fastorIndexInEta - fastOrIndexInPhi; + int sectorInSMType = static_cast(fastorInSMType / (FASTORSETA * nModule_inSM_phi)); + int fastOrInSector = static_cast(fastorInSMType % (FASTORSETA * nModule_inSM_phi)); fastOrIndexInPhi += sectorInSMType * (FASTORSETA * nModule_inSM_phi); // Add back number of FastORs in previous tracking sectors of the same type // rotate arrangement from eta to phi - fastOrIndexInPhi += (int)(fastOrInSector % FASTORSETA) * nModule_inSM_phi; // Add full colums in sector - fastOrIndexInPhi += (int)(fastOrInSector / FASTORSETA); // Add FastORs in the last column + fastOrIndexInPhi += static_cast(fastOrInSector % FASTORSETA) * nModule_inSM_phi; // Add full colums in sector + fastOrIndexInPhi += static_cast(fastOrInSector / FASTORSETA); // Add FastORs in the last column return fastOrIndexInPhi; } TriggerMappingV2::IndexFastOR TriggerMappingV2::rotateAbsFastOrIndexPhiToEta(IndexFastOR fastOrIndexInPhi) const { - Int_t det_phi = int(fastOrIndexInPhi / FASTORSETA); - Int_t fastorIndexInEta = 0; - Int_t nModule_inSM_phi = FASTORSPHISM; + int det_phi = static_cast(fastOrIndexInPhi / FASTORSETA); + int fastorIndexInEta = 0; + int nModule_inSM_phi = FASTORSPHISM; // Calculate FastOR offset relative to previous SM type for (int i = 1; i < 5; i++) { if (det_phi < mNModuleInEMCALPhi[i]) { @@ -525,12 +535,12 @@ TriggerMappingV2::IndexFastOR TriggerMappingV2::rotateAbsFastOrIndexPhiToEta(Ind } // fastorIndexInEta := Number of FastORs of the previous range with same SM type - Int_t fastorInSMType = fastOrIndexInPhi - fastorIndexInEta; - Int_t sectorInSMType = (int)(fastorInSMType / (FASTORSETA * nModule_inSM_phi)); - Int_t fastOrInSector = (int)(fastorInSMType % (FASTORSETA * nModule_inSM_phi)); + int fastorInSMType = fastOrIndexInPhi - fastorIndexInEta; + int sectorInSMType = static_cast(fastorInSMType / (FASTORSETA * nModule_inSM_phi)); + int fastOrInSector = static_cast(fastorInSMType % (FASTORSETA * nModule_inSM_phi)); - Int_t columnInSector = fastOrInSector / nModule_inSM_phi; - Int_t rowInSector = fastOrInSector % nModule_inSM_phi; + int columnInSector = fastOrInSector / nModule_inSM_phi; + int rowInSector = fastOrInSector % nModule_inSM_phi; fastorIndexInEta += sectorInSMType * (FASTORSETA * nModule_inSM_phi); // Add back number of FastORs in previous tracking sectors of the same type // rotate arrangement from phi to eta @@ -596,4 +606,4 @@ std::tuple + #include -#include "EMCALBase/Geometry.h" + #include #include +#include + +#include + +#include "EMCALBase/Geometry.h" std::tuple GetRefCellIndex(int CellId); @@ -63,4 +68,4 @@ std::tuple GetRefCellIndex(int CellId) } return std::make_tuple(smod, mod, iphi, ieta); -} \ No newline at end of file +} diff --git a/Detectors/EMCAL/base/test/testGeometryRowColIndexing.C b/Detectors/EMCAL/base/test/testGeometryRowColIndexing.C index a05dd89eef923..14fbe0e31e37f 100644 --- a/Detectors/EMCAL/base/test/testGeometryRowColIndexing.C +++ b/Detectors/EMCAL/base/test/testGeometryRowColIndexing.C @@ -34,4 +34,4 @@ void testGeometryRowColIndexing() hsmod->Draw(); plot->cd(); plot->Update(); -} \ No newline at end of file +} diff --git a/Detectors/EMCAL/base/test/testMapper.cxx b/Detectors/EMCAL/base/test/testMapper.cxx index 39e8e1094ccc2..1f4ef7cd64095 100644 --- a/Detectors/EMCAL/base/test/testMapper.cxx +++ b/Detectors/EMCAL/base/test/testMapper.cxx @@ -11,16 +11,21 @@ #define BOOST_TEST_MODULE Test EMCAL Base #define BOOST_TEST_MAIN #define BOOST_TEST_DYN_LINK -#include + #include -#include -#include "EMCALBase/Mapper.h" +#include // C system header ???? + #include #include #include #include +#include + #include "RStringView.h" +#include // other header +#include "EMCALBase/Mapper.h" + struct refchannel { int mAddress; int mRow; @@ -114,4 +119,4 @@ std::vector loadReferenceMapping(const std::string_view mappingfile) } return mapping; -} \ No newline at end of file +} diff --git a/Detectors/EMCAL/base/test/testRCUTrailer.cxx b/Detectors/EMCAL/base/test/testRCUTrailer.cxx index 4cbf5ec8d327a..bec3b3a58b5b8 100644 --- a/Detectors/EMCAL/base/test/testRCUTrailer.cxx +++ b/Detectors/EMCAL/base/test/testRCUTrailer.cxx @@ -12,6 +12,7 @@ #define BOOST_TEST_MAIN #define BOOST_TEST_DYN_LINK #include +#include #include #include "EMCALBase/RCUTrailer.h" @@ -127,4 +128,4 @@ BOOST_AUTO_TEST_CASE(RCUTrailer_test) BOOST_CHECK_EQUAL(trailer_decoded_error.getNumberOfChannelAddressMismatch(), error); } trailer.setNumberOfChannelAddressMismatch(0); -} \ No newline at end of file +}