rootwriter C++ API Reference

class I3ROOTBranchWrapper

Subclassed by I3ROOTBranchWrapperData, I3ROOTBranchWrapperEnum

Public Functions

I3ROOTBranchWrapper()
I3ROOTBranchWrapper(TTree *tree, unsigned int index, size_t arrayLength = 1, bool multirow = false)
I3ROOTBranchWrapper(const I3ROOTBranchWrapper &rhs)
virtual ~I3ROOTBranchWrapper()
virtual void Fill(const I3TableRowConstPtr &data) = 0
inline const TBranch *Branch() const
inline TBranch *Branch()

Protected Functions

inline void SetBranch(TBranch *branch)

Protected Attributes

TTree *tree_
TBranch *branch_
unsigned int index_
size_t arrayLength_
bool multirow_
class I3ROOTBranchWrapperData : public I3ROOTBranchWrapper

Public Functions

I3ROOTBranchWrapperData()
I3ROOTBranchWrapperData(TTree *tree, const I3Datatype &type, const std::string &branchname, const std::string &docstring, unsigned int index, size_t arrayLength = 1, const I3ROOTBranchWrapperConstPtr &counter = I3ROOTBranchWrapperConstPtr())
I3ROOTBranchWrapperData(const I3ROOTBranchWrapperData &rhs)
virtual ~I3ROOTBranchWrapperData()
template<typename T>
inline void Fill(const T &data)
virtual void Fill(const I3TableRowConstPtr &data)

Private Functions

void setBranchAddress()
template<typename Source, typename Destination>
void RootCharArrayHackFillData(const I3TableRowConstPtr &data)

Private Members

size_t datasize_
boost::shared_ptr<std::vector<char>> data_
bool rootCharArrayHack_
bool rootCharArrayIsSigned_
class I3ROOTBranchWrapperEnum : public I3ROOTBranchWrapper

Public Types

typedef void (I3ROOTBranchWrapperEnum::* FillFn)(const I3TableRowConstPtr&)

Public Functions

I3ROOTBranchWrapperEnum()
I3ROOTBranchWrapperEnum(TTree *tree, const I3Datatype &type, const std::string &branchname, const std::string &docstring, unsigned int index, size_t arrayLength = 1, const I3ROOTBranchWrapperConstPtr &counter = I3ROOTBranchWrapperConstPtr())
I3ROOTBranchWrapperEnum(const I3ROOTBranchWrapperEnum &rhs)
virtual ~I3ROOTBranchWrapperEnum()
virtual void Fill(const I3TableRowConstPtr &data)

Private Functions

template<typename T>
void FillImp(const I3TableRowConstPtr &data)
FillFn selectFillImp(const I3Datatype &type)

Private Members

boost::shared_ptr<std::string> data_
std::map<long, std::string> mapping_
FillFn fillImp_

Friends

friend class OnlyForTest
class I3ROOTTable : public I3Table
#include <I3ROOTTable.h>

Public Functions

I3ROOTTable(I3TableService &service, const std::string &name, I3TableRowDescriptionConstPtr description)
virtual ~I3ROOTTable()
void Write()

Protected Functions

virtual void WriteRows(I3TableRowConstPtr row)
virtual I3Table::AlignmentType GetAlignmentType()

Private Functions

SET_LOGGER ("I3ROOTTable")

Private Members

TTree *tree_
bool multirow_
I3ROOTBranchWrapperDataPtr counter_
std::vector<I3ROOTBranchWrapperPtr> branches_

Friends

friend class I3ROOTTableService
class I3ROOTTableService : public I3TableService

Table service to write root table.

Encapsulates a root file and provides methods of writing data to that ROOT file in the tableio framework.

Public Functions

inline I3ROOTTableService(const std::string &filename, const std::string &master = "MasterTree", int compress = 1, const std::string &mode = "RECREATE")

The only constructor.

Parameters:
  • filename – Name of the ROOT files to be written.

  • master – Name of the master tree in the ROOT file. All other trees are friends of this tree.

  • compress – Compression parameter. See the documentation of TFile in the ROOT documentation for the meaning of this number. The default should be okay for most people.

  • mode – The file mode of the ROOT file. See the documentation of TFile in the ROOT documentation. Only change this if you really know what you are doing!

inline I3ROOTTableService(I3::dataio::shared_filehandle filename, const std::string &master = "MasterTree", int compress = 1, const std::string &mode = "RECREATE")
virtual ~I3ROOTTableService()

Public Static Functions

static void setMaxTreeSize(long long int maxSize)

Set the maximum file size when writing ROOT trees.

ROOT will automatically split files when they reach a certain size limit. By default, this size is set to 1TB in rootwriter to essentially keep ROOT from splitting files. If your file sizes have to be below some limit you can use this function to set the maximum file size. You should, however, be aware that this feature is experimental in rootwriter. Also, the files will not be independent, since rootwriter cannot guarantee that all trees have the same number of entries in every file. Especially, all entries of the master tree will be in the last file.

Parameters:

maxSize – The maximum file size in MiB.

Protected Functions

virtual I3TablePtr CreateTable(const std::string &tableName, I3TableRowDescriptionConstPtr description)

Creates a ROOT tree with the given name and description.

Used by tableio.

virtual void CloseFile()

Close the ROOT file.

Private Functions

void init(I3::dataio::shared_filehandle, const std::string &master, int compress, const std::string &mode)
SET_LOGGER ("I3ROOTTableService")

Private Members

std::vector<I3ROOTTablePtr> tables_
bool open_
I3::dataio::shared_filehandle filename_
I3ROOTTablePtr mastertable_
namespace [anonymous]
namespace std

STL namespace.

file I3ROOTBranchWrapper.cxx
#include “I3ROOTBranchWrapper.h
file I3ROOTBranchWrapper.h
#include <icetray/I3PointerTypedefs.h>
#include <boost/shared_ptr.hpp>
#include <cassert>
#include <vector>

Functions

I3_FORWARD_DECLARATION(I3TableRow)
I3_POINTER_TYPEDEFS(I3ROOTBranchWrapper)
file I3ROOTBranchWrapperData.cxx
#include <icetray/I3Logging.h>
#include <tableio/I3Datatype.h>
#include <tableio/I3TableRow.h>
#include <TBranch.h>
#include <TTree.h>
#include <boost/lexical_cast.hpp>
#include <cassert>
#include <cctype>
#include <cstring>

Functions

char I3DatatypeToROOTType(const I3Datatype &type)
file I3ROOTBranchWrapperData.h
#include “I3ROOTBranchWrapper.h
#include <icetray/I3PointerTypedefs.h>
#include <boost/shared_ptr.hpp>
#include <cassert>
#include <vector>

Functions

I3_FORWARD_DECLARATION(I3TableRow)
I3_POINTER_TYPEDEFS(I3ROOTBranchWrapperData)
file I3ROOTBranchWrapperEnum.cxx
#include <icetray/I3Logging.h>
#include <tableio/I3Datatype.h>
#include <tableio/I3TableRow.h>
#include <TBranch.h>
#include <TTree.h>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include <cassert>
#include <cctype>
#include <string>
file I3ROOTBranchWrapperEnum.h
#include “I3ROOTBranchWrapper.h
#include <icetray/I3PointerTypedefs.h>
#include <boost/shared_ptr.hpp>
#include <map>
#include <string>

Functions

I3_FORWARD_DECLARATION(I3TableRow)
I3_POINTER_TYPEDEFS(I3ROOTBranchWrapperEnum)
file I3ROOTTable.cxx
#include “rootwriter/I3ROOTTable.h
#include <tableio/I3TableRow.h>
#include <tableio/I3TableRowDescription.h>
#include <boost/foreach.hpp>
#include <TTree.h>
file I3ROOTTable.h
#include <tableio/I3Table.h>
#include <vector>

Functions

I3_FORWARD_DECLARATION(I3TableService)

copyright (C) 2010 The Icecube Collaboration

$Id$

Version

$Revision$

Date

$LastChangedDate$

Author

Fabian Kislat fabian.kislat@desy.de Last changed by: $LastChangedBy$

I3_FORWARD_DECLARATION(I3TableRowDescription)
I3_FORWARD_DECLARATION(I3TableRow)
I3_FORWARD_DECLARATION(I3ROOTBranchWrapper)
I3_FORWARD_DECLARATION(I3ROOTBranchWrapperData)
I3_POINTER_TYPEDEFS(I3ROOTTable)
file I3ROOTTableService.cxx
#include “rootwriter/I3ROOTTable.h
#include <tableio/I3TableRowDescription.h>
#include <TFile.h>
#include <TTree.h>
#include <boost/foreach.hpp>
file I3ROOTTableService.h
#include <icetray/I3PointerTypedefs.h>
#include <tableio/I3TableService.h>
#include <dataio/I3FileStager.h>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <vector>

Functions

I3_FORWARD_DECLARATION(I3ROOTTable)
dir icetray
dir private
dir public
dir rootwriter
dir rootwriter
dir rootwriter