]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - THerwig/AliGenHerwig.cxx
JYMMY includes.
[u/mrichter/AliRoot.git] / THerwig / AliGenHerwig.cxx
index 6f15f6ee2e049bede770ab413de231086a10ad0b..2753e0d40afaca268fbfbe2de3fecefd54e237cd 100644 (file)
 // Uses the THerwig implementation of TGenerator.
 
 #include "AliGenHerwig.h"
+#include "AliHerwigRndm.h"
 #include "AliRun.h"
 
 #include <TParticle.h>
 #include "THerwig6.h"
 
 #include "Riostream.h"
+#include "AliMC.h"
+
+#include "driver.h"
 
 ClassImp(AliGenHerwig)
 
-static TRandom * sRandom;
 
-AliGenHerwig::AliGenHerwig()
+  AliGenHerwig::AliGenHerwig() :
+    AliGenMC(),
+    fAutPDF("GRV"),
+    fModPDF(5),
+    fStrucFunc(kCTEQ5L),
+    fKeep(0),
+    fDecaysOff(1),
+    fTrigger(0),
+    fSelectAll(0),
+    fFlavor(0),
+    fEnergyCMS(14000),
+    fMomentum1(7000),
+    fMomentum2(7000),
+    fKineBias(1),
+    fTrials(0),
+    fXsection(0),
+    fHerwig(0x0),
+    fProcess(0),
+    fPtHardMin(0.),
+    fPtRMS(0.),
+    fMaxPr(10),
+    fMaxErrors(1000),
+    fEnSoft(1),
+    fEv1Pr(0),
+    fEv2Pr(0),
+    fFileName(0)
 {
 // Constructor
 }
 
 AliGenHerwig::AliGenHerwig(Int_t npart)
-    :AliGenMC(npart)
+    :AliGenMC(npart),
+    fAutPDF("GRV"),
+    fModPDF(5),
+    fStrucFunc(kCTEQ5L),
+    fKeep(0),
+    fDecaysOff(1),
+    fTrigger(0),
+    fSelectAll(0),
+    fFlavor(0),
+    fEnergyCMS(14000),
+    fMomentum1(7000),
+    fMomentum2(7000),
+    fKineBias(1),
+    fTrials(0),
+    fXsection(0),
+    fHerwig(0x0),
+    fProcess(0),
+    fPtHardMin(0.),
+    fPtRMS(0.),
+    fMaxPr(10),
+    fMaxErrors(1000),
+    fEnSoft(1),
+    fEv1Pr(0),
+    fEv2Pr(0),
+    fFileName(0)
 {
-    SetBeamMomenta();
     SetTarget();
     SetProjectile();
-    SetStrucFunc(kGRVLO98);
-    fKeep=0;
-    fTrigger=0;
-    fDecaysOff=1;
-    fSelectAll=0;
-    fFlavor=0;
-    fPtHardMin=10.;
-    fPtRMS=0.0;
-    fEnSoft=1.0;
-    fMaxPr=1;
-    fMaxErrors=1000;
-//  Set random number
-    if (!sRandom) sRandom=fRandom;
+    // Set random number generator   
+    AliHerwigRndm::SetHerwigRandom(GetRandom());
 }
 
 AliGenHerwig::AliGenHerwig(const AliGenHerwig & Herwig)
-    :AliGenMC(Herwig)
+    :AliGenMC(Herwig),
+    fAutPDF("GRV"),
+    fModPDF(5),
+    fStrucFunc(kCTEQ5L),
+    fKeep(0),
+    fDecaysOff(1),
+    fTrigger(0),
+    fSelectAll(0),
+    fFlavor(0),
+    fEnergyCMS(14000),
+    fMomentum1(7000),
+    fMomentum2(7000),
+    fKineBias(1),
+    fTrials(0),
+    fXsection(0),
+    fHerwig(0x0),
+    fProcess(0),
+    fPtHardMin(0.),
+    fPtRMS(0.),
+    fMaxPr(10),
+    fMaxErrors(1000),
+    fEnSoft(1),
+    fEv1Pr(0),
+    fEv2Pr(0),
+    fFileName(0)
 {
 // Copy constructor
     Herwig.Copy(*this);
@@ -71,6 +135,13 @@ AliGenHerwig::~AliGenHerwig()
 // Destructor
 }
 
+void AliGenHerwig::SetEventListRange(Int_t eventFirst, Int_t eventLast)
+{
+  fEv1Pr = ++eventFirst;
+  fEv2Pr = ++eventLast;
+  if ( fEv2Pr == -1 ) fEv2Pr = fEv2Pr;
+}
+
 void AliGenHerwig::Init()
 {
 // Initialisation
@@ -87,6 +158,26 @@ void AliGenHerwig::Init()
   fHerwig->SetMAXPR(fMaxPr);
   fHerwig->SetMAXER(fMaxErrors);
   fHerwig->SetENSOF(fEnSoft);
+  
+  fHerwig->SetEV1PR(fEv1Pr);
+  fHerwig->SetEV2PR(fEv2Pr);
+
+// C---D,U,S,C,B,T QUARK AND GLUON MASSES (IN THAT ORDER)
+//       RMASS(1)=0.32
+//       RMASS(2)=0.32
+//       RMASS(3)=0.5
+//       RMASS(4)=1.55
+//       RMASS(5)=4.95
+//       RMASS(6)=174.3
+//       RMASS(13)=0.75
+
+  fHerwig->SetRMASS(4,1.2);
+  fHerwig->SetRMASS(5,4.75);
+  
+  if ( fProcess < 0 ) strncpy(VVJIN.QQIN,fFileName.Data(),50);
+
+  fHerwig->Hwusta("PI0     ");
+
   // compute parameter dependent constants
   fHerwig->PrepareRun();
 }
@@ -95,34 +186,34 @@ void AliGenHerwig::InitPDF()
 {
   switch(fStrucFunc)
     {
-    case kGRVLO:
-      fModPDF=5;
-      fAutPDF="GRV";
-      break;
-    case kGRVHO:
-      fModPDF=6;
-      fAutPDF="GRV";
-      break;
+//    case kGRVLO:
+//      fModPDF=5;
+//      fAutPDF="GRV";
+//      break;
+//    case kGRVHO:
+//      fModPDF=6;
+//      fAutPDF="GRV";
+//      break;
     case kGRVLO98:
       fModPDF=12;
       fAutPDF="GRV";
       break;
-    case kMRSDminus:
-      fModPDF=31;
-      fAutPDF="MRS";
-      break;
-    case kMRSD0:
-      fModPDF=30;
-      fAutPDF="MRS";
-      break;
-    case kMRSG:
-      fModPDF=41;
-      fAutPDF="MRS";
-      break;
-    case kMRSTcgLO:
-      fModPDF=72;
-      fAutPDF="MRS";
-      break;
+//    case kMRSDminus:
+//      fModPDF=31;
+//      fAutPDF="MRS";
+//      break;
+//    case kMRSD0:
+//      fModPDF=30;
+//      fAutPDF="MRS";
+//      break;
+//    case kMRSG:
+//      fModPDF=41;
+//      fAutPDF="MRS";
+//      break;
+//    case kMRSTcgLO:
+//      fModPDF=72;
+//      fAutPDF="MRS";
+//      break;
     case kCTEQ4M:
       fModPDF=34;
       fAutPDF="CTEQ";
@@ -131,6 +222,10 @@ void AliGenHerwig::InitPDF()
       fModPDF=46;
       fAutPDF="CTEQ";
       break;
+//    case kCTEQ5M:
+//      fModPDF=48;
+//      fAutPDF="CTEQ";
+//      break;
     default:
       cerr << "This structure function is not inplemented " << fStrucFunc << endl;
       break;
@@ -204,26 +299,22 @@ void AliGenHerwig::Generate()
                Float_t tof = kconv*iparticle->T();
                Int_t   iparent = (imo > -1) ? newPos[imo] : -1;
                Int_t   trackIt = (ks == 1) && fTrackIt;
-               gAlice->PushTrack(trackIt, iparent, kf,
-                                p[0], p[1], p[2], p[3],
-                                origin[0], origin[1], origin[2], 
-                                tof,
-                                polar[0], polar[1], polar[2],
-                                kPPrimary, nt, 1., ks);
+               PushTrack(trackIt, iparent, kf,
+                         p[0], p[1], p[2], p[3],
+                         origin[0], origin[1], origin[2], 
+                         tof,
+                         polar[0], polar[1], polar[2],
+                         kPPrimary, nt, fHerwig->GetEVWGT(), ks);
                KeepTrack(nt);
                newPos[i]=nt;
            } // end of if: selection of particle
        } // end of for: particle loop
        if (newPos) delete[] newPos;
-       printf("\n I've put %i particles on the stack \n",nc);
        //      MakeHeader();
-       printf("nc: %d %d\n", nc, fNpart);
-       
        if (nc > 0) {
            jev+=nc;
            if (jev >= fNpart || fNpart == -1) {
                fKineBias=Float_t(fNpart)/Float_t(fTrials);
-               printf("\n Trials: %i %i %i\n",fTrials, fNpart, jev);
                break;
            }
        }
@@ -239,9 +330,9 @@ void AliGenHerwig::AdjustWeights()
 {
 // Adjust the weights after generation of all events
     TParticle *part;
-    Int_t ntrack=gAlice->GetNtrack();
+    Int_t ntrack=gAlice->GetMCApp()->GetNtrack();
     for (Int_t i=0; i<ntrack; i++) {
-        part= gAlice->Particle(i);
+        part= gAlice->GetMCApp()->Particle(i);
         part->SetWeight(part->GetWeight()*fKineBias);
     }
 }
@@ -324,6 +415,3 @@ AliGenHerwig& AliGenHerwig::operator=(const  AliGenHerwig& rhs)
 }
 
 
-extern "C" {
-  Double_t hwr_() {return sRandom->Rndm();}
-}