* subroutine addhits_sim(x0,y0,nx,ny,e0) implicit none #include "cphoto.inc" * integer ech common/ech_common/ ech(0:1,-MCOL:MCOL,-MROW:MROW) * real x0, y0, nx, ny, e0 real x, y, dx, dy, dz, e, fc, s, r1, r2, ecell, & shower_depth, cell_mc, sigma2g integer i, j, kx, ky, kx1, kx2, ky1, ky2, ihole, nint * i_gen_method = 1 ! fast simulation method dz = shower_depth(icase,e0) x = x0 + nx*dz y = y0 + ny*dz kx = nint(x/(dtarg(icase,1)*2.)) ky = nint(y/(dtarg(icase,2)*2.)) * if(icase.eq.1) then ! PWO if(.not.(abs(x0).lt.60. .and. abs(y0).lt.60.)) return ! hybrid in LG part ihole = 3 if(iabs(kx).gt.NCOL(1).or.iabs(ky).gt.NROW(1)) return ! out of calorimeter if(iabs(kx).lt.ihole .and. iabs(ky).lt.ihole) return ! hole call rannor(r1,r2) e = e0*(1.+r1*0.0045) else if(icase.eq.0) then ! LG if(igeometry.eq.1) then ! hybrid in pwo part if(abs(x0).lt.60. .and. abs(y0).lt.60.) return endif ihole = 2 if(kx*kx+ky*ky.ge.961) return ! out of calorimeter if(iabs(kx).lt.ihole .and. iabs(ky).lt.ihole) return ! hole call rannor(r1,r2) e = e0*(1.+r1*0.015) else e = e0 ihole = 0 endif * kx1 = max(-NCOL(icase),kx-3) kx2 = min( NCOL(icase),kx+3) ky1 = max(-NROW(icase),ky-3) ky2 = min( NROW(icase),ky+3) * do i = kx1, kx2 do j = ky1, ky2 if(icase.eq.0.and.i*i+j*j.ge.961) goto 120 ! out of LG calorimeter if(iabs(i).lt.ihole .and. iabs(j).lt.ihole) goto 120 ! hole dx = x/(dtarg(icase,1)*2.)-i dy = y/(dtarg(icase,2)*2.)-j fc = cell_mc(dx,dy) s = sqrt( sigma2g(dx,dy,fc,100.*e)/(100.*e) ) 150 continue call rannor(r1,r2) ecell = e*(fc+r1*s) if(ecell.lt.0. .or. ecell.gt.e) goto 150 if(ecell.gt.3.e-3) & ech(icase,i,j) = ech(icase,i,j) + nint(ecell*1.e4) 120 continue enddo enddo * return end * * real function sigma2g(dx,dy,fc,e0) ! sigma_e^2/e0 = sigma_f^2*e0, units are 10MeV implicit none #include "phot_cell_cbk_mc.inc" #include "cphoto.inc" * real dx, dy, fc, e0 * real alp, bet1, bet2, d2c parameter (alp = .816, bet1 = 32.1, bet2 = 1.72) * sigma2g = alp*fc + (bet1+bet2*sqrt(e0))*d2c(dx,dy) * * * sigma2g = (0.01*e0)*0.0004 + sigma2g sigma2g = sfactor(icase)*sigma2g * return end * * subroutine addhits_mip(x0,y0,nx,ny,e0) implicit none #include "cphoto.inc" * integer ech common/ech_common/ ech(0:1,-MCOL:MCOL,-MROW:MROW) * real x0, y0, nx, ny, e0 real x, y, dz, e, r1, r2, ecell integer i, j, kx, ky, ihole, nint * i_gen_method = 1 ! fast simulation method dz = 10. x = x0 + nx*dz y = y0 + ny*dz kx = nint(x/(dtarg(icase,1)*2.)) ky = nint(y/(dtarg(icase,2)*2.)) * if(icase.eq.1) then ! PWO if(.not.(abs(x0).lt.60. .and. abs(y0).lt.60.)) return ! hybrid in LG part ihole = 3 if(iabs(kx).gt.NCOL(1).or.iabs(ky).gt.NROW(1)) return ! out of calorimeter if(iabs(kx).lt.ihole .and. iabs(ky).lt.ihole) return ! hole call rannor(r1,r2) e = min(0.21,e0)*(1.+r1*0.062) else if(icase.eq.0) then ! LG if(igeometry.eq.1) then ! hybrid in pwo part if(abs(x0).lt.60. .and. abs(y0).lt.60.) return endif ihole = 2 if(kx*kx+ky*ky.ge.961) return ! out of calorimeter if(iabs(kx).lt.ihole .and. iabs(ky).lt.ihole) return ! hole call rannor(r1,r2) e = min(0.28,e0)*(1.+r1*0.064) else return endif * ecell = e i = kx j = ky if(ecell.gt.e0) ecell = e0 if(ecell.gt.3.e-3) & ech(icase,i,j) = ech(icase,i,j) + nint(ecell*1.e4) * return end * * subroutine addhits_had(x0,y0,nx,ny,e0) implicit none #include "cphoto.inc" * integer ech common/ech_common/ ech(0:1,-MCOL:MCOL,-MROW:MROW) * real x0, y0, nx, ny, e0 real x, y, dx, dy, dz, e, fc, s, r1, r2, ecell, & cellh_mc, sigma2g, xw, w, rndm, inter_depth integer i, j, kx, ky, kx1, kx2, ky1, ky2, ihole, nint * i_gen_method = 1 ! fast simulation method inter_depth = -log(rndm(-1.)) if(icase.eq.1) then ! PWO inter_depth = inter_depth * 22.4 else if(icase.eq.0) then ! LG inter_depth = inter_depth * 38.7 else return endif * if(inter_depth.gt.2.*dtarg(icase,3)) return * 111 continue xw = rndm(-1.) w = 7.*xw*exp(1.-7.*xw) if(rndm(-1.).gt.w) goto 111 e = e0 * xw * dz = 1.5*dtarg(icase,3) x = x0 + nx*dz y = y0 + ny*dz kx = nint(x/(dtarg(icase,1)*2.)) ky = nint(y/(dtarg(icase,2)*2.)) * if(icase.eq.1) then ! PWO if(.not.(abs(x0).lt.60. .and. abs(y0).lt.60.)) return ! hybrid in LG part ihole = 3 if(iabs(kx).gt.NCOL(1).or.iabs(ky).gt.NROW(1)) return ! out of calorimeter if(iabs(kx).lt.ihole .and. iabs(ky).lt.ihole) return ! hole call rannor(r1,r2) e = e*(1.+r1*0.0045) else if(icase.eq.0) then ! LG if(igeometry.eq.1) then ! hybrid in pwo part if(abs(x0).lt.60. .and. abs(y0).lt.60.) return endif ihole = 2 if(kx*kx+ky*ky.ge.961) return ! out of calorimeter if(iabs(kx).lt.ihole .and. iabs(ky).lt.ihole) return ! hole call rannor(r1,r2) e = e*(1.+r1*0.015) else return endif * kx1 = max(-NCOL(icase),kx-3) kx2 = min( NCOL(icase),kx+3) ky1 = max(-NROW(icase),ky-3) ky2 = min( NROW(icase),ky+3) * do i = kx1, kx2 do j = ky1, ky2 if(icase.eq.0.and.i*i+j*j.ge.961) goto 120 ! out of LG calorimeter if(iabs(i).lt.ihole .and. iabs(j).lt.ihole) goto 120 ! hole dx = x/(dtarg(icase,1)*2.)-i dy = y/(dtarg(icase,2)*2.)-j fc = cellh_mc(dx,dy) s = 5.*sqrt( sigma2g(dx,dy,fc,100.*e)/(100.*e) ) if(icase.eq.1) s = 2.*s ! PWO 150 continue call rannor(r1,r2) ecell = e*(fc+r1*s) if(ecell.lt.0. .or. ecell.gt.e) goto 150 * if(ecell.gt.30.e-3) then ech(icase,i,j) = ech(icase,i,j) + nint(ecell*1.e4) else if (ecell.gt.20.e-3 .and. rndm(-1.).gt.0.3) then ech(icase,i,j) = ech(icase,i,j) + nint(ecell*1.e4) else if (ecell.gt.10.e-3 .and. rndm(-1.).gt.0.3) then ech(icase,i,j) = ech(icase,i,j) + nint(ecell*1.e4) else if (ecell.gt. 3.e-3 .and. rndm(-1.).gt.0.1) then ech(icase,i,j) = ech(icase,i,j) + nint(ecell*1.e4) endif 120 continue enddo enddo * return end *