9#ifndef ROOT_Browsable_RFieldProvider
10#define ROOT_Browsable_RFieldProvider
29using namespace std::string_literals;
47 std::shared_ptr<ROOT::Experimental::Detail::RPageSource>
fNtplSource;
53 auto len =
fHist->GetBufferLength();
54 auto buf =
fHist->GetBuffer();
56 if (!buf || (len < 5))
70 if (is_integer && (max-min < 100)) {
72 if (min > 1) min -= 2;
74 std::unique_ptr<TH1>
h1 = std::make_unique<TH1F>(
fHist->GetName(),
fHist->GetTitle(), npoints, min, max);
77 h1->
Fill(buf[2 + 2*
n], buf[1 + 2*
n]);
85 std::string title =
"Drawing of RField "s + field.
GetName();
87 fHist = std::make_unique<TH1F>(
"hdraw", title.c_str(), 100, 0, 0);
88 fHist->SetDirectory(
nullptr);
90 auto bufsize = (
fHist->GetBufferSize() - 1) / 2;
92 if (bufsize > 10) bufsize-=3;
else bufsize = -1;
95 for (
auto i : view.GetFieldRange()) {
97 if (++cnt == bufsize) {
105 fHist->BufferEmpty();
110 std::map<std::string, int> values;
115 for (
auto i : view.GetFieldRange()) {
116 std::string
v = view(i);
118 auto iter = values.find(
v);
119 if (iter != values.end())
121 else if (values.size() >= 50)
129 std::string title =
"Drawing of RField "s + field.
GetName();
130 fHist = std::make_unique<TH1F>(
"h",title.c_str(),3,0,3);
131 fHist->SetDirectory(
nullptr);
135 for (
auto &entry : values)
136 fHist->Fill(entry.first.c_str(), entry.second);
137 fHist->LabelsDeflate();
142 explicit RDrawVisitor(std::shared_ptr<ROOT::Experimental::Detail::RPageSource> ntplSource)
148 return fHist.release();
172 if (!holder)
return nullptr;
177 const auto &desc = ntplSource->GetDescriptor();
178 auto field = desc.GetFieldDescriptor(holder->
GetId()).CreateField(desc);
179 name.append(field->GetName());
182 field->AcceptVisitor(drawVisitor);
auto GetParentName() const
auto GetNtplSource() const
void VisitUInt16Field(const RField< std::uint16_t > &field) final
void FillStringHistogram(const RField< std::string > &field)
std::unique_ptr< TH1 > fHist
void VisitUInt32Field(const RField< std::uint32_t > &field) final
void TestHistBuffer()
Test collected entries if it looks like integer values and one can use better binning.
void FillHistogram(const RField< T > &field)
void VisitDoubleField(const RField< double > &field) final
std::shared_ptr< ROOT::Experimental::Detail::RPageSource > fNtplSource
void VisitInt8Field(const RField< std::int8_t > &field) final
void VisitCharField(const RField< char > &field) final
RDrawVisitor(std::shared_ptr< ROOT::Experimental::Detail::RPageSource > ntplSource)
void VisitUInt64Field(const RField< std::uint64_t > &field) final
void VisitStringField(const RField< std::string > &field) final
void VisitInt64Field(const RField< std::int64_t > &field) final
void VisitBoolField(const RField< bool > &field) final
void VisitUInt8Field(const RField< std::uint8_t > &field) final
void VisitInt16Field(const RField< std::int16_t > &field) final
void VisitField(const ROOT::Experimental::Detail::RFieldBase &) final
void VisitIntField(const RField< int > &field) final
void VisitFloatField(const RField< float > &field) final
Base class for provider of RNTuple drawing.
TH1 * DrawField(RFieldHolder *holder)
Provider of different browsing methods for supported classes.
std::string GetName() const
DescriptorId_t GetOnDiskId() const
Abstract base class for classes implementing the visitor design pattern.
Classes with dictionaries that can be inspected by TClass.
An RNTupleView provides read-only access to a single field of the ntuple.
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.