Skip to content

Commit

Permalink
[RDF] Implement a fast mode for df103*.C
Browse files Browse the repository at this point in the history
  • Loading branch information
stwunsch committed Jun 30, 2020
1 parent 1a2db3d commit 6b3297f
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions tutorials/dataframe/df103_NanoAODHiggsAnalysis.C
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
/// 3. Reconstruct the Higgs boson from the remaining Z boson candidates and calculate
/// its invariant mass.
///
/// The tutorial has the fast mode enabled by default, which reads the data from already skimmed
/// datasets with a total size of only 51MB. If the fast mode is disabled, the tutorial runs over
/// the full dataset with a size of 12GB.
///
/// \macro_image
/// \macro_code
/// \macro_output
Expand All @@ -37,6 +41,7 @@
#include "TLegend.h"
#include "Math/Vector4Dfwd.h"
#include "TStyle.h"
#include <string>

using namespace ROOT::VecOps;
using RNode = ROOT::RDF::RNode;
Expand Down Expand Up @@ -394,34 +399,35 @@ void plot(T sig, T bkg, T data, const std::string &x_label, const std::string &f
c->SaveAs(filename.c_str());
}

void df103_NanoAODHiggsAnalysis()
void df103_NanoAODHiggsAnalysis(const bool run_fast = true)
{
// Enable multi-threading
ROOT::EnableImplicitMT();

// In fast mode, take samples from */cms_opendata_2012_nanoaod_skimmed/*, which has
// the preselections from the selection_* functions already applied.
std::string path = "root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod";
if (run_fast) path += "_skimmed";

// Create dataframes for signal, background and data samples

// Signal: Higgs -> 4 leptons
ROOT::RDataFrame df_sig_4l("Events",
"root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/SMHiggsToZZTo4L.root");
ROOT::RDataFrame df_sig_4l("Events", path + "/SMHiggsToZZTo4L.root");

// Background: ZZ -> 4 leptons
// Note that additional background processes from the original paper with minor contribution were left out for this
// tutorial.
ROOT::RDataFrame df_bkg_4mu("Events",
"root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/ZZTo4mu.root");
ROOT::RDataFrame df_bkg_4el("Events",
"root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/ZZTo4e.root");
ROOT::RDataFrame df_bkg_2el2mu("Events",
"root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/ZZTo2e2mu.root");
ROOT::RDataFrame df_bkg_4mu("Events", path + "/ZZTo4mu.root");
ROOT::RDataFrame df_bkg_4el("Events", path + "/ZZTo4e.root");
ROOT::RDataFrame df_bkg_2el2mu("Events", path + "/ZZTo2e2mu.root");

// CMS data taken in 2012 (11.6 fb^-1 integrated luminosity)
ROOT::RDataFrame df_data_doublemu(
"Events", {"root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/Run2012B_DoubleMuParked.root",
"root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/Run2012C_DoubleMuParked.root"});
"Events", {path + "/Run2012B_DoubleMuParked.root",
path + "/Run2012C_DoubleMuParked.root"});
ROOT::RDataFrame df_data_doubleel(
"Events", {"root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/Run2012B_DoubleElectron.root",
"root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/Run2012C_DoubleElectron.root"});
"Events", {path + "/Run2012B_DoubleElectron.root",
path + "/Run2012C_DoubleElectron.root"});

// Reconstruct Higgs to 4 muons
auto df_sig_4mu_reco = reco_higgs_to_4mu(df_sig_4l);
Expand Down Expand Up @@ -500,5 +506,6 @@ void df103_NanoAODHiggsAnalysis()

int main()
{
df103_NanoAODHiggsAnalysis();
const auto run_fast = true;
df103_NanoAODHiggsAnalysis(run_fast);
}

0 comments on commit 6b3297f

Please sign in to comment.