Use RDataFrame to display data about ROOT downloads.
In order to display the Platform Distribution of ROOT, we choose to create two TH1F histograms: one that includes all types of platforms, other filtering and classifying them. This procedure is using a lambda expression taking as parameter the values stored in the "Platform" column from the database. At the end, the histograms are filled with their specific demand regarding the platform's type.
void df029_SQlitePlatformDistribution() {
auto rdf =
ROOT::RDF::FromSqlite(
"http://root.cern/files/root_download_stats.sqlite",
"SELECT * FROM accesslog;");
TH1F hRootPlatform(
"hrootPlatform",
"Platform Distribution", 7, 0, -1);
TH1F hShortRootPlatform(
"hShortRootPlatform",
"Short Platform Distribution", 7, 0, -1);
auto fillRootPlatform = [&hRootPlatform, &hShortRootPlatform] ( const std::string &platform ) {
hShortRootPlatform.Fill(Platform_0,1);
}
else if ( Platform.
Contains(
"Linux") ){
hShortRootPlatform.Fill(Platform_0,1);
}
else if ( Platform.
Contains(
"source") ){
hShortRootPlatform.Fill(Platform_1,1);
}
else if ( Platform.
Contains(
"macosx64") ){
hShortRootPlatform.Fill(Platform_2,1);
}
else if ( Platform.
Contains(
"IRIX64") ){
hShortRootPlatform.Fill(Platform_1,1);
}
hRootPlatform.Fill(Platform,1);
};
rdf.Foreach( fillRootPlatform, { "Platform" } );
auto PlatformDistributionHistogram =
new TCanvas();
hRootPlatform.GetXaxis()->LabelsOption("a");
hRootPlatform.LabelsDeflate("X");
hRootPlatform.DrawClone();
auto shortPlatformDistributionHistogram =
new TCanvas();
hShortRootPlatform.GetXaxis()->LabelsOption("a");
hShortRootPlatform.LabelsDeflate("X");
hShortRootPlatform.DrawClone();
}
1-D histogram with a float per channel (see TH1 documentation)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
RDataFrame FromSqlite(std::string_view fileName, std::string_view query)
Factory method to create a SQlite RDataFrame.
- Date
- August 2018
- Author
- Alexandra-Maria Dobrescu
Definition in file df029_SQlitePlatformDistribution.C.