22void df028_SQliteIPLocation() {
24 auto rdf =
ROOT::RDF::FromSqlite(
"http://root.cern/files/root_download_stats.sqlite",
"SELECT * FROM accesslog;");
27 auto worldMap =
f->Get<
TH2Poly>(
"WMUSA");
29 auto fillIPLocation = [&worldMap] (
const std::string &sLongitude,
const std::string &sLatitude ) {
30 if (!( sLongitude ==
"" ) && !( sLatitude ==
"" )) {
31 auto latitude = std::stof(sLatitude);
32 auto longitude = std::stof(sLongitude);
33 worldMap->Fill(longitude, latitude);
37 rdf.Foreach( fillIPLocation, {
"IPLongitude",
"IPLatitude" } );
39 auto worldMapCanvas =
new TCanvas();
40 worldMapCanvas->SetLogz();
41 worldMap->SetTitle(
"ROOT Downloads per Location (GitHub excluded);Longitude;Latitude");
42 worldMap->DrawClone(
"colz");
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
2D Histogram with Polygonal Bins
RDataFrame FromSqlite(std::string_view fileName, std::string_view query)
Factory method to create a SQlite RDataFrame.