]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenPythia.cxx
AliMUONTrackReconstructor and FORTRAN code removed.
[u/mrichter/AliRoot.git] / EVGEN / AliGenPythia.cxx
index 0823c955a1295d37d8619c32bdc1bd4b6d19b92b..088ace7cd58933a567f33db3f16892064af2c797 100644 (file)
 
 /*
 $Log$
+Revision 1.35  2001/03/09 13:03:40  morsch
+Process_t and Struc_Func_t moved to AliPythia.h
+
+Revision 1.34  2001/02/14 15:50:40  hristov
+The last particle in event marked using SetHighWaterMark
+
+Revision 1.33  2001/01/30 09:23:12  hristov
+Streamers removed (R.Brun)
+
+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.
 
@@ -153,62 +174,62 @@ void AliGenPythia::Init()
 //  Parent and Children Selection
     switch (fProcess) 
     {
-    case charm:
-
+    case kPyCharm:
        fParentSelect[0]=411;
        fParentSelect[1]=421;
        fParentSelect[2]=431;
        fParentSelect[3]=4122;  
        break;
-    case charm_unforced:
-
+    case kPyCharmUnforced:
        fParentSelect[0]=411;
        fParentSelect[1]=421;
        fParentSelect[2]=431;
        fParentSelect[3]=4122;  
        break;
-    case beauty:
+    case kPyBeauty:
        fParentSelect[0]=511;
        fParentSelect[1]=521;
        fParentSelect[2]=531;
        fParentSelect[3]=5122;  
        break;
-    case beauty_unforced:
+    case kPyBeautyUnforced:
        fParentSelect[0]=511;
        fParentSelect[1]=521;
        fParentSelect[2]=531;
        fParentSelect[3]=5122;  
        break;
-    case jpsi_chi:
-    case jpsi:
+    case kPyJpsiChi:
+    case kPyJpsi:
        fParentSelect[0]=443;
        break;
-    case mb:
+    case kPyMb:
+    case kPyJets:
+    case kPyDirectGamma:
        break;
     }
 
     switch (fForceDecay) 
     {
-    case semielectronic:
-    case dielectron:
-    case b_jpsi_dielectron:
-    case b_psip_dielectron:
+    case kSemiElectronic:
+    case kDiElectron:
+    case kBJpsiDiElectron:
+    case kBPsiPrimeDiElectron:
        fChildSelect[0]=kElectron;      
        break;
-    case semimuonic:
-    case dimuon:
-    case b_jpsi_dimuon:
-    case b_psip_dimuon:
-    case pitomu:
-    case katomu:
+    case kSemiMuonic:
+    case kDiMuon:
+    case kBJpsiDiMuon:
+    case kBPsiPrimeDiMuon:
+    case kPiToMu:
+    case kKaToMu:
        fChildSelect[0]=kMuonMinus;
        break;
-    case hadronicD:
+    case kHadronicD:
       fChildSelect[0]=kPiPlus;
       fChildSelect[1]=kKPlus;
       break;
-    case all:
-    case nodecay:
+    case kAll:
+    case kNoDecay:
       break;
     }
 }
@@ -218,10 +239,10 @@ void AliGenPythia::Generate()
 // Generate one event
     fDecayer->ForceDecay();
 
-    Float_t polar[3] =   {0,0,0};
-    Float_t origin[3]=   {0,0,0};
-    Float_t originP[3]= {0,0,0};
-    Float_t origin0[3]=  {0,0,0};
+    Float_t polar[3]   =   {0,0,0};
+    Float_t origin[3]  =   {0,0,0};
+    Float_t originP[3] =   {0,0,0};
+    Float_t origin0[3] =   {0,0,0};
     Float_t p[3], pP[4];
 //    Float_t random[6];
     static TClonesArray *particles;
@@ -258,7 +279,7 @@ void AliGenPythia::Generate()
        printf("\n **************************************************%d\n",np);
        Int_t nc=0;
        if (np == 0 ) continue;
-       if (fProcess != mb) {
+       if (fProcess != kPyMb && fProcess != kPyJets && fProcess != kPyDirectGamma) {
            for (Int_t i = 0; i<np-1; i++) {
                TParticle *  iparticle = (TParticle *) particles->At(i);
                Int_t ks = iparticle->GetStatusCode();
@@ -302,9 +323,9 @@ void AliGenPythia::Generate()
                        Int_t ifch=iparticle->GetFirstDaughter();
                        Int_t ilch=iparticle->GetLastDaughter();        
 
-                       if ((ifch !=0 && ilch !=0) || fForceDecay == nodecay) {
+                       if ((ifch !=0 && ilch !=0) || fForceDecay == kNoDecay) {
                          Int_t trackit=0;
-                         if (fForceDecay == nodecay) trackit = 1;
+                         if (fForceDecay == kNoDecay) trackit = 1;
                            gAlice->SetTrack(trackit,ntP,kf,
                                             p,origin,polar,
                                             0,kPPrimary,nt,fParentWeight);
@@ -312,7 +333,7 @@ void AliGenPythia::Generate()
                            Int_t iparent = nt;
 //
 // Children        
-                           if (fForceDecay != nodecay) {
+                           if (fForceDecay != kNoDecay) {
                              for (j=ifch; j<=ilch; j++)
                                {
                                  TParticle *  ichild = 
@@ -327,38 +348,41 @@ void AliGenPythia::Generate()
                                    p[0]=ichild->Px();
                                    p[1]=ichild->Py();
                                    p[2]=ichild->Pz();
-                                   Float_t tof=kconv*ichild->T();
-                                   gAlice->SetTrack(fTrackIt, iparent, kf,
-                                                    p,origin,polar,
-                                                    tof,kPDecay,nt,fChildWeight);
-                                   gAlice->KeepTrack(nt);
-                                 } // select child
-                               } // child loop
-                           } 
-                       }
-                   } // kinematic selection
-               } // select particle
-           } // particle loop
-       } else {
-           for (Int_t i = 0; i<np-1; i++) {
-               TParticle *  iparticle = (TParticle *) particles->At(i);
-               kf = CheckPDGCode(iparticle->GetPdgCode());
-               Int_t ks = iparticle->GetStatusCode();
-
-               if (ks==1 && kf!=0 && KinematicSelection(iparticle)) {
-                       nc++;
+                                   Float_t tof=kconv*ichild->T();
+                                   gAlice->SetTrack(fTrackIt, iparent, kf,
+                                                    p,origin,polar,
+                                                    tof,kPDecay,nt,fChildWeight);
+                                   gAlice->KeepTrack(nt);
+                                 } // select child
+                               } // child loop
+                           } 
+                       }
+                   } // kinematic selection
+               } // select particle
+           } // particle loop
+       } else {
+           for (Int_t i = 0; i<np-1; i++) {
+               TParticle *  iparticle = (TParticle *) particles->At(i);
+               kf = CheckPDGCode(iparticle->GetPdgCode());
+               Int_t ks = iparticle->GetStatusCode();
+               Int_t km = iparticle->GetFirstMother();
+               //      printf("\n process %d %d\n", ks,km);
+               
+               if ((ks==1 && kf!=0 && KinematicSelection(iparticle)) ||
+                   (fProcess == kPyJets && ks == 21 && km == 0 && i>1)) {
+                   nc++;
 //
 // store track information
-                       p[0]=iparticle->Px();
-                       p[1]=iparticle->Py();
-                       p[2]=iparticle->Pz();
-                       origin[0]=origin0[0]+iparticle->Vx()/10.;
-                       origin[1]=origin0[1]+iparticle->Vy()/10.;
-                       origin[2]=origin0[2]+iparticle->Vz()/10.;
-                       Float_t tof=kconv*iparticle->T();
-                       gAlice->SetTrack(fTrackIt,-1,kf,p,origin,polar,
-                                        tof,kPPrimary,nt);
-                       gAlice->KeepTrack(nt);
+                   p[0]=iparticle->Px();
+                   p[1]=iparticle->Py();
+                   p[2]=iparticle->Pz();
+                   origin[0]=origin0[0]+iparticle->Vx()/10.;
+                   origin[1]=origin0[1]+iparticle->Vy()/10.;
+                   origin[2]=origin0[2]+iparticle->Vz()/10.;
+                   Float_t tof=kconv*iparticle->T();
+                   gAlice->SetTrack(fTrackIt,-1,kf,p,origin,polar,
+                                    tof,kPPrimary,nt);
+                   gAlice->KeepTrack(nt);
                } // select particle
            } // particle loop 
            printf("\n I've put %i particles on the stack \n",nc);
@@ -368,18 +392,23 @@ 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;
            }
        }
     } // event loop
+    gAlice->SetHighWaterMark(nt);
 //  adjust weight due to kinematic selection
     AdjustWeights();
 //  get cross-section
     fXsection=fPythia->GetPARI(1);
 }
 
+void AliGenPythia::FinishRun()
+{
+// Print x-section summary
+    fPythia->Pystat(1);
+}
+
 Bool_t AliGenPythia::ParentSelected(Int_t ip)
 {
 // True if particle is in list of parent particles to be selected
@@ -393,7 +422,7 @@ Bool_t AliGenPythia::ParentSelected(Int_t ip)
 Bool_t AliGenPythia::ChildSelected(Int_t ip)
 {
 // True if particle is in list of decay products to be selected
-    if (fForceDecay == all) return kTRUE;
+    if (fForceDecay == kAll) return kTRUE;
     
     for (Int_t i=0; i<5; i++)
     {
@@ -438,7 +467,7 @@ Bool_t AliGenPythia::KinematicSelection(TParticle *particle)
 
 //
 // rapidity cut
-    if (e==pz) {
+    if ( (e-pz)<=0 || (e+pz)<=0 ) {
       return kFALSE;
     }
     else {
@@ -465,11 +494,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);
     }
 }
@@ -524,6 +552,7 @@ AliGenPythia& AliGenPythia::operator=(const  AliGenPythia& rhs)
 
 
 
+#ifdef never
 void AliGenPythia::Streamer(TBuffer &R__b)
 {
    // Stream an object of class AliGenPythia.
@@ -562,21 +591,5 @@ void AliGenPythia::Streamer(TBuffer &R__b)
       //     fDecayer->Streamer(R__b);
    }
 }
-
-
-
-#ifndef WIN32
-#define pyr    pyr_
-#define pyrset pyrset_
-#define pyrget pyrget_
-#else
-#define pyr    PYR
-#define pyrset PYRSET
-#define pyrget PYRGET
 #endif
 
-extern "C" {
-  Double_t pyr(Int_t*) {return sRandom->Rndm();}
-  void pyrset(Int_t*,Int_t*) {}
-  void pyrget(Int_t*,Int_t*) {}
-}