Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JROOT::JTreeWriter< T, flat > Class Template Reference

Auxiliary class for default template TTree writing. More...

#include <JTreeWriter.hh>

Inheritance diagram for JROOT::JTreeWriter< T, flat >:
JROOT::JTreeParameters JROOT::JTreeCopyWriter< T >

Public Member Functions

 JTreeWriter (const JTreeParameters &parameters=JROOT::getTreeParameters< T >())
 Constructor.
 
const TBranch * GetBranch () const
 Get the pointer to the unique TBranch belonging this TTree.
 
Int_t Write (const T &object)
 Data object output equivalent of TTree::Fill().
 
const JTreeParametersgetTreeParameters () const
 Get TTree parameters.
 
const TString & getTreeName () const
 Get TTree name.
 
const TString & getTreeTitle () const
 Get TTree title.
 
const TString & getBranchName () const
 Get TBranch name.
 
int getCompressionLevel () const
 Get compression level.
 
void setCompressionLevel (const int value)
 Set compression level.
 
int getBasketSize () const
 Get basket size.
 
void setBasketSize (int value)
 Set basket size.
 
int getSplitLevel () const
 Get split level.
 
void setSplitLevel (int value)
 Set split level.
 
Long64_t getAutoFlush () const
 Get auto flush.
 
void setAutoFlush (Long64_t value)
 Set auto flush.
 

Protected Attributes

TString treeName
 TTree name.
 
TString treeTitle
 TTree title.
 
TString branchName
 TBranch name.
 
int compressionLevel
 TBranch compression level.
 
int basketSize
 TBranch basket size.
 
int splitLevel
 TBranch split level.
 
Long64_t autoFlush
 TTree auto flush.
 

Private Attributes

TBranch * branch
 Pointer to unique branch belonging to this TTree.
 
const T * address
 Pointer to unique object belonging to this TTree.
 

Detailed Description

template<class T, bool flat = false>
class JROOT::JTreeWriter< T, flat >

Auxiliary class for default template TTree writing.

Definition at line 35 of file JTreeWriter.hh.

Constructor & Destructor Documentation

◆ JTreeWriter()

template<class T , bool flat = false>
JROOT::JTreeWriter< T, flat >::JTreeWriter ( const JTreeParameters & parameters = JROOT::getTreeParameters<T>())
inline

Constructor.

Note that the default TTree parameters are obtained using method JROOT::getTreeParameters.

Parameters
parametersparameters of TTree

Definition at line 47 of file JTreeWriter.hh.

47 :
48 JTreeParameters(parameters),
49 address(NULL)
50 {
51 SetNameTitle(this->getTreeName(), this->getTreeTitle());
52
53 SetAutoFlush(this->getAutoFlush());
54 SetCacheSize();
55
56 branch = Branch(this->getBranchName(),
57 T::Class_Name(),
58 &address,
59 this->getBasketSize(),
60 this->getSplitLevel());
61
62 branch->SetCompressionLevel(this->getCompressionLevel());
63 }
int getBasketSize() const
Get basket size.
Long64_t getAutoFlush() const
Get auto flush.
int getCompressionLevel() const
Get compression level.
int getSplitLevel() const
Get split level.
const TString & getBranchName() const
Get TBranch name.
JTreeParameters(const TString &treeName, const TString &treeTitle, const TString &branchName="", const int compressionLevel=1, const int basketSize=65536, const int splitLevel=1, const Long64_t autoFlush=5000)
Constructor.
const TString & getTreeTitle() const
Get TTree title.
const TString & getTreeName() const
Get TTree name.
const T * address
Pointer to unique object belonging to this TTree.
TBranch * branch
Pointer to unique branch belonging to this TTree.

Member Function Documentation

◆ GetBranch()

template<class T , bool flat = false>
const TBranch * JROOT::JTreeWriter< T, flat >::GetBranch ( ) const
inline

Get the pointer to the unique TBranch belonging this TTree.

Returns
pointer to TBranch

Definition at line 71 of file JTreeWriter.hh.

72 {
73 return branch;
74 }

◆ Write()

template<class T , bool flat = false>
Int_t JROOT::JTreeWriter< T, flat >::Write ( const T & object)
inline

Data object output equivalent of TTree::Fill().

Parameters
objectdata object
Returns
as TTree::Fill

Definition at line 83 of file JTreeWriter.hh.

84 {
85 address = &object;
86
87 return this->Fill();
88 }

◆ getTreeParameters()

const JTreeParameters & JROOT::JTreeParameters::getTreeParameters ( ) const
inlineinherited

Get TTree parameters.

Returns
TTree parameters

Definition at line 67 of file JTreeParameters.hh.

68 {
69 return static_cast<const JTreeParameters&>(*this);
70 }

◆ getTreeName()

const TString & JROOT::JTreeParameters::getTreeName ( ) const
inlineinherited

Get TTree name.

Returns
TTree name

Definition at line 78 of file JTreeParameters.hh.

79 {
80 return treeName;
81 }
TString treeName
TTree name.

◆ getTreeTitle()

const TString & JROOT::JTreeParameters::getTreeTitle ( ) const
inlineinherited

Get TTree title.

Returns
TTree title

Definition at line 89 of file JTreeParameters.hh.

90 {
91 return treeTitle;
92 }
TString treeTitle
TTree title.

◆ getBranchName()

const TString & JROOT::JTreeParameters::getBranchName ( ) const
inlineinherited

Get TBranch name.

Returns
TBranch name

Definition at line 100 of file JTreeParameters.hh.

101 {
102 return (branchName != "" ? branchName : treeName);
103 }
TString branchName
TBranch name.

◆ getCompressionLevel()

int JROOT::JTreeParameters::getCompressionLevel ( ) const
inlineinherited

Get compression level.

Returns
compression level

Definition at line 111 of file JTreeParameters.hh.

112 {
113 return compressionLevel;
114 }
int compressionLevel
TBranch compression level.

◆ setCompressionLevel()

void JROOT::JTreeParameters::setCompressionLevel ( const int value)
inlineinherited

Set compression level.

Parameters
valuecompression level

Definition at line 122 of file JTreeParameters.hh.

123 {
124 compressionLevel = value;
125 }

◆ getBasketSize()

int JROOT::JTreeParameters::getBasketSize ( ) const
inlineinherited

Get basket size.

Returns
basket size

Definition at line 133 of file JTreeParameters.hh.

134 {
135 return basketSize;
136 }
int basketSize
TBranch basket size.

◆ setBasketSize()

void JROOT::JTreeParameters::setBasketSize ( int value)
inlineinherited

Set basket size.

Parameters
valuebasket size

Definition at line 144 of file JTreeParameters.hh.

145 {
146 basketSize = value;
147 }

◆ getSplitLevel()

int JROOT::JTreeParameters::getSplitLevel ( ) const
inlineinherited

Get split level.

Returns
split level

Definition at line 155 of file JTreeParameters.hh.

156 {
157 return splitLevel;
158 }
int splitLevel
TBranch split level.

◆ setSplitLevel()

void JROOT::JTreeParameters::setSplitLevel ( int value)
inlineinherited

Set split level.

Parameters
valuesplit level

Definition at line 166 of file JTreeParameters.hh.

167 {
168 splitLevel = value;
169 }

◆ getAutoFlush()

Long64_t JROOT::JTreeParameters::getAutoFlush ( ) const
inlineinherited

Get auto flush.

Returns
auto flush

Definition at line 177 of file JTreeParameters.hh.

178 {
179 return autoFlush;
180 }
Long64_t autoFlush
TTree auto flush.

◆ setAutoFlush()

void JROOT::JTreeParameters::setAutoFlush ( Long64_t value)
inlineinherited

Set auto flush.

Parameters
valueauto flush

Definition at line 188 of file JTreeParameters.hh.

189 {
190 autoFlush = value;
191 }

Member Data Documentation

◆ branch

template<class T , bool flat = false>
TBranch* JROOT::JTreeWriter< T, flat >::branch
private

Pointer to unique branch belonging to this TTree.

Definition at line 95 of file JTreeWriter.hh.

◆ address

template<class T , bool flat = false>
const T* JROOT::JTreeWriter< T, flat >::address
private

Pointer to unique object belonging to this TTree.

Definition at line 96 of file JTreeWriter.hh.

◆ treeName

TString JROOT::JTreeParameters::treeName
protectedinherited

TTree name.

Definition at line 215 of file JTreeParameters.hh.

◆ treeTitle

TString JROOT::JTreeParameters::treeTitle
protectedinherited

TTree title.

Definition at line 216 of file JTreeParameters.hh.

◆ branchName

TString JROOT::JTreeParameters::branchName
protectedinherited

TBranch name.

Definition at line 217 of file JTreeParameters.hh.

◆ compressionLevel

int JROOT::JTreeParameters::compressionLevel
protectedinherited

TBranch compression level.

Definition at line 218 of file JTreeParameters.hh.

◆ basketSize

int JROOT::JTreeParameters::basketSize
protectedinherited

TBranch basket size.

Definition at line 219 of file JTreeParameters.hh.

◆ splitLevel

int JROOT::JTreeParameters::splitLevel
protectedinherited

TBranch split level.

Definition at line 220 of file JTreeParameters.hh.

◆ autoFlush

Long64_t JROOT::JTreeParameters::autoFlush
protectedinherited

TTree auto flush.

Definition at line 221 of file JTreeParameters.hh.


The documentation for this class was generated from the following file: