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

Debugging of inclusive kinematics

parent 46493de5
No related branches found
No related tags found
1 merge request!114Debugging of inclusive kinematics
...@@ -35,6 +35,8 @@ int dis_electrons(const std::string& config_name) ...@@ -35,6 +35,8 @@ int dis_electrons(const std::string& config_name)
const std::string detector = config["detector"]; const std::string detector = config["detector"];
const std::string output_prefix = config["output_prefix"]; const std::string output_prefix = config["output_prefix"];
const std::string test_tag = config["test_tag"]; const std::string test_tag = config["test_tag"];
const int ebeam = config["ebeam"];
const int pbeam = config["pbeam"];
fmt::print(fmt::emphasis::bold | fg(fmt::color::forest_green), fmt::print(fmt::emphasis::bold | fg(fmt::color::forest_green),
"Running DIS electron analysis...\n"); "Running DIS electron analysis...\n");
...@@ -42,6 +44,8 @@ int dis_electrons(const std::string& config_name) ...@@ -42,6 +44,8 @@ int dis_electrons(const std::string& config_name)
fmt::print(" - input file: {}\n", rec_file); fmt::print(" - input file: {}\n", rec_file);
fmt::print(" - output prefix: {}\n", output_prefix); fmt::print(" - output prefix: {}\n", output_prefix);
fmt::print(" - test tag: {}\n", test_tag); fmt::print(" - test tag: {}\n", test_tag);
fmt::print(" - ebeam: {}\n", ebeam);
fmt::print(" - pbeam: {}\n", pbeam);
// create our test definition // create our test definition
// test_tag // test_tag
...@@ -110,6 +114,16 @@ int dis_electrons(const std::string& config_name) ...@@ -110,6 +114,16 @@ int dis_electrons(const std::string& config_name)
TFitResultPtr f_x_el_res = h_x_el_res->Fit("gaus", "S"); TFitResultPtr f_x_el_res = h_x_el_res->Fit("gaus", "S");
if (f_x_el_res == 0) f_x_el_res->Print("V"); if (f_x_el_res == 0) f_x_el_res->Print("V");
TFitResultPtr f_Q2_jb_res = h_Q2_jb_res->Fit("gaus", "S");
if (f_Q2_jb_res == 0) f_Q2_jb_res->Print("V");
TFitResultPtr f_x_jb_res = h_x_jb_res->Fit("gaus", "S");
if (f_x_jb_res == 0) f_x_jb_res->Print("V");
TFitResultPtr f_Q2_da_res = h_Q2_da_res->Fit("gaus", "S");
if (f_Q2_da_res == 0) f_Q2_da_res->Print("V");
TFitResultPtr f_x_da_res = h_x_da_res->Fit("gaus", "S");
if (f_x_da_res == 0) f_x_da_res->Print("V");
// Plot our histograms. // Plot our histograms.
// TODO: to start I'm explicitly plotting the histograms, but want to // TODO: to start I'm explicitly plotting the histograms, but want to
// factorize out the plotting code moving forward. // factorize out the plotting code moving forward.
...@@ -141,8 +155,8 @@ int dis_electrons(const std::string& config_name) ...@@ -141,8 +155,8 @@ int dis_electrons(const std::string& config_name)
h2.DrawClone("hist same"); h2.DrawClone("hist same");
h3.DrawClone("hist same"); h3.DrawClone("hist same");
h4.DrawClone("hist same"); h4.DrawClone("hist same");
// FIXME hardcoded beam configuration // legend
common_bench::plot::draw_label(18, 275, detector); common_bench::plot::draw_label(ebeam, pbeam, detector);
TText* tptr1; TText* tptr1;
TPaveText t1(.6, .8417, .9, .925, "NB NDC"); TPaveText t1(.6, .8417, .9, .925, "NB NDC");
t1.SetFillColorAlpha(kWhite, 0); t1.SetFillColorAlpha(kWhite, 0);
...@@ -150,14 +164,14 @@ int dis_electrons(const std::string& config_name) ...@@ -150,14 +164,14 @@ int dis_electrons(const std::string& config_name)
t1.SetTextSize(25); t1.SetTextSize(25);
tptr1 = t1.AddText("simulated"); tptr1 = t1.AddText("simulated");
tptr1->SetTextColor(common_bench::plot::kMpBlue); tptr1->SetTextColor(common_bench::plot::kMpBlue);
tptr1 = t1.AddText("electron"); tptr1 = t1.AddText("EL method");
tptr1->SetTextColor(common_bench::plot::kMpOrange); tptr1->SetTextColor(common_bench::plot::kMpOrange);
tptr1 = t1.AddText("JB"); tptr1 = t1.AddText("JB method");
tptr1->SetTextColor(common_bench::plot::kMpRed); tptr1->SetTextColor(common_bench::plot::kMpRed);
tptr1 = t1.AddText("DA"); tptr1 = t1.AddText("DA method");
tptr1->SetTextColor(common_bench::plot::kMpGreen); tptr1->SetTextColor(common_bench::plot::kMpGreen);
t1.Draw(); t1.Draw();
c.Print(fmt::format("{}Q2.png", output_prefix).c_str()); c.Print(fmt::format("{}_Q2.png", output_prefix).c_str());
} }
// Q2 resolution // Q2 resolution
...@@ -170,11 +184,11 @@ int dis_electrons(const std::string& config_name) ...@@ -170,11 +184,11 @@ int dis_electrons(const std::string& config_name)
auto& h2 = *h_Q2_jb_res; auto& h2 = *h_Q2_jb_res;
auto& h3 = *h_Q2_da_res; auto& h3 = *h_Q2_da_res;
// histogram style // histogram style
h1.SetLineColor(common_bench::plot::kMpBlue); h1.SetLineColor(common_bench::plot::kMpOrange);
h1.SetLineWidth(2); h1.SetLineWidth(2);
h2.SetLineColor(common_bench::plot::kMpOrange); h2.SetLineColor(common_bench::plot::kMpRed);
h2.SetLineWidth(2); h2.SetLineWidth(2);
h3.SetLineColor(common_bench::plot::kMpRed); h3.SetLineColor(common_bench::plot::kMpGreen);
h3.SetLineWidth(2); h3.SetLineWidth(2);
// axes // axes
h1.GetXaxis()->CenterTitle(); h1.GetXaxis()->CenterTitle();
...@@ -183,9 +197,21 @@ int dis_electrons(const std::string& config_name) ...@@ -183,9 +197,21 @@ int dis_electrons(const std::string& config_name)
h1.DrawClone("hist"); h1.DrawClone("hist");
h2.DrawClone("hist same"); h2.DrawClone("hist same");
h3.DrawClone("hist same"); h3.DrawClone("hist same");
// FIXME hardcoded beam configuration // legend
common_bench::plot::draw_label(18, 275, detector); common_bench::plot::draw_label(ebeam, pbeam, detector);
c.Print(fmt::format("{}Q2resolution.png", output_prefix).c_str()); TText* tptr1;
TPaveText t1(.6, .8417, .9, .925, "NB NDC");
t1.SetFillColorAlpha(kWhite, 0);
t1.SetTextFont(43);
t1.SetTextSize(25);
tptr1 = t1.AddText("EL method");
tptr1->SetTextColor(common_bench::plot::kMpOrange);
tptr1 = t1.AddText("JB method");
tptr1->SetTextColor(common_bench::plot::kMpRed);
tptr1 = t1.AddText("DA method");
tptr1->SetTextColor(common_bench::plot::kMpGreen);
t1.Draw();
c.Print(fmt::format("{}_Q2_resolution.png", output_prefix).c_str());
} }
// x comparison // x comparison
...@@ -215,8 +241,8 @@ int dis_electrons(const std::string& config_name) ...@@ -215,8 +241,8 @@ int dis_electrons(const std::string& config_name)
h2.DrawClone("hist same"); h2.DrawClone("hist same");
h3.DrawClone("hist same"); h3.DrawClone("hist same");
h4.DrawClone("hist same"); h4.DrawClone("hist same");
// FIXME hardcoded beam configuration // legend
common_bench::plot::draw_label(18, 275, detector); common_bench::plot::draw_label(ebeam, pbeam, detector);
TText* tptr1; TText* tptr1;
TPaveText t1(.6, .8417, .9, .925, "NB NDC"); TPaveText t1(.6, .8417, .9, .925, "NB NDC");
t1.SetFillColorAlpha(kWhite, 0); t1.SetFillColorAlpha(kWhite, 0);
...@@ -224,10 +250,14 @@ int dis_electrons(const std::string& config_name) ...@@ -224,10 +250,14 @@ int dis_electrons(const std::string& config_name)
t1.SetTextSize(25); t1.SetTextSize(25);
tptr1 = t1.AddText("simulated"); tptr1 = t1.AddText("simulated");
tptr1->SetTextColor(common_bench::plot::kMpBlue); tptr1->SetTextColor(common_bench::plot::kMpBlue);
tptr1 = t1.AddText("reconstructed"); tptr1 = t1.AddText("EL method");
tptr1->SetTextColor(common_bench::plot::kMpOrange); tptr1->SetTextColor(common_bench::plot::kMpOrange);
tptr1 = t1.AddText("JB method");
tptr1->SetTextColor(common_bench::plot::kMpRed);
tptr1 = t1.AddText("DA method");
tptr1->SetTextColor(common_bench::plot::kMpGreen);
t1.Draw(); t1.Draw();
c.Print(fmt::format("{}x.png", output_prefix).c_str()); c.Print(fmt::format("{}_x.png", output_prefix).c_str());
} }
// x resolution // x resolution
...@@ -240,11 +270,11 @@ int dis_electrons(const std::string& config_name) ...@@ -240,11 +270,11 @@ int dis_electrons(const std::string& config_name)
auto& h2 = *h_x_jb_res; auto& h2 = *h_x_jb_res;
auto& h3 = *h_x_da_res; auto& h3 = *h_x_da_res;
// histogram style // histogram style
h1.SetLineColor(common_bench::plot::kMpBlue); h1.SetLineColor(common_bench::plot::kMpOrange);
h1.SetLineWidth(2); h1.SetLineWidth(2);
h2.SetLineColor(common_bench::plot::kMpOrange); h2.SetLineColor(common_bench::plot::kMpRed);
h2.SetLineWidth(2); h2.SetLineWidth(2);
h3.SetLineColor(common_bench::plot::kMpRed); h3.SetLineColor(common_bench::plot::kMpGreen);
h3.SetLineWidth(2); h3.SetLineWidth(2);
// axes // axes
h1.GetXaxis()->CenterTitle(); h1.GetXaxis()->CenterTitle();
...@@ -253,9 +283,21 @@ int dis_electrons(const std::string& config_name) ...@@ -253,9 +283,21 @@ int dis_electrons(const std::string& config_name)
h1.DrawClone("hist"); h1.DrawClone("hist");
h2.DrawClone("hist same"); h2.DrawClone("hist same");
h3.DrawClone("hist same"); h3.DrawClone("hist same");
// FIXME hardcoded beam configuration // legend
common_bench::plot::draw_label(18, 275, detector); common_bench::plot::draw_label(ebeam, pbeam, detector);
c.Print(fmt::format("{}xresolution.png", output_prefix).c_str()); TText* tptr1;
TPaveText t1(.6, .8417, .9, .925, "NB NDC");
t1.SetFillColorAlpha(kWhite, 0);
t1.SetTextFont(43);
t1.SetTextSize(25);
tptr1 = t1.AddText("EL method");
tptr1->SetTextColor(common_bench::plot::kMpOrange);
tptr1 = t1.AddText("JB method");
tptr1->SetTextColor(common_bench::plot::kMpRed);
tptr1 = t1.AddText("DA method");
tptr1->SetTextColor(common_bench::plot::kMpGreen);
t1.Draw();
c.Print(fmt::format("{}_x_resolution.png", output_prefix).c_str());
} }
common_bench::write_test({dis_Q2_resolution}, fmt::format("{}dis_electrons.json", output_prefix)); common_bench::write_test({dis_Q2_resolution}, fmt::format("{}dis_electrons.json", output_prefix));
......
...@@ -35,6 +35,8 @@ int rec_analysis_ecal(const std::string& config_name) ...@@ -35,6 +35,8 @@ int rec_analysis_ecal(const std::string& config_name)
const std::string detector = config["detector"]; const std::string detector = config["detector"];
const std::string output_prefix = config["output_prefix"]; const std::string output_prefix = config["output_prefix"];
const std::string test_tag = config["test_tag"]; const std::string test_tag = config["test_tag"];
const int ebeam = config["ebeam"];
const int pbeam = config["pbeam"];
fmt::print(fmt::emphasis::bold | fg(fmt::color::forest_green), fmt::print(fmt::emphasis::bold | fg(fmt::color::forest_green),
"Running DIS electron analysis...\n"); "Running DIS electron analysis...\n");
...@@ -42,6 +44,8 @@ int rec_analysis_ecal(const std::string& config_name) ...@@ -42,6 +44,8 @@ int rec_analysis_ecal(const std::string& config_name)
fmt::print(" - input file: {}\n", rec_file); fmt::print(" - input file: {}\n", rec_file);
fmt::print(" - output prefix: {}\n", output_prefix); fmt::print(" - output prefix: {}\n", output_prefix);
fmt::print(" - test tag: {}\n", test_tag); fmt::print(" - test tag: {}\n", test_tag);
fmt::print(" - ebeam: {}\n", ebeam);
fmt::print(" - pbeam: {}\n", pbeam);
// create our test definition // create our test definition
// test_tag // test_tag
......
...@@ -35,6 +35,8 @@ int rec_analysis_hcal(const std::string& config_name) ...@@ -35,6 +35,8 @@ int rec_analysis_hcal(const std::string& config_name)
const std::string detector = config["detector"]; const std::string detector = config["detector"];
const std::string output_prefix = config["output_prefix"]; const std::string output_prefix = config["output_prefix"];
const std::string test_tag = config["test_tag"]; const std::string test_tag = config["test_tag"];
const int ebeam = config["ebeam"];
const int pbeam = config["pbeam"];
fmt::print(fmt::emphasis::bold | fg(fmt::color::forest_green), fmt::print(fmt::emphasis::bold | fg(fmt::color::forest_green),
"Running DIS electron analysis...\n"); "Running DIS electron analysis...\n");
...@@ -42,6 +44,8 @@ int rec_analysis_hcal(const std::string& config_name) ...@@ -42,6 +44,8 @@ int rec_analysis_hcal(const std::string& config_name)
fmt::print(" - input file: {}\n", rec_file); fmt::print(" - input file: {}\n", rec_file);
fmt::print(" - output prefix: {}\n", output_prefix); fmt::print(" - output prefix: {}\n", output_prefix);
fmt::print(" - test tag: {}\n", test_tag); fmt::print(" - test tag: {}\n", test_tag);
fmt::print(" - ebeam: {}\n", ebeam);
fmt::print(" - pbeam: {}\n", pbeam);
// create our test definition // create our test definition
// test_tag // test_tag
......
...@@ -12,7 +12,7 @@ dis:generate: ...@@ -12,7 +12,7 @@ dis:generate:
PBEAM: 275 PBEAM: 275
timeout: 1 hours timeout: 1 hours
script: script:
- bash benchmarks/dis/gen.sh --config dis_${EBEAM}x${PBEAM} --ebeam ${EBEAM} --pbeam ${PBEAM} - bash benchmarks/dis/get.sh --config dis_${EBEAM}x${PBEAM} --ebeam ${EBEAM} --pbeam ${PBEAM}
dis:process: dis:process:
stage: process stage: process
......
#!/bin/bash
## =============================================================================
## Standin for a proper pythia generation process, similar to how we
## generate events for DVMP
## Runs in 5 steps:
## 1. Parse the command line and setup the environment
## 2. Check if we can download the file
## 3. Finalize
## =============================================================================
## =============================================================================
## make sure we launch this script from the project root directory
PROJECT_ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"/../..
pushd ${PROJECT_ROOT}
## =============================================================================
## Step 1: Setup the environment variables
## First parse the command line flags.
## This sets the following environment variables:
## - CONFIG: The specific generator configuration --> not currenlty used FIXME
## - EBEAM: The electron beam energy --> not currently used FIXME
## - PBEAM: The ion beam energy --> not currently used FIXME
source parse_cmd.sh $@
## To run the generator, we need the following global variables:
##
## - LOCAL_PREFIX: Place to cache local packages and data
## - JUGGLER_N_EVENTS: Number of events to process
## - JUGGLER_RNG_SEED: Random seed for event generation.
##
## defined in common_bench repo
## You can ready bin/env.sh for more in-depth explanations of the variables
## and how they can be controlled.
## We also need the following benchmark-specific variables:
##
## - BENCHMARK_TAG: Unique identified for this benchmark process.
## - INPUT_PATH: Path for generator-level input to the benchmarks
## - TMP_PATH: Path for temporary data (not exported as artifacts)
##
## You can read dvmp/env.sh for more in-depth explanations of the variables.
source benchmarks/dis/env.sh
## Get a unique file name prefix based on the configuration options
GEN_TAG=gen-${CONFIG}_${JUGGLER_N_EVENTS} ## Generic file prefix
## =============================================================================
## Step 2: Check if we can find the file
if [ -f "${INPUT_PATH}/${GEN_TAG}.hepmc" ]; then
echo "Found cached generator output for $GEN_TAG, no need to rerun"
exit 0
fi
## =============================================================================
## Step 3: Copy the file (about 180 lines per event in DIS NC files)
nlines=$((180*${JUGGLER_N_EVENTS}))
mc config host add S3 https://dtn01.sdcc.bnl.gov:9000 ${S3_ACCESS_KEY} ${S3_SECRET_KEY}
mc head -n ${nlines} S3/eictest/ATHENA/EVGEN/DIS/NC/${EBEAM}x${PBEAM}/minQ2=1/pythia8NCDIS_${EBEAM}x${PBEAM}_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_vtxfix_1.hepmc > ${TMP_PATH}/${GEN_TAG}.hepmc
if [[ "$?" -ne "0" ]] ; then
echo "ERROR downloading file"
exit 1
fi
## =============================================================================
## Step 4: Finally, move relevant output into the artifacts directory and clean up
## =============================================================================
echo "Moving generator output into ${INPUT_PATH}"
mv ${TMP_PATH}/${GEN_TAG}.hepmc ${INPUT_PATH}/${GEN_TAG}.hepmc
## this step only matters for local execution
echo "Cleaning up"
## does nothing
## =============================================================================
## All done!
echo "$BENCHMARK_TAG event generation complete"
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