Skip to content

Commit 32a9fae

Browse files
committed
Update checkout github action version
Also fixes clang-formatting
1 parent 9eaab35 commit 32a9fae

5 files changed

Lines changed: 28 additions & 16 deletions

File tree

.github/workflows/CI-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
container: anthoak13/attpcroot-deps
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222

2323
- name: Configure CMake
2424
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v6
1212
- name: Run clang-format
1313
uses: DoozyX/clang-format-lint-action@v0.17
1414
# These are optional (defaults displayed)

AtTools/AtELossBetheBlochTest.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "AtELossBetheBloch.h"
2+
23
#include "AtELossCATIMA.h"
34

45
#include <catima/catima.h>
@@ -286,17 +287,16 @@ TEST_F(AtELossBetheBlochVsCATIMAFixture, CATIMAComparison_EnergyStraggling)
286287
double eIni, eFin;
287288
};
288289
const Case cases[] = {
289-
{1.0, 0.75 * mass}, // narrow: ~25% energy loss
290-
{5.0, 3.58164 * mass}, // narrow: ~28% energy loss
291-
{5.0, 1.0}, // wide: 80% energy loss
292-
{10.0, 1.0}, // wide: 90% energy loss, exercises Bragg-peak region
290+
{1.0, 0.75 * mass}, // narrow: ~25% energy loss
291+
{5.0, 3.58164 * mass}, // narrow: ~28% energy loss
292+
{5.0, 1.0}, // wide: 80% energy loss
293+
{10.0, 1.0}, // wide: 90% energy loss, exercises Bragg-peak region
293294
};
294295
for (auto &c : cases) {
295296
double bbSigma = bb.GetElossStraggling(c.eIni, c.eFin);
296297
double catimaSigma = catima.GetElossStraggling(c.eIni, c.eFin);
297298
ASSERT_GT(bbSigma, 0.0) << "BB straggling zero for E0=" << c.eIni;
298299
ASSERT_GT(catimaSigma, 0.0) << "CATIMA straggling zero for E0=" << c.eIni;
299-
EXPECT_NEAR(bbSigma, catimaSigma, 0.10 * catimaSigma)
300-
<< "Energy straggling mismatch for E0=" << c.eIni << " MeV";
300+
EXPECT_NEAR(bbSigma, catimaSigma, 0.10 * catimaSigma) << "Energy straggling mismatch for E0=" << c.eIni << " MeV";
301301
}
302302
}

AtTools/AtELossCATIMA.cxx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ double AtELossCATIMA::GetRange(double energyIni, double energyFin) const
4444
double remainingEnergy{energyIni};
4545
double range{0};
4646
while (remainingEnergy > energyFin) {
47-
catima::Result result = catima::calculate(*fProjectile, *fMaterial, remainingEnergy / fProjectileMassAmu, fConfig);
47+
catima::Result result =
48+
catima::calculate(*fProjectile, *fMaterial, remainingEnergy / fProjectileMassAmu, fConfig);
4849
double dEdx = result.dEdxi * fDensity;
4950
double DE = dEdx * fRangeStepSize / 10.;
5051

@@ -65,7 +66,8 @@ double AtELossCATIMA::GetEnergy(double energyIni, double distance) const
6566
double remainingEnergy{energyIni};
6667
double range{0};
6768
while (range < distance) {
68-
catima::Result result = catima::calculate(*fProjectile, *fMaterial, remainingEnergy / fProjectileMassAmu, fConfig);
69+
catima::Result result =
70+
catima::calculate(*fProjectile, *fMaterial, remainingEnergy / fProjectileMassAmu, fConfig);
6971
double dEdx = result.dEdxi * fDensity;
7072
double DE{};
7173

@@ -142,8 +144,9 @@ AtELossCATIMA::GetBraggCurve(double energy, double rangeStepSize, double totalFr
142144
double range{};
143145
while (remainingEnergy / energy > totalFractionELoss) {
144146

145-
catima::Result result = catima::calculate(*fProjectile, *fMaterial, remainingEnergy / fProjectileMassAmu, fConfig);
146-
double dEdx = result.dEdxi * fDensity; // MeV/cm
147+
catima::Result result =
148+
catima::calculate(*fProjectile, *fMaterial, remainingEnergy / fProjectileMassAmu, fConfig);
149+
double dEdx = result.dEdxi * fDensity; // MeV/cm
147150
braggCurve.push_back(std::make_pair(dEdx / 10.0, range)); // store in MeV/mm
148151

149152
double DE = dEdx * rangeStepSize / 10.;

scripts/formatAll.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@
22

33
#Break if something errors
44
set -e
5-
echo "Indenting all source (.cxx) and header files (.h)"
5+
echo "Indenting all source (.cxx, .C) and header files (.h)"
66

7-
#Make sure $VMCWORKDIR is set.
7+
#Make sure $VMCWORKDIR is set.
88
if [ -z "$VMCWORKDIR" ]
99
then
1010
echo "VMCWORKDIR is unset. Please run config.sh on build directory first. Aborting..."
1111
return
1212
fi
1313

14-
find -L $VMCWORKDIR -type f | grep -w h$ | xargs -I fname clang-format -i --verbose fname
15-
find -L $VMCWORKDIR -type f | grep -w cxx$ | xargs -I fname clang-format -i --verbose fname
14+
# Directories excluded from formatting (matches .github/workflows/main.yml)
15+
EXCLUDE_DIRS="macro scripts compiled resources include geometry build .venv lib bin"
16+
17+
# Build a prune expression for find
18+
PRUNE_EXPR=""
19+
for dir in $EXCLUDE_DIRS; do
20+
PRUNE_EXPR="$PRUNE_EXPR -path $VMCWORKDIR/$dir -prune -o"
21+
done
22+
23+
find -L $VMCWORKDIR $PRUNE_EXPR -type f \( -name "*.h" -o -name "*.cxx" -o -name "*.C" \) -print \
24+
| xargs -I fname clang-format-17 -i --verbose fname
1625

1726
echo "Success! Indented all source and header files"

0 commit comments

Comments
 (0)