Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pre-commit

on: [push, pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cvmfs-contrib/github-action-cvmfs@v4
- uses: aidasoft/run-lcg-view@v4
with:
container: el9
view-path: /cvmfs/sw-nightlies.hsf.org/key4hep
run: |
python -m venv /root/pre-commit-venv
source /root/pre-commit-venv/bin/activate
pip install pre-commit
export PYTHONPATH=$VIRTUAL_ENV/lib/python3.$(python3 -c 'import sys; print(f"{sys.version_info[1]}")')/site-packages:$PYTHONPATH
# Newer versions of git are more cautious around the github runner
# environment and without this git rev-parse --show-cdup in pre-commit
# fails
git config --global --add safe.directory $(pwd)
pre-commit run --show-diff-on-failure \
--color=always \
--all-files
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: local
hooks:
- id: ruff-format
name: ruff-format
entry: ruff format --force-exclude
types: [python]
language: system
- id: ruff-isort
name: ruff-isort
entry: ruff check --select I --fix --force-exclude
types: [python]
language: system
10 changes: 10 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target-version = "py311"

line-length = 99
Comment thread
tmadlener marked this conversation as resolved.

[format]
# Make things format the same way as black
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
1 change: 0 additions & 1 deletion StandardConfig/production/CaloDigi/FcalDigi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from Configurables import MarlinProcessorWrapper


MySimpleBCalDigi = MarlinProcessorWrapper("MySimpleBCalDigi")
MySimpleBCalDigi.ProcessorType = "SimpleFCalDigi"
MySimpleBCalDigi.Parameters = {
Expand Down
8 changes: 2 additions & 6 deletions StandardConfig/production/CaloDigi/SiWEcalDigi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

from Configurables import MarlinProcessorWrapper

MergeCollectionsEcalBarrelHits = MarlinProcessorWrapper(
"MergeCollectionsEcalBarrelHits"
)
MergeCollectionsEcalBarrelHits = MarlinProcessorWrapper("MergeCollectionsEcalBarrelHits")
MergeCollectionsEcalBarrelHits.ProcessorType = "MergeCollections"
MergeCollectionsEcalBarrelHits.Parameters = {
"InputCollections": ["ECalBarrelSiHitsEven", "ECalBarrelSiHitsOdd"],
"OutputCollection": ["EcalBarrelCollection"],
}

MergeCollectionsEcalEndcapHits = MarlinProcessorWrapper(
"MergeCollectionsEcalEndcapHits"
)
MergeCollectionsEcalEndcapHits = MarlinProcessorWrapper("MergeCollectionsEcalEndcapHits")
MergeCollectionsEcalEndcapHits.ProcessorType = "MergeCollections"
MergeCollectionsEcalEndcapHits.Parameters = {
"InputCollections": ["ECalEndcapSiHitsEven", "ECalEndcapSiHitsOdd"],
Expand Down
8 changes: 2 additions & 6 deletions StandardConfig/production/HighLevelReco/HighLevelReco.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"PFOCollectionName": ["PandoraPFOs"],
}

MyComputeShowerShapesProcessor = MarlinProcessorWrapper(
"MyComputeShowerShapesProcessor"
)
MyComputeShowerShapesProcessor = MarlinProcessorWrapper("MyComputeShowerShapesProcessor")
MyComputeShowerShapesProcessor.ProcessorType = "ComputeShowerShapesProcessor"
MyComputeShowerShapesProcessor.Parameters = {
"ClusterCollectionName": ["PandoraClusters"],
Expand Down Expand Up @@ -291,9 +289,7 @@
"BuildUpVertexCollectionName": ["BuildUpVertex"],
"PFOCollection": ["PandoraPFOs"],
"PrimaryVertexCollectionName": ["PrimaryVertex"],
"PrimaryVertexFinder.BeamspotConstraint": [
cms_energy_config["LCFIPlusBeamspotConstraint"]
],
"PrimaryVertexFinder.BeamspotConstraint": [cms_energy_config["LCFIPlusBeamspotConstraint"]],
"PrimaryVertexFinder.BeamspotSmearing": ["0"],
"PrimaryVertexFinder.Chi2Threshold": ["25."],
"PrimaryVertexFinder.TrackMaxD0": ["20."],
Expand Down
32 changes: 8 additions & 24 deletions StandardConfig/production/ILDReconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ def get_cms_energy_config(
geoSvc.EnableGeant4Geo = False
svcList.append(geoSvc)

is_FCCee_model, cms_e, cms_energy_config = get_cms_energy_config(
compact_file, reco_args.cmsEnergy
)
is_FCCee_model, cms_e, cms_energy_config = get_cms_energy_config(compact_file, reco_args.cmsEnergy)
CONSTANTS = {
"CMSEnergy": str(cms_e),
"BeamCalCalibrationFactor": str(reco_args.beamCalCalibFactor),
Expand Down Expand Up @@ -303,9 +301,7 @@ def get_cms_energy_config(
"BCalCollections": ["BCAL"],
"BCalCollectionsSimCaloHit": ["BeamCalCollection"],
"CollectCalibrationDetails": ["0"],
"ECalBarrelCollectionsSimCaloHit": [
CONSTANTS["ECalBarrelSimHitCollections"]
],
"ECalBarrelCollectionsSimCaloHit": [CONSTANTS["ECalBarrelSimHitCollections"]],
"ECalCollections": [
"EcalBarrelCollectionRec",
"EcalBarrelCollectionGapHits",
Expand All @@ -314,21 +310,15 @@ def get_cms_energy_config(
"EcalEndcapRingCollectionRec",
],
"ECalCollectionsSimCaloHit": [CONSTANTS["ECalSimHitCollections"]],
"ECalEndCapCollectionsSimCaloHit": [
CONSTANTS["ECalEndcapSimHitCollections"]
],
"ECalEndCapCollectionsSimCaloHit": [CONSTANTS["ECalEndcapSimHitCollections"]],
"ECalOtherCollectionsSimCaloHit": [CONSTANTS["ECalRingSimHitCollections"]],
"HCalBarrelCollectionsSimCaloHit": [
CONSTANTS["HCalBarrelSimHitCollections"]
],
"HCalBarrelCollectionsSimCaloHit": [CONSTANTS["HCalBarrelSimHitCollections"]],
"HCalCollections": [
"HcalBarrelCollectionRec",
"HcalEndcapsCollectionRec",
"HcalEndcapRingCollectionRec",
],
"HCalEndCapCollectionsSimCaloHit": [
CONSTANTS["HCalEndcapSimHitCollections"]
],
"HCalEndCapCollectionsSimCaloHit": [CONSTANTS["HCalEndcapSimHitCollections"]],
"HCalOtherCollectionsSimCaloHit": [CONSTANTS["HCalRingSimHitCollections"]],
"LCalCollections": ["LCAL"],
"LCalCollectionsSimCaloHit": ["LumiCalCollection"],
Expand All @@ -352,9 +342,7 @@ def get_cms_energy_config(

# Make sure that all collections are always available by patching in missing
# ones on-the-fly
collPatcherRec = MarlinProcessorWrapper(
"CollPatcherREC", ProcessorType="PatchCollections"
)
collPatcherRec = MarlinProcessorWrapper("CollPatcherREC", ProcessorType="PatchCollections")
collPatcherRec.Parameters = {
"PatchCollections": parse_collection_patch_file(REC_COLLECTION_CONTENTS_FILE)
}
Expand All @@ -365,9 +353,7 @@ def get_cms_energy_config(
output_commands.extend(get_drop_collections(CONSTANTS, True))
# get_drop_collections incorrectly splits "type edm4hep::..." into two separate drops
output_commands.append("drop type edm4hep::RecDqdxCollection")
io_handler.add_edm4hep_writer(
f"{reco_args.outputFileBase}_REC.edm4hep.root", output_commands
)
io_handler.add_edm4hep_writer(f"{reco_args.outputFileBase}_REC.edm4hep.root", output_commands)


if reco_args.lcioOutput in ("on", "only"):
Expand Down Expand Up @@ -419,9 +405,7 @@ def get_cms_energy_config(
svcList.append(auditorSvc)
auditorSvc.Auditors = [AlgTimingAuditor()]

app_mgr = ApplicationMgr(
TopAlg=algList, EvtSel="NONE", EvtMax=3, ExtSvc=svcList, OutputLevel=INFO
)
app_mgr = ApplicationMgr(TopAlg=algList, EvtSel="NONE", EvtMax=3, ExtSvc=svcList, OutputLevel=INFO)

app_mgr.AuditAlgorithms = True
app_mgr.AuditTools = True
Expand Down
4 changes: 1 addition & 3 deletions StandardConfig/production/Tracking/TrackingDigi.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
],
}

VXDPlanarDigiProcessor_CMOSVXD5 = MarlinProcessorWrapper(
"VXDPlanarDigiProcessor_CMOSVXD5"
)
VXDPlanarDigiProcessor_CMOSVXD5 = MarlinProcessorWrapper("VXDPlanarDigiProcessor_CMOSVXD5")
VXDPlanarDigiProcessor_CMOSVXD5.ProcessorType = "DDPlanarDigiProcessor"
VXDPlanarDigiProcessor_CMOSVXD5.Parameters = {
"ForceHitsOntoSurface": ["true"],
Expand Down
4 changes: 1 addition & 3 deletions StandardConfig/production/Tracking/TrackingDigi_FCCeeMDI.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
"TrackerHitCollectionName": ["InnerTrackerBarrelHits"],
}

InnerEndcapPlanarDigiProcessor = MarlinProcessorWrapper(
"InnerEndcapPlanarDigiProcessor"
)
InnerEndcapPlanarDigiProcessor = MarlinProcessorWrapper("InnerEndcapPlanarDigiProcessor")
InnerEndcapPlanarDigiProcessor.ProcessorType = "DDPlanarDigiProcessor"
InnerEndcapPlanarDigiProcessor.Parameters = {
"IsStrip": ["false"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3

from Configurables import MarlinProcessorWrapper

from py_utils import encode_CT_steps_dict_to_legacy_list

CT_MAX_DIST = "0.03" # RANDOM VALUE COPYIED FROM CLDRECO
Expand Down
Loading
Loading