Skip to content

Commit 9fbf915

Browse files
committed
Fix codechecker violations
1 parent 1b8f9aa commit 9fbf915

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

Detectors/Upgrades/ALICE3/TRKFT3/FT3/base/src/GeometryTGeo.cxx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ void GeometryTGeo::Build(int loadTrans)
108108
LOG(fatal) << getName() << " volume " << getFT3VolPattern() << " is not in the geometry";
109109
}
110110
auto layerNode = ft3V->GetNode(Form("%s_1", composeSymNameLayer(iDir, iDisc)));
111-
if (layerNode == nullptr)
111+
if (layerNode == nullptr) {
112112
LOG(fatal) << "Could not find layer node " << Form("%s_1", composeSymNameLayer(iDir, iDisc));
113+
}
113114
auto layerVol = layerNode->GetVolume();
114115
if (layerVol == nullptr)
115116
LOG(fatal) << "Could not find layer volume " << Form("%s_1", composeSymNameLayer(iDir, iDisc));
@@ -137,20 +138,23 @@ void GeometryTGeo::Build(int loadTrans)
137138
}
138139
LOG(info) << "direction " << iDir << " disc " << iDisc << " has " << nNodes << " nodes of which " << nSensor << " sensors in " << chipsPerStave.size() << " staves";
139140

140-
if (nStaves != chipsPerStave.size())
141+
if (nStaves != chipsPerStave.size()) {
141142
LOG(info) << "Inconsistency in stave count " << nStaves << " " << chipsPerStave.size();
143+
}
142144
mChipIdxStave.resize(absStaveIdx + chipsPerStave.size() + 1);
143145
mNumberOfStavesPerDisc.push_back(chipsPerStave.size()); // TODO: remove this? Or remove StaveIdxDisc
144146
int totSensor = 0;
145147
for (int nChips : chipsPerStave) {
146148
LOG(debug) << "Absolute Stave ID " << absStaveIdx << " : " << nChips << " sensors";
147149
totSensor += nChips;
148-
if (absStaveIdx)
150+
if (absStaveIdx) {
149151
mChipIdxStave[absStaveIdx + 1] = mChipIdxStave[absStaveIdx] + nChips;
152+
}
150153
absStaveIdx++;
151154
}
152-
if (totSensor != nSensor)
155+
if (totSensor != nSensor) {
153156
LOG(info) << "Inconsistency in sensor count " << nSensor << " " << totSensor;
157+
}
154158
LOG(debug) << " adding stave Idx " << absStaveIdx << " to disc array; element " << mStaveIdxDisc.size();
155159
mStaveIdxDisc.push_back(absStaveIdx);
156160
mNumberOfChipsPerDisc.push_back(totSensor);
@@ -256,8 +260,9 @@ void GeometryTGeo::extractChipIds(std::string const volName, int& direction, int
256260
int GeometryTGeo::getChipIndex(int dir, int layer, int stave, int chip) const
257261
{
258262
int absDisc = layer;
259-
if (dir == 1)
263+
if (dir == 1) {
260264
absDisc += mNumberOfDiscs[0];
265+
}
261266
return mChipIdxStave[mStaveIdxDisc[absDisc] + stave] + chip;
262267
}
263268

@@ -352,21 +357,25 @@ void GeometryTGeo::fillMatrixCache(int mask)
352357
layer = absDisc - mNumberOfDiscs[0];
353358
}
354359
LOG(info) << "Direction " << direction << " layer " << layer;
355-
if (absDisc >= mNumberOfStavesPerDisc.size())
360+
if (absDisc >= mNumberOfStavesPerDisc.size()) {
356361
LOG(fatal) << "Not enough entries in mNumberOfStavesPerDisc " << absDisc << " " << mNumberOfStavesPerDisc.size();
362+
}
357363
for (int stave = 0; stave < mNumberOfStavesPerDisc[absDisc]; stave++) {
358364
int absStave = mStaveIdxDisc[absDisc] + stave;
359-
if (absStave + 1 >= mChipIdxStave.size())
365+
if (absStave + 1 >= mChipIdxStave.size()) {
360366
LOG(fatal) << "Attempting to get absStave + 1 from index array size " << mChipIdxStave.size();
367+
}
361368
int nChip = mChipIdxStave[absStave + 1] - mChipIdxStave[absStave]; // TODO: this is too often == 0
362369
LOG(debug) << "Getting matrices for direction " << direction << " layer " << layer << " stave " << stave << " : " << nChip << " chips";
363370
for (int chip = 0; chip < nChip; chip++) {
364371
int chipIdx = getChipIndex(direction, layer, stave, chip);
365-
if (!gGeoManager->cd(getMatrixPath(direction, layer, stave, chip).c_str()))
372+
if (!gGeoManager->cd(getMatrixPath(direction, layer, stave, chip).c_str())) {
366373
LOG(fatal) << "Geometry path not found " << getMatrixPath(direction, layer, stave, chip);
374+
}
367375
const TGeoHMatrix* matL2G = gGeoManager->GetCurrentMatrix();
368-
if (chipIdx >= mSize)
376+
if (chipIdx >= mSize) {
369377
LOG(fatal) << "ChipIdx " << chipIdx << " out of range " << mSize;
378+
}
370379
cacheL2G.setMatrix(Mat3D(*matL2G), chipIdx);
371380

372381
matL2G->LocalToMaster(locA, gloA);

0 commit comments

Comments
 (0)