25 std::string output, path =
"/world";
26 bool enable_transactions =
false, arg_error =
false;
27 for(
int i=1; i<argc;++i) {
28 if ( argv[i] && (argv[i][0]==
'-' || argv[i][0]==
'/') ) {
29 const char* p = ::strchr(argv[i],
'=');
30 if ( p && strncmp(argv[i]+1,
"-output",7)==0 )
32 else if ( p && strncmp(argv[i]+1,
"-path",5)==0 )
34 else if ( strncmp(argv[i]+1,
"-transactions",5)==0 )
35 enable_transactions =
true;
41 if ( arg_error || output.empty() || path.empty() ) {
44 "Usage: -plugin <name> -arg [-arg] \n"
45 " name: factory nameDD4hep_GlobalAlignmentWriter \n\n"
46 " -output <string> Path to the output file generated. \n"
47 " -path <string> Path to the detector element for which \n"
48 " the alignment file should be written. \n"
49 " -transactions Enable output transactions. \n"
50 "\tArguments given: " << dd4hep::arguments(argc,argv) << std::endl << std::flush;
54 dd4hep::printout(dd4hep::ALWAYS,
"AlignmentXmlWriter",
55 "++ Writing dd4hep alignment constants of the \"%s\" "
56 "DetElement tree to file \"%s\"",
57 path.c_str(), output.c_str());
61 return wr.
write(wr.
dump(top,enable_transactions), output);
63 dd4hep::except(
"AlignmentXmlWriter",
"++ Invalid top level detector element name: %s",path.c_str());