Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -1109,7 +1109,7 @@ protected:
|
||||
|
||||
} else if(tag_name==s_row()) {
|
||||
|
||||
const std::vector<aida::base_col*>& cols = a_ntu.cols();
|
||||
const std::vector<aida::base_col*>& cols = a_ntu.columns();
|
||||
|
||||
std::vector<unsigned int> intus;
|
||||
std::vector<unsigned int> inot_ntus;
|
||||
@@ -1276,7 +1276,7 @@ protected:
|
||||
}
|
||||
}}
|
||||
|
||||
if(!ntu->cols().size()) { //??? we could have an empty ntu !
|
||||
if(!ntu->columns().size()) { //??? we could have an empty ntu !
|
||||
a_out << "tools::xml::aidas::read_ntu :"
|
||||
<< " for ntuple name " << sout(sname)
|
||||
<< " unable to create a aida::ntuple." << std::endl;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "../smatch"
|
||||
#include "../sout"
|
||||
#include "../forit"
|
||||
#include "../sbeg"
|
||||
|
||||
namespace tools {
|
||||
namespace xml {
|
||||
@@ -33,6 +34,9 @@ public:
|
||||
public:
|
||||
std::ostream& out() const {return m_out;}
|
||||
|
||||
const sg::cmaps_t& cmaps() const {return m_cmaps;}
|
||||
sg::cmaps_t& cmaps() {return m_cmaps;}
|
||||
|
||||
typedef std::pair<std::string,std::string> style_item_t;
|
||||
typedef std::vector<style_item_t> style_t;
|
||||
typedef std::pair<std::string,style_t> named_style_t;
|
||||
@@ -51,6 +55,18 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
style_t* find_style(const std::string& a_name) {
|
||||
tools_vforit(named_style_t,m_named_styles,it){
|
||||
if((*it).first==a_name) return &((*it).second);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void remove_item_in_style(style_t& a_style,const std::string& a_item) {
|
||||
remove<std::string,std::string>(a_style,a_item);
|
||||
}
|
||||
*/
|
||||
|
||||
void find_styles(const std::string& a_pattern,std::vector<std::string>& a_v) const {
|
||||
a_v.clear();
|
||||
tools_vforcit(named_style_t,m_named_styles,it){
|
||||
@@ -61,10 +77,12 @@ public:
|
||||
void add_style(const std::string& a_name,const style_t& a_style) {
|
||||
tools_vforit(named_style_t,m_named_styles,it){
|
||||
if((*it).first==a_name) { //override
|
||||
//::printf("debug : styles::add_style : override : \"%s\"\n",a_name.c_str());
|
||||
(*it).second = a_style;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//::printf("debug : styles::add_style : push_back \"%s\"\n",a_name.c_str());
|
||||
m_named_styles.push_back(named_style_t(a_name,a_style));
|
||||
}
|
||||
|
||||
@@ -80,7 +98,9 @@ public:
|
||||
}
|
||||
|
||||
void append(const styles& a_from) {
|
||||
//::printf("debug : styles::append ...\n");
|
||||
tools_vforcit(named_style_t,a_from.m_named_styles,it) {
|
||||
//::printf("debug : styles::append \"%s\"\n",(*it).first.c_str());
|
||||
m_named_styles.push_back(*it);
|
||||
}
|
||||
}
|
||||
@@ -302,6 +322,32 @@ public:
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool print_plotter_style(std::ostream& a_out,const std::string& a_style) {
|
||||
std::string _beg = a_style+".";
|
||||
bool found = false;
|
||||
tools_vforcit(named_style_t,m_named_styles,it) {
|
||||
const std::string& _name = (*it).first;
|
||||
if((_name==a_style)||is_beg(_name,_beg)) {
|
||||
found = true;
|
||||
a_out << (*it).first << " :" << std::endl;
|
||||
const style_t& sty = (*it).second;
|
||||
tools_vforcit(style_item_t,sty,vit) {
|
||||
if((*vit).first=="tag") continue;
|
||||
a_out << " " << (*vit).first << " " << (*vit).second << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
void list_plotter_styles(std::ostream& a_out) {
|
||||
tools_vforcit(named_style_t,m_named_styles,it) {
|
||||
const style_t& sty = (*it).second;
|
||||
if(!styles::is_plotter_style(sty)) continue;
|
||||
a_out << (*it).first << std::endl;
|
||||
}
|
||||
}
|
||||
protected:
|
||||
std::ostream& m_out;
|
||||
//styles :
|
||||
@@ -407,16 +453,13 @@ inline void load_plotter_style(styles& a_styles,const tree& a_tree) {
|
||||
|
||||
styles sts(a_styles.out());
|
||||
|
||||
const std::vector<styles::named_style_t>& nss =
|
||||
a_styles.named_styles();
|
||||
const std::vector<styles::named_style_t>& nss = a_styles.named_styles();
|
||||
tools_vforcit(styles::named_style_t,nss,it){
|
||||
const std::string& name = (*it).first;
|
||||
if(name.substr(0,l)==head) {
|
||||
std::string tail = name.substr(l,name.size()-l);
|
||||
const styles::style_t& ssty = (*it).second;
|
||||
if(ssty.size()) {
|
||||
sts.add_style(pname+"."+tail,ssty);
|
||||
}
|
||||
if(ssty.size()) sts.add_style(pname+"."+tail,ssty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +495,26 @@ inline void load_plotter_style(styles& a_styles,const tree& a_tree) {
|
||||
|
||||
{looper _for2(*_tree);
|
||||
while(element* _elem = _for2.next_element()) {
|
||||
sty.push_back(styles::style_item_t(_elem->name(),_elem->value()));
|
||||
if(_elem->name()=="copy") {
|
||||
std::string from;
|
||||
_elem->attribute_value("from",from); //expect another style name.
|
||||
if(from.empty()) {
|
||||
a_styles.out() << "tools::sg::gui_viewer::load_plotter_style : (2) :"
|
||||
<< " <copy> without from."
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
const styles::style_t* csty = a_styles.find_style(from);
|
||||
if(!csty) {
|
||||
a_styles.out() << "tools::sg::gui_viewer::load_plotter_style : (2) :"
|
||||
<< " <copy> : from " << sout(from) << " not found."
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
append(sty,*csty);
|
||||
} else {
|
||||
sty.push_back(styles::style_item_t(_elem->name(),_elem->value()));
|
||||
}
|
||||
}}
|
||||
|
||||
if(sty.size()) {
|
||||
|
||||
@@ -173,9 +173,7 @@ public:
|
||||
///////////////////////////////////////////////////////
|
||||
/// elements //////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////
|
||||
void add_element(const std::string& a_name,
|
||||
const std::vector<atb>& a_atbs,
|
||||
const std::string& a_value){
|
||||
void add_element(const std::string& a_name,const std::vector<atb>& a_atbs,const std::string& a_value){
|
||||
m_childs.push_back(new element(a_name,a_atbs,a_value));
|
||||
}
|
||||
|
||||
@@ -222,9 +220,7 @@ public:
|
||||
|
||||
*/
|
||||
|
||||
bool element_atb_value(const std::string& a_elem,
|
||||
const std::string& a_atb,
|
||||
std::string& a_value) const {
|
||||
bool element_atb_value(const std::string& a_elem,const std::string& a_atb,std::string& a_value) const {
|
||||
a_value.clear();
|
||||
tools_lforcit(ielem*,m_childs,it) {
|
||||
if(element* _elem = id_cast<ielem,element>(*(*it))) {
|
||||
@@ -235,7 +231,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
bool element_atb_value(const std::string& a_elem,const std::string& a_atb,T& a_value) const {
|
||||
std::string sv;
|
||||
@@ -255,8 +251,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool set_element_value(const std::string& a_name,
|
||||
const std::string& a_value,int a_index = 0){
|
||||
bool set_element_value(const std::string& a_name,const std::string& a_value,int a_index = 0){
|
||||
int index = 0;
|
||||
tools_lforcit(ielem*,m_childs,it) {
|
||||
if(element* _elem = id_cast<ielem,element>(*(*it))) {
|
||||
@@ -276,8 +271,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool set_attribute_value(const std::string& a_atb,
|
||||
const std::string& a_value) {
|
||||
bool set_attribute_value(const std::string& a_atb,const std::string& a_value) {
|
||||
tools_vforit(atb,m_atbs,it) {
|
||||
if((*it).first==a_atb) {
|
||||
(*it).second = a_value;
|
||||
@@ -354,8 +348,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static void collect_by_tag(tree& a_tree,const std::string& a_tag,
|
||||
std::vector<tree*>& a_items) {
|
||||
static void collect_by_tag(tree& a_tree,const std::string& a_tag,std::vector<tree*>& a_items) {
|
||||
if(a_tree.tag_name()==a_tag) a_items.push_back(&a_tree);
|
||||
tools_lforcit(ielem*,a_tree.m_childs,it) {
|
||||
if(tree* _tree = id_cast<ielem,tree>(*(*it))) {
|
||||
|
||||
Reference in New Issue
Block a user