KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVDataBranchHandler.cpp
1//Created by KVClassFactory on Fri Dec 11 11:52:02 2009
2//Author: John Frankland,,,
3
4#include "KVDataBranchHandler.h"
5
7
8
9
13
15 const Char_t* type, const Char_t* prefix) :
16 KVBase()
17{
18 // Initialise branch handler for given TTree, object, member variable named 'var',
19 // of leaf type 'type' (see TBranch constructor) and an optional branch prefix p
20 // (will be prepended as 'p.').
21
22 fTree = tree;
23 Long_t offset = obj->IsA()->GetDataMemberOffset(var);
24 if (!offset) {
25 Error("KVDataBranchHandler", "Offset for member %s of %s is 0", var, obj->GetName());
26 fAddr = 0;
27 fBranch = 0;
28 return;
29 }
30 fAddr = (void*)((Long_t)obj + offset);
31 if (strcmp(prefix, "")) SetName(Form("%s.%s.%s", prefix, obj->GetName(), var));
32 else SetName(Form("%s.%s", obj->GetName(), var));
33 SetType(Form("%s/%s", GetName(), type));
34 fBranch = fTree->GetBranch(GetName());
35 if (!ConnectBranch()) CreateBranch();
36}
37
38
39
42
47
48
49
54
56{
57 // Connect member variable to branch for reading.
58 // If branch exists returns kTRUE.
59 // If branch does not exist, returns kFALSE.
60
61 if (!fBranch) return kFALSE;
63 return kTRUE;
64}
65
66
67
70
72{
73 // Create new branch in TTree for member variable and return its address.
74
75 if (!fAddr) return 0;
76 //Info("CreateBranch", "fTree->Branch(\"%s\", %p, \"%s\")", GetName(), fAddr, GetType());
77 return (fBranch = fTree->Branch(GetName(), fAddr, GetType()));
78}
79
80
81
long Long_t
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
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 offset
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 type
char * Form(const char *fmt,...)
Base class for KaliVeda framework.
Definition KVBase.h:142
virtual const Char_t * GetType() const
Definition KVBase.h:177
Handles TTree branches for storing member variables of classes.
virtual ~KVDataBranchHandler()
Destructor.
TBranch * fBranch
the branch
void * fAddr
address of variable
TBranch * CreateBranch()
Create new branch in TTree for member variable and return its address.
virtual void SetAddress(void *add)
const char * GetName() const override
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99)
gr SetName("gr")
void Error(const char *location, const char *fmt,...)
ClassImp(TPyArg)