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

More changes...

parent a3e54b91
No related branches found
No related tags found
1 merge request!81Re-enable DIS
This commit is part of merge request !81. Comments created here will be created in the context of that merge request.
......@@ -179,7 +179,7 @@ int dis_electrons(const std::string& config_name)
{"target", "0.1"}}};
// Run this in multi-threaded mode if desired
//ROOT::EnableImplicitMT(kNumThreads);
ROOT::EnableImplicitMT(kNumThreads);
//Particle number enumeration
enum sidis_particle_ID
......@@ -213,15 +213,6 @@ int dis_electrons(const std::string& config_name)
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"})
.Define("p_rec", momenta_from_reconstruction, {"electrons_rec"})
.Define("p_rec_sort", sort_momenta, {"p_rec"})
......@@ -239,7 +230,7 @@ int dis_electrons(const std::string& config_name)
.Define("p_diff", sub, {"p_rec_sort","p_sim_sort"})
.Define("mom_rec", momentum, {"p_rec_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("Q2_sim_elec_pid", Q2_from_sim, {"electrons_sim"})
......@@ -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_res = d0.Histo1D({"h_Q2_res", "; ; counts", 100, -10, 10}, "Q2_diff");
/*
TH1D *h_Q2_res = (TH1D *)h_Q2_sim -> Clone();
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");
//TFitResultPtr f1 = h_Q2_res -> Fit("gaus", "S");
//f1 -> Print("V");
// Plot our histograms.
// TODO: to start I'm explicitly plotting the histograms, but want to
......@@ -271,10 +256,9 @@ int dis_electrons(const std::string& config_name)
// Momentum
{
TCanvas c{"canvas", "canvas", 1200, 1200};
TCanvas c{"c", "c", 1200, 1200};
c.cd();
// gPad->SetLogx(false);
gPad->SetLogy(true);
//gPad->SetLogy(true);
auto& h1 = *h_mom_sim;
auto& h2 = *h_mom_rec;
// histogram style
......@@ -291,25 +275,23 @@ int dis_electrons(const std::string& config_name)
// FIXME hardcoded beam configuration
common_bench::plot::draw_label(18, 275, detector);
TText* tptr1;
auto t1 = new TPaveText(.6, .8417, .9, .925, "NB NDC");
t1->SetFillColorAlpha(kWhite, 0);
t1->SetTextFont(43);
t1->SetTextSize(25);
tptr1 = t1->AddText("simulated");
TPaveText t1(.6, .8417, .9, .925, "NB NDC");
t1.SetFillColorAlpha(kWhite, 0);
t1.SetTextFont(43);
t1.SetTextSize(25);
tptr1 = t1.AddText("simulated");
tptr1->SetTextColor(common_bench::plot::kMpBlue);
tptr1 = t1->AddText("reconstructed");
tptr1 = t1.AddText("reconstructed");
tptr1->SetTextColor(common_bench::plot::kMpOrange);
t1->Draw();
t1.Draw();
c.Print(fmt::format("{}mom.png", output_prefix).c_str());
}
// Q2
{
TCanvas c{"canvas", "canvas", 1200, 1200};
TCanvas c{"c", "c", 1200, 1200};
c.cd();
// gPad->SetLogx(false);
gPad->SetLogy(true);
//gPad->SetLogy(true);
auto& h1 = *h_Q2_sim;
auto& h2 = *h_Q2_rec;
// histogram style
......@@ -326,18 +308,18 @@ int dis_electrons(const std::string& config_name)
// FIXME hardcoded beam configuration
common_bench::plot::draw_label(18, 275, detector);
TText* tptr1;
auto t1 = new TPaveText(.6, .8417, .9, .925, "NB NDC");
t1->SetFillColorAlpha(kWhite, 0);
t1->SetTextFont(43);
t1->SetTextSize(25);
tptr1 = t1->AddText("simulated");
TPaveText t1(.6, .8417, .9, .925, "NB NDC");
t1.SetFillColorAlpha(kWhite, 0);
t1.SetTextFont(43);
t1.SetTextSize(25);
tptr1 = t1.AddText("simulated");
tptr1->SetTextColor(common_bench::plot::kMpBlue);
tptr1 = t1->AddText("reconstructed");
tptr1 = t1.AddText("reconstructed");
tptr1->SetTextColor(common_bench::plot::kMpOrange);
t1->Draw();
t1.Draw();
c.Print(fmt::format("{}Q2.png", output_prefix).c_str());
}
common_bench::write_test({dis_Q2_resolution}, fmt::format("{}dis_electrons.json", output_prefix));
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment