Skip to content
Snippets Groups Projects
Unverified Commit 0120e487 authored by Dmitry Kalinkin's avatar Dmitry Kalinkin Committed by GitHub
Browse files

remove Athena backgrounds benchmark (#56)

parent 73ddce97
No related branches found
No related tags found
No related merge requests found
Pipeline #106986 passed
...@@ -107,7 +107,6 @@ common:setup: ...@@ -107,7 +107,6 @@ common:setup:
- runner_system_failure - runner_system_failure
include: include:
- local: 'benchmarks/backgrounds/config.yml'
- local: 'benchmarks/Exclusive-Diffraction-Tagging/diffractive_vm/config.yml' - local: 'benchmarks/Exclusive-Diffraction-Tagging/diffractive_vm/config.yml'
- local: 'benchmarks/Exclusive-Diffraction-Tagging/demp/config.yml' - local: 'benchmarks/Exclusive-Diffraction-Tagging/demp/config.yml'
#- local: 'benchmarks/Exclusive-Diffraction-Tagging/dvmp/config.yml' #- local: 'benchmarks/Exclusive-Diffraction-Tagging/dvmp/config.yml'
...@@ -125,7 +124,6 @@ summary: ...@@ -125,7 +124,6 @@ summary:
- "dvcs:results" - "dvcs:results"
- "tcs:results" - "tcs:results"
- "u_omega:results" - "u_omega:results"
- "backgrounds:results"
script: script:
- collect_benchmarks.py - collect_benchmarks.py
- find results -print | sort | tee summary.txt - find results -print | sort | tee summary.txt
......
#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);
}
#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;
}
}
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
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment