Hi Fluka experts;
I’m using a single energy level photon beam to penetrate the PMMA mode(half of it is blocked by lead),and I set up a usrbin behind the PMMA for scoring.But I only want to score the primary photons that pass through PMMA, excluding those that are scattered by Compton.I have referred to several posts to learn that some types of particles can be killed using the usrmed.f routine.But my routine code didn’t get the result I wanted,the result I get when I execute the routine is the same as if I didn’t call the routine
I don’t know whether there is something wrong with my code or the understanding of “LTRACK” is wrong?
So here is my routine code and flair file, I don’t know what the problem is.Can someone help me figure out the problem?
ScaSim001.flair (4.3 KB)
myusrmed03.f (3.1 KB)
Hi Fluka experts;
I think using a routine for this may be a little too much. You can score primary photons straight in USRBIN by setting particle type BEAMPART in “part” (WHAT(2))
I apologize for the inaccuracy of my description.My source is a 50kev photon beam. When it penetrates PMMA, part of the photons will be Compton scattered. My intention is to kill this part of the photons that have Compton scattered, and score only the photons that directly pass through PMMA.So, I’m not sure if your suggestion is valid, because, for the “part” (what(2))of usrbin, I always set it to photon.
I have posted my subroutine code below to make it easier to check the problem, can someone help me see what the problem is.
INCLUDE 'trackr.inc' * usual flag for first call: CHARACTER*8 MRGNAM, NRGNAM LOGICAL LFIRST SAVE LFIRST, MRGNAM, NRGNAM DATA LFIRST / .TRUE. / * IF ( LFIRST ) THEN CALL GEON2R( MREG, MRGNAM, IERR1) CALL GEON2R( NEWREG, NRGNAM, IERR2) IF(IERR1 .NE. 0 .OR. IERR2 .NE. 0) STOP "Error in name conversion" LFIRST = .FALSE. ENDIF IF(MRGNAM .EQ. "PM " .AND. NRGNAM .EQ. "ROOM ") THEN * filter on photons of second generation IF ( LTRACK .EQ. 1 ) THEN ELSE WEE = ZERZER END IF ENDIF RETURN *=== End of subroutine Usrmed =========================================* END
Your usrmed routine is never called, since the material range set in the MAT-PROP card is wrong, going from material #27 (PMMA) to material #26 (AIR) with the default step of +1, which gives an empty range. The actual material numbers can be found in the output file.
Once your routine is called, it will crash, since the call to GEON2R is also wrong: the first two arguments should be inverted, putting first the region name variable and second the region number variable. Moreover, the region name variables must be filled with your region names before the GEON2R call (you are asking the number corresponding to a given name, therefore you need to provide the name).
Also, you cannot use the MREG and NEWREG dynamic variables to save the corresponding numbers, rather other integer variables of your choice (say NUPSTR and NDOWNR). Then, outside the LFIRST condition, the runtime condition to apply is
IF (MREG.EQ.NUPSTR .AND. NEWREG.EQ.NDOWNR) THEN