Fatal /vis/filtering/trajectories/attributefilter-0/addinterval

I am running a simulation of antiproton annihilation in a lead crystal calorimeter simulation. Particle filters work fine, and I can select different particles to be filtered by e.g.
/vis/filtering/trajectories/particleFilter-0/add anti_proton

However, when I add an attributefilter to select only particles within a certain energy/momentum then the program crashes. Here are the lines that I add:
/vis/filtering/trajectories/attributeFilter-0/setAttribute IMag
/vis/filtering/trajectories/attributeFilter-0/addInterval 1 GeV 2 GeV

after including the last command I get:
Invalid format: Was the input data formatted correctly ?
Fatal error in argument.
The problematic line is the "…/addInterval 1 GeV 2 GeV

I looked at all the examples and cannot detect the error. The same thing also happens when I use:
/vis/modeling/trajectories/drawByAttribute-0/setAttribute IMag
/vis/modeling/trajectories/drawByAttribute-0/addInterval interval1 1.0 GeV 1.5 GeV

Same error message. I would be grateful for any hint. Thanks a lot Herbert

Mmm. The documentation is not much help. And the command guidance is not very helpful (it simply asks for a string). My guess is: you don’t need the middle “GeV”. I’ll check the code.

Mmm, no, you are right. It expects “1 GeV 2 GeV”. And when I try that in a simple example, it works fine for me. Strange.

Could you attach your actual commands, if they are in a macro. Just wondering if a rogue character has crept in.

Thanks Allison for the fast response, appended please find the macro. I actually append two macros. The first one “BL4S_shielding.mac” adds trajectories and the drawbyparticle commands. If I comment out the “create/attributeFilter” in the lower section then everything works fine.

The second macro (gui_shielding.mac) contains instructions to add buttons to the application (I am using gears). I do this to visualize particles selectively. Works great. I wanted to do the same thing with energy range selection and then I ran into the described problem.

Would be great if you could have a look at it. If you want me I can also add a screenshot of the error message on the screen.
BL4S_Shielding.txt (2.3 KB)
gui_Shielding.txt (2.7 KB)

Hi Herbert

This is a mystery. Your macros work fine for me. (To get them to work on exampleB1 I had to comment out /gps/, /analysis/ and /geometry/source commands.) They gave me a really impressive array of buttons that all seemed to work, as far as I tried them - it looks like a really nice app you are developing. So something else must be going on for you.

What version of G4 are you using?

Any chance you could debug this? Place a break point at G4AttValueFilterT.hh:169?


Hi John,
I am using G4 version 4 11.1. I am on a Windows environment and registered the libraries in the system path. ( I append a screenshot).
The program code that I am using is actually from Jin Liu (all cudos to him ;-)) and it is available here https://physino.xyz/gears/ - it is called GEARS.
Unfortunately I am not a C++ programmer. My skillset allowed me (with online instructions) to get the source code use CMake, and then in Visual Studio to compile it. After that I only modified the macro files and the geometry. (I think G4 is great !!!).
Regarding Debugging. Hmmm, tough for me. I had a quick look into the gears files, but there I could not find the mentioned .hh file. Maybe this is because the gears.exe refers to the G4 libraries in compiled form (i.e. as DLLs in the case of Windows).

Mmm. OK.

If you actually edited using a Windows-based editor, it sometimes/always puts in (a carriage return character). Geant4 doesn’t like this - it is Unix-oriented. But that doesn’t seem to be the case here, but I mention it in case you have, perhaps, more than one copy of the macros, some edited on Windows, in which case one of them might be the culprit.

Sorry not to be more helpful. Anyone else with ideas?