45 class alignment_delta;
50 template <>
void Converter<debug>::operator()(
xml_h seq)
const;
51 template <>
void Converter<volume>::operator()(
xml_h seq)
const;
52 template <>
void Converter<alignment>::operator()(
xml_h seq)
const;
53 template <>
void Converter<detelement>::operator()(
xml_h seq)
const;
54 template <>
void Converter<include_file>::operator()(
xml_h seq)
const;
56 static long setup_Alignment(Detector& description,
const xml_h& e);
69 template <>
void dd4hep::Converter<dd4hep::debug>::operator()(
xml_h e)
const {
70 bool value = e.
attr<
bool>(
_U(value));
89 template <>
void dd4hep::Converter<dd4hep::volume>::operator()(
xml_h e)
const {
92 std::pair<DetElement,std::string>* elt = _param<std::pair<DetElement,std::string> >();
93 std::string subpath = e.
attr<std::string>(
_ALU(path));
95 bool reset_dau = e.
hasAttr(
_ALU(reset_children)) ? e.
attr<
bool>(
_ALU(reset_children)) :
true;
97 bool check_val = check ? e.
attr<
bool>(
_ALU(check_overlaps)) :
false;
99 double ovl = overlap ? e.
attr<
double>(
_ALU(overlap)) : 0.001;
100 std::string elt_place = elt->first.placementPath();
101 std::string placement = subpath[0]==
'/' ? subpath : elt_place +
"/" + subpath;
103 printout(INFO,
"Alignment<vol>",
" path:%s placement:%s reset:%s children:%s",
104 subpath.c_str(), placement.c_str(), yes_no(reset), yes_no(reset_dau));
114 dd4hep_ptr<StackEntry> entry(
new StackEntry(elt->first,placement,val,ovl));
116 std::pair<DetElement,std::string> vol_param(elt->first,subpath);
136 template <>
void dd4hep::Converter<dd4hep::detelement>::operator()(
xml_h e)
const {
137 DetElement
det(_param<DetElement::Object>());
139 std::string path = e.
attr<std::string>(
_ALU(path));
141 bool check_val = check ? e.
attr<
bool>(
_ALU(check_overlaps)) :
false;
143 bool reset_dau = e.
hasAttr(
_ALU(reset_children)) ? e.
attr<
bool>(
_ALU(reset_children)) :
false;
145 double ovl = overlap ? e.
attr<
double>(
_ALU(overlap)) : 0.001;
147 std::string placement = elt.isValid() ? elt.placementPath() : std::string(
"-----");
149 if ( !elt.isValid() ) {
150 except(
"GlocalAlignmentParser",
151 "dd4hep: DetElement %s has no child: %s [No such child]",
det.path().c_str(), path.c_str());
158 reset = reset_dau =
true;
167 "Alignment<det>",
"path:%s [%s] placement:%s matrix:%s reset:%s children:%s",
169 elt.isValid() ? elt.path().c_str() :
"-----",
172 yes_no(reset), yes_no(reset_dau));
177 std::pair<DetElement, std::string> vol_param(elt,
"");
194 template <>
void dd4hep::Converter<dd4hep::include_file>::operator()(
xml_h element)
const {
196 xml_h node = doc.root();
197 std::string tag = node.
tag();
198 if ( tag ==
"alignment" )
199 Converter<alignment>(description,param,optional)(node);
200 else if ( tag ==
"global_alignment" )
201 setup_Alignment(description, node);
202 else if ( tag ==
"detelement" )
203 Converter<detelement>(description,param,optional)(node);
204 else if ( tag ==
"subdetectors" || tag ==
"detelements" )
207 except(
"GlocalAlignmentParser",
"Undefined tag name in XML structure: %s XML parsing abandoned.", tag.c_str());
222 template <>
void dd4hep::Converter<dd4hep::alignment>::operator()(
xml_h e)
const {
248 except(
"GlobalAlignment",
"Request to open a second alignment transaction stack -- not allowed!");
253 printout(ERROR,
"GlobalAlignment",
254 "Request process global alignments without cache.");
255 printout(ERROR,
"GlobalAlignment",
256 "Call plugin DD4hep_GlobalAlignmentInstall first OR add XML tag <open_transaction/>");
257 except(
"GlobalAlignment",
"Request process global alignments without cache.");
260 (dd4hep::Converter<dd4hep::alignment>(description,description.
world().
ptr(),&stack))(e);
267 Path uri = elt.document().uri();
268 printout(INFO,
"GlobalAlignment",
"+++ Successfully parsed XML: %s",
285 DECLARE_APPLY(DD4hep_GlobalAlignmentInstall,install_Alignment)