Skip to content
Snippets Groups Projects
Commit f5087fa5 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

Single simulation test on standard reconstruction

parent cac0fc7a
Branches
No related tags found
1 merge request!80Single simulation test on standard reconstruction
...@@ -69,6 +69,7 @@ include: ...@@ -69,6 +69,7 @@ include:
#- local: 'benchmarks/dvmp/config.yml' #- local: 'benchmarks/dvmp/config.yml'
- local: 'benchmarks/dvcs/config.yml' - local: 'benchmarks/dvcs/config.yml'
- local: 'benchmarks/u_omega/config.yml' - local: 'benchmarks/u_omega/config.yml'
- local: 'benchmarks/single/config.yml'
summary: summary:
stage: finish stage: finish
......
#include <iostream>
#include <string>
#include <ROOT/RDataFrame.hxx>
#include <eicd/ReconstructedParticleData.h>
int analyze(std::string file)
{
// open dataframe
ROOT::RDataFrame df("events", file, {"GeneratedParticles", "ReconstructedParticles"});
// count total events
auto count = df.Count();
if (count == 0) {
std::cout << "Error: No events found" << std::endl;
return -1;
}
auto n_tracks = [](const std::vector<eic::ReconstructedParticleData> &p) { return (int) p.size(); };
auto d = df
.Define("n_tracks_gen", n_tracks, {"GeneratedParticles"})
.Define("n_tracks_rec", n_tracks, {"ReconstructedParticles"})
;
auto stats_n_tracks_gen = d.Stats("n_tracks_gen");
auto stats_n_tracks_rec = d.Stats("n_tracks_rec");
if (stats_n_tracks_rec->GetMean() < 0.9) {
std::cout << "Error: too few tracks per events " << std::endl;
stats_n_tracks_gen->Print();
stats_n_tracks_rec->Print();
return -1;
}
// success
return 0;
}
single:process:
extends: .phy_benchmark
timeout: 24 hours
stage: process
script:
- bash benchmarks/single/single.sh e-_1GeV_45to135deg
from DDSim.DD4hepSimulation import DD4hepSimulation
from g4units import mm, GeV, MeV, degree
SIM = DD4hepSimulation()
SIM.gun.energy = 1*GeV
SIM.gun.particle = "e-"
SIM.gun.position = (0.0, 0.0, 0.0)
SIM.gun.direction = (0.0, 0.0, 1.0)
SIM.gun.distribution = "cos(theta)"
SIM.gun.thetaMin = 45*degree
SIM.gun.thetaMax = 135*degree
\ No newline at end of file
#!/bin/bash
if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=100
fi
export JUGGLER_FILE_NAME_TAG="${1:-e-_1GeV_45to135deg}"
export JUGGLER_GEN_FILE="benchmarks/single/${JUGGLER_FILE_NAME_TAG}.steer"
export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root"
export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root"
# Simulate
npsim --runType run \
--printLevel WARNING \
--enableGun \
--steeringFile ${JUGGLER_GEN_FILE} \
--numberOfEvents ${JUGGLER_N_EVENTS} \
--part.minimalKineticEnergy 1*TeV \
--compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \
--outputFile ${JUGGLER_SIM_FILE}
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running npsim"
exit 1
fi
# Reconstruct
for rec in options/*.py ; do
unset tag
[[ $(basename ${rec} .py) =~ (.*)\.(.*) ]] && tag=".${BASH_REMATCH[2]}"
JUGGLER_REC_FILE=${JUGGLER_REC_FILE/.root/${tag:-}.root} \
gaudirun.py ${rec}
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running juggler"
exit 1
fi
done
# Analysis
root -l -b -q "benchmarks/single/analysis/analyze.cxx(\"${JUGGLER_REC_FILE}\")"
if [[ "$?" -ne "0" ]] ; then
echo "ERROR analysis failed"
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment