IAP GITLAB

qgsjetII_epos.f 14.2 KB
Newer Older
1 2 3 4 5 6 7 8 9
c 07.06.2006 Link routines between QGSJet-II-03 and EPOS.
c author T. Pierog


c-----------------------------------------------------------------------
      subroutine IniQGSJETII
c-----------------------------------------------------------------------
c Primary initialization for QGSJET-II
c-----------------------------------------------------------------------
10
      parameter(iapmax=208)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
      include 'epos.inc'
      integer debug
      common /qgdebug/ debug
      common /qgarr43/ moniou
      double precision bqgs2,bmaxqgs,bmaxnex,bminnex,xan,xbn
      common /qgsIInex1/xan(iapmax,3),xbn(iapmax,3)
     *,bqgs2,bmaxqgs,bmaxnex,bminnex
      CHARACTER DATDIR*(132)

      call utpri('iniqgsII',ish,ishini,6)
      write(ifmt,'(a,i6)')'initialize QGSJET-II ...'

      debug=0
      if(ish.ge.3)debug=ish-2
      moniou=ifch

c model parameter setting
      call qgset
c common initialization procedure
30
      DATDIR="qgsjetII"
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
      call qgaini(DATDIR)
      BMAXNEX=dble(bmaxim)
      BMINNEX=dble(bminim)
      egymin=0.1
      egymax=egymax
      irescl=0
      

      call utprix('iniqgsII',ish,ishini,6)
      end

c-----------------------------------------------------------------------
      subroutine IniEvtQGSII
c-----------------------------------------------------------------------
c Initialization for each type of event (for given proj, targ and egy)
c-----------------------------------------------------------------------
47
      parameter(iapmax=208)
48 49 50 51 52 53 54 55 56
      include 'epos.inc'
      common/geom/rmproj,rmtarg,bmax,bkmx
c QGSJET-II Common
      double precision bqgs,bmaxqgs,bmaxnex,bminnex,xa,xb,e0
      common /qgsIInex1/xa(iapmax,3),xb(iapmax,3)
     *,bqgs,bmaxqgs,bmaxnex,bminnex


      if(matarg.gt.iapmax.or.maproj.gt.iapmax)
57
     &  call utstop('Nucleus too big for QGSJET-II (Mmax=208) !&')
58 59 60 61
      call iclass(idproj,iclpro)
      call iclass(idtarg,icltar)
      icp=idtrafo('nxs','qgs',idproj)
      if(icp.eq.0)icp=1-2*int(rangen()+0.5)       !pi0=pi+ or p-
62 63
      if(abs(icp).gt.5)
     &  call utstop('Projectile not allowed in QGSJET-II !&')
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
      e0=dble(elab)
      call qgini(e0,icp,maproj,matarg)
      call qgini(e0,icp,maproj,matarg)        !again to set bm properly
      bmax=BMAXQGS
      qgsIIincs=qgsIIcrse(ekin,maproj,matarg,idtarg)
      if(engy.lt.egymin)qgsIIincs=0.          !below egymin, no interaction
      call xsigma                             !change bm in qgfz
      bkmx=sqrt(sigine/10./pi)        !10= fm^2 -> mb
      if(ish.ge.2)write(ifch,*)
     &  'QGSJET-II used with (E,proj,maproj,matarg,bmax)',e0,icp
     &  ,maproj,matarg,bmax

      return
      end

c-----------------------------------------------------------------------
      subroutine emsqgsII(iret)
c-----------------------------------------------------------------------
c  call qgsjet-II to simulate interaction
c-----------------------------------------------------------------------
84
      parameter(iapmax=208,nptmax=95000)
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
      include 'epos.inc'
      include 'epos.incems'
      common/geom/rmproj,rmtarg,bmax,bkmx
      double precision bqgs,bmaxqgs,bmaxnex,bminnex,xa,xb,esp
      common /qgsIInex1/xa(iapmax,3),xb(iapmax,3)
     *,bqgs,bmaxqgs,bmaxnex,bminnex
      common/nucl3/phi,bimp
      common/col3/ncol,kolpt
      common /qgarr12/ nsp
      common /qgarr14/ esp(4,nptmax),ich(nptmax)
c nsf - number of secondary fragments;
c iaf(i) - mass of the i-th fragment
      common /qgarr13/ nsf,iaf(iapmax)
      common /qgarr55/ nwt,nwp

      ncol=0
      iret=0
      b1=bminim
      b2=min(bmax,bmaxim)
      a=pi*(b2**2-b1**2)

      if(a.gt.0..and.rangen().gt.qgsIIincs/10./a)goto 1001   !no interaction
      if(ish.ge.3)call alist('Determine QGSJET-II Production&',0,0)

      nptl=0
      nsp=0
      call qgconf
      
      ncol=1
      nevt=1
      kolevt=ncol
      koievt=0
      npjevt=maproj
      ntgevt=matarg
      pmxevt=pnll
      egyevt=engy
      if(BQGS.ge.0.d0)then
        bimevt=real(BQGS)
        bimp=real(BQGS)
        phi=2.*pi*rangen()
        phievt=phi
      else
        bimevt=0.
        bimp=0.
        phievt=0.
        phi=0.
      endif
      anintine=anintine+1.

      call conre
      call conwr
      call conqgsII



c keep the projectile spectators as fragments
      if(infragm.eq.2)then

        if(NSF.gt.0)then
          do is=1,NSF           !count the number of spectators
          if(ish.ge.7)write(ifch,'(a,i5,a,i5)')
     $       ' Projecticle Fragment ',is,' Mass :',IAF(is)
            nptl=nptl+1
            istptl(nptl)=0
            if(IAF(is).eq.1)then
              id=idptl(is)
              pptl(3,nptl)=pptl(3,is)
              pptl(4,nptl)=pptl(4,is)
              pptl(5,nptl)=pptl(5,is)
            else
              if(IAF(is).eq.2)then
                id=17
              elseif(IAF(is).eq.3)then
                id=18
              elseif(IAF(is).eq.4)then
                id=19
              else
                inucl=IAF(is)
                iprot= int(dble(inucl) / 2.15d0 + 0.7d0)
                id=1000000000+iprot*10000+inucl*10 !code for nuclei
              endif
              call idmass(id,am)
              pptl(4,nptl)=dble(IAF(is))*pptl(4,is)      !Etot
              pptl(5,nptl)=am                             !mass
              pz2tmp=(pptl(4,nptl)+am)*(pptl(4,nptl)-am)
              if(pz2tmp.gt.0.d0)then
                pptl(3,nptl)=sqrt(pz2tmp)                 !Pz
              else
                write(*,*)'Warning in emsqgsII !'
                write(*,*)'energy of fragment too small :',IAF(is),am
     &                     ,pptl(4,nptl)
                pptl(3,nptl)=pptl(4,nptl)
              endif
            endif
            pptl(1,nptl)=0.d0 !P_x
            pptl(2,nptl)=0.d0 !P_y
            ityptl(nptl)=0
            iorptl(nptl)=1
            jorptl(nptl)=maproj+matarg
            ifrptl(1,nptl)=0
            ifrptl(2,nptl)=0
            xorptl(1,nptl)=0.d0
            xorptl(2,nptl)=0.d0
            xorptl(3,nptl)=0.d0
            xorptl(4,nptl)=0.d0
            tivptl(1,nptl)=0.d0
            tivptl(2,nptl)=0.d0
            idptl(nptl)=id
            if(ish.ge.5)write(ifch,'(a,i5,a,i5,a,4(e10.4,1x),f6.3)')
     $       ' Fragment from qgsjetII ',nptl,' id :',idptl(nptl)
     $  , ' momentum :',(pptl(k,nptl),k=1,5)

          enddo
        endif

c make the projectile spectators as free nucleons

      else
        ns=0
        if(NSF.gt.0)then
          do is=1,NSF           !count the number of spectators
            ns=ns+IAF(is)
          enddo
          if(infragm.eq.1)then
c  remaining nucleus is one fragment
            nptl=nptl+1
            istptl(nptl)=0
            pptl(1,nptl)=0.d0
            pptl(2,nptl)=0.d0
            pptl(4,nptl)=0.d0
            inucl=0
            do is=1,ns
              inucl=inucl+1
              pptl(4,nptl)=pptl(4,nptl)+pptl(4,is)
            enddo
            iprot= int(dble(inucl) / 2.15d0 + 0.7d0)
            idnucl=1000000000+iprot*10000+inucl*10 !code for nuclei
            call idmass(idnucl,am)
            pptl(5,nptl)=am  !mass
            ptot=(pptl(4,nptl)+am)*(pptl(4,nptl)-am)
            pptl(3,nptl)=sqrt(ptot)
            ityptl(nptl)=0
            istptl(nptl)=0
            iorptl(nptl)=1
            jorptl(nptl)=maproj
            ifrptl(1,nptl)=0
            ifrptl(2,nptl)=0
            xorptl(1,nptl)=xorptl(1,1)
            xorptl(2,nptl)=xorptl(2,1)
            xorptl(3,nptl)=xorptl(3,1)
            xorptl(4,nptl)=xorptl(4,1)
            tivptl(1,nptl)=tivptl(1,1)
            tivptl(2,nptl)=tivptl(2,1)
            idptl(nptl)=idnucl
          else
            do is=1,ns          !make the ns first projectile nucleon actives
              istptl(is)=0
            enddo
          endif
        endif
      endif

c restore target spectators
      ns=0
      if(NWT.lt.matarg)then
        ns=matarg-NWT
        do is=maproj+1,maproj+ns  !make the ns first target nucleon actives
          istptl(is)=0
        enddo
      endif


      do is=1,nsp

c ich is the type of secondary hadron, esp - its transverse momentum,
c and its energy
c the following notations for the particles types are used: 0 - pi0, 1 -
c pi+,
c -1 - pi-, 2 - p, -2 - p, 3 - n, -3 - n, 4 - k+, -4 - k-, 5 - k0s, -5 -
c k0l
          ic=ich(is)
          if(ish.ge.7)write(ifch,'(a,i5,a,i5,2a,4(e10.4,1x))')
     $       ' qgsjet particle ',is,' id :',ic,' before conversion'
     $     , ' momentum :',(esp(k,is),k=1,4)

            nptl=nptl+1
            if(nptl.gt.mxptl)call utstop('qgsjet: mxptl too small&')
            id=idtrafo('qgs','nxs',ic)
            if(ish.ge.7)write(ifch,'(a,i5,a,i5,a)')
     $       ' epos particle ',nptl,' id :',id,' after conversion'
            call idmass(id,am)
            

            pptl(1,nptl)=real(esp(3,is)) !P_x
            pptl(2,nptl)=real(esp(4,is)) !P_y
            pptl(3,nptl)=real(esp(2,is)) !P_z
            pptl(4,nptl)=real(esp(1,is)) !E
            pptl(5,nptl)=am              !mass
            istptl(nptl)=0
            ityptl(nptl)=0
            iorptl(nptl)=1
            jorptl(nptl)=maproj+matarg
            ifrptl(1,nptl)=0
            ifrptl(2,nptl)=0
            xorptl(1,nptl)=0.
            xorptl(2,nptl)=0.
            xorptl(3,nptl)=0.
            xorptl(4,nptl)=0.
            tivptl(1,nptl)=0.
            tivptl(2,nptl)=0.
            idptl(nptl)=id

297 298 299
c boost in CMS frame
            call utlob5(yhaha, pptl(1,nptl), pptl(2,nptl)
     .        , pptl(3,nptl), pptl(4,nptl), pptl(5,nptl))
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
            
            if(ish.ge.5)write(ifch,'(a,i5,a,i5,a,4(e10.4,1x),f6.3)')
     $       ' particle from qgsjet ',nptl,' id :',idptl(nptl)
     $  , ' momentum :',(pptl(k,nptl),k=1,5)


      enddo

1000  return

1001  iret=-1 
      goto 1000 

      end

c-----------------------------------------------------------------------
      subroutine conqgsII
c-----------------------------------------------------------------------
c  determines interaction configuration
c-----------------------------------------------------------------------

      include 'epos.inc'
      include 'epos.incems'
      common/geom/rmproj,rmtarg,bmax,bkmx
      common/nucl3/phi,bimp
      common /cncl/xproj(mamx),yproj(mamx),zproj(mamx)
     *            ,xtarg(mamx),ytarg(mamx),ztarg(mamx)
      common/cncl2/diffbpr(mamx,mamx),diffbtg(mamx,mamx)
      common/cncl3/iactpr(mamx),iacttg(mamx)
      common/cfacmss/facmss

      call utpri('cqgsII ',ish,ishini,4)  

      iret=0

c     initialisations
c     ---------------

      vel=tanh(ypjtl-yhaha)+tanh(yhaha)
 
c     determine phi, bimp, coll, iproj, itarg, x/y/zproj, x/y/ztarg
c     ---------------------------------------------------------------


      if(maproj.eq.1.and.matarg.eq.1)then
           
      koll=1
      do n=1,4
        coord(n,1)=0.
      enddo
      bk(1)=bimp
      iproj(1)=1
      itarg(1)=1
      phi=phievt
      xproj(1)=bimp*cos(phi)
      yproj(1)=bimp*sin(phi)
      zproj(1)=0
      xtarg(1)=0
      ytarg(1)=0
      ztarg(1)=0
      lproj(1)=1
      ltarg(1)=1
      lproj3(1)=1
      ltarg3(1)=1
      kproj(1,1)=1
      ktarg(1,1)=1

           else
             
      bx=0
      by=0
      if(maproj.gt.0)then
        phi=phievt
        bimp=bimevt
        bx=cos(phi)*bimp
        by=sin(phi)*bimp
      endif
      if(maproj.eq.0)goto 1000
      koll=0
      do i=1,maproj
      lproj(i)=0
      enddo
      do j=1,matarg
      ltarg(j)=0
      enddo
      do 12 i=1,maproj
      do 11 j=1,matarg
      bij=sqrt((xproj(i)+bx-xtarg(j))**2+(yproj(i)+by-ytarg(j))**2)
      if(ish.ge.7)write(ifch,*)'i_p:',i,' i_t:',j,' b_ij:',bij
      if(bij.gt.bkmx)goto 11                

      if(koll.ge.kollmx)goto 1000
      koll=koll+1

      bk(koll)=bij
      bkx(koll)=xproj(i)+bx-xtarg(j)
      bky(koll)=yproj(i)+by-ytarg(j)
      iproj(koll)=i
      itarg(koll)=j
      lproj(i)=lproj(i)+1
      ltarg(j)=ltarg(j)+1
      kproj(i,lproj(i))=koll
      ktarg(j,ltarg(j))=koll


11    continue
12    continue


      do k=1,koll
        do n=1,4
          coord(n,k)=0.
        enddo
      enddo

          endif

      if(ish.ge.3)write(ifch,*)'koll=',koll
      if(koll.eq.0)goto 1000


c     determine coord
c     --------------- 
      do kl=1,koll
      i=iproj(kl)
      j=itarg(kl)
      dist=ztarg(j)-zproj(i)
      coord(1,kl)=(xproj(i)+xtarg(j))*0.5
      coord(2,kl)=(yproj(i)+ytarg(j))*0.5
      coord(3,kl)=(zproj(i)+ztarg(j))*0.5
      coord(4,kl)=dist/vel
      enddo
      
c     determine number of collisions according glauber model
c     ------------
      nglevt=koll
       
c     exit
c     ----
1000  continue
      if(ish.ge.5)then
      write(ifch,*)'ia,x/y/zproj:'
      do mm=1,maproj
      write(ifch,*)mm,iactpr(mm),xproj(mm),yproj(mm),zproj(mm)
      enddo
      write(ifch,*)'ia,x/y/ztarg:'
      do mm=1,matarg
      write(ifch,*)mm,iacttg(mm),xtarg(mm),ytarg(mm),ztarg(mm)
      enddo
      write(ifch,*)'iret',iret
      endif
      call utprix('cqgsII ',ish,ishini,4)
      return

      end


c------------------------------------------------------------------------------
      function qgsIIcrse(egy,mapro,matar,id)
c------------------------------------------------------------------------------
c inelastic cross section of qgsjet-II 
c (id=0 corresponds to air)
c egy - kinetic energy
c maproj - projec mass number     (1<maproj<64)
c matarg - target mass number     (1<matarg<64)
c------------------------------------------------------------------------------
      include 'epos.inc'
      double precision egyl,qgsect

      qgsIIcrse=0.
      call iclass(idproj,icpro)
      call idmass(1120,amt1)
      call idmass(1220,amt2)
      amtar=0.5*(amt1+amt2)
      if(matar.eq.1)amtar=amt1
      if(mapro.eq.1)then
        call idmass(idproj,ampro)
      else
        ampro=mapro*amtar
      endif
      egyl=dble(egy+ampro)

      if(id.eq.0)then
        do k=1,3
          mt=int(airanxs(k))
          qgsIIcrse=qgsIIcrse+airwnxs(k)*qgsect(egyl,icpro,mapro,mt)
        enddo
      else
        qgsIIcrse=qgsect(egyl,icpro,mapro,matar)
      endif

      return
      end

c--------------------------------------------------------------------
      double precision function qgran(b10)
c--------------------------------------------------------------------
497
c Random number generator
498 499
c--------------------------------------------------------------------
      include 'epos.inc'
500
      double precision b10,drangen
501 502 503 504 505
      qgran=drangen(b10)
      if(irandm.eq.1)write(ifch,*)'qgran()= ',qgran

      return
      end
506