Skip to content

Commit 9e5adb3

Browse files
anerokhisawenzel
authored andcommitted
DataFormats: make readability-braces-around-statements happy
1 parent 7c57a74 commit 9e5adb3

35 files changed

Lines changed: 245 additions & 137 deletions

File tree

DataFormats/Detectors/CPV/include/DataFormatsCPV/Digit.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ class Digit : public DigitBase
5757
{
5858
if (fabs(getTimeStamp() - other.getTimeStamp()) < kTimeGate) {
5959
return getAbsId() < other.getAbsId();
60-
} else
60+
} else {
6161
return getTimeStamp() < other.getTimeStamp();
62+
}
6263
}
6364

6465
/// \brief Comparison oparator, based on time and absId
@@ -68,8 +69,9 @@ class Digit : public DigitBase
6869
{
6970
if (fabs(getTimeStamp() - other.getTimeStamp()) <= kTimeGate) {
7071
return getAbsId() > other.getAbsId();
71-
} else
72+
} else {
7273
return getTimeStamp() > other.getTimeStamp();
74+
}
7375
}
7476

7577
/// \brief Comparison oparator, based on time and absId

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetMatrixCache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ class MatrixCache
4141
/// set the size of the cache
4242
void setSize(int s)
4343
{
44-
if (!mCache.size())
44+
if (!mCache.size()) {
4545
mCache.resize(s);
46+
}
4647
}
4748

4849
/// get the size of the cache

DataFormats/Detectors/Common/src/AlignParam.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,11 @@ int AlignParam::Compare(const TObject* obj) const
318318

319319
int level = getLevel();
320320
int level2 = ((AlignParam*)obj)->getLevel();
321-
if (level == level2)
321+
if (level == level2) {
322322
return 0;
323-
else
323+
} else {
324324
return ((level > level2) ? 1 : -1);
325+
}
325326
}
326327

327328
//_____________________________________________________________________________

DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/AnalysisCluster.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,20 @@ class AnalysisCluster
146146

147147
int getCellIndex(int i) const
148148
{
149-
if (i >= 0 && i < mNCells)
149+
if (i >= 0 && i < mNCells) {
150150
return mCellsIndices[i];
151-
else
151+
} else {
152152
throw CellOutOfRangeException(i);
153+
}
153154
}
154155

155156
float getCellAmplitudeFraction(int i) const
156157
{
157-
if (i >= 0 && i < mNCells)
158+
if (i >= 0 && i < mNCells) {
158159
return mCellsAmpFraction[i];
159-
else
160+
} else {
160161
throw CellOutOfRangeException(i);
162+
}
161163
}
162164

163165
bool getIsExotic() const { return mIsExotic; }

DataFormats/Detectors/EMCAL/src/AnalysisCluster.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ TLorentzVector AnalysisCluster::getMomentum(std::array<const float, 3> vertex) c
4040

4141
float r = TMath::Sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]);
4242

43-
if (r > 0)
43+
if (r > 0) {
4444
p.SetPxPyPzE(mEnergy * pos[0] / r, mEnergy * pos[1] / r, mEnergy * pos[2] / r, mEnergy);
45-
else
45+
} else {
4646
LOG(INFO) << "Null cluster radius, momentum calculation not possible";
47+
}
4748

4849
return p;
4950
}

DataFormats/Detectors/EMCAL/src/Cell.cxx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ Cell::Cell(Short_t tower, Double_t energy, Double_t time, ChannelType_t ctype)
2525

2626
void Cell::setTower(Short_t tower)
2727
{
28-
if (tower > 0x7fff || tower < 0)
28+
if (tower > 0x7fff || tower < 0) {
2929
tower = 0x7fff;
30+
}
3031
ULong_t t = (ULong_t)tower;
3132

3233
ULong_t b = getLong() & 0xffffff8000; // 1111111111111111111111111000000000000000
@@ -43,12 +44,13 @@ Short_t Cell::getTower() const
4344
void Cell::setTimeStamp(Double_t time)
4445
{
4546
ULong_t t = 0;
46-
if (time > 0x1ff)
47+
if (time > 0x1ff) {
4748
t = 0x1ff;
48-
else if (time < 0)
49+
} else if (time < 0) {
4950
t = 0;
50-
else
51+
} else {
5152
t = (ULong_t)time;
53+
}
5254

5355
t <<= 15;
5456
ULong_t b = getLong() & 0xffff007fff; // 1111111111111111000000000111111111111111
@@ -65,10 +67,11 @@ Short_t Cell::getTimeStamp() const
6567

6668
void Cell::setEnergyBits(Short_t ebits)
6769
{
68-
if (ebits > 0x3fff)
70+
if (ebits > 0x3fff) {
6971
ebits = 0x3fff;
70-
else if (ebits < 0)
72+
} else if (ebits < 0) {
7173
ebits = 0;
74+
}
7275
ULong_t a = (ULong_t)ebits;
7376

7477
a <<= 24;
@@ -119,12 +122,13 @@ void Cell::setType(ChannelType_t ctype)
119122

120123
ChannelType_t Cell::getType() const
121124
{
122-
if (getHighGain())
125+
if (getHighGain()) {
123126
return ChannelType_t::HIGH_GAIN;
124-
else if (getLEDMon())
127+
} else if (getLEDMon()) {
125128
return ChannelType_t::LEDMON;
126-
else if (getTRU())
129+
} else if (getTRU()) {
127130
return ChannelType_t::TRU;
131+
}
128132
return ChannelType_t::LOW_GAIN;
129133
}
130134

@@ -137,8 +141,9 @@ void Cell::setLowGain()
137141
Bool_t Cell::getLowGain() const
138142
{
139143
ULong_t t = (getLong() >> 38);
140-
if (t)
144+
if (t) {
141145
return false;
146+
}
142147
return true;
143148
}
144149

@@ -151,8 +156,9 @@ void Cell::setHighGain()
151156
Bool_t Cell::getHighGain() const
152157
{
153158
ULong_t t = (getLong() >> 38);
154-
if (t == 1)
159+
if (t == 1) {
155160
return true;
161+
}
156162
return false;
157163
}
158164

@@ -165,8 +171,9 @@ void Cell::setLEDMon()
165171
Bool_t Cell::getLEDMon() const
166172
{
167173
ULong_t t = (getLong() >> 38);
168-
if (t == 2)
174+
if (t == 2) {
169175
return true;
176+
}
170177
return false;
171178
}
172179

@@ -179,8 +186,9 @@ void Cell::setTRU()
179186
Bool_t Cell::getTRU() const
180187
{
181188
ULong_t t = (getLong() >> 38);
182-
if (t == 3)
189+
if (t == 3) {
183190
return true;
191+
}
184192
return false;
185193
}
186194

DataFormats/Detectors/EMCAL/src/Digit.cxx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ Digit& Digit::operator+=(const Digit& other)
2525
Int_t a = getAmplitudeADC() + other.getAmplitudeADC();
2626
Short_t s = (Short_t)(a);
2727

28-
if (a < -0x8000)
28+
if (a < -0x8000) {
2929
setAmplitudeADC(-0x8000);
30-
else if (a <= constants::EMCAL_HGLGTRANSITION)
30+
} else if (a <= constants::EMCAL_HGLGTRANSITION) {
3131
setAmplitudeADC(s);
32-
else if (a <= 0x7fff * constants::EMCAL_HGLGFACTOR)
32+
} else if (a <= 0x7fff * constants::EMCAL_HGLGFACTOR) {
3333
setAmplitudeADC(s / constants::EMCAL_HGLGFACTOR, ChannelType_t::LOW_GAIN);
34-
else
34+
} else {
3535
setAmplitudeADC(0x7fff, ChannelType_t::LOW_GAIN);
36+
}
3637
}
3738
// Does nothing if the digits are in different towers or have incompatible times.
3839
return *this;
@@ -66,15 +67,17 @@ Int_t Digit::getAmplitudeADC(ChannelType_t ctype) const
6667
{
6768
if (ctype == ChannelType_t::LOW_GAIN) {
6869
// return in units of Low-Gain ADC counts
69-
if (mChannelType == ChannelType_t::LOW_GAIN)
70+
if (mChannelType == ChannelType_t::LOW_GAIN) {
7071
return (Int_t)(mAmplitude);
71-
else
72+
} else {
7273
return mAmplitude / constants::EMCAL_HGLGFACTOR;
74+
}
7375
}
7476

7577
// return in units of High-Gain ADC counts (default)
76-
if (mChannelType == ChannelType_t::LOW_GAIN)
78+
if (mChannelType == ChannelType_t::LOW_GAIN) {
7779
return mAmplitude * constants::EMCAL_HGLGFACTOR;
80+
}
7881

7982
return (Int_t)(mAmplitude);
8083
}

DataFormats/Detectors/EMCAL/src/EventHandler.cxx

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,37 @@ int EventHandler<CellInputType>::getNumberOfEvents() const
4141
{
4242
int neventsClusters = mTriggerRecordsClusters.size(),
4343
neventsCells = mTriggerRecordsCells.size();
44-
if (neventsClusters)
44+
if (neventsClusters) {
4545
return neventsClusters;
46-
else if (neventsCells)
46+
} else if (neventsCells) {
4747
return neventsCells;
48-
else
48+
} else {
4949
return 0;
50+
}
5051
}
5152

5253
template <class CellInputType>
5354
const o2::InteractionRecord& EventHandler<CellInputType>::getInteractionRecordForEvent(int eventID) const
5455
{
5556
const InteractionRecord *irClusters(nullptr), *irCells(nullptr);
5657
if (mTriggerRecordsClusters.size()) {
57-
if (eventID >= mTriggerRecordsClusters.size())
58+
if (eventID >= mTriggerRecordsClusters.size()) {
5859
throw RangeException(eventID, mTriggerRecordsClusters.size());
60+
}
5961
irClusters = &(mTriggerRecordsClusters[eventID].getBCData());
6062
}
6163
if (mTriggerRecordsCells.size()) {
62-
if (eventID >= mTriggerRecordsCells.size())
64+
if (eventID >= mTriggerRecordsCells.size()) {
6365
throw RangeException(eventID, mTriggerRecordsCells.size());
66+
}
6467
irCells = &(mTriggerRecordsCellIndices[eventID].getBCData());
6568
}
6669
if (irClusters && irCells) {
67-
if (compareInteractionRecords(*irClusters, *irCells))
70+
if (compareInteractionRecords(*irClusters, *irCells)) {
6871
return *irClusters;
69-
else
72+
} else {
7073
throw InteractionRecordInvalidException(*irClusters, *irCells);
74+
}
7175
} else if (irClusters) {
7276
return *irClusters;
7377
} else if (irCells) {
@@ -80,8 +84,9 @@ template <class CellInputType>
8084
const typename EventHandler<CellInputType>::ClusterRange EventHandler<CellInputType>::getClustersForEvent(int eventID) const
8185
{
8286
if (mTriggerRecordsClusters.size()) {
83-
if (eventID >= mTriggerRecordsClusters.size())
87+
if (eventID >= mTriggerRecordsClusters.size()) {
8488
throw RangeException(eventID, mTriggerRecordsClusters.size());
89+
}
8590
auto& trgrecord = mTriggerRecordsClusters[eventID];
8691
return ClusterRange(mClusters.data() + trgrecord.getFirstEntry(), trgrecord.getNumberOfObjects());
8792
}
@@ -92,8 +97,9 @@ template <class CellInputType>
9297
const typename EventHandler<CellInputType>::CellRange EventHandler<CellInputType>::getCellsForEvent(int eventID) const
9398
{
9499
if (mTriggerRecordsCells.size()) {
95-
if (eventID >= mTriggerRecordsCells.size())
100+
if (eventID >= mTriggerRecordsCells.size()) {
96101
throw RangeException(eventID, mTriggerRecordsCells.size());
102+
}
97103
auto& trgrecord = mTriggerRecordsCells[eventID];
98104
return CellRange(mCells.data() + trgrecord.getFirstEntry(), trgrecord.getNumberOfObjects());
99105
}
@@ -104,8 +110,9 @@ template <class CellInputType>
104110
const typename EventHandler<CellInputType>::CellIndexRange EventHandler<CellInputType>::getClusterCellIndicesForEvent(int eventID) const
105111
{
106112
if (mTriggerRecordsCellIndices.size()) {
107-
if (eventID >= mTriggerRecordsCellIndices.size())
113+
if (eventID >= mTriggerRecordsCellIndices.size()) {
108114
throw RangeException(eventID, mTriggerRecordsCellIndices.size());
115+
}
109116
auto& trgrecord = mTriggerRecordsCellIndices[eventID];
110117
return CellIndexRange(mClusterCellIndices.data() + trgrecord.getFirstEntry(), trgrecord.getNumberOfObjects());
111118
}
@@ -128,12 +135,15 @@ EventData<CellInputType> EventHandler<CellInputType>::buildEvent(int eventID) co
128135
{
129136
EventData<CellInputType> outputEvent;
130137
outputEvent.mInteractionRecord = getInteractionRecordForEvent(eventID);
131-
if (hasClusters())
138+
if (hasClusters()) {
132139
outputEvent.mClusters = getClustersForEvent(eventID);
133-
if (hasClusterIndices())
140+
}
141+
if (hasClusterIndices()) {
134142
outputEvent.mCellIndices = getClusterCellIndicesForEvent(eventID);
135-
if (hasCells())
143+
}
144+
if (hasCells()) {
136145
outputEvent.mCells = getCellsForEvent(eventID);
146+
}
137147

138148
return outputEvent;
139149
}
@@ -162,10 +172,11 @@ bool EventHandler<CellInputType>::EventIterator::operator==(const EventHandler<C
162172
template <class CellInputType>
163173
typename EventHandler<CellInputType>::EventIterator& EventHandler<CellInputType>::EventIterator::operator++()
164174
{
165-
if (mForward)
175+
if (mForward) {
166176
mEventID++;
167-
else
177+
} else {
168178
mEventID--;
179+
}
169180
mCurrentEvent = mEventHandler.buildEvent(mEventID);
170181
return *this;
171182
}
@@ -181,10 +192,11 @@ typename EventHandler<CellInputType>::EventIterator EventHandler<CellInputType>:
181192
template <class CellInputType>
182193
typename EventHandler<CellInputType>::EventIterator& EventHandler<CellInputType>::EventIterator::operator--()
183194
{
184-
if (mForward)
195+
if (mForward) {
185196
mEventID--;
186-
else
197+
} else {
187198
mEventID++;
199+
}
188200
mCurrentEvent = mEventHandler.buildEvent(mEventID);
189201
return *this;
190202
}

DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/LookUpTable.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,23 @@ class LookUpTable
5353
explicit LookUpTable(std::vector<Topo> const& topoVector)
5454
: mTopoVector(topoVector), mInvTopo(topoVector.size())
5555
{
56-
for (size_t channel = 0; channel < mTopoVector.size(); ++channel)
56+
for (size_t channel = 0; channel < mTopoVector.size(); ++channel) {
5757
mInvTopo.at(getIdx(mTopoVector[channel].mPM, mTopoVector[channel].mMCP)) =
5858
channel;
59+
}
5960
}
6061

6162
~LookUpTable() = default;
6263
void printFullMap() const
6364
{
64-
for (size_t channel = 0; channel < mTopoVector.size(); ++channel)
65+
for (size_t channel = 0; channel < mTopoVector.size(); ++channel) {
6566
std::cout << channel << "\t : PM \t" << mTopoVector[channel].mPM
6667
<< " MCP \t" << mTopoVector[channel].mMCP << std::endl;
67-
for (size_t idx = 0; idx < mInvTopo.size(); ++idx)
68+
}
69+
for (size_t idx = 0; idx < mInvTopo.size(); ++idx) {
6870
std::cout << "PM \t" << getLinkFromIdx(mInvTopo[idx]) << " MCP \t"
6971
<< getMCPFromIdx(mInvTopo[idx]) << std::endl;
72+
}
7073
}
7174

7275
int getChannel(int link, int mcp) const

DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/RawEventData.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,9 @@ class DataPageWriter
324324

325325
void writePage()
326326
{
327-
if (mBuffer.size() == 0)
327+
if (mBuffer.size() == 0) {
328328
return;
329+
}
329330
mPages.emplace_back(std::move(mBuffer));
330331
LOG(DEBUG) << " writePage " << mBuffer.size();
331332
mNpackets.push_back(mNpacketsInBuffer);

0 commit comments

Comments
 (0)