Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -4,15 +4,15 @@
|
||||
#ifndef tools_rroot_streamers
|
||||
#define tools_rroot_streamers
|
||||
|
||||
#include "dummy_fac"
|
||||
|
||||
#include "named"
|
||||
#include "date"
|
||||
#include "directory"
|
||||
#include "graph"
|
||||
//#include "graph"
|
||||
#include "clss"
|
||||
#include "info"
|
||||
#include "dummy"
|
||||
#include "list"
|
||||
#include "iros"
|
||||
#include "obj_list"
|
||||
|
||||
#include "../sout"
|
||||
#include "../vmanip"
|
||||
@@ -70,61 +70,6 @@ inline bool AttAxis_stream(buffer& a_buffer){
|
||||
return true;
|
||||
}
|
||||
|
||||
class dummy_fac : public virtual ifac {
|
||||
public: //ifac
|
||||
virtual iro* create(const std::string& a_class,const args& a_args) {
|
||||
if(rcmp(a_class,"TGraph")) { //for TH_read_1D/List.
|
||||
return new graph();
|
||||
|
||||
// for read_sinfos() :
|
||||
} else if(rcmp(a_class,"TStreamerInfo")) {
|
||||
return new StreamerInfo(*this);
|
||||
} else if(rcmp(a_class,"TObjArray")) {
|
||||
std::string* sc = ifac::arg_class(a_args);
|
||||
if(sc) {
|
||||
if((*sc)==streamer_element::s_class()){
|
||||
return new obj_array<streamer_element>(*this,true,true);
|
||||
} else {
|
||||
m_out << "tools::rroot::dummy_fac::create :"
|
||||
<< " Can't create TObjArray of " << *sc << "."
|
||||
<< std::endl;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return new iros(*this,true,true);
|
||||
}
|
||||
|
||||
} else if(rcmp(a_class,"TStreamerBase")
|
||||
||rcmp(a_class,"TStreamerBasicType")
|
||||
||rcmp(a_class,"TStreamerBasicPointer")
|
||||
||rcmp(a_class,"TStreamerObjectAny")
|
||||
||rcmp(a_class,"TStreamerObject")
|
||||
||rcmp(a_class,"TStreamerObjectPointer")
|
||||
||rcmp(a_class,"TStreamerString")
|
||||
||rcmp(a_class,"TStreamerSTL")
|
||||
||rcmp(a_class,"TStreamerLoop")
|
||||
||rcmp(a_class,"TList")
|
||||
) {
|
||||
return new dummy_streamer_element();
|
||||
|
||||
} else {
|
||||
m_out << "tools::rroot::dummy_fac::create :"
|
||||
<< " dummy. Can't create object of class " << sout(a_class) << "."
|
||||
<< std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
virtual void destroy(iro*& a_obj) {delete a_obj;a_obj = 0;}
|
||||
public:
|
||||
dummy_fac(std::ostream& a_out):m_out(a_out){}
|
||||
virtual ~dummy_fac(){}
|
||||
protected:
|
||||
dummy_fac(const dummy_fac& a_from): ifac(a_from),m_out(a_from.m_out){}
|
||||
dummy_fac& operator=(const dummy_fac&){return *this;}
|
||||
protected:
|
||||
std::ostream& m_out;
|
||||
};
|
||||
|
||||
inline bool Axis_stream(buffer& a_buffer,histo::axis<double,unsigned int>& a_fAxis){
|
||||
// Version 6 streaming (ROOT/v3-00-6).
|
||||
short v;
|
||||
@@ -143,8 +88,6 @@ inline bool Axis_stream(buffer& a_buffer,histo::axis<double,unsigned int>& a_fAx
|
||||
if(!a_buffer.read(min)) return false;
|
||||
double max;
|
||||
if(!a_buffer.read(max)) return false;
|
||||
//::printf("debug : BatchLab::RioTH::streamTAxis : %d %g %g\n",
|
||||
// number,min,max);
|
||||
|
||||
std::vector<double> edges;
|
||||
if(!Array_stream<double>(a_buffer,edges)) return false; //fXbins TArrayD
|
||||
@@ -204,7 +147,7 @@ inline bool TH_read_1D(buffer& a_buffer,hd_data& a_data,
|
||||
short vers;
|
||||
if(!a_buffer.read_version(vers,s,c)) return false;
|
||||
|
||||
//::printf("debug : BatchLab::Rio::TH::streamTH1 : version %d\n",vers);
|
||||
//::printf("debug : tools::rroot::TH_read_1D : version %d\n",vers);
|
||||
|
||||
// Version 3 streaming (ROOT/v3-00-6).
|
||||
|
||||
@@ -255,8 +198,6 @@ inline bool TH_read_1D(buffer& a_buffer,hd_data& a_data,
|
||||
if(!a_buffer.read(a_entries)) return false;
|
||||
|
||||
if(!a_buffer.read(a_Sw)) return false; //fTsumw
|
||||
//::printf("debug : BatchLab::Rio::TH::streamTH1 : \"%s\" %g %g\n",
|
||||
// a_data.m_title.c_str(),fEntries,fSw);
|
||||
|
||||
if(!a_buffer.read(a_Sw2)) return false;
|
||||
|
||||
@@ -288,7 +229,7 @@ inline bool TH_read_1D(buffer& a_buffer,hd_data& a_data,
|
||||
}
|
||||
|
||||
{dummy_fac fac(a_buffer.out());
|
||||
obj_list dummy(fac,true,true);
|
||||
obj_list dummy(fac);
|
||||
if(!dummy.stream(a_buffer)) {
|
||||
a_buffer.out() << "tools::rroot::TH_read_1D :"
|
||||
<< " obj_list stream failed."
|
||||
@@ -347,8 +288,6 @@ inline bool TH_read_2D(buffer& a_buffer,hd_data& a_data,
|
||||
short v;
|
||||
if(!a_buffer.read_version(v,s,c)) return false;
|
||||
|
||||
//::printf("debug : BatchLab::Rio::TH::streamTH2 : version %d\n",v);
|
||||
|
||||
// Version 3 streaming (ROOT/v3-00-6).
|
||||
|
||||
if(!TH_read_1D(a_buffer,a_data,a_entries,a_Sw,a_Sw2,a_Sxw,a_Sx2w)) return false;
|
||||
@@ -416,8 +355,6 @@ inline histo::h1d* TH1F_stream(buffer& a_buffer){
|
||||
short v;
|
||||
if(!a_buffer.read_version(v,s,c)) return 0;
|
||||
|
||||
//::printf("debug : BatchLab::Rio::TH1F::stream : version %d\n",v);
|
||||
|
||||
// Version 1 streaming (ROOT/v3-00-6).
|
||||
|
||||
// Now we have to reconstruct a valid Histogram from a_buffer :
|
||||
@@ -445,7 +382,6 @@ inline histo::h1d* TH1F_stream(buffer& a_buffer){
|
||||
if(!a_buffer.check_byte_count(s,c,"TH1F")) return 0;
|
||||
|
||||
unsigned int binn = data.m_bin_number;
|
||||
//::printf("debug : BatchLab::Rio::TH1F::stream : histo bins %d\n",binn);
|
||||
data.m_bin_Sw.resize(binn,0);
|
||||
{for(unsigned int index=0;index<binn;index++){
|
||||
data.m_bin_Sw[index] = double(bins[index]);
|
||||
@@ -475,8 +411,6 @@ inline histo::h1d* TH1D_stream(buffer& a_buffer){
|
||||
short v;
|
||||
if(!a_buffer.read_version(v,s,c)) return 0;
|
||||
|
||||
//::printf("debug : BatchLab::Rio::TH1D::stream : version %d\n",v);
|
||||
|
||||
// Version 1 streaming (ROOT/v3-00-6).
|
||||
|
||||
// Now we have to reconstruct a valid Histogram from a_buffer :
|
||||
@@ -529,8 +463,6 @@ inline histo::h2d* TH2F_stream(buffer& a_buffer){
|
||||
short v;
|
||||
if(!a_buffer.read_version(v,s,c)) return 0;
|
||||
|
||||
//::printf("debug : BatchLab::Rio::TH2F::stream : version %d\n",v);
|
||||
|
||||
// Version 3 streaming (ROOT/v3-00-6).
|
||||
|
||||
// Now we have to reconstruct a valid Histogram from a_buffer :
|
||||
@@ -561,7 +493,6 @@ inline histo::h2d* TH2F_stream(buffer& a_buffer){
|
||||
if(!a_buffer.check_byte_count(s,c,"TH2F")) return 0;
|
||||
|
||||
unsigned int binn = data.m_bin_number;
|
||||
//::printf("debug : BatchLab::Rio::TH2F::stream : histo bins %d\n",binn);
|
||||
data.m_bin_Sw.resize(binn,0);
|
||||
{for(unsigned int index=0;index<binn;index++){
|
||||
data.m_bin_Sw[index] = double(bins[index]);
|
||||
@@ -594,8 +525,6 @@ inline histo::h2d* TH2D_stream(buffer& a_buffer){
|
||||
short v;
|
||||
if(!a_buffer.read_version(v,s,c)) return 0;
|
||||
|
||||
//::printf("debug : BatchLab::Rio::TH2D::stream : version %d\n",v);
|
||||
|
||||
// Version 3 streaming (ROOT/v3-00-6).
|
||||
|
||||
// Now we have to reconstruct a valid Histogram from a_buffer :
|
||||
@@ -655,8 +584,6 @@ inline histo::h3d* TH3D_stream(buffer& a_buffer){
|
||||
short v;
|
||||
if(!a_buffer.read_version(v,s,c)) return 0;
|
||||
|
||||
//::printf("debug : BatchLab::Rio::TH2D::stream : version %d\n",v);
|
||||
|
||||
// Now we have to reconstruct a valid Histogram from a_buffer :
|
||||
hd_data data;
|
||||
|
||||
@@ -848,14 +775,14 @@ inline histo::p2d* TProfile2D_stream(buffer& a_buffer){
|
||||
return p;
|
||||
}
|
||||
|
||||
class TDirectory : public rroot::directory {
|
||||
class TDirectory : public directory {
|
||||
//public:
|
||||
// static const std::string& store_class() {return TDirectory_cls();}
|
||||
public:
|
||||
TDirectory(ifile& a_file):rroot::directory(a_file){}
|
||||
TDirectory(ifile& a_file):directory(a_file){}
|
||||
virtual ~TDirectory(){}
|
||||
protected:
|
||||
TDirectory(const TDirectory& a_from):rroot::directory(a_from){}
|
||||
TDirectory(const TDirectory& a_from):directory(a_from){}
|
||||
TDirectory& operator=(const TDirectory&){return *this;}
|
||||
public:
|
||||
bool stream(buffer& a_buffer){
|
||||
@@ -917,25 +844,25 @@ protected:
|
||||
|
||||
|
||||
inline void dump(std::ostream& a_out,
|
||||
rroot::ifile& a_file,
|
||||
const std::vector<rroot::key*>& a_keys,
|
||||
ifile& a_file,
|
||||
const std::vector<key*>& a_keys,
|
||||
bool a_recursive,
|
||||
unsigned int a_spaces = 0) {
|
||||
|
||||
// dump non directory objects :
|
||||
{std::vector<rroot::key*>::const_iterator it;
|
||||
{std::vector<key*>::const_iterator it;
|
||||
for(it=a_keys.begin();it!=a_keys.end();++it) {
|
||||
rroot::key& k = *(*it);
|
||||
if(k.object_class()==rroot::TDirectory_cls()) continue;
|
||||
key& k = *(*it);
|
||||
if(k.object_class()==TDirectory_cls()) continue;
|
||||
{for(unsigned int index=0;index<a_spaces;index++) a_out << " ";}
|
||||
k.dump(a_out);
|
||||
}}
|
||||
|
||||
// dump directories :
|
||||
{std::vector<rroot::key*>::const_iterator it;
|
||||
{std::vector<key*>::const_iterator it;
|
||||
for(it=a_keys.begin();it!=a_keys.end();++it) {
|
||||
rroot::key& k = *(*it);
|
||||
if(k.object_class()!=rroot::TDirectory_cls()) continue;
|
||||
key& k = *(*it);
|
||||
if(k.object_class()!=TDirectory_cls()) continue;
|
||||
|
||||
std::string label = k.object_name();
|
||||
{for(unsigned int index=0;index<a_spaces;index++) a_out << " ";}
|
||||
@@ -951,25 +878,25 @@ inline void dump(std::ostream& a_out,
|
||||
<< " can't get directory data buffer."
|
||||
<< std::endl;
|
||||
} else {
|
||||
rroot::buffer b(a_out,a_file.byte_swap(),
|
||||
sz,buf,k.key_length(),false);
|
||||
rroot::TDirectory tdir(a_file);
|
||||
buffer b(a_out,a_file.byte_swap(),sz,buf,k.key_length(),false);
|
||||
TDirectory tdir(a_file);
|
||||
if(!tdir.stream(b)) {
|
||||
a_out << "tools::rroot::dump :"
|
||||
<< " can't stream TDirectory."
|
||||
<< std::endl;
|
||||
} else {
|
||||
const std::vector<rroot::key*>& keys = tdir.keys();
|
||||
const std::vector<key*>& keys = tdir.keys();
|
||||
dump(a_out,a_file,keys,a_recursive,a_spaces+1);
|
||||
}
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
||||
inline bool read_sinfos(rroot::ifile& a_file){
|
||||
/*
|
||||
inline bool read_sinfos(ifile& a_file){
|
||||
key& k = a_file.sinfos_key();
|
||||
std::ostream& out = k.out();
|
||||
if(k.object_class()!=rroot::TList_cls()) {
|
||||
if(k.object_class()!=TList_cls()) {
|
||||
out << "tools::rroot::read_sinfos :"
|
||||
<< " key not a TList."
|
||||
<< std::endl;
|
||||
@@ -983,18 +910,18 @@ inline bool read_sinfos(rroot::ifile& a_file){
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
rroot::buffer b(out,a_file.byte_swap(),sz,buf,k.key_length(),false);
|
||||
buffer b(out,a_file.byte_swap(),sz,buf,k.key_length(),false);
|
||||
dummy_fac fac(out);
|
||||
obj_list infos(fac,true,true);
|
||||
obj_list infos(fac);
|
||||
if(!infos.stream(b)) return false;
|
||||
tools_vforcit(iro*,infos,it) {
|
||||
StreamerInfo* info = safe_cast<iro,StreamerInfo>(*(*it));
|
||||
streamer_info* info = safe_cast<iro,streamer_info>(*(*it));
|
||||
if(!info) return false;
|
||||
info->out(out);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user