Import Geant4 11.4.0 source tree
This commit is contained in:
+2
-113
@@ -11,11 +11,9 @@
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
|
||||
//typedef std::map<std::string,std::string> annotations_t;
|
||||
inline bool to(directory& a_dir,const std::map<std::string,std::string>& a_annotations,const std::string& a_histo_name) {
|
||||
//if(a_annotations.empty()) return true;
|
||||
std::string sas;
|
||||
tools_mforcit(std::string,std::string,a_annotations,it) {
|
||||
for(auto it = a_annotations.cbegin(); it != a_annotations.cend(); ++it) {
|
||||
if(it!=a_annotations.begin()) sas += "\n";
|
||||
sas += (*it).first;
|
||||
sas += "\n";
|
||||
@@ -134,9 +132,8 @@ inline bool to(directory& a_dir,const histo::p2d& a_histo,const std::string& a_n
|
||||
}
|
||||
|
||||
inline bool write_histos(directory& a_dir,const std::vector< std::pair<std::string,void*> >& a_hists) {
|
||||
typedef std::pair<std::string,void*> class_pointer;
|
||||
|
||||
tools_vforcit(class_pointer,a_hists,it) {
|
||||
for(auto it = a_hists.cbegin(); it != a_hists.cend(); ++it) {
|
||||
const std::string& scls = (*it).first;
|
||||
void* p = (*it).second;
|
||||
if(scls==histo::h1d::s_class()) {
|
||||
@@ -171,112 +168,4 @@ inline bool write_histos(directory& a_dir,const std::vector< std::pair<std::stri
|
||||
|
||||
}}
|
||||
|
||||
#include "member_writer"
|
||||
#include "../store/osc_streamers"
|
||||
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
|
||||
inline bool to_osc(directory& a_dir,const histo::h1d& a_histo,const std::string& a_name) {
|
||||
bufobj* bo = new bufobj(a_dir.file().out(),a_dir.file().byte_swap(),256,
|
||||
a_name,a_histo.title(),osc::s_h1d());
|
||||
|
||||
//Stream as in a BatchLab/Rio/Data.h :
|
||||
if(!bo->write_version(1)) return false;
|
||||
if(!Named_stream(*bo,a_name,a_histo.title())) return false;
|
||||
|
||||
member_writer mw(*bo);
|
||||
if(!osc::visit(mw,a_histo)) {
|
||||
a_dir.file().out() << "tools::wroot::to_osc :"
|
||||
<< " Histogram1D_stream failed."
|
||||
<< std::endl;
|
||||
delete bo;
|
||||
return false;
|
||||
}
|
||||
a_dir.append_object(bo); //a_dir takes ownership of bo.
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool to_osc(directory& a_dir,const histo::h2d& a_histo,const std::string& a_name) {
|
||||
bufobj* bo = new bufobj(a_dir.file().out(),a_dir.file().byte_swap(),256,
|
||||
a_name,a_histo.title(),osc::s_h2d());
|
||||
|
||||
//Stream as in a BatchLab/Rio/Data.h :
|
||||
if(!bo->write_version(1)) return false;
|
||||
if(!Named_stream(*bo,a_name,a_histo.title())) return false;
|
||||
|
||||
member_writer mw(*bo);
|
||||
if(!osc::visit(mw,a_histo)) {
|
||||
a_dir.file().out() << "tools::wroot::to_osc :"
|
||||
<< " Histogram2D_stream failed."
|
||||
<< std::endl;
|
||||
delete bo;
|
||||
return false;
|
||||
}
|
||||
a_dir.append_object(bo); //a_dir takes ownership of bo.
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool to_osc(directory& a_dir,const histo::h3d& a_histo,const std::string& a_name) {
|
||||
bufobj* bo = new bufobj(a_dir.file().out(),a_dir.file().byte_swap(),256,
|
||||
a_name,a_histo.title(),osc::s_h3d());
|
||||
|
||||
//Stream as in a BatchLab/Rio/Data.h :
|
||||
if(!bo->write_version(1)) return false;
|
||||
if(!Named_stream(*bo,a_name,a_histo.title())) return false;
|
||||
|
||||
member_writer mw(*bo);
|
||||
if(!osc::visit(mw,a_histo)) {
|
||||
a_dir.file().out() << "tools::wroot::to_osc :"
|
||||
<< " Histogram3D_stream failed."
|
||||
<< std::endl;
|
||||
delete bo;
|
||||
return false;
|
||||
}
|
||||
a_dir.append_object(bo); //a_dir takes ownership of bo.
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool to_osc(directory& a_dir,const histo::p1d& a_histo,const std::string& a_name) {
|
||||
bufobj* bo = new bufobj(a_dir.file().out(),a_dir.file().byte_swap(),256,
|
||||
a_name,a_histo.title(),osc::s_p1d());
|
||||
|
||||
//Stream as in a BatchLab/Rio/Data.h :
|
||||
if(!bo->write_version(1)) return false;
|
||||
if(!Named_stream(*bo,a_name,a_histo.title())) return false;
|
||||
|
||||
member_writer mw(*bo);
|
||||
if(!osc::visit(mw,a_histo)) {
|
||||
a_dir.file().out() << "tools::wroot::to_osc :"
|
||||
<< " Profile1D_stream failed."
|
||||
<< std::endl;
|
||||
delete bo;
|
||||
return false;
|
||||
}
|
||||
a_dir.append_object(bo); //a_dir takes ownership of bo.
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool to_osc(directory& a_dir,const histo::p2d& a_histo,const std::string& a_name) {
|
||||
bufobj* bo = new bufobj(a_dir.file().out(),a_dir.file().byte_swap(),256,
|
||||
a_name,a_histo.title(),osc::s_p2d());
|
||||
|
||||
//Stream as in a BatchLab/Rio/Data.h :
|
||||
if(!bo->write_version(1)) return false;
|
||||
if(!Named_stream(*bo,a_name,a_histo.title())) return false;
|
||||
|
||||
member_writer mw(*bo);
|
||||
if(!osc::visit(mw,a_histo)) {
|
||||
a_dir.file().out() << "tools::wroot::to_osc :"
|
||||
<< " Profile2D_stream failed."
|
||||
<< std::endl;
|
||||
delete bo;
|
||||
return false;
|
||||
}
|
||||
a_dir.append_object(bo); //a_dir takes ownership of bo.
|
||||
return true;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user