Jpp  19.1.0-rc.1
the software that should make you happy
Public Member Functions | Protected Attributes | Private Attributes | List of all members
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. More...
 
const TBranch * GetBranch () const
 Get the pointer to the unique TBranch belonging this TTree. More...
 
Int_t Write (const T &object)
 Data object output equivalent of TTree::Fill(). More...
 
const JTreeParametersgetTreeParameters () const
 Get TTree parameters. More...
 
const TString & getTreeName () const
 Get TTree name. More...
 
const TString & getTreeTitle () const
 Get TTree title. More...
 
const TString & getBranchName () const
 Get TBranch name. More...
 
int getCompressionLevel () const
 Get compression level. More...
 
int getBasketSize () const
 Get basket size. More...
 
int getSplitLevel () const
 Get split level. More...
 

Protected Attributes

TString treeName
 TTree name. More...
 
TString treeTitle
 TTree title. More...
 
TString branchName
 TBranch name. More...
 
int compressionLevel
 TBranch compression level. More...
 
int basketSize
 TBranch basket size. More...
 
int splitLevel
 TBranch split level. More...
 

Private Attributes

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

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  branch = Branch(this->getBranchName(),
54  T::Class_Name(),
55  &address,
56  this->getBasketSize(),
57  this->getSplitLevel());
58 
59  branch->SetCompressionLevel(this->getCompressionLevel());
60  }
int getBasketSize() const
Get basket size.
const TString & getBranchName() const
Get TBranch name.
int getCompressionLevel() const
Get compression level.
int getSplitLevel() const
Get split level.
const TString & getTreeName() const
Get TTree name.
JTreeParameters(const TString &treeName, const TString &treeTitle, const TString &branchName="", const int compressionLevel=1, const int basketSize=65536, const int splitLevel=1)
Constructor.
const TString & getTreeTitle() const
Get TTree title.
const T * address
Pointer to unique object belonging to this TTree.
Definition: JTreeWriter.hh:93
TBranch * branch
Pointer to unique branch belonging to this TTree.
Definition: JTreeWriter.hh:92

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 68 of file JTreeWriter.hh.

69  {
70  return branch;
71  }

◆ 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 80 of file JTreeWriter.hh.

81  {
82  address = &object;
83 
84  return this->Fill();
85  }

◆ getTreeParameters()

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

Get TTree parameters.

Returns
TTree parameters

Definition at line 63 of file JTreeParameters.hh.

64  {
65  return static_cast<const JTreeParameters&>(*this);
66  }
Data structure for TTree parameters.

◆ getTreeName()

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

Get TTree name.

Returns
TTree name

Definition at line 74 of file JTreeParameters.hh.

75  {
76  return treeName;
77  }
TString treeName
TTree name.

◆ getTreeTitle()

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

Get TTree title.

Returns
TTree title

Definition at line 85 of file JTreeParameters.hh.

86  {
87  return treeTitle;
88  }
TString treeTitle
TTree title.

◆ getBranchName()

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

Get TBranch name.

Returns
TBranch name

Definition at line 96 of file JTreeParameters.hh.

97  {
98  return (branchName != "" ? branchName : treeName);
99  }
TString branchName
TBranch name.

◆ getCompressionLevel()

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

Get compression level.

Returns
compression level

Definition at line 107 of file JTreeParameters.hh.

108  {
109  return compressionLevel;
110  }
int compressionLevel
TBranch compression level.

◆ getBasketSize()

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

Get basket size.

Returns
basket size

Definition at line 118 of file JTreeParameters.hh.

119  {
120  return basketSize;
121  }
int basketSize
TBranch basket size.

◆ getSplitLevel()

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

Get split level.

Returns
split level

Definition at line 129 of file JTreeParameters.hh.

130  {
131  return splitLevel;
132  }
int splitLevel
TBranch split level.

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 92 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 93 of file JTreeWriter.hh.

◆ treeName

TString JROOT::JTreeParameters::treeName
protectedinherited

TTree name.

Definition at line 155 of file JTreeParameters.hh.

◆ treeTitle

TString JROOT::JTreeParameters::treeTitle
protectedinherited

TTree title.

Definition at line 156 of file JTreeParameters.hh.

◆ branchName

TString JROOT::JTreeParameters::branchName
protectedinherited

TBranch name.

Definition at line 157 of file JTreeParameters.hh.

◆ compressionLevel

int JROOT::JTreeParameters::compressionLevel
protectedinherited

TBranch compression level.

Definition at line 158 of file JTreeParameters.hh.

◆ basketSize

int JROOT::JTreeParameters::basketSize
protectedinherited

TBranch basket size.

Definition at line 159 of file JTreeParameters.hh.

◆ splitLevel

int JROOT::JTreeParameters::splitLevel
protectedinherited

TBranch split level.

Definition at line 160 of file JTreeParameters.hh.


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