48using Clock = std::chrono::high_resolution_clock;
55 auto result = std::shared_ptr<TH1D>(
static_cast<TH1D *
>(
h.GetPtr()->Clone()));
56 result->SetDirectory(
nullptr);
64constexpr const char *
kRawDataUrl =
"http://root.cern./files/tutorials/GlobalLandTemperaturesByCity.csv";
65constexpr const char *
kNTupleFileName =
"GlobalLandTemperaturesByCity.root";
73 auto t1 = Clock::now();
76 auto model = RNTupleModel::Create();
79 auto fieldYear = model->MakeField<std::uint32_t>(
"Year");
80 auto fieldMonth = model->MakeField<std::uint32_t>(
"Month");
81 auto fieldDay = model->MakeField<std::uint32_t>(
"Day");
82 auto fieldAvgTemp = model->MakeField<
float>(
"AverageTemperature");
83 auto fieldTempUncrty = model->MakeField<
float>(
"AverageTemperatureUncertainty");
84 auto fieldCity = model->MakeField<std::string>(
"City");
85 auto fieldCountry = model->MakeField<std::string>(
"Country");
86 auto fieldLat = model->MakeField<
float>(
"Latitude");
87 auto fieldLong = model->MakeField<
float>(
"Longitude");
100 while (file->Readln(
record)) {
102 throw std::runtime_error(
"record too long: " +
record);
123 std::cout <<
" ... converted " <<
nRecords <<
" records" << std::endl;
127 std::cout <<
nSkipped <<
" records skipped" << std::endl;
128 std::cout <<
nRecords <<
" records processed" << std::endl;
130 auto t2 = Clock::now();
131 std::cout << std::endl
132 <<
"Processing Time: " << std::chrono::duration_cast<std::chrono::seconds>(
t2 -
t1).count() <<
" seconds\n"
142 df.Display()->Print();
145 auto min_value = df.Min(
"AverageTemperature");
146 auto max_value = df.Max(
"AverageTemperature");
180 dfFall.Histo1D({
"Fall Average Temp",
"Average Temperature by Season", 100, -40, 40},
"AverageTemperature");
182 dfWinter.Histo1D({
"Winter Average Temp",
"Average Temperature by Season", 100, -40, 40},
"AverageTemperature");
184 dfSpring.Histo1D({
"Spring Average Temp",
"Average Temperature by Season", 100, -40, 40},
"AverageTemperature");
186 dfSummer.Histo1D({
"Summer Average Temp",
"Average Temperature by Season", 100, -40, 40},
"AverageTemperature");
190 {
"1993_to_2002 Average Temp",
"Average Temperature: 1993_to_2002 vs. 2003_to_2013", 100, -40, 40},
191 "AverageTemperature");
193 {
"2003_to_2013 Average Temp",
"Average Temperature: 1993_to_2002 vs. 2003_to_2013", 100, -40, 40},
194 "AverageTemperature");
199 std::cout << std::endl <<
"The Minimum temperature is: " << *
min_value << std::endl;
200 std::cout <<
"The Maximum temperature is: " << *
max_value << std::endl;
203 std::cout << std::endl <<
"The count for Winter: " << *
winterCount << std::endl;
204 std::cout <<
"The count for Spring: " << *
springCount << std::endl;
205 std::cout <<
"The count for Summer: " << *
summerCount << std::endl;
206 std::cout <<
"The count for Fall: " << *
fallCount << std::endl;
243 auto canvas = RCanvas::Create(
"Average Temperature by Season");
250 auto legend = std::make_shared<TLegend>(0.15, 0.65, 0.53, 0.85);
259 auto canvas2 = RCanvas::Create(
"Average Temperature: 1993_to_2002 vs. 2003_to_2013");
264 auto legend2 = std::make_shared<TLegend>(0.1, 0.7, 0.48, 0.9);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
R__EXTERN TSystem * gSystem
Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).
The RRawFile provides read-only access to local and remote files.
Smart pointer for the return type of actions.
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
const_iterator begin() const
const_iterator end() const
1-D histogram with a double per channel (see TH1 documentation)
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
On construction, an ROptions parameter can customize the RRawFile behavior.
size_t fBlockSize
Read at least fBlockSize bytes at a time. A value of zero turns off I/O buffering.