Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
df030_SQliteVersionsOfROOT.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_dataframe
3 /// \notebook -js
4 /// Plot the downloads of different ROOT versions reading a remote sqlite3 file with RSqliteDS.
5 /// Then a TH1F histogram is created and filled
6 /// using a lambda expression which receives the recorded
7 /// values in the "version" column of the sqlite3 database.
8 /// The histogram shows the usage of the ROOT development version.
9 ///
10 /// \macro_code
11 /// \macro_image
12 ///
13 /// \date August 2018
14 /// \author Alexandra-Maria Dobrescu
15 
16 void df030_SQliteVersionsOfROOT() {
17 
18  auto rdf = ROOT::RDF::MakeSqliteDataFrame("http://root.cern/files/root_download_stats.sqlite", "SELECT Version FROM accesslog;");
19 
20  TH1F hVersionOfRoot("hVersionOfRoot", "Development Versions of ROOT", 8, 0, -1);
21 
22  auto fillVersionHisto = [&hVersionOfRoot] (const std::string &version) {
23  TString copyVersion = version;
24  TString shortVersion(copyVersion(0,4));
25  hVersionOfRoot.Fill(shortVersion, 1);
26  };
27 
28  rdf.Foreach( fillVersionHisto, { "Version" } );
29 
30  auto VersionOfRootHistogram = new TCanvas();
31 
32  gStyle->SetOptStat(0);
33  hVersionOfRoot.GetXaxis()->LabelsOption("a");
34  hVersionOfRoot.LabelsDeflate("X");
35  hVersionOfRoot.DrawClone("");
36 }