Skip to content

Commit

Permalink
Add c++ version without jitted code
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierCVilla committed Aug 15, 2018
1 parent 3f08eed commit 0e313a1
Showing 1 changed file with 204 additions and 38 deletions.
242 changes: 204 additions & 38 deletions cplusplus/distributions-nojitting.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

#include <iostream>

#include <TROOT.h>

using RDF = ROOT::RDataFrame;
using namespace std;

// Get input (temporal options)
auto treename = "distilled";
Expand Down Expand Up @@ -98,13 +101,16 @@ int main(int argc, char **argv)
// book metadata histograms
unsigned int timestamp_bins = timestamp_max - timestamp_min + 1.;

map<unsigned int, Binning*> binning_setup;
Binning binning_setup[binnings.size()];
map<unsigned int, ROOT::RDF::RResultPtr<TH1D>> bh_t_Nev_before, bh_t_Nev_after_no_corr;
map<unsigned int, ROOT::RDF::RResultPtr<TH1D>> bh_t_before, bh_t_after_no_corr, bh_t_after;
//map<unsigned int, TProfile*> bp_t_phi_corr, bp_t_full_corr;

for (unsigned int bi = 0; bi < binnings.size(); ++bi)
{
Binning b;
BuildBinningRDF(anal, binnings[bi], b);
binning_setup[bi] = &b;
binning_setup[bi] = b;
}
// zero counters
unsigned long n_ev_full = 0;
Expand Down Expand Up @@ -139,6 +145,9 @@ int main(int argc, char **argv)

auto f2 = f1.Filter(allDiagonalRPs, {"v_L_2_F", "v_L_2_N", "v_R_2_F", "v_R_2_N"}, "allDiagonalRPs");

auto model = ROOT::RDF::TH1DModel("h_timestamp_dgn", ";timestamp;rate (Hz)", int(timestamp_bins), timestamp_min-0.5, timestamp_max+0.5);
auto h_timestamp_dgn = f2.Histo1D(model, "timestamp");

//auto model = ROOT::RDF::TH1DModel("h_timestamp_dgn", ";timestamp;rate (Hz)", int(timestamp_bins), timestamp_min-0.5, timestamp_max+0.5);
//auto h_timestamp_dgn = f2.Histo1D(model, "timestamp");

Expand All @@ -149,40 +158,36 @@ int main(int argc, char **argv)

auto f_zerobias = f2.Filter(isZeroBiasEvent, {"trigger_bits"}, "zero_bias_event");

auto r2 = f2.Define("h_al", ApplyFineAlignment, {"timestamp" , "x_L_1_F", "x_L_2_N", "x_L_2_F", "x_R_1_F", "x_R_2_N", "x_R_2_F", "y_L_1_F", "y_L_2_N", "y_L_2_F", "y_R_1_F", "y_R_2_N", "y_R_2_F"});
// auto r2 = f2.Define("h_al", "ApplyFineAlignment( timestamp , x_L_1_F, x_L_2_N, x_L_2_F, x_R_1_F, x_R_2_N, x_R_2_F, y_L_1_F, y_L_2_N, y_L_2_F, y_R_1_F, y_R_2_N, y_R_2_F)");


//# .Define("h_al_x_L_1_F", "h_al.L_1_F.x")
//# .Define("h_al_x_L_2_N", "h_al.L_2_N.x")
//# .Define("h_al_x_L_2_F", "h_al.L_2_F.x")
//# .Define("h_al_y_L_1_F", "h_al.L_1_F.y")
//# .Define("h_al_y_L_2_N", "h_al.L_2_N.y")
//# .Define("h_al_y_L_2_F", "h_al.L_2_F.y")
//# .Define("h_al_x_R_1_F", "h_al.R_1_F.x")
//# .Define("h_al_x_R_2_N", "h_al.R_2_N.x")
//# .Define("h_al_x_R_2_F", "h_al.R_2_F.x")
//# .Define("h_al_y_R_1_F", "h_al.R_1_F.y")
//# .Define("h_al_y_R_2_N", "h_al.R_2_N.y")
//# .Define("h_al_y_R_2_F", "h_al.R_2_F.y");
//#
// // fill pre-selection histograms (Line 860 - 866)
// al_nosel_models = {
// ("h_y_L_1_F_vs_x_L_1_F_al_nosel", ";x^{L,1,F};y^{L,1,F}", 150, -15., 15., 300, -30., +30.),
// ("h_y_L_2_N_vs_x_L_2_N_al_nosel", ";x^{L,2,N};y^{L,2,N}", 150, -15., 15., 300, -30., +30.),
// ("h_y_L_2_F_vs_x_L_2_F_al_nosel", ";x^{L,2,F};y^{L,2,F}", 150, -15., 15., 300, -30., +30.),
// ("h_y_R_1_F_vs_x_R_1_F_al_nosel", ";x^{R,1,F};y^{R,1,F}", 150, -15., 15., 300, -30., +30.),
// ("h_y_R_2_N_vs_x_R_2_N_al_nosel", ";x^{R,2,N};y^{R,2,N}", 150, -15., 15., 300, -30., +30.),
// ("h_y_R_2_F_vs_x_R_2_F_al_nosel", ";x^{R,2,F};y^{R,2,F}", 150, -15., 15., 300, -30., +30.)
//};

//auto al_nosel_models0 = ROOT::RDF::TH2DModel("h_y_L_1_F_vs_x_L_1_F_al_nosel", ";x^{L,1,F};y^{L,1,F}", 150, -15., 15., 300, -30., +30.);
//auto h_y_L_1_F_vs_x_L_1_F_al_nosel = r2.Histo2D(al_nosel_models0, "h_al_x_L_1_F", "h_al_y_L_1_F");
//auto h_y_L_2_N_vs_x_L_2_N_al_nosel = r2.Histo2D(al_nosel_models[1], "h_al_x_L_2_N", "h_al_y_L_2_N");
//auto h_y_L_2_F_vs_x_L_2_F_al_nosel = r2.Histo2D(al_nosel_models[2], "h_al_x_L_2_F", "h_al_y_L_2_F");
//auto h_y_R_1_F_vs_x_R_1_F_al_nosel = r2.Histo2D(al_nosel_models[3], "h_al_x_R_1_F", "h_al_y_R_1_F");
//auto h_y_R_2_N_vs_x_R_2_N_al_nosel = r2.Histo2D(al_nosel_models[4], "h_al_x_R_2_N", "h_al_y_R_2_N");
//auto h_y_R_2_F_vs_x_R_2_F_al_nosel = r2.Histo2D(al_nosel_models[5], "h_al_x_R_2_F", "h_al_y_R_2_F");
auto r2 = f2.Define("h_al", ApplyFineAlignment, {"timestamp" , "x_L_1_F", "x_L_2_N", "x_L_2_F", "x_R_1_F", "x_R_2_N", "x_R_2_F", "y_L_1_F", "y_L_2_N", "y_L_2_F", "y_R_1_F", "y_R_2_N", "y_R_2_F"})
.Define("h_al_x_L_1_F", "h_al.L_1_F.x")
.Define("h_al_x_L_2_N", "h_al.L_2_N.x")
.Define("h_al_x_L_2_F", "h_al.L_2_F.x")
.Define("h_al_y_L_1_F", "h_al.L_1_F.y")
.Define("h_al_y_L_2_N", "h_al.L_2_N.y")
.Define("h_al_y_L_2_F", "h_al.L_2_F.y")
.Define("h_al_x_R_1_F", "h_al.R_1_F.x")
.Define("h_al_x_R_2_N", "h_al.R_2_N.x")
.Define("h_al_x_R_2_F", "h_al.R_2_F.x")
.Define("h_al_y_R_1_F", "h_al.R_1_F.y")
.Define("h_al_y_R_2_N", "h_al.R_2_N.y")
.Define("h_al_y_R_2_F", "h_al.R_2_F.y");

// fill pre-selection histograms (Line 860 - 866)
map<int, ROOT::RDF::TH2DModel>al_nosel_models = {
{0, ROOT::RDF::TH2DModel("h_y_L_1_F_vs_x_L_1_F_al_nosel", ";x^{L,1,F};y^{L,1,F}", 150, -15., 15., 300, -30., +30.)},
{1 , ROOT::RDF::TH2DModel("h_y_L_2_N_vs_x_L_2_N_al_nosel", ";x^{L,2,N};y^{L,2,N}", 150, -15., 15., 300, -30., +30.)},
{2 , ROOT::RDF::TH2DModel("h_y_L_2_F_vs_x_L_2_F_al_nosel", ";x^{L,2,F};y^{L,2,F}", 150, -15., 15., 300, -30., +30.)},
{3 , ROOT::RDF::TH2DModel("h_y_R_1_F_vs_x_R_1_F_al_nosel", ";x^{R,1,F};y^{R,1,F}", 150, -15., 15., 300, -30., +30.)},
{4 , ROOT::RDF::TH2DModel("h_y_R_2_N_vs_x_R_2_N_al_nosel", ";x^{R,2,N};y^{R,2,N}", 150, -15., 15., 300, -30., +30.)},
{5 , ROOT::RDF::TH2DModel("h_y_R_2_F_vs_x_R_2_F_al_nosel", ";x^{R,2,F};y^{R,2,F}", 150, -15., 15., 300, -30., +30.)}
};

auto h_y_L_1_F_vs_x_L_1_F_al_nosel = r2.Histo2D(al_nosel_models[0], "h_al_x_L_1_F", "h_al_y_L_1_F");
auto h_y_L_2_N_vs_x_L_2_N_al_nosel = r2.Histo2D(al_nosel_models[1], "h_al_x_L_2_N", "h_al_y_L_2_N");
auto h_y_L_2_F_vs_x_L_2_F_al_nosel = r2.Histo2D(al_nosel_models[2], "h_al_x_L_2_F", "h_al_y_L_2_F");
auto h_y_R_1_F_vs_x_R_1_F_al_nosel = r2.Histo2D(al_nosel_models[3], "h_al_x_R_1_F", "h_al_y_R_1_F");
auto h_y_R_2_N_vs_x_R_2_N_al_nosel = r2.Histo2D(al_nosel_models[4], "h_al_x_R_2_N", "h_al_y_R_2_N");
auto h_y_R_2_F_vs_x_R_2_F_al_nosel = r2.Histo2D(al_nosel_models[5], "h_al_x_R_2_F", "h_al_y_R_2_F");

auto r3 = r2.Define("kinematics", DoReconstruction , { "h_al" } );

Expand Down Expand Up @@ -224,20 +229,181 @@ auto r2 = f2.Define("h_al", ApplyFineAlignment, {"timestamp" , "x_L_1_F", "x_L_
auto r6 = r5.Define("norm_corr", getNorm_corr, {"timestamp"} )
.Define("normalization", getNormalization, {"norm_corr"} );

//auto al_nosel_models0 = ROOT::RDF::TH2DModel("h_y_L_1_F_vs_x_L_1_F_al_nosel", ";x^{L,1,F};y^{L,1,F}", 150, -15., 15., 300, -30., +30.);
//auto h_y_L_1_F_vs_x_L_1_F_al_nosel = r2.Histo2D(al_nosel_models0, "h_al_x_L_1_F", "h_al_y_L_1_F");
auto h_timestamp_sel = f4.Histo1D(ROOT::RDF::TH1DModel("h_timestamp_sel", ";timestamp;rate (Hz)", int(timestamp_bins), timestamp_min-0.5, timestamp_max+0.5), "timestamp");

// fill histograms
map<int, ROOT::RDF::TH2DModel> noal_sel_models = {
{0, ROOT::RDF::TH2DModel("h_y_L_1_F_vs_x_L_1_F_noal_sel", ";x^{L,1,F};y^{L,1,F}", 100, -3., +3., 300, -30., +30.)},
{1, ROOT::RDF::TH2DModel("h_y_L_2_N_vs_x_L_2_N_noal_sel", ";x^{L,2,N};y^{L,2,N}", 100, -3., +3., 300, -30., +30.)},
{2, ROOT::RDF::TH2DModel("h_y_L_2_F_vs_x_L_2_F_noal_sel", ";x^{L,2,F};y^{L,2,F}", 100, -3., +3., 300, -30., +30.)},
{3, ROOT::RDF::TH2DModel("h_y_R_1_F_vs_x_R_1_F_noal_sel", ";x^{R,1,F};y^{R,1,F}", 100, -3., +3., 300, -30., +30.)},
{4, ROOT::RDF::TH2DModel("h_y_R_2_N_vs_x_R_2_N_noal_sel", ";x^{R,2,N};y^{R,2,N}", 100, -3., +3., 300, -30., +30.)},
{5, ROOT::RDF::TH2DModel("h_y_R_2_F_vs_x_R_2_F_noal_sel", ";x^{R,2,F};y^{R,2,F}", 100, -3., +3., 300, -30., +30.)}
};

auto h_y_L_1_F_vs_x_L_1_F_noal_sel = f4.Histo2D(noal_sel_models[0], "x_L_1_F", "y_L_1_F");
auto h_y_L_2_N_vs_x_L_2_N_noal_sel = f4.Histo2D(noal_sel_models[1], "x_L_2_N", "y_L_2_N");
auto h_y_L_2_F_vs_x_L_2_F_noal_sel = f4.Histo2D(noal_sel_models[2], "x_L_2_F", "y_L_2_F");
auto h_y_R_1_F_vs_x_R_1_F_noal_sel = f4.Histo2D(noal_sel_models[3], "x_R_1_F", "y_R_1_F");
auto h_y_R_2_N_vs_x_R_2_N_noal_sel = f4.Histo2D(noal_sel_models[4], "x_R_2_N", "y_R_2_N");
auto h_y_R_2_F_vs_x_R_2_F_noal_sel = f4.Histo2D(noal_sel_models[5], "x_R_2_F", "y_R_2_F");

map<int, ROOT::RDF::TH2DModel> al_sel_models = {
{0, ROOT::RDF::TH2DModel("h_y_L_1_F_vs_x_L_1_F_al_sel", ";x^{L,1,F};y^{L,1,F}", 100, -3., +3., 300, -30., +30.)},
{1, ROOT::RDF::TH2DModel("h_y_L_2_N_vs_x_L_2_N_al_sel", ";x^{L,2,N};y^{L,2,N}", 100, -3., +3., 300, -30., +30.)},
{2, ROOT::RDF::TH2DModel("h_y_L_2_F_vs_x_L_2_F_al_sel", ";x^{L,2,F};y^{L,2,F}", 100, -3., +3., 300, -30., +30.)},
{3, ROOT::RDF::TH2DModel("h_y_R_1_F_vs_x_R_1_F_al_sel", ";x^{R,1,F};y^{R,1,F}", 100, -3., +3., 300, -30., +30.)},
{4, ROOT::RDF::TH2DModel("h_y_R_2_N_vs_x_R_2_N_al_sel", ";x^{R,2,N};y^{R,2,N}", 100, -3., +3., 300, -30., +30.)},
{5, ROOT::RDF::TH2DModel("h_y_R_2_F_vs_x_R_2_F_al_sel", ";x^{R,2,F};y^{R,2,F}", 100, -3., +3., 300, -30., +30.)}
};

auto h_y_L_1_F_vs_x_L_1_F_al_sel = f4.Histo2D(al_sel_models[0], "h_al_x_L_1_F", "h_al_y_L_1_F");
auto h_y_L_2_N_vs_x_L_2_N_al_sel = f4.Histo2D(al_sel_models[1], "h_al_x_L_2_N", "h_al_y_L_2_N");
auto h_y_L_2_F_vs_x_L_2_F_al_sel = f4.Histo2D(al_sel_models[2], "h_al_x_L_2_F", "h_al_y_L_2_F");
auto h_y_R_1_F_vs_x_R_1_F_al_sel = f4.Histo2D(al_sel_models[3], "h_al_x_R_1_F", "h_al_y_R_1_F");
auto h_y_R_2_N_vs_x_R_2_N_al_sel = f4.Histo2D(al_sel_models[4], "h_al_x_R_2_N", "h_al_y_R_2_N");
auto h_y_R_2_F_vs_x_R_2_F_al_sel = f4.Histo2D(al_sel_models[5], "h_al_x_R_2_F", "h_al_y_R_2_F");

// Line 1157 (k.th_x_R - k.th_x_L)
// (k.th_y_R - k.th_y_L)
auto th_x_diffLR = f4.Histo1D(ROOT::RDF::TH1DModel("th_x_diffLR", ";#theta_{x}^{R} - #theta_{x}^{L}", 1000, -500E-6, +500E-6), "k_th_x_diffLR");
auto th_y_diffLR = f4.Histo1D(ROOT::RDF::TH1DModel("th_y_diffLR", ";#theta_{y}^{R} - #theta_{y}^{L}", 500, -50E-6, +50E-6), "k_th_y_diffLR");

// Line 1160 (k.th_x_L - k.th_x)
// (k.th_x_R - k.th_x)
auto th_x_diffLF = f4.Histo1D(ROOT::RDF::TH1DModel("th_x_diffLF", ";#theta_{x}^{L} - #theta_{x}", 400, -200E-6, +200E-6), "k_th_x_diffLF");
auto th_x_diffRF = f4.Histo1D(ROOT::RDF::TH1DModel("th_x_diffRF", ";#theta_{x}^{R} - #theta_{x}", 400, -200E-6, +200E-6), "k_th_x_diffRF");

// Line 1163 (k.th_x, k.th_x_R - k.th_x_L)
// (k.th_y, k.th_y_R - k.th_y_L)
// (k.vtx_x, k.th_x_R - k.th_x_L)
auto h_th_x_diffLR_vs_th_x = f4.Histo2D(ROOT::RDF::TH2DModel("h_th_x_diffLR_vs_th_x", ";#theta_{x};#theta_{x}^{R} - #theta_{x}^{L}", 100, -300E-6, +300E-6, 120, -120E-6, +120E-6), "k_th_x", "k_th_x_diffLR");
auto h_th_y_diffLR_vs_th_y = f4.Histo2D(ROOT::RDF::TH2DModel("h_th_y_diffLR_vs_th_y", ";#theta_{y};#theta_{y}^{R} - #theta_{y}^{L}", 100, -500E-6, +500E-6, 120, -120E-6, +120E-6), "k_th_y", "k_th_y_diffLR");
auto h_th_x_diffLR_vs_vtx_x = f4.Histo2D(ROOT::RDF::TH2DModel("h_th_x_diffLR_vs_vtx_x", ";vtx_{x};#theta_{x}^{R} - #theta_{x}^{L}", 100, -300E-3, +300E-3, 120, -120E-6, +120E-6), "k_vtx_x", "k_th_x_diffLR");

auto h_th_y_L_vs_th_x_L = f4.Histo2D(ROOT::RDF::TH2DModel("h_th_y_L_vs_th_x_L", ";#theta_{x}^{L};#theta_{y}^{L}", 100, -115E-6, +11E-5, 100, 22E-6, +102E-6), "k_th_x_L", "k_th_y_L");
auto h_th_y_R_vs_th_x_R = f4.Histo2D(ROOT::RDF::TH2DModel("h_th_y_R_vs_th_x_R", ";#theta_{x}^{R};#theta_{y}^{R}", 100, -125E-6, +12E-5, 100, 27E-6, +102E-6), "k_th_x_R", "k_th_y_R");
auto h_th_y_vs_th_x = f4.Histo2D(ROOT::RDF::TH2DModel("h_th_y_vs_th_x", ";#theta_{x};#theta_{y}", 100, -300E-6, +300E-6, 100, -150E-6, +150E-6), "k_th_x", "k_th_y");

auto h_th_y_L_vs_th_y_R = f4.Histo2D(ROOT::RDF::TH2DModel("h_th_y_L_vs_th_y_R", ";#theta_{y}^{R};#theta_{y}^{L}",
300, -150E-6, +150E-6, 300, -150E-6, +150E-6), "k_th_y_R", "k_th_y_L");

// Line 1203: (k.th_x)
// (k.th_y)
auto h_th_x = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_x", ";#theta_{x}", 250, -500E-6, +500E-6), "k_th_x");
auto h_th_y = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_y", ";#theta_{y}", 250, -500E-6, +500E-6), "k_th_y");

// Line 1205: (-k.th_y)
auto h_th_y_flipped = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_y_flipped", ";#theta_{y}", 250, -500E-6, +500E-6), "minus_k_th_y");

// Line 1207: (k.th_x_L)
// (k.th_x_R)
auto h_th_x_L = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_x_L", ";#theta_{x}^{L}", 250, -500E-6, +500E-6), "k_th_x_L");
auto h_th_x_R = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_x_R", ";#theta_{x}^{R}", 250, -500E-6, +500E-6), "k_th_x_R");

auto h_th_y_L = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_y_L", ";#theta_{y}^{L}", 250, -500E-6, +500E-6), "k_th_y_L");
auto h_th_y_R = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_y_R", ";#theta_{y}^{R}", 250, -500E-6, +500E-6), "k_th_y_R");

// Line 1213: (k.th_y_L_F)
// (k.th_y_L_N)
// (k.th_y_R_N)
// (k.th_y_R_F)
auto h_th_y_L_F = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_y_L_F", ";#theta_{y}^{L_F}", 250, -500E-6, +500E-6), "k_th_y_L_F");
auto h_th_y_L_N = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_y_L_N", ";#theta_{y}^{L_N}", 250, -500E-6, +500E-6), "k_th_y_L_N");
auto h_th_y_R_N = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_y_R_N", ";#theta_{y}^{R_N}", 250, -500E-6, +500E-6), "k_th_y_R_N");
auto h_th_y_R_F = f4.Histo1D(ROOT::RDF::TH1DModel("h_th_y_R_F", ";#theta_{y}^{R_F}", 250, -500E-6, +500E-6), "k_th_y_R_F");

// fill vertex histograms

// Line 1220 (k.vtx_x)
// (k.vtx_x_L)
// (k.vtx_x_R)
auto h_vtx_x = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_x", ";x^{*}", 100, -0.5, +0.5) , "k_vtx_x");
auto h_vtx_x_L = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_x_L", ";x^{*,L}", 100, -0.5, +0.5) , "k_vtx_x_L");
auto h_vtx_x_R = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_x_R", ";x^{*,R}", 100, -0.5, +0.5) , "k_vtx_x_R");

// Line 1224 (k.vtx_y)
// (k.vtx_y_L)
// (k.vtx_y_R)
auto h_vtx_y = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_y", ";y^{*}", 100, -0.5, +0.5), "k_vtx_y");
auto h_vtx_y_L = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_y_L", ";y^{*,L}", 100, -0.5, +0.5), "k_vtx_y_L");
auto h_vtx_y_R = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_y_R", ";y^{*,R}", 100, -0.5, +0.5), "k_vtx_y_R");

// Line 1228:
// (k.vtx_x_R, k.vtx_x_L)
// (k.vtx_y_R, k.vtx_y_L)
auto h_vtx_x_L_vs_vtx_x_R = f4.Histo2D(ROOT::RDF::TH2DModel("h_vtx_x_L_vs_vtx_x_R", ";x^{*,R};x^{*,L}", 100, -0.5, +0.5, 100, -0.5, +0.5), "k_vtx_x_R", "k_vtx_x_L");
auto h_vtx_y_L_vs_vtx_y_R = f4.Histo2D(ROOT::RDF::TH2DModel("h_vtx_y_L_vs_vtx_y_R", ";y^{*,R};y^{*,L}", 100, -0.5, +0.5, 100, -0.5, +0.5), "k_vtx_y_R", "k_vtx_y_L");

// Line 1231:
// (k.th_x_L, k.vtx_x_L)
// (k.th_x_R, k.vtx_x_R)
// (k.th_y_L, k.vtx_y_L)
// (k.th_y_R, k.vtx_y_R)
auto h_vtx_x_L_vs_th_x_L = f4.Histo2D(ROOT::RDF::TH2DModel("h_vtx_x_L_vs_th_x_L", ";#theta_{x}^{L};x^{*,L}", 100, -600E-6, +600E-6, 100, -0.5, +0.5), "k_th_x_L", "k_vtx_x_L");
auto h_vtx_x_R_vs_th_x_R = f4.Histo2D(ROOT::RDF::TH2DModel("h_vtx_x_R_vs_th_x_R", ";#theta_{x}^{R};x^{*,R}", 100, -600E-6, +600E-6, 100, -0.5, +0.5), "k_th_x_R", "k_vtx_x_R");
auto h_vtx_y_L_vs_th_y_L = f4.Histo2D(ROOT::RDF::TH2DModel("h_vtx_y_L_vs_th_y_L", ";#theta_{y}^{L};y^{*,L}", 100, -600E-6, +600E-6, 100, -0.5, +0.5), "k_th_y_L", "k_vtx_y_L");
auto h_vtx_y_R_vs_th_y_R = f4.Histo2D(ROOT::RDF::TH2DModel("h_vtx_y_R_vs_th_y_R", ";#theta_{y}^{R};y^{*,R}", 100, -600E-6, +600E-6, 100, -0.5, +0.5), "k_th_y_R", "k_vtx_y_R");

// Line 1236:
// (k.vtx_x_R - k.vtx_x_L)
// (k.vtx_y_R - k.vtx_y_L)
auto h_vtx_x_diffLR = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_x_diffLR", ";x^{*,R} - x^{*,L}", 100, -0.5, +0.5), "k_vtx_x_diffLR");
auto h_vtx_y_diffLR = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_y_diffLR", ";y^{*,R} - y^{*,L}", 100, -0.5, +0.5), "k_vtx_y_diffLR");

// Line 1239:
// (k.th_x, k.vtx_x_R - k.vtx_x_L)
// (k.th_y, k.vtx_y_R - k.vtx_y_L)
auto h_vtx_x_diffLR_vs_th_x = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_x_diffLR", ";x^{*,R} - x^{*,L}", 100, -0.5, +0.5), "k_th_x", "k_vtx_x_diffLR");
auto h_vtx_y_diffLR_vs_th_y = f4.Histo1D(ROOT::RDF::TH1DModel("h_vtx_y_diffLR", ";y^{*,R} - y^{*,L}", 100, -0.5, +0.5), "k_th_y", "k_vtx_y_diffLR");

// Line 1245:
// (k.vtx_x_R, k.vtx_x_R - k.vtx_x_L)
// (k.vtx_y_R, k.vtx_y_R - k.vtx_y_L)
auto h_vtx_x_diffLR_vs_vtx_x_R = f4.Histo2D(ROOT::RDF::TH2DModel("h_vtx_x_diffLR_vs_vtx_x_R", ";x^{*,R};x^{*,R} - x^{*,L}", 100, -0.5, +0.5, 100, -0.5, +0.5), "k_vtx_x_R", "k_vtx_y_diffLR");
auto h_vtx_y_diffLR_vs_vtx_y_R = f4.Histo2D(ROOT::RDF::TH2DModel("h_vtx_y_diffLR_vs_vtx_y_R", ";y^{*,R};y^{*,R} - y^{*,L}", 100, -0.5, +0.5, 100, -0.5, +0.5), "k_vtx_y_R", "k_vtx_y_diffLR");

auto r7 = f4.Define("correction", CalculateAcceptanceCorrectionsRDF, { "kinematics"} )
.Define("corr", "correction.corr")
.Define("div_corr", "correction.div_corr")
.Define("one", [](){return 1;});

Binning* bis;
for(int bi = 0; bi < binnings.size() ; bi++){
bis = &binning_setup[bi];
bh_t_Nev_before[bi] = r7.Histo1D(ROOT::RDF::TH1DModel("h_t_Nev_before", ";|t|;events per bin", bis->N_bins, bis->bin_edges), "k_t", "one");
bh_t_before[bi] = r7.Histo1D(ROOT::RDF::TH1DModel("h_t_before", ";|t|", bis->N_bins, bis->bin_edges), "k_t", "one");
}

auto skipCorrection = [](Correction &correction){
return ! correction.skip;
};

auto f5 = r7.Filter( skipCorrection, {"correction"}, "acceptance correction");

for(int bi = 0; bi < binnings.size(); bi++){
bis = &binning_setup[bi];
bh_t_Nev_after_no_corr[bi] = f5.Histo1D(ROOT::RDF::TH1DModel("h_t_Nev_after_no_corr", ";|t|;events per bin", bis->N_bins, bis->bin_edges), "k_t", "one");
bh_t_after_no_corr[bi] = f5.Histo1D(ROOT::RDF::TH1DModel("h_t_after_no_corr", ";|t|", bis->N_bins, bis->bin_edges), "k_t", "one");
bh_t_after[bi] = f5.Histo1D(ROOT::RDF::TH1DModel("h_t_after", ";|t|", bis->N_bins, bis->bin_edges), "k_t", "corr");
}

// Line 1435
auto h_th_y_vs_th_x_after = f5.Histo2D(ROOT::RDF::TH2DModel("h_th_y_vs_th_x_after", ";#theta_{x};#theta_{y}", 150, -300E-6, +300E-6, 150, -150E-6, +150E-6), "k_th_x", "k_th_y", "div_corr");

// Line 1435
auto h_th_vs_phi_after = f5.Histo2D(ROOT::RDF::TH2DModel("h_th_vs_phi_after", ";#phi;#theta", 50, -M_PI, +M_PI, 50, 150E-6, 550E-6), "k_phi", "k_th", "div_corr");

// Line 1441
// apply normalization
auto bh_t_normalized_ob_1_30_02 = f5.Define("corr_norm", "corr * normalization")
.Histo1D(ROOT::RDF::TH1DModel("h_t_normalized", ";|t|",128, 0., 4.), "k_t", "corr_norm");

// Line 1445
auto h_th_y_vs_th_x_normalized = f5.Define("div_corr_norm", "correction.div_corr * normalization")
.Histo2D(ROOT::RDF::TH2DModel("h_th_y_vs_th_x_normalized", ";#theta_{x};#theta_{y}", 150, -600E-6, +600E-6, 150, -600E-6, +600E-6), "k_th_x", "k_th_y", "div_corr_norm");


// Trigger event
//h_y_L_1_F_vs_x_L_1_F_al_nosel.GetValue();
auto c = f5.Count().GetValue();
Expand Down

0 comments on commit 0e313a1

Please sign in to comment.