      SUBROUTINE STRPRIV(X,MUF,UPV,DNV,USEA,DSEA,STR,CHM,BOT,TOP,GL)
C ******************************************************************   
C   This routine provides the interface to the H12007JetsDPDF
*   Access through PDFLIB private structure function (1001001)
*   Need common block with xpomeron, delta_xpomeron and DPDF id
*   (see code below)
*
* INPUT:
C                  X  = x-value of parton   
C                MUF  = QCD scale in GeV
* OUTPUT:  UPV,DNV,USEA,DSEA,STR,CHM,BOT,TOP,GL
*
* F-P Schilling, S Schaetzel, M.Mozer 
C ******************************************************************   
      IMPLICIT NONE

      DOUBLE PRECISION X,MUF       
      DOUBLE PRECISION UPV,DNV,USEA,DSEA,STR,CHM,BOT,TOP,GL 

      real rx,rmuf,rxpom
      

      double precision BetaGluonPom,BetaSingletPom
      double precision BetaGluonReg,BetaSingletReg

      integer dpdf,dpdfset,dpdffit,dpdfvar,dpdfopt,i
      logical first
      integer icycle      
      real g,s,c,err
      real flux

cKAREL      real h12007jetsdpdf_gluon,h12007jetsdpdf_singlet,h12007jetsdpdf_charm
cKAREL      external h12007jetsdpdf_gluon,h12007jetsdpdf_singlet,h12007jetsdpdf_charm

cKAREL
      real h12007jetsdpdf_gluon
      external h12007jetsdpdf_gluon
      real h12007jetsdpdf_singlet
      external h12007jetsdpdf_singlet
      real h12007jetsdpdf_charm
      external h12007jetsdpdf_charm
cKAREL

      real h12007jetsdpdf_prcoeff
      external h12007jetsdpdf_prcoeff
      integer ityp
*      data first /.true./
*      save first

      Double Precision xpq
      DIMENSION XPQ(-6:6)


* common block: xpomeron (=xpom), delta_xpomeron (=scal) , diffractive PDF id (=idpdf)
* fill from steering
      Double Precision scal,xpom
      integer idpdf
      common/adster/scal,xpom,idpdf,first
      data icycle /0/
      save icycle,ityp

      GL   = 0.d0
      DNV  = 0.d0
      UPV  = 0.d0       
      DSEA = 0.d0
      USEA = 0.d0
      STR  = 0.d0
      CHM  = 0.d0
      BOT  = 0.d0
      TOP  = 0.d0

      DO I=-6,6
         XPQ(I)=0.D0
      ENDDO

      rx=x
      rxpom=xpom
      rmuf=muf

      if (first) then
         first=.false.

         icycle=0
         ityp=1

         g=h12007jetsdpdf_gluon(x,muf*muf,icycle)
         s=h12007jetsdpdf_singlet(x,muf*muf,icycle)
         c=h12007jetsdpdf_charm(x,muf*muf,'',icycle) 
c     KAREL 
         dpdf=abs(idpdf)
         dpdfopt=int(dpdf/1000)
         dpdf=dpdf-dpdfopt*1000
         dpdfset=int(dpdf/100)
         dpdf=dpdf-dpdfset*100
         dpdffit=int(dpdf/10)
         dpdf=dpdf-dpdffit*10
         dpdfvar=dpdf
         print *,'STRPRIV: values for DPDFLib opt,set,fit,var',
     +        dpdfopt,dpdfset,dpdffit,dpdfvar
         call dpdf_init(dpdfset,dpdffit,dpdfvar)
cKAREL
      endif


cKAREL
      dpdf=abs(idpdf)
      dpdfopt=int(dpdf/1000)
      ityp=dpdfopt
cKAREL


* get IP-Flux
      flux=h12007jetsdpdf_prcoeff(ityp,rxpom)


      g=h12007jetsdpdf_gluon(x,muf*muf,icycle)
      s=h12007jetsdpdf_singlet(x,muf*muf,icycle)
      c=h12007jetsdpdf_charm(x,muf*muf,'',icycle) 

      xpq(0)=g      *flux      ! correct h12007jetsdpdf_gluon desnisty for flux
      xpq(1)=s/6.d0 *flux      !
      xpq(2)=s/6.d0 *flux      ! h12007jetsdpdf_singletlet -> quark-density
      xpq(3)=s/6.d0 *flux      ! 
      xpq(4)=c*9.d0/8.d0 *flux ! structurfn -> density

      do i=-6,6
         xpq(i)=xpq(i)*scal
      enddo

      UPV  = 0
      DNV  = 0
      USEA = XPQ(1)
      DSEA = XPQ(2)
      STR  = XPQ(3)
      CHM  = XPQ(4)
      BOT  = XPQ(5)
      TOP  = XPQ(6)
      GL   = XPQ(0)

      RETURN
      END
