]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenPythia.cxx
Have to create Digits trees and branches by hand in the case of multiple event files.
[u/mrichter/AliRoot.git] / EVGEN / AliGenPythia.cxx
index 4f7480a372fb81ebba73bf9e8ed279cc45cd3ea1..83b4e18d316998223f06c044d8fa5e2fba59f9eb 100644 (file)
 
 /*
 $Log$
+Revision 1.32  2001/01/26 19:55:51  hristov
+Major upgrade of AliRoot code
+
+Revision 1.31  2001/01/17 10:54:31  hristov
+Better protection against FPE
+
+Revision 1.30  2000/12/18 08:55:35  morsch
+Make AliPythia dependent generartors work with new scheme of random number generation
+
+Revision 1.29  2000/12/04 11:22:03  morsch
+Init of sRandom as in 1.15
+
+Revision 1.28  2000/12/02 11:41:39  morsch
+Use SetRandom() to initialize random number generator in constructor.
+
+Revision 1.27  2000/11/30 20:29:02  morsch
+Initialise static variable sRandom in constructor: sRandom = fRandom;
+
+Revision 1.26  2000/11/30 07:12:50  alibrary
+Introducing new Rndm and QA classes
+
+Revision 1.25  2000/10/18 19:11:27  hristov
+Division by zero fixed
+
+Revision 1.24  2000/09/18 10:41:35  morsch
+Add possibility to use nuclear structure functions from PDF library V8.
+
+Revision 1.23  2000/09/14 14:05:40  morsch
+dito
+
 Revision 1.22  2000/09/14 14:02:22  morsch
 - Correct conversion from mm to cm when passing particle vertex to MC.
 - Correct handling of fForceDecay == all.
@@ -83,6 +113,8 @@ AliGenPythia::AliGenPythia(Int_t npart)
 // structure function GRVHO
 //
     fXsection  = 0.;
+    fNucA1=0;
+    fNucA2=0;
     fParentSelect.Set(5);
     fChildSelect.Set(5);
     for (Int_t i=0; i<5; i++) fParentSelect[i]=fChildSelect[i]=0;
@@ -92,6 +124,8 @@ AliGenPythia::AliGenPythia(Int_t npart)
     SetPtHard();
     SetEnergyCMS();
     fDecayer = new AliDecayerPythia();
+    // Set random number generator 
+    sRandom=fRandom;
 }
 
 AliGenPythia::AliGenPythia(const AliGenPythia & Pythia)
@@ -123,6 +157,7 @@ void AliGenPythia::Init()
 
     fPythia->SetCKIN(3,fPtHardMin);
     fPythia->SetCKIN(4,fPtHardMax);    
+    if (fNucA1 > 0 && fNucA2 > 0) fPythia->SetNuclei(fNucA1, fNucA2);  
     fPythia->ProcInit(fProcess,fEnergyCMS,fStrucFunc);
 
     //    fPythia->Pylist(0);
@@ -262,7 +297,8 @@ void AliGenPythia::Generate()
                            pP[3] = massP;
                            gAlice->SetTrack(0,-1,-1,
                                             pP,originP,polar,
-                                            0,"Hard Scat.",ntP,fParentWeight);
+                                            0,kPPrimary,ntP,fParentWeight);
+//                                          0,"Hard Scat.",ntP,fParentWeight);
                            gAlice->KeepTrack(ntP);
                        }
                        nc++;
@@ -283,7 +319,7 @@ void AliGenPythia::Generate()
                          if (fForceDecay == nodecay) trackit = 1;
                            gAlice->SetTrack(trackit,ntP,kf,
                                             p,origin,polar,
-                                            0,"Primary",nt,fParentWeight);
+                                            0,kPPrimary,nt,fParentWeight);
                            gAlice->KeepTrack(nt);
                            Int_t iparent = nt;
 //
@@ -306,7 +342,7 @@ void AliGenPythia::Generate()
                                    Float_t tof=kconv*ichild->T();
                                    gAlice->SetTrack(fTrackIt, iparent, kf,
                                                     p,origin,polar,
-                                                    tof,"Decay",nt,fChildWeight);
+                                                    tof,kPDecay,nt,fChildWeight);
                                    gAlice->KeepTrack(nt);
                                  } // select child
                                } // child loop
@@ -333,7 +369,7 @@ void AliGenPythia::Generate()
                        origin[2]=origin0[2]+iparticle->Vz()/10.;
                        Float_t tof=kconv*iparticle->T();
                        gAlice->SetTrack(fTrackIt,-1,kf,p,origin,polar,
-                                        tof,"Primary",nt);
+                                        tof,kPPrimary,nt);
                        gAlice->KeepTrack(nt);
                } // select particle
            } // particle loop 
@@ -344,6 +380,8 @@ void AliGenPythia::Generate()
            if (jev >= fNpart || fNpart == -1) {
                fKineBias=Float_t(fNpart)/Float_t(fTrials);
                printf("\n Trials: %i %i %i\n",fTrials, fNpart, jev);
+// Print x-section summary
+               fPythia->Pystat(1);
                break;
            }
        }
@@ -412,11 +450,16 @@ Bool_t AliGenPythia::KinematicSelection(TParticle *particle)
 
 //
 // rapidity cut
-    Float_t y = 0.5*TMath::Log((e+pz)/(e-pz));
-    if (y > fYMax || y < fYMin)
-    {
+    if ( (e-pz)<=0 || (e+pz)<=0 ) {
+      return kFALSE;
+    }
+    else {
+      Float_t y = 0.5*TMath::Log((e+pz)/(e-pz));
+      if (y > fYMax || y < fYMin)
+        {
 //     printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax);
-       return kFALSE;
+          return kFALSE;
+        }
     }
 
 //
@@ -434,11 +477,10 @@ void AliGenPythia::AdjustWeights()
 {
 // Adjust the weights after generation of all events
 //
-    TClonesArray *partArray = gAlice->Particles();
     TParticle *part;
     Int_t ntrack=gAlice->GetNtrack();
     for (Int_t i=0; i<ntrack; i++) {
-       part= (TParticle*) partArray->UncheckedAt(i);
+       part= gAlice->Particle(i);
        part->SetWeight(part->GetWeight()*fKineBias);
     }
 }
@@ -475,7 +517,16 @@ Int_t AliGenPythia::CheckPDGCode(Int_t pdgcode)
   //non diffractive state -- return code unchanged
   return pdgcode;
 }
-                 
+
+    
+void AliGenPythia::SetNuclei(Int_t a1, Int_t a2)
+{
+// Treat protons as inside nuclei with mass numbers a1 and a2  
+    fNucA1 = a1;
+    fNucA2 = a2;
+}
+       
+         
 AliGenPythia& AliGenPythia::operator=(const  AliGenPythia& rhs)
 {
 // Assignment operator
@@ -483,6 +534,8 @@ AliGenPythia& AliGenPythia::operator=(const  AliGenPythia& rhs)
 }
 
 
+
+#ifdef never
 void AliGenPythia::Streamer(TBuffer &R__b)
 {
    // Stream an object of class AliGenPythia.
@@ -521,11 +574,5 @@ void AliGenPythia::Streamer(TBuffer &R__b)
       //     fDecayer->Streamer(R__b);
    }
 }
-
-
-
-
-
-
-
+#endif