]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - THerwig/AliGenHerwig.cxx
(martin) pt vs eta correction matrix calculation macro using CorrectionMatrix2D class.
[u/mrichter/AliRoot.git] / THerwig / AliGenHerwig.cxx
index ddf1f6a903946ccc1e8b0eef36c986578f64ec60..58dde0daa45e87cc110a813e903d81044f675d26 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"
 
- ClassImp(AliGenHerwig)
+ClassImp(AliGenHerwig)
 
-static TRandom * sRandom;
 
-AliGenHerwig::AliGenHerwig()
+  AliGenHerwig::AliGenHerwig() :
+    AliGenMC(),
+    fAutPDF("GRV"),
+    fModPDF(5),
+    fStrucFunc(kGRVHO),
+    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)
 {
 // Constructor
 }
@@ -49,18 +72,20 @@ AliGenHerwig::AliGenHerwig(Int_t npart)
     fDecaysOff=1;
     fSelectAll=0;
     fFlavor=0;
-    fPtHardMin=10.;
+    fPtHardMin=0.;
     fPtRMS=0.0;
     fEnSoft=1.0;
-    fMaxPr=1;
+    fMaxPr=10;
     fMaxErrors=1000;
-//  Set random number
-    if (!sRandom) sRandom=fRandom;
+    // Set random number generator   
+    AliHerwigRndm::SetHerwigRandom(GetRandom());
 }
 
 AliGenHerwig::AliGenHerwig(const AliGenHerwig & Herwig)
+    :AliGenMC(Herwig)
 {
-// copy constructor
+// Copy constructor
+    Herwig.Copy(*this);
 }
 
 
@@ -75,7 +100,7 @@ void AliGenHerwig::Init()
   fTarget.Resize(8);
   fProjectile.Resize(8);
   SetMC(new THerwig6());
-  fHerwig=(THerwig6*) fgMCEvGen;
+  fHerwig=(THerwig6*) fMCEvGen;
   // initialize common blocks
   fHerwig->Initialize(fProjectile, fTarget, fMomentum1, fMomentum2, fProcess);
   // reset parameters according to user needs
@@ -202,26 +227,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, 1., 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;
            }
        }
@@ -237,9 +258,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);
     }
 }
@@ -317,10 +338,8 @@ void AliGenHerwig::FinishRun()
 AliGenHerwig& AliGenHerwig::operator=(const  AliGenHerwig& rhs)
 {
 // Assignment operator
-    return *this;
+    rhs.Copy(*this);
+    return (*this);
 }
 
 
-extern "C" {
-  Double_t hwr_() {return sRandom->Rndm();}
-}