Skip to content

Commit

Permalink
dis: enable backwards-compatibility with previous versions of EICrecon (
Browse files Browse the repository at this point in the history
  • Loading branch information
veprbl authored Aug 29, 2024
1 parent 388dff9 commit a2cbe91
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
18 changes: 16 additions & 2 deletions benchmarks/dis/analysis/dis_electrons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ int dis_electrons(const std::string& config_name)
ROOT::EnableImplicitMT(kNumThreads);
ROOT::RDataFrame d("events", rec_file);

std::string esigma_Q2_col_name, esigma_x_col_name;
if (d.HasColumn("InclusiveKinematicsESigma.Q2")) {
// new style
esigma_Q2_col_name = "InclusiveKinematicsESigma.Q2";
esigma_x_col_name = "InclusiveKinematicsESigma.Q2";
} else if (d.HasColumn("InclusiveKinematicseSigma.x")) {
// new style
esigma_Q2_col_name = "InclusiveKinematicseSigma.Q2";
esigma_x_col_name = "InclusiveKinematicseSigma.x";
} else {
std::cerr << "Can't find InclusiveKinematicsESigma.Q2 column" << std::endl;
std::exit(EXIT_FAILURE);
}

auto combinatorial_diff_ratio = [] (
const ROOT::VecOps::RVec<float>& v1,
const ROOT::VecOps::RVec<float>& v2
Expand All @@ -81,7 +95,7 @@ int dis_electrons(const std::string& config_name)
.Define("Q2_jb", "InclusiveKinematicsJB.Q2")
.Define("Q2_da", "InclusiveKinematicsDA.Q2")
.Define("Q2_sigma", "InclusiveKinematicsSigma.Q2")
.Define("Q2_esigma", "InclusiveKinematicsESigma.Q2")
.Define("Q2_esigma", esigma_Q2_col_name) // InclusiveKinematicsESigma.Q2
.Define("logQ2_sim", "log10(Q2_sim)")
.Define("logQ2_el", "log10(Q2_el)")
.Define("logQ2_jb", "log10(Q2_jb)")
Expand All @@ -98,7 +112,7 @@ int dis_electrons(const std::string& config_name)
.Define("x_jb", "InclusiveKinematicsJB.x")
.Define("x_da", "InclusiveKinematicsDA.x")
.Define("x_sigma", "InclusiveKinematicsSigma.x")
.Define("x_esigma", "InclusiveKinematicsESigma.x")
.Define("x_esigma", esigma_x_col_name) // InclusiveKinematicsESigma.x
.Define("x_el_res", combinatorial_diff_ratio, {"x_sim", "x_el"})
.Define("x_jb_res", combinatorial_diff_ratio, {"x_sim", "x_jb"})
.Define("x_da_res", combinatorial_diff_ratio, {"x_sim", "x_da"})
Expand Down
9 changes: 7 additions & 2 deletions benchmarks/dis/analysis/kinematics_correlations.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,13 @@ def Xcorrelation(minq2,method): #minq2 can be 1,10,100, or 1000; method can be '
JacquetBlondel = [keys['InclusiveKinematicsJB.Q2'], keys['InclusiveKinematicsJB.x']]
keys = ur.concatenate(rec_file + ':events/' + 'InclusiveKinematicsSigma')
Sigma = [keys['InclusiveKinematicsSigma.Q2'], keys['InclusiveKinematicsSigma.x']]
keys = ur.concatenate(rec_file + ':events/' + 'InclusiveKinematicsESigma')
ESigma = [keys['InclusiveKinematicsESigma.Q2'], keys['InclusiveKinematicsESigma.x']]
try:
keys = ur.concatenate(rec_file + ':events/' + 'InclusiveKinematicsESigma')
ESigma = [keys['InclusiveKinematicsESigma.Q2'], keys['InclusiveKinematicsESigma.x']]
except ur.KeyInFileError:
# Legacy compatibility
keys = ur.concatenate(rec_file + ':events/' + 'InclusiveKinematicseSigma')
ESigma = [keys['InclusiveKinematicseSigma.Q2'], keys['InclusiveKinematicseSigma.x']]

Q2values_T = Truth[0]
Q2values_E = Electron[0]
Expand Down

0 comments on commit a2cbe91

Please sign in to comment.