Skip to content
Snippets Groups Projects

Re-enable DIS

Merged Wouter Deconinck requested to merge reenable-dis into master
1 file
+ 23
41
Compare changes
  • Side-by-side
  • Inline
@@ -179,7 +179,7 @@ int dis_electrons(const std::string& config_name)
@@ -179,7 +179,7 @@ int dis_electrons(const std::string& config_name)
{"target", "0.1"}}};
{"target", "0.1"}}};
// Run this in multi-threaded mode if desired
// Run this in multi-threaded mode if desired
//ROOT::EnableImplicitMT(kNumThreads);
ROOT::EnableImplicitMT(kNumThreads);
//Particle number enumeration
//Particle number enumeration
enum sidis_particle_ID
enum sidis_particle_ID
@@ -213,15 +213,6 @@ int dis_electrons(const std::string& config_name)
@@ -213,15 +213,6 @@ int dis_electrons(const std::string& config_name)
return common_bench::momenta_from_tracking(tracks, electron_mass);
return common_bench::momenta_from_tracking(tracks, electron_mass);
};
};
/*
//Old dataframe
auto d0 = d.Define("p_rec", momenta_from_tracking, {"outputTrackParameters"})
.Define("N", "p_rec.size()")
.Define("p_sim", common_bench::momenta_from_simulation, {"mcparticles2"})
.Define("mom_sim", common_bench::mom, {"p_sim"})
.Define("mom_rec", common_bench::mom, {"p_rec"});
*/
auto d0 = d .Define("electrons_rec", select_electrons, {"ReconstructedParticles"})
auto d0 = d .Define("electrons_rec", select_electrons, {"ReconstructedParticles"})
.Define("p_rec", momenta_from_reconstruction, {"electrons_rec"})
.Define("p_rec", momenta_from_reconstruction, {"electrons_rec"})
.Define("p_rec_sort", sort_momenta, {"p_rec"})
.Define("p_rec_sort", sort_momenta, {"p_rec"})
@@ -239,7 +230,7 @@ int dis_electrons(const std::string& config_name)
@@ -239,7 +230,7 @@ int dis_electrons(const std::string& config_name)
.Define("p_diff", sub, {"p_rec_sort","p_sim_sort"})
.Define("p_diff", sub, {"p_rec_sort","p_sim_sort"})
.Define("mom_rec", momentum, {"p_rec_sort"})
.Define("mom_rec", momentum, {"p_rec_sort"})
.Define("mom_sim", momentum, {"p_sim_sort"})
.Define("mom_sim", momentum, {"p_sim_sort"})
.Define("mom_diff", momentum, {"p_diff"})
.Define("mom_diff", "(mom_rec[0]-mom_sim[0])/mom_sim[0]")
/*
/*
.Define("electrons_sim", elec_PID_sim, {"sorted_sim"})
.Define("electrons_sim", elec_PID_sim, {"sorted_sim"})
.Define("Q2_sim_elec_pid", Q2_from_sim, {"electrons_sim"})
.Define("Q2_sim_elec_pid", Q2_from_sim, {"electrons_sim"})
@@ -256,14 +247,8 @@ int dis_electrons(const std::string& config_name)
@@ -256,14 +247,8 @@ int dis_electrons(const std::string& config_name)
auto h_Q2_rec = d0.Histo1D({"h_Q2_rec", "; GeV; counts", 100, -5, 25}, "elec_Q2_rec_rand");
auto h_Q2_rec = d0.Histo1D({"h_Q2_rec", "; GeV; counts", 100, -5, 25}, "elec_Q2_rec_rand");
auto h_Q2_res = d0.Histo1D({"h_Q2_res", "; ; counts", 100, -10, 10}, "Q2_diff");
auto h_Q2_res = d0.Histo1D({"h_Q2_res", "; ; counts", 100, -10, 10}, "Q2_diff");
/*
//TFitResultPtr f1 = h_Q2_res -> Fit("gaus", "S");
TH1D *h_Q2_res = (TH1D *)h_Q2_sim -> Clone();
//f1 -> Print("V");
TH1D *h_Q2_rec_copy = (TH1D *)h_Q2_rec -> Clone();
h_Q2_res -> Scale(1.0 / h_Q2_res -> Integral() );
h_Q2_res -> Add(h_Q2_rec_copy, -1.0 / h_Q2_rec_copy -> Integral() );
*/
TFitResultPtr f1 = h_Q2_res -> Fit("gaus", "S");
f1 -> 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
@@ -271,10 +256,9 @@ int dis_electrons(const std::string& config_name)
@@ -271,10 +256,9 @@ int dis_electrons(const std::string& config_name)
// Momentum
// Momentum
{
{
TCanvas c{"canvas", "canvas", 1200, 1200};
TCanvas c{"c", "c", 1200, 1200};
c.cd();
c.cd();
// gPad->SetLogx(false);
//gPad->SetLogy(true);
gPad->SetLogy(true);
auto& h1 = *h_mom_sim;
auto& h1 = *h_mom_sim;
auto& h2 = *h_mom_rec;
auto& h2 = *h_mom_rec;
// histogram style
// histogram style
@@ -291,25 +275,23 @@ int dis_electrons(const std::string& config_name)
@@ -291,25 +275,23 @@ int dis_electrons(const std::string& config_name)
// FIXME hardcoded beam configuration
// FIXME hardcoded beam configuration
common_bench::plot::draw_label(18, 275, detector);
common_bench::plot::draw_label(18, 275, detector);
TText* tptr1;
TText* tptr1;
auto t1 = new TPaveText(.6, .8417, .9, .925, "NB NDC");
TPaveText t1(.6, .8417, .9, .925, "NB NDC");
t1->SetFillColorAlpha(kWhite, 0);
t1.SetFillColorAlpha(kWhite, 0);
t1->SetTextFont(43);
t1.SetTextFont(43);
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("reconstructed");
tptr1->SetTextColor(common_bench::plot::kMpOrange);
tptr1->SetTextColor(common_bench::plot::kMpOrange);
t1->Draw();
t1.Draw();
c.Print(fmt::format("{}mom.png", output_prefix).c_str());
c.Print(fmt::format("{}mom.png", output_prefix).c_str());
}
}
// Q2
// Q2
{
{
TCanvas c{"canvas", "canvas", 1200, 1200};
TCanvas c{"c", "c", 1200, 1200};
c.cd();
c.cd();
// gPad->SetLogx(false);
//gPad->SetLogy(true);
gPad->SetLogy(true);
auto& h1 = *h_Q2_sim;
auto& h1 = *h_Q2_sim;
auto& h2 = *h_Q2_rec;
auto& h2 = *h_Q2_rec;
// histogram style
// histogram style
@@ -326,18 +308,18 @@ int dis_electrons(const std::string& config_name)
@@ -326,18 +308,18 @@ int dis_electrons(const std::string& config_name)
// FIXME hardcoded beam configuration
// FIXME hardcoded beam configuration
common_bench::plot::draw_label(18, 275, detector);
common_bench::plot::draw_label(18, 275, detector);
TText* tptr1;
TText* tptr1;
auto t1 = new TPaveText(.6, .8417, .9, .925, "NB NDC");
TPaveText t1(.6, .8417, .9, .925, "NB NDC");
t1->SetFillColorAlpha(kWhite, 0);
t1.SetFillColorAlpha(kWhite, 0);
t1->SetTextFont(43);
t1.SetTextFont(43);
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("reconstructed");
tptr1->SetTextColor(common_bench::plot::kMpOrange);
tptr1->SetTextColor(common_bench::plot::kMpOrange);
t1->Draw();
t1.Draw();
c.Print(fmt::format("{}Q2.png", output_prefix).c_str());
c.Print(fmt::format("{}Q2.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));
return 0;
return 0;
Loading