NEWREG variable

Dear Experts,

In my mgdraw file i try to use BXDRAW to detect all particles passing through certain region. And i noticed that variable MREG is always defined, however NEWREG sometimes in empty and this causes crushes(when i try logical operators or calling GEOR2N). Me geometry is simple. I have target(cylinder with hole)->Vacuum1(sphere)->RegisterVacuum(sphere)->BLCKBODY(sphere). Why this can happen?
muonicsignal.inp (1.0 KB)

Dear Experts,

I want to know how bxdraw works. As i understood it is called each time when particle crosses region border. It has two variables MREG and NEWREG. MREG is region from where particle moves to NEWREG. However in my simulation if i try to print NEWREG variable it is sometimes empty. Why this can happen? My geometry is simple. I have target(cylinder with hole)->Vacuum1(sphere)->RegisterVacuum(sphere)->BLCKBODY(sphere)
This is sample of output file.
Format is:
1 line (JTRACK NCASE MREGNAME NEWREG)
2 line (JTRACK NCASE ENERGY MOMENTUM COSxyz)
You can see that particles properties same for two pair of lines(1,2 same as 3,4),however lines 1,2 don’t have NEWREG variable. If i try to call GEOR2N or logical operators on newreg program crushes.
mgdraw.f (3.8 KB)
output.txt (975 Bytes)

my previous question NEWREG variable

Dear Semyon,

you accidentally deleted the RETURN command just before the line:

ENTRY BXDRAW ( ICODE, MREG, NEWREG, XSCO, YSCO, ZSCO )

Without the RETURN command, the BXDRAW section of the code was run for every step, where the MGDRAW was called.

After putting back the RETURN command, the user routine works without any issue and the NEWREG variable is specified as expected.

Cheers,
David

Dear David,

Thank you very much for you answers!!!