Skip to content

Commit

Permalink
Add simulation of pions in HMS/SHMS collimators
Browse files Browse the repository at this point in the history
  • Loading branch information
gaskelld committed May 7, 2024
1 parent 8b6549a commit e015386
Show file tree
Hide file tree
Showing 11 changed files with 547 additions and 81 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ OBJ3 = semi_physics.o rho_physics.o rho_decay.o generate_rho.o trg_track.o se
OBJ4 = results_write.o event.o call_ranlux.o jacobians.o F1F2IN21_v1.0.o
OBJ5 = $(A)musc.o $(A)musc_ext.o $(A)project.o $(A)transp.o
OBJ6 = $(A)rotate_haxis.o $(A)rotate_vaxis.o $(A)locforunt.o
OBJ7 = $(H)mc_hms.o $(H)mc_hms_hut.o $(H)mc_hms_recon.o
OBJ7 = $(H)mc_hms.o $(H)mc_hms_hut.o $(H)mc_hms_recon.o $(H)pion_coll_absorb.o $(H)mc_hms_coll.o
OBJ8 = $(S)mc_sos.o $(S)mc_sos_hut.o $(S)mc_sos_recon.o
OBJ9 = $(R)mc_hrsr.o $(R)mc_hrsr_hut.o $(R)mc_hrsr_recon.o
OBJA = $(L)mc_hrsl.o $(L)mc_hrsl_hut.o $(L)mc_hrsl_recon.o
OBJB = $(SH)mc_shms.o $(SH)mc_shms_hut.o $(SH)mc_shms_recon.o
OBJB = $(SH)mc_shms.o $(SH)mc_shms_hut.o $(SH)mc_shms_recon.o $(SH)mc_shms_coll.o
OBJC = $(T)Ctq5Pdf.o
OBJD = $(C)mc_calo.o $(C)mc_calo_recon.o
OBJCH = $(CH)lfit.o $(CH)ranlux.o $(CH)fint.o $(CH)kerset.o $(CH)abend.o
Expand Down
11 changes: 8 additions & 3 deletions dbase.f
Original file line number Diff line number Diff line change
Expand Up @@ -825,12 +825,12 @@ subroutine dbase_read(H)
if (hadron_arm.eq.electron_arm) then
write(6,*) '**WARNING: SIMC works best with two DIFFERENT spectrometers!!!'
else if ((hadron_arm+electron_arm).eq.3) then
write(6,*) 'Rolf welcomes you to Hall C at Jefferson Lab - Get to work!'
write(6,*) 'Welcome time traveler to Hall C at 6 GeV - Get to work!'
else if (electron_arm.eq.5 .or. hadron_arm.eq.5 .or.
> electron_arm.eq.6 .or. hadron_arm.eq.6) then
write(6,*) 'Grumpy Dutch Giant welcomes you to Hall C++ at JLab12 - Get to work!'
write(6,*) 'Welcome to Hall C++ at JLab12 - Get to work!'
else if ((hadron_arm+electron_arm).eq.7) then
write(6,*) 'Kees welcomes you to Hall A at Jefferson Lab - Enjoy your stay!'
write(6,*) 'Welcome to Hall A at Jefferson Lab - Enjoy your stay!'
else if ( electron_arm.eq.7 .and. hadron_arm .eq. 5) then
write(6,*) ' Bigcal and SHMS'
else if ( electron_arm.eq.8 .and. hadron_arm .eq. 1) then
Expand All @@ -852,6 +852,9 @@ subroutine dbase_read(H)
> Implmemented for beam and scattered electron only!'
if (.not.correct_Eloss) write(6,*) 'NOTE: Will NOT correct reconstructed data for energy loss'
if (.not.correct_raster) write(6,*) 'NOTE: Will NOT use raster terms in reconstruction'
if (using_HMScoll) write(6,*) 'NOTE: including pion scattering in HMS collimator'
if (using_SHMScoll) write(6,*) 'NOTE: including pion scattering in SHMS collimator'


return
end
Expand Down Expand Up @@ -970,6 +973,8 @@ subroutine regallvars()
ierr = regparmint('using_Eloss',using_Eloss,0)
ierr = regparmint('correct_Eloss',correct_eloss,0)
ierr = regparmint('correct_raster',correct_raster,0)
ierr = regparmint('using_HMScoll',using_HMScoll,0)
ierr = regparmint('using_SHMScoll',using_SHMScoll,0)
ierr = regparmint('deForest_flag',deForest_flag,0)
ierr = regparmint('rad_flag',rad_flag,0)
ierr = regparmint('extrad_flag',extrad_flag,0)
Expand Down
84 changes: 57 additions & 27 deletions hms/mc_hms.f
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
subroutine mc_hms (p_spec, th_spec, dpp, x, y, z, dxdz, dydz,
> x_fp, dx_fp, y_fp, dy_fp, m2,
> ms_flag, wcs_flag, decay_flag, resmult, fry, ok_spec, pathlen)
> ms_flag, wcs_flag, decay_flag, resmult, fry, ok_spec, pathlen,
> using_HMScoll)

C+______________________________________________________________________________
!
Expand Down Expand Up @@ -130,6 +131,12 @@ subroutine mc_hms (p_spec, th_spec, dpp, x, y, z, dxdz, dydz,

real*8 grnd

C DJG stuff for HMS collimator
real*8 save_Hcollsuccess, save_Scollsuccess
logical Hcollsuccess, Hcoll_flag
logical using_HMScoll
common /save_coll/ save_Hcollsuccess, save_Scollsuccess

! Gaby's dipole shape stuff
logical hit_dipole
external hit_dipole
Expand Down Expand Up @@ -193,35 +200,58 @@ subroutine mc_hms (p_spec, th_spec, dpp, x, y, z, dxdz, dydz,
! Check front of fixed slit.
zdrift = z_entr
call project(xs,ys,zdrift,decay_flag,dflag,m2,p,pathlen) !project and decay
if (abs(ys-y_off).gt.h_entr) then
hSTOP_slit_hor = hSTOP_slit_hor + 1
goto 500
endif
if (abs(xs-x_off).gt.v_entr) then
hSTOP_slit_vert = hSTOP_slit_vert + 1
goto 500
endif
if (abs(xs-x_off).gt. (-v_entr/h_entr*abs(ys-y_off)+3*v_entr/2)) then
hSTOP_slit_oct = hSTOP_slit_oct + 1
goto 500
endif
*------------------------------------------------------
c SECTION ADDED FOR HMS COLLIMATOR
if (using_HMScoll .and. (m2.gt.100.0**2) .and.(m2.lt.200.0**2)) then ! check for pions/muons, if yes step through coll.
c write(*,*)'m2=',m2
c write(*,*)'mpi2 =',mpi2
c write(*,*)'-----------------------'
c write(*,*) 'I found a pion',p
call mc_hms_coll(m2,p,p_spec,decay_flag,dflag,Hcollsuccess,Hcoll_flag,pathlen)
! save_Hcollsuccess=1.25
c write(*,*) 'TH - SANITY CHECK',Hcollsuccess,p
if(.not.Hcollsuccess) then
save_Hcollsuccess=1.5
hSTOP_coll = hSTOP_coll + 1
goto 500
endif
else !just apertures at front and back
*------------------------------------------------------
if (abs(ys-y_off).gt.h_entr) then
hSTOP_slit_hor = hSTOP_slit_hor + 1
goto 500
endif
if (abs(xs-x_off).gt.v_entr) then
hSTOP_slit_vert = hSTOP_slit_vert + 1
goto 500
endif
if (abs(xs-x_off).gt. (-v_entr/h_entr*abs(ys-y_off)+3*v_entr/2)) then
hSTOP_slit_oct = hSTOP_slit_oct + 1
goto 500
endif
!Check back of fixed slit.
zdrift = z_exit-z_entr
call project(xs,ys,zdrift,decay_flag,dflag,m2,p,pathlen) !project and decay
if (abs(ys-y_off).gt.h_exit) then
hSTOP_slit_hor = hSTOP_slit_hor + 1
goto 500
endif
if (abs(xs-x_off).gt.v_exit) then
hSTOP_slit_vert = hSTOP_slit_vert + 1
goto 500
endif
if (abs(xs-x_off).gt. (-v_exit/h_exit*abs(ys-y_off)+3*v_exit/2)) then
hSTOP_slit_oct = hSTOP_slit_oct + 1
goto 500
endif
zdrift = z_exit-z_entr
call project(xs,ys,zdrift,decay_flag,dflag,m2,p,pathlen) !project and decay
if (abs(ys-y_off).gt.h_exit) then
hSTOP_slit_hor = hSTOP_slit_hor + 1
goto 500
endif
if (abs(xs-x_off).gt.v_exit) then
hSTOP_slit_vert = hSTOP_slit_vert + 1
goto 500
endif
if (abs(xs-x_off).gt. (-v_exit/h_exit*abs(ys-y_off)+3*v_exit/2)) then
hSTOP_slit_oct = hSTOP_slit_oct + 1
goto 500
endif
endif !check on collimator simulation
! Go to Q1 IN mag bound. Drift rather than using COSY matrices
Expand Down
147 changes: 147 additions & 0 deletions hms/mc_hms_coll.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
subroutine mc_hms_coll(m2,p,p_spec,decay_flag,dflag,success,
- coll_flag,pathlen)
CDJG Subroutine to step a particle "through" the collimator,checking for
CDJG energy loss, multiple scattering. If particle doesn't make it (too
CDJG much energy loss for example), returns .FALSE.
! TH - collimator thickness ~6.3 cm. He uses 20 steps for some reason
! TH Why not..seems ok. Note that keep going even if the particle
! TH is outside entrance specs.
implicit none
include 'apertures_hms.inc'
include 'struct_hms.inc'
include '../spectrometers.inc'
real*8 m2,p,p_spec
logical decay_flag, dflag,success,coll_flag
real*8 grnd
real*8 h_entr,h_exit,v_entr,v_exit
real*8 x_off,y_off,z_off
parameter (h_entr = 4.575)
parameter (v_entr = 11.646)
parameter (h_exit = 4.759)
parameter (v_exit = 12.114)
parameter (x_off = 0.000)
parameter (y_off = +0.028)
parameter (z_off = +40.17)
integer nstep
parameter(nstep=20)
real*8 coll_thick,coll_dens,zcoll,acoll,coll_radl,coll_radw
real*8 pathlen
parameter(coll_thick = 6.30)
parameter(coll_dens = 17.0)
parameter(zcoll = 69.45)
parameter(acoll = 171.56797)
parameter(coll_radl = 0.41753)
real*8 step_size,h_step,v_step
logical step_flag
logical slit_h_flag,slit_v_flag,slit_o_flag,rantemp_flag,epart_flag
real*8 epart,trans,eloss_tot,eloss,rantemp
real*8 thick,thick_temp
integer n
eloss_tot=0.
eloss=0.
step_size = 6.30/nstep
coll_flag = .FALSE.
success = .FALSE.
slit_h_flag = .FALSE.
slit_v_flag = .FALSE.
slit_o_flag = .FALSE.
rantemp_flag = .FALSE.
epart_flag = .FALSE.
h_step = h_entr
v_step = v_entr
epart = sqrt(p**2+m2)
C Now start stepping
C Check aperture, if part. hits collimator, do multiple scattering,eloss
C for next step and then project.
do n=1,nstep
step_flag = .FALSE.
if (abs(ys-y_off).gt.h_step) then
coll_flag = .TRUE.
step_flag = .TRUE.
hSTOP_slit_hor = hSTOP_slit_hor + 1
slit_h_flag = .TRUE.
thick_temp = step_size
endif
if (abs(xs-x_off).gt.v_step) then
coll_flag = .TRUE.
step_flag = .TRUE.
hSTOP_slit_vert = hSTOP_slit_vert + 1
slit_v_flag = .TRUE.
thick_temp=step_size
endif
if (abs(xs-x_off).gt.(-v_step/h_step*abs(ys-y_off)+3*v_step/2)) then
coll_flag = .TRUE.
step_flag = .TRUE.
hSTOP_slit_oct = hSTOP_slit_oct + 1
slit_o_flag = .TRUE.
thick_temp = step_size
endif
thick = thick_temp
C If we hit the collimator, check for hadronic reaction, do eloss, mult. scat. for first step
if(step_flag) then
c TH - un-comment the following line if want no collimator punch through!
c goto 500
if(m2.gt.12000. .and. m2.lt.20000.) then !check if pion - if muon, don't check for hadronic interaction
call pion_coll_absorb(p,thick,trans)
rantemp = grnd()
if(rantemp.gt.trans) then
rantemp_flag = .TRUE.
goto 500
endif
endif
coll_radw = thick/coll_radl
! TH - some adjustment here for multiple scattering test
c call musc(m2,p,coll_radw,thick,dydzs,dxdzs)
call musc(m2,p,coll_radw,dydzs,dxdzs)
epart = sqrt(p**2+m2)
call enerloss_new(thick,coll_dens,zcoll,acoll,epart,
$ sqrt(m2),1,eloss)
epart = epart - eloss
eloss_tot = eloss_tot + eloss
if(epart.lt.sqrt(m2)) then
epart_flag = .TRUE.
goto 500
endif
p = sqrt(epart**2-m2)
dpps = 100.*(p/p_spec - 1.)
endif

call project(xs,ys,step_size,decay_flag,dflag,m2,p,pathlen) !drift and decay

h_step = h_step + (h_exit-h_entr)/nstep
v_step = v_step + (v_exit-v_entr)/nstep
c write(6,*) 'step,eloss',n,eloss,step_flag,pathlen
enddo

success = .TRUE.

500 continue
c write(6,*) 'step,eloss',n,eloss_tot,success,coll_flag,step_flag,xs,ys
c if (.not.success) then
c write(6,*) rantemp_flag,trans,epart_flag,eloss,slit_h_flag,slit_v_flag,slit_o_flag
c endif
c write(6,*) 'leaving collimator...',p,success,coll_flag,step_flag
c if (abs(xs).gt.0.5 .or. abs(ys).gt.0.5) write(6,*) 'xy ',xs,ys

return
end
95 changes: 95 additions & 0 deletions hms/pion_coll_absorb.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
subroutine pion_coll_absorb(ppi,thick,transmission)
c Subroutine to calculate probability that pion will be absorbed in the SOS
c collimator - can be used for HMS assuming same geometry applies. TH - checked that.

C DJG For now, I use the "reaction" cross sections. Also, only implemented for
C DJG pi+ - no pi-.

! TH - cross section from Dave's parameterization of the energy and A dependence up to
! TH pion momenta of ~ 2 GeV, we extended that to > 2 GeV during Fpi analysis
implicit none
real*8 Ppi,Epi,Tpi,mpi !pion kinematics
real*8 Navagadro
parameter(Navagadro = 6.0221367d+23)
parameter(mpi = 139.56995)
real*8 mate_dens
real*8 mate_t
real*8 mate_A
real*8 T(14),sigreac(14),qreac(14)
real*8 sighi,siglo,qhi,qlo,transmission,lambdai,thick
real*8 Tlo,Thi,sigA,sigAlo,sigAhi,sum
integer i
! TH - DG original + TH extension for > 2GeV
data T /85.0,125.0,165.0,205.0,245.0,315.0,584.02,711.95,870.12,
> 1227.57,1446.58,1865.29,2858.0,4159.0/
CCCCCCCCCC TOTAL CROSS SECTIONS CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
! data sigreac /170.12,189.49,178.61,158.11,116.9,85.86,55.5,55.5,
! > 55.5,55.5,55.5,55.5,55.5,55.5/
! data qreac /0.59980,0.5753,0.58046,0.59842,0.65218,0.69421,.779
! > ,.779,.779,.779,.779,.779,0.779,0.779/
CCCCCCCCCCCCC REACTION CROSS SECTIONS CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
! TH - DG Original + TH extension for > 2GeV
data sigreac /26.03,84.47,117.3,117.4,101.9,69.58,42.5,44.7,47.9,
> 46.5,45.2,39.6,35.34,33.15/
data qreac /0.948,0.659,0.56,0.5342,0.5452,0.60796,0.699,0.689,
> 0.679,0.683,0.688,0.704,0.7483,0.7705/
CCCCCCCCCCCCC ABSORPTION(?) CROSS SECTIONS CCCCCCCCCCCCCCCCCCCCCCCCCCC
c data sigreac /8.81,25.57,29.57,30.245,15.63,8.302,4.98,4.98,4.98,
c > 4.98,4.98,4.98/
c data qreac /0.986,0.763,0.744,0.679,0.762,0.6506,0.75,0.75,
c > 0.75,0.75,0.75,0.75/
c data sigreac_minus /25.0,100.0,120.,110.0,100.0,80.0/
c data qreac_minus /0.97,0.60,0.52,0.50,0.53,0.60/
mate_dens = 17.0 !Collimator density (g/cm^3)
mate_t = 6.35 !Total aluminum seen by pion(cm)
mate_A = 171.57
Epi = sqrt(Ppi**2+mpi**2)
Tpi = Epi - mpi
sigA = 0.0
c do i = 1,14
c GH changed this to 13, there are only 14 elements, so the T(i+1) check should fail for i=14
do i = 1,13
if((Tpi.gt.T(i)).and.(Tpi.le.T(i+1))) then
Thi = T(i+1)
Tlo = T(i)
sighi = sigreac(i+1)
siglo = sigreac(i)
qhi = qreac(i+1)
qlo = qreac(i)
sigAhi = sighi*mate_A**qhi
sigAlo = siglo*mate_A**qlo
sigA = (sigAlo*(Thi-Tpi) + sigAhi*(Tpi-Tlo))/(Thi-Tlo)
sigA = sigA*1.d-27 !convert to cm^2
endif
enddo
c GH if pion kinetic energy is greater than T(14)=4159 MeV, then use T(14) parameters
if (Tpi.gt.T(14)) then
sigA = sigreac(14)*mate_A**qreac(14)
sigA = sigA*1.d-27
c write(6,*)' coll: pion K.E. limit ',Tpi
endif
sum = 0.0
lambdai = mate_dens*Navagadro*sigA/mate_A
sum = sum + thick*lambdai
transmission = exp(-sum)
end
Loading

0 comments on commit e015386

Please sign in to comment.