Skip to content

Commit

Permalink
Merge pull request #57 from gaskelld/NPS
Browse files Browse the repository at this point in the history
NPS - pi0
  • Loading branch information
gaskelld authored Aug 29, 2024
2 parents 0d45a21 + b2902a2 commit 7ea1949
Show file tree
Hide file tree
Showing 18 changed files with 1,233 additions and 170 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ D = $(simcdir)/fdss/

OBJ1 = target.o brem.o gauss1.o NtupleInit.o NtupleClose.o enerloss_new.o
OBJ2 = radc.o init.o dbase.o physics_kaon.o physics_pion.o physics_delta.o physics_proton.o loren.o sf_lookup.o
OBJ3 = semi_physics.o rho_physics.o rho_decay.o generate_rho.o trg_track.o semi_dilution.o
OBJ3 = semi_physics.o rho_physics.o rho_decay.o generate_rho.o trg_track.o semi_dilution.o pizero_decay.o
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
Expand Down
55 changes: 54 additions & 1 deletion NtupleInit.f
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,32 @@ subroutine NtupleInit(filename)
NtupleTag(m) = 'saghai' ! 54
m = m+1
NtupleTag(m) = 'factor' ! 55
endif
if(doing_pizero) then
m = m+1
NtupleTag(m) = 'xcal_gamma1'
m = m+1
NtupleTag(m) = 'ycal_gamma1'
m = m+1
NtupleTag(m) = 'Egamma1'
m = m+1
NtupleTag(m) = 'Pgamma1x'
m = m+1
NtupleTag(m) = 'Pgamma1y'
m = m+1
NtupleTag(m) = 'Pgamma1z'
m = m+1
NtupleTag(m) = 'xcal_gamma2'
m = m+1
NtupleTag(m) = 'ycal_gamma2'
m = m+1
NtupleTag(m) = 'Egamma2'
m = m+1
NtupleTag(m) = 'Pgamma2x'
m = m+1
NtupleTag(m) = 'Pgamma2y'
m = m+1
NtupleTag(m) = 'Pgamma2z'
endif
else if (doing_semi.or.doing_rho) then
m = m+1
Expand Down Expand Up @@ -234,7 +260,34 @@ subroutine NtupleInit(filename)
m = m+1
NtupleTag(m) = 'Thrho' ! 58 or 66
endif


if(doing_pizero) then
m = m+1
NtupleTag(m) = 'xcal_gamma1'
m = m+1
NtupleTag(m) = 'ycal_gamma1'
m = m+1
NtupleTag(m) = 'Egamma1'
m = m+1
NtupleTag(m) = 'Pgamma1x'
m = m+1
NtupleTag(m) = 'Pgamma1y'
m = m+1
NtupleTag(m) = 'Pgamma1z'
m = m+1
NtupleTag(m) = 'xcal_gamma2'
m = m+1
NtupleTag(m) = 'ycal_gamma2'
m = m+1
NtupleTag(m) = 'Egamma2'
m = m+1
NtupleTag(m) = 'Pgamma2x'
m = m+1
NtupleTag(m) = 'Pgamma2y'
m = m+1
NtupleTag(m) = 'Pgamma2z'
endif

else if (doing_hyd_elast .or. doing_deuterium .or. doing_heavy) then
m = m+1
NtupleTag(m) = 'corrsing' ! 34
Expand Down
75 changes: 42 additions & 33 deletions calo/mc_calo.f
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ subroutine mc_calo (p_spec, th_spec, dpp, x, y, z, dxdz, dydz,


! No collimator, but use collimator dimensions to define calo
parameter (h_entr = 64.0)
parameter (v_entr = 109.0)
parameter (h_exit = 64.0)
parameter (v_exit = 109.0)
c parameter (h_entr = 64.0)
c parameter (v_entr = 109.0)
c parameter (h_exit = 64.0)
c parameter (v_exit = 109.0)

c Use size of NPS
parameter (h_entr = 30.75) ! calorimeter 1/2 width: (30 blocks * 2.05 cm)/2.0
parameter (v_entr = 36.9) ! calorimeter 1/2 height: (36 blocks * 2.05 cm)/2.0
parameter (h_exit = 30.75)
parameter (v_exit = 36.9)

! Math constants

Expand Down Expand Up @@ -131,47 +137,50 @@ subroutine mc_calo (p_spec, th_spec, dpp, x, y, z, dxdz, dydz,
goto 500
endif

c Assume a position resolution of 0.5cm and energy resolution of 10%
c
x_fp = xs + 0.5 * gauss1(99.0)
y_fp = ys + 0.5 * gauss1(99.0)
ps = p*(1.0 + 0.10/sqrt(p/1000.0)*gauss1(99.0))
write(*,*) ' elect mom = ',p,ps,(p-ps)/p
dpps = (ps/p_spec-1.0)*100.0



c positions, angles at front
x_fp = xs
y_fp = ys
dx_fp=dxdzs
dy_fp=dydzs

C skip all this fow, after checking that we hit calorimeter, just fill output
C with input-maybe add some smearing later.

c no difference between recon angle and "focal plane" angles
c use the z position determined by the hadron arm to
c correct the distance from the beam interaction point to the hit in the calo
c
delta_y = -prot_zbeam*stheta
delta_z = prot_zbeam*ctheta
c delta_y = -prot_zbeam*stheta
c delta_z = prot_zbeam*ctheta
c
dx_fp = (x_fp-fry)/(drift_to_cal-delta_z)
dy_fp = (y_fp-delta_y)/(drift_to_cal-delta_z)
c dx_fp = (x_fp-fry)/(drift_to_cal-delta_z)
c dy_fp = (y_fp-delta_y)/(drift_to_cal-delta_z)

! replace xs,ys,... with 'tracked' quantities.
xs=x_fp
ys=y_fp
dxdzs=dx_fp
dydzs=dy_fp
c xs=x_fp
c ys=y_fp
c dxdzs=dx_fp
c dydzs=dy_fp


! Reconstruct target quantities.
call mc_calo_recon(dpp_recon,dth_recon,dph_recon,y_recon,fry,delta_y,delta_z,drift_to_cal)

if (using_tgt_field) then
ok = .TRUE.
call track_to_tgt(dpp_recon,y_recon,dph_recon,dth_recon,-frx,-fry,
> -p,sqrt(m2),ctheta,-stheta,prot_zbeam,-1,ok)
endif
c call mc_calo_recon(dpp_recon,dth_recon,dph_recon,y_recon,fry,delta_y,delta_z,drift_to_cal)
c
c if (using_tgt_field) then
c ok = .TRUE.
c call track_to_tgt(dpp_recon,y_recon,dph_recon,dth_recon,-frx,-fry,
c > -p,sqrt(m2),ctheta,-stheta,prot_zbeam,-1,ok)
c endif
! Fill output to return to main code
dpp = dpp_recon
dxdz = dph_recon
dydz = dth_recon
y = y_recon
c dpp = dpp_recon
c dxdz = dph_recon
c dydz = dth_recon
c y = y_recon

c dpp = dpps
c dxdz = dxdzs
c dydz = dydzs
c y = ys
ok_spec = .true.
caloSTOP_successes = caloSTOP_successes + 1

Expand Down
Loading

0 comments on commit 7ea1949

Please sign in to comment.