Df 0 2 8_ S Qlite I P Location

Plot the location of ROOT downloads reading a remote sqlite3 file with RSqliteDS. The world map is hold by a TH2Poly histogram which, after filling, will show the world wide dispersion of ROOT's users. To histogram filling, is done thanks to a lambda expression having as input parameters the two columns of the database: "IPLongitude' - for the longitude, and the "IPLatitude" - for the latitude. The data related to the latitude and the longitude has been provided from the log files storing the users IP. This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.

Author: Alexandra-Maria Dobrescu
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Monday, January 27, 2020 at 01:18 AM.

In [1]:
auto rdf = ROOT::RDF::MakeSqliteDataFrame( "http://root.cern/files/root_download_stats.sqlite", "SELECT * FROM accesslog;" );

auto f = TFile::Open("http://root.cern.ch/files/WM.root");
auto worldMap = f->Get<TH2Poly>("WMUSA");

auto fillIPLocation = [&worldMap] ( const std::string &sLongitude, const std::string &sLatitude ) {
   if (!( sLongitude == "" ) && !( sLatitude == "" )) {
      auto latitude = std::stof(sLatitude);
      auto longitude = std::stof(sLongitude);
      worldMap->Fill(longitude, latitude);
   }
};

rdf.Foreach( fillIPLocation, { "IPLongitude", "IPLatitude" } );

auto worldMapCanvas = new TCanvas();
worldMapCanvas->SetLogz();
worldMap->SetTitle("ROOT Downloads per Location (GitHub exluded);Longitude;Latitude");
worldMap->DrawClone("colz");

Draw all canvases

In [2]:
%jsroot on
gROOT->GetListOfCanvases()->Draw()