19void df027_SQliteDependencyOverVersion ()
21 auto rdfb =
ROOT::RDF::FromSqlite(
"http://root.cern/files/root_download_stats.sqlite",
"SELECT * FROM accesslog;");
23 auto minTimeStr = *rdfb.Reduce([](std::string
a, std::string
b) {
return std::min(
a,
b);},
"Time", std::string(
"Z"));
25 std::cout <<
"Minimum time is '" << minTimeStr <<
"'" << std::endl;
28 double maxTime = minTime + 3600.*24*365.25*4;
30 auto rdf = rdfb.Define(
"datime", [](
const std::string &time){
return TDatime(time.c_str()).
Convert();}, {
"Time"});
32 auto h614 = rdf.Filter([](
const std::string &
v){
return 0 ==
v.find(
"6.14");}, {
"Version"})
33 .Histo1D({
"h614",
"Download time for version 6.14", 64, minTime, maxTime}, {
"datime"});
35 auto h616 = rdf.Filter([](
const std::string &
v){
return 0 ==
v.find(
"6.16");}, {
"Version"})
36 .Histo1D({
"h616",
"Download time for version 6.16", 64, minTime, maxTime}, {
"datime"});
38 auto h618 = rdf.Filter([](
const std::string &
v){
return 0 ==
v.find(
"6.18");}, {
"Version"})
39 .Histo1D({
"h618",
"Download time for version 6.18", 64, minTime, maxTime}, {
"datime"});
41 auto customize_histo = [](
TH1D &histo) {
42 auto *xaxis = histo.GetXaxis();
43 xaxis->SetTimeDisplay(1);
44 xaxis->SetLabelSize(0.02);
45 xaxis->SetNdivisions(512,
kFALSE);
46 xaxis->SetTimeFormat(
"%Y-%m-%d%F1970-00-00 00:00:00");
50 customize_histo(*h614);
51 customize_histo(*h616);
52 customize_histo(*h618);
54 std::vector drawables{h614->Clone(), h616->Clone(), h618->Clone()};
56 auto c1 =
new TCanvas(
"c1",
"Download time", 800, 1500);
57 c1->Divide(1, drawables.size());
58 for (
unsigned n = 0;
n < drawables.size(); ++
n)
59 c1->GetPad(
n + 1)->Add(drawables[
n]);
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
UInt_t Convert(Bool_t toGMT=kFALSE) const
Convert fDatime from TDatime format to the standard time_t format.
1-D histogram with a double per channel (see TH1 documentation)
RDataFrame FromSqlite(std::string_view fileName, std::string_view query)
Factory method to create a SQlite RDataFrame.