Skip to content

Commit

Permalink
Merge branch 'HEP-FCC:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bistapf authored Apr 19, 2023
2 parents b81129e + 1c4fb94 commit 4b70ddc
Show file tree
Hide file tree
Showing 74 changed files with 9,605 additions and 4,100 deletions.
149 changes: 149 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
...

29 changes: 29 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: clang-format

on: [push, pull_request]

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: cvmfs-contrib/github-action-cvmfs@v2
- name: Start container
run: |
docker run -it --name CI_container -v ${GITHUB_WORKSPACE}:/Package -v /cvmfs:/cvmfs:shared -d ghcr.io/aidasoft/centos7:latest /bin/bash
- name: Add upstream
run: |
docker exec CI_container /bin/bash -c 'cd ./Package
git remote add upstream https://github.com/HEP-FCC/FCCAnalyses.git
git fetch upstream'
- name: Run formatter
run: |
docker exec CI_container /bin/bash -c 'cd ./Package
source /cvmfs/sft.cern.ch/lcg/contrib/clang/14.0.6/x86_64-centos7/setup.sh
git clang-format --style=file $(git merge-base upstream/master HEAD)'
- name: Check cleanliness
run: |
docker exec CI_container /bin/bash -c 'cd ./Package
git diff'
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ MANIFEST

# Output
outputs/
BatchOutputs/

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -96,3 +97,6 @@ venv.bak/

# Benchmarking
benchmark*json

# Local configuration
.fccana/*
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"creators": [
{
"affiliation": "CERN",
"affiliation": "Ecole Polytechnique Fédérale de Lausanne",
"name": "Helsens, Clement",
"orcid": "0000-0002-9243-7554"
},
Expand Down
31 changes: 14 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include(CTest)
#--- options ------------------------------------------------------------------


set(WITH_ACTS AUTO CACHE STRING "Build analyzers that need Acts")
set(WITH_ACTS OFF CACHE STRING "Build analyzers that need Acts")
set_property(CACHE WITH_ACTS PROPERTY STRINGS AUTO ON OFF)

set(WITH_DD4HEP AUTO CACHE STRING "Build analyzers that need DD4hep")
Expand Down Expand Up @@ -62,6 +62,8 @@ find_package(podio)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
find_package(FastJet)

find_package( Delphes REQUIRED )


if(WITH_ACTS)
find_package( Acts COMPONENTS Core )
Expand All @@ -88,6 +90,17 @@ if(WITH_DD4HEP)
endif()
endif()

if(WITH_ONNX)
find_package(ONNXRuntime)
if(ONNXRuntime_FOUND)

elseif(WITH_ONNX STREQUAL AUTO)
message(WARNING "ONNXRuntime not found. Skipping ONNX-dependent analyzers.")
set(WITH_ONNX OFF)
else()
message(FATAL_ERROR "Failed to locate ONNXRuntime!")
endif()
endif()

if(WITH_ONNX AND BUILD_TESTING) # currently these files are only needed by ONNX-parts
# Grab the test files into a cached directory
Expand Down Expand Up @@ -122,22 +135,6 @@ file(GLOB _run_python_files config/*.py)
install(FILES ${_run_python_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/python/config)
install(FILES config/doPlots.py PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${CMAKE_INSTALL_PREFIX}/python/config)

#--- Awkward setup ------------------------------------------------------------

execute_process(COMMAND python -m awkward.config --incdir OUTPUT_VARIABLE _AWKWARD_INCLUDE OUTPUT_STRIP_TRAILING_WHITESPACE)
set(AWKWARD_INCLUDE ${_AWKWARD_INCLUDE})
execute_process(COMMAND python -m awkward.config --libdir OUTPUT_VARIABLE _AWKWARD_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
set(AWKWARD_LIBRARIES ${_AWKWARD_LIBRARIES})

include_directories(BEFORE "${AWKWARD_INCLUDE}")

find_library(CPU-KERNELS awkward-cpu-kernels REQUIRED HINTS ${AWKWARD_LIBRARIES})
find_library(LIBAWKWARD awkward REQUIRED HINTS ${AWKWARD_LIBRARIES})
find_library(LIBDL dl REQUIRED)

message(STATUS "Libraries: ${CPU-KERNELS} ${LIBAWKWARD} ${LIBDL}")
message(STATUS "includes--------------------- main: ${AWKWARD_INCLUDE}")
message(STATUS "Library---------------------- main: ${AWKWARD_LIBRARIES}")

#--- Descend into subdirectories ----------------------------------------------

Expand Down
66 changes: 57 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ files and producing the plots.
>
> To have access to the FCC samples, you need to be subscribed to one of the
> following e-groups (with owner approval) `fcc-eos-read-xx` with `xx=ee,hh,eh`.
> For the time being, the configuration files are accessible on `fccsw` public
> AFS. This is not optimal and will be changed in the future with migration to DIRAC, thus you are
> also kindly asked to contact `[email protected]`, `[email protected]`, `clement.helsens@cern.ch` and request access to
> `/afs/cern.ch/work/f/fccsw/public/FCCDicts/`.
>
> The configuration files are accessible at `/afs/cern.ch/work/f/fccsw/public/FCCDicts/` with a mirror at `/cvmfs/fcc.cern.ch/FCCDicts/`.
> For accessing/reading information about existing datasets you do not need special rights.
> However, if you need new datasets, you are invited to contact `[email protected]`, `[email protected]` or `juraj.smiesko@cern.ch`
> who will explian the procedure, including granting the required access, where relevant.
>
Detailed code documentation can be found
[here](http://hep-fcc.github.io/FCCAnalyses/doc/latest/index.html).
Expand All @@ -31,6 +31,8 @@ Detailed code documentation can be found
* [Pre-selection](#pre-selection)
* [Final selection](#final-selection)
* [Plotting](#plotting)
* [Contributing](#contributing)
* [Formating](#code-formating)


## RootDataFrame based
Expand All @@ -46,9 +48,18 @@ ROOT dataframe documentation is available

## Getting started

In order to use the FCC analysers within ROOT dataframe, a dictionary needs to
be built and put into `LD_LIBRARY_PATH` (this happens in `setup.sh`). The
following needs to be done when running local code and for developers.
In order to use the FCC analyzers within ROOT RDataFrame, a dictionary needs to
be built and put into `LD_LIBRARY_PATH`. In order to build and load FCCAnalyses
with default options one needs to run following two commands:

```shell
source ./setup.sh
fccanalysis build
```

The FCCAnalyses is a CMake based project and any customizations can be provided
in classic CMake style, the following commands are equivalent to default version
of FCCAnalyses:

```shell
source ./setup.sh
Expand All @@ -63,6 +74,21 @@ cd ..
> Each time changes are made in the C++ code, for example in
> `analyzers/dataframe/` please do not forget to re-compile :)
>
> To cleanly recompile the default version of FCCAnalyses one can use
> `fccanalysis build --clean-build`.
In order to provide the possibility to keep developing an analysis with well
defined Key4hep stack, the sub-command `fccanalysis pin` is provided. One can
pin his/her analysis with
```
source setup.sh
fccanalysis pin
```

To remove the pin run
```
fccanalysis pin --clear
```


## Generalities
Expand Down Expand Up @@ -120,7 +146,7 @@ where `p8_ee_ZH_ecm240` should match an existing sample in the database,
of output files) and `output` in case you need to change the name of the output
file (please note that then the sample will not be matched in the database for
`finalSel.py` histograms normalisation). The other parameters are explained in
[the example file](https://github.com/HEP-FCC/FCCAnalyses/tree/master/example/FCCee/higgs/mH-recoil/analysis_stage1.py).
[the example file](https://github.com/HEP-FCC/FCCAnalyses/blob/master/examples/FCCee/higgs/mH-recoil/mumu/analysis_stage1.py).

To run the pre-selection stage of the example analysis run:

Expand Down Expand Up @@ -195,3 +221,25 @@ Resulting plots will be located the `outdir` defined in the analysis file.

In an attempt to ease the development of new physics case studies, such as for the [FCCee physics performance](https://github.com/HEP-FCC/FCCeePhysicsPerformance) cases, a new experimental analysis package creation tool is introduced.
[See here](case-studies/README.md) for more details.


## Contributing

### Code formating

The preferred style of the C++ code in the FCCAnalyses is LLVM which is checked
by CI job.

Currently `clang-format` is not available in the Key4hep stack, but one can
obtain a suitable version of it from CVMFS thanks to LCG:
```
source /cvmfs/sft.cern.ch/lcg/contrib/clang/14.0.6/x86_64-centos7/setup.sh
```

Then to apply formatting to a given file:
```
clang-format -i -style=file /path/to/file.cpp
```

Another way to obtain a recent version of `clang-format` is through downloading
[Key4hep Spack instance](https://key4hep.github.io/key4hep-doc/spack-build-instructions-for-librarians/spack-setup.html#downloading-a-spack-instance).
Loading

0 comments on commit 4b70ddc

Please sign in to comment.