Logo ROOT   6.10/09
Reference Guide
TTreeReaderValue.cxx
Go to the documentation of this file.
1 // @(#)root/treeplayer:$Id$
2 // Author: Axel Naumann, 2011-09-28
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers and al. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TTreeReaderValue.h"
13 
14 #include "TTreeReader.h"
15 #include "TBranchClones.h"
16 #include "TBranchElement.h"
17 #include "TBranchRef.h"
18 #include "TBranchSTL.h"
19 #include "TBranchProxyDirector.h"
20 #include "TClassEdit.h"
21 #include "TLeaf.h"
22 #include "TTreeProxyGenerator.h"
23 #include "TTreeReaderValue.h"
24 #include "TRegexp.h"
25 #include "TStreamerInfo.h"
26 #include "TStreamerElement.h"
27 #include "TNtuple.h"
28 #include <vector>
29 
30 /** \class TTreeReaderValue
31 
32 Extracts data from a TTree.
33 */
34 
36 
37 ////////////////////////////////////////////////////////////////////////////////
38 /// Construct a tree value reader and register it with the reader object.
39 
41  const char* branchname /*= 0*/,
42  TDictionary* dict /*= 0*/):
43  fBranchName(branchname),
44  fTreeReader(reader),
45  fDict(dict),
46  fProxy(NULL),
47  fLeaf(NULL),
48  fSetupStatus(kSetupNotSetup),
49  fReadStatus(kReadNothingYet)
50 {
51  RegisterWithTreeReader();
52 }
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// Copy-construct.
56 
58  fBranchName(rhs.fBranchName),
59  fLeafName(rhs.fLeafName),
60  fTreeReader(rhs.fTreeReader),
61  fDict(rhs.fDict),
62  fProxy(rhs.fProxy),
63  fLeaf(rhs.fLeaf),
64  fSetupStatus(rhs.fSetupStatus),
65  fReadStatus(rhs.fReadStatus),
66  fStaticClassOffsets(rhs.fStaticClassOffsets)
67 {
69 }
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Copy-assign.
73 
76  if (&rhs != this) {
78  fLeafName = rhs.fLeafName;
79  if (fTreeReader != rhs.fTreeReader) {
80  if (fTreeReader)
84  }
85  fDict = rhs.fDict;
86  fProxy = rhs.fProxy;
87  fLeaf = rhs.fLeaf;
91  }
92  return *this;
93 }
94 
95 ////////////////////////////////////////////////////////////////////////////////
96 /// Unregister from tree reader, cleanup.
97 
99 {
101 }
102 
103 ////////////////////////////////////////////////////////////////////////////////
104 /// Register with tree reader.
105 
107  if (fTreeReader) {
108  if (!fTreeReader->RegisterValueReader(this)) {
109  fTreeReader = nullptr;
110  }
111  }
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 /// Try to read the value from the TBranchProxy, returns
116 /// the status of the read.
117 
120  if (!fProxy) return kReadNothingYet;
121  if (fProxy->Read()) {
123  } else {
125  }
126  return fReadStatus;
127 }
128 
129 ////////////////////////////////////////////////////////////////////////////////
130 /// Stringify the template argument.
131 std::string ROOT::Internal::TTreeReaderValueBase::GetElementTypeName(const std::type_info& ti) {
132  int err;
133  char* buf = TClassEdit::DemangleTypeIdName(ti, err);
134  std::string ret = buf;
135  free(buf);
136  return ret;
137 }
138 
139 ////////////////////////////////////////////////////////////////////////////////
140 /// The TTreeReader has switched to a new TTree. Update the leaf.
141 
143  if (fLeafName.Length() == 0)
144  return;
145 
146  TBranch *myBranch = newTree->GetBranch(fBranchName);
147 
148  if (!myBranch) {
150  Error("TTreeReaderValueBase::GetLeaf()", "Unable to get the branch from the tree");
151  return;
152  }
153 
154  fLeaf = myBranch->GetLeaf(fLeafName);
155  if (!fLeaf) {
156  Error("TTreeReaderValueBase::GetLeaf()", "Failed to get the leaf from the branch");
157  }
158 }
159 
160 ////////////////////////////////////////////////////////////////////////////////
161 /// Returns the memory address of the object being read.
162 
164  if (ProxyRead() != kReadSuccess) return 0;
165 
166  if (fLeafName.Length() > 0){
167  if (GetLeaf()){
168  return fLeaf->GetValuePointer();
169  }
170  else {
172  Error("TTreeReaderValueBase::GetAddress()", "Unable to get the leaf");
173  return 0;
174  }
175  }
176  if (!fStaticClassOffsets.empty()){ // Follow all the pointers
177  Byte_t *address = (Byte_t*)fProxy->GetWhere();
178 
179  for (unsigned int i = 0; i < fStaticClassOffsets.size() - 1; ++i){
180  address = *(Byte_t**)(address + fStaticClassOffsets[i]);
181  }
182 
183  return address + fStaticClassOffsets.back();
184  }
185  return fProxy ? (Byte_t*)fProxy->GetWhere() : 0;
186 }
187 
188 ////////////////////////////////////////////////////////////////////////////////
189 /// Create the proxy object for our branch.
190 
192  if (fProxy) {
193  return;
194  }
195 
196  fSetupStatus = kSetupInternalError; // Fallback; set to something concrete below.
197  if (!fTreeReader) {
198  Error("TTreeReaderValueBase::CreateProxy()", "TTreeReader object not set / available for branch %s!",
199  fBranchName.Data());
201  return;
202  }
203  if (!fDict) {
205  const char* brDataType = "{UNDETERMINED}";
206  if (br) {
207  TDictionary* brDictUnused = 0;
208  brDataType = GetBranchDataType(br, brDictUnused);
209  }
210  Error("TTreeReaderValueBase::CreateProxy()", "The template argument type T of %s accessing branch %s (which contains data of type %s) is not known to ROOT. You will need to create a dictionary for it.",
211  GetDerivedTypeName(), fBranchName.Data(), brDataType);
213  return;
214  }
215 
216  // Search for the branchname, determine what it contains, and wire the
217  // TBranchProxy representing it to us so we can access its data.
218 
220  if (namedProxy && namedProxy->GetDict() == fDict) {
221  fProxy = namedProxy->GetProxy();
223  return;
224  }
225 
226  // This allows to support names such as v.a where the branch was created with
227  // this syntax:
228  // myTree->Branch("v", &v, "a/I:b:/I")
229  // if the branch is not found, the fBranchName is chopped to the top level branch
230  // by this very method.
231  std::string originalBranchName = fBranchName.Data();
232 
234  TLeaf *myLeaf = NULL;
235  TDictionary* branchActualType = 0;
236 
237  if (!branch) {
238  if (fBranchName.Contains(".")){
239  TRegexp leafNameExpression ("\\.[a-zA-Z0-9_]+$");
240  TString leafName (fBranchName(leafNameExpression));
241  TString branchName = fBranchName(0, fBranchName.Length() - leafName.Length());
242  branch = fTreeReader->GetTree()->GetBranch(branchName);
243  if (!branch){
244  std::vector<TString> nameStack;
245  nameStack.push_back(TString()); //Trust me
246  nameStack.push_back(leafName.Strip(TString::kBoth, '.'));
247  leafName = branchName(leafNameExpression);
248  branchName = branchName(0, branchName.Length() - leafName.Length());
249 
250  branch = fTreeReader->GetTree()->GetBranch(branchName);
251  if (!branch) branch = fTreeReader->GetTree()->GetBranch(branchName + ".");
252  if (leafName.Length()) nameStack.push_back(leafName.Strip(TString::kBoth, '.'));
253 
254  while (!branch && branchName.Contains(".")){
255  leafName = branchName(leafNameExpression);
256  branchName = branchName(0, fBranchName.Length() - leafName.Length());
257  branch = fTreeReader->GetTree()->GetBranch(branchName);
258  if (!branch) branch = fTreeReader->GetTree()->GetBranch(branchName + ".");
259  nameStack.push_back(leafName.Strip(TString::kBoth, '.'));
260  }
261 
262  if (branch && branch->IsA() == TBranchElement::Class()){
263  TBranchElement *myBranchElement = (TBranchElement*)branch;
264 
265  TString traversingBranch = nameStack.back();
266  nameStack.pop_back();
267 
268  bool found = true;
269 
270  TDataType *finalDataType = 0;
271 
272  std::vector<Long64_t> offsets;
273  Long64_t offset = 0;
274  TClass *elementClass = 0;
275 
276  TObjArray *myObjArray = myBranchElement->GetInfo()->GetElements();
277  TVirtualStreamerInfo *myInfo = myBranchElement->GetInfo();
278 
279  while (nameStack.size() && found){
280  found = false;
281 
282  for (int i = 0; i < myObjArray->GetEntries(); ++i){
283 
284  TStreamerElement *tempStreamerElement = (TStreamerElement*)myObjArray->At(i);
285 
286  if (!strcmp(tempStreamerElement->GetName(), traversingBranch.Data())){
287  offset += myInfo->GetElementOffset(i);
288 
289  traversingBranch = nameStack.back();
290  nameStack.pop_back();
291 
292  elementClass = tempStreamerElement->GetClass();
293  if (elementClass) {
294  myInfo = elementClass->GetStreamerInfo(0);
295  myObjArray = myInfo->GetElements();
296  // FIXME: this is odd, why is 'i' not also reset????
297  }
298  else {
299  finalDataType = TDataType::GetDataType((EDataType)tempStreamerElement->GetType());
300  if (!finalDataType) {
301  TDictionary* seType = TDictionary::GetDictionary(tempStreamerElement->GetTypeName());
302  if (seType && seType->IsA() == TDataType::Class()) {
303  finalDataType = TDataType::GetDataType((EDataType)((TDataType*)seType)->GetType());
304  }
305  }
306  }
307 
308  if (tempStreamerElement->IsaPointer()){
309  offsets.push_back(offset);
310  offset = 0;
311  }
312 
313  found = true;
314  break;
315  }
316  }
317  }
318 
319  offsets.push_back(offset);
320 
321  if (found){
322  fStaticClassOffsets = offsets;
323 
324  if (fDict != finalDataType && fDict != elementClass){
325  Error("TTreeReaderValueBase::CreateProxy", "Wrong data type %s", finalDataType ? finalDataType->GetName() : elementClass ? elementClass->GetName() : "UNKNOWN");
327  fProxy = 0;
328  return;
329  }
330  }
331  }
332 
333 
334  if (!fStaticClassOffsets.size()) {
335  Error("TTreeReaderValueBase::CreateProxy()", "The tree does not have a branch called %s. You could check with TTree::Print() for available branches.", fBranchName.Data());
337  fProxy = 0;
338  return;
339  }
340  }
341  else {
342  myLeaf = branch->GetLeaf(TString(leafName(1, leafName.Length())));
343  if (!myLeaf){
344  Error("TTreeReaderValueBase::CreateProxy()",
345  "The tree does not have a branch, nor a sub-branch called %s. You could check with TTree::Print() for available branches.", fBranchName.Data());
347  fProxy = 0;
348  return;
349  }
350  else {
351  TDictionary *tempDict = TDictionary::GetDictionary(myLeaf->GetTypeName());
352  if (tempDict && tempDict->IsA() == TDataType::Class() && TDictionary::GetDictionary(((TDataType*)tempDict)->GetTypeName()) == fDict){
353  //fLeafOffset = myLeaf->GetOffset() / 4;
354  branchActualType = fDict;
355  fLeaf = myLeaf;
357  fLeafName = leafName(1, leafName.Length());
359  }
360  else {
361  Error("TTreeReaderValueBase::CreateProxy()",
362  "Leaf of type %s cannot be read by TTreeReaderValue<%s>.", myLeaf->GetTypeName(), fDict->GetName());
364  }
365  }
366  }
367  }
368  else {
369  Error("TTreeReaderValueBase::CreateProxy()", "The tree does not have a branch called %s. You could check with TTree::Print() for available branches.", fBranchName.Data());
370  fProxy = 0;
371  return;
372  }
373  }
374 
375  if (!myLeaf && !fStaticClassOffsets.size()) {
376  const char* branchActualTypeName = GetBranchDataType(branch, branchActualType);
377 
378  if (!branchActualType) {
379  Error("TTreeReaderValueBase::CreateProxy()", "The branch %s contains data of type %s, which does not have a dictionary.",
380  fBranchName.Data(), branchActualTypeName ? branchActualTypeName : "{UNDETERMINED TYPE}");
381  fProxy = 0;
382  return;
383  }
384 
385  if (fDict != branchActualType) {
386  TDataType *dictdt = dynamic_cast<TDataType*>(fDict);
387  TDataType *actualdt = dynamic_cast<TDataType*>(branchActualType);
388  bool complainAboutMismatch = true;
389  if (dictdt && actualdt) {
390  if (dictdt->GetType() > 0 && dictdt->GetType() == actualdt->GetType()) {
391  // Same numerical type but different TDataType, likely Long64_t
392  complainAboutMismatch = false;
393  } else if ((actualdt->GetType() == kDouble32_t && dictdt->GetType() == kDouble_t)
394  || (actualdt->GetType() == kFloat16_t && dictdt->GetType() == kFloat_t)) {
395  // Double32_t and Float16_t never "decay" to their underlying type;
396  // we need to identify them manually here (ROOT-8731).
397  complainAboutMismatch = false;
398  }
399  }
400  if (complainAboutMismatch) {
401  Error("TTreeReaderValueBase::CreateProxy()",
402  "The branch %s contains data of type %s. It cannot be accessed by a TTreeReaderValue<%s>",
403  fBranchName.Data(), branchActualType->GetName(),
404  fDict->GetName());
405  return;
406  }
407  }
408  }
409 
410 
411  // Update named proxy's dictionary
412  if (namedProxy && !namedProxy->GetDict()) {
413  namedProxy->SetDict(fDict);
414  fProxy = namedProxy->GetProxy();
415  if (fProxy)
417  return;
418  }
419 
420  // Search for the branchname, determine what it contains, and wire the
421  // TBranchProxy representing it to us so we can access its data.
422  // A proxy for branch must not have been created before (i.e. check
423  // fProxies before calling this function!)
424 
425  TString membername;
426 
427  bool isTopLevel = branch->GetMother() == branch;
428  if (!isTopLevel) {
429  membername = strrchr(branch->GetName(), '.');
430  if (membername.IsNull()) {
431  membername = branch->GetName();
432  }
433  }
434  namedProxy = new TNamedBranchProxy(fTreeReader->fDirector, branch, originalBranchName.c_str(), membername);
435  fTreeReader->AddProxy(namedProxy);
436  fProxy = namedProxy->GetProxy();
437  if (fProxy) {
439  } else {
441  }
442 }
443 
444 ////////////////////////////////////////////////////////////////////////////////
445 /// Retrieve the type of data stored by branch; put its dictionary into
446 /// dict, return its type name. If no dictionary is available, at least
447 /// its type name should be returned.
448 
450  TDictionary* &dict) const
451 {
452  dict = 0;
453  if (branch->IsA() == TBranchElement::Class()) {
454  TBranchElement* brElement = (TBranchElement*)branch;
455 
456  auto ResolveTypedef = [&]() -> void {
457  if (dict->IsA() != TDataType::Class())
458  return;
459  // Resolve the typedef.
460  dict = TDictionary::GetDictionary(((TDataType*)dict)->GetTypeName());
461  if (dict->IsA() != TDataType::Class()) {
462  // Might be a class.
463  if (dict != fDict) {
464  dict = TClass::GetClass(brElement->GetTypeName());
465  }
466  if (dict != fDict) {
467  dict = brElement->GetCurrentClass();
468  }
469  }
470  };
471 
472  if (brElement->GetType() == TBranchElement::kSTLNode ||
473  brElement->GetType() == TBranchElement::kLeafNode ||
474  brElement->GetType() == TBranchElement::kObjectNode) {
475 
476  TStreamerInfo *streamerInfo = brElement->GetInfo();
477  Int_t id = brElement->GetID();
478 
479  if (id >= 0){
480  TStreamerElement *element = (TStreamerElement*)streamerInfo->GetElements()->At(id);
481  if (element->IsA() == TStreamerSTL::Class()){
482  TStreamerSTL *myStl = (TStreamerSTL*)element;
483  dict = myStl->GetClass();
484  return 0;
485  }
486  }
487 
488  if (brElement->GetType() == 3 || brElement->GetType() == 4) {
489  dict = brElement->GetCurrentClass();
490  return brElement->GetTypeName();
491  }
492 
493  if (brElement->GetTypeName())
494  dict = TDictionary::GetDictionary(brElement->GetTypeName());
495 
496  if (dict)
497  ResolveTypedef();
498  else
499  dict = brElement->GetCurrentClass();
500 
501  return brElement->GetTypeName();
502  } else if (brElement->GetType() == TBranchElement::kClonesNode) {
503  dict = TClonesArray::Class();
504  return "TClonesArray";
505  } else if (brElement->GetType() == 31
506  || brElement->GetType() == 41) {
507  // it's a member, extract from GetClass()'s streamer info
508  Error("TTreeReaderValueBase::GetBranchDataType()", "Must use TTreeReaderArray to access a member of an object that is stored in a collection.");
509  } else if (brElement->GetType() == -1 && brElement->GetTypeName()) {
510  dict = TDictionary::GetDictionary(brElement->GetTypeName());
511  ResolveTypedef();
512  return brElement->GetTypeName();
513  } else {
514  Error("TTreeReaderValueBase::GetBranchDataType()", "Unknown type and class combination: %i, %s", brElement->GetType(), brElement->GetClassName());
515  }
516  return 0;
517  } else if (branch->IsA() == TBranch::Class()
518  || branch->IsA() == TBranchObject::Class()
519  || branch->IsA() == TBranchSTL::Class()) {
520  if (branch->GetTree()->IsA() == TNtuple::Class()){
522  return dict->GetName();
523  }
524  const char* dataTypeName = branch->GetClassName();
525  if ((!dataTypeName || !dataTypeName[0])
526  && branch->IsA() == TBranch::Class()) {
527  TLeaf *myLeaf = branch->GetLeaf(branch->GetName());
528  if (myLeaf){
529  TDictionary *myDataType = TDictionary::GetDictionary(myLeaf->GetTypeName());
530  if (myDataType && myDataType->IsA() == TDataType::Class()){
531  dict = TDataType::GetDataType((EDataType)((TDataType*)myDataType)->GetType());
532  return myLeaf->GetTypeName();
533  }
534  }
535 
536 
537  // leaflist. Can't represent.
538  Error("TTreeReaderValueBase::GetBranchDataType()", "The branch %s was created using a leaf list and cannot be represented as a C++ type. Please access one of its siblings using a TTreeReaderArray:", branch->GetName());
539  TIter iLeaves(branch->GetListOfLeaves());
540  TLeaf* leaf = 0;
541  while ((leaf = (TLeaf*) iLeaves())) {
542  Error("TTreeReaderValueBase::GetBranchDataType()", " %s.%s", branch->GetName(), leaf->GetName());
543  }
544  return 0;
545  }
546  if (dataTypeName) dict = TDictionary::GetDictionary(dataTypeName);
547  return dataTypeName;
548  } else if (branch->IsA() == TBranchClones::Class()) {
549  dict = TClonesArray::Class();
550  return "TClonesArray";
551  } else if (branch->IsA() == TBranchRef::Class()) {
552  // Can't represent.
553  Error("TTreeReaderValueBase::GetBranchDataType()", "The branch %s is a TBranchRef and cannot be represented as a C++ type.", branch->GetName());
554  return 0;
555  } else {
556  Error("TTreeReaderValueBase::GetBranchDataType()", "The branch %s is of type %s - something that is not handled yet.", branch->GetName(), branch->IsA()->GetName());
557  return 0;
558  }
559 
560  return 0;
561 }
562 
ROOT::Internal::TNamedBranchProxy * FindProxy(const char *branchname) const
Definition: TTreeReader.h:221
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:43
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any. ...
Definition: TBranch.cxx:1256
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Definition: TLeaf.h:32
An array of TObjects.
Definition: TObjArray.h:37
static TDataType * GetDataType(EDataType type)
Given a EDataType type, get the TDataType* that represents it.
Definition: TDataType.cxx:440
To read this branch, we need a dictionary.
long long Long64_t
Definition: RtypesCore.h:69
Int_t GetType() const
TTreeReader is a simple, robust and fast interface to read values from a TTree, TChain or TNtuple...
Definition: TTreeReader.h:43
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
The branch class type is not a collection.
virtual const char * GetTypeName() const
Definition: TLeaf.h:76
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist...
Definition: TClass.cxx:4360
virtual ~TTreeReaderValueBase()
Unregister from tree reader, cleanup.
Regular expression class.
Definition: TRegexp.h:31
static TDictionary * GetDictionary(const char *name)
Definition: TDictionary.cxx:84
TStreamerInfo * GetInfo() const
Get streamer info for the branch class.
Basic string class.
Definition: TString.h:129
EReadStatus ProxyRead()
Try to read the value from the TBranchProxy, returns the status of the read.
int Int_t
Definition: RtypesCore.h:41
std::vector< Long64_t > fStaticClassOffsets
Type GetType(const std::string &Name)
Definition: Systematics.cxx:34
The array cannot find its counter branch: Array[CounterBranch].
#define NULL
Definition: RtypesCore.h:88
TObject * At(Int_t idx) const
Definition: TObjArray.h:165
Bool_t RegisterValueReader(ROOT::Internal::TTreeReaderValueBase *reader)
TTree * GetTree() const
Definition: TTreeReader.h:152
const Detail::TBranchProxy * GetProxy() const
void Class()
Definition: Class.C:29
unsigned char Byte_t
Definition: RtypesCore.h:60
virtual TLeaf * GetLeaf(const char *name) const
Return pointer to the 1st Leaf named name in thisBranch.
Definition: TBranch.cxx:1552
Int_t GetID() const
TTreeReaderValueBase & operator=(const TTreeReaderValueBase &)
Copy-assign.
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition: TTree.cxx:4979
Int_t GetType() const
Definition: TDataType.h:68
virtual const char * GetTypeName() const
Return type name of element in the branch.
void SetDict(TDictionary *dict)
void RegisterWithTreeReader()
Register with tree reader.
ROOT::Internal::TBranchProxyDirector * fDirector
proxying director, owned
Definition: TTreeReader.h:263
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:158
void AddProxy(ROOT::Internal::TNamedBranchProxy *p)
Definition: TTreeReader.h:227
virtual void CreateProxy()
Create the proxy object for our branch.
Some other error - hopefully the error message helps.
Ssiz_t Length() const
Definition: TString.h:388
TClass * GetCurrentClass()
Return a pointer to the current type of the data member corresponding to branch element.
virtual void * GetValuePointer() const
Definition: TLeaf.h:75
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1080
void * GetAddress()
Returns the memory address of the object being read.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
A Branch for the case of an object.
static std::string GetElementTypeName(const std::type_info &ti)
Stringify the template argument.
#define ClassImp(name)
Definition: Rtypes.h:336
virtual TObjArray * GetElements() const =0
virtual Bool_t IsaPointer() const
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any. ...
#define free
Definition: civetweb.c:821
EDataType
Definition: TDataType.h:28
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:572
void DeregisterValueReader(ROOT::Internal::TTreeReaderValueBase *reader)
TObjArray * GetListOfLeaves()
Definition: TBranch.h:183
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2885
Bool_t IsNull() const
Definition: TString.h:385
TLeaf * GetLeaf()
If we are reading a leaf, return the corresponding TLeaf.
TObjArray * GetElements() const
const char * GetTypeName() const
virtual const char * GetDerivedTypeName() const =0
TTreeReaderValueBase(TTreeReader *reader=0, const char *branchname=0, TDictionary *dict=0)
Construct a tree value reader and register it with the reader object.
void NotifyNewTree(TTree *newTree)
The TTreeReader has switched to a new TTree. Update the leaf.
TTree * GetTree() const
Definition: TBranch.h:188
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:494
A TTree object has a header with a name and a title.
Definition: TTree.h:78
A TTree is a list of TBranches.
Definition: TBranch.h:57
Abstract Interface class describing Streamer information for one class.
Int_t GetType() const
const char * GetBranchDataType(TBranch *branch, TDictionary *&dict) const
Retrieve the type of data stored by branch; put its dictionary into dict, return its type name...
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Definition: TBranch.cxx:1625
virtual Int_t GetElementOffset(Int_t id) const =0
void Error(ErrorHandler_t func, int code, const char *va_(fmt),...)
Write error message and call a handler, if required.
TClass * GetClass() const
const char * Data() const
Definition: TString.h:347