21 #include <TInterpreter.h>
35 Handler() { SetErrorHandler(Handler::print); }
36 static void print(
int level, Bool_t abort,
const char *location,
const char *msg) {
37 if ( level > kInfo || abort ) ::printf(
"%s: %s\n", location, msg);
40 std::cout <<
" usage: materialScan compact.xml x0 y0 z0 x1 y1 z1 [-interactive]" << std::endl
41 <<
" or: materialScan compact.xml -interactive" << std::endl
42 <<
" -> prints the materials on a straight line between the two given points (unit is cm) " << std::endl
43 <<
" -interactive Load geometry once, then allow for shots from the ROOT prompt" << std::endl
44 <<
" NOTE: ALL lengths in units of [cm]"
50 bool do_scan =
true, interactive =
false;
51 double x0, y0, z0, x1, y1, z1;
53 if( argc == 3 && ::strncmp(argv[2],
"-interactive",5) == 0 ) {
57 else if ( argc == 9 && ::strncmp(argv[8],
"-interactive",5) == 0 ) {
61 else if ( argc < 8 ) {
65 std::string inFile = argv[1];
67 std::stringstream sstr;
68 sstr << argv[2] <<
" " << argv[3] <<
" " << argv[4] <<
" "
69 << argv[5] <<
" " << argv[6] <<
" " << argv[7] <<
" " <<
"NONE";
70 sstr >> x0 >> y0 >> z0 >> x1 >> y1 >> z1;
73 setPrintLevel(WARNING);
78 scan.
print(x0*dd4hep::cm, y0*dd4hep::cm, z0*dd4hep::cm, x1*dd4hep::cm, y1*dd4hep::cm, z1*dd4hep::cm);
82 description.
apply(
"DD4hep_InteractiveUI",0,0);
83 ::snprintf(cmd,
sizeof(cmd),
84 "dd4hep::rec::MaterialScan* gMaterialScan = "
85 "(dd4hep::rec::MaterialScan*)%p",(
void*)&scan);
86 gInterpreter->ProcessLine(cmd);
87 printout(ALWAYS,
"materialScan",
"Use the ROOT interpreter variable "
88 "\"dd4hep::rec::MaterialScan* gMaterialScan\" to interact "
89 "with the material scanner");
90 gInterpreter->ProcessLine(
".class dd4hep::rec::MaterialScan");
91 description.
apply(
"DD4hep_Rint",0,0);