Skip to content

Commit 48e5e15

Browse files
committed
[tree][docs] Explain how histograms or event lists can be registered for TTree::Draw.
1 parent c1f4b7d commit 48e5e15

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

tree/tree/src/TTree.cxx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4172,9 +4172,9 @@ Long64_t TTree::Draw(const char* varexp, const TCut& selection, Option_t* option
41724172
/// // 100 bins in x-direction; lower limit on x-axis is 10; upper limit is 60
41734173
/// // 50 bins in y-direction; lower limit on y-axis is .1; upper limit is .5
41744174
/// ~~~
4175-
/// By default, the specified histogram is reset.
4176-
/// To continue to append data to an existing histogram, use "+" in front
4177-
/// of the histogram name.
4175+
/// By default, if a histogram with the same name is already registered to the current
4176+
/// ROOT directory, the specified histogram is reset. To continue to append data to an
4177+
/// existing histogram, use "+" in front of the histogram name.
41784178
///
41794179
/// A '+' in front of the histogram name is ignored, when the name is followed by
41804180
/// binning information as described in the previous paragraph.
@@ -4184,6 +4184,15 @@ Long64_t TTree::Draw(const char* varexp, const TCut& selection, Option_t* option
41844184
/// will not reset `hsqrt`, but will continue filling. This works for 1-D, 2-D
41854185
/// and 3-D histograms.
41864186
///
4187+
/// Note that when the automatic registration of histograms is off (see \ref DisableObjectAutoRegistration() ),
4188+
/// external histogram are not visible to TTree::Draw unless they are registered to the current directory explicitly.
4189+
/// ~~~ {.cpp}
4190+
/// auto histo = new TH1D("histo", ...);
4191+
/// histo->SetDirectory(gDirectory);
4192+
/// tree.Draw("sqrt(x)>>histo","y>0")
4193+
/// ~~~
4194+
/// When auto-registration is off, histograms created by TTree::Draw will still be registered to the current directory.
4195+
///
41874196
/// ### Accessing collection objects
41884197
///
41894198
/// TTree::Draw default's handling of collections is to assume that any
@@ -4434,6 +4443,14 @@ Long64_t TTree::Draw(const char* varexp, const TCut& selection, Option_t* option
44344443
/// will not reset yplus, but will enter the selected entries at the end
44354444
/// of the existing list.
44364445
///
4446+
/// Note that when the automatic registration of event lists is off (see \ref DisableObjectAutoRegistration() ),
4447+
/// they are not visible to TTree::Draw unless they are registered to the current directory explicitly.
4448+
/// ~~~ {.cpp}
4449+
/// auto elist = new TEventList("elist", ...);
4450+
/// elist->SetDirectory(gDirectory);
4451+
/// tree.Draw(">>+elist","y>0")
4452+
/// ~~~
4453+
///
44374454
/// ### Using a TEventList, TEntryList or TEntryListArray as Input
44384455
///
44394456
/// Once a TEventList or a TEntryList object has been generated, it can be used as input

0 commit comments

Comments
 (0)