Problem 2420 - G4GenericMessenger: buggy SetRange on DeclareMethod commands (numeric types)
Summary: G4GenericMessenger: buggy SetRange on DeclareMethod commands (numeric types)
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: intercoms (show other problems)
Version: 10.7
Hardware: All All
: P4 normal
Assignee: asai
URL:
Depends on:
Blocks:
 
Reported: 2021-09-09 16:13 CEST by Luigi Pertoldi
Modified: 2021-12-14 22:34 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Luigi Pertoldi 2021-09-09 16:13:40 CEST
G4GenericMessenger::SetRange does not work as expected on a Command created with G4GenericMessenger::DeclareMethod with a function that accepts a numeric type. This happens because DeclareMethod seems to always assign type "string" to the function argument.

The bug can be reproduced by modifying example basic/B5:

1) In B5DetectorConstruction::DefineCommands, create armAngleCmd by invoking DeclareMethod instead of DeclareMethodWithUnit (remove the "deg" unit specification).

2) Substitute "/B5/detector/armAngle 30. deg" with "/B5/detector/armAngle 30." in provided macro run1.mac.

3) Compile the example and run the program. Output:

parameter out of range: angle>=0. && angle<180.
***** Illegal parameter (99) </B5/detector/armAngle 0. deg> *****

***** Batch is interrupted!! *****

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
      issued by : G4UImanager::ApplyCommand
Command aborted (399)
Error code : 399
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Comment 1 asai 2021-12-14 22:34:03 CET
Thank you for reporting this. The fix will be included in the next patch release.