diff --git a/.github/workflows/build_unittest_container.yml b/.github/workflows/build_unittest_container.yml new file mode 100644 index 00000000..254543db --- /dev/null +++ b/.github/workflows/build_unittest_container.yml @@ -0,0 +1,45 @@ +# CI step to build the unittest container to be used for the other CI steps +# publish the container in the github container registry + +name: Checks + +# This workflow should only run when the Dockerfile changes +on: + push: + paths: + - docker/Dockerfile + pull_request: + paths: + - docker/Dockerfile +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-crown-unittest + +jobs: + build_unittest_container: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + file: docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0a74f611..95bc5186 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -25,28 +25,12 @@ env: jobs: build_project: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 container: - image: rootproject/root:6.28.10-ubuntu22.04 + image: ghcr.io/kit-cms/crown-crown-unittest:pr-260 options: --user 0 # run as root steps: - # - name: update Arch keyring - # run: pacman -Sc --noconfirm && pacman -Syy --noconfirm && pacman -Sy archlinux-keyring --noconfirm - - # - name: Install missing software - # run: pacman -Syu --noconfirm cmake make git python-pip openmp openmpi boost openssh --ignore root --ignore openssl - - # - name: Install python packages - # run: python -m pip install GitPython --break-system-packages && python -m pip install git+https://github.com/cms-nanoAOD/correctionlib.git --break-system-packages - - - name: update ubuntu - run: apt-get -y update - - name: install packages - run: apt-get install -y git cmake make python3-pip openmpi-bin libopenmpi-dev libboost-all-dev openssh-client - - name: install python packages - run: python3 -m pip install GitPython && python3 -m pip install git+https://github.com/cms-nanoAOD/correctionlib.git - - name: Clone project uses: actions/checkout@v3 with: @@ -64,7 +48,7 @@ jobs: - name: Configure CMake shell: bash - run: cd ${{github.workspace}}/build && cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DANALYSIS=$ANALYSIS -DCONFIG=$CONFIG -DSAMPLES=$SAMPLES -DERAS=$ERAS -DSCOPES=$SCOPES -DSHIFTS=$SHIFTS -DOPTIMIZED=false + run: cd ${{github.workspace}}/build && cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DANALYSIS=$ANALYSIS -DCONFIG=$CONFIG -DSAMPLES=$SAMPLES -DERAS=$ERAS -DSCOPES=$SCOPES -DSHIFTS=$SHIFTS -DOPTIMIZED=false -DONNXRUNTIME_INCLUDE_DIR=/opt/onnxruntime - name: Build shell: bash @@ -75,21 +59,12 @@ jobs: run: cd ${{github.workspace}}/build && ctest -V --label-regex "ntuple.*." build_single_friend: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 container: - image: rootproject/root:6.28.04-arch + image: ghcr.io/kit-cms/crown-crown-unittest:pr-260 options: --user 0 # run as root steps: - - name: update Arch keyring - run: pacman -Sc --noconfirm && pacman -Syy --noconfirm && pacman -Sy archlinux-keyring --noconfirm - - - name: Install missing software - run: pacman -Syu --noconfirm cmake make git python-pip openmp openmpi boost openssh --ignore root --ignore openssl - - - - name: Install python packages - run: python -m pip install GitPython --break-system-packages && python -m pip install git+https://github.com/cms-nanoAOD/correctionlib.git --break-system-packages - name: Clone project uses: actions/checkout@v3 @@ -108,7 +83,7 @@ jobs: - name: Configure CMake shell: bash - run: cd ${{github.workspace}}/build && cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DANALYSIS=$ANALYSIS -DCONFIG=$SINGLE_FRIEND_CONFIG -DSAMPLES=$SAMPLES -DERAS=$ERAS -DSCOPES=$SINGLE_FRIEND_SCOPES -DSHIFTS=$FRIEND_SHIFTS -DOPTIMIZED=false -DQUANTITIESMAP="dummy" + run: cd ${{github.workspace}}/build && cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DANALYSIS=$ANALYSIS -DCONFIG=$SINGLE_FRIEND_CONFIG -DSAMPLES=$SAMPLES -DERAS=$ERAS -DSCOPES=$SINGLE_FRIEND_SCOPES -DSHIFTS=$FRIEND_SHIFTS -DOPTIMIZED=false -DQUANTITIESMAP="dummy" -DONNXRUNTIME_INCLUDE_DIR=/opt/onnxruntime - name: Build shell: bash @@ -119,22 +94,12 @@ jobs: run: cd ${{github.workspace}}/build && ctest -V --label-regex "single_friend.*." build_two_friends: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 container: - image: rootproject/root:6.28.04-arch + image: ghcr.io/kit-cms/crown-crown-unittest:pr-260 options: --user 0 # run as root steps: - - name: update Arch keyring - run: pacman -Sc --noconfirm && pacman -Syy --noconfirm && pacman -Sy archlinux-keyring --noconfirm - - - name: Install missing software - run: pacman -Syu --noconfirm cmake make git python-pip openmp openmpi boost openssh --ignore root --ignore openssl - - - - name: Install python packages - run: python -m pip install GitPython --break-system-packages && python -m pip install git+https://github.com/cms-nanoAOD/correctionlib.git --break-system-packages - - name: Clone project uses: actions/checkout@v3 with: @@ -152,7 +117,7 @@ jobs: - name: Configure CMake shell: bash - run: cd ${{github.workspace}}/build && cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DANALYSIS=$ANALYSIS -DCONFIG=$TWO_FRIENDS_CONFIG -DSAMPLES=$SAMPLES -DERAS=$ERAS -DSCOPES=$TWO_FRIENDS_SCOPES -DSHIFTS=$FRIEND_SHIFTS -DOPTIMIZED=false -DQUANTITIESMAP="dummy" + run: cd ${{github.workspace}}/build && cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DANALYSIS=$ANALYSIS -DCONFIG=$TWO_FRIENDS_CONFIG -DSAMPLES=$SAMPLES -DERAS=$ERAS -DSCOPES=$TWO_FRIENDS_SCOPES -DSHIFTS=$FRIEND_SHIFTS -DOPTIMIZED=false -DQUANTITIESMAP="dummy" -DONNXRUNTIME_INCLUDE_DIR=/opt/onnxruntime - name: Build shell: bash @@ -164,9 +129,9 @@ jobs: python_format: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 container: - image: rootproject/root:6.26.00-ubuntu20.04 + image: ghcr.io/kit-cms/crown-crown-unittest:pr-260 options: --user 0 # run as root steps: @@ -183,9 +148,9 @@ jobs: run: cd $GITHUB_WORKSPACE && bash checks/python-formatting.sh cpp_format: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 container: - image: rootproject/root:6.26.00-ubuntu20.04 + image: ghcr.io/kit-cms/crown-crown-unittest:pr-260 options: --user 0 # run as root steps: @@ -202,9 +167,9 @@ jobs: run: cd $GITHUB_WORKSPACE && bash checks/cpp-formatting.sh docs: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 container: - image: rootproject/root:6.26.00-ubuntu20.04 + image: ghcr.io/kit-cms/crown-crown-unittest:pr-260 options: --user 0 # run as root steps: diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 6801a0a4..53eb14b2 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -5,12 +5,18 @@ # Required version: 2 +# Set the OS, Python version and other tools you might need + +build: + os: ubuntu-22.04 + tools: + python: "3.10" + # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/sphinx_source/conf.py # Optionally set the version of Python and requirements required to build your docs python: - version: 3.8 install: - requirements: docs/sphinx_source/requirements.txt diff --git a/analysis_configurations/unittest/producers/genparticles.py b/analysis_configurations/unittest/producers/genparticles.py index 29a17910..734d9e7d 100644 --- a/analysis_configurations/unittest/producers/genparticles.py +++ b/analysis_configurations/unittest/producers/genparticles.py @@ -197,7 +197,7 @@ name="gen_match_2", call="quantities::tau::genmatch({df}, {output}, 1, {input})", input=[q.dileptonpair, nanoAOD.Tau_genMatch], - output=[q.gen_match_2], + output=[q.tau_gen_match_2], scopes=["mt", "et", "tt"], ) gen_taujet_pt_1 = Producer( diff --git a/analysis_configurations/unittest/producers/pairquantities.py b/analysis_configurations/unittest/producers/pairquantities.py index 5e6bfb31..5eafe375 100644 --- a/analysis_configurations/unittest/producers/pairquantities.py +++ b/analysis_configurations/unittest/producers/pairquantities.py @@ -265,7 +265,7 @@ name="gen_match_1", call="quantities::tau::genmatch({df}, {output}, 0, {input})", input=[q.dileptonpair, nanoAOD.Tau_genMatch], - output=[q.gen_match_1], + output=[q.tau_gen_match_1], scopes=["tt"], ) taujet_pt_1 = Producer( @@ -318,7 +318,7 @@ name="taugen_match_2", call="quantities::tau::genmatch({df}, {output}, 1, {input})", input=[q.dileptonpair, nanoAOD.Tau_genMatch], - output=[q.gen_match_2], + output=[q.tau_gen_match_2], scopes=["mt", "et", "tt"], ) taujet_pt_2 = Producer( diff --git a/analysis_configurations/unittest/producers/scalefactors.py b/analysis_configurations/unittest/producers/scalefactors.py index e5d8abc4..e4d2bdf2 100644 --- a/analysis_configurations/unittest/producers/scalefactors.py +++ b/analysis_configurations/unittest/producers/scalefactors.py @@ -111,14 +111,15 @@ }, ) + ############################ # Tau ID/ISO SF # The readout is done via correctionlib ############################ Tau_1_VsJetTauID_SF = ExtendedVectorProducer( name="Tau_1_VsJetTauID_SF", - call='scalefactor::tau::id_vsJet_tt({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsjet_tau_id_WP}", "{tau_sf_vsjet_tauDM0}", "{tau_sf_vsjet_tauDM1}", "{tau_sf_vsjet_tauDM10}", "{tau_sf_vsjet_tauDM11}", "{tau_vsjet_sf_dependence}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', - input=[q.pt_1, q.tau_decaymode_1, q.gen_match_1], + call='scalefactor::tau::id_vsJet_tt({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsjet_tau_id_WP}", "{tau_sf_vsjet_tauDM0}", "{tau_sf_vsjet_tauDM1}", "{tau_sf_vsjet_tauDM10}", "{tau_sf_vsjet_tauDM11}", "{tau_vsjet_sf_dependence}", "{tau_vsjet_vseleWP}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', + input=[q.pt_1, q.tau_decaymode_1, q.tau_gen_match_1], output="tau_1_vsjet_sf_outputname", scope=["tt"], vec_config="vsjet_tau_id", @@ -126,7 +127,7 @@ Tau_1_VsEleTauID_SF = ExtendedVectorProducer( name="Tau_1_VsEleTauID_SF", call='scalefactor::tau::id_vsEle({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsele_tau_id_WP}", "{tau_sf_vsele_barrel}", "{tau_sf_vsele_endcap}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', - input=[q.eta_1, q.tau_decaymode_1, q.gen_match_1], + input=[q.eta_1, q.tau_decaymode_1, q.tau_gen_match_1], output="tau_1_vsele_sf_outputname", scope=["tt"], vec_config="vsele_tau_id", @@ -134,23 +135,23 @@ Tau_1_VsMuTauID_SF = ExtendedVectorProducer( name="Tau_1_VsMuTauID_SF", call='scalefactor::tau::id_vsMu({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsmu_tau_id_WP}", "{tau_sf_vsmu_wheel1}", "{tau_sf_vsmu_wheel2}", "{tau_sf_vsmu_wheel3}", "{tau_sf_vsmu_wheel4}", "{tau_sf_vsmu_wheel5}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', - input=[q.eta_1, q.tau_decaymode_1, q.gen_match_1], + input=[q.eta_1, q.tau_decaymode_1, q.tau_gen_match_1], output="tau_1_vsmu_sf_outputname", scope=["tt"], vec_config="vsmu_tau_id", ) Tau_2_VsJetTauID_lt_SF = ExtendedVectorProducer( name="Tau_2_VsJetTauID_lt_SF", - call='scalefactor::tau::id_vsJet_lt({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsjet_tau_id_WP}", "{tau_sf_vsjet_tau30to35}", "{tau_sf_vsjet_tau35to40}", "{tau_sf_vsjet_tau40to500}", "{tau_sf_vsjet_tau500to1000}", "{tau_sf_vsjet_tau1000toinf}", "{tau_vsjet_sf_dependence}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', - input=[q.pt_2, q.tau_decaymode_2, q.gen_match_2], + call='scalefactor::tau::id_vsJet_lt({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsjet_tau_id_WP}", "{tau_sf_vsjet_tau30to35}", "{tau_sf_vsjet_tau35to40}", "{tau_sf_vsjet_tau40to500}", "{tau_sf_vsjet_tau500to1000}", "{tau_sf_vsjet_tau1000toinf}", "{tau_vsjet_sf_dependence}", "{tau_vsjet_vseleWP}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', + input=[q.pt_2, q.tau_decaymode_2, q.tau_gen_match_2], output="tau_2_vsjet_sf_outputname", scope=["et", "mt"], vec_config="vsjet_tau_id", ) Tau_2_VsJetTauID_tt_SF = ExtendedVectorProducer( name="Tau_2_VsJetTauID_tt_SF", - call='scalefactor::tau::id_vsJet_tt({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsjet_tau_id_WP}", "{tau_sf_vsjet_tauDM0}", "{tau_sf_vsjet_tauDM1}", "{tau_sf_vsjet_tauDM10}", "{tau_sf_vsjet_tauDM11}", "{tau_vsjet_sf_dependence}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', - input=[q.pt_2, q.tau_decaymode_2, q.gen_match_2], + call='scalefactor::tau::id_vsJet_tt({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsjet_tau_id_WP}", "{tau_sf_vsjet_tauDM0}", "{tau_sf_vsjet_tauDM1}", "{tau_sf_vsjet_tauDM10}", "{tau_sf_vsjet_tauDM11}", "{tau_vsjet_sf_dependence}", "{tau_vsjet_vseleWP}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', + input=[q.pt_2, q.tau_decaymode_2, q.tau_gen_match_2], output="tau_2_vsjet_sf_outputname", scope=["tt"], vec_config="vsjet_tau_id", @@ -158,7 +159,7 @@ Tau_2_VsEleTauID_SF = ExtendedVectorProducer( name="Tau_2_VsEleTauID_SF", call='scalefactor::tau::id_vsEle({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsele_tau_id_WP}", "{tau_sf_vsele_barrel}", "{tau_sf_vsele_endcap}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', - input=[q.eta_2, q.tau_decaymode_2, q.gen_match_2], + input=[q.eta_2, q.tau_decaymode_2, q.tau_gen_match_2], output="tau_2_vsele_sf_outputname", scope=["et", "mt", "tt"], vec_config="vsele_tau_id", @@ -166,7 +167,7 @@ Tau_2_VsMuTauID_SF = ExtendedVectorProducer( name="Tau_2_VsMuTauID_SF", call='scalefactor::tau::id_vsMu({df}, {input}, {vec_open}{tau_dms}{vec_close}, "{vsmu_tau_id_WP}", "{tau_sf_vsmu_wheel1}", "{tau_sf_vsmu_wheel2}", "{tau_sf_vsmu_wheel3}", "{tau_sf_vsmu_wheel4}", "{tau_sf_vsmu_wheel5}", {output}, "{tau_sf_file}", "{tau_id_discriminator}")', - input=[q.eta_2, q.tau_decaymode_2, q.gen_match_2], + input=[q.eta_2, q.tau_decaymode_2, q.tau_gen_match_2], output="tau_2_vsmu_sf_outputname", scope=["et", "mt", "tt"], vec_config="vsmu_tau_id", diff --git a/analysis_configurations/unittest/quantities/output.py b/analysis_configurations/unittest/quantities/output.py index 63bf3c4d..d339b645 100644 --- a/analysis_configurations/unittest/quantities/output.py +++ b/analysis_configurations/unittest/quantities/output.py @@ -58,8 +58,8 @@ iso_2 = Quantity("iso_2") decaymode_1 = Quantity("decaymode_1") decaymode_2 = Quantity("decaymode_2") -gen_match_1 = Quantity("gen_match_1") -gen_match_2 = Quantity("gen_match_2") +tau_gen_match_1 = Quantity("tau_gen_match_1") +tau_gen_match_2 = Quantity("tau_gen_match_2") gen_tau_pt_1 = Quantity("gen_tau_pt_1") gen_tau_pt_2 = Quantity("gen_tau_pt_2") gen_tau_eta_1 = Quantity("gen_tau_eta_1") diff --git a/analysis_configurations/unittest/unittest_config.py b/analysis_configurations/unittest/unittest_config.py index 37728bc9..313d18f7 100644 --- a/analysis_configurations/unittest/unittest_config.py +++ b/analysis_configurations/unittest/unittest_config.py @@ -205,14 +205,10 @@ def build_config( "vsjet_tau_id_WPbit": bit, } for wp, bit in { - "VVVLoose": 1, - "VVLoose": 2, - "VLoose": 3, "Loose": 4, "Medium": 5, "Tight": 6, "VTight": 7, - "VVTight": 8, }.items() ], "vsele_tau_id": [ @@ -275,6 +271,7 @@ def build_config( "tau_sf_vsjet_tau500to1000": "nom", "tau_sf_vsjet_tau1000toinf": "nom", "tau_vsjet_sf_dependence": "pt", # or "dm", "eta" + "tau_vsjet_vseleWP": "VVLoose", }, ) # TT tau id sf variations @@ -286,6 +283,7 @@ def build_config( "tau_sf_vsjet_tauDM10": "nom", "tau_sf_vsjet_tauDM11": "nom", "tau_vsjet_sf_dependence": "dm", # or "dm", "eta" + "tau_vsjet_vseleWP": "VVLoose", }, ) # MT / ET tau selection @@ -568,19 +566,19 @@ def build_config( # "global", # RemoveProducer( # producers=[event.PUweights, event.npartons], - # samples=["data", "emb", "emb_mc"], + # samples=["data", "embedding", "embedding_mc"], # ), # ) configuration.add_modification_rule( scopes, AppendProducer( producers=[event.GGH_NNLO_Reweighting, event.GGH_WG1_Uncertainties], - samples="ggh", + samples="ggh_htautau", ), ) configuration.add_modification_rule( scopes, - AppendProducer(producers=event.QQH_WG1_Uncertainties, samples="qqh"), + AppendProducer(producers=event.QQH_WG1_Uncertainties, samples="vbf_htautau"), ) configuration.add_modification_rule( scopes, @@ -588,24 +586,25 @@ def build_config( ) configuration.add_modification_rule( scopes, - AppendProducer(producers=event.ZPtMassReweighting, samples="dy"), + AppendProducer(producers=event.ZPtMassReweighting, samples="dyjets"), ) # changes needed for data # global scope configuration.add_modification_rule( "global", AppendProducer( - producers=jets.RenameJetsData, samples=["data", "emb", "emb_mc"] + producers=jets.RenameJetsData, samples=["data", "embedding", "embedding_mc"] ), ) configuration.add_modification_rule( "global", - AppendProducer(producers=event.JSONFilter, samples=["data", "emb"]), + AppendProducer(producers=event.JSONFilter, samples=["data", "embedding"]), ) configuration.add_modification_rule( "global", RemoveProducer( - producers=jets.JetEnergyCorrection, samples=["data", "emb", "emb_mc"] + producers=jets.JetEnergyCorrection, + samples=["data", "embedding", "embedding_mc"], ), ) # scope specific @@ -740,7 +739,7 @@ def build_config( pairquantities.VsMuTauIDFlag_2.output_group, q.taujet_pt_2, q.gen_taujet_pt_2, - q.gen_match_2, + q.tau_gen_match_2, q.muon_veto_flag, q.dimuon_veto, q.electron_veto_flag, @@ -761,7 +760,7 @@ def build_config( pairquantities.VsMuTauIDFlag_2.output_group, q.taujet_pt_2, q.gen_taujet_pt_2, - q.gen_match_2, + q.tau_gen_match_2, q.muon_veto_flag, q.dimuon_veto, q.electron_veto_flag, @@ -786,8 +785,8 @@ def build_config( q.taujet_pt_1, q.taujet_pt_2, q.decaymode_1, - q.gen_match_1, - q.gen_match_2, + q.tau_gen_match_1, + q.tau_gen_match_2, ], ) @@ -798,7 +797,7 @@ def build_config( ], ) # not available in nanoAOD test sample - # if "data" not in sample and "emb" not in sample: + # if "data" not in sample and "embedding" not in sample: # configuration.add_outputs( # scopes, # [ @@ -894,11 +893,7 @@ def build_config( }, scopes=["global"], ), - samples=[ - sample - for sample in available_sample_types - if sample not in ["data", "emb", "emb_mc"] - ], + exclude_samples=["data", "embedding", "embedding_mc"], ) configuration.add_shift( SystematicShiftByQuantity( @@ -909,11 +904,7 @@ def build_config( }, scopes=["global"], ), - samples=[ - sample - for sample in available_sample_types - if sample not in ["data", "emb", "emb_mc"] - ], + exclude_samples=["data", "embedding", "embedding_mc"], ) ######################### # Jet energy resolution @@ -934,11 +925,7 @@ def build_config( } }, ), - samples=[ - sample - for sample in available_sample_types - if sample not in ["data", "embedding", "embedding_mc"] - ], + exclude_samples=["data", "embedding", "embedding_mc"], ) configuration.add_shift( SystematicShift( @@ -955,11 +942,7 @@ def build_config( } }, ), - samples=[ - sample - for sample in available_sample_types - if sample not in ["data", "embedding", "embedding_mc"] - ], + exclude_samples=["data", "embedding", "embedding_mc"], ) ######################### diff --git a/cmake/AddOnnxruntime.cmake b/cmake/AddOnnxruntime.cmake index eebdd94b..a4ea7c94 100644 --- a/cmake/AddOnnxruntime.cmake +++ b/cmake/AddOnnxruntime.cmake @@ -16,8 +16,19 @@ if(DEFINED ENV{LCG_VERSION}) message(STATUS "ONNXRuntime include path: ${ONNX_RUNTIME_INCLUDE_PATH}/core/session") include_directories("${ONNX_RUNTIME_INCLUDE_PATH}/core/session") endif() - message(STATUS "ONNXRuntime library path: ${ONNX_RUNTIME_LIB_PATH}") else() - message(STATUS "No LCG stack found, not adding ONNXRuntime") + set(ONNXRUNTIME_INCLUDE_DIR "" CACHE FILEPATH "Path to ONNXRUNTIME includes") + message(STATUS "Running in CI, take Onnxruntime from pre-build") + if(NOT EXISTS ${ONNXRUNTIME_INCLUDE_DIR}/include/onnxruntime/core/session/onnxruntime_cxx_api.h) + message(SEND_ERROR "Can't find onnxruntime_cxx_api.h in ${ONNXRUNTIME_INCLUDE_DIR}/include/onnxruntime/core/session") + else() + message(STATUS "ONNXRuntime include path: ${ONNXRUNTIME_INCLUDE_DIR}/include/onnxruntime/core/session") + include_directories("${ONNXRUNTIME_INCLUDE_DIR}/include/onnxruntime/core/session") + # lib file is found in ${ONNXRUNTIME_INCLUDE_DIR}/build/Linux/Release + find_library( + ONNX_RUNTIME_LIB_PATH + NAMES onnxruntime + HINTS ${ONNXRUNTIME_INCLUDE_DIR}/build/Linux/Release) + endif() endif() diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..fee2bf2d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,23 @@ +# start from rootproject/root:6.30.04-ubuntu22.04 +FROM rootproject/root:6.30.04-ubuntu22.04 + +# Install necessary packages +RUN apt-get update -y +RUN apt-get install -y ca-certificates gpg wget git make python3-pip openmpi-bin libopenmpi-dev libboost-all-dev openssh-client nlohmann-json3-dev + +RUN python3 -m pip install GitPython && python3 -m pip install git+https://github.com/cms-nanoAOD/correctionlib.git + +# update cmake +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \ +echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \ +apt-get update -y && \ +apt-get install -y cmake + +# Install onnxruntime +RUN git clone --recursive https://github.com/microsoft/onnxruntime.git +RUN cd onnxruntime && ./build.sh --config Release --update --build --build_shared_lib --parallel --allow_running_as_root + +# Install tini +RUN apt-get install -y tini + +ENTRYPOINT ["/usr/bin/tini", "--"] \ No newline at end of file diff --git a/include/scalefactors.hxx b/include/scalefactors.hxx index cbe8ec9d..713d7399 100644 --- a/include/scalefactors.hxx +++ b/include/scalefactors.hxx @@ -28,17 +28,16 @@ ROOT::RDF::RNode iso(ROOT::RDF::RNode df, const std::string &pt, } // namespace muon namespace tau { -ROOT::RDF::RNode -id_vsJet_lt(ROOT::RDF::RNode df, const std::string &pt, - const std::string &decayMode, const std::string &genMatch, - const std::vector &selectedDMs, const std::string &wp, - const std::string &sf_vsjet_tau30to35, - const std::string &sf_vsjet_tau35to40, - const std::string &sf_vsjet_tau40to500, - const std::string &sf_vsjet_tau500to1000, - const std::string &sf_vsjet_tau1000toinf, - const std::string &sf_dependence, const std::string &id_output, - const std::string &sf_file, const std::string &idAlgorithm); +ROOT::RDF::RNode id_vsJet_lt( + ROOT::RDF::RNode df, const std::string &pt, const std::string &decayMode, + const std::string &genMatch, const std::vector &selectedDMs, + const std::string &wp, const std::string &sf_vsjet_tau30to35, + const std::string &sf_vsjet_tau35to40, + const std::string &sf_vsjet_tau40to500, + const std::string &sf_vsjet_tau500to1000, + const std::string &sf_vsjet_tau1000toinf, const std::string &sf_dependence, + const std::string &vsele_wp, const std::string &id_output, + const std::string &sf_file, const std::string &idAlgorithm); ROOT::RDF::RNode id_vsJet_lt_embedding( ROOT::RDF::RNode df, const std::string &pt, const std::string &wp, const std::string &sf_vsjet_tau20to25, @@ -59,8 +58,8 @@ ROOT::RDF::RNode id_vsJet_tt( const std::string &wp, const std::string &sf_vsjet_tauDM0, const std::string &sf_vsjet_tauDM1, const std::string &sf_vsjet_tauDM10, const std::string &sf_vsjet_tauDM11, const std::string &sf_dependence, - const std::string &id_output, const std::string &sf_file, - const std::string &idAlgorithm); + const std::string &id_output, const std::string &vsele_wp, + const std::string &sf_file, const std::string &idAlgorithm); ROOT::RDF::RNode id_vsEle(ROOT::RDF::RNode df, const std::string &eta, const std::string &decayMode, const std::string &genMatch, diff --git a/src/scalefactors.cxx b/src/scalefactors.cxx index a3bc650e..3c4e4101 100644 --- a/src/scalefactors.cxx +++ b/src/scalefactors.cxx @@ -214,29 +214,29 @@ for nominal for nominal * and "systup"/"systdown" the up/down variation * @param sf_dependence "pt", "dm" or "eta" based scale factors + * @param vsele_wp working point of the vsEle cut * @param id_output name of the id scale factor column * @param sf_file path to the file with the tau scale factors * @param idAlgorithm name of the tau id scale factor * @return a new dataframe containing the new column */ -ROOT::RDF::RNode -id_vsJet_lt(ROOT::RDF::RNode df, const std::string &pt, - const std::string &decayMode, const std::string &genMatch, - const std::vector &selectedDMs, const std::string &wp, - const std::string &sf_vsjet_tau30to35, - const std::string &sf_vsjet_tau35to40, - const std::string &sf_vsjet_tau40to500, - const std::string &sf_vsjet_tau500to1000, - const std::string &sf_vsjet_tau1000toinf, - const std::string &sf_dependence, const std::string &id_output, - const std::string &sf_file, const std::string &idAlgorithm) { +ROOT::RDF::RNode id_vsJet_lt( + ROOT::RDF::RNode df, const std::string &pt, const std::string &decayMode, + const std::string &genMatch, const std::vector &selectedDMs, + const std::string &wp, const std::string &sf_vsjet_tau30to35, + const std::string &sf_vsjet_tau35to40, + const std::string &sf_vsjet_tau40to500, + const std::string &sf_vsjet_tau500to1000, + const std::string &sf_vsjet_tau1000toinf, const std::string &sf_dependence, + const std::string &vsele_wp, const std::string &id_output, + const std::string &sf_file, const std::string &idAlgorithm) { Logger::get("TauIDvsJet_lt_SF") ->debug("Setting up function for tau id vsJet sf"); Logger::get("TauIDvsJet_lt_SF")->debug("ID - Name {}", idAlgorithm); auto evaluator = correction::CorrectionSet::from_file(sf_file)->at(idAlgorithm); - auto idSF_calculator = [evaluator, wp, sf_vsjet_tau30to35, + auto idSF_calculator = [evaluator, wp, vsele_wp, sf_vsjet_tau30to35, sf_vsjet_tau35to40, sf_vsjet_tau40to500, sf_vsjet_tau500to1000, sf_vsjet_tau1000toinf, sf_dependence, selectedDMs, @@ -251,32 +251,33 @@ id_vsJet_lt(ROOT::RDF::RNode df, const std::string &pt, selectedDMs.end()) { Logger::get("TauIDvsJet_lt_SF") ->debug("ID {} - pt {}, decayMode {}, genMatch {}, wp {}, " + "vsele_wp {}" "sf_vsjet_tau30to35 {}, sf_vsjet_tau35to40 {}, " "sf_vsjet_tau40to500{}, sf_vsjet_tau500to1000 {}, " "sf_vsjet_tau1000toinf {}, sf_dependence {}", - idAlgorithm, pt, decayMode, genMatch, wp, + idAlgorithm, pt, decayMode, genMatch, wp, vsele_wp, sf_vsjet_tau30to35, sf_vsjet_tau35to40, sf_vsjet_tau40to500, sf_vsjet_tau500to1000, sf_vsjet_tau1000toinf, sf_dependence); if (pt >= 30.0 && pt < 35.0) { - sf = evaluator->evaluate({pt, decayMode, - static_cast(genMatch), wp, - sf_vsjet_tau30to35, sf_dependence}); + sf = evaluator->evaluate( + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, + sf_vsjet_tau30to35, sf_dependence}); } else if (pt >= 35.0 && pt < 40.0) { - sf = evaluator->evaluate({pt, decayMode, - static_cast(genMatch), wp, - sf_vsjet_tau35to40, sf_dependence}); + sf = evaluator->evaluate( + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, + sf_vsjet_tau35to40, sf_dependence}); } else if (pt >= 40.0 && pt < 500.0) { - sf = evaluator->evaluate({pt, decayMode, - static_cast(genMatch), wp, - sf_vsjet_tau40to500, sf_dependence}); + sf = evaluator->evaluate( + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, + sf_vsjet_tau40to500, sf_dependence}); } else if (pt >= 500.0 && pt < 1000.0) { sf = evaluator->evaluate( - {pt, decayMode, static_cast(genMatch), wp, + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, sf_vsjet_tau500to1000, sf_dependence}); } else if (pt >= 1000.0 && pt < 2000.0) { sf = evaluator->evaluate( - {pt, decayMode, static_cast(genMatch), wp, + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, sf_vsjet_tau1000toinf, sf_dependence}); } else { sf = 1.; @@ -468,6 +469,7 @@ nominal nominal * and "systup"/"systdown" the up/down variation * @param sf_dependence "pt", "dm" or "eta" based scale factors + * @param vsele_wp working point of the vsEle cut * @param id_output name of the id scale factor column * @param sf_file path to the file with the tau scale factors * @param idAlgorithm name of the tau id scale factor @@ -479,17 +481,17 @@ ROOT::RDF::RNode id_vsJet_tt( const std::string &wp, const std::string &sf_vsjet_tauDM0, const std::string &sf_vsjet_tauDM1, const std::string &sf_vsjet_tauDM10, const std::string &sf_vsjet_tauDM11, const std::string &sf_dependence, - const std::string &id_output, const std::string &sf_file, - const std::string &idAlgorithm) { + const std::string &vsele_wp, const std::string &id_output, + const std::string &sf_file, const std::string &idAlgorithm) { Logger::get("TauIDvsJet_tt_SF") ->debug("Setting up function for tau id vsJet sf"); Logger::get("TauIDvsJet_tt_SF")->debug("ID - Name {}", idAlgorithm); auto evaluator = correction::CorrectionSet::from_file(sf_file)->at(idAlgorithm); - auto idSF_calculator = [evaluator, wp, sf_vsjet_tauDM0, sf_vsjet_tauDM1, - sf_vsjet_tauDM10, sf_vsjet_tauDM11, sf_dependence, - selectedDMs, + auto idSF_calculator = [evaluator, wp, vsele_wp, sf_vsjet_tauDM0, + sf_vsjet_tauDM1, sf_vsjet_tauDM10, sf_vsjet_tauDM11, + sf_dependence, selectedDMs, idAlgorithm](const float &pt, const int &decayMode, const UChar_t &genMatch) { Logger::get("TauIDvsJet_tt_SF")->debug("ID - decayMode {}", decayMode); @@ -501,28 +503,29 @@ ROOT::RDF::RNode id_vsJet_tt( selectedDMs.end()) { Logger::get("TauIDvsJet_tt_SF") ->debug("ID {} - pt {}, decayMode {}, genMatch {}, wp {}, " + "vsele_wp {}, " "sf_vsjet_tauDM0 {}, sf_vsjet_tauDM1 {}, " "sf_vsjet_tauDM1 {}, sf_vsjet_tauDM10{}, " "sf_vsjet_tauDM11 {}, sf_dependence {}", - idAlgorithm, pt, decayMode, genMatch, wp, + idAlgorithm, pt, decayMode, genMatch, wp, vsele_wp, sf_vsjet_tauDM0, sf_vsjet_tauDM1, sf_vsjet_tauDM10, sf_vsjet_tauDM11, sf_dependence); if (decayMode == 0) { - sf = evaluator->evaluate({pt, decayMode, - static_cast(genMatch), wp, - sf_vsjet_tauDM0, sf_dependence}); + sf = evaluator->evaluate( + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, + sf_vsjet_tauDM0, sf_dependence}); } else if (decayMode == 1) { - sf = evaluator->evaluate({pt, decayMode, - static_cast(genMatch), wp, - sf_vsjet_tauDM1, sf_dependence}); + sf = evaluator->evaluate( + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, + sf_vsjet_tauDM1, sf_dependence}); } else if (decayMode == 10) { - sf = evaluator->evaluate({pt, decayMode, - static_cast(genMatch), wp, - sf_vsjet_tauDM10, sf_dependence}); + sf = evaluator->evaluate( + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, + sf_vsjet_tauDM10, sf_dependence}); } else if (decayMode == 11) { - sf = evaluator->evaluate({pt, decayMode, - static_cast(genMatch), wp, - sf_vsjet_tauDM11, sf_dependence}); + sf = evaluator->evaluate( + {pt, decayMode, static_cast(genMatch), wp, vsele_wp, + sf_vsjet_tauDM11, sf_dependence}); } else { sf = 1.; }