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

Hallo,
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/create/attributeFilter
/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/create/drawByAttribute
/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

1 Like

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)

1 Like

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?

John

1 Like

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?

John

Hello,

did you ever figure this out - i am also having issues with implementing an attribute filter, to not display trajectories of photons with certain energies/momentums. - does not seem to work.

Hi Jazmin

More details, please…in what way ā€œdoes not seem to workā€? Have you read the above messages in this thread? Have you read the documentation - Trajectory Filtering — Book For Application Developers 11.2 documentation? Have you asked for rich trajectories?

John

Hello Jon,

Thanks for getting back to me, i have indeed read through this thread and the only difference is i am in a Linux environment not Windows, i also dont recieve an error message like the one in the original post.

In regards to the documentation you’ve linked, ive read that and many other like it, which all state the same technique which is not working for me. I will detail below with evidence what i mean.

The commands i am using in my ā€˜vis.mac’ file is as shown below:

/vis/filtering/trajectories/create/attributeFilter energy
/vis/filtering/trajectories/energy/verbose true
/vis/filtering/trajectories/energy/setAttribute IMag
/vis/filtering/trajectories/energy/addInterval 1GeV 5GeV
/vis/filtering/trajectories/energy/active true

I’ve played around with different energy ranges in case that was the issue, but none seem to work.

For context, i am simulating a muon travelling through a water Cherenkov tank, which creates Cherenkov photons in the water, finally detected by a PMT. However, the muon creates scintillation inside the tank material (which is currently stainless steel) and this is shown in the trajectory output. - i want to hide this which is typically a lower energy than the cherenkov photons produced inside the water of the tank.

I’m happy to provide more information if needed, thanks in advance!

Try putting a space between the number and the unit: 1 GeV 5 GeV

Perhaps I’ll have another look tomorrow - strange you’re getting scintillation photons in steel. (Or I’ve misread.)

Hi Jazmin

I think the photons you are seeing from steel are bremsstrahlung, not scintillation photons. But, yes, by all means suppress their drawing, but be aware that in reality - and in Geant4 - they will contribute to the signal if they reach a detector.

John

Hello Jon,

thanks for getting back to me, you are correct I misunderstood it is indeed bremsstrahlung radiation being produced in the steel due to the muon.

The spaces between the values and units seemed to work, so I am now just trying to filter out the bremsstrahlung so only the Cherenkov tracks are visualised.