Skip to content

Commit 04802d4

Browse files
committed
ITSMFT: ITS3: fix asserts in TopoDict
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 877dc1f commit 04802d4

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

DataFormats/Detectors/ITSMFT/common/include/DataFormatsITSMFT/TopologyDictionary.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,67 +92,67 @@ class TopologyDictionary
9292
/// Returns the x position of the COG for the n_th element
9393
inline float getXCOG(int n) const
9494
{
95-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
95+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
9696
return mVectorOfIDs[n].mXCOG;
9797
}
9898
/// Returns the error on the x position of the COG for the n_th element
9999
inline float getErrX(int n) const
100100
{
101-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
101+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
102102
return mVectorOfIDs[n].mErrX;
103103
}
104104
/// Returns the z position of the COG for the n_th element
105105
inline float getZCOG(int n) const
106106
{
107-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
107+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
108108
return mVectorOfIDs[n].mZCOG;
109109
}
110110
/// Returns the error on the z position of the COG for the n_th element
111111
inline float getErrZ(int n) const
112112
{
113-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
113+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
114114
return mVectorOfIDs[n].mErrZ;
115115
}
116116
/// Returns the error^2 on the x position of the COG for the n_th element
117117
inline float getErr2X(int n) const
118118
{
119-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
119+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
120120
return mVectorOfIDs[n].mErr2X;
121121
}
122122
/// Returns the error^2 on the z position of the COG for the n_th element
123123
inline float getErr2Z(int n) const
124124
{
125-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
125+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
126126
return mVectorOfIDs[n].mErr2Z;
127127
}
128128
/// Returns the hash of the n_th element
129129
inline unsigned long getHash(int n) const
130130
{
131-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
131+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
132132
return mVectorOfIDs[n].mHash;
133133
}
134134
/// Returns the number of fired pixels of the n_th element
135135
inline int getNpixels(int n) const
136136
{
137-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
137+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
138138
return mVectorOfIDs[n].mNpixels;
139139
}
140140
/// Returns the frequency of the n_th element;
141141
inline double getFrequency(int n) const
142142
{
143-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
143+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
144144
return mVectorOfIDs[n].mFrequency;
145145
}
146146
/// Returns true if the element corresponds to a group of rare topologies
147147
inline bool isGroup(int n) const
148148
{
149-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
149+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
150150
return mVectorOfIDs[n].mIsGroup;
151151
}
152152
/// Returns the pattern of the topology
153153
inline const ClusterPattern& getPattern(int n) const
154154
{
155-
assert(n >= 0 || n < (int)mVectorOfIDs.size());
155+
assert(n >= 0 && n < (int)mVectorOfIDs.size());
156156
return mVectorOfIDs[n].mPattern;
157157
}
158158

Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,77 +65,77 @@ class TopologyDictionary
6565
[[nodiscard]] float getXCOG(int n, bool IB = true) const
6666
{
6767
const auto& data = (IB) ? mDataIB : mDataOB;
68-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
68+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
6969
return data.mVectorOfIDs[n].mXCOG;
7070
}
7171
/// Returns the error on the x position of the COG for the n_th element
7272
[[nodiscard]] float getErrX(int n, bool IB = true) const
7373
{
7474
const auto& data = (IB) ? mDataIB : mDataOB;
75-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
75+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
7676
return data.mVectorOfIDs[n].mErrX;
7777
}
7878
/// Returns the z position of the COG for the n_th element
7979
[[nodiscard]] float getZCOG(int n, bool IB = true) const
8080
{
8181
const auto& data = (IB) ? mDataIB : mDataOB;
82-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
82+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
8383
return data.mVectorOfIDs[n].mZCOG;
8484
}
8585
/// Returns the error on the z position of the COG for the n_th element
8686
[[nodiscard]] float getErrZ(int n, bool IB = true) const
8787
{
8888
const auto& data = (IB) ? mDataIB : mDataOB;
89-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
89+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
9090
return data.mVectorOfIDs[n].mErrZ;
9191
}
9292
/// Returns the error^2 on the x position of the COG for the n_th element
9393
[[nodiscard]] float getErr2X(int n, bool IB = true) const
9494
{
9595
const auto& data = (IB) ? mDataIB : mDataOB;
96-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
96+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
9797
return data.mVectorOfIDs[n].mErr2X;
9898
}
9999
/// Returns the error^2 on the z position of the COG for the n_th element
100100
[[nodiscard]] float getErr2Z(int n, bool IB = true) const
101101
{
102102
const auto& data = (IB) ? mDataIB : mDataOB;
103-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
103+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
104104
return data.mVectorOfIDs[n].mErr2Z;
105105
}
106106
/// Returns the hash of the n_th element
107107
[[nodiscard]] unsigned long getHash(int n, bool IB = true) const
108108
{
109109
const auto& data = (IB) ? mDataIB : mDataOB;
110-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
110+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
111111
return data.mVectorOfIDs[n].mHash;
112112
}
113113
/// Returns the number of fired pixels of the n_th element
114114
[[nodiscard]] int getNpixels(int n, bool IB = true) const
115115
{
116116
const auto& data = (IB) ? mDataIB : mDataOB;
117-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
117+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
118118
return data.mVectorOfIDs[n].mNpixels;
119119
}
120120
/// Returns the frequency of the n_th element;
121121
[[nodiscard]] double getFrequency(int n, bool IB = true) const
122122
{
123123
const auto& data = (IB) ? mDataIB : mDataOB;
124-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
124+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
125125
return data.mVectorOfIDs[n].mFrequency;
126126
}
127127
/// Returns true if the element corresponds to a group of rare topologies
128128
[[nodiscard]] bool isGroup(int n, bool IB = true) const
129129
{
130130
const auto& data = (IB) ? mDataIB : mDataOB;
131-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
131+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
132132
return data.mVectorOfIDs[n].mIsGroup;
133133
}
134134
/// Returns the pattern of the topology
135135
[[nodiscard]] const itsmft::ClusterPattern& getPattern(int n, bool IB = true) const
136136
{
137137
const auto& data = (IB) ? mDataIB : mDataOB;
138-
assert(n >= 0 || n < (int)data.mVectorOfIDs.size());
138+
assert(n >= 0 && n < (int)data.mVectorOfIDs.size());
139139
return data.mVectorOfIDs[n].mPattern;
140140
}
141141

0 commit comments

Comments
 (0)