From 399d2fe0ff5156a0a8b37a23c53818d9968d8f71 Mon Sep 17 00:00:00 2001 From: Barak Schmookler Date: Fri, 20 Sep 2024 14:38:04 -0400 Subject: [PATCH] Update --- .gitlab-ci.yml | 2 + benchmarks/zdc_neutron/README.md | 2 +- .../zdc_neutron/analysis/fwd_neutrons_geant.C | 16 ++++---- benchmarks/zdc_neutron/config.yml | 38 +++++++++++++++++++ .../zdc_neutron/gen_forward_neutrons.cxx | 2 +- 5 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 benchmarks/zdc_neutron/config.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 002bb608..ad4727c0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -141,6 +141,7 @@ include: - local: 'benchmarks/barrel_hcal/config.yml' - local: 'benchmarks/zdc/config.yml' - local: 'benchmarks/zdc_lyso/config.yml' + - local: 'benchmarks/zdc_neutron/config.yml' - local: 'benchmarks/material_scan/config.yml' - local: 'benchmarks/pid/config.yml' - local: 'benchmarks/timing/config.yml' @@ -162,6 +163,7 @@ deploy_results: - "collect_results:tracking_performances_dis" - "collect_results:zdc" - "collect_results:zdc_lyso" + - "collect_results:zdc_neutron" script: - echo "deploy results!" - find results -print | sort | tee summary.txt diff --git a/benchmarks/zdc_neutron/README.md b/benchmarks/zdc_neutron/README.md index 981be6af..623d1465 100644 --- a/benchmarks/zdc_neutron/README.md +++ b/benchmarks/zdc_neutron/README.md @@ -2,7 +2,7 @@ Detector Benchmark for single neutron in the ZDC ================================================= ## Overview -This benchmark generates single-neutron events. The neutrons are generated with 100 GeV total momentum; polar angles of 0-6.5 mRad with respect to the proton/ion beam direction, uniform over cosine of the polar angle; and uniform azimuthal angles with respect to the proton/ion beam direction. The benchmark creates acceptance and reconstruction performance plots. +This benchmark generates single-neutron events. The neutrons are generated with 100 GeV total momentum; polar angles of 0-6 mRad with respect to the proton/ion beam direction, uniform over cosine of the polar angle; and uniform azimuthal angles with respect to the proton/ion beam direction. The benchmark creates acceptance and reconstruction performance plots. ## Contacts [Barak Schmookler](baraks@ucr.edu) diff --git a/benchmarks/zdc_neutron/analysis/fwd_neutrons_geant.C b/benchmarks/zdc_neutron/analysis/fwd_neutrons_geant.C index 73eedd3c..0e4c7e92 100644 --- a/benchmarks/zdc_neutron/analysis/fwd_neutrons_geant.C +++ b/benchmarks/zdc_neutron/analysis/fwd_neutrons_geant.C @@ -90,13 +90,13 @@ void fwd_neutrons_geant(std::string inputfile, std::string outputfile){ h3a_hcal->GetYaxis()->SetTitle("Number of cells hit per event");h3a_hcal->GetYaxis()->CenterTitle(); h3a_hcal->SetLineColor(kBlue);h3a_hcal->SetLineWidth(3); - //Cut on theta* < 3.5mRad + //Cut on theta* < 3.5 mRad TH1 *h3b_hcal = new TH1D("h3b_hcal","Cells w/ non-zero energy deposit ",100,0,64); h3b_hcal->GetXaxis()->SetTitle("Layer Number in ZDC HCal"); h3b_hcal->GetXaxis()->CenterTitle(); h3b_hcal->GetYaxis()->SetTitle("Number of cells hit per event");h3b_hcal->GetYaxis()->CenterTitle(); h3b_hcal->SetLineColor(kBlue);h3b_hcal->SetLineWidth(3); - //Cut on 6mRad < theta* < 8mRad + //Cut on 3.5 mRad < theta* < 6 mRad TH1 *h3c_hcal = new TH1D("h3c_hcal","Cells w/ non-zero energy deposit ",100,0,64); h3c_hcal->GetXaxis()->SetTitle("Layer Number in ZDC HCal"); h3c_hcal->GetXaxis()->CenterTitle(); h3c_hcal->GetYaxis()->SetTitle("Number of cells hit per event");h3c_hcal->GetYaxis()->CenterTitle(); @@ -135,7 +135,7 @@ void fwd_neutrons_geant(std::string inputfile, std::string outputfile){ TTreeReaderArray hcal_hit_z(tr, "HcalFarForwardZDCHits.position.z"); //Other variables - int counter(0),counter_3p5(0),counter_6to8(0); + int counter(0),counter_3p5(0),counter_3p5to6(0); TLorentzVector neut_true; //True neutron in lab coordinates TLorentzVector neut_true_rot; //True neutron wrt proton beam direction @@ -188,7 +188,7 @@ void fwd_neutrons_geant(std::string inputfile, std::string outputfile){ h3a_hcal->Fill(layer_number); if( neut_true_rot.Theta()*1000. < 3.5 ) h3b_hcal->Fill(layer_number); - if( neut_true_rot.Theta()*1000. > 6 && neut_true_rot.Theta()*1000 < 8) h3c_hcal->Fill(layer_number); + if( neut_true_rot.Theta()*1000. > 3.5 && neut_true_rot.Theta()*1000 < 6.) h3c_hcal->Fill(layer_number); } //End loop over HCal hits @@ -217,8 +217,8 @@ void fwd_neutrons_geant(std::string inputfile, std::string outputfile){ counter_3p5++; } - if( neut_true_rot.Theta()*1000. > 6 && neut_true_rot.Theta()*1000 < 8){ - counter_6to8++; + if( neut_true_rot.Theta()*1000. > 3.5 && neut_true_rot.Theta()*1000 < 6.){ + counter_3p5to6++; } } //End loop over events @@ -226,7 +226,7 @@ void fwd_neutrons_geant(std::string inputfile, std::string outputfile){ //Scale histograms h3a_hcal->Scale(1./counter); h3b_hcal->Scale(1./counter_3p5); - h3c_hcal->Scale(1./counter_6to8); + h3c_hcal->Scale(1./counter_3p5to6); //Make plots TCanvas *c1 = new TCanvas("c1"); @@ -309,7 +309,7 @@ void fwd_neutrons_geant(std::string inputfile, std::string outputfile){ TLegend *leg6c = new TLegend(0.5,0.6,0.9,0.8); leg6c->SetBorderSize(0);leg6c->SetFillStyle(0); - leg6c->SetHeader("Average over events w/ neutron 6 < #theta^{*} < 8 mRad"); + leg6c->SetHeader("Average over events w/ neutron 3.5 < #theta^{*} < 6 mRad"); leg6c->Draw(); //Print plots to file diff --git a/benchmarks/zdc_neutron/config.yml b/benchmarks/zdc_neutron/config.yml new file mode 100644 index 00000000..715a9b20 --- /dev/null +++ b/benchmarks/zdc_neutron/config.yml @@ -0,0 +1,38 @@ +sim:zdc_neutron: + extends: .det_benchmark + stage: simulate + script: + - snakemake --cache --cores 1 sim_output/zdc_neutron/epic_craterlake/fwd_neutrons.edm4eic.root + retry: + max: 2 + when: + - runner_system_failure + +bench:zdc_neutron: + extends: .det_benchmark + stage: benchmarks + needs: + - ["sim:zdc_neutron"] + script: + - snakemake --cores 1 results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf + +collect_results:zdc_neutron: + extends: .det_benchmark + stage: collect + needs: + - "bench:zdc_neutron" + script: + - ls -lrht + - mv results{,_save}/ # move results directory out of the way to preserve it + - snakemake --cores 1 --delete-all-output results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf + - mv results{_save,}/ + # convert to png + - | + gs -sDEVICE=pngalpha -dUseCropBox -r144 \ + -o 'results/zdc_neutron/epic_craterlake/geant_plots_%03d.png' \ + results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf + - | + gs -sDEVICE=pngalpha -dUseCropBox -r144 \ + -o 'results/zdc_neutron/epic_craterlake/recon_plots_%03d.png' \ + results/zdc_neutron/epic_craterlake/fwd_neutrons_recon.pdf + diff --git a/benchmarks/zdc_neutron/gen_forward_neutrons.cxx b/benchmarks/zdc_neutron/gen_forward_neutrons.cxx index fef4ef59..90a3eafe 100644 --- a/benchmarks/zdc_neutron/gen_forward_neutrons.cxx +++ b/benchmarks/zdc_neutron/gen_forward_neutrons.cxx @@ -22,7 +22,7 @@ void gen_forward_neutrons(int n_events = 10000, UInt_t seed = 0, const char* out { double theta_min = 0.0; //in mRad - double theta_max = 6.5; //in mRad + double theta_max = 6.0; //in mRad double cost_min = std::cos(theta_max/1000.) ; //Minimum value of cos(theta) double cost_max = std::cos(theta_min/1000.) ; //Maximum value of cos(theta)