Skip to content
Snippets Groups Projects
Commit 510cb6cb authored by Alex Jentsch's avatar Alex Jentsch
Browse files

Merge branch '50-b0tracker-acceptance-tests' of...

Merge branch '50-b0tracker-acceptance-tests' of https://eicweb.phy.anl.gov/EIC/benchmarks/detector_benchmarks into 50-b0tracker-acceptance-tests
Still trying to add MC vs. accepted information - rebase issue.
parents 0d80f473 548e97b5
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,18 @@ common:setup:
echo "JUGGLER_DETECTOR=$JUGGLER_DETECTOR" >> juggler.env
echo "JUGGLER_DETECTOR_VERSION=$JUGGLER_DETECTOR_VERSION" >> juggler.env
echo "COMMON_BENCH_VERSION=$COMMON_BENCH_VERSION" >> juggler.env
else
if [[ "${JUGGLER_DETECTOR}" == "" ]] ; then
export JUGGLER_DETECTOR="athena"
fi
if [[ "${JUGGLER_DETECTOR_VERSION}" == "" ]] ; then
export JUGGLER_DETECTOR_VERSION="master"
fi
echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}"
echo "JUGGLER_DETECTOR_VERSION = ${JUGGLER_DETECTOR_VERSION}"
echo "JUGGLER_DETECTOR=$JUGGLER_DETECTOR" >> juggler.env
echo "JUGGLER_DETECTOR_VERSION=$JUGGLER_DETECTOR_VERSION" >> juggler.env
echo "COMMON_BENCH_VERSION=$COMMON_BENCH_VERSION" >> juggler.env
fi
- source setup/bin/env.sh && ./setup/bin/install_common.sh
......
......@@ -36,7 +36,6 @@ void b0_tracker_hits(const char* fname = "./sim_output/sim_forward_protons.root"
ROOT::RDataFrame d0(*t);
dd4pod::MonteCarloContrib
auto MC_hits_theta = [&](const std:vector<dd4pod::MonteCarloContrib>& mchits){
std::vector<double> result;
......@@ -101,15 +100,59 @@ void b0_tracker_hits(const char* fname = "./sim_output/sim_forward_protons.root"
auto h1 = d2.Histo1D({"h1", "hits_theta", 100, 0,20}, "hits_theta");
auto hMCTheta = d3.Histo1D({"mchitstheta", "MC_hits_theta", 100, 0, 20});
auto local_position = [&](const std::vector<dd4pod::TrackerHitData>& hits) {
std::vector<std::array<double, 2>> result;
for (const auto& h : hits) {
auto pos0 = (h.position);
result.push_back({pos0.x , pos0.y});
}
return result;
};
auto x_pos = [&](const std::vector<std::array<double, 2>>& xypos) {
std::vector<double> result;
for (const auto& h : xypos) {
result.push_back(h.at(0));
}
return result;
};
auto y_pos = [&](const std::vector<std::array<double, 2>>& xypos) {
std::vector<double> result;
for (const auto& h : xypos) {
result.push_back(h.at(1));
}
return result;
};
auto d1 = d0.Define("nhits", hits_theta, {"B0TrackerHits"})
.Define("xy_hit_pos", local_position, {"B0TrackerHits"})
.Define("x_pos", x_pos, {"xy_hit_pos"})
.Define("y_pos", y_pos, {"xy_hit_pos"});
auto h_local_pos = d1.Histo2D({"h_local_pos", ";x [mm]; y [mm] ", 100, -100.0, -200.0, 100, -100.0, 100.0}, "x_pos", "y_pos");
auto d2 = d0.Define("hits_theta", hits_theta, {"B0TrackerHits"});
auto h1 = d2.Histo1D({"h1", "hits_theta", 100, 0,20}, "hits_theta");
>>>>>>> 548e97b5b5705204a320a076b0c6b7b125aa0cef
TCanvas* c = new TCanvas();
h1->DrawCopy();
c->SaveAs("results/b0_tracker_hits_theta.png");
c->SaveAs("results/b0_tracker_hits_theta.pdf");
<<<<<<< HEAD
hMCTheta->DrawCopy();
c->SaveAs("results/MC_hits_theta.png");
c->SaveAs("results/MC_hits_theta.pdf");
=======
>>>>>>> 548e97b5b5705204a320a076b0c6b7b125aa0cef
h_local_pos->DrawCopy("colz");
c->SaveAs("results/b0_tracker_hits_occupancy_disk_1.png");
c->SaveAs("results/b0_tracker_hits_occupancy_disk_1.pdf");
......
#stages:
# #- simulate
# - benchmarks
pid_test_1_dummy_test:
sim:backward:
extends: .det_benchmark
stage: simulate
script:
- npsim --runType batch --numberOfEvents 100 --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml --enableGun --gun.energy "5*GeV" --gun.particle "${PARTICLE}" --gun.thetaMin 130*deg --gun.thetaMax 177*deg --gun.distribution "cos(theta)" --outputFile sim_output/sim_pid_backward_${PARTICLE}_5GeV.root
- rootls -t sim_output/sim_pid_backward_${PARTICLE}_5GeV.root
parallel:
matrix:
- PARTICLE: ["e-", "pi+", "proton"]
bench:mrich:
extends: .det_benchmark
stage: benchmarks
needs: ["sim:backward"]
script:
- mkdir -p results/pid/backward/mrich/
- root -t -x -q -b "benchmarks/pid/scripts/mrich_analysis.cxx+(\"sim_output/sim_pid_backward_${PARTICLE}_5GeV.root\", \"${PARTICLE}\")"
parallel:
matrix:
- PARTICLE: ["e-", "pi+", "proton"]
collect_results:pid:
extends: .det_benchmark
stage: collect
needs:
- ["bench:mrich"]
script:
- bash benchmarks/pid/dummy_test.sh
artifacts:
paths:
- results/
allow_failure: true
- ls -lrht
#!/bin/bash
echo "PID Dummy Test..."
echo "passes."
exit 0
////////////////////////////////////////
// Read reconstruction ROOT output file
// Plot variables
////////////////////////////////////////
#include "ROOT/RDataFrame.hxx"
#include <iostream>
#include <fmt/core.h>
#include "dd4pod/Geant4ParticleCollection.h"
#include "dd4pod/PhotoMultiplierHitCollection.h"
#include "TCanvas.h"
#include "TStyle.h"
#include "TMath.h"
#include "TH1.h"
#include "TF1.h"
#include "TH1D.h"
using ROOT::RDataFrame;
using namespace ROOT::VecOps;
void mrich_analysis(const char* input_fname = "sim_output/sim_pid_backward_e-_5GeV.root", const char* input_pname = "e-")
{
// Setting for graphs
gROOT->SetStyle("Plain");
gStyle->SetOptFit(1);
gStyle->SetLineWidth(2);
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);
gStyle->SetPadGridX(1);
gStyle->SetPadGridY(1);
gStyle->SetPadLeftMargin(0.14);
gStyle->SetPadRightMargin(0.14);
ROOT::EnableImplicitMT();
ROOT::RDataFrame d0("events", input_fname);
// Number of hits
auto nhits = [] (const std::vector<dd4pod::PhotoMultiplierHitData>& evt) {return (int) evt.size(); };
// Define variables
auto d1 = d0.Define("nhits", nhits, {"MRICHHits"});
// Define Histograms
auto hNhits =
d1.Histo1D({"hNhits", "Number of hits per events; Number of hits; Events",
100, 0.0, 2000.0},
"nhits");
auto hXYhits =
d1.Histo2D({"hXYhits", "Hit positions for events; Horizontal position [mm]; Vertical position [mm]",
1000, -1000.0, +1000.0, 1000, -1000.0, +1000.0},
"MRICHHits.position.x", "MRICHHits.position.y");
// Event Counts
auto nevents_thrown = d1.Count();
std::cout << "Number of Thrown Events: " << (*nevents_thrown) << "\n";
// Draw Histograms
{
TCanvas* c1 = new TCanvas("c1", "c1", 700, 500);
auto h = hXYhits->DrawCopy();
c1->SaveAs(fmt::format("results/pid/backward/mrich/mrich_{}_hits_xy.png",input_pname).c_str());
c1->SaveAs(fmt::format("results/pid/backward/mrich/mrich_{}_hits_xy.pdf",input_pname).c_str());
}
{
TCanvas* c2 = new TCanvas("c2", "c2", 700, 500);
c2->SetLogy(1);
auto h = hNhits->DrawCopy();
//h->GetYaxis()->SetTitleOffset(1.4);
h->SetLineWidth(2);
h->SetLineColor(kBlue);
c2->SaveAs(fmt::format("results/pid/backward/mrich/mrich_{}_nhits.png",input_pname).c_str());
c2->SaveAs(fmt::format("results/pid/backward/mrich/mrich_{}_nhits.pdf",input_pname).c_str());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment