Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4122 commits
Select commit Hold shift + click to select a range
fe51c5b
Merge pull request #523 from davidwalter2/240724_fakes
bendavid Aug 19, 2024
2737862
Merge branch 'main' of github.com:WMass/WRemnants
kdlong Aug 19, 2024
372cd73
latest changes in theory agnostic after review
emanca Aug 19, 2024
727e624
Implement arguments to set fake smoothing polynomials
davidwalter2 Aug 20, 2024
aa5f935
Implement Chebyshev polynomials
davidwalter2 Aug 20, 2024
10d0b90
Small typo fix
davidwalter2 Aug 20, 2024
809252d
Dump narf
davidwalter2 Aug 20, 2024
944d023
Fix output file naming of postfit plotting script and add some option
davidwalter2 Aug 20, 2024
f2ef475
Merge branch 'main' of github.com:WMass/WRemnants
cippy Aug 20, 2024
93ed0cc
Merge branch 'main' of github.com:cippy/WRemnants
cippy Aug 20, 2024
b293c7b
Switch to chebyshev polynomial for smoothing and parameter variations…
davidwalter2 Aug 20, 2024
5148309
Change to Chebyshev polynomials also for plotting script
davidwalter2 Aug 20, 2024
322ab95
Try to allow scientific notation in plotting
kdlong Aug 20, 2024
ebc3457
Enable flow when swapping bins
davidwalter2 Aug 21, 2024
5e0b0c7
Fix plotting script; add option to filter processes in postfit plotti…
davidwalter2 Aug 21, 2024
fb3e487
Add new plotting scripts for validation of fake estimation
davidwalter2 Aug 21, 2024
b45675b
Update nuisance parameter grouping; small plotting script fixes
davidwalter2 Aug 21, 2024
76036ad
Fix bug in mass decorrelated fits where rebinning was bugged
davidwalter2 Aug 21, 2024
264293d
Small fix on plot_decorr_params script
davidwalter2 Aug 21, 2024
84be64a
Merge pull request #527 from davidwalter2/240820_fakeSmoothingPolynom…
bendavid Aug 21, 2024
812d96a
Merge branch 'main' of github.com:WMass/WRemnants into 240503_lineari…
davidwalter2 Aug 23, 2024
ae6efeb
Merge branch '240503_linearizedUnfolding' of github.com:davidwalter2/…
davidwalter2 Aug 23, 2024
8cbf695
Fix security issue in index.php
davidwalter2 Aug 23, 2024
92055c5
Merge pull request #529 from davidwalter2/240823_updIndexPHP
davidwalter2 Aug 24, 2024
4264245
Support to plot postfit noi variations; support for scintific notation
davidwalter2 Aug 25, 2024
5dee67c
Small fix in styles
davidwalter2 Aug 25, 2024
05236cb
Dump narf
davidwalter2 Aug 25, 2024
76d528f
some updates for plots and QCD studies
cippy Aug 25, 2024
76125a2
Merge branch 'main' of github.com:WMass/WRemnants
cippy Aug 25, 2024
4e2b4ac
add option to read pseudodata from fit input hdf5 file
bendavid Aug 25, 2024
f6769c2
make scaling and symmetrization of minnlo scale variations configurable
bendavid Aug 25, 2024
6b4da5b
set default value to avoid crashes
bendavid Aug 26, 2024
00884c1
apply qcd and pdfs to theory agnostic
emanca Aug 26, 2024
2ab5c36
plotting style changes
kdlong Aug 27, 2024
0c09ccf
Merge branch 'main' of github.com:WMass/WRemnants into 240503_lineari…
davidwalter2 Aug 27, 2024
a2fb3fb
Add new syst group with all experimental uncertainties except calibra…
davidwalter2 Aug 27, 2024
6e5b510
Revert changes in CMS decor position and scientific notations as thos…
davidwalter2 Aug 27, 2024
c541f11
Change command line arguments for disabling lower panel
davidwalter2 Aug 27, 2024
fb60752
Merge pull request #531 from bendavid/pseudodata_fitinput
davidwalter2 Aug 27, 2024
c2122b6
Merge branch 'plotting_format' of github.com:kdlong/WRemnants into 24…
davidwalter2 Aug 27, 2024
7f6f95e
Merge pull request #530 from davidwalter2/240825_updPlotting
davidwalter2 Aug 27, 2024
bcb2f2c
Fix scientific notation; harmonize font sizes
davidwalter2 Aug 27, 2024
cc0d2d6
Adapt new arguemtns in fix_axes function everywhere
davidwalter2 Aug 28, 2024
d827a3e
right symm for pdfs
emanca Aug 28, 2024
a9b09d4
fix use of eta and pt ranges specified on the command line
bendavid Aug 28, 2024
34fcec5
make massDiff and mass constraint options more flexible to allow more…
bendavid Aug 28, 2024
28c9433
Fix legend size; disable scintific notation for log scale plots; use …
davidwalter2 Aug 28, 2024
de930c0
Merge pull request #533 from bendavid/flexdiff
davidwalter2 Aug 28, 2024
41c996b
Adjust plotting CLAs
davidwalter2 Aug 29, 2024
e6538b1
tag to v10
emanca Aug 29, 2024
8fe1b80
updating wremnants-data with theory bands from v10
emanca Aug 29, 2024
c2d1279
point file to band ANv10 in wremnants-data
emanca Aug 29, 2024
5c8e5a3
updating wremnants-data
emanca Aug 29, 2024
314e908
synch wremnants-data once again
emanca Aug 29, 2024
ad53e14
latest changes in theory agnostic after review
emanca Aug 19, 2024
a1b5cb4
apply qcd and pdfs to theory agnostic
emanca Aug 26, 2024
6e795e0
right symm for pdfs
emanca Aug 28, 2024
29b2baf
tag to v10
emanca Aug 29, 2024
d4ab042
updating wremnants-data with theory bands from v10
emanca Aug 29, 2024
2447233
point file to band ANv10 in wremnants-data
emanca Aug 29, 2024
3f3b26b
updating wremnants-data
emanca Aug 29, 2024
f2ca2da
synch wremnants-data once again
emanca Aug 29, 2024
5d8e2f6
Merge branch 'normwtheo' of github.com:emanca/WRemnants into normwtheo
emanca Aug 29, 2024
43b8b84
cleanup wremnants/combine_theory_helper
emanca Aug 29, 2024
932a5a1
pointing wremnants-data to the right commit
emanca Aug 29, 2024
3cee808
Improve style
davidwalter2 Aug 29, 2024
88e5592
adding a few options to the dilepton histmakers
emanca Aug 31, 2024
cb4e9ea
removing the impact for the quark masses that was added by mistake
emanca Aug 31, 2024
b57d1e9
Merge pull request #534 from emanca/normwtheo
bendavid Aug 31, 2024
054c99a
Merge branch 'main' of github.com:WMass/WRemnants into 240827_updPlot…
davidwalter2 Sep 1, 2024
8b43588
Add option to draw vertical lines to separate makro bins in unrolled …
davidwalter2 Sep 2, 2024
5a45f82
Merge pull request #532 from davidwalter2/240827_updPlotting
davidwalter2 Sep 2, 2024
fa60a99
Merge branch 'main' of github.com:WMass/WRemnants into 240503_lineari…
davidwalter2 Sep 2, 2024
ecfbc6e
Fix plotting scripts
davidwalter2 Sep 3, 2024
ea57596
Revert temporary changes to plot fakes
davidwalter2 Sep 3, 2024
26e5bdb
Merge pull request #535 from davidwalter2/240903_fixPlottingScripts
davidwalter2 Sep 3, 2024
18103d3
Merge pull request #445 from davidwalter2/240503_linearizedUnfolding
davidwalter2 Sep 3, 2024
f61494f
adding shower kt uncertainty
emanca Sep 3, 2024
41f6bcd
Merge pull request #536 from emanca/normwtheo
bendavid Sep 7, 2024
f8fd927
small fixes to scripts
cippy Sep 9, 2024
08c7b12
Merge branch 'main' of github.com:WMass/WRemnants
cippy Sep 9, 2024
12566cc
updates to plot PU and Muon z distributions with/without vertex rewei…
cippy Sep 9, 2024
b6c7c9e
Polishing plots
davidwalter2 Sep 10, 2024
e22460c
Dump narf
davidwalter2 Sep 10, 2024
763bb50
Merge remote-tracking branch 'origin/main'
kdlong Sep 10, 2024
52f6ea3
Further plotting refinements
davidwalter2 Sep 10, 2024
ffa409a
Add postfit gen plots
kdlong Sep 10, 2024
a1a5d2e
Don't fuck with narf
kdlong Sep 10, 2024
2512580
Really don' fuck w narf
kdlong Sep 10, 2024
cf9e2aa
Update summary plot
kdlong Sep 10, 2024
e3515a4
Fix wrap_text for postfit plots; small style improvements; add option…
davidwalter2 Sep 11, 2024
80801f5
Merge branch 'summary_plots' of github.com:kdlong/WRemnants into 2409…
davidwalter2 Sep 11, 2024
1c9378f
Allow to define systematics from alternate histogram only (w/o variat…
davidwalter2 Sep 11, 2024
de3ed90
Fix legend for unfolded plots
davidwalter2 Sep 11, 2024
b56f08e
Merge pull request #537 from davidwalter2/240910_plotsPolishing
davidwalter2 Sep 12, 2024
f992048
Formatting for vgen plots
kdlong Sep 12, 2024
485fb82
Add results summary plot
kdlong Sep 12, 2024
b5a45b9
fix
cippy Sep 12, 2024
fbd6f47
fix in utility histogram
cippy Sep 12, 2024
2c84da1
Merge branch 'main' of github.com:cippy/WRemnants
cippy Sep 12, 2024
0e60a2d
Merge pull request #540 from kdlong/summary_plots
davidwalter2 Sep 12, 2024
8f90f40
More style polishing for paper plots
davidwalter2 Sep 12, 2024
123bc78
Merge branch 'main' of github.com:WMass/WRemnants into 240912_updPlots
davidwalter2 Sep 12, 2024
e47ab36
Support extra text for prefit/postfit label and chi2; adapt to new fo…
davidwalter2 Sep 13, 2024
b3ba09f
Dump narf
davidwalter2 Sep 13, 2024
7ee1eb3
Small fix for metadata
davidwalter2 Sep 13, 2024
abe0233
Changes to summary plot
kdlong Sep 14, 2024
2bd3da4
Fix smaller issues
davidwalter2 Sep 14, 2024
2a25398
Merge branch 'summary_plots' of https://github.com/kdlong/WRemnants i…
davidwalter2 Sep 14, 2024
432151b
Refine summary plot
davidwalter2 Sep 14, 2024
8fecc2b
Set wremnants-data back to most recent
davidwalter2 Sep 14, 2024
30ef246
Add extra text with selection (e.g. qmu=+1); style updates
davidwalter2 Sep 14, 2024
c32de0f
Dump narf
davidwalter2 Sep 14, 2024
61126e1
Merge pull request #539 from davidwalter2/240912_updPlots
davidwalter2 Sep 15, 2024
d3f7756
Small fixes for unfolding
davidwalter2 Sep 15, 2024
b4b9e67
Merge branch 'main' of github.com:WMass/WRemnants into 240913_unfolding
davidwalter2 Sep 15, 2024
79b3ab9
Small updates to summary plot
kdlong Sep 15, 2024
37439ef
Update summary plots
kdlong Sep 15, 2024
76fb19c
Back the other way
kdlong Sep 15, 2024
7dbe2bf
Update postfit_vgen plotting script
davidwalter2 Sep 16, 2024
f5be050
Add fudging mechanism for postfit plots; improve style for gen plots …
davidwalter2 Sep 16, 2024
1793448
Merge branch 'main' of github.com:WMass/WRemnants
cippy Sep 16, 2024
a6a9323
Small updates to summary plot
kdlong Sep 15, 2024
54e848e
Update summary plots
kdlong Sep 15, 2024
09c22b9
Back the other way
kdlong Sep 15, 2024
b090a46
Updates for TNP plotting
kdlong Sep 16, 2024
36ef823
foo
cippy Sep 16, 2024
d241f60
Merge branch 'main' of github.com:WMass/WRemnants
cippy Sep 16, 2024
13caaff
Further plotting updates
davidwalter2 Sep 17, 2024
64c0f75
utility scripts
cippy Sep 18, 2024
35eb99f
Merge branch 'main' of github.com:cippy/WRemnants
cippy Sep 18, 2024
2ecee9e
Add EW fit legend...
kdlong Sep 19, 2024
f3c1218
Another version...
kdlong Sep 20, 2024
3a2487f
Merge remote-tracking branch 'origin/summary_plots' into summary_plots
kdlong Sep 20, 2024
dce5dc9
update singularity image
bendavid Sep 20, 2024
63fc43c
Add more options to makeDataMCStackPlot script
davidwalter2 Sep 22, 2024
66ec118
Merge pull request #544 from WMass/singularity_v30
davidwalter2 Sep 22, 2024
49a0324
Merge pull request #543 from cippy/main
davidwalter2 Sep 22, 2024
8ce78a1
Merge branch 'main' of github.com:WMass/WRemnants into 240913_unfolding
davidwalter2 Sep 22, 2024
cd93e05
Fix response matrix plots
davidwalter2 Sep 22, 2024
39b8c32
Fix plotting command
davidwalter2 Sep 22, 2024
f798482
add Lambda_Correlated np model
bendavid Sep 22, 2024
16d2fa2
add Delta_Lambda_Correlated np model
bendavid Sep 22, 2024
a76ad91
Merge pull request #545 from bendavid/npcorrelated
davidwalter2 Sep 23, 2024
4b3ec71
updates
cippy Sep 25, 2024
a48eefe
Merge branch 'main' of github.com:WMass/WRemnants
cippy Sep 25, 2024
18f3c9c
Merge branch 'main' of github.com:WMass/WRemnants into 240913_unfolding
davidwalter2 Sep 26, 2024
fb95427
Summary plot updates
kdlong Sep 26, 2024
df79ad6
Merge branch 'summary_plots' of github.com:kdlong/WRemnants into 2409…
davidwalter2 Sep 26, 2024
95209dd
foo
cippy Sep 27, 2024
595c0b5
Merge branch 'main' of github.com:WMass/WRemnants
cippy Sep 27, 2024
de04935
merge from origin/main
cippy Sep 27, 2024
f16a10d
Fix handling of flow bins in plotting unfolded cross sections
davidwalter2 Sep 28, 2024
25cd944
Fix issue from merge
davidwalter2 Sep 28, 2024
bf0b693
update narf (technical updates to support newer root and tensorflow v…
bendavid Sep 28, 2024
e403d62
explicitly load required root library (needed for newer root versions)
bendavid Sep 28, 2024
e91554a
remove unnecessary escape to avoid warnings in newer python versions
bendavid Sep 28, 2024
e0a590d
Merge pull request #547 from bendavid/technical_updates
bendavid Sep 29, 2024
67bcd01
update singularity to v31
bendavid Sep 29, 2024
214f4fe
explicitly load missing libraries
bendavid Sep 29, 2024
f356721
more fixes to string escapes
bendavid Sep 29, 2024
a9f1d48
Remove exclude flow option and set flow bins properly
davidwalter2 Sep 30, 2024
bf75b7e
update singularity image to v34 (to fix ssh permissions issues)
bendavid Sep 30, 2024
bb7aa52
Merge pull request #542 from davidwalter2/240913_unfolding
bendavid Sep 30, 2024
fb2cec7
Merge pull request #548 from bendavid/singularity_v31
bendavid Sep 30, 2024
c36dda0
update narf (to fix axis template issue)
bendavid Oct 1, 2024
4713c27
Merge pull request #550 from bendavid/axisfix
davidwalter2 Oct 1, 2024
016523e
Adapt to new version of numpy and python to resolve warnings
davidwalter2 Oct 1, 2024
d87a8ee
Add isort linter
davidwalter2 Oct 1, 2024
6bc4da1
Add custom github pre-commit hooks and description
davidwalter2 Oct 1, 2024
0bedccc
Fix white spaces in files
davidwalter2 Oct 1, 2024
0cc9aad
Fix syntax errors and add syntax error check in pre-commit hooks
davidwalter2 Oct 1, 2024
6836c41
replace non-standard variable-length-arrays with std::vector
bendavid Oct 1, 2024
f7c749f
update narf (small technical fixes to go with updated ROOT build)
bendavid Oct 1, 2024
cf930ee
update singularity to v37 for updated ROOT build with cppyy error han…
bendavid Oct 1, 2024
d710110
update singularity to v38 (to add autoflake)
bendavid Oct 1, 2024
d823d98
Merge pull request #553 from bendavid/cppyy_error_handling
davidwalter2 Oct 2, 2024
3bac917
Add syntax check for .yaml files
davidwalter2 Oct 2, 2024
9609684
Merge branch 'main' of github.com:WMass/WRemnants into 241001_isort
davidwalter2 Oct 2, 2024
9b9e0a3
Run autoflake to remove unused imports (only from standard libraries)…
davidwalter2 Oct 2, 2024
7a0ddad
Fix c++ files to be pass syntax check; add c++ syntax check to pre-co…
davidwalter2 Oct 3, 2024
d999478
Modify pre-commit hook to not automatically add and commit
davidwalter2 Oct 4, 2024
512b965
Add back 'libHist' in init
davidwalter2 Oct 4, 2024
986c957
update plotting scripts, add histograms for vertex study or QCD MC ones
cippy Oct 4, 2024
c1d7a90
script to make plots for vertex efficiency
cippy Oct 4, 2024
a5c7a76
more features for QCD MC studies
cippy Oct 4, 2024
7d12040
Merge branch 'main' of github.com:WMass/WRemnants into addHistAndBugFix
cippy Oct 4, 2024
4c93f72
Merge pull request #554 from cippy/addHistAndBugFix
davidwalter2 Oct 5, 2024
99eccb5
Merge remote-tracking branch 'upstream/main'
kdlong Oct 5, 2024
1a78ca0
foo
cippy Oct 6, 2024
f7ab956
Merge branch 'main' of github.com:WMass/WRemnants
cippy Oct 6, 2024
6f84f57
Merge branch 'main' of github.com:WMass/WRemnants into 241001_isort
davidwalter2 Oct 9, 2024
89cea33
Apply style formatting
davidwalter2 Oct 9, 2024
c2ac000
Also remove unused imports from non standard libraries
davidwalter2 Oct 10, 2024
1177484
Adapt readme; Fixes
davidwalter2 Oct 10, 2024
489b1fe
Apply style format on cpp files
davidwalter2 Oct 10, 2024
2b4b164
Dump narf
davidwalter2 Oct 10, 2024
4a0bff7
Apply python and c/c++ style modifications
davidwalter2 Oct 10, 2024
556dd72
Add check for json files in pre-commit hook
davidwalter2 Oct 10, 2024
d2a1333
Add linting to github CI; more black formatting
davidwalter2 Oct 10, 2024
b4dd4cb
Exclude submodules in linting
davidwalter2 Oct 10, 2024
48d8358
Fix CI
davidwalter2 Oct 10, 2024
d3655a6
Remove all * imports and add it to the linters
davidwalter2 Oct 11, 2024
a092732
More checks with flake8
davidwalter2 Oct 11, 2024
43fff4f
Add local .gitconfig
davidwalter2 Oct 14, 2024
1baeb48
Update readme
davidwalter2 Oct 15, 2024
1ffad3b
Merge pull request #552 from davidwalter2/241001_isort
bendavid Oct 19, 2024
1e5dd23
Turn off region swapping in ABCD methods in case smoothing mode is di…
davidwalter2 Oct 29, 2024
29872b2
Run flake8 only on staged files
davidwalter2 Oct 29, 2024
7a75935
Exclude prompt muons in QCD MC
davidwalter2 Oct 29, 2024
038d027
Polish impact parameter plot
davidwalter2 Oct 29, 2024
51f40aa
Extend use of flake8 to cover cases with undefined variables
davidwalter2 Oct 29, 2024
edc0497
Update impact plots
davidwalter2 Oct 29, 2024
8afcb75
Further work on impact plots, fix various options
davidwalter2 Oct 30, 2024
fb1dab8
Move parsing functions into seperate file
davidwalter2 Oct 30, 2024
e4da799
Fix legend padding
davidwalter2 Oct 30, 2024
80cfe6a
Show numbers of impacts and other refinements on impact plots
davidwalter2 Oct 30, 2024
0573cfd
Add possibility to fit alphaS and sin2ThetaW
davidwalter2 Oct 31, 2024
c358fcb
Merge branch '241029_miscellaneous' of github.com:davidwalter2/WRemna…
davidwalter2 Oct 31, 2024
48810f7
Merge branch 'main' of github.com:WMass/WRemnants
kdlong Oct 31, 2024
803c297
Merge pull request #555 from davidwalter2/241029_miscellaneous
bendavid Oct 31, 2024
15ecef9
Merge branch 'main' of github.com:WMass/WRemnants into 241031_sin2ThetaW
davidwalter2 Nov 1, 2024
0f52320
Fix for adding back total impact in grouped impacts when showing numb…
davidwalter2 Nov 1, 2024
fd45c3f
automatic deletion of old kerberos credentials
davidwalter2 Nov 4, 2024
7716ec1
Delete old kerberos credentials in cleanup workflow
davidwalter2 Nov 4, 2024
5d6a870
Run ptll-yll alphaS fit in CI; Reblind ptll fit
davidwalter2 Nov 1, 2024
1d204ce
Merge branch 'main' of github.com:WMass/WRemnants
cippy Nov 5, 2024
7c68f3d
Merge pull request #557 from davidwalter2/main
kdlong Nov 5, 2024
f2fc642
Merge pull request #556 from davidwalter2/241101_alphaS
kdlong Nov 5, 2024
72da6d3
Steps towards double ratio, fix MIT html
kdlong Nov 6, 2024
b7c7066
Make legend padding configurable, some style improvements
davidwalter2 Nov 6, 2024
b8e1093
Working version of double ratios
kdlong Nov 6, 2024
023f512
fix for ploting scripts
cippy Nov 6, 2024
6ef749d
Merge branch 'main' of github.com:WMass/WRemnants into fixPR
cippy Nov 6, 2024
2c04f5c
remove test change
cippy Nov 6, 2024
3936719
Merge branch 'genPtllPlot' of https://github.com/kdlong/WRemnants
davidwalter2 Nov 6, 2024
8fe3d1e
fix
cippy Nov 7, 2024
e83a580
another fix
cippy Nov 7, 2024
812d208
test
cippy Nov 7, 2024
f32618a
Fix event number tables in log files
davidwalter2 Nov 6, 2024
0078fe1
fix
davidwalter2 Nov 8, 2024
be4d3be
Polish paper plots
davidwalter2 Nov 8, 2024
189aa48
Merge pull request #559 from cippy/fixPR
davidwalter2 Nov 9, 2024
fac76a0
Merge branch 'main' of github.com:WMass/WRemnants
davidwalter2 Nov 9, 2024
2690829
Polish pdf summary plot and others; fix parsing
davidwalter2 Nov 9, 2024
e2c6193
Polish mass decorr plots
davidwalter2 Nov 9, 2024
eadbe9e
Further refinements on plotting scripts; Implement marcos comments
davidwalter2 Nov 11, 2024
75d64a0
Merge pull request #560 from davidwalter2/main
kdlong Nov 11, 2024
7dcb223
Merge remote-tracking branch 'upstream/main'
kdlong Nov 15, 2024
55262f4
Some parameter renaming and changes for the impact plots
kdlong Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[core]
hooksPath = .githooks
128 changes: 128 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/bin/bash
# This pre-commit hook fixes whitespace issues and formats Python files

# Exit if any command fails
set -e

# Trap the EXIT signal to print the last executed command when the script exits
trap 'echo "Error on line $LINENO: $BASH_COMMAND" >&2' ERR


# Find all staged c++ files
STAGED_FILES_CPP=$(git diff --cached --name-only --diff-filter=d | grep -E '\.(c|cpp|h|hpp)$' || true)

for FILE in $STAGED_FILES_CPP; do
clang++ -I./narf/narf/include/ -I./wremnants/include/ -std=c++20 -fsyntax-only $FILE
if [ $? -ne 0 ]; then
echo "Syntax error in $FILE. Commit aborted."
exit 1
fi
done


# Find all staged YAML files
STAGED_FILES_YAML=$(git diff --cached --name-only --diff-filter=d | grep -E '\.ya?ml$' || true)

# Check syntax of each YAML file
for FILE in $STAGED_FILES_YAML; do
python -c "import yaml, sys; yaml.safe_load(open('$FILE'))"
if [ $? -ne 0 ]; then
echo "Syntax error in $FILE. Commit aborted."
exit 1
fi
done


# Find all staged json files
STAGED_FILES_JSON=$(git diff --cached --name-only --diff-filter=d | grep -E '\.json$' || true)

# Check syntax of each json file
for FILE in $STAGED_FILES_JSON; do
python -m json.tool $FILE > /dev/null
if [ $? -ne 0 ]; then
echo "Syntax error in $FILE. Commit aborted."
exit 1
fi
done


# Find all staged Python files
STAGED_FILES_PY=$(git diff --cached --name-only --diff-filter=d | grep -E '\.py$' || true)

# Check for syntax errors in each staged Python file
for FILE in $STAGED_FILES_PY; do
# Use python's compile command to check for syntax errors
python -m py_compile "$FILE"

# Check the exit status of the previous command
if [ $? -ne 0 ]; then
echo "Syntax error in $FILE. Commit aborted."
exit 1
fi
done


# apply style modifications on staged files
unset MODIFIED_FILES

# Loop through each staged c/c++ files and fix style issues
for FILE in $STAGED_FILES_CPP; do
# apply LLVM style
clang-format -i "$FILE"

# Check if the file was modified compared to the staged version
if ! git diff --quiet "$FILE"; then
# Track the modified files
MODIFIED_FILES+=("$FILE")
fi

done


# Loop through each staged Python file and fix style issues
for FILE in $STAGED_FILES_PY; do

# Remove unused imports
autoflake --in-place --expand-star-imports --remove-all-unused-imports "$FILE" --exclude=narf,wremnants-data

# Run isort to organize imports
isort "$FILE" --skip narf --skip wremnants-data --profile black --line-length 88

# PEP 8 formatting
black "$FILE"

# Check if the file was modified compared to the staged version
if ! git diff --quiet "$FILE"; then
# Track the modified files
MODIFIED_FILES+=("$FILE")
fi

flake8 $FILE --select=F401,F402,F403,F404,F405,F406,F407,F601,F602,F621,F622,F631,F632,F633,F634,F701,F702,F704,F706,F707,F721,F722,F723,F821,F822,F823,F831,F901 --max-line-length 88

done


# Check the exit status of flake8
if [ $? -ne 0 ]; then
echo "flake8 found issues. Commit aborted."
exit 1 # Abort the commit
fi


if [ -n "$STAGED_FILES_PY" ]; then
# give a code rating of python files
pylint $STAGED_FILES_PY | grep 'Your code has been rated at'
fi


# Notify the user if any files were modified
if [ ${#MODIFIED_FILES[@]} -gt 0 ]; then
echo "The following files were modified and need to be re-staged:"
for FILE in "${MODIFIED_FILES[@]}"; do
echo " $FILE"
done
echo "Please review the changes and manually add the modified files to the staging area."
exit 1
fi

exit 0
38 changes: 38 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: EOS Cleanup
on:
schedule:
- cron: '0 3 * * 0' # Run on Sunday morning at 3h00 UTC
workflow_dispatch:

env:
EOS_DIR: /eos/user/c/cmsmwbot/

jobs:
cleanup:
runs-on: [self-hosted, linux, x64]

# delete old folders, keep the 5 newest ones
steps:
- name: delete old kerberos credentials
run: |
FILE_PATH="/tmp/krb5cc_158524"
if [ -f "$FILE_PATH" ]; then
echo "Delete $FILE_PATH and create new one"
rm "$FILE_PATH"
else
echo "File $FILE_PATH does not yet exist, create it."
fi

- name: setup kerberos
run: |
kinit -kt ~/private/.keytab cmsmwbot@CERN.CH
klist -k -t -e ~/private/.keytab
klist
echo "xrdfs root://eosuser.cern.ch// ls $EOS_DIR"
xrdfs root://eosuser.cern.ch// ls $EOS_DIR

- name: cleanup main
run: scripts/ci/cleanup_directory.sh $EOS_DIR/ScheduledBuilds/ 5

- name: cleanup unfolding
run: scripts/ci/cleanup_directory.sh $EOS_DIR/ScheduledBuilds_unfolding/ 5
Loading