diff --git a/DDCore/include/DD4hep/DetFactoryHelper.h b/DDCore/include/DD4hep/DetFactoryHelper.h index 18690557ca21412348d9e0ca79681e16c6c7fefa..01f647fcf0fe69440b67874c70934bfa2e8af8f8 100644 --- a/DDCore/include/DD4hep/DetFactoryHelper.h +++ b/DDCore/include/DD4hep/DetFactoryHelper.h @@ -13,11 +13,6 @@ #include "DD4hep/LCDD.h" #include "DD4hep/Factories.h" -// Helpers to access tags and attributes quickly without specifying explicitly namespaces -#define _X(a) DD4hep::XML::Tag_##a -#define _A(a) DD4hep::XML::Attr_##a -#define _U(a) DD4hep::XML::Strng_t(#a) - // Shortcuts to elements of the XML namespace typedef DD4hep::XML::Tag_t xml_tag_t; typedef DD4hep::XML::Attribute xml_attr_t; diff --git a/DDCore/include/XML/XMLDetector.h b/DDCore/include/XML/XMLDetector.h index aa52a910f74c632f5847c28b8b87977e6198bf65..cd666d4bb55fdf7f0b0206bf535fdad2308aa8ae 100644 --- a/DDCore/include/XML/XMLDetector.h +++ b/DDCore/include/XML/XMLDetector.h @@ -55,12 +55,22 @@ namespace DD4hep { /// Access parameters: id, if not present returns default int id(int default_value) const; + /// Access parameters: type + int type() const; + /// Access rotation constants: combineHits + bool combineHits() const; + /// Access rotation constants: angle double angle() const; /// Access rotation constants: theta double theta() const; + /// Access rotation constants: thetaBins + int thetaBins() const; + /// Access rotation constants: phi double phi() const; + /// Access rotation constants: phiBins + int phiBins() const; /// Access rotation constants: phi0 double phi0() const; /// Access parameters: phi0, if not present returns default @@ -226,6 +236,8 @@ namespace DD4hep { /// Access attribute values: number int number() const; + /// Access attribute values: nmodules + int nmodules() const; /// Access attribute values: nModules int nModules() const; /// Access attribute values: RowID diff --git a/DDCore/include/XML/XMLElements.h b/DDCore/include/XML/XMLElements.h index 52f93ad3b621c1b6d47097d651fd15141f12b7ec..5cb194c7d2c9a48ea145592746d2dfd15dfa1d4e 100644 --- a/DDCore/include/XML/XMLElements.h +++ b/DDCore/include/XML/XMLElements.h @@ -639,12 +639,6 @@ namespace DD4hep { void setName(const XmlChar* new_name); }; - extern const Tag_t Attr_id; - extern const Tag_t Attr_type; - extern const Tag_t Attr_name; - extern const Tag_t Attr_value; - extern const Tag_t Attr_ref; - extern const Tag_t Attr_NULL; #undef INLINE } } /* End namespace DD4hep */ diff --git a/DDCore/include/XML/XMLTags.h b/DDCore/include/XML/XMLTags.h index 7aed06c89e7c4e8fdecfdd171f5096b942f67882..417d56c98df565cfefc7c130761e02946552a6e0 100644 --- a/DDCore/include/XML/XMLTags.h +++ b/DDCore/include/XML/XMLTags.h @@ -10,528 +10,13 @@ #define DD4hep_XML_TAGS_H #include "XML/XMLElements.h" +#define UNICODE(x) extern const Tag_t Unicode_##x +#include "XML/UnicodeValues.h" +#undef UNICODE -namespace DD4hep { namespace XML { +// Helpers to access tags and attributes quickly without specifying explicitly namespaces +#define _U(a) DD4hep::XML::Unicode_##a +#define _Unicode(a) DD4hep::XML::Strng_t(#a) - extern const Tag_t Attr_id; - extern const Tag_t Attr_type; - extern const Tag_t Attr_value; - extern const Tag_t Attr_formula; - extern const Tag_t Tag_NULL; - extern const Tag_t Tag_empty; - extern const Tag_t Tag_star; - extern const Tag_t Tag_PI; - extern const Tag_t Tag_TWOPI; - extern const Tag_t Tag_radian; - extern const Tag_t Tag_mm; - extern const Tag_t Tag_cm; - extern const Tag_t Attr_global; - extern const Tag_t Attr_local; - - extern const Tag_t Attr_overlap; - extern const Tag_t Attr_check; - - // RefElement parameters - extern const Tag_t Tag_ref; - - // Polycone parameters - - extern const Tag_t Tag_Air; - extern const Tag_t Tag_Vacuum; - extern const Tag_t Tag_D; - extern const Tag_t Tag_n; - extern const Tag_t Tag_RL; - extern const Tag_t Tag_NIL; - extern const Tag_t Tag_atom; - extern const Tag_t Attr_density; - extern const Tag_t Tag_composite; - extern const Tag_t Tag_fraction; - extern const Tag_t Tag_strength; - extern const Tag_t Tag_properties; - extern const Tag_t Tag_attributes; - - extern const Tag_t Tag_define; - extern const Tag_t Tag_detector; - extern const Tag_t Tag_dimensions; - extern const Tag_t Tag_element; - extern const Tag_t Tag_sd; - extern const Tag_t Tag_id; - extern const Tag_t Tag_idspecref; - - extern const Tag_t Attr_InvisibleNoDaughters; - extern const Tag_t Attr_InvisibleWithDaughters; - - extern const Tag_t Attr_Z; - - extern const Tag_t Attr_1; - extern const Tag_t Attr_barrel; - extern const Tag_t Attr_beampipe; - extern const Tag_t Attr_combineHits; - extern const Tag_t Attr_crossing_angle; - extern const Tag_t Attr_dimensions; - extern const Tag_t Attr_ecut; - extern const Tag_t Attr_false; - extern const Tag_t Attr_strength; - extern const Tag_t Attr_field; - extern const Tag_t Attr_inner_field; - extern const Tag_t Attr_outer_field; - extern const Tag_t Attr_field_name; - extern const Tag_t Attr_hits_collection; - extern const Tag_t Attr_incoming_r; - extern const Tag_t Attr_layer; - extern const Tag_t Attr_limits; - extern const Tag_t Attr_material; - extern const Tag_t Attr_n; - extern const Tag_t Attr_name; - extern const Tag_t Attr_nphi; - extern const Tag_t Attr_ntheta; - extern const Tag_t Attr_funit; - extern const Tag_t Tag_dipole_coeff; - - extern const Tag_t Attr_position; - extern const Tag_t Attr_rbg; - extern const Tag_t Attr_readout; - extern const Tag_t Attr_reflect; - extern const Tag_t Attr_region; - extern const Tag_t Attr_repeat; - extern const Tag_t Attr_rotation; - extern const Tag_t Attr_segmentation; - extern const Tag_t Attr_sensitive; - extern const Tag_t Attr_sensitive_detector; - extern const Tag_t Attr_system; - extern const Tag_t Attr_thickness; - extern const Tag_t Attr_true; - extern const Tag_t Attr_tubs; - extern const Tag_t Attr_verbose; - extern const Tag_t Attr_vis; - - // LCDD - extern const Tag_t Tag_lcdd; - extern const Tag_t Tag_lccdd; - extern const Tag_t Tag_barrel; - extern const Tag_t Tag_endcap; - extern const Tag_t Tag_cartesian_grid_xy; - extern const Tag_t Tag_global_grid_xy; - extern const Tag_t Tag_color; - extern const Tag_t Tag_detectors; - extern const Tag_t Tag_display; - extern const Tag_t Tag_field; - extern const Tag_t Tag_fields; - extern const Tag_t Tag_gdml; - extern const Tag_t Tag_header; - extern const Tag_t Tag_iddict; - extern const Tag_t Tag_limits; - extern const Tag_t Tag_materials; - extern const Tag_t Tag_materials; - extern const Tag_t Tag_includes; - extern const Tag_t Tag_gdmlFile; - extern const Tag_t Tag_readout; - extern const Tag_t Tag_readouts; - extern const Tag_t Tag_reflect_rot; - extern const Tag_t Tag_regions; - extern const Tag_t Tag_segmentation; - extern const Tag_t Tag_sensitive_detectors; - extern const Tag_t Tag_setup; - extern const Tag_t Tag_structure; - extern const Tag_t Tag_solids; - extern const Tag_t Tag_tracker; - extern const Tag_t Tag_tubs; - extern const Tag_t Tag_system; - extern const Tag_t Tag_world; - extern const Tag_t Tag_world_box; - extern const Tag_t Tag_world_volume; - extern const Tag_t Tag_calorimeter; - extern const Tag_t Tag_cartesian_grid_xy; - extern const Tag_t Tag_tracking_cylinder; - extern const Tag_t Tag_tracking_volume; - - extern const Tag_t Attr_insideTrackingVolume; - extern const Tag_t Attr_signed; - extern const Tag_t Attr_label; - extern const Tag_t Attr_start; - extern const Tag_t Attr_end; - extern const Tag_t Attr_width; - extern const Tag_t Attr_length; - extern const Tag_t Attr_height; - extern const Tag_t Attr_depth; - extern const Tag_t Attr_z_length; - extern const Tag_t Attr_line_style; - extern const Tag_t Attr_drawing_style; - extern const Tag_t Attr_module; - extern const Tag_t Attr_combine_hits; - - extern const Tag_t Tag_polyhedra; - extern const Tag_t Attr_numsides; - - /// LCDD XML - extern const Tag_t Tag_firstrotation; - extern const Tag_t Tag_firstposition; - extern const Tag_t Tag_union; - extern const Tag_t Tag_intersection; - extern const Tag_t Tag_paraboloid; - extern const Tag_t Tag_assembly; - extern const Tag_t Tag_sphere; - extern const Tag_t Tag_para; - extern const Tag_t Tag_eltube; - extern const Tag_t Tag_torus; - extern const Tag_t Attr_idspecref; - extern const Tag_t Attr_rlo; - extern const Tag_t Attr_rhi; - extern const Tag_t Attr_rtor; - extern const Tag_t Attr_starttheta; - extern const Tag_t Attr_deltatheta; - extern const Tag_t Attr_first; - extern const Tag_t Attr_second; - - /// Compact XML - extern const Tag_t Attr_gap; - extern const Tag_t Attr_phiBins; - extern const Tag_t Attr_thetaBins; - extern const Tag_t Attr_threshold; - extern const Tag_t Tag_component; - - extern const Tag_t Attr_r_size; - extern const Tag_t Attr_phi_size_max; - extern const Tag_t Tag_beampipe; - - extern const Tag_t Attr_lineStyle; -#if 0 - extern const Tag_t - extern const Tag_t - extern const Tag_t - extern const Tag_t - extern const Tag_t - extern const Tag_t - extern const Tag_t - -#endif - - // -- RefElement - extern const Tag_t Attr_name; - // -- References to refelements: - extern const Tag_t Attr_ref; - - //================================ Objects: ================================ - // -- Author - extern const Tag_t Tag_author; - extern const Tag_t Attr_name; - extern const Tag_t Attr_email; - extern const Tag_t Tag_empty; - // -- Header - extern const Tag_t Tag_header; - extern const Tag_t Attr_author; - extern const Tag_t Tag_detector; - extern const Tag_t Tag_comment; - extern const Tag_t Tag_name; - extern const Tag_t Tag_status; - extern const Tag_t Tag_title; - extern const Tag_t Tag_generator; - extern const Tag_t Attr_status; - extern const Tag_t Attr_title; - extern const Tag_t Attr_name; - extern const Tag_t Attr_file; - extern const Tag_t Attr_url; - extern const Tag_t Attr_version; - extern const Tag_t Attr_checksum; - extern const Tag_t Tag_info; - // -- Constant - extern const Tag_t Tag_constant; - extern const Tag_t Attr_value; - // -- XYZ_element - extern const Tag_t Attr_x; - extern const Tag_t Attr_y; - extern const Tag_t Attr_z; - extern const Tag_t Attr_unit; - // -- Position - extern const Tag_t Tag_position; - // -- Rotation - extern const Tag_t Tag_rotation; - // -- Atom - extern const Tag_t Tag_element; - // -- Material - extern const Tag_t Tag_material; - - // -- VisAttr (compact) - extern const Tag_t Tag_vis; - extern const Tag_t Attr_showDaughters; - extern const Tag_t Attr_visible; - extern const Tag_t Attr_drawingStyle; - extern const Tag_t Attr_alpha; - extern const Tag_t Attr_r; - extern const Tag_t Attr_b; - extern const Tag_t Attr_g; - - // -- VisAttr (LCDD) - extern const Tag_t Tag_vis; - extern const Tag_t Tag_color; - extern const Tag_t Attr_show_daughters; - extern const Tag_t Attr_visible; - extern const Tag_t Attr_line_style; - extern const Tag_t Attr_drawing_style; - extern const Tag_t Attr_alpha; - extern const Tag_t Attr_R; - extern const Tag_t Attr_B; - extern const Tag_t Attr_G; - extern const Tag_t Tag_limit; - // -- Limit - extern const Tag_t Attr_value; - extern const Tag_t Attr_unit; - extern const Tag_t Attr_particles; - extern const Tag_t Tag_mm; - extern const Tag_t Tag_star; - // -- Limitset - extern const Tag_t Tag_limitset; - // -- Region - extern const Tag_t Tag_region; - extern const Tag_t Attr_store_secondaries; - extern const Tag_t Attr_threshold; - extern const Tag_t Attr_lunit; - extern const Tag_t Attr_eunit; - extern const Tag_t Attr_cut; - extern const Tag_t Tag_mm; - extern const Tag_t Tag_MeV; - // -- IDSpec - extern const Tag_t Tag_idspec; - extern const Tag_t Attr_length; - // -- IDSpec.idfield - extern const Tag_t Tag_idfield; - extern const Tag_t Attr_signed; - extern const Tag_t Attr_label; - extern const Tag_t Attr_start; - extern const Tag_t Attr_length; - // -- Alignment - extern const Tag_t Tag_alignments; - extern const Tag_t Tag_alignment; - - //================================ Objects: ================================ - - //================================ Volumes: ================================ - // -- Volume - extern const Tag_t Tag_volume; - extern const Tag_t Tag_solidref; - extern const Tag_t Tag_materialref; - extern const Tag_t Tag_regionref; - extern const Tag_t Tag_limitsetref; - extern const Tag_t Tag_sdref; - extern const Tag_t Tag_visref; - // -- PhysVol - extern const Tag_t Tag_physvol; - extern const Tag_t Tag_volumeref; - extern const Tag_t Tag_positionref; - extern const Tag_t Tag_rotationref; - extern const Tag_t Tag_identity_pos; - extern const Tag_t Tag_identity_rot; - // -- PhysVol.PhysVolID - extern const Tag_t Tag_physvolid; - extern const Tag_t Attr_field_name; - extern const Tag_t Attr_value; - - // -- Rotation/angles - extern const Tag_t Attr_angle; - extern const Tag_t Attr_alpha; - extern const Tag_t Attr_alpha1; - extern const Tag_t Attr_alpha2; - extern const Tag_t Attr_beta; - extern const Tag_t Attr_gamma; - extern const Tag_t Attr_theta; - extern const Tag_t Attr_phi; - extern const Tag_t Attr_phi0; - extern const Tag_t Attr_psi; - - // -- Cartesian type values - extern const Tag_t Attr_r; - extern const Tag_t Attr_dr; - extern const Tag_t Attr_rmin; - extern const Tag_t Attr_rmax; - extern const Tag_t Attr_rmin1; - extern const Tag_t Attr_rmin2; - extern const Tag_t Attr_rmax1; - extern const Tag_t Attr_rmax2; - extern const Tag_t Attr_inner_radius; - extern const Tag_t Attr_inner_r; - extern const Tag_t Attr_outer_radius; - extern const Tag_t Attr_outer_r; - extern const Tag_t Attr_outgoing_r; - - extern const Tag_t Attr_x; - extern const Tag_t Attr_X; - extern const Tag_t Attr_dx; - extern const Tag_t Attr_X1; - extern const Tag_t Attr_X2; - extern const Tag_t Attr_x0; - extern const Tag_t Attr_x1; - extern const Tag_t Attr_x2; - extern const Tag_t Attr_x3; - extern const Tag_t Attr_x4; - extern const Tag_t Attr_xmin; - extern const Tag_t Attr_xmax; - extern const Tag_t Attr_start_x; - extern const Tag_t Attr_end_x; - extern const Tag_t Attr_dim_x; - extern const Tag_t Attr_x_offset; - - extern const Tag_t Attr_y; - extern const Tag_t Attr_Y; - extern const Tag_t Attr_dy; - extern const Tag_t Attr_Y1; - extern const Tag_t Attr_Y2; - extern const Tag_t Attr_y0; - extern const Tag_t Attr_y1; - extern const Tag_t Attr_y2; - extern const Tag_t Attr_ymin; - extern const Tag_t Attr_ymax; - extern const Tag_t Attr_start_y; - extern const Tag_t Attr_end_y; - extern const Tag_t Attr_dim_y; - extern const Tag_t Attr_y_offset; - - extern const Tag_t Attr_z; - extern const Tag_t Attr_Z; - extern const Tag_t Attr_z0; - extern const Tag_t Attr_z1; - extern const Tag_t Attr_z2; - extern const Tag_t Attr_dz; - extern const Tag_t Attr_zmin; - extern const Tag_t Attr_zmax; - extern const Tag_t Attr_start_z; - extern const Tag_t Attr_end_z; - extern const Tag_t Attr_inner_z; - extern const Tag_t Attr_outer_z; - extern const Tag_t Attr_dim_z; - extern const Tag_t Attr_z_offset; - - - //================================ Shapes: ================================ - // Solid: - // No tags - // -- ZPlane - extern const Tag_t Tag_zplane; - // -- Box - extern const Tag_t Tag_box; - // -- Polycone - extern const Tag_t Tag_polycone; - extern const Tag_t Attr_startphi; - extern const Tag_t Attr_deltaphi; - // -- Tube - extern const Tag_t Tag_tube; - extern const Tag_t Attr_deltaphi; - extern const Tag_t Attr_zhalf; - // -- Cone - extern const Tag_t Tag_cone; - extern const Tag_t Attr_startphi; - extern const Tag_t Attr_deltaphi; - - // -- Trapezoid - extern const Tag_t Tag_trd; - // Trap - extern const Tag_t Tag_trap; - extern const Tag_t Attr_aunit; - extern const Tag_t Attr_lunit; - // -- PolyhedraRegular - extern const Tag_t Tag_polyhedra; - extern const Tag_t Attr_startphi; - extern const Tag_t Attr_deltaphi; - extern const Tag_t Attr_numsides; - // -- BooleanSolid - extern const Tag_t Tag_first; - extern const Tag_t Tag_second; - extern const Tag_t Tag_positionref; - extern const Tag_t Tag_rotationref; - // -- SubtractionSolid - extern const Tag_t Tag_subtraction; - - //================================ Detectors: ================================ - // -- Calorimeter - extern const Tag_t Tag_Air; - extern const Tag_t Tag_layer; - extern const Tag_t Tag_layers; - extern const Tag_t Tag_slice; - extern const Tag_t Tag_slices; - extern const Tag_t Tag_reflect; - extern const Tag_t Tag_reflect_rot; - extern const Tag_t Tag_stave; - extern const Tag_t Tag_staves; - extern const Tag_t Tag_system; - extern const Tag_t Tag_barrel; - extern const Tag_t Tag_limit; - extern const Tag_t Tag_module; - extern const Tag_t Attr_system; - extern const Tag_t Attr_barrel; - extern const Tag_t Attr_layer; - // -- SiTrackers - extern const Tag_t Tag_Air; - extern const Tag_t Tag_Vacuum; - extern const Tag_t Tag_module; - extern const Tag_t Tag_layer; - extern const Tag_t Tag_position; - extern const Tag_t Tag_rotation; - extern const Tag_t Tag_sensor; - extern const Tag_t Tag_wedge; - extern const Tag_t Tag_system; - extern const Tag_t Tag_barrel; - extern const Tag_t Tag_component; - extern const Tag_t Tag_sensor; - extern const Tag_t Tag_trd; - extern const Tag_t Tag_module_component; - extern const Tag_t Attr_system; - extern const Tag_t Attr_barrel; - extern const Tag_t Attr_InvisibleWithDaughters; - //================================ Segmentation: ============================= - extern const Tag_t Tag_nonprojective_cylinder; - extern const Tag_t Tag_projective_cylinder; - extern const Tag_t Tag_projective_zplane; - extern const Tag_t Tag_grid_xyz; - extern const Tag_t Tag_NULL; - extern const Tag_t Attr_thetaBins; - extern const Tag_t Attr_phiBins; - extern const Tag_t Attr_gridSizeX; - extern const Tag_t Attr_gridSizeY; - extern const Tag_t Attr_gridSizeZ; - extern const Tag_t Attr_gridSizePhi; - extern const Tag_t Attr_useForHitPosition; - extern const Tag_t Attr_type; - extern const Tag_t Attr_ntheta; - extern const Tag_t Attr_nphi; - extern const Tag_t Attr_thetaBins; - extern const Tag_t Attr_phiBins; - extern const Tag_t Attr_grid_size_phi; - extern const Tag_t Attr_grid_size_x; - extern const Tag_t Attr_grid_size_y; - extern const Tag_t Attr_grid_size_z; - - extern const Tag_t Tag_barrel_envelope; - extern const Tag_t Tag_module_envelope; - extern const Tag_t Tag_rphi_layout; - extern const Tag_t Tag_z_layout; - extern const Tag_t Attr_phi_tilt; - extern const Tag_t Attr_rc; - extern const Tag_t Attr_nz; - extern const Tag_t Attr_nmodules; - extern const Tag_t Attr_zstart; - extern const Tag_t Tag_ring; - - // ILCEx - extern const Tag_t Tag_support; - extern const Tag_t Tag_ladder; - extern const Tag_t Attr_number; - extern const Tag_t Attr_offset; - extern const Tag_t Attr_radius; - // -- TPC, modules for endplate - extern const Tag_t Tag_modules; - extern const Tag_t Tag_row; - extern const Tag_t Attr_nModules; - extern const Tag_t Attr_modulePosX; - extern const Tag_t Attr_modulePosY; - extern const Tag_t Attr_moduleHeight; - extern const Tag_t Attr_moduleWidth; - extern const Tag_t Attr_modulePitch; - extern const Tag_t Attr_rowPitch; - extern const Tag_t Attr_pads; - extern const Tag_t Attr_RowID; - extern const Tag_t Attr_nPads; - extern const Tag_t Attr_padPitch; - extern const Tag_t Attr_rowHeight; - -}} #endif // DD4hep_XML_TAGS_H diff --git a/DDCore/src/LCDDImp.cpp b/DDCore/src/LCDDImp.cpp index 6037358e413ba5011a62fb46f0580f769f722ae2..22fe70b778082aa64bbb593b6b1208cc16fef362 100644 --- a/DDCore/src/LCDDImp.cpp +++ b/DDCore/src/LCDDImp.cpp @@ -278,19 +278,19 @@ void LCDDImp::apply(const char* factory_type, int argc, char** argv) { try { long result = ROOT::Reflex::PluginService::Create<long>(fac,(LCDD*)this,argc,argv); if ( 0 == result ) { - throw runtime_error("Failed to locate plugin to apply "+fac); + throw runtime_error("apply-plugin: Failed to locate plugin "+fac); } result = *(long*)result; if ( result != 1 ) { - throw runtime_error("Failed to execute plugin to apply "+fac); + throw runtime_error("apply-plugin: Failed to execute plugin "+fac); } } catch(const exception& e) { cout << "Exception:" << e.what() << endl; - throw runtime_error("Exception:\""+string(e.what())+"\" while applying plugin:"+fac); + throw runtime_error("Exception:\""+string(e.what())+"\" with plugin:"+fac); } catch(...) { cout << "UNKNOWN Exception" << endl; - throw runtime_error("UNKNOWN excetion while applying plugin:"+fac); + throw runtime_error("UNKNOWN excetion from plugin:"+fac); } } diff --git a/DDCore/src/XML/Layering.cpp b/DDCore/src/XML/Layering.cpp index 376c24c530bb99410776bc49645028d54f8d8a05..dc8777c8bd32729b9e81eae41dda5846afc6989d 100644 --- a/DDCore/src/XML/Layering.cpp +++ b/DDCore/src/XML/Layering.cpp @@ -9,6 +9,7 @@ #include "XML/XMLDetector.h" #include "XML/Layering.h" +#include "XML/XMLTags.h" #include <algorithm> #include <stdexcept> #include <cfloat> @@ -18,17 +19,8 @@ using namespace std; using namespace DD4hep; using namespace DD4hep::XML; -namespace DD4hep { namespace XML { - extern const Tag_t Tag_Air; - extern const Tag_t Tag_layer; - extern const Tag_t Tag_slice; - extern const Tag_t Attr_repeat; -}} - Layer::Layer(const Layer& c) -: _thickness(c._thickness), - _preOffset(c._preOffset), - _slices(c._slices) +: _thickness(c._thickness), _preOffset(c._preOffset), _slices(c._slices) { } @@ -79,12 +71,12 @@ void LayeringCnv::fromCompact(Layering& layering) const { vector<Layer*>& layers = layering.layers(); int count = 0; for_each(layers.begin(),layers.end(),deletePtr<Layer>); - for(Collection_t c(m_element,Tag_layer); c; ++c) { + for(Collection_t c(m_element,_U(layer)); c; ++c) { Layer lay; Component layer = c; - int repeat = layer.hasAttr(Attr_repeat) ? layer.repeat() : 1; + int repeat = layer.hasAttr(_U(repeat)) ? layer.repeat() : 1; ++count; - for(Collection_t s(c,Tag_slice); s; ++s) { + for(Collection_t s(c,_U(slice)); s; ++s) { Component slice = s; string mat = slice.materialStr(); LayerSlice lslice(slice.isSensitive(), slice.thickness(), mat); @@ -103,7 +95,7 @@ void LayeringCnv::fromCompact(Layering& layering) const { double Layering::singleLayerThickness(XML::Element e) const { Component layer = e; double thickness = 0e0; - for(Collection_t s(layer,Tag_slice); s; ++s) { + for(Collection_t s(layer,_U(slice)); s; ++s) { Component slice = s; thickness += slice.thickness(); } diff --git a/DDCore/src/XML/XMLDetector.cpp b/DDCore/src/XML/XMLDetector.cpp index bcc0c7b356a5d9abb39abbfa1c33df037b4db2c9..e865ede691c2f69342f0431adb4a3e1e71513682 100644 --- a/DDCore/src/XML/XMLDetector.cpp +++ b/DDCore/src/XML/XMLDetector.cpp @@ -3,26 +3,27 @@ using namespace std; using namespace DD4hep::XML; -#define XML_ATTR_ACCESSOR(type,name) type Dimension::name() const { return m_element.attr<type>(Attr_##name); } +#define XML_ATTR_ACCESSOR(type,name) type Dimension::name() const { return m_element.attr<type>(Unicode_##name); } #define XML_ATTR_ACCESSOR_DOUBLE(name) \ double Dimension::name(double default_val) const { \ - const XmlChar* val = m_element.attr_value_nothrow(Attr_##name); \ + const XmlChar* val = m_element.attr_value_nothrow(Unicode_##name); \ return val ? _toDouble(val) : default_val; } #define XML_ATTR_ACCESSOR_INT(name) \ int Dimension::name(int default_val) const { \ - const XmlChar* val = m_element.attr_value_nothrow(Attr_##name); \ + const XmlChar* val = m_element.attr_value_nothrow(Unicode_##name); \ return val ? _toInt(val) : default_val; } #define XML_ATTR_ACCESSOR_BOOL(name) \ bool Dimension::name(bool default_val) const { \ - const XmlChar* val = m_element.attr_value_nothrow(Attr_##name); \ + const XmlChar* val = m_element.attr_value_nothrow(Unicode_##name); \ return val ? _toBool(val) : default_val; } #define XML_CHILD_ACCESSOR_XML_DIM(name) \ Dimension Dimension::name(bool throw_if_not_present) const { \ - return m_element.child(Tag_##name,throw_if_not_present); } + return m_element.child(Unicode_##name,throw_if_not_present); } XML_ATTR_ACCESSOR(int,id) XML_ATTR_ACCESSOR_INT(id) + XML_ATTR_ACCESSOR(bool,combineHits) XML_ATTR_ACCESSOR(double,x) XML_ATTR_ACCESSOR_DOUBLE(x) @@ -79,8 +80,10 @@ XML_ATTR_ACCESSOR(int,id) XML_ATTR_ACCESSOR(double,angle) XML_ATTR_ACCESSOR(double,theta) + XML_ATTR_ACCESSOR(int,thetaBins) XML_ATTR_ACCESSOR(double,psi) XML_ATTR_ACCESSOR(double,phi) + XML_ATTR_ACCESSOR(int,phiBins) XML_ATTR_ACCESSOR(double,phi0) XML_ATTR_ACCESSOR_DOUBLE(phi0) XML_ATTR_ACCESSOR(double,deltaphi) @@ -115,6 +118,7 @@ XML_ATTR_ACCESSOR(int,id) XML_ATTR_ACCESSOR(bool,reflect) XML_ATTR_ACCESSOR_BOOL(reflect) + XML_ATTR_ACCESSOR(int,nmodules) XML_ATTR_ACCESSOR(int,nModules) XML_ATTR_ACCESSOR(int,RowID) XML_ATTR_ACCESSOR(int,nPads) @@ -128,12 +132,12 @@ XML_ATTR_ACCESSOR(int,id) XML_ATTR_ACCESSOR(double,rowHeight) XML_ATTR_ACCESSOR(double,inner_field) XML_ATTR_ACCESSOR(double,outer_field) + XML_ATTR_ACCESSOR(int,type) #if 0 XML_ATTR_ACCESSOR(double,) XML_ATTR_ACCESSOR(double,) XML_ATTR_ACCESSOR(double,) XML_ATTR_ACCESSOR(double,) - XML_ATTR_ACCESSOR(double,) #endif XML_CHILD_ACCESSOR_XML_DIM(dimensions) @@ -145,56 +149,56 @@ XML_ATTR_ACCESSOR(int,id) XML_CHILD_ACCESSOR_XML_DIM(beampipe) -string Dimension::padType() const { - return m_element.attr<string>(Attr_pads); + string Dimension::padType() const { + return m_element.attr<string>(_U(pads)); } string Dimension::nameStr() const { - return m_element.attr<string>(Attr_name); + return m_element.attr<string>(_U(name)); } string Dimension::typeStr() const { - return m_element.attr<string>(Attr_type); + return m_element.attr<string>(_U(type)); } string Dimension::regionStr() const { - return m_element.hasAttr(Attr_region) ? m_element.attr<string>(Attr_region) : string(); + return m_element.hasAttr(_U(region)) ? m_element.attr<string>(_U(region)) : string(); } string Dimension::limitsStr() const { - return m_element.hasAttr(Attr_limits) ? m_element.attr<string>(Attr_limits) : string(); + return m_element.hasAttr(_U(limits)) ? m_element.attr<string>(_U(limits)) : string(); } string Dimension::visStr() const { - return m_element.hasAttr(Attr_vis) ? m_element.attr<string>(Attr_vis) : string(); + return m_element.hasAttr(_U(vis)) ? m_element.attr<string>(_U(vis)) : string(); } string Dimension::readoutStr() const { - return m_element.hasAttr(Attr_readout) ? m_element.attr<string>(Attr_readout) : string(); + return m_element.hasAttr(_U(readout)) ? m_element.attr<string>(_U(readout)) : string(); } string Dimension::moduleStr() const { - return m_element.hasAttr(Attr_module) ? m_element.attr<string>(Attr_module) : string(); + return m_element.hasAttr(_U(module)) ? m_element.attr<string>(_U(module)) : string(); } string Component::materialStr() const { - return m_element.attr<string>(Attr_material); + return m_element.attr<string>(_U(material)); } bool Component::isSensitive() const { - char val = m_element.hasAttr(Attr_sensitive) ? m_element.attr<string>(Attr_sensitive)[0] : 'f'; + char val = m_element.hasAttr(_U(sensitive)) ? m_element.attr<string>(_U(sensitive))[0] : 'f'; val = ::toupper(val); return val == 'T' || val == 'Y'; } int DetElement::id() const { - return m_element.hasAttr(Attr_id) ? m_element.attr<int>(Attr_id) : -1; + return m_element.hasAttr(_U(id)) ? m_element.attr<int>(_U(id)) : -1; } string DetElement::materialStr() const { - Handle_t h = m_element.child(Tag_material); - if ( h && h.hasAttr(Attr_name) ) { - return h.attr<string>(Attr_name); + Handle_t h = m_element.child(_U(material)); + if ( h && h.hasAttr(_U(name)) ) { + return h.attr<string>(_U(name)); } return ""; } @@ -207,8 +211,8 @@ void DetElement::check(bool condition, const string& msg) const { bool DetElement::isTracker() const { if ( m_element ) { - string type = attr<string>(Attr_type); - if ( type.find("Tracker") != string::npos && hasAttr(Attr_readout) ) { + string type = attr<string>(_U(type)); + if ( type.find("Tracker") != string::npos && hasAttr(_U(readout)) ) { return true; } } @@ -217,17 +221,17 @@ bool DetElement::isTracker() const { bool DetElement::isCalorimeter() const { if ( m_element ) { - string type = attr<string>(Attr_type); - if ( type.find("Calorimeter") != string::npos && hasAttr(Attr_readout) ) { - return true; + string type = attr<string>(_U(type)); + if ( type.find("Calorimeter") != string::npos && hasAttr(_U(readout)) ) { + return true; } } return false; } bool DetElement::isInsideTrackingVolume() const { - if ( m_element && hasAttr(Attr_insideTrackingVolume) ) - return attr<bool>(Attr_insideTrackingVolume); + if ( m_element && hasAttr(_U(insideTrackingVolume)) ) + return attr<bool>(_U(insideTrackingVolume)); else if ( isTracker() ) return true; return false; diff --git a/DDCore/src/XML/XMLElements.cpp b/DDCore/src/XML/XMLElements.cpp index 4d77dc8a3e579efb4386803bc537165d927a931e..ecfefdcac5b1695d5fd161885a13416a1ef6559c 100644 --- a/DDCore/src/XML/XMLElements.cpp +++ b/DDCore/src/XML/XMLElements.cpp @@ -10,6 +10,7 @@ // Framework include files #include "XML/XMLElements.h" #include "XML/Evaluator.h" +#include "XML/XMLTags.h" // C/C++ include files #include <iostream> @@ -657,7 +658,7 @@ Attribute Handle_t::setAttr(const XmlChar* name, const XmlChar* value) const { Handle_t Handle_t::setRef(const XmlChar* tag, const XmlChar* ref_name) { Element me(*this); Element ref(me.document(),tag); - ref.setAttr(Attr_ref,ref_name); + ref.setAttr(Unicode_ref,ref_name); me.append(ref); return ref; } @@ -795,12 +796,12 @@ Attribute Element::getAttr(const XmlChar* name) const { /// Set the reference attribute to the node (adds attribute ref="ref-name") Attribute Element::setRef(const XmlChar* tag, const XmlChar* refname) const { - return setChild(tag).setAttr(Attr_ref,refname); + return setChild(tag).setAttr(Unicode_ref,refname); } /// Access the value of the reference attribute of the node (attribute ref="ref-name") const XmlChar* Element::getRef(const XmlChar* tag) const { - return child(tag).attr<cpXmlChar>(Attr_ref); + return child(tag).attr<cpXmlChar>(Unicode_ref); } /// Add a new child to the DOM node @@ -819,13 +820,13 @@ Handle_t Element::setChild(const XmlChar* t) const { RefElement::RefElement(const Document& document, const XmlChar* type, const XmlChar* name) : Element(document, type) { - m_name = name ? setAttr(Attr_name,name) : 0; + m_name = name ? setAttr(_U(name),name) : 0; } RefElement::RefElement(const Handle_t& e) : Element(e) { - m_name = m_element ? getAttr(Attr_name) : 0; + m_name = m_element ? getAttr(_U(name)) : 0; } RefElement::RefElement(const RefElement& e) @@ -844,7 +845,7 @@ const XmlChar* RefElement::refName() const { } void RefElement::setName(const XmlChar* new_name) { - setAttr(Attr_name,new_name); + setAttr(_U(name),new_name); } #ifndef __TIXML__ diff --git a/DDCore/src/XML/XMLTags.cpp b/DDCore/src/XML/XMLTags.cpp index 4adf4d5c11bd96bf53a162949429fac4cf8e9d11..d501d37f210b07d3b8db159a7a9b46090c801267 100644 --- a/DDCore/src/XML/XMLTags.cpp +++ b/DDCore/src/XML/XMLTags.cpp @@ -29,412 +29,18 @@ namespace { __Init __In__; } #endif -#define TAG(x) extern const Tag_t Tag_##x (#x) -#define ATTR(x) extern const Tag_t Attr_##x (#x) -namespace DD4hep { namespace XML { - - extern const Tag_t Attr_id ("id"); - extern const Tag_t Attr_type ("type"); - extern const Tag_t Attr_value ("value"); - extern const Tag_t Attr_formula ("formula"); - extern const Tag_t Tag_NULL ("0"); - extern const Tag_t Tag_empty (""); - extern const Tag_t Tag_star ("*"); - extern const Tag_t Tag_PI ("3.14159265358979323846"); - extern const Tag_t Tag_TWOPI ("6.28318530717958647692"); - TAG(radian); - TAG(mm); - TAG(cm); - TAG(MeV); - TAG(n); - TAG(ref); - - // - - // RefElement parameters - - // Polycone parameters - - TAG(Air); - TAG(Vacuum); - - TAG(element); - TAG(material); - TAG(atom); - TAG(D); - TAG(RL); - TAG(NIL); - ATTR(desnity); - TAG(fraction); - TAG(composite); - TAG(sd); - TAG(dipole_coeff); - ATTR(funit); - ATTR(global); - ATTR(local); - - TAG(box); - TAG(define); - TAG(constant); - TAG(detector); - TAG(dimensions); - TAG(first); - TAG(id); - TAG(idspecref); - TAG(limit); - TAG(limitset); - TAG(limitsetref); - TAG(materialref); - TAG(module_component); - TAG(physvol); - TAG(physvolid); - TAG(polycone); - TAG(position); - TAG(positionref); - TAG(nonprojective_cylinder); - TAG(projective_cylinder); - TAG(projective_zplane); - TAG(region); - TAG(regionref); - TAG(rotation); - TAG(rotationref); - TAG(sdref); - TAG(second); - TAG(solidref); - TAG(tube); - TAG(vis); - TAG(visref); - TAG(strength); - TAG(volume); - TAG(volumeref); - TAG(zplane); - - TAG(alignment); - TAG(alignments); - TAG(properties); - TAG(attributes); - - ATTR(overlap); - ATTR(check); - ATTR(InvisibleNoDaughters); - ATTR(InvisibleWithDaughters); - - ATTR(1); - ATTR(b); - ATTR(barrel); - ATTR(beampipe); - ATTR(combineHits); - ATTR(crossing_angle); - ATTR(deltaphi); - ATTR(dimensions); - ATTR(ecut); - ATTR(false); - ATTR(strength); - ATTR(field); - ATTR(inner_field); - ATTR(outer_field); - ATTR(field_name); - ATTR(g); - ATTR(gridSizeX); - ATTR(gridSizeY); - ATTR(gridSizeZ); - ATTR(gridSizePhi); - ATTR(hits_collection); - TAG(identity_rot); - TAG(identity_pos); - ATTR(layer); - ATTR(limits); - ATTR(material); - ATTR(n); - ATTR(name); - ATTR(nphi); - ATTR(ntheta); - ATTR(position); - ATTR(rbg); - ATTR(readout); - ATTR(ref); - ATTR(reflect); - ATTR(reflect_rot); - ATTR(region); - ATTR(repeat); - - // -- Boxes - ATTR(width); - ATTR(length); - ATTR(height); - ATTR(depth); - - // -- angles - ATTR(angle); - ATTR(alpha); - ATTR(alpha1); - ATTR(alpha2); - ATTR(alpha3); - ATTR(alpha4); - ATTR(beta); - ATTR(gamma); - ATTR(psi); - ATTR(phi); - ATTR(startphi); - ATTR(endphi); - ATTR(theta); - - // -- Cartesian stuff - ATTR(x); - ATTR(X); - ATTR(dx); - ATTR(x0); - ATTR(x1); - ATTR(x2); - ATTR(x3); - ATTR(x4); - ATTR(X1); - ATTR(X2); - ATTR(xmin); - ATTR(xmax); - ATTR(start_x); - ATTR(end_x); - ATTR(dim_x); - ATTR(x_offset); - - ATTR(y); - ATTR(Y); - ATTR(dy); - ATTR(y0); - ATTR(y1); - ATTR(y2); - ATTR(y3); - ATTR(y4); - ATTR(Y1); - ATTR(Y2); - ATTR(ymin); - ATTR(ymax); - ATTR(start_y); - ATTR(end_y); - ATTR(dim_y); - ATTR(y_offset); - - ATTR(z); - ATTR(Z); - ATTR(dz); - ATTR(z0); - ATTR(z1); - ATTR(z2); - ATTR(z3); - ATTR(z4); - ATTR(zmin); - ATTR(zmax); - ATTR(start_z); - ATTR(end_z); - ATTR(dim_z); - ATTR(z_offset); - ATTR(inner_z); - ATTR(outer_z); - - // -- Radial stuff - ATTR(r); - ATTR(R); - ATTR(dr); - ATTR(r0); - ATTR(rmin); - ATTR(rmin1); - ATTR(rmin2); - ATTR(rmax); - ATTR(rmax1); - ATTR(rmax2); - ATTR(radius); - ATTR(inner_radius); - ATTR(inner_r); - ATTR(outer_radius); - ATTR(outer_r); +#define UNICODE(x) extern const Tag_t Unicode_##x (#x) +#include "XML/UnicodeValues.h" - ATTR(rotation); - ATTR(segmentation); - ATTR(sensitive); - ATTR(sensitive_detector); - ATTR(system); - ATTR(thickness); - ATTR(true); - ATTR(tubs); - ATTR(unit); - ATTR(useForHitPosition); - ATTR(verbose); - ATTR(version); - ATTR(vis); - ATTR(zhalf); - - // LCDD - TAG(firstrotation); - TAG(firstposition); - TAG(union); - TAG(intersection); - TAG(paraboloid); - TAG(assembly); - TAG(sphere); - TAG(para); - TAG(eltube); - TAG(torus); - ATTR(idspecref); - ATTR(rlo); - ATTR(rhi); - ATTR(rtor); - ATTR(starttheta); - ATTR(deltatheta); - ATTR(first); - ATTR(second); - - - TAG(lcdd); - TAG(lccdd); - TAG(barrel); - TAG(endcap); - TAG(cartesian_grid_xy); - TAG(global_grid_xy); - TAG(color); - TAG(detectors); - TAG(display); - TAG(field); - TAG(fields); - TAG(gdml); - TAG(grid_xyz); - TAG(iddict); - TAG(idfield); - TAG(idspec); - TAG(limits); - TAG(materials); - TAG(gdmlFile); - TAG(includes); - TAG(readout); - TAG(readouts); - TAG(reflect_rot); - TAG(regions); - TAG(segmentation); - TAG(sensitive_detectors); - TAG(setup); - TAG(structure); - TAG(solids); - TAG(tracker); - TAG(tubs); - TAG(system); - TAG(world); - TAG(world_box); - TAG(world_volume); - TAG(calorimeter); - TAG(tracking_cylinder); - TAG(tracking_volume); - - ATTR(insideTrackingVolume); - ATTR(signed); - ATTR(label); - ATTR(start); - ATTR(end); - - ATTR(z_length); - ATTR(grid_size_x); - ATTR(grid_size_y); - ATTR(grid_size_z); - ATTR(grid_size_phi); - ATTR(line_style); - ATTR(drawing_style); - ATTR(module); - ATTR(particles); - ATTR(show_daughters); - ATTR(B); - ATTR(G); - ATTR(visible); - ATTR(combine_hits); - TAG(trd); - - TAG(polyhedra); - ATTR(numsides); - - // -- Detector building and composition - TAG(slice); - TAG(slices); - TAG(layer); - TAG(layers); - TAG(stave); - TAG(staves); - TAG(module); - TAG(modules); - - /// Compact XML - TAG(sensor); - TAG(wedge); - ATTR(gap); - ATTR(lineStyle); - ATTR(drawingStyle); - ATTR(showDaughters); - ATTR(phiBins); - ATTR(thetaBins); - - TAG(trap); - ATTR(aunit); - - - ATTR(cut); - ATTR(store_secondaries); - ATTR(threshold); - ATTR(lunit); - ATTR(eunit); - ATTR(r_size); - ATTR(phi_size_max); - - TAG(component); - TAG(generator); - TAG(comment); - TAG(author); - ATTR(status); - ATTR(author); - TAG(title); - ATTR(title); - TAG(name); - ATTR(url); - TAG(header); - TAG(info); - ATTR(file); - ATTR(checksum); - - ATTR(incoming_r); - ATTR(outgoing_r); - - TAG(beampipe); - TAG(subtraction); - - TAG(cone); - - TAG(ladder); - TAG(support); - ATTR(number); - ATTR(offset); +namespace DD4hep { namespace XML { - TAG(module_envelope); - TAG(barrel_envelope); - TAG(rphi_layout); - TAG(z_layout); - TAG(ring); - ATTR(nmodules); - ATTR(phi0); - ATTR(phi_tilt); - ATTR(rc); - ATTR(nz); - ATTR(zstart); + extern const Tag_t Unicode_NULL ("0"); + extern const Tag_t Unicode_empty (""); + extern const Tag_t Unicode_star ("*"); + extern const Tag_t Unicode_PI ("3.14159265358979323846"); + extern const Tag_t Unicode_TWOPI ("6.28318530717958647692"); - TAG(row); - ATTR(nModules); - ATTR(moduleHeight); - ATTR(moduleWidth); - ATTR(modulePosX); - ATTR(modulePosY); - ATTR(modulePitch); - ATTR(rowPitch); - ATTR(pads); - ATTR(RowID); - ATTR(nPads); - ATTR(padPitch); - ATTR(rowHeight); - void tags_init() {static __Init i; } }} diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index 9ea6c61c7cff65e81c676c72ae2a76badde36459..9d9681c776b95f209111054b00971e365df1c8fa 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -61,9 +61,9 @@ namespace { static Ref_t create_GridXYZ(lcdd_t& /* lcdd */, xml_h e) { GridXYZ obj; - if ( e.hasAttr(_A(gridSizeX)) ) obj.setGridSizeX(e.attr<float>(_A(gridSizeX))); - if ( e.hasAttr(_A(gridSizeY)) ) obj.setGridSizeY(e.attr<float>(_A(gridSizeY))); - if ( e.hasAttr(_A(gridSizeZ)) ) obj.setGridSizeZ(e.attr<float>(_A(gridSizeZ))); + if ( e.hasAttr(_U(gridSizeX)) ) obj.setGridSizeX(e.attr<float>(_U(gridSizeX))); + if ( e.hasAttr(_U(gridSizeY)) ) obj.setGridSizeY(e.attr<float>(_U(gridSizeY))); + if ( e.hasAttr(_U(gridSizeZ)) ) obj.setGridSizeZ(e.attr<float>(_U(gridSizeZ))); return obj; } DECLARE_XMLELEMENT(GridXYZ,create_GridXYZ); @@ -73,16 +73,16 @@ DECLARE_XMLELEMENT(RegularNgonCartesianGridXY,create_GridXYZ); static Ref_t create_GlobalGridXY(lcdd_t& /* lcdd */, xml_h e) { GlobalGridXY obj; - if ( e.hasAttr(_A(gridSizeX)) ) obj.setGridSizeX(e.attr<float>(_A(gridSizeX))); - if ( e.hasAttr(_A(gridSizeY)) ) obj.setGridSizeY(e.attr<float>(_A(gridSizeY))); + if ( e.hasAttr(_U(gridSizeX)) ) obj.setGridSizeX(e.attr<float>(_U(gridSizeX))); + if ( e.hasAttr(_U(gridSizeY)) ) obj.setGridSizeY(e.attr<float>(_U(gridSizeY))); return obj; } DECLARE_XMLELEMENT(GlobalGridXY,create_GlobalGridXY); static Ref_t create_CartesianGridXY(lcdd_t& /* lcdd */, xml_h e) { CartesianGridXY obj; - if ( e.hasAttr(_A(gridSizeX)) ) obj.setGridSizeX(e.attr<double>(_A(gridSizeX))); - if ( e.hasAttr(_A(gridSizeY)) ) obj.setGridSizeY(e.attr<double>(_A(gridSizeY))); + if ( e.hasAttr(_U(gridSizeX)) ) obj.setGridSizeX(e.attr<double>(_U(gridSizeX))); + if ( e.hasAttr(_U(gridSizeY)) ) obj.setGridSizeY(e.attr<double>(_U(gridSizeY))); return obj; } DECLARE_XMLELEMENT(CartesianGridXY,create_CartesianGridXY); @@ -92,24 +92,24 @@ DECLARE_XMLELEMENT(EcalBarrelCartesianGridXY,create_CartesianGridXY); static Ref_t create_ProjectiveCylinder(lcdd_t& /* lcdd */, xml_h e) { ProjectiveCylinder obj; - if ( e.hasAttr(_A(phiBins)) ) obj.setPhiBins(e.attr<int>(_A(phiBins))); - if ( e.hasAttr(_A(thetaBins)) ) obj.setThetaBins(e.attr<int>(_A(thetaBins))); + if ( e.hasAttr(_U(phiBins)) ) obj.setPhiBins(e.attr<int>(_U(phiBins))); + if ( e.hasAttr(_U(thetaBins)) ) obj.setThetaBins(e.attr<int>(_U(thetaBins))); return obj; } DECLARE_XMLELEMENT(ProjectiveCylinder,create_ProjectiveCylinder); static Ref_t create_NonProjectiveCylinder(lcdd_t& /* lcdd */, xml_h e) { NonProjectiveCylinder obj; - if ( e.hasAttr(_A(gridSizePhi)) ) obj.setThetaBinSize(e.attr<double>(_A(gridSizePhi))); - if ( e.hasAttr(_A(gridSizeZ)) ) obj.setPhiBinSize(e.attr<double>(_A(gridSizeZ))); + if ( e.hasAttr(_U(gridSizePhi)) ) obj.setThetaBinSize(e.attr<double>(_U(gridSizePhi))); + if ( e.hasAttr(_U(gridSizeZ)) ) obj.setPhiBinSize(e.attr<double>(_U(gridSizeZ))); return obj; } DECLARE_XMLELEMENT(NonProjectiveCylinder,create_NonProjectiveCylinder); static Ref_t create_ProjectiveZPlane(lcdd_t& /* lcdd */, xml_h e) { ProjectiveZPlane obj; - if ( e.hasAttr(_A(phiBins)) ) obj.setThetaBins(e.attr<int>(_A(phiBins))); - if ( e.hasAttr(_A(thetaBins)) ) obj.setPhiBins(e.attr<int>(_A(thetaBins))); + if ( e.hasAttr(_U(phiBins)) ) obj.setThetaBins(e.attr<int>(_U(phiBins))); + if ( e.hasAttr(_U(thetaBins)) ) obj.setPhiBins(e.attr<int>(_U(thetaBins))); return obj; } DECLARE_XMLELEMENT(ProjectiveZPlane,create_ProjectiveZPlane); @@ -118,8 +118,8 @@ DECLARE_XMLELEMENT(ProjectiveZPlane,create_ProjectiveZPlane); static Ref_t create_ConstantField(lcdd_t& /* lcdd */, xml_h e) { CartesianField obj; - xml_comp_t field(e), strength(e.child(_X(strength))); - string t = e.attr<string>(_A(field)); + xml_comp_t field(e), strength(e.child(_U(strength))); + string t = e.attr<string>(_U(field)); Value<TNamed,ConstantField>* ptr = new Value<TNamed,ConstantField>(); ptr->type = ::toupper(t[0])=='E' ? CartesianField::ELECTRIC : CartesianField::MAGNETIC; ptr->direction.SetX(strength.x()); @@ -135,15 +135,15 @@ static Ref_t create_SolenoidField(lcdd_t& lcdd, xml_h e) { xml_comp_t c(e); CartesianField obj; Value<TNamed,SolenoidField>* ptr = new Value<TNamed,SolenoidField>(); - if ( c.hasAttr(_A(inner_radius)) ) ptr->innerRadius = c.attr<double>(_A(inner_radius)); + if ( c.hasAttr(_U(inner_radius)) ) ptr->innerRadius = c.attr<double>(_U(inner_radius)); else ptr->innerRadius = 0.0; - if ( c.hasAttr(_A(outer_radius)) ) ptr->outerRadius = c.attr<double>(_A(outer_radius)); + if ( c.hasAttr(_U(outer_radius)) ) ptr->outerRadius = c.attr<double>(_U(outer_radius)); else ptr->outerRadius = lcdd.constant<double>("world_side"); - if ( c.hasAttr(_A(inner_field)) ) ptr->innerField = c.attr<double>(_A(inner_field)); - if ( c.hasAttr(_A(outer_field)) ) ptr->outerField = c.attr<double>(_A(outer_field)); - if ( c.hasAttr(_A(zmax)) ) ptr->maxZ = c.attr<double>(_A(zmax)); + if ( c.hasAttr(_U(inner_field)) ) ptr->innerField = c.attr<double>(_U(inner_field)); + if ( c.hasAttr(_U(outer_field)) ) ptr->outerField = c.attr<double>(_U(outer_field)); + if ( c.hasAttr(_U(zmax)) ) ptr->maxZ = c.attr<double>(_U(zmax)); else ptr->maxZ = lcdd.constant<double>("world_side"); - if ( c.hasAttr(_A(zmin)) ) ptr->minZ = c.attr<double>(_A(zmin)); + if ( c.hasAttr(_U(zmin)) ) ptr->minZ = c.attr<double>(_U(zmin)); else ptr->minZ = - ptr->maxZ; obj.assign(ptr,c.nameStr(),c.typeStr()); return obj; @@ -154,12 +154,12 @@ static Ref_t create_DipoleField(lcdd_t& /* lcdd */, xml_h e) { xml_comp_t c(e); CartesianField obj; Value<TNamed,DipoleField>* ptr = new Value<TNamed,DipoleField>(); - double val, lunit = c.attr<double>(_A(lunit)), funit = c.attr<double>(_A(funit)); + double val, lunit = c.attr<double>(_U(lunit)), funit = c.attr<double>(_U(funit)); - if ( c.hasAttr(_A(zmin)) ) ptr->zmin = _multiply<double>(c.attr<string>(_A(zmin)),lunit); - if ( c.hasAttr(_A(zmax)) ) ptr->zmax = _multiply<double>(c.attr<string>(_A(zmax)),lunit); - if ( c.hasAttr(_A(rmax)) ) ptr->rmax = _multiply<double>(c.attr<string>(_A(rmax)),lunit); - for( xml_coll_t coll(c,_X(dipole_coeff)); coll; ++coll) { + if ( c.hasAttr(_U(zmin)) ) ptr->zmin = _multiply<double>(c.attr<string>(_U(zmin)),lunit); + if ( c.hasAttr(_U(zmax)) ) ptr->zmax = _multiply<double>(c.attr<string>(_U(zmax)),lunit); + if ( c.hasAttr(_U(rmax)) ) ptr->rmax = _multiply<double>(c.attr<string>(_U(rmax)),lunit); + for( xml_coll_t coll(c,_U(dipole_coeff)); coll; ++coll) { val = funit/pow(lunit,(int)ptr->coefficents.size()); val = _multiply<double>(coll.value(),val); ptr->coefficents.push_back(val); @@ -182,8 +182,8 @@ DECLARE_XML_DOC_READER(lccdd,create_Compact); */ template <> void Converter<Constant>::operator()(xml_h e) const { xml_ref_t constant(e); - TNamed* obj = new TNamed(constant.attr<string>(_A(name)).c_str(), - constant.attr<string>(_A(value)).c_str()); + TNamed* obj = new TNamed(constant.attr<string>(_U(name)).c_str(), + constant.attr<string>(_U(value)).c_str()); Ref_t cons(obj); _toDictionary(obj->GetName(),obj->GetTitle()); lcdd.addConstant(cons); @@ -195,12 +195,12 @@ template <> void Converter<Constant>::operator()(xml_h e) const { */ template <> void Converter<Header>::operator()(xml_h e) const { xml_comp_t c(e); - Header h(e.attr<string>(_A(name)),e.attr<string>(_A(title))); - h.setUrl(e.attr<string>(_A(url))); - h.setAuthor(e.attr<string>(_A(author))); - h.setStatus(e.attr<string>(_A(status))); - h.setVersion(e.attr<string>(_A(version))); - h.setComment(e.child(_X(comment)).text()); + Header h(e.attr<string>(_U(name)),e.attr<string>(_U(title))); + h.setUrl(e.attr<string>(_U(url))); + h.setAuthor(e.attr<string>(_U(author))); + h.setStatus(e.attr<string>(_U(status))); + h.setVersion(e.attr<string>(_U(version))); + h.setComment(e.child(_U(comment)).text()); lcdd.setHeader(h); } @@ -228,19 +228,19 @@ template <> void Converter<Material>::operator()(xml_h e) const { TGeoElementTable* table = mgr->GetElementTable(); TGeoMaterial* mat = mgr->GetMaterial(matname); TGeoMixture* mix = dynamic_cast<TGeoMixture*>(mat); - xml_coll_t fractions(m,_X(fraction)); - xml_coll_t composites(m,_X(composite)); + xml_coll_t fractions(m,_U(fraction)); + xml_coll_t composites(m,_U(composite)); bool has_density = true; bool mat_created = false; set<string> elts; if ( 0 == mat ) { - xml_h radlen = m.child(_X(RL),false); - xml_h intlen = m.child(_X(NIL),false); - xml_h density = m.child(_X(D),false); - double radlen_val = radlen.ptr() ? radlen.attr<double>(_A(value)) : 0.0; - double intlen_val = intlen.ptr() ? intlen.attr<double>(_A(value)) : 0.0; - double dens_val = density.ptr() ? density.attr<double>(_A(value)) : 0.0; + xml_h radlen = m.child(_U(RL),false); + xml_h intlen = m.child(_U(NIL),false); + xml_h density = m.child(_U(D),false); + double radlen_val = radlen.ptr() ? radlen.attr<double>(_U(value)) : 0.0; + double intlen_val = intlen.ptr() ? intlen.attr<double>(_U(value)) : 0.0; + double dens_val = density.ptr() ? density.attr<double>(_U(value)) : 0.0; if ( 0 == mat && !density.ptr() ) { cout << "Compact2Objects[WARNING]: Material:" << matname << " with NO density." << endl; has_density = false; @@ -256,11 +256,11 @@ template <> void Converter<Material>::operator()(xml_h e) const { elts.insert(mix->GetElement(i)->GetName()); } for(; composites; ++composites) { - std::string nam = composites.attr<string>(_X(ref)); + std::string nam = composites.attr<string>(_U(ref)); TGeoMaterial* comp_mat; TGeoElement* element; if ( elts.find(nam) == elts.end() ) { - double fraction = composites.attr<double>(_X(n)); + double fraction = composites.attr<double>(_U(n)); if ( 0 != (comp_mat=mgr->GetMaterial(nam.c_str())) ) { mix->AddElement(comp_mat,fraction); } @@ -275,11 +275,11 @@ template <> void Converter<Material>::operator()(xml_h e) const { } } for(; fractions; ++fractions) { - std::string nam = fractions.attr<string>(_X(ref)); + std::string nam = fractions.attr<string>(_U(ref)); TGeoMaterial* comp_mat; TGeoElement* element; if ( elts.find(nam) == elts.end() ) { - double fraction = fractions.attr<double>(_X(n)); + double fraction = fractions.attr<double>(_U(n)); if ( 0 != (comp_mat=mgr->GetMaterial(nam.c_str())) ) mix->AddElement(comp_mat,fraction); else if ( 0 != (element=table->FindElement(nam.c_str())) ) @@ -295,14 +295,14 @@ template <> void Converter<Material>::operator()(xml_h e) const { if ( !has_density && mix && 0 == mix->GetDensity() ) { double dens = 0.0; for(composites.reset(); composites; ++composites) { - std::string nam = composites.attr<string>(_X(ref)); - double fraction = composites.attr<double>(_X(n)); + std::string nam = composites.attr<string>(_U(ref)); + double fraction = composites.attr<double>(_U(n)); TGeoMaterial* comp_mat = mgr->GetMaterial(nam.c_str()); dens += fraction*comp_mat->GetDensity(); } for(fractions.reset(); fractions; ++fractions) { - std::string nam = fractions.attr<string>(_X(ref)); - double fraction = fractions.attr<double>(_X(n)); + std::string nam = fractions.attr<string>(_U(ref)); + double fraction = fractions.attr<double>(_U(n)); TGeoMaterial* comp_mat = mgr->GetMaterial(nam.c_str()); dens += fraction*comp_mat->GetDensity(); } @@ -321,8 +321,8 @@ template <> void Converter<Material>::operator()(xml_h e) const { // TGeo has no notion of a material "formula" // Hence, treat the formula the same way as the material itself - if ( m.hasAttr(_A(formula)) ) { - string form = m.attr<string>(_A(formula)); + if ( m.hasAttr(_U(formula)) ) { + string form = m.attr<string>(_U(formula)); if ( form != matname ) { LCDD::HandleMap::const_iterator im=lcdd.materials().find(form); if ( im == lcdd.materials().end() ) { @@ -350,11 +350,11 @@ template <> void Converter<Atom>::operator()(xml_h e) const { TGeoElementTable* tab = mgr->GetElementTable(); TGeoElement* element = tab->FindElement(eltname.c_str()); if ( !element ) { - xml_ref_t atom(elem.child(_X(atom))); - tab->AddElement(elem.attr<string>(_A(name)).c_str(), - elem.attr<string>(_A(formula)).c_str(), - elem.attr<int>(_A(Z)), - atom.attr<int>(_A(value)) + xml_ref_t atom(elem.child(_U(atom))); + tab->AddElement(elem.attr<string>(_U(name)).c_str(), + elem.attr<string>(_U(formula)).c_str(), + elem.attr<int>(_U(Z)), + atom.attr<int>(_U(value)) ); element = tab->FindElement(eltname.c_str()); } @@ -369,29 +369,29 @@ template <> void Converter<Atom>::operator()(xml_h e) const { * visible="true"/> */ template <> void Converter<VisAttr>::operator()(xml_h e) const { - VisAttr attr(e.attr<string>(_A(name))); - float r = e.hasAttr(_A(r)) ? e.attr<float>(_A(r)) : 1.0f; - float g = e.hasAttr(_A(g)) ? e.attr<float>(_A(g)) : 1.0f; - float b = e.hasAttr(_A(b)) ? e.attr<float>(_A(b)) : 1.0f; + VisAttr attr(e.attr<string>(_U(name))); + float r = e.hasAttr(_U(r)) ? e.attr<float>(_U(r)) : 1.0f; + float g = e.hasAttr(_U(g)) ? e.attr<float>(_U(g)) : 1.0f; + float b = e.hasAttr(_U(b)) ? e.attr<float>(_U(b)) : 1.0f; attr.setColor(r,g,b); - if ( e.hasAttr(_A(alpha)) ) attr.setAlpha(e.attr<float>(_A(alpha))); - if ( e.hasAttr(_A(visible)) ) attr.setVisible(e.attr<bool>(_A(visible))); - if ( e.hasAttr(_A(lineStyle)) ) { - string ls = e.attr<string>(_A(lineStyle)); + if ( e.hasAttr(_U(alpha)) ) attr.setAlpha(e.attr<float>(_U(alpha))); + if ( e.hasAttr(_U(visible)) ) attr.setVisible(e.attr<bool>(_U(visible))); + if ( e.hasAttr(_U(lineStyle)) ) { + string ls = e.attr<string>(_U(lineStyle)); if ( ls == "unbroken" ) attr.setLineStyle(VisAttr::SOLID); if ( ls == "broken" ) attr.setLineStyle(VisAttr::DASHED); } else { attr.setLineStyle(VisAttr::SOLID); } - if ( e.hasAttr(_A(drawingStyle)) ) { - string ds = e.attr<string>(_A(drawingStyle)); + if ( e.hasAttr(_U(drawingStyle)) ) { + string ds = e.attr<string>(_U(drawingStyle)); if ( ds == "wireframe" ) attr.setDrawingStyle(VisAttr::WIREFRAME); } else { attr.setDrawingStyle(VisAttr::WIREFRAME); } - if ( e.hasAttr(_A(showDaughters)) ) attr.setShowDaughters(e.attr<bool>(_A(showDaughters))); + if ( e.hasAttr(_U(showDaughters)) ) attr.setShowDaughters(e.attr<bool>(_U(showDaughters))); lcdd.addVisAttribute(attr); } @@ -404,20 +404,20 @@ template <> void Converter<VisAttr>::operator()(xml_h e) const { */ template <> void Converter<AlignmentEntry>::operator()(xml_h e) const { xml_comp_t child(e); - string path = e.attr<string>(_A(name)); - bool check = e.hasAttr(_A(check)); - bool overlap = e.hasAttr(_A(overlap)); + string path = e.attr<string>(_U(name)); + bool check = e.hasAttr(_U(check)); + bool overlap = e.hasAttr(_U(overlap)); AlignmentEntry alignment(path); Position pos; Rotation rot; - if ( (child=e.child(_X(position),false)) ) { // Position is not mandatory! + if ( (child=e.child(_U(position),false)) ) { // Position is not mandatory! pos.SetXYZ(child.x(),child.y(),child.z()); } - if ( (child=e.child(_X(rotation),false)) ) { // Rotation is not mandatory + if ( (child=e.child(_U(rotation),false)) ) { // Rotation is not mandatory rot.SetComponents(child.z(),child.y(),child.x()); } if ( overlap ) { - double ovl = e.attr<double>(_A(overlap)); + double ovl = e.attr<double>(_U(overlap)); alignment.align(pos,rot,check,ovl); } else { @@ -430,17 +430,17 @@ template <> void Converter<AlignmentEntry>::operator()(xml_h e) const { * */ template <> void Converter<Region>::operator()(xml_h e) const { - Region region(e.attr<string>(_A(name))); + Region region(e.attr<string>(_U(name))); vector<string>& limits = region.limits(); - string ene = e.attr<string>(_A(eunit)), len = e.attr<string>(_A(lunit)); + string ene = e.attr<string>(_U(eunit)), len = e.attr<string>(_U(lunit)); region.setEnergyUnit(ene); region.setLengthUnit(len); - region.setCut(_multiply<double>(e.attr<string>(_A(cut)),len)); - region.setThreshold(_multiply<double>(e.attr<string>(_A(threshold)),ene)); - region.setStoreSecondaries(e.attr<bool>(_A(store_secondaries))); - for(xml_coll_t user_limits(e,_X(limitsetref)); user_limits; ++user_limits) - limits.push_back(user_limits.attr<string>(_A(name))); + region.setCut(_multiply<double>(e.attr<string>(_U(cut)),len)); + region.setThreshold(_multiply<double>(e.attr<string>(_U(threshold)),ene)); + region.setStoreSecondaries(e.attr<bool>(_U(store_secondaries))); + for(xml_coll_t user_limits(e,_U(limitsetref)); user_limits; ++user_limits) + limits.push_back(user_limits.attr<string>(_U(name))); lcdd.addRegion(region); } @@ -452,13 +452,13 @@ template <> void Converter<Region>::operator()(xml_h e) const { * </readout> */ template <> void Converter<Readout>::operator()(xml_h e) const { - xml_h id = e.child(_X(id)); - xml_h seg = e.child(_X(segmentation),false); - string name = e.attr<string>(_A(name)); + xml_h id = e.child(_U(id)); + xml_h seg = e.child(_U(segmentation),false); + string name = e.attr<string>(_U(name)); Readout ro(name); if ( seg ) { // Segmentation is not mandatory! - string type = seg.attr<string>(_A(type)); + string type = seg.attr<string>(_U(type)); Ref_t segment(ROOT::Reflex::PluginService::Create<TNamed*>(type,&lcdd,&seg)); if ( !segment.isValid() ) throw runtime_error("FAILED to create segmentation:"+type); ro.setSegmentation(segment); @@ -480,13 +480,13 @@ template <> void Converter<Readout>::operator()(xml_h e) const { * ... </limitset> */ template <> void Converter<LimitSet>::operator()(xml_h e) const { - LimitSet ls(e.attr<string>(_A(name))); - for (xml_coll_t c(e,XML::Tag_limit); c; ++c) { + LimitSet ls(e.attr<string>(_U(name))); + for (xml_coll_t c(e,_U(limit)); c; ++c) { Limit limit; - limit.particles = c.attr<string>(_A(particles)); - limit.name = c.attr<string>(_A(name)); - limit.content = c.attr<string>(_A(value)); - limit.unit = c.attr<string>(_A(unit)); + limit.particles = c.attr<string>(_U(particles)); + limit.name = c.attr<string>(_U(name)); + limit.content = c.attr<string>(_U(value)); + limit.unit = c.attr<string>(_U(unit)); limit.value = _multiply<double>(limit.content,limit.unit); ls.addLimit(limit); } @@ -500,7 +500,7 @@ template <> void Converter<LimitSet>::operator()(xml_h e) const { * ... </properties> */ template <> void Converter<Property>::operator()(xml_h e) const { - string name = e.attr<string>(_A(name)); + string name = e.attr<string>(_U(name)); LCDD::Properties& prp = lcdd.properties(); if ( name.empty() ) { throw runtime_error("Failed to convert properties. No name given!"); @@ -525,8 +525,8 @@ template <> void Converter<Property>::operator()(xml_h e) const { */ template <> void Converter<CartesianField>::operator()(xml_h e) const { string msg = "updated"; - string name = e.attr<string>(_A(name)); - string type = e.attr<string>(_A(type)); + string name = e.attr<string>(_U(name)); + string type = e.attr<string>(_U(type)); CartesianField field = lcdd.field(name); if ( !field.isValid() ) { // The field is not present: We create it and add it to LCDD @@ -540,8 +540,8 @@ template <> void Converter<CartesianField>::operator()(xml_h e) const { type = field.type(); // Now update the field structure with the generic part ie. set it's properties CartesianField::Properties& prp = field.properties(); - for( xml_coll_t c(e,_X(properties)); c; ++c) { - string props_name = c.attr<string>(_A(name)); + for( xml_coll_t c(e,_U(properties)); c; ++c) { + string props_name = c.attr<string>(_U(name)); vector<xml_attr_t> a = c.attributes(); if ( prp.find(props_name) == prp.end() ) { prp.insert(make_pair(props_name,CartesianField::PropertyValues())); @@ -550,7 +550,7 @@ template <> void Converter<CartesianField>::operator()(xml_h e) const { pair<string,string> val(xml_tag_t(c.attr_name(*i)),c.attr<string>(*i)); prp[props_name].insert(val); } - if ( c.hasAttr(_A(global)) && c.attr<bool>(_A(global)) ) { + if ( c.hasAttr(_U(global)) && c.attr<bool>(_U(global)) ) { lcdd.field().properties() = prp; } } @@ -571,24 +571,24 @@ template <> void Converter<CartesianField>::operator()(xml_h e) const { * */ template <> void Converter<SensitiveDetector>::operator()(xml_h element) const { - string name = element.attr<string>(_A(name)); + string name = element.attr<string>(_U(name)); try { DetElement det = lcdd.detector(name); SensitiveDetector sd = lcdd.sensitiveDetector(name); - xml_attr_t type = element.attr_nothrow(_A(type)); + xml_attr_t type = element.attr_nothrow(_U(type)); if ( type ) { sd.setType(element.attr<string>(type)); } - xml_attr_t verbose = element.attr_nothrow(_A(verbose)); + xml_attr_t verbose = element.attr_nothrow(_U(verbose)); if ( verbose ) { sd.setVerbose(element.attr<bool>(verbose)); } - xml_attr_t combine = element.attr_nothrow(_A(combine_hits)); + xml_attr_t combine = element.attr_nothrow(_U(combine_hits)); if ( combine ) { sd.setCombineHits(element.attr<bool>(combine)); } - xml_attr_t limits = element.attr_nothrow(_A(limits)); + xml_attr_t limits = element.attr_nothrow(_U(limits)); if ( limits ) { string l = element.attr<string>(limits); LimitSet ls = lcdd.limitSet(l); @@ -597,7 +597,7 @@ template <> void Converter<SensitiveDetector>::operator()(xml_h element) const } sd.setLimitSet(ls); } - xml_attr_t region = element.attr_nothrow(_A(region)); + xml_attr_t region = element.attr_nothrow(_U(region)); if ( region ) { string r = element.attr<string>(region); Region reg = lcdd.region(r); @@ -606,12 +606,12 @@ template <> void Converter<SensitiveDetector>::operator()(xml_h element) const } sd.setRegion(reg); } - xml_attr_t hits = element.attr_nothrow(_A(hits_collection)); + xml_attr_t hits = element.attr_nothrow(_U(hits_collection)); if ( hits ) { sd.setHitsCollection(element.attr<string>(hits)); } - xml_attr_t ecut = element.attr_nothrow(_A(ecut)); - xml_attr_t eunit = element.attr_nothrow(_A(eunit)); + xml_attr_t ecut = element.attr_nothrow(_U(ecut)); + xml_attr_t eunit = element.attr_nothrow(_U(eunit)); if ( ecut && eunit ) { double value = _multiply<double>(_toString(ecut),_toString(eunit)); sd.setEnergyCutoff(value); @@ -649,8 +649,8 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { static const char* req_typs = ::getenv("REQUIRED_DETECTOR_TYPES"); static const char* ign_dets = ::getenv("IGNORED_DETECTORS"); static const char* ign_typs = ::getenv("IGNORED_DETECTOR_TYPES"); - string type = element.attr<string>(_A(type)); - string name = element.attr<string>(_A(name)); + string type = element.attr<string>(_U(type)); + string name = element.attr<string>(_U(name)); string name_match = ":"+name+":"; string type_match = ":"+type+":"; if ( req_dets && !strstr(req_dets,name_match.c_str()) ) return; @@ -658,7 +658,7 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { if ( ign_dets && strstr(ign_dets,name_match.c_str()) ) return; if ( ign_typs && strstr(ign_typs,type_match.c_str()) ) return; try { - xml_attr_t attr_ro = element.attr_nothrow(_A(readout)); + xml_attr_t attr_ro = element.attr_nothrow(_U(readout)); SensitiveDetector sd; if ( attr_ro ) { Readout ro = lcdd.readout(element.attr<string>(attr_ro)); @@ -691,36 +691,36 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { /// Read material entries from a seperate file in one of the include sections of the geometry template <> void Converter<GdmlFile>::operator()(xml_h element) const { - xml_h materials = XML::DocumentHandler().load(element,element.attr_value(_A(ref))).root(); - xml_coll_t(materials,_X(element) ).for_each(Converter<Atom>(this->lcdd)); - xml_coll_t(materials,_X(material)).for_each(Converter<Material>(this->lcdd)); + xml_h materials = XML::DocumentHandler().load(element,element.attr_value(_U(ref))).root(); + xml_coll_t(materials,_U(element) ).for_each(Converter<Atom>(this->lcdd)); + xml_coll_t(materials,_U(material)).for_each(Converter<Material>(this->lcdd)); } /// Read alignment entries from a seperate file in one of the include sections of the geometry template <> void Converter<AlignmentFile>::operator()(xml_h element) const { - xml_h alignments = XML::DocumentHandler().load(element,element.attr_value(_A(ref))).root(); - xml_coll_t(alignments,_X(alignment)).for_each(Converter<AlignmentEntry>(this->lcdd)); + xml_h alignments = XML::DocumentHandler().load(element,element.attr_value(_U(ref))).root(); + xml_coll_t(alignments,_U(alignment)).for_each(Converter<AlignmentEntry>(this->lcdd)); } template <> void Converter<Compact>::operator()(xml_h element) const { char text[32]; xml_elt_t compact(element); - xml_coll_t(compact,_X(includes) ).for_each(_X(gdmlFile), Converter<GdmlFile>(lcdd)); - if ( element.hasChild(_X(info)) ) - (Converter<Header>(lcdd))(xml_h(compact.child(_X(info)))); - xml_coll_t(compact,_X(define) ).for_each(_X(constant), Converter<Constant>(lcdd)); - xml_coll_t(compact,_X(materials) ).for_each(_X(element), Converter<Atom>(lcdd)); - xml_coll_t(compact,_X(materials) ).for_each(_X(material), Converter<Material>(lcdd)); - xml_coll_t(compact,_X(properties) ).for_each(_X(attributes),Converter<Property>(lcdd)); + xml_coll_t(compact,_U(includes) ).for_each(_U(gdmlFile), Converter<GdmlFile>(lcdd)); + if ( element.hasChild(_U(info)) ) + (Converter<Header>(lcdd))(xml_h(compact.child(_U(info)))); + xml_coll_t(compact,_U(define) ).for_each(_U(constant), Converter<Constant>(lcdd)); + xml_coll_t(compact,_U(materials) ).for_each(_U(element), Converter<Atom>(lcdd)); + xml_coll_t(compact,_U(materials) ).for_each(_U(material), Converter<Material>(lcdd)); + xml_coll_t(compact,_U(properties) ).for_each(_U(attributes),Converter<Property>(lcdd)); lcdd.init(); - xml_coll_t(compact,_X(limits) ).for_each(_X(limitset), Converter<LimitSet>(lcdd)); - xml_coll_t(compact,_X(display) ).for_each(_X(vis), Converter<VisAttr>(lcdd)); - xml_coll_t(compact,_X(readouts) ).for_each(_X(readout), Converter<Readout>(lcdd)); - xml_coll_t(compact,_X(detectors) ).for_each(_X(detector), Converter<DetElement>(lcdd)); - xml_coll_t(compact,_X(includes) ).for_each(_X(alignment),Converter<AlignmentFile>(lcdd)); - xml_coll_t(compact,_X(alignments) ).for_each(_X(alignment),Converter<AlignmentEntry>(lcdd)); - xml_coll_t(compact,_X(fields) ).for_each(_X(field), Converter<CartesianField>(lcdd)); - xml_coll_t(compact,_X(sensitive_detectors)).for_each(_X(sd),Converter<SensitiveDetector>(lcdd)); + xml_coll_t(compact,_U(limits) ).for_each(_U(limitset), Converter<LimitSet>(lcdd)); + xml_coll_t(compact,_U(display) ).for_each(_U(vis), Converter<VisAttr>(lcdd)); + xml_coll_t(compact,_U(readouts) ).for_each(_U(readout), Converter<Readout>(lcdd)); + xml_coll_t(compact,_U(detectors) ).for_each(_U(detector), Converter<DetElement>(lcdd)); + xml_coll_t(compact,_U(includes) ).for_each(_U(alignment),Converter<AlignmentFile>(lcdd)); + xml_coll_t(compact,_U(alignments) ).for_each(_U(alignment),Converter<AlignmentEntry>(lcdd)); + xml_coll_t(compact,_U(fields) ).for_each(_U(field), Converter<CartesianField>(lcdd)); + xml_coll_t(compact,_U(sensitive_detectors)).for_each(_U(sd),Converter<SensitiveDetector>(lcdd)); ::sprintf(text,"%u",xml_h(element).checksum(0)); lcdd.addConstant(Constant("compact_checksum",text)); lcdd.endDocument(); diff --git a/DDCore/src/plugins/Geant4XML.cpp b/DDCore/src/plugins/Geant4XML.cpp index ac3399e0c22040ca2501530995bc52336810f7ff..b50c1c1f6e04c8fb56226648c16b1b8c7b7e0b50 100644 --- a/DDCore/src/plugins/Geant4XML.cpp +++ b/DDCore/src/plugins/Geant4XML.cpp @@ -29,9 +29,9 @@ namespace DD4hep { template <> void Converter<Geant4>::operator()(xml_h element) const { xml_elt_t compact(element); - //xml_coll_t(compact,_X(includes) ).for_each(_X(gdmlFile), Converter<Geometry::GdmlFile>(lcdd,param)); - xml_coll_t(compact,_X(properties) ).for_each(_X(attributes),Converter<Geometry::Property>(lcdd,param)); - xml_coll_t(compact,_X(sensitive_detectors)).for_each(_X(sd),Converter<Geometry::SensitiveDetector>(lcdd,param)); + //xml_coll_t(compact,_U(includes) ).for_each(_U(gdmlFile), Converter<Geometry::GdmlFile>(lcdd,param)); + xml_coll_t(compact,_U(properties) ).for_each(_U(attributes),Converter<Geometry::Property>(lcdd,param)); + xml_coll_t(compact,_U(sensitive_detectors)).for_each(_U(sd),Converter<Geometry::SensitiveDetector>(lcdd,param)); } static long create_Geant4(lcdd_t& lcdd, const xml_h& element) { diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp index 81fd0549b32c565a4f32333e68e4add3306b5995..9ded4a55b2ebcff805fcdbe0b4f97a6ce9bcd4b1 100644 --- a/DDCore/src/plugins/LCDDConverter.cpp +++ b/DDCore/src/plugins/LCDDConverter.cpp @@ -82,15 +82,15 @@ xml_h LCDDConverter::handleElement(const string& name, const TGeoElement* elemen GeometryInfo& geo = data(); xml_h e = geo.xmlElements[element]; if ( !e ) { - xml_elt_t atom(geo.doc,_X(atom)); - geo.doc_materials.append(e=xml_elt_t(geo.doc,_X(element))); + xml_elt_t atom(geo.doc,_U(atom)); + geo.doc_materials.append(e=xml_elt_t(geo.doc,_U(element))); e.append(atom); - e.setAttr(_A(name),element->GetName()); - e.setAttr(_A(formula),element->GetName()); - e.setAttr(_A(Z),element->Z()); - atom.setAttr(_A(type),"A"); - atom.setAttr(_A(unit),"g/mol"); - atom.setAttr(_A(value),element->A() /* *(g/mole) */); + e.setAttr(_U(name),element->GetName()); + e.setAttr(_U(formula),element->GetName()); + e.setAttr(_U(Z),element->Z()); + atom.setAttr(_U(type),"A"); + atom.setAttr(_U(unit),"g/mol"); + atom.setAttr(_U(value),element->A() /* *(g/mole) */); geo.xmlElements[element] = e; } return e; @@ -104,12 +104,12 @@ xml_h LCDDConverter::handleMaterial(const string& name, const TGeoMedium* medium xml_h obj; TGeoMaterial* m = medium->GetMaterial(); double d = m->GetDensity(); //*(gram/cm3); - mat = xml_elt_t(geo.doc,_X(material)); - mat.setAttr(_A(name),medium->GetName()); - mat.append(obj=xml_elt_t(geo.doc,_X(D))); - obj.setAttr(_A(value),m->GetDensity() /* *(g/cm3) */); - obj.setAttr(_A(unit),"g/cm3"); - obj.setAttr(_A(type),"density"); + mat = xml_elt_t(geo.doc,_U(material)); + mat.setAttr(_U(name),medium->GetName()); + mat.append(obj=xml_elt_t(geo.doc,_U(D))); + obj.setAttr(_U(value),m->GetDensity() /* *(g/cm3) */); + obj.setAttr(_U(unit),"g/cm3"); + obj.setAttr(_U(type),"density"); geo.checkMaterial(name,medium); @@ -125,20 +125,20 @@ xml_h LCDDConverter::handleMaterial(const string& name, const TGeoMedium* medium for (int i=0, n=mix->GetNelements(); i < n; i++) { TGeoElement *elt = mix->GetElement(i); string formula = elt->GetTitle()+string("_elm"); - mat.append(obj=xml_elt_t(geo.doc,_X(fraction))); - obj.setAttr(_A(n),wmix[i]/sum); - obj.setAttr(_A(ref),elt->GetName()); + mat.append(obj=xml_elt_t(geo.doc,_U(fraction))); + obj.setAttr(_U(n),wmix[i]/sum); + obj.setAttr(_U(ref),elt->GetName()); } } else { TGeoElement *elt = m->GetElement(0); - xml_elt_t atom(geo.doc,_X(atom)); + xml_elt_t atom(geo.doc,_U(atom)); handleElement(elt->GetName(),elt); mat.append(atom); - mat.setAttr(_A(Z),m->GetZ()); - atom.setAttr(_A(type),"A"); - atom.setAttr(_A(unit),"g/mol"); - atom.setAttr(_A(value),m->GetA() /* *(g/mole) */); + mat.setAttr(_U(Z),m->GetZ()); + atom.setAttr(_U(type),"A"); + atom.setAttr(_U(unit),"g/mol"); + atom.setAttr(_U(value),m->GetA() /* *(g/mole) */); } geo.doc_materials.append(mat); geo.xmlMaterials[medium] = mat; @@ -155,203 +155,203 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) c geo.checkShape(name,shape); if ( shape->IsA() == TGeoBBox::Class() ) { const TGeoBBox* s = (const TGeoBBox*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(box))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(x),s->GetDX()*CM_2_MM); - solid.setAttr(_A(y),s->GetDY()*CM_2_MM); - solid.setAttr(_A(z),s->GetDZ()*CM_2_MM); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(box))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(x),s->GetDX()*CM_2_MM); + solid.setAttr(_U(y),s->GetDY()*CM_2_MM); + solid.setAttr(_U(z),s->GetDZ()*CM_2_MM); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoTube::Class() ) { const TGeoTube* s = (const TGeoTube*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(tube))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(rmin),s->GetRmin()*CM_2_MM); - solid.setAttr(_A(rmax),s->GetRmax()*CM_2_MM); - solid.setAttr(_A(z),s->GetDz()*CM_2_MM); - solid.setAttr(_A(startphi),0e0); - solid.setAttr(_A(deltaphi),2*M_PI); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(tube))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(rmin),s->GetRmin()*CM_2_MM); + solid.setAttr(_U(rmax),s->GetRmax()*CM_2_MM); + solid.setAttr(_U(z),s->GetDz()*CM_2_MM); + solid.setAttr(_U(startphi),0e0); + solid.setAttr(_U(deltaphi),2*M_PI); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoEltu::Class() ) { const TGeoEltu* s = (const TGeoEltu*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(eltube))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(dx),s->GetA()*CM_2_MM); - solid.setAttr(_A(dy),s->GetB()*CM_2_MM); - solid.setAttr(_A(dz),s->GetDz()*CM_2_MM); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(eltube))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(dx),s->GetA()*CM_2_MM); + solid.setAttr(_U(dy),s->GetB()*CM_2_MM); + solid.setAttr(_U(dz),s->GetDz()*CM_2_MM); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoTubeSeg::Class() ) { const TGeoTubeSeg* s = (const TGeoTubeSeg*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(tube))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(rmin),s->GetRmin()*CM_2_MM); - solid.setAttr(_A(rmax),s->GetRmax()*CM_2_MM); - solid.setAttr(_A(z),s->GetDz()*CM_2_MM); - solid.setAttr(_A(startphi),s->GetPhi1()*DEGREE_2_RAD); - solid.setAttr(_A(deltaphi),s->GetPhi2()*DEGREE_2_RAD); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(tube))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(rmin),s->GetRmin()*CM_2_MM); + solid.setAttr(_U(rmax),s->GetRmax()*CM_2_MM); + solid.setAttr(_U(z),s->GetDz()*CM_2_MM); + solid.setAttr(_U(startphi),s->GetPhi1()*DEGREE_2_RAD); + solid.setAttr(_U(deltaphi),s->GetPhi2()*DEGREE_2_RAD); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoTrd1::Class() ) { const TGeoTrd1* s = (const TGeoTrd1*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(trd))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(x1),s->GetDx1()*CM_2_MM); - solid.setAttr(_A(x2),s->GetDx2()*CM_2_MM); - solid.setAttr(_A(y1),s->GetDy()*CM_2_MM); - solid.setAttr(_A(y2),s->GetDy()*CM_2_MM); - solid.setAttr(_A(z), s->GetDz()*CM_2_MM); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(trd))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(x1),s->GetDx1()*CM_2_MM); + solid.setAttr(_U(x2),s->GetDx2()*CM_2_MM); + solid.setAttr(_U(y1),s->GetDy()*CM_2_MM); + solid.setAttr(_U(y2),s->GetDy()*CM_2_MM); + solid.setAttr(_U(z), s->GetDz()*CM_2_MM); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoTrd2::Class() ) { const TGeoTrd2* s = (const TGeoTrd2*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(trd))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(x1),s->GetDx1()*CM_2_MM); - solid.setAttr(_A(x2),s->GetDx2()*CM_2_MM); - solid.setAttr(_A(y1),s->GetDy1()*CM_2_MM); - solid.setAttr(_A(y2),s->GetDy2()*CM_2_MM); - solid.setAttr(_A(z), s->GetDz()*CM_2_MM); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(trd))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(x1),s->GetDx1()*CM_2_MM); + solid.setAttr(_U(x2),s->GetDx2()*CM_2_MM); + solid.setAttr(_U(y1),s->GetDy1()*CM_2_MM); + solid.setAttr(_U(y2),s->GetDy2()*CM_2_MM); + solid.setAttr(_U(z), s->GetDz()*CM_2_MM); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoTrap::Class() ) { const TGeoTrap* s = (const TGeoTrap*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(trap))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(x1),s->GetBl1()*CM_2_MM); - solid.setAttr(_A(x2),s->GetTl1()*CM_2_MM); - solid.setAttr(_A(x3),s->GetBl2()*CM_2_MM); - solid.setAttr(_A(x4),s->GetTl2()*CM_2_MM); - solid.setAttr(_A(y1),s->GetH1()*CM_2_MM); - solid.setAttr(_A(y2),s->GetH2()*CM_2_MM); - solid.setAttr(_A(z),s->GetDz()*CM_2_MM); - solid.setAttr(_A(alpha1),s->GetAlpha1()*DEGREE_2_RAD); - solid.setAttr(_A(alpha2),s->GetAlpha2()*DEGREE_2_RAD); - solid.setAttr(_A(theta),s->GetTheta()*DEGREE_2_RAD); - solid.setAttr(_A(phi),s->GetPhi()*DEGREE_2_RAD); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(trap))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(x1),s->GetBl1()*CM_2_MM); + solid.setAttr(_U(x2),s->GetTl1()*CM_2_MM); + solid.setAttr(_U(x3),s->GetBl2()*CM_2_MM); + solid.setAttr(_U(x4),s->GetTl2()*CM_2_MM); + solid.setAttr(_U(y1),s->GetH1()*CM_2_MM); + solid.setAttr(_U(y2),s->GetH2()*CM_2_MM); + solid.setAttr(_U(z),s->GetDz()*CM_2_MM); + solid.setAttr(_U(alpha1),s->GetAlpha1()*DEGREE_2_RAD); + solid.setAttr(_U(alpha2),s->GetAlpha2()*DEGREE_2_RAD); + solid.setAttr(_U(theta),s->GetTheta()*DEGREE_2_RAD); + solid.setAttr(_U(phi),s->GetPhi()*DEGREE_2_RAD); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoPara::Class() ) { const TGeoPara* s = (const TGeoPara*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(para))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(x),s->GetX()*CM_2_MM); - solid.setAttr(_A(y),s->GetY()*CM_2_MM); - solid.setAttr(_A(z),s->GetZ()*CM_2_MM); - solid.setAttr(_A(alpha),s->GetAlpha()*DEGREE_2_RAD); - solid.setAttr(_A(theta),s->GetTheta()*DEGREE_2_RAD); - solid.setAttr(_A(phi),s->GetPhi()*DEGREE_2_RAD); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(para))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(x),s->GetX()*CM_2_MM); + solid.setAttr(_U(y),s->GetY()*CM_2_MM); + solid.setAttr(_U(z),s->GetZ()*CM_2_MM); + solid.setAttr(_U(alpha),s->GetAlpha()*DEGREE_2_RAD); + solid.setAttr(_U(theta),s->GetTheta()*DEGREE_2_RAD); + solid.setAttr(_U(phi),s->GetPhi()*DEGREE_2_RAD); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoPgon::Class() ) { const TGeoPgon* s = (const TGeoPgon*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(polyhedra))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(startphi),s->GetPhi1()*DEGREE_2_RAD); - solid.setAttr(_A(deltaphi),s->GetDphi()*DEGREE_2_RAD); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(polyhedra))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(startphi),s->GetPhi1()*DEGREE_2_RAD); + solid.setAttr(_U(deltaphi),s->GetDphi()*DEGREE_2_RAD); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); for( size_t i=0; i<s->GetNz(); ++i ) { - zplane = xml_elt_t(geo.doc,_X(zplane)); - zplane.setAttr(_A(rmin),s->GetRmin(i)*CM_2_MM); - zplane.setAttr(_A(rmax),s->GetRmax(i)*CM_2_MM); - zplane.setAttr(_A(z),s->GetZ(i)*CM_2_MM); + zplane = xml_elt_t(geo.doc,_U(zplane)); + zplane.setAttr(_U(rmin),s->GetRmin(i)*CM_2_MM); + zplane.setAttr(_U(rmax),s->GetRmax(i)*CM_2_MM); + zplane.setAttr(_U(z),s->GetZ(i)*CM_2_MM); solid.append(zplane); } } else if ( shape->IsA() == TGeoPcon::Class() ) { const TGeoPcon* s = (const TGeoPcon*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(polycone))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(startphi),s->GetPhi1()*DEGREE_2_RAD); - solid.setAttr(_A(deltaphi),s->GetDphi()*DEGREE_2_RAD); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(polycone))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(startphi),s->GetPhi1()*DEGREE_2_RAD); + solid.setAttr(_U(deltaphi),s->GetDphi()*DEGREE_2_RAD); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); for( size_t i=0; i<s->GetNz(); ++i ) { - zplane = xml_elt_t(geo.doc,_X(zplane)); - zplane.setAttr(_A(rmin),s->GetRmin(i)*CM_2_MM); - zplane.setAttr(_A(rmax),s->GetRmax(i)*CM_2_MM); - zplane.setAttr(_A(z),s->GetZ(i)*CM_2_MM); + zplane = xml_elt_t(geo.doc,_U(zplane)); + zplane.setAttr(_U(rmin),s->GetRmin(i)*CM_2_MM); + zplane.setAttr(_U(rmax),s->GetRmax(i)*CM_2_MM); + zplane.setAttr(_U(z),s->GetZ(i)*CM_2_MM); solid.append(zplane); } } else if ( shape->IsA() == TGeoCone::Class() ) { const TGeoCone* s = (const TGeoCone*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(cone))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(z),s->GetDz()*CM_2_MM); - solid.setAttr(_A(rmin1),s->GetRmin1()*CM_2_MM); - solid.setAttr(_A(rmax1),s->GetRmax1()*CM_2_MM); - solid.setAttr(_A(rmin2),s->GetRmin2()*CM_2_MM); - solid.setAttr(_A(rmax2),s->GetRmax2()*CM_2_MM); - solid.setAttr(_A(z),s->GetDz()*CM_2_MM); - solid.setAttr(_A(startphi),0e0); - solid.setAttr(_A(deltaphi),2*M_PI); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(cone))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(z),s->GetDz()*CM_2_MM); + solid.setAttr(_U(rmin1),s->GetRmin1()*CM_2_MM); + solid.setAttr(_U(rmax1),s->GetRmax1()*CM_2_MM); + solid.setAttr(_U(rmin2),s->GetRmin2()*CM_2_MM); + solid.setAttr(_U(rmax2),s->GetRmax2()*CM_2_MM); + solid.setAttr(_U(z),s->GetDz()*CM_2_MM); + solid.setAttr(_U(startphi),0e0); + solid.setAttr(_U(deltaphi),2*M_PI); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoConeSeg::Class() ) { const TGeoConeSeg* s = (const TGeoConeSeg*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(cone))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(startphi),s->GetPhi1()*DEGREE_2_RAD); - solid.setAttr(_A(deltaphi),(s->GetPhi2()-s->GetPhi1())*DEGREE_2_RAD); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); - zplane = xml_elt_t(geo.doc,_X(zplane)); - zplane.setAttr(_A(rmin),s->GetRmin1()*CM_2_MM); - zplane.setAttr(_A(rmax),s->GetRmax1()*CM_2_MM); - zplane.setAttr(_A(z),s->GetDz()*CM_2_MM); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(cone))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(startphi),s->GetPhi1()*DEGREE_2_RAD); + solid.setAttr(_U(deltaphi),(s->GetPhi2()-s->GetPhi1())*DEGREE_2_RAD); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); + zplane = xml_elt_t(geo.doc,_U(zplane)); + zplane.setAttr(_U(rmin),s->GetRmin1()*CM_2_MM); + zplane.setAttr(_U(rmax),s->GetRmax1()*CM_2_MM); + zplane.setAttr(_U(z),s->GetDz()*CM_2_MM); solid.append(zplane); - zplane = xml_elt_t(geo.doc,_X(zplane)); - zplane.setAttr(_A(rmin),s->GetRmin2()*CM_2_MM); - zplane.setAttr(_A(rmax),s->GetRmax2()*CM_2_MM); - zplane.setAttr(_A(z),s->GetDz()*CM_2_MM); + zplane = xml_elt_t(geo.doc,_U(zplane)); + zplane.setAttr(_U(rmin),s->GetRmin2()*CM_2_MM); + zplane.setAttr(_U(rmax),s->GetRmax2()*CM_2_MM); + zplane.setAttr(_U(z),s->GetDz()*CM_2_MM); solid.append(zplane); } else if ( shape->IsA() == TGeoParaboloid::Class() ) { const TGeoParaboloid* s = (const TGeoParaboloid*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(paraboloid))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(rlo),s->GetRlo()*CM_2_MM); - solid.setAttr(_A(rhi),s->GetRhi()*CM_2_MM); - solid.setAttr(_A(dz),s->GetDz()*CM_2_MM); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(paraboloid))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(rlo),s->GetRlo()*CM_2_MM); + solid.setAttr(_U(rhi),s->GetRhi()*CM_2_MM); + solid.setAttr(_U(dz),s->GetDz()*CM_2_MM); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoSphere::Class() ) { const TGeoSphere* s = (const TGeoSphere*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(sphere))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(rmin),s->GetRmin()*CM_2_MM); - solid.setAttr(_A(rmax),s->GetRmax()*CM_2_MM); - solid.setAttr(_A(startphi),s->GetPhi1()*DEGREE_2_RAD); - solid.setAttr(_A(deltaphi),(s->GetPhi2()-s->GetPhi1())*DEGREE_2_RAD); - solid.setAttr(_A(starttheta),s->GetTheta1()*DEGREE_2_RAD); - solid.setAttr(_A(deltatheta),(s->GetTheta2()-s->GetTheta1())*DEGREE_2_RAD); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(sphere))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(rmin),s->GetRmin()*CM_2_MM); + solid.setAttr(_U(rmax),s->GetRmax()*CM_2_MM); + solid.setAttr(_U(startphi),s->GetPhi1()*DEGREE_2_RAD); + solid.setAttr(_U(deltaphi),(s->GetPhi2()-s->GetPhi1())*DEGREE_2_RAD); + solid.setAttr(_U(starttheta),s->GetTheta1()*DEGREE_2_RAD); + solid.setAttr(_U(deltatheta),(s->GetTheta2()-s->GetTheta1())*DEGREE_2_RAD); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoTorus::Class() ) { const TGeoTorus* s = (const TGeoTorus*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(torus))); - solid.setAttr(_A(name),Unicode(name)); - solid.setAttr(_A(rtor),s->GetR()); - solid.setAttr(_A(rmin),s->GetRmin()); - solid.setAttr(_A(rmax),s->GetRmax()); - solid.setAttr(_A(startphi),s->GetPhi1()*DEGREE_2_RAD); - solid.setAttr(_A(deltaphi),s->GetDphi()*DEGREE_2_RAD); - solid.setAttr(_A(aunit),"rad"); - solid.setAttr(_A(lunit),"mm"); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(torus))); + solid.setAttr(_U(name),Unicode(name)); + solid.setAttr(_U(rtor),s->GetR()); + solid.setAttr(_U(rmin),s->GetRmin()); + solid.setAttr(_U(rmax),s->GetRmax()); + solid.setAttr(_U(startphi),s->GetPhi1()*DEGREE_2_RAD); + solid.setAttr(_U(deltaphi),s->GetDphi()*DEGREE_2_RAD); + solid.setAttr(_U(aunit),"rad"); + solid.setAttr(_U(lunit),"mm"); } else if ( shape->IsA() == TGeoShapeAssembly::Class() ) { TGeoShapeAssembly* s = (TGeoShapeAssembly*)shape; - geo.doc_solids.append(solid = xml_elt_t(geo.doc,_X(assembly))); - solid.setAttr(_A(name),Unicode(name)); + geo.doc_solids.append(solid = xml_elt_t(geo.doc,_U(assembly))); + solid.setAttr(_U(name),Unicode(name)); } else if ( shape->IsA() == TGeoCompositeShape::Class() ) { const TGeoCompositeShape* s = (const TGeoCompositeShape*)shape; @@ -369,47 +369,47 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) c } if ( oper == TGeoBoolNode::kGeoSubtraction ) - solid = xml_elt_t(geo.doc,_X(subtraction)); + solid = xml_elt_t(geo.doc,_U(subtraction)); else if ( oper == TGeoBoolNode::kGeoUnion ) - solid = xml_elt_t(geo.doc,_X(union)); + solid = xml_elt_t(geo.doc,_U(union)); else if ( oper == TGeoBoolNode::kGeoIntersection ) - solid = xml_elt_t(geo.doc,_X(intersection)); + solid = xml_elt_t(geo.doc,_U(intersection)); xml_h obj; - solid.append(first=xml_elt_t(geo.doc,_X(first))); - solid.setAttr(_A(name),Unicode(name)); - first.setAttr(_A(ref),name+"_left"); + solid.append(first=xml_elt_t(geo.doc,_U(first))); + solid.setAttr(_U(name),Unicode(name)); + first.setAttr(_U(ref),name+"_left"); XYZRotation rot = getXYZangles(boolean->GetLeftMatrix()->Inverse().GetRotationMatrix()); const double *tr = boolean->GetLeftMatrix()->GetTranslation(); if ((tr[0] != 0.0) || (tr[1] != 0.0) || (tr[2] != 0.0)) { - first.append(obj=xml_elt_t(geo.doc,_X(firstposition))); - obj.setAttr(_A(x),tr[0]*CM_2_MM); - obj.setAttr(_A(y),tr[1]*CM_2_MM); - obj.setAttr(_A(z),tr[2]*CM_2_MM); + first.append(obj=xml_elt_t(geo.doc,_U(firstposition))); + obj.setAttr(_U(x),tr[0]*CM_2_MM); + obj.setAttr(_U(y),tr[1]*CM_2_MM); + obj.setAttr(_U(z),tr[2]*CM_2_MM); } if ((rot.X() != 0.0) || (rot.Y() != 0.0) || (rot.Z() != 0.0)) { - first.append(obj=xml_elt_t(geo.doc,_X(firstrotation))); - obj.setAttr(_A(x),rot.X()); - obj.setAttr(_A(y),rot.Y()); - obj.setAttr(_A(z),rot.Z()); + first.append(obj=xml_elt_t(geo.doc,_U(firstrotation))); + obj.setAttr(_U(x),rot.X()); + obj.setAttr(_U(y),rot.Y()); + obj.setAttr(_U(z),rot.Z()); } rot = getXYZangles(boolean->GetRightMatrix()->Inverse().GetRotationMatrix()); tr = boolean->GetRightMatrix()->GetTranslation(); - solid.append(second=xml_elt_t(geo.doc,_X(second))); - second.setAttr(_A(ref),name+"_right"); + solid.append(second=xml_elt_t(geo.doc,_U(second))); + second.setAttr(_U(ref),name+"_right"); if ((tr[0] != 0.0) || (tr[1] != 0.0) || (tr[2] != 0.0)) { - first.append(obj=xml_elt_t(geo.doc,_X(position))); - obj.setAttr(_A(x),tr[0]*CM_2_MM); - obj.setAttr(_A(y),tr[1]*CM_2_MM); - obj.setAttr(_A(z),tr[2]*CM_2_MM); + first.append(obj=xml_elt_t(geo.doc,_U(position))); + obj.setAttr(_U(x),tr[0]*CM_2_MM); + obj.setAttr(_U(y),tr[1]*CM_2_MM); + obj.setAttr(_U(z),tr[2]*CM_2_MM); } if ((rot.X() != 0.0) || (rot.Y() != 0.0) || (rot.Z() != 0.0)) { - first.append(obj=xml_elt_t(geo.doc,_X(rotation))); - obj.setAttr(_A(x),rot.X()); - obj.setAttr(_A(y),rot.Y()); - obj.setAttr(_A(z),rot.Z()); + first.append(obj=xml_elt_t(geo.doc,_U(rotation))); + obj.setAttr(_U(x),rot.X()); + obj.setAttr(_U(y),rot.Y()); + obj.setAttr(_U(z),rot.Z()); } } if ( !solid ) { @@ -431,21 +431,21 @@ xml_h LCDDConverter::handlePosition(const std::string& name, const TGeoMatrix* t const double* tr = trafo->GetTranslation(); if ( tr[0] != 0 || tr[1] != 0 || tr[2] != 0 ) { geo.checkPosition(name,trafo); - geo.doc_define.append(pos=xml_elt_t(geo.doc,_X(position))); - pos.setAttr(_A(name),name); - pos.setAttr(_A(x),tr[0]); - pos.setAttr(_A(y),tr[1]); - pos.setAttr(_A(z),tr[2]); + geo.doc_define.append(pos=xml_elt_t(geo.doc,_U(position))); + pos.setAttr(_U(name),name); + pos.setAttr(_U(x),tr[0]); + pos.setAttr(_U(y),tr[1]); + pos.setAttr(_U(z),tr[2]); } else if ( identity ) { pos = identity; } else { - geo.doc_define.append(identity=xml_elt_t(geo.doc,_X(position))); - identity.setAttr(_A(name),"identity_pos"); - identity.setAttr(_A(x),0); - identity.setAttr(_A(y),0); - identity.setAttr(_A(z),0); + geo.doc_define.append(identity=xml_elt_t(geo.doc,_U(position))); + identity.setAttr(_U(name),"identity_pos"); + identity.setAttr(_U(x),0); + identity.setAttr(_U(y),0); + identity.setAttr(_U(z),0); pos = identity; geo.checkPosition("identity_pos",0); } @@ -463,21 +463,21 @@ xml_h LCDDConverter::handleRotation(const std::string& name, const TGeoMatrix* t XYZRotation r = getXYZangles(trafo->Inverse().GetRotationMatrix()); if ( r.X() != 0 || r.Y() != 0 || r.Z() != 0 ) { geo.checkRotation(name,trafo); - geo.doc_define.append(rot=xml_elt_t(geo.doc,_X(rotation))); - rot.setAttr(_A(name),name); - rot.setAttr(_A(x),r.X()); - rot.setAttr(_A(y),r.Y()); - rot.setAttr(_A(z),r.Z()); + geo.doc_define.append(rot=xml_elt_t(geo.doc,_U(rotation))); + rot.setAttr(_U(name),name); + rot.setAttr(_U(x),r.X()); + rot.setAttr(_U(y),r.Y()); + rot.setAttr(_U(z),r.Z()); } else if ( identity ) { rot = identity; } else { - geo.doc_define.append(identity=xml_elt_t(geo.doc,_X(rotation))); - identity.setAttr(_A(name),"identity_rot"); - identity.setAttr(_A(x),0); - identity.setAttr(_A(y),0); - identity.setAttr(_A(z),0); + geo.doc_define.append(identity=xml_elt_t(geo.doc,_U(rotation))); + identity.setAttr(_U(name),"identity_rot"); + identity.setAttr(_U(x),0); + identity.setAttr(_U(y),0); + identity.setAttr(_U(z),0); rot = identity; geo.checkRotation("identity_rot",0); } @@ -504,12 +504,12 @@ xml_h LCDDConverter::handleVolume(const string& name, const TGeoVolume* volume) throw runtime_error("G4Converter: No Geant4 material present for volume:"+n); geo.checkVolume(name,volume); - geo.doc_structure.append(vol=xml_elt_t(geo.doc,_X(volume))); - vol.setAttr(_A(name),n); - vol.setRef(_X(solidref),sol.name()); + geo.doc_structure.append(vol=xml_elt_t(geo.doc,_U(volume))); + vol.setAttr(_U(name),n); + vol.setRef(_U(solidref),sol.name()); if ( m ) { xml_ref_t med = handleMaterial(m->GetName(),m); - vol.setRef(_X(materialref),med.name()); + vol.setRef(_U(materialref),med.name()); } if ( geo.doc_header && dynamic_cast<const Volume::Object*>(volume) ) { Region reg = _v.region(); @@ -518,19 +518,19 @@ xml_h LCDDConverter::handleVolume(const string& name, const TGeoVolume* volume) SensitiveDetector det = _v.sensitiveDetector(); if ( vis.isValid() ) { xml_ref_t data = handleVis(vis.name(),vis.ptr()); - vol.setRef(_X(visref),data.name()); + vol.setRef(_U(visref),data.name()); } if ( lim.isValid() ) { xml_ref_t data = handleLimitSet(lim.name(),lim.ptr()); - vol.setRef(_X(limitsetref),data.name()); + vol.setRef(_U(limitsetref),data.name()); } if ( reg.isValid() ) { xml_ref_t data = handleRegion(reg.name(),reg.ptr()); - vol.setRef(_X(regionref),data.name()); + vol.setRef(_U(regionref),data.name()); } if ( det.isValid() ) { xml_ref_t data = handleSensitive(det.name(),det.ptr()); - vol.setRef(_X(sdref),data.name()); + vol.setRef(_U(sdref),data.name()); } } geo.xmlVolumes[v] = vol; @@ -586,27 +586,27 @@ xml_h LCDDConverter::handlePlacement(const string& name, const TGeoNode* node) c xml_ref_t vol = xml_h(geo.xmlVolumes[v]); xml_h mot = geo.xmlVolumes[node->GetMotherVolume()]; - place = xml_elt_t(geo.doc,_X(physvol)); + place = xml_elt_t(geo.doc,_U(physvol)); if ( mot ) { // Beware of top level volume! mot.append(place); } - place.setRef(_X(volumeref),vol.name()); + place.setRef(_U(volumeref),vol.name()); if ( t ) { char text[32]; ::sprintf(text,"_%p_pos",node); xml_ref_t pos = handlePosition(name+text,t); ::sprintf(text,"_%p_rot",node); xml_ref_t rot = handleRotation(name+text,t); - place.setRef(_X(positionref),pos.name()); - place.setRef(_X(rotationref),rot.name()); + place.setRef(_U(positionref),pos.name()); + place.setRef(_U(rotationref),rot.name()); } if ( dynamic_cast<const PlacedVolume::Object*>(node) ) { PlacedVolume p = Ref_t(node); const PlacedVolume::VolIDs& ids = p.volIDs(); for(PlacedVolume::VolIDs::const_iterator i=ids.begin(); i!=ids.end(); ++i) { xml_h pvid = xml_elt_t(geo.doc,"physvolid"); - pvid.setAttr(_A(field_name),(*i).first); - pvid.setAttr(_A(value),(*i).second); + pvid.setAttr(_U(field_name),(*i).first); + pvid.setAttr(_U(value),(*i).second); place.append(pvid); } } @@ -624,12 +624,12 @@ xml_h LCDDConverter::handleRegion(const std::string& name, const TNamed* region) xml_h reg = geo.xmlRegions[region]; if ( !reg ) { Region r = Ref_t(region); - geo.doc_regions.append(reg=xml_elt_t(geo.doc,_X(region))); - reg.setAttr(_A(name), r.name()); - reg.setAttr(_A(cut), r.cut()); - reg.setAttr(_A(eunit), r.energyUnit()); - reg.setAttr(_A(lunit), r.lengthUnit()); - reg.setAttr(_A(store_secondaries),r.storeSecondaries()); + geo.doc_regions.append(reg=xml_elt_t(geo.doc,_U(region))); + reg.setAttr(_U(name), r.name()); + reg.setAttr(_U(cut), r.cut()); + reg.setAttr(_U(eunit), r.energyUnit()); + reg.setAttr(_U(lunit), r.lengthUnit()); + reg.setAttr(_U(store_secondaries),r.storeSecondaries()); geo.xmlRegions[region] = reg; } return reg; @@ -641,17 +641,17 @@ xml_h LCDDConverter::handleLimitSet(const std::string& name, const TNamed* limit xml_h xml = geo.xmlLimits[limitset]; if ( !xml ) { LimitSet lim = Ref_t(limitset); - geo.doc_limits.append(xml=xml_elt_t(geo.doc,_X(limitset))); - xml.setAttr(_A(name),lim.name()); + geo.doc_limits.append(xml=xml_elt_t(geo.doc,_U(limitset))); + xml.setAttr(_U(name),lim.name()); const LimitSet::Object& obj = lim.limits(); for(LimitSet::Object::const_iterator i=obj.begin(); i!=obj.end(); ++i) { - xml_h x = xml_elt_t(geo.doc,_X(limit)); + xml_h x = xml_elt_t(geo.doc,_U(limit)); const Limit& l = *i; xml.append(x); - x.setAttr(_A(name),l.name); - x.setAttr(_A(unit),l.unit); - x.setAttr(_A(value),l.value); - x.setAttr(_A(particles),l.particles); + x.setAttr(_U(name),l.name); + x.setAttr(_U(unit),l.unit); + x.setAttr(_U(value),l.value); + x.setAttr(_U(particles),l.particles); } geo.xmlLimits[limitset] = xml; } @@ -666,16 +666,16 @@ xml_h LCDDConverter::handleSensitive(const string& name, const TNamed* sens_det) SensitiveDetector sd = Ref_t(sens_det); string type = sd.type(), name = sd.name(); geo.doc_detectors.append(sensdet = xml_elt_t(geo.doc,Unicode(type))); - sensdet.setAttr(_A(name),sd.name()); - sensdet.setAttr(_A(ecut),sd.energyCutoff()); - sensdet.setAttr(_A(eunit),"MeV"); - sensdet.setAttr(_A(verbose),sd.verbose()); - sensdet.setAttr(_A(hits_collection),sd.hitsCollection()); - if ( sd.combineHits() ) sensdet.setAttr(_A(combine_hits),sd.combineHits()); + sensdet.setAttr(_U(name),sd.name()); + sensdet.setAttr(_U(ecut),sd.energyCutoff()); + sensdet.setAttr(_U(eunit),"MeV"); + sensdet.setAttr(_U(verbose),sd.verbose()); + sensdet.setAttr(_U(hits_collection),sd.hitsCollection()); + if ( sd.combineHits() ) sensdet.setAttr(_U(combine_hits),sd.combineHits()); Readout ro = sd.readout(); if ( ro.isValid() ) { xml_ref_t ref = handleIdSpec(ro.idSpec().name(),ro.idSpec().ptr()); - sensdet.setRef(_A(idspecref),ref.name()); + sensdet.setRef(_U(idspecref),ref.name()); } geo.xmlSensDets[sens_det] = sensdet; } @@ -688,16 +688,16 @@ xml_h LCDDConverter::handleIdSpec(const std::string& name, const TNamed* id_spec xml_h id = geo.xmlIdSpecs[id_spec]; if ( !id ) { IDDescriptor desc = Ref_t(id_spec); - geo.doc_idDict.append(id=xml_elt_t(geo.doc,_X(idspec))); - id.setAttr(_A(name),name); + geo.doc_idDict.append(id=xml_elt_t(geo.doc,_U(idspec))); + id.setAttr(_U(name),name); const IDDescriptor::FieldMap& m = desc.fields(); for(IDDescriptor::FieldMap::const_iterator i=m.begin(); i!=m.end(); ++i) { xml_h idfield = xml_elt_t(geo.doc,"idfield"); const IDDescriptor::Field& f = (*i).second; - idfield.setAttr(_A(signed),f.second<0 ? true : false); - idfield.setAttr(_A(label),(*i).first); - idfield.setAttr(_A(length),f.second<0 ? -f.second : f.second); - idfield.setAttr(_A(start),f.first); + idfield.setAttr(_U(signed),f.second<0 ? true : false); + idfield.setAttr(_U(label),(*i).first); + idfield.setAttr(_U(length),f.second<0 ? -f.second : f.second); + idfield.setAttr(_U(start),f.first); id.append(idfield); } geo.xmlIdSpecs[id_spec] = id; @@ -715,24 +715,24 @@ xml_h LCDDConverter::handleVis(const string& name, const TNamed* v) const { int style = attr.lineStyle(); int draw = attr.drawingStyle(); - geo.doc_display.append(vis=xml_elt_t(geo.doc,_X(vis))); - vis.setAttr(_A(name),attr.name()); - vis.setAttr(_A(visible),attr.visible()); - vis.setAttr(_A(show_daughters),attr.showDaughters()); + geo.doc_display.append(vis=xml_elt_t(geo.doc,_U(vis))); + vis.setAttr(_U(name),attr.name()); + vis.setAttr(_U(visible),attr.visible()); + vis.setAttr(_U(show_daughters),attr.showDaughters()); if ( style == VisAttr::SOLID ) - vis.setAttr(_A(line_style),"unbroken"); + vis.setAttr(_U(line_style),"unbroken"); else if ( style == VisAttr::DASHED ) - vis.setAttr(_A(line_style),"broken"); + vis.setAttr(_U(line_style),"broken"); if ( draw == VisAttr::SOLID ) - vis.setAttr(_A(line_style),"solid"); + vis.setAttr(_U(line_style),"solid"); else if ( draw == VisAttr::WIREFRAME ) - vis.setAttr(_A(line_style),"wireframe"); + vis.setAttr(_U(line_style),"wireframe"); - xml_h col = xml_elt_t(geo.doc,_X(color)); - col.setAttr(_A(alpha),attr.alpha()); - col.setAttr(_A(R),r); - col.setAttr(_A(G),g); - col.setAttr(_A(B),b); + xml_h col = xml_elt_t(geo.doc,_U(color)); + col.setAttr(_U(alpha),attr.alpha()); + col.setAttr(_U(R),r); + col.setAttr(_U(G),g); + col.setAttr(_U(B),b); vis.append(col); geo.xmlVis[v] = vis; } @@ -746,9 +746,9 @@ xml_h LCDDConverter::handleField(const std::string& name, const TNamed* f) con if ( !field ) { Ref_t fld(f); string type = f->GetTitle(); - field=xml_elt_t(geo.doc,_X(field)); - field.setAttr(_A(name),f->GetName()); - field.setAttr(_A(type),type); + field=xml_elt_t(geo.doc,_U(field)); + field.setAttr(_U(name),f->GetName()); + field.setAttr(_U(type),type); fld = ROOT::Reflex::PluginService::Create<TNamed*>(type+"_Convert2LCDD",&m_lcdd,&field,&fld); cout << (fld.isValid() ? "Converted" : "FAILED to convert ") << " electromagnetic field:" << f->GetName() << " of type " << f->GetTitle() << endl; @@ -807,14 +807,14 @@ void LCDDConverter::handleHeader() const { Header hdr = m_lcdd.header(); xml_h obj; geo.doc_header.append(obj=xml_elt_t(geo.doc,"detector")); - obj.setAttr(_A(name),hdr.name()); + obj.setAttr(_U(name),hdr.name()); geo.doc_header.append(obj=xml_elt_t(geo.doc,"generator")); - obj.setAttr(_A(name),"LCDDConverter"); - obj.setAttr(_A(version),hdr.version()); - obj.setAttr(_A(file),hdr.url()); - obj.setAttr(_A(checksum),m_lcdd.constantAsString("compact_checksum")); + obj.setAttr(_U(name),"LCDDConverter"); + obj.setAttr(_U(version),hdr.version()); + obj.setAttr(_U(file),hdr.url()); + obj.setAttr(_U(checksum),m_lcdd.constantAsString("compact_checksum")); geo.doc_header.append(obj=xml_elt_t(geo.doc,"author")); - obj.setAttr(_A(name),hdr.author()); + obj.setAttr(_U(name),hdr.author()); geo.doc_header.append(obj=xml_elt_t(geo.doc,"comment")); obj.setText(hdr.comment()); } @@ -863,13 +863,13 @@ xml_doc_t LCDDConverter::createGDML(DetElement top) { xml_elt_t elt(0); geo.doc = docH.parse(empty_gdml,sizeof(empty_gdml)); geo.doc_root = geo.doc.root(); - geo.doc_root.append(geo.doc_define = xml_elt_t(geo.doc,_X(define))); - geo.doc_root.append(geo.doc_materials = xml_elt_t(geo.doc,_X(materials))); - geo.doc_root.append(geo.doc_solids = xml_elt_t(geo.doc,_X(solids))); - geo.doc_root.append(geo.doc_structure = xml_elt_t(geo.doc,_X(structure))); - geo.doc_root.append(geo.doc_setup = xml_elt_t(geo.doc,_X(setup))); - elt = xml_elt_t(geo.doc,_X(world)); - elt.setAttr(_A(ref),lcdd.worldVolume().name()); + geo.doc_root.append(geo.doc_define = xml_elt_t(geo.doc,_U(define))); + geo.doc_root.append(geo.doc_materials = xml_elt_t(geo.doc,_U(materials))); + geo.doc_root.append(geo.doc_solids = xml_elt_t(geo.doc,_U(solids))); + geo.doc_root.append(geo.doc_structure = xml_elt_t(geo.doc,_U(structure))); + geo.doc_root.append(geo.doc_setup = xml_elt_t(geo.doc,_U(setup))); + elt = xml_elt_t(geo.doc,_U(world)); + elt.setAttr(_U(ref),lcdd.worldVolume().name()); geo.doc_setup.append(elt); @@ -932,24 +932,24 @@ xml_doc_t LCDDConverter::createLCDD(DetElement top) { //doc->setStrictErrorChecking(true); geo.doc_root = geo.doc.root(); - //Box worldSolid(doc,_X(world_box)); - geo.doc_root.append(geo.doc_header = xml_elt_t(geo.doc,_X(header))); - geo.doc_root.append(geo.doc_idDict = xml_elt_t(geo.doc,_X(iddict))); - geo.doc_root.append(geo.doc_detectors = xml_elt_t(geo.doc,_X(sensitive_detectors))); - geo.doc_root.append(geo.doc_limits = xml_elt_t(geo.doc,_X(limits))); - geo.doc_root.append(geo.doc_regions = xml_elt_t(geo.doc,_X(regions))); - geo.doc_root.append(geo.doc_display = xml_elt_t(geo.doc,_X(display))); - geo.doc_root.append(geo.doc_gdml = xml_elt_t(geo.doc,_X(gdml))); - geo.doc_root.append(geo.doc_fields = xml_elt_t(geo.doc,_X(fields))); + //Box worldSolid(doc,_U(world_box)); + geo.doc_root.append(geo.doc_header = xml_elt_t(geo.doc,_U(header))); + geo.doc_root.append(geo.doc_idDict = xml_elt_t(geo.doc,_U(iddict))); + geo.doc_root.append(geo.doc_detectors = xml_elt_t(geo.doc,_U(sensitive_detectors))); + geo.doc_root.append(geo.doc_limits = xml_elt_t(geo.doc,_U(limits))); + geo.doc_root.append(geo.doc_regions = xml_elt_t(geo.doc,_U(regions))); + geo.doc_root.append(geo.doc_display = xml_elt_t(geo.doc,_U(display))); + geo.doc_root.append(geo.doc_gdml = xml_elt_t(geo.doc,_U(gdml))); + geo.doc_root.append(geo.doc_fields = xml_elt_t(geo.doc,_U(fields))); //elt = xml_elt_t(); - geo.doc_gdml.append(geo.doc_define = xml_elt_t(geo.doc,_X(define))); - geo.doc_gdml.append(geo.doc_materials = xml_elt_t(geo.doc,_X(materials))); - geo.doc_gdml.append(geo.doc_solids = xml_elt_t(geo.doc,_X(solids))); - geo.doc_gdml.append(geo.doc_structure = xml_elt_t(geo.doc,_X(structure))); - geo.doc_gdml.append(geo.doc_setup = xml_elt_t(geo.doc,_X(setup))); - elt = xml_elt_t(geo.doc,_X(world)); - elt.setAttr(_A(ref),lcdd.worldVolume().name()); + geo.doc_gdml.append(geo.doc_define = xml_elt_t(geo.doc,_U(define))); + geo.doc_gdml.append(geo.doc_materials = xml_elt_t(geo.doc,_U(materials))); + geo.doc_gdml.append(geo.doc_solids = xml_elt_t(geo.doc,_U(solids))); + geo.doc_gdml.append(geo.doc_structure = xml_elt_t(geo.doc,_U(structure))); + geo.doc_gdml.append(geo.doc_setup = xml_elt_t(geo.doc,_U(setup))); + elt = xml_elt_t(geo.doc,_U(world)); + elt.setAttr(_U(ref),lcdd.worldVolume().name()); geo.doc_setup.append(elt); diff --git a/DDCore/src/plugins/LCDDFields.cpp b/DDCore/src/plugins/LCDDFields.cpp index 7b5e71ef6b87ea0479a89fb6637c0282be71c4f1..221f046af9a1d0b71ae52345bec222fcd7b36433 100644 --- a/DDCore/src/plugins/LCDDFields.cpp +++ b/DDCore/src/plugins/LCDDFields.cpp @@ -16,17 +16,17 @@ using namespace DD4hep::Geometry; static Ref_t convert_constant_field(LCDD& lcdd, xml_h field, Ref_t object) { xml_doc_t doc = xml_elt_t(field).document(); ConstantField* s = object.data<ConstantField>(); - field.setAttr(_A(lunit),"mm"); - //field.setAttr(_A(funit),"tesla"); + field.setAttr(_U(lunit),"mm"); + //field.setAttr(_U(funit),"tesla"); if ( s->type == CartesianField::ELECTRIC ) - field.setAttr(_A(field),"electric"); + field.setAttr(_U(field),"electric"); else if ( s->type == CartesianField::MAGNETIC ) - field.setAttr(_A(field),"magnetic"); + field.setAttr(_U(field),"magnetic"); - xml_elt_t strength = xml_elt_t(doc,_X(strength)); - strength.setAttr(_A(x),s->direction.X()); - strength.setAttr(_A(y),s->direction.Y()); - strength.setAttr(_A(z),s->direction.Z()); + xml_elt_t strength = xml_elt_t(doc,_U(strength)); + strength.setAttr(_U(x),s->direction.X()); + strength.setAttr(_U(y),s->direction.Y()); + strength.setAttr(_U(z),s->direction.Z()); field.append(strength); return object; } @@ -35,18 +35,18 @@ DECLARE_XML_PROCESSOR(ConstantField_Convert2LCDD,convert_constant_field); static Ref_t convert_solenoid(LCDD& lcdd, xml_h field, Ref_t object) { char text[128]; SolenoidField* s = object.data<SolenoidField>(); - field.setAttr(_A(lunit),"mm"); - field.setAttr(_A(funit),"tesla"); + field.setAttr(_U(lunit),"mm"); + field.setAttr(_U(funit),"tesla"); ::sprintf(text,"%g/mm",s->outerRadius); - field.setAttr(_A(outer_radius),_toDouble(text)); + field.setAttr(_U(outer_radius),_toDouble(text)); ::sprintf(text,"%g/mm",s->innerRadius); - field.setAttr(_A(inner_radius),_toDouble(text)); + field.setAttr(_U(inner_radius),_toDouble(text)); ::sprintf(text,"%g/tesla",s->innerField); - field.setAttr(_A(inner_field),_toDouble(text)); + field.setAttr(_U(inner_field),_toDouble(text)); ::sprintf(text,"%g/tesla",s->outerField); - field.setAttr(_A(outer_field),_toDouble(text)); - field.setAttr(_A(zmin),s->minZ); - field.setAttr(_A(zmax),s->maxZ); + field.setAttr(_U(outer_field),_toDouble(text)); + field.setAttr(_U(zmin),s->minZ); + field.setAttr(_U(zmax),s->maxZ); return object; } DECLARE_XML_PROCESSOR(SolenoidMagnet_Convert2LCDD,convert_solenoid); @@ -55,17 +55,17 @@ static Ref_t convert_dipole(LCDD& lcdd, xml_h field, Ref_t object) { char text[128]; xml_doc_t doc = xml_elt_t(field).document(); DipoleField* s = object.data<DipoleField>(); - field.setAttr(_A(lunit),"mm"); - field.setAttr(_A(funit),"tesla"); + field.setAttr(_U(lunit),"mm"); + field.setAttr(_U(funit),"tesla"); ::sprintf(text,"%g/mm",s->rmax); - field.setAttr(_A(rmax),_toDouble(text)); + field.setAttr(_U(rmax),_toDouble(text)); ::sprintf(text,"%g/mm",s->zmax); - field.setAttr(_A(zmax),_toDouble(text)); + field.setAttr(_U(zmax),_toDouble(text)); ::sprintf(text,"%g/mm",s->zmin); - field.setAttr(_A(zmin),_toDouble(text)); + field.setAttr(_U(zmin),_toDouble(text)); DipoleField::Coefficents::const_iterator i=s->coefficents.begin(); for(; i != s->coefficents.end(); ++i) { - xml_elt_t coeff = xml_elt_t(doc,_X(dipole_coeff)); + xml_elt_t coeff = xml_elt_t(doc,_U(dipole_coeff)); coeff.setValue(_toString(*i)); field.append(coeff); } diff --git a/DDCore/src/plugins/PandoraConverter.cpp b/DDCore/src/plugins/PandoraConverter.cpp index 65d3a56eafb32a6acfe5ec0b06e11f76dbd5c54b..b27245bf7e0c00d5729946f4984da0e332a3bbce 100644 --- a/DDCore/src/plugins/PandoraConverter.cpp +++ b/DDCore/src/plugins/PandoraConverter.cpp @@ -122,14 +122,14 @@ xml_doc_t PandoraConverter::create(DetElement top) { Header hdr = m_lcdd.header(); geo.doc = docH.parse(empty_xml,sizeof(empty_xml)); geo.doc_root = geo.doc.root(); - geo.doc_root.append(geo.doc_calorimeters = xml_elt_t(geo.doc,_U(calorimeters))); - geo.doc_root.append(geo.doc_detector = xml_elt_t(geo.doc,_U(detector))); - geo.doc_root.append(geo.doc_coil = xml_elt_t(geo.doc,_U(coil))); - geo.doc_root.append(geo.doc_tracking = xml_elt_t(geo.doc,_U(tracking))); - geo.doc_detector.setAttr(_U(name),hdr.name()); - geo.doc_tracking.setAttr(_U(innerR),""); - geo.doc_tracking.setAttr(_U(outerR),""); - geo.doc_tracking.setAttr(_U(z),""); + geo.doc_root.append(geo.doc_calorimeters = xml_elt_t(geo.doc,_Unicode(calorimeters))); + geo.doc_root.append(geo.doc_detector = xml_elt_t(geo.doc,_Unicode(detector))); + geo.doc_root.append(geo.doc_coil = xml_elt_t(geo.doc,_Unicode(coil))); + geo.doc_root.append(geo.doc_tracking = xml_elt_t(geo.doc,_Unicode(tracking))); + geo.doc_detector.setAttr(_Unicode(name),hdr.name()); + geo.doc_tracking.setAttr(_Unicode(innerR),""); + geo.doc_tracking.setAttr(_Unicode(outerR),""); + geo.doc_tracking.setAttr(_Unicode(z),""); return geo.doc; }