Dear professors,

I’m recording the energy deposition of the source particles and all the secondaries for each event. The variable RULL in mgdraw.f seems to perfectly satisfy my purpose. On the other hand, some people suppose that I can also record the energy loss of each primary after and before it enters certain region. So I write the following codes to check whether it is consistent.

```
ENTRY ENDRAW ( ICODE, MREG, RULL, XSCO, YSCO, ZSCO )
IF (MREG .EQ. 6 ) THEN
ENEDEPLS = ENEDEPLS + RULL
END IF
```

where ENEDEPLS is refreshed every time a new primary enters and recorded during ENTRY EEDRAW.

```
ENTRY BXDRAW ( ICODE, MREG, NEWREG, XSCO, YSCO, ZSCO )
IF ( JTRACK .EQ. 11 .OR. JTRACK .EQ. 10 ) THEN
IF ( MREG .EQ. 7 .AND. NEWREG .EQ. 6 ) THEN
ENTELS = .TRUE.
ENEBEF = ETRACK
END IF
IF ( MREG .EQ. 6 .AND. NEWREG .EQ. 7) THEN
EXITLS = .TRUE.
ENEAFT = ETRACK
END IF
END IF
```

where the primary is muon-/muon+, the interested region 6 is surrounded by region 7 and the difference between ENEBEF and ENEAFT is recorded as ENELOS during ENTRY EENRAW according to this line.

`WRITE(98,'(A15, 2ES15.3)') "eneLS", ENEDEPLS, ENELOS`

The expectation is that if my interpretation to RULL and the codes are right, the value of RULL should be larger than that of ENELOS. Because sometimes a primary could deposit energy in region 6 without crossing it when some secondaries may “help” it. However, it turns out that the latter is much larger for the most of time. I’m wondering where the mistake lies.

mgdraw.f (8.6 KB)

output.txt (354.5 KB)

Best regards,

Hechong Han