]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - THerwig/AliGenHerwig.cxx
renamed CorrectionMatrix class
[u/mrichter/AliRoot.git] / THerwig / AliGenHerwig.cxx
index b0f294e00e65b0843551dac84c5ce44ef8237220..58dde0daa45e87cc110a813e903d81044f675d26 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.4  2002/10/14 14:55:35  hristov
-Merging the VirtualMC branch to the main development branch (HEAD)
-
-Revision 1.2.2.3  2002/10/11 10:40:46  hristov
-Default case added
-
-Revision 1.2.2.2  2002/07/26 18:34:02  alibrary
-Updating VirtualMC
-
-Revision 1.3  2002/07/26 15:32:24  hristov
-stream.h doesn't exest on Sun, removed from includes
-
-Revision 1.2  2002/07/19 11:43:10  morsch
-- Write full stack.
-- Use SetTrack passing energy.
-
-Revision 1.1  2002/07/16 11:33:26  morsch
-First commit.
-
-*/
-
+/* $Id$ */
 
 
 // Generator using Herwig as an external generator
@@ -43,16 +21,41 @@ First commit.
 // Uses the THerwig implementation of TGenerator.
 
 #include "AliGenHerwig.h"
+#include "AliHerwigRndm.h"
 #include "AliRun.h"
 
 #include <TParticle.h>
 #include "THerwig6.h"
 
 #include "Riostream.h"
-
- ClassImp(AliGenHerwig)
-
-AliGenHerwig::AliGenHerwig()
+#include "AliMC.h"
+
+ClassImp(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
 }
@@ -69,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);
 }
 
 
@@ -95,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
@@ -222,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->SetTrack(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;
            }
        }
@@ -257,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);
     }
 }
@@ -337,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();}
-}