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

Use rdataframe tests

parent c347dd26
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !80. Comments created here will be created in the context of that merge request.
#include <iostream>
#include <string>
#include <ROOT/RDataFrame.hxx>
#include <eicd/ReconstructedParticleData.h>
int analyze(std::string name)
{
// open dataframe
ROOT::RDataFrame df("events", url, {"mcparticles2", "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_gen->GetMean() < 1.0
|| stats_n_tracks_rec->GetMean()) {
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;
}
...@@ -31,7 +31,7 @@ if [[ "$?" -ne "0" ]] ; then ...@@ -31,7 +31,7 @@ if [[ "$?" -ne "0" ]] ; then
fi fi
# Analysis # Analysis
root -l -b -q ${JUGGLER_REC_FILE} -e 'events->Scan("@ReconstructedParticles.size()","","",10)' root -l -b -q "benchmarks/single/analyze.cxx+(\"${JUGGLER_REC_FILE}\")"
if [[ "$?" -ne "0" ]] ; then if [[ "$?" -ne "0" ]] ; then
echo "ERROR analysis failed" echo "ERROR analysis failed"
exit 1 exit 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment