9#ifndef ROOT_Browsable_RFieldProvider
10#define ROOT_Browsable_RFieldProvider
29using namespace std::string_literals;
50 std::shared_ptr<ROOT::Experimental::RNTupleReader>
fNtplReader;
57 auto buf =
fHist->GetBuffer();
59 if (!buf || (
len < 5))
73 if (is_integer && (max-min < 100)) {
75 if (min > 1) min -= 2;
77 std::unique_ptr<TH1>
h1 = std::make_unique<TH1F>(
fHist->GetName(),
fHist->GetTitle(), npoints, min, max);
80 h1->
Fill(buf[2 + 2*
n], buf[1 + 2*
n]);
88 std::string title =
"Drawing of RField "s + field.
GetFieldName();
90 fHist = std::make_unique<TH1F>(
"hdraw", title.c_str(), 100, 0, 0);
91 fHist->SetDirectory(
nullptr);
93 auto bufsize = (
fHist->GetBufferSize() - 1) / 2;
95 if (bufsize > 10) bufsize-=3;
else bufsize = -1;
99 if (++cnt == bufsize) {
107 fHist->BufferEmpty();
113 auto view =
fNtplReader->GetView<T>(field.GetOnDiskId());
126 std::map<std::string, int> values;
131 for (
auto i : view.GetFieldRange()) {
132 std::string
v = view(i);
134 auto iter = values.find(
v);
135 if (iter != values.end())
137 else if (values.size() >= 50)
145 std::string title =
"Drawing of RField "s + field.
GetFieldName();
146 fHist = std::make_unique<TH1F>(
"h",title.c_str(),3,0,3);
147 fHist->SetDirectory(
nullptr);
151 for (
auto &entry : values)
152 fHist->Fill(entry.first.c_str(), entry.second);
153 fHist->LabelsDeflate();
161 return fHist.release();
180 if (
const auto f32 = field.As32Bit()) {
182 }
else if (
const auto f64 = field.As64Bit()) {
193 if (!holder)
return nullptr;
198 const auto fieldName = ntplReader->GetDescriptor().GetFieldDescriptor(holder->
GetId()).GetFieldName();
199 const auto qualifiedFieldName = ntplReader->GetDescriptor().GetQualifiedFieldName(holder->
GetId());
200 auto view = ntplReader->GetView<
void>(qualifiedFieldName);
201 name.append(fieldName);
204 view.GetField().AcceptVisitor(drawVisitor);
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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
auto GetParentName() const
auto GetNtplReader() const
void VisitCardinalityField(const ROOT::Experimental::RCardinalityField &field) final
void VisitUInt64Field(const RIntegralField< std::uint64_t > &field) final
void VisitInt8Field(const RIntegralField< std::int8_t > &field) final
void FillStringHistogram(const RField< std::string > &field)
std::unique_ptr< TH1 > fHist
void TestHistBuffer()
Test collected entries if it looks like integer values and one can use better binning.
void FillHistogram(const RField< T > &field)
void VisitUInt8Field(const RIntegralField< std::uint8_t > &field) final
void VisitDoubleField(const RField< double > &field) final
void VisitInt64Field(const RIntegralField< std::int64_t > &field) final
void VisitCharField(const RField< char > &field) final
void VisitUInt32Field(const RIntegralField< std::uint32_t > &field) final
void FillHistogramImpl(const ROOT::Experimental::RFieldBase &field, ROOT::Experimental::RNTupleView< T > &view)
void VisitField(const ROOT::Experimental::RFieldBase &) final
void VisitInt32Field(const RIntegralField< std::int32_t > &field) final
void FillHistogram(const RIntegralField< T > &field)
void VisitInt16Field(const RIntegralField< std::int16_t > &field) final
void VisitUInt16Field(const RIntegralField< std::uint16_t > &field) final
std::shared_ptr< ROOT::Experimental::RNTupleReader > fNtplReader
void VisitStringField(const RField< std::string > &field) final
void VisitBoolField(const RField< bool > &field) final
RDrawVisitor(std::shared_ptr< ROOT::Experimental::RNTupleReader > ntplReader)
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.
Abstract base class for classes implementing the visitor design pattern.
An artificial field that transforms an RNTuple column that contains the offset of collections into co...
A field translates read and write calls from/to underlying columns to/from tree values.
const std::string & GetFieldName() const
DescriptorId_t GetOnDiskId() const
Classes with dictionaries that can be inspected by TClass.
RNTupleGlobalRange GetFieldRange() const
An RNTupleView for a known type.
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.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.