]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
correct event rejection and initialisation
authormorsch <andreas.morsch@cern.ch>
Wed, 12 Nov 2014 18:09:03 +0000 (19:09 +0100)
committermorsch <andreas.morsch@cern.ch>
Wed, 12 Nov 2014 18:14:22 +0000 (19:14 +0100)
DIME/TDime.cxx
DIME/dimemcv1.05.f

index a4dd8b39ac3d2a4adadb4511e974537ceb5aef2b..d6c24b1d1c475934e89c7d6960c7b2e9c646362a 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef WIN32
 extern "C" void type_of_call dimeinit();
-extern "C" void type_of_call dimegenerate();
+extern "C" void type_of_call dimegenerate(int& success);
 #else
 #endif
 
@@ -94,7 +94,9 @@ TDime::~TDime()
 
 void  TDime::GenerateEvent()
 {
-   dimegenerate();
+  Int_t ok = 0;
+  while(!ok)
+    dimegenerate(ok);
    //for (Int_t i = 0; i < HEPEUP.NUP; i++) {
    //printf("%5d %5d %5d %5d %5d %13.3f %13.3f\n", i, 
    //   HEPEUP.IDUP[i], HEPEUP.ISTUP[i], HEPEUP.MOTHUP[i][0],
index 907975e6ddcc95a71111a499a1691e480cfd0c7e..6226417f7faf5186c6053ef973519a5bf2235755 100644 (file)
@@ -163,8 +163,8 @@ ccAM      iin=1           ! Model for soft survival factor, as described in arXi
           write(6,*) "*************************************************"
 cccccccc
 
-ccAM      ntotal=1000000            ! no. of runs for weighted events
-ccAM      nev=100                  ! no. of unweighted events generated to event record
+          ntotal=1000000             ! no. of runs for weighted events
+          nev=100                    ! no. of unweighted events generated to event record
 
 ccccccccc
 
@@ -512,31 +512,24 @@ ccc   HEPEVT
       else
          lmax=1
       endif
-
-c      do ll=1,lmax
-      ll = 2
-      if(ll.eq.2)then
-c         ntotal=nev*10
-         ntotal=1000000000
-      endif
-
+c
+c
+c     first  generate weighted events first
+      ll = 1 
       ip=ntotal+1
-
-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
-c                                                       c
-c     Start of event loop                               c
-c                                                       c
-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
-
-      if(ll.eq.1)then
-         write(6,*)'Generating weighted events...'
-      else
-        write(6,*)'Generating unweighted events...'
-      endif
+      write(6,*)'Generating weighted events...'
+      do i=1, ntotal
+         isuc = 0
+         call dimegenerate(isuc)
+      enddo
+c     prepare for unweighted generation      
+      ll = 2
+      write(6,*)'Generating unweighted events...'
+c
       return
       end
       
-      subroutine dimegenerate
+      subroutine dimegenerate(isuccess)
       implicit none
       
 ccccc hepevt output
@@ -610,8 +603,9 @@ cccccc local variables ...
       double precision pboo(4), pcm(4), plb(4)
       double precision svec(4)
       complex*16 zmat
-      integer h, i, j, k, ntotal
+      integer h, i, j, k, ntotal, isuccess
       weight=0d0
+      isuccess = 0
       call r2455(ran0)
       call r2455(ran1)
       call r2455(ran2)
@@ -870,7 +864,6 @@ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
 c      place cuts
 
          if(cuts.eq.'true')then
-
             call cut(icut)
             
             if(icut.eq.0)then
@@ -1050,7 +1043,7 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccc
          call r2455(ranhist)
          
          if(ranhist.lt.weight/weightm)then
-            
+            isuccess = 1
             xwgtup=1d0
 
             num=num+1
@@ -1089,9 +1082,7 @@ c            call binit(sumt/nev)
       if(num.gt.nev-1)then  ! exit loop once required no. of unweighted events generated
 
          ntotal=i
-!         goto 888
-c         call terminate(ntotal)
-
+         return
       endif
       endif