Project
Loading...
Searching...
No Matches
o2::tpc::DataContainer3D< DataT > Class Template Reference

#include <DataContainer3D.h>

Public Member Functions

 DataContainer3D (unsigned short nZ, unsigned short nR, unsigned short nPhi)
 
 DataContainer3D ()=default
 default constructor for Root I/O
 
const DataToperator[] (size_t i) const
 operator to directly access the values
 
DataToperator[] (size_t i)
 
const auto & getData () const
 
auto & getData ()
 
const DataToperator() (size_t iz, size_t ir, size_t iphi) const
 
DataToperator() (size_t iz, size_t ir, size_t iphi)
 
DataT interpolate (const DataT z, const DataT r, const DataT phi, const o2::tpc::RegularGrid3D< DataT > &grid) const
 
size_t getDataIndex (const size_t iz, const size_t ir, const size_t iphi) const
 
size_t getNDataPoints () const
 
unsigned short getNZ () const
 
unsigned short getNR () const
 
unsigned short getNPhi () const
 
size_t getIndexZ (size_t index) const
 
size_t getIndexR (size_t index) const
 
size_t getIndexPhi (size_t index) const
 
void setGrid (unsigned short nZ, unsigned short nR, unsigned short nPhi, const bool resize)
 set the grid points
 
template<typename DataTOut = DataT>
int writeToFile (TFile &outf, const char *name="data") const
 
int writeToFile (std::string_view file, std::string_view option, std::string_view name="data", const int nthreads=1) const
 
template<typename DataTIn = DataT>
bool initFromFile (TFile &inpf, const char *name="data")
 set values from file
 
bool initFromFile (std::string_view file, std::string_view name="data", const int nthreads=1)
 
void print () const
 print the matrix
 
DataContainer3D< DataT > & operator*= (const DataT value)
 operator overload
 
DataContainer3D< DataT > & operator+= (const DataContainer3D< DataT > &other)
 
DataContainer3D< DataT > & operator*= (const DataContainer3D< DataT > &other)
 
DataContainer3D< DataT > & operator-= (const DataContainer3D< DataT > &other)
 

Static Public Member Functions

static void setAliases (TTree *tree)
 
static void setAliasesForDump (TTree *tree)
 
static size_t getIndexZ (size_t index, const int nz, const int nr, const int nphi)
 
static size_t getIndexR (size_t index, const int nz, const int nr, const int nphi)
 
static size_t getIndexPhi (size_t index, const int nz, const int nr, const int nphi)
 
static DataContainer3D< DataT > * loadFromFile (TFile &inpf, const char *name="data")
 get pointer to object from file (deprecated!)
 
static void dumpSlice (std::string_view treename, std::string_view fileIn, std::string_view fileOut, std::string_view option, std::pair< unsigned short, unsigned short > rangeiR, std::pair< unsigned short, unsigned short > rangeiZ, std::pair< unsigned short, unsigned short > rangeiPhi, const int nthreads=1)
 
static void dumpInterpolation (std::string_view treename, std::string_view fileIn, std::string_view fileOut, std::string_view option, std::pair< float, float > rangeR, std::pair< float, float > rangeZ, std::pair< float, float > rangePhi, const int nR, const int nZ, const int nPhi, const int nthreads=1)
 
static bool getVertices (std::string_view treename, std::string_view fileIn, unsigned short &nR, unsigned short &nZ, unsigned short &nPhi)
 

Detailed Description

template<typename DataT = double>
class o2::tpc::DataContainer3D< DataT >
Template Parameters
DataTthe type of data which is used during the calculations

The DataContainer3D class represents a simple method to store values on a large 3-Dim grid with ROOT io functionality.

Definition at line 40 of file DataContainer3D.h.

Constructor & Destructor Documentation

◆ DataContainer3D() [1/2]

template<typename DataT = double>
o2::tpc::DataContainer3D< DataT >::DataContainer3D ( unsigned short  nZ,
unsigned short  nR,
unsigned short  nPhi 
)
inline

< constructor

Parameters
nZnumber of vertices in z direction
nRnumber of vertices in r direction
nPhinumber of vertices in phi direction

Definition at line 46 of file DataContainer3D.h.

◆ DataContainer3D() [2/2]

template<typename DataT = double>
o2::tpc::DataContainer3D< DataT >::DataContainer3D ( )
default

default constructor for Root I/O

Member Function Documentation

◆ dumpInterpolation()

template<typename DataT >
void DataContainer3D::dumpInterpolation ( std::string_view  treename,
std::string_view  fileIn,
std::string_view  fileOut,
std::string_view  option,
std::pair< float, float >  rangeR,
std::pair< float, float >  rangeZ,
std::pair< float, float >  rangePhi,
const int  nR,
const int  nZ,
const int  nPhi,
const int  nthreads = 1 
)
static

dump interpolations of stored values to TTree including indices for Drawing

Parameters
treenamename of the TTree in the input file for which the slices will be dumped
fileIninput file
fileOutoutput file
option"RECREATE" or "UPDATE" the output file
rangeRrange in radial direction
rangeZrange in z direction
rangePhirange in phi direction
nRnumber of points in radial direction which will be used to interpolate
nZnumber of points in z direction which will be used to interpolate
nPhinumber of points in phi direction which will be used to interpolate

Definition at line 408 of file DataContainer3D.cxx.

◆ dumpSlice()

template<typename DataT >
void DataContainer3D::dumpSlice ( std::string_view  treename,
std::string_view  fileIn,
std::string_view  fileOut,
std::string_view  option,
std::pair< unsigned short, unsigned short rangeiR,
std::pair< unsigned short, unsigned short rangeiZ,
std::pair< unsigned short, unsigned short rangeiPhi,
const int  nthreads = 1 
)
static

dump slices to TTree including indices for Drawing

Parameters
treenamename of the TTree in the input file for which the slices will be dumped
fileIninput file
fileOutoutput file
option"RECREATE" or "UPDATE" the output file
rangeiRindices range in radial direction
rangeiZindices range in z direction
rangeiPhiindices range in phi direction

Definition at line 323 of file DataContainer3D.cxx.

◆ getData() [1/2]

template<typename DataT = double>
auto & o2::tpc::DataContainer3D< DataT >::getData ( )
inline

Definition at line 56 of file DataContainer3D.h.

◆ getData() [2/2]

template<typename DataT = double>
const auto & o2::tpc::DataContainer3D< DataT >::getData ( ) const
inline

Definition at line 55 of file DataContainer3D.h.

◆ getDataIndex()

template<typename DataT = double>
size_t o2::tpc::DataContainer3D< DataT >::getDataIndex ( const size_t  iz,
const size_t  ir,
const size_t  iphi 
) const
inline
Parameters
izindex in z dimension
irindex in r dimension
iphiindex in phi dimension
Returns
returns the index to the data

Definition at line 77 of file DataContainer3D.h.

◆ getIndexPhi() [1/2]

template<typename DataT = double>
size_t o2::tpc::DataContainer3D< DataT >::getIndexPhi ( size_t  index) const
inline

Definition at line 121 of file DataContainer3D.h.

◆ getIndexPhi() [2/2]

template<typename DataT >
size_t DataContainer3D::getIndexPhi ( size_t  index,
const int  nz,
const int  nr,
const int  nphi 
)
static
Returns
returns index iphi for given global index (can be used for TTree::Draw("second : o2::tpc::DataContainer3D<float>::getIndexPhi(first+Iteration$, 129, 129, 360) ","","colz"))
Parameters
indexglobal index
nznumber of vertices in z
nrnumber of vertices in r
nphinumber of vertices in phi

Definition at line 276 of file DataContainer3D.cxx.

◆ getIndexR() [1/2]

template<typename DataT = double>
size_t o2::tpc::DataContainer3D< DataT >::getIndexR ( size_t  index) const
inline

Definition at line 113 of file DataContainer3D.h.

◆ getIndexR() [2/2]

template<typename DataT >
size_t DataContainer3D::getIndexR ( size_t  index,
const int  nz,
const int  nr,
const int  nphi 
)
static
Returns
returns index ir for given global index (can be used for TTree::Draw("second : o2::tpc::DataContainer3D<float>::getIndexR(first+Iteration$, 129, 129, 360) ","","colz"))
Parameters
indexglobal index
nznumber of vertices in z
nrnumber of vertices in r
nphinumber of vertices in phi

Definition at line 267 of file DataContainer3D.cxx.

◆ getIndexZ() [1/2]

template<typename DataT = double>
size_t o2::tpc::DataContainer3D< DataT >::getIndexZ ( size_t  index) const
inline

Definition at line 105 of file DataContainer3D.h.

◆ getIndexZ() [2/2]

template<typename DataT >
size_t DataContainer3D::getIndexZ ( size_t  index,
const int  nz,
const int  nr,
const int  nphi 
)
static
Returns
returns index iz for given global index (can be used for TTree::Draw("second : o2::tpc::DataContainer3D<float>::getIndexZ(first+Iteration$, 129, 129, 360) ","","colz"))
Parameters
indexglobal index
nznumber of vertices in z
nrnumber of vertices in r
nphinumber of vertices in phi

Definition at line 258 of file DataContainer3D.cxx.

◆ getNDataPoints()

template<typename DataT = double>
size_t o2::tpc::DataContainer3D< DataT >::getNDataPoints ( ) const
inline
Returns
returns the number of values stored

Definition at line 80 of file DataContainer3D.h.

◆ getNPhi()

template<typename DataT = double>
unsigned short o2::tpc::DataContainer3D< DataT >::getNPhi ( ) const
inline
Returns
returns the number of z vertices

Definition at line 89 of file DataContainer3D.h.

◆ getNR()

template<typename DataT = double>
unsigned short o2::tpc::DataContainer3D< DataT >::getNR ( ) const
inline
Returns
returns the number of y vertices

Definition at line 86 of file DataContainer3D.h.

◆ getNZ()

template<typename DataT = double>
unsigned short o2::tpc::DataContainer3D< DataT >::getNZ ( ) const
inline
Returns
returns the number of x vertices

Definition at line 83 of file DataContainer3D.h.

◆ getVertices()

template<typename DataT >
bool DataContainer3D::getVertices ( std::string_view  treename,
std::string_view  fileIn,
unsigned short nR,
unsigned short nZ,
unsigned short nPhi 
)
static

sets vertices definition stored from object in file

Returns
true if vertices could be read from the input file
Parameters
treenamename of the TTree in the input file for which the slices will be dumped
fileIninput file
nRvertices in radial direction will be stored in this variable
nZvertices in z direction will be stored in this variable
nPhivertices in phi direction will be stored in this variable

Definition at line 497 of file DataContainer3D.cxx.

◆ initFromFile() [1/2]

template<typename DataT >
bool DataContainer3D::initFromFile ( std::string_view  file,
std::string_view  name = "data",
const int  nthreads = 1 
)

set values from file using RDataFrame

Parameters
fileobject is written to this file
nameobject is saved with this name
nthreadsnumber of threads to use

Definition at line 96 of file DataContainer3D.cxx.

◆ initFromFile() [2/2]

template<typename DataT >
template<typename DataTIn >
bool DataContainer3D::initFromFile ( TFile &  inpf,
const char name = "data" 
)

set values from file

set values from file (deprecated!)

Template Parameters
DataTOutformat of the input container (can be used to load the container with a different precission than the current object)

Definition at line 139 of file DataContainer3D.cxx.

◆ interpolate()

template<typename DataT >
DataT DataContainer3D::interpolate ( const DataT  z,
const DataT  r,
const DataT  phi,
const o2::tpc::RegularGrid3D< DataT > &  grid 
) const
Returns
reutrns interpolated value at arbitrary coordinate

Definition at line 401 of file DataContainer3D.cxx.

◆ loadFromFile()

template<typename DataT >
DataContainer3D< DataT > * DataContainer3D::loadFromFile ( TFile &  inpf,
const char name = "data" 
)
inlinestatic

get pointer to object from file (deprecated!)

Definition at line 166 of file DataContainer3D.cxx.

◆ operator()() [1/2]

template<typename DataT = double>
DataT & o2::tpc::DataContainer3D< DataT >::operator() ( size_t  iz,
size_t  ir,
size_t  iphi 
)
inline
Parameters
izindex in z dimension
irindex in r dimension
iphiindex in phi dimension
Returns
returns the stored value

Definition at line 68 of file DataContainer3D.h.

◆ operator()() [2/2]

template<typename DataT = double>
const DataT & o2::tpc::DataContainer3D< DataT >::operator() ( size_t  iz,
size_t  ir,
size_t  iphi 
) const
inline
Parameters
izindex in z dimension
irindex in r dimension
iphiindex in phi dimension
Returns
returns the stored value

Definition at line 62 of file DataContainer3D.h.

◆ operator*=() [1/2]

template<typename DataT >
DataContainer3D< DataT > & DataContainer3D::operator*= ( const DataContainer3D< DataT > &  other)

Definition at line 251 of file DataContainer3D.cxx.

◆ operator*=() [2/2]

template<typename DataT >
DataContainer3D< DataT > & DataContainer3D::operator*= ( const DataT  value)

operator overload

Definition at line 230 of file DataContainer3D.cxx.

◆ operator+=()

template<typename DataT >
DataContainer3D< DataT > & DataContainer3D::operator+= ( const DataContainer3D< DataT > &  other)

Definition at line 237 of file DataContainer3D.cxx.

◆ operator-=()

template<typename DataT >
DataContainer3D< DataT > & DataContainer3D::operator-= ( const DataContainer3D< DataT > &  other)

Definition at line 244 of file DataContainer3D.cxx.

◆ operator[]() [1/2]

template<typename DataT = double>
DataT & o2::tpc::DataContainer3D< DataT >::operator[] ( size_t  i)
inline

Definition at line 53 of file DataContainer3D.h.

◆ operator[]() [2/2]

template<typename DataT = double>
const DataT & o2::tpc::DataContainer3D< DataT >::operator[] ( size_t  i) const
inline

operator to directly access the values

Definition at line 52 of file DataContainer3D.h.

◆ print()

template<typename DataT >
void DataContainer3D::print ( ) const

print the matrix

Definition at line 183 of file DataContainer3D.cxx.

◆ setAliases()

template<typename DataT >
void DataContainer3D::setAliases ( TTree *  tree)
static

define aliases for TTree for drawing

Parameters
inputTTree for which the aliases will be defined

Definition at line 282 of file DataContainer3D.cxx.

◆ setAliasesForDump()

template<typename DataT >
void DataContainer3D::setAliasesForDump ( TTree *  tree)
static

define aliases for TTree for drawing which was created by dumpSlice() or dumpInterpolation()

Parameters
treeTTree for which the aliases will be defined

Definition at line 293 of file DataContainer3D.cxx.

◆ setGrid()

template<typename DataT >
void DataContainer3D::setGrid ( unsigned short  nZ,
unsigned short  nR,
unsigned short  nPhi,
const bool  resize 
)

set the grid points

Definition at line 312 of file DataContainer3D.cxx.

◆ writeToFile() [1/2]

template<typename DataT >
int DataContainer3D::writeToFile ( std::string_view  file,
std::string_view  option,
std::string_view  name = "data",
const int  nthreads = 1 
) const

write this object to a file using RDataFrame

Parameters
fileobject is written to this file
option"RECREATE" or "UPDATE"
nameobject is saved with this name
nthreadsnumber of threads to use

Definition at line 44 of file DataContainer3D.cxx.

◆ writeToFile() [2/2]

template<typename DataT >
template<typename DataTOut >
int DataContainer3D::writeToFile ( TFile &  outf,
const char name = "data" 
) const

write this object to a file (deprecated!)

Parameters
outfobject is written to this file
nameobject is saved with this name
Template Parameters
DataTOutformat of the output container (can be used to store the container with a different precission than the current object)

Definition at line 29 of file DataContainer3D.cxx.


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