Skip to content

Instantly share code, notes, and snippets.

@marty1885
Created September 3, 2019 08:11
Show Gist options
  • Save marty1885/4a68a9edccbf78684133b8ad44bd35ac to your computer and use it in GitHub Desktop.
Save marty1885/4a68a9edccbf78684133b8ad44bd35ac to your computer and use it in GitHub Desktop.
void missing_creator()
{
// Now we can use the new and improved RDataFrame interface
auto rdf = ROOT::RDataFrame("library", "library.root");
auto rdf_missing = rdf.Filter("creator != \"\" && publication_year != 0x7fffffff");
std::map<std::string, int> books;
rdf_missing.Foreach([&](std::string title, int year) {books[title] = year;}, {"title", "publication_year"});
auto h1 = new TH1F("h1", "books with missing creator", 100, 1850, 2019);
for(auto [title, year] : books)
h1->Fill(year);
h1->Draw();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment