]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenMC.cxx
Get phi from iparticle.
[u/mrichter/AliRoot.git] / EVGEN / AliGenMC.cxx
index c9f932a4196bf7a1448165ee99d081ed5f78620a..e205984c5b253262fa955da0aa02651476a82e23 100644 (file)
 
 /*
 $Log$
+Revision 1.17  2003/04/30 14:48:21  hristov
+Changes related to the initialization of random numbers generators. Now one can use its own randoms for each module, particle generator, and/or tracking package. The interface with Fortran is simplified and some inter-library dependencies are avoided. Future improvements are welcome...
+
+Revision 1.16  2003/04/08 10:22:05  morsch
+Rapidity shift calculated in Init().
+
+Revision 1.15  2003/04/04 08:13:26  morsch
+Boost method added.
+
+Revision 1.14  2003/01/14 10:50:19  alibrary
+Cleanup of STEER coding conventions
+
+Revision 1.13  2002/10/14 14:55:35  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
 Revision 1.5.4.2  2002/07/24 08:56:28  alibrary
 Updating EVGEN on TVirtulaMC
 
@@ -63,11 +78,12 @@ AliGenMC base class for AliGenParam and AliGenPythia commonalities.
 // decay products and particle selection.
 // andreas.morsch@cern.ch
 
-#include "AliGenMC.h"
-#include "AliPDG.h"
 #include <TMath.h>
+#include <TPDGCode.h>
 #include <TParticle.h>
 
+#include "AliGenMC.h"
+
  ClassImp(AliGenMC)
 
 AliGenMC::AliGenMC()
@@ -84,6 +100,8 @@ AliGenMC::AliGenMC()
     SetGeometryAcceptance();
     SetPdgCodeParticleforAcceptanceCut();
     SetNumberOfAcceptedParticles();
+    SetTarget();
+    SetProjectile();
 }
 
 AliGenMC::AliGenMC(Int_t npart)
@@ -104,6 +122,8 @@ AliGenMC::AliGenMC(Int_t npart)
     SetGeometryAcceptance();
     SetPdgCodeParticleforAcceptanceCut();
     SetNumberOfAcceptedParticles();
+    SetTarget();
+    SetProjectile();
 }
 
 AliGenMC::AliGenMC(const AliGenMC & mc)
@@ -147,6 +167,12 @@ void AliGenMC::Init()
     case kNoDecayHeavy:
        break;
     }
+
+    if (fZTarget != 0 && fAProjectile != 0) 
+    {
+       fDyBoost    = - 0.5 * TMath::Log(Double_t(fZProjectile) * Double_t(fATarget) / 
+                                        (Double_t(fZTarget)    * Double_t(fAProjectile)));
+    }
 }
 
 
@@ -173,8 +199,6 @@ Bool_t AliGenMC::ChildSelected(Int_t ip) const
 Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) const
 {
 // Perform kinematic selection
-    Float_t px    = particle->Px();
-    Float_t py    = particle->Py();
     Float_t pz    = particle->Pz();
     Float_t  e    = particle->Energy();
     Float_t pt    = particle->Pt();
@@ -182,8 +206,8 @@ Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) const
     Float_t theta = particle->Theta();
     Float_t mass  = particle->GetCalcMass();
     Float_t mt2   = pt * pt + mass * mass;
+    Float_t phi   = particle->Phi();
     
-    Float_t phi   = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
     Double_t y, y0;
 
     if (TMath::Abs(pz) <  e) {
@@ -329,6 +353,38 @@ Int_t AliGenMC::CheckPDGCode(Int_t pdgcode) const
   //non diffractive state -- return code unchanged
   return pdgcode;
 }
+
+void AliGenMC::Boost()
+{
+//
+// Boost cms into LHC lab frame
+//
+
+    Double_t beta  = TMath::TanH(fDyBoost);
+    Double_t gamma = 1./TMath::Sqrt(1.-beta*beta);
+    Double_t gb    = gamma * beta;
+
+    //    printf("\n Boosting particles to lab frame %f %f %f", fDyBoost, beta, gamma);
+    
+    Int_t i;
+    Int_t np = fParticles->GetEntriesFast();
+    for (i = 0; i < np; i++) 
+    {
+       TParticle* iparticle = (TParticle*) fParticles->At(i);
+
+       Double_t e   = iparticle->Energy();
+       Double_t px  = iparticle->Px();
+       Double_t py  = iparticle->Py();
+       Double_t pz  = iparticle->Pz();
+
+       Double_t eb  = gamma * e -      gb * pz;
+       Double_t pzb =   -gb * e +   gamma * pz;
+
+       iparticle->SetMomentum(px, py, pzb, eb);
+    }
+}
+
+
          
 AliGenMC& AliGenMC::operator=(const  AliGenMC& rhs)
 {