From 0120e487ecd995dbefcc33440e89b3023fce7ef4 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin <dkalinkin@bnl.gov> Date: Sat, 26 Oct 2024 16:40:53 -0400 Subject: [PATCH] remove Athena backgrounds benchmark (#56) --- .gitlab-ci.yml | 2 - .../backgrounds/analysis/synchrotron_raw.cxx | 29 --- .../backgrounds/analysis/synchrotron_sim.cxx | 57 ------ benchmarks/backgrounds/config.yml | 20 --- benchmarks/backgrounds/synchrotron.sh | 168 ------------------ 5 files changed, 276 deletions(-) delete mode 100644 benchmarks/backgrounds/analysis/synchrotron_raw.cxx delete mode 100644 benchmarks/backgrounds/analysis/synchrotron_sim.cxx delete mode 100644 benchmarks/backgrounds/config.yml delete mode 100644 benchmarks/backgrounds/synchrotron.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c7e93826..fb80599a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -107,7 +107,6 @@ common:setup: - runner_system_failure include: - - local: 'benchmarks/backgrounds/config.yml' - local: 'benchmarks/Exclusive-Diffraction-Tagging/diffractive_vm/config.yml' - local: 'benchmarks/Exclusive-Diffraction-Tagging/demp/config.yml' #- local: 'benchmarks/Exclusive-Diffraction-Tagging/dvmp/config.yml' @@ -125,7 +124,6 @@ summary: - "dvcs:results" - "tcs:results" - "u_omega:results" - - "backgrounds:results" script: - collect_benchmarks.py - find results -print | sort | tee summary.txt diff --git a/benchmarks/backgrounds/analysis/synchrotron_raw.cxx b/benchmarks/backgrounds/analysis/synchrotron_raw.cxx deleted file mode 100644 index 14a7b1fd..00000000 --- a/benchmarks/backgrounds/analysis/synchrotron_raw.cxx +++ /dev/null @@ -1,29 +0,0 @@ -#include <cmath> -#include <iostream> -#include <string> -#include <vector> - -#include "ROOT/RDataFrame.hxx" -#include "Math/Vector4D.h" -#include "TCanvas.h" - -#include <nlohmann/json.hpp> -using json = nlohmann::json; - -R__LOAD_LIBRARY(libfmt.so) -#include "fmt/core.h" -#include "fmt/color.h" - -R__LOAD_LIBRARY(libedm4eic.so) - -#include "edm4eic/ReconstructedParticleCollection.h" - -void synchrotron_raw(const char* fname = "rec_synchrotron.raw.root"){ - - fmt::print(fmt::emphasis::bold | fg(fmt::color::forest_green), "Running synchrotron analysis...\n"); - - // Run this in multi-threaded mode if desired - ROOT::EnableImplicitMT(); - ROOT::RDataFrame df("events", fname); - -} diff --git a/benchmarks/backgrounds/analysis/synchrotron_sim.cxx b/benchmarks/backgrounds/analysis/synchrotron_sim.cxx deleted file mode 100644 index fc22532e..00000000 --- a/benchmarks/backgrounds/analysis/synchrotron_sim.cxx +++ /dev/null @@ -1,57 +0,0 @@ -#include <cmath> -#include <iostream> -#include <string> -#include <vector> - -#include "ROOT/RDataFrame.hxx" -#include "Math/Vector4D.h" -#include "TCanvas.h" -#include "TSystem.h" - -#include <nlohmann/json.hpp> -using json = nlohmann::json; - -R__LOAD_LIBRARY(libfmt.so) -#include "fmt/core.h" -#include "fmt/color.h" - -R__LOAD_LIBRARY(libedm4eic.so) - -#include "edm4eic/ReconstructedParticleCollection.h" - -void synchrotron_sim(const char* fname = "sim_synchrotron.edm4hep.root"){ - - fmt::print(fmt::emphasis::bold | fg(fmt::color::forest_green), "Running synchrotron analysis...\n"); - - // Run this in multi-threaded mode if desired - ROOT::EnableImplicitMT(); - ROOT::RDataFrame df("events", fname); - - // Detector version - std::string detector_version("default"); - const char* getenv_detector_version = gSystem->Getenv("DETECTOR_VERSION"); - if (getenv_detector_version) { - detector_version = getenv_detector_version; - } - - if (detector_version == "acadia") { - // Define variables - auto df0 = df - .Define("n_VertexBarrelHits", "VertexBarrelHits.size()") - .Define("n_VertexEndcapHits", "VertexEndcapHits.size()") - ; - auto n_VertexBarrelHits = df0.Mean("n_VertexBarrelHits"); - auto n_VertexEndcapHits = df0.Mean("n_VertexEndcapHits"); - std::cout << "n_VertexBarrelHits = " << *n_VertexBarrelHits << " / ev" << std::endl; - std::cout << "n_VertexEndcapHits = " << *n_VertexEndcapHits << " / ev" << std::endl; - } else if (detector_version == "canyonlands") { - // Define variables - auto df0 = df - .Define("n_VertexBarrelHits", "VertexBarrelHits.size()") - ; - auto n_VertexBarrelHits = df0.Mean("n_VertexBarrelHits"); - std::cout << "n_VertexBarrelHits = " << *n_VertexBarrelHits << " / ev" << std::endl; - } else { - std::cout << "Detector version " << detector_version << " not supported in synchrotron_sim.cxx" << std::endl; - } -} diff --git a/benchmarks/backgrounds/config.yml b/benchmarks/backgrounds/config.yml deleted file mode 100644 index a34e04ed..00000000 --- a/benchmarks/backgrounds/config.yml +++ /dev/null @@ -1,20 +0,0 @@ -backgrounds:compile: - stage: compile - extends: .compile_benchmark - script: - - compile_analyses.py backgrounds - -backgrounds:synchrotron:simulate: - stage: simulate - extends: .phy_benchmark - tags: - - s3 - needs: ["backgrounds:compile"] - script: - - bash benchmarks/backgrounds/synchrotron.sh --all - -backgrounds:results: - stage: collect - needs: ["backgrounds:synchrotron:simulate"] - script: - - ls -lrth diff --git a/benchmarks/backgrounds/synchrotron.sh b/benchmarks/backgrounds/synchrotron.sh deleted file mode 100644 index 29609cc7..00000000 --- a/benchmarks/backgrounds/synchrotron.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/bash -source strict-mode.sh - -function print_the_help { - echo "USAGE: ${0} [--rec] [--sim] [--ana] [--all] " - echo " The default options are to run all steps (sim,rec,ana) " - echo "OPTIONS: " - echo " --data-init download the input event data" - echo " --sim,-s Runs the Geant4 simulation" - echo " --rec,-r Run the juggler reconstruction" - echo " --ana,-a Run the analysis scripts" - echo " --all (default) Do all steps. Argument is included so usage can convey intent." - exit -} - -DO_ALL=1 -DATA_INIT= -DO_SIM= -DO_REC= -DO_ANA= - -POSITIONAL=() -while [[ $# -gt 0 ]] -do - key="$1" - - case $key in - -h|--help) - shift # past argument - print_the_help - ;; - --all) - DO_ALL=2 - if [[ ! "${DO_REC}${DO_SIM}${DO_ANA}" -eq "" ]] ; then - echo "Error: cannot use --all with other arguments." 1>&2 - print_the_help - exit 1 - fi - shift # past value - ;; - -s|--sim) - DO_SIM=1 - DO_ALL= - shift # past value - ;; - --data-init) - DATA_INIT=1 - DO_ALL= - shift # past value - ;; - -r|--rec) - DO_REC=1 - DO_ALL= - shift # past value - ;; - -a|--analysis) - DO_ANA=1 - DO_ALL= - shift # past value - ;; - *) # unknown option - #POSITIONAL+=("$1") # save it in an array for later - echo "unknown option $1" - print_the_help - shift # past argument - ;; - esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - -# assuming something like .local/bin/env.sh has already been sourced. -print_env.sh - -FILE_NAME_TAG="synchrotron" -DATA_URL="S3/eictest/ATHENA/EVGEN/SR/SR.10GeV_5kVthreshold_hepmc/25098.hepmc" - -export JUGGLER_MC_FILE="${LOCAL_DATA_PATH}/mc_${FILE_NAME_TAG}.hepmc" -export JUGGLER_SIM_FILE="${LOCAL_DATA_PATH}/sim_${FILE_NAME_TAG}.edm4hep.root" -export JUGGLER_REC_FILE="${LOCAL_DATA_PATH}/rec_${FILE_NAME_TAG}.root" - -echo "FILE_NAME_TAG = ${FILE_NAME_TAG}" -echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" -echo "DETECTOR = ${DETECTOR}" - - -## To run the reconstruction, we need the following global variables: -## - DETECTOR: the detector package we want to use for this benchmark -## - DETECTOR_PATH: full path to the detector definitions - -## Step 1. Get the data -if [[ -n "${DATA_INIT}" || -n "${DO_ALL}" ]] ; then - mc -C . config host add S3 https://eics3.sdcc.bnl.gov:9000 $S3_ACCESS_KEY $S3_SECRET_KEY - set +o pipefail - mc -C . head -n $((2+5*${JUGGLER_N_EVENTS})) --insecure ${DATA_URL} | sanitize_hepmc3 > ${JUGGLER_MC_FILE} - if [[ "$?" -ne "0" ]] ; then - echo "Failed to download hepmc files" - exit 1 - fi -fi - -### Step 2. Run the simulation (geant4) -if [[ -n "${DO_SIM}" || -n "${DO_ALL}" ]] ; then - ## run geant4 simulations - ddsim --runType batch \ - --part.minimalKineticEnergy 1000*GeV \ - --filter.tracker edep0 \ - -v ERROR \ - --numberOfEvents ${JUGGLER_N_EVENTS} \ - --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \ - --inputFiles ${JUGGLER_MC_FILE} \ - --outputFile ${JUGGLER_SIM_FILE} - if [[ "$?" -ne "0" ]] ; then - echo "ERROR running ddsim" - exit 1 - fi -fi - -### Step 3. Run the reconstruction (eicrecon) -if [[ -n "${DO_REC}" || -n "${DO_ALL}" ]] ; then - if [ ${RECO} == "eicrecon" ] ; then - eicrecon ${JUGGLER_SIM_FILE} -Ppodio:output_file=${JUGGLER_REC_FILE} - if [[ "$?" -ne "0" ]] ; then - echo "ERROR running eicrecon" - exit 1 - fi - fi - - if [[ ${RECO} == "juggler" ]] ; then - gaudirun.py options/reconstruction.py || [ $? -eq 4 ] - if [ "$?" -ne "0" ] ; then - echo "ERROR running juggler" - exit 1 - fi - fi - - root_filesize=$(stat --format=%s "${JUGGLER_REC_FILE}") - if [[ "${JUGGLER_N_EVENTS}" -lt "500" ]] ; then - # file must be less than 10 MB to upload - if [[ "${root_filesize}" -lt "10000000" ]] ; then - cp ${JUGGLER_REC_FILE} results/. - fi - fi -fi - -### Step 4. Run the analysis code -if [[ -n "${DO_ANA}" || -n "${DO_ALL}" ]] ; then - echo "Running analysis scripts" - rootls -t ${JUGGLER_REC_FILE} - - # Store all plots here (preferribly png and pdf files) - mkdir -p results/synchrotron - - # here you can add as many scripts as you want. - root -b -q "benchmarks/backgrounds/analysis/synchrotron_sim.cxx+(\"${JUGGLER_SIM_FILE}\")" - if [[ "$?" -ne "0" ]] ; then - echo "ERROR running root script" - exit 1 - fi - - root -b -q "benchmarks/backgrounds/analysis/synchrotron_raw.cxx+(\"${JUGGLER_REC_FILE/.root/.raw.root}\")" - if [[ "$?" -ne "0" ]] ; then - echo "ERROR running root script" - exit 1 - fi -fi - - - -- GitLab