32 fDirector(0), fInitialized(false), fIsMember(false), fIsClone(false), fIsaPointer(false),
33 fHasLeafCount(false), fBranchName(
""), fParent(0), fDataMember(
""),
34 fClassName(
""),
fClass(0), fElement(0), fMemberOffset(0), fOffset(0), fArrayLength(1),
35 fBranch(0), fBranchCount(0),
37 fRead(-1), fWhere(0),fCollection(0)
46 fDirector(boss), fInitialized(false), fIsMember(false), fIsClone(false), fIsaPointer(false),
47 fHasLeafCount(false), fBranchName(top), fParent(0), fDataMember(
""),
48 fClassName(
""),
fClass(0), fElement(0), fMemberOffset(0), fOffset(0), fArrayLength(1),
49 fBranch(0), fBranchCount(0),
51 fRead(-1), fWhere(0),fCollection(0)
64 fDirector(boss), fInitialized(false), fIsMember(true), fIsClone(false), fIsaPointer(false),
65 fHasLeafCount(false), fBranchName(top), fParent(0), fDataMember(membername),
66 fClassName(
""),
fClass(0), fElement(0), fMemberOffset(0), fOffset(0), fArrayLength(1),
67 fBranch(0), fBranchCount(0),
69 fRead(-1), fWhere(0),fCollection(0)
85 fDirector(boss), fInitialized(false), fIsMember(true), fIsClone(false), fIsaPointer(false),
86 fHasLeafCount(false), fBranchName(top), fParent(parent), fDataMember(membername),
87 fClassName(
""),
fClass(0), fElement(0), fMemberOffset(0), fOffset(0), fArrayLength(1),
88 fBranch(0), fBranchCount(0),
90 fRead(-1), fWhere(0),fCollection(0)
105 fDirector(boss), fInitialized(false), fIsMember(membername != 0 && membername[0]), fIsClone(false), fIsaPointer(false),
106 fHasLeafCount(false), fBranchName(branch->GetName()), fParent(0), fDataMember(membername),
107 fClassName(
""),
fClass(0), fElement(0), fMemberOffset(0), fOffset(0), fArrayLength(1),
108 fBranch(0), fBranchCount(0),
110 fRead(-1), fWhere(0),fCollection(0)
128 std::string sFullBranchName = fullBranchName;
129 std::string::size_type pos = sFullBranchName.rfind(branch->
GetFullName());
130 if (pos != std::string::npos) {
131 sFullBranchName.erase(pos);
134 return sFullBranchName;
142 fDirector(boss), fInitialized(false), fIsMember(membername != 0 && membername[0]), fIsClone(false), fIsaPointer(false),
143 fHasLeafCount(false), fBranchName(
GetFriendBranchName(boss->GetTree(), branch, branchname)), fParent(0), fDataMember(membername),
144 fClassName(
""),
fClass(0), fElement(0), fMemberOffset(0), fOffset(0), fArrayLength(1),
145 fBranch(0), fBranchCount(0),
147 fRead(-1), fWhere(0),fCollection(0)
159 if (fNotify.IsLinked() && fDirector && fDirector->GetTree())
160 fNotify.RemoveLink(*(fDirector->GetTree()));
178 fInitialized =
false;
179 fHasLeafCount =
false;
189 std::cout <<
"fBranchName " << fBranchName << std::endl;
191 std::cout <<
"fBranch " << fBranch << std::endl;
192 if (fBranchCount) std::cout <<
"fBranchCount " << fBranchCount << std::endl;
202 if (!fDirector->GetTree()) {
205 if (!fNotify.IsLinked()) {
206 fNotify.PrependLink(*fDirector->GetTree());
210 if (!fParent->Setup()) {
220 Int_t i = fDirector->GetReadEntry();
221 if (i<0) fDirector->SetReadEntry(0);
222 if (fParent->Read()) {
223 if (i<0) fDirector->SetReadEntry(i);
228 if (clones) pcl = clones->
GetClass();
233 if (fCollection)
delete fCollection;
235 pcl = fCollection->GetValueClass();
238 Error(
"Setup",
"Not finding TClass for collection for the data member %s seems no longer be in class %s",fDataMember.Data(),fParent->GetClass()->GetName());
246 fClass = fElement->GetClassPointer();
247 fMemberOffset = fElement->GetOffset();
248 fArrayLength = fElement->GetArrayLength();
250 Error(
"Setup",
"Data member %s seems no longer be in class %s",fDataMember.Data(),pcl->
GetName());
256 fWhere = fParent->fWhere;
258 if (fParent->IsaPointer()) {
272 fBranch = fDirector->GetTree()->GetBranch(fBranchName.Data());
286 TLeaf *leaf = (
TLeaf*) fBranch->GetListOfLeaves()->At(0);
304 fWhere = (
double*)fBranch->GetAddress();
308 TLeaf *leaf2 =
nullptr;
309 if (fDataMember.Length()) {
310 leaf2 = fBranch->GetLeaf(fDataMember);
311 }
else if (!fWhere) {
312 leaf2 = (
TLeaf*)fBranch->GetListOfLeaves()->At(0);
317 fArrayLength = leaf2->
GetLen();
320 fHasLeafCount =
true;
326 fBranch->SetupAddresses();
327 fWhere = (
double*)fBranch->GetAddress();
338 fClassName =
"TClonesArray";
343 fIsaPointer = fElement->IsaPointer();
344 fClass = fElement->GetClassPointer();
355 if ( fIsMember && be->
GetType()==3 ) {
357 }
else if (fIsaPointer) {
358 clones = (
TClonesArray*)*(
void**)((
char*)fWhere+fOffset);
362 if (!fIsMember) fIsClone =
true;
380 if (!fIsMember) fIsClone =
true;
397 }
else if (be->
GetType()==41) {
403 }
else if (be->
GetType()==31) {
416 fWhere = ((
unsigned char*)be->
GetObject()) + fOffset;
421 fClassName = fBranch->GetClassName();
424 fClassName = fBranch->GetClassName();
465 member = fDataMember;
468 fMemberOffset =
fClass->GetDataMemberOffset(member);
470 if (fMemberOffset<0) {
471 Error(
"Setup",
"%s",
Form(
"Negative offset %d for %s in %s",
472 fMemberOffset,fBranch->
GetName(),
473 bcount?bcount->
GetName():
"unknown"));
479 fClass->GetStreamerInfo()->GetElements()->FindObject(fDataMember);
481 fMemberOffset = fElement->GetOffset();
487 member += fDataMember;
488 fMemberOffset =
fClass->GetDataMemberOffset(member);
496 Error(
"Setup",
"%s",
Form(
"Missing TClass object for %s\n",fClassName.Data()));
502 fOffset = fMemberOffset;
506 fWhere = ((
unsigned char*)fWhere) + fMemberOffset;
static std::string GetFriendBranchName(TTree *directorTree, TBranch *branch, const char *fullBranchName)
For a fullBranchName that might contain a leading friend tree path (but access elements designating a...
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Base class for all the proxy object.
Bool_t Setup()
Initialize/cache the necessary information.
const TString fBranchName
void Reset()
Completely reset the object.
TBranchProxy()
Constructor.
virtual void Print()
Display the content of the object.
virtual ~TBranchProxy()
Typical Destructor.
void Attach(Detail::TBranchProxy *p)
Attach a TBranchProxy object to this director.
A Branch for the case of an object.
TBranchElement * GetBranchCount() const
const char * GetClassName() const override
Return the name of the user class whose content is stored in this branch, if any.
TStreamerInfo * GetInfo() const
Get streamer info for the branch class.
TVirtualCollectionProxy * GetCollectionProxy()
Return the collection proxy describing the branch content, if any.
Int_t GetEntry(Long64_t entry=0, Int_t getall=0) override
Read all branches of a BranchElement and return total number of bytes.
char * GetObject() const
Return a pointer to our object.
TClass * IsA() const override
A TTree is a list of TBranches.
virtual char * GetAddress() const
virtual TString GetFullName() const
Return the 'full' name of the branch.
virtual void SetAddress(void *add)
Set address of this branch.
TBranch * GetMother() const
Get our top-level parent branch in the tree.
TClass instances represent classes, structs and namespaces in the ROOT type system.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
TClass * IsA() const override
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.
An array of clone (identical) objects.
TClass * GetClass() const
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual void * GetValuePointer() const
virtual Int_t GetLen() const
Return the number of effective elements of this leaf, for the current entry.
virtual TLeaf * GetLeafCount() const
If this leaf stores a variable-sized array or a multi-dimensional array whose last dimension has vari...
TBranch * GetBranch() const
const char * GetName() const override
Returns name of object.
TObject * At(Int_t idx) const override
virtual Bool_t IsaPointer() const
Describes a persistent version of a class.
Int_t GetElementOffset(Int_t id) const override
TObjArray * GetElements() const override
const char * Data() const
TString & Remove(Ssiz_t pos)
A TTree represents a columnar dataset.
virtual Long64_t GetReadEntry() const
virtual TTree * GetTree() const
virtual TClass * GetValueClass() const =0
virtual TVirtualCollectionProxy * Generate() const =0
virtual TStreamerElement * GetStreamerElement(const char *datamember, Int_t &offset) const =0