]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenHIJINGpara.cxx
New class used for primary vertex finding (AliITSVertexerTracks)
[u/mrichter/AliRoot.git] / EVGEN / AliGenHIJINGpara.cxx
index 5488b103f8bc7007dcccd8fa698a4dd96d9ad419..17fae20c87a23625da0f2e929e0f270a4420ee1b 100644 (file)
 
 /*
 $Log$
+Revision 1.19  2003/01/14 10:50:18  alibrary
+Cleanup of STEER coding conventions
+
+Revision 1.18  2002/12/11 11:58:11  morsch
+Bug in formula for pi0 energy for decay corrected.
+
+Revision 1.17  2002/12/10 17:44:57  morsch
+Correct mother child relation for pi0.
+
+Revision 1.16  2002/11/28 11:46:15  morsch
+Don't track pi0 if already decayed.
+
+Revision 1.15  2002/11/28 11:38:53  morsch
+Typo corrected.
+
+Revision 1.14  2002/11/26 17:12:36  morsch
+Decay pi0 if requested.
+
 Revision 1.13  2002/10/14 14:55:35  hristov
 Merging the VirtualMC branch to the main development branch (HEAD)
 
@@ -87,19 +105,19 @@ All coding rule violations except RS3 corrected (AM)
 //                                                               //
 ///////////////////////////////////////////////////////////////////
 
-#include "AliGenHIJINGpara.h"
-#include "AliGenEventHeader.h"
-#include "AliRun.h"
-#include "AliConst.h"
-#include "AliDecayer.h"
-#include "AliDecayerPythia.h"
-#include "AliPDG.h"
-
-#include <TF1.h>
 #include <TArrayF.h>
-#include <TDatabasePDG.h>
 #include <TClonesArray.h>
+#include <TDatabasePDG.h>
+#include <TF1.h>
 #include <TParticle.h>
+#include <TPDGCode.h>
+
+#include "AliConst.h"
+#include "AliDecayer.h"
+#include "AliDecayerPythia.h"
+#include "AliGenEventHeader.h"
+#include "AliGenHIJINGpara.h"
+#include "AliRun.h"
 
 ClassImp(AliGenHIJINGpara)
 
@@ -211,11 +229,12 @@ AliGenHIJINGpara::AliGenHIJINGpara()
     //
     // Default constructor
     //
-    fPtpi    = 0;
-    fPtka    = 0;
-    fETApic  = 0;
-    fETAkac  = 0;
-    fDecayer = 0;
+    fPtpi    =  0;
+    fPtka    =  0;
+    fETApic  =  0;
+    fETAkac  =  0;
+    fDecayer =  0;
+    fNt      = -1;
     SetCutVertexZ();
     SetPtRange();
     SetPi0Decays();
@@ -228,13 +247,14 @@ AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart)
   // 
   // Standard constructor
   //
-    fName="HIGINGpara";
+    fName="HIJINGpara";
     fTitle="HIJING Parametrisation Particle Generator";
-    fPtpi    = 0;
-    fPtka    = 0;
-    fETApic  = 0;
-    fETAkac  = 0;
-    fDecayer = 0;
+    fPtpi    =  0;
+    fPtka    =  0;
+    fETApic  =  0;
+    fETAkac  =  0;
+    fDecayer =  0;
+    fNt      = -1;
     SetCutVertexZ();
     SetPtRange();
     SetPi0Decays();
@@ -329,7 +349,7 @@ void AliGenHIJINGpara::Generate()
     Float_t pt, pl, ptot;
     Float_t phi, theta;
     Float_t p[3];
-    Int_t i, part, nt, j;
+    Int_t i, part, j;
     //
     TF1 *ptf;
     TF1 *etaf;
@@ -385,13 +405,23 @@ void AliGenHIJINGpara::Generate()
                        TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
                }
            }
-           SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
+           if (part == kPi0 && fPi0Decays){
 //
 //          Decay pi0 if requested
-           if (part == kPi0 && fPi0Decays) DecayPi0(origin, p);
+               SetTrack(0,-1,part,p,origin,polar,0,kPPrimary,fNt,fParentWeight);
+               KeepTrack(fNt);
+               DecayPi0(origin, p);
+           } else {
+               SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,fNt,fParentWeight);
+               KeepTrack(fNt);
+           }
+
            break;
        }
+       SetHighWaterMark(fNt);
     }
+//
+
 // Header
     AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
 // Event Vertex
@@ -419,25 +449,28 @@ void AliGenHIJINGpara::DecayPi0(Float_t* orig, Float_t * p)
     if(!particles) particles = new TClonesArray("TParticle",1000);
 //    
     const Float_t kMass = TDatabasePDG::Instance()->GetParticle(kPi0)->Mass();
-    Float_t       e     = TMath::Sqrt(p[0] * p[0] + p[1] * p[1] +p[2] * p[2] * kMass * kMass);
+    Float_t       e     = TMath::Sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]+ kMass * kMass);
 //
 //  Decay the pi0    
     TLorentzVector pmom(p[0], p[1], p[2], e);
     fDecayer->Decay(kPi0, &pmom);
+    
 //
 // Put decay particles on the stack
 //
-    Int_t nt = 0;
     Float_t polar[3] = {0., 0., 0.};
     Int_t np = fDecayer->ImportParticles(particles);
-    
+    Int_t nt;    
     for (Int_t i = 1; i < np; i++)
     {
-       TParticle* iParticle =  (TParticle *) particles->At(1);
-       p[0]=iParticle->Px();
-       p[1]=iParticle->Py();
-       p[2]=iParticle->Pz();
+       TParticle* iParticle =  (TParticle *) particles->At(i);
+       p[0] = iParticle->Px();
+       p[1] = iParticle->Py();
+       p[2] = iParticle->Pz();
        Int_t part = iParticle->GetPdgCode();
-       SetTrack(fTrackIt, 0, part, p, orig, polar, 0, kPDecay, nt, fParentWeight);
+
+       SetTrack(fTrackIt, fNt, part, p, orig, polar, 0, kPDecay, nt, fParentWeight);
+       KeepTrack(nt);
     }
+    fNt = nt;
 }