1212#ifndef ALICEO2_EMCAL_ANALYSISCLUSTER_H_
1313#define ALICEO2_EMCAL_ANALYSISCLUSTER_H_
1414
15+ #include " MathUtils/Cartesian.h" // IWYU pragma: keep
16+
17+ #include < Rtypes.h>
18+ #include < TLorentzVector.h>
19+
1520#include < fairlogger/Logger.h>
1621#include < gsl/span>
17- #include < array>
18- #include " Rtypes.h"
19- #include " MathUtils/Cartesian.h"
20- #include " TLorentzVector.h"
2122
22- namespace o2
23- {
23+ #include < array>
2424
25- namespace emcal
25+ namespace o2 :: emcal
2626{
2727
2828// / \class AnalysisCluster
@@ -45,8 +45,7 @@ class AnalysisCluster
4545 public:
4646 // / \brief Constructor, setting cell wrong cell index raising the exception
4747 // / \param cellIndex Cell index raising the exception
48- CellOutOfRangeException (Int_t cellIndex) : std::exception(),
49- mCellIndex (cellIndex),
48+ CellOutOfRangeException (Int_t cellIndex) : mCellIndex (cellIndex),
5049 mMessage (" Cell index " + std::to_string(mCellIndex ) + " out of range.")
5150 {
5251 }
@@ -56,11 +55,11 @@ class AnalysisCluster
5655
5756 // / \brief Access to cell ID raising the exception
5857 // / \return Cell ID
59- Int_t getCellIndex () const noexcept { return mCellIndex ; }
58+ [[nodiscard]] Int_t getCellIndex () const noexcept { return mCellIndex ; }
6059
6160 // / \brief Access to error message of the exception
6261 // / \return Error message
63- const char * what () const noexcept final { return mMessage .data (); }
62+ [[nodiscard]] const char * what () const noexcept final { return mMessage .data (); }
6463
6564 private:
6665 Int_t mCellIndex ; // /< Cell index raising the exception
@@ -76,55 +75,55 @@ class AnalysisCluster
7675 // Common EMCAL/PHOS/FMD/PMD
7776
7877 void setID (int id) { mID = id; }
79- int getID () const { return mID ; }
78+ [[nodiscard]] int getID () const { return mID ; }
8079
8180 void setE (float ene) { mEnergy = ene; }
82- float E () const { return mEnergy ; }
81+ [[nodiscard]] float E () const { return mEnergy ; }
8382
8483 void setChi2 (float chi2) { mChi2 = chi2; }
85- float Chi2 () const { return mChi2 ; }
84+ [[nodiscard]] float Chi2 () const { return mChi2 ; }
8685
8786 // /
8887 // / Set the cluster global position.
89- void setGlobalPosition (math_utils::Point3D<float > x);
90- math_utils::Point3D<float > getGlobalPosition () const
88+ void setGlobalPosition (const math_utils::Point3D<float >& x);
89+ [[nodiscard]] math_utils::Point3D<float > getGlobalPosition () const
9190 {
9291 return mGlobalPos ;
9392 }
9493
95- void setLocalPosition (math_utils::Point3D<float > x);
96- math_utils::Point3D<float > getLocalPosition () const
94+ void setLocalPosition (const math_utils::Point3D<float >& x);
95+ [[nodiscard]] math_utils::Point3D<float > getLocalPosition () const
9796 {
9897 return mLocalPos ;
9998 }
10099
101100 void setDispersion (float disp) { mDispersion = disp; }
102- float getDispersion () const { return mDispersion ; }
101+ [[nodiscard]] float getDispersion () const { return mDispersion ; }
103102
104103 void setM20 (float m20) { mM20 = m20; }
105- float getM20 () const { return mM20 ; }
104+ [[nodiscard]] float getM20 () const { return mM20 ; }
106105
107106 void setM02 (float m02) { mM02 = m02; }
108- float getM02 () const { return mM02 ; }
107+ [[nodiscard]] float getM02 () const { return mM02 ; }
109108
110109 void setNExMax (unsigned char nExMax) { mNExMax = nExMax; }
111- unsigned char getNExMax () const { return mNExMax ; }
110+ [[nodiscard]] unsigned char getNExMax () const { return mNExMax ; }
112111
113112 void setEmcCpvDistance (float dEmcCpv) { mEmcCpvDistance = dEmcCpv; }
114- float getEmcCpvDistance () const { return mEmcCpvDistance ; }
113+ [[nodiscard]] float getEmcCpvDistance () const { return mEmcCpvDistance ; }
115114 void setTrackDistance (float dx, float dz)
116115 {
117116 mTrackDx = dx;
118117 mTrackDz = dz;
119118 }
120- float getTrackDx () const { return mTrackDx ; }
121- float getTrackDz () const { return mTrackDz ; }
119+ [[nodiscard]] float getTrackDx () const { return mTrackDx ; }
120+ [[nodiscard]] float getTrackDz () const { return mTrackDz ; }
122121
123122 void setDistanceToBadChannel (float dist) { mDistToBadChannel = dist; }
124- float getDistanceToBadChannel () const { return mDistToBadChannel ; }
123+ [[nodiscard]] float getDistanceToBadChannel () const { return mDistToBadChannel ; }
125124
126125 void setNCells (int n) { mNCells = n; }
127- int getNCells () const { return mNCells ; }
126+ [[nodiscard]] int getNCells () const { return mNCells ; }
128127
129128 // /
130129 // / Set the array of cell indices.
@@ -133,7 +132,7 @@ class AnalysisCluster
133132 mCellsIndices = array;
134133 }
135134
136- const std::vector<unsigned short >& getCellsIndices () const { return mCellsIndices ; }
135+ [[nodiscard]] const std::vector<unsigned short >& getCellsIndices () const { return mCellsIndices ; }
137136
138137 // /
139138 // / Set the array of cell amplitude fractions.
@@ -143,53 +142,51 @@ class AnalysisCluster
143142 {
144143 mCellsAmpFraction = array;
145144 }
146- const std::vector<float >& getCellsAmplitudeFraction () const { return mCellsAmpFraction ; }
145+ [[nodiscard]] const std::vector<float >& getCellsAmplitudeFraction () const { return mCellsAmpFraction ; }
147146
148- int getCellIndex (int i) const
147+ [[nodiscard]] int getCellIndex (int i) const
149148 {
150149 if (i >= 0 && i < mNCells ) {
151150 return mCellsIndices [i];
152- } else {
153- throw CellOutOfRangeException (i);
154151 }
152+ throw CellOutOfRangeException (i);
155153 }
156154
157- float getCellAmplitudeFraction (int i) const
155+ [[nodiscard]] float getCellAmplitudeFraction (int i) const
158156 {
159157 if (i >= 0 && i < mNCells ) {
160158 return mCellsAmpFraction [i];
161- } else {
162- throw CellOutOfRangeException (i);
163159 }
160+ throw CellOutOfRangeException (i);
164161 }
165162
166- bool getIsExotic () const { return mIsExotic ; }
163+ [[nodiscard]] bool getIsExotic () const { return mIsExotic ; }
167164 void setIsExotic (bool b) { mIsExotic = b; }
168165
169166 void setClusterTime (float time)
170167 {
171168 mTime = time;
172169 }
173170
174- float getClusterTime () const
171+ [[nodiscard]] float getClusterTime () const
175172 {
176173 return mTime ;
177174 }
178175
179- int getIndMaxInput () const { return mInputIndMax ; }
176+ [[nodiscard]] int getIndMaxInput () const { return mInputIndMax ; }
180177 void setIndMaxInput (const int ind) { mInputIndMax = ind; }
181178
182- float getCoreEnergy () const { return mCoreEnergy ; }
179+ [[nodiscard]] float getCoreEnergy () const { return mCoreEnergy ; }
183180 void setCoreEnergy (float energy) { mCoreEnergy = energy; }
184181
185- float getFCross () const { return mFCross ; }
182+ [[nodiscard]] float getFCross () const { return mFCross ; }
186183 void setFCross (float fCross ) { mFCross = fCross ; }
187184
188185 // /
189186 // / Returns TLorentzVector with momentum of the cluster. Only valid for clusters
190187 // / identified as photons or pi0 (overlapped gamma) produced on the vertex
191188 // / Vertex can be recovered with esd pointer doing:
192- TLorentzVector getMomentum (std::array<const float , 3 > vertexPosition) const ;
189+ [[nodiscard]] TLorentzVector getMomentum (std::array<const float , 3 > vertexPosition) const ;
193190
194191 protected:
195192 // / TODO to replace later by o2::MCLabel when implementing the MC handling
@@ -230,9 +227,8 @@ class AnalysisCluster
230227
231228 int mInputIndMax = -1 ; // /< index of digit/cell with max energy
232229
233- ClassDefNV (AnalysisCluster, 2 );
230+ ClassDefNV (AnalysisCluster, 3 );
234231};
235232
236- } // namespace emcal
237- } // namespace o2
233+ } // namespace o2::emcal
238234#endif // ANALYSISCLUSTER_H
0 commit comments