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

Benchmarks for mrich: number of hits

parent 310224b3
No related branches found
No related tags found
1 merge request!80Benchmarks for mrich: number of hits
#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.
Finish editing this message first!
Please register or to comment