Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -7,6 +7,7 @@
#include "ifac"
#include "branch_element"
#include "../sout"
#include "iobject"
namespace tools {
namespace rroot {
@@ -16,12 +17,19 @@ inline const std::string& TTree_cls(){
return s_v;
}
class tree {
class tree : public virtual iobject {
public:
static const std::string& s_class() {
static const std::string s_v("tools::rroot::tree");
return s_v;
}
public: //iobject
virtual const std::string& name() const {return m_name;}
virtual const std::string& title() const {return m_title;}
virtual const std::string& store_class_name() const {
static const std::string s_v("TTree");
return s_v;
}
public:
tree(ifile& a_file,ifac& a_fac)
:m_file(a_file)
@@ -29,7 +37,7 @@ public:
,m_out(a_file.out())
,m_name("")
,m_title("")
,m_branches(a_fac,true)
,m_branches(a_fac,true,true)
,m_entries(0)
{
#ifdef TOOLS_MEM
@@ -43,21 +51,22 @@ public:
}
protected:
tree(const tree& a_from)
:m_file(a_from.m_file)
:iobject(a_from)
,m_file(a_from.m_file)
,m_fac(a_from.m_fac)
,m_out(a_from.m_out)
,m_branches(m_fac,false)
,m_branches(m_fac,false,true)
{}
tree& operator=(const tree&){return *this;}
public:
std::ostream& out() const {return m_out;}
ifile& file() {return m_file;}
const std::string& name() const {return m_name;}
const std::string& title() const {return m_title;}
ifac& fac() {return m_fac;}
const std::vector<branch*>& branches() const {return m_branches;}
bool find_entry(uint32 a_entry,uint32& a_nbytes) {
bool find_entry(uint64 a_entry,uint32& a_nbytes) {
a_nbytes = 0;
if(a_entry>=m_entries) return false;
int nbytes = 0;
@@ -101,7 +110,7 @@ public:
branch* find_leaf_branch(const base_leaf& a_leaf) const {return _find_leaf_branch(m_branches,a_leaf);}
bool show(std::ostream& a_out,uint32 a_entry){
bool show(std::ostream& a_out,uint64 a_entry){
a_out << "======> EVENT:" << a_entry << std::endl;
tools_vforit(branch*,m_branches,it) {
if(!(*it)->show(a_out,m_file,a_entry)) return false;
@@ -111,7 +120,7 @@ public:
uint64 entries() const {return m_entries;}
bool stream(buffer& a_buffer){
virtual bool stream(buffer& a_buffer) { //virtual for iobject.
//uint64 m_tot_bytes;
//uint64 m_zip_bytes;
//uint64 m_saved_bytes;
@@ -285,9 +294,9 @@ public:
// We read leaves in order to keep streaming synchronisation.
// In fact m_leaves are references to existing leaves read by
// the branches in the upper line of code.
//::printf("debug : tree : read leaves : begin\n");
{ObjArray<base_leaf> m_leaves(m_fac,true);
branch b(m_out,m_fac);
//::printf("debug : tree : read leaves : begin\n");
{obj_array<base_leaf> m_leaves(m_fac,a_buffer.map_objs()?false:true,true);
//branch b(m_out,m_fac);
ifac::args args;
//args[ifac::arg_branch()] = &b;
if(!m_leaves.stream(a_buffer,args)) {
@@ -400,7 +409,7 @@ protected:
static branch* _find_branch(const std::vector<branch*>& a_bs,const std::string& a_name,bool a_recursive) {
tools_vforcit(branch*,a_bs,it) {
if(tools::rcmp((*it)->name(),a_name)) return *it;
if(rcmp((*it)->name(),a_name)) return *it;
if(a_recursive) {
branch* br = _find_branch((*it)->branches(),a_name,a_recursive);
if(br) return br;
@@ -412,7 +421,7 @@ protected:
static base_leaf* _find_leaf(const std::vector<branch*>& a_bs,const std::string& a_name,bool a_recursive) {
tools_vforcit(branch*,a_bs,it) {
tools_vforcit(base_leaf*,(*it)->leaves(),itl) {
if(tools::rcmp((*itl)->name(),a_name)) return *itl;
if(rcmp((*itl)->name(),a_name)) return *itl;
}
if(a_recursive) {
base_leaf* lf = _find_leaf((*it)->branches(),a_name,a_recursive);
@@ -452,7 +461,7 @@ protected:
std::string m_name;
std::string m_title;
ObjArray<branch> m_branches;
obj_array<branch> m_branches;
uint64 m_entries; // Number of entries
};