Skip to content

Commit df3b3bd

Browse files
authored
ALICE3-TRK: Fix readability-braces-around-statements errors (#14778)
* Refactor conditionals for clarity in VDGeometryBuilder * Fix while loop syntax for shape name generation
1 parent 180fd48 commit df3b3bd

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

Detectors/Upgrades/ALICE3/TRK/simulation/src/VDGeometryBuilder.cxx

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,28 @@ inline bool isSolidToCut(const TGeoVolume* v)
5454
const char* nm = v->GetName();
5555
const char* med = v->GetMedium() ? v->GetMedium()->GetName() : "";
5656
// silicon sensors (barrel + disks)
57-
if (med && strcmp(med, "TRK_SILICON$") == 0)
57+
if (med && strcmp(med, "TRK_SILICON$") == 0) {
5858
return true;
59+
}
5960
// walls, sidewalls, cold-plate, service rings (names from your builders)
60-
if (TString(nm).BeginsWith("VD_InnerWallArc"))
61+
if (TString(nm).BeginsWith("VD_InnerWallArc")) {
6162
return true;
62-
if (TString(nm).BeginsWith("VD_OuterWallArc"))
63+
}
64+
if (TString(nm).BeginsWith("VD_OuterWallArc")) {
6365
return true;
64-
if (TString(nm).BeginsWith("VD_SideWall"))
66+
}
67+
if (TString(nm).BeginsWith("VD_SideWall")) {
6568
return true;
66-
if (TString(nm).Contains("_Coldplate"))
69+
}
70+
if (TString(nm).Contains("_Coldplate")) {
6771
return true;
68-
if (TString(nm).BeginsWith("IRIS_Service_Neg"))
72+
}
73+
if (TString(nm).BeginsWith("IRIS_Service_Neg")) {
6974
return true;
70-
if (TString(nm).BeginsWith("IRIS_Service_Pos_InVac"))
75+
}
76+
if (TString(nm).BeginsWith("IRIS_Service_Pos_InVac")) {
7177
return true;
78+
}
7279
return false;
7380
}
7481

@@ -83,11 +90,13 @@ inline const char* ensureShapeName(TGeoVolume* v)
8390
int k = 0;
8491
TString cand = wanted;
8592
auto* shapes = gGeoManager ? gGeoManager->GetListOfShapes() : nullptr;
86-
while (shapes && shapes->FindObject(cand))
93+
while (shapes && shapes->FindObject(cand)) {
8794
cand = Form("%s_%d", wanted.Data(), ++k);
95+
}
8896
sh->SetName(cand);
89-
if (shapes && !shapes->FindObject(cand))
97+
if (shapes && !shapes->FindObject(cand)) {
9098
shapes->Add(sh);
99+
}
91100
}
92101
return sh->GetName();
93102
}
@@ -102,23 +111,26 @@ inline void appendLocalTerm(const char* shapeName, const TGeoHMatrix& H)
102111
auto* ct = new TGeoCombiTrans(H);
103112
ct->SetName(Form("IRIS_LOC_TR_%d", gLocalTrIdx++));
104113
ct->RegisterYourself();
105-
if (!gPetalSolidsFormula.IsNull())
114+
if (!gPetalSolidsFormula.IsNull()) {
106115
gPetalSolidsFormula += "+";
116+
}
107117
gPetalSolidsFormula += TString::Format("%s:%s", shapeName, ct->GetName());
108118
}
109119

110120
// DFS: compose LOCAL transforms only (identity prefix), to capture the petal contents
111121
void traversePetalLocal(TGeoVolume* vol, const TGeoHMatrix& prefix)
112122
{
113123
auto* nodes = vol->GetNodes();
114-
if (!nodes)
124+
if (!nodes) {
115125
return;
126+
}
116127
for (int i = 0; i < nodes->GetEntriesFast(); ++i) {
117128
auto* node = (TGeoNode*)nodes->At(i);
118129
auto* childV = node->GetVolume();
119130
TGeoHMatrix H(prefix);
120-
if (auto* m = node->GetMatrix())
131+
if (auto* m = node->GetMatrix()) {
121132
H.Multiply(m);
133+
}
122134

123135
if (isSolidToCut(childV)) {
124136
const char* shapeName = ensureShapeName(childV);
@@ -132,8 +144,9 @@ void traversePetalLocal(TGeoVolume* vol, const TGeoHMatrix& prefix)
132144
inline void buildPetalSolidsComposite(TGeoVolume* petalAsm)
133145
{
134146
// If it already exists, skip
135-
if (gGeoManager && gGeoManager->GetListOfShapes() && gGeoManager->GetListOfShapes()->FindObject("IRIS_PETAL_SOLIDSsh"))
147+
if (gGeoManager && gGeoManager->GetListOfShapes() && gGeoManager->GetListOfShapes()->FindObject("IRIS_PETAL_SOLIDSsh")) {
136148
return;
149+
}
137150

138151
gPetalSolidsFormula.Clear();
139152
gLocalTrIdx = 0;
@@ -162,8 +175,9 @@ inline void buildIrisCutoutFromPetalSolid(int nPetals)
162175
auto* RT = new TGeoCombiTrans(0, 0, 0, R);
163176
RT->SetName(Form("IRIS_PETAL_ROT_%d", p));
164177
RT->RegisterYourself();
165-
if (p)
178+
if (p) {
166179
cutFormula += "+";
180+
}
167181
cutFormula += Form("IRIS_PETAL_SOLIDSsh:%s", RT->GetName());
168182
}
169183
LOGP(info, "IRIS_CUTOUTsh formula: {}", cutFormula.Data());
@@ -257,8 +271,9 @@ inline double degFromArc(double arc, double radius)
257271
*/
258272
inline double phiSpanFromGap(int nPetals, double gap, double radius)
259273
{
260-
if (nPetals <= 0 || radius <= 0.f)
274+
if (nPetals <= 0 || radius <= 0.f) {
261275
return 0.f;
276+
}
262277
const double petalPhiDeg = 360.f / nPetals;
263278
const double phi = petalPhiDeg - degFromArc(gap, radius);
264279
return phi > 0.f ? phi : 0.f;

0 commit comments

Comments
 (0)