32 fDirector(nullptr), fInitialized(false), fIsMember(false), fIsClone(false), fIsaPointer(false),
33 fHasLeafCount(false), fBranchName(
""), fParent(nullptr), fDataMember(
""),
34 fClassName(
""),
fClass(nullptr), fElement(nullptr), fMemberOffset(0), fOffset(0), fArrayLength(1),
35 fBranch(nullptr), fBranchCount(nullptr),
37 fRead(-1), fWhere(nullptr),fCollection(nullptr)
46 fDirector(boss), fInitialized(false), fIsMember(false), fIsClone(false), fIsaPointer(false),
47 fHasLeafCount(false), fBranchName(top), fParent(nullptr), fDataMember(
""),
48 fClassName(
""),
fClass(nullptr), fElement(nullptr), fMemberOffset(0), fOffset(0), fArrayLength(1),
49 fBranch(nullptr), fBranchCount(nullptr),
51 fRead(-1), fWhere(nullptr),fCollection(nullptr)
64 fDirector(boss), fInitialized(false), fIsMember(true), fIsClone(false), fIsaPointer(false),
65 fHasLeafCount(false), fBranchName(top), fParent(nullptr), fDataMember(membername),
66 fClassName(
""),
fClass(nullptr), fElement(nullptr), fMemberOffset(0), fOffset(0), fArrayLength(1),
67 fBranch(nullptr), fBranchCount(nullptr),
69 fRead(-1), fWhere(nullptr),fCollection(nullptr)
85 fDirector(boss), fInitialized(false), fIsMember(true), fIsClone(false), fIsaPointer(false),
86 fHasLeafCount(false), fBranchName(top), fParent(parent), fDataMember(membername),
87 fClassName(
""),
fClass(nullptr), fElement(nullptr), fMemberOffset(0), fOffset(0), fArrayLength(1),
88 fBranch(nullptr), fBranchCount(nullptr),
90 fRead(-1), fWhere(nullptr),fCollection(nullptr)
105 fDirector(boss), fInitialized(false), fIsMember(membername != nullptr && membername[0]), fIsClone(false), fIsaPointer(false),
106 fHasLeafCount(false), fBranchName(branch->GetName()), fParent(nullptr), fDataMember(membername),
107 fClassName(
""),
fClass(nullptr), fElement(nullptr), fMemberOffset(0), fOffset(0), fArrayLength(1),
108 fBranch(nullptr), fBranchCount(nullptr),
110 fRead(-1), fWhere(nullptr),fCollection(nullptr)
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 != nullptr && membername[0]), fIsClone(false), fIsaPointer(false),
143 fHasLeafCount(false), fBranchName(
GetFriendBranchName(boss->GetTree(), branch, branchname)), fParent(nullptr), fDataMember(membername),
144 fClassName(
""),
fClass(nullptr), fElement(nullptr), fMemberOffset(0), fOffset(0), fArrayLength(1),
145 fBranch(nullptr), fBranchCount(nullptr),
147 fRead(-1), fWhere(nullptr),fCollection(nullptr)
159 if (fNotify.IsLinked() && fDirector && fDirector->GetTree())
160 fNotify.RemoveLink(*(fDirector->GetTree()));
170 fBranchCount =
nullptr;
178 fInitialized =
false;
179 fHasLeafCount =
false;
181 fCollection =
nullptr;
189 std::cout <<
"fBranchName " << fBranchName << std::endl;
191 std::cout <<
"fBranch " << fBranch << std::endl;
193 std::cout <<
"fLeafCount " << fLeafCount << std::endl;
194 else if (fBranchCount)
195 std::cout <<
"fBranchCount " << fBranchCount << std::endl;
206 if (!fDirector->GetTree()) {
209 if (!fNotify.IsLinked()) {
210 fNotify.PrependLink(*fDirector->GetTree());
214 if (!fParent->Setup()) {
224 Int_t i = fDirector->GetReadEntry();
225 if (i<0) fDirector->SetReadEntry(0);
226 if (fParent->Read()) {
227 if (i<0) fDirector->SetReadEntry(i);
232 if (clones) pcl = clones->
GetClass();
237 if (fCollection)
delete fCollection;
239 pcl = fCollection->GetValueClass();
240 if (pcl ==
nullptr) {
242 Error(
"Setup",
"Not finding TClass for collection for the data member %s seems no longer be in class %s",fDataMember.Data(),fParent->GetClass()->GetName());
250 fClass = fElement->GetClassPointer();
251 fMemberOffset = fElement->GetOffset();
252 fArrayLength = fElement->GetArrayLength();
254 Error(
"Setup",
"Data member %s seems no longer be in class %s",fDataMember.Data(),pcl->
GetName());
260 fWhere = fParent->fWhere;
262 if (fParent->IsaPointer()) {
276 fBranch = fDirector->GetTree()->GetBranch(fBranchName.Data());
288 fWhere = (
double*)fBranch->GetAddress();
296 fWhere = (
double*)fBranch->GetAddress();
300 TLeaf *leaf2 =
nullptr;
301 if (fDataMember.Length()) {
302 leaf2 = fBranch->GetLeaf(fDataMember);
303 }
else if (!fWhere) {
304 leaf2 = (
TLeaf*)fBranch->GetListOfLeaves()->At(0);
309 fArrayLength = leaf2->
GetLen();
312 fHasLeafCount =
true;
317 TLeaf *leaf = (
TLeaf*) fBranch->GetListOfLeaves()->At(0);
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;
511 if (fWhere!=
nullptr) {
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.
const TString fBranchName
bool Setup()
Initialize/cache the necessary information.
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.
void SetupAddresses() override
If the branch address is not set, we set all addresses starting with the top level parent branch.
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 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
If the value type is a user-defined class, return a pointer to the TClass representing the value type...
virtual TVirtualCollectionProxy * Generate() const =0
Returns a clean object of the actual class that derives from TVirtualCollectionProxy.
virtual TStreamerElement * GetStreamerElement(const char *datamember, Int_t &offset) const =0