]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenMC.cxx
AliGenCocktail passes its pointer to the entries and
[u/mrichter/AliRoot.git] / EVGEN / AliGenMC.cxx
index 2b87c64c7e8c35e6191eeceda7afe53a798383ff..d8d68526e7a9cce809048f30e01b135cf62ddcef 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-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
-
-Revision 1.12  2002/07/19 11:42:33  morsch
-Use CalcMass()
-
-Revision 1.11  2002/06/06 15:26:24  morsch
-Correct child-selection for kPhiKK
-
-Revision 1.10  2002/06/05 14:05:46  morsch
-Decayer option kPhiKK for forced phi->K+K- decay added.
-
-Revision 1.9  2002/05/30 14:58:29  morsch
-Add pointer to AliGeometry to handle geometrical acceptance. (G. MArtinez)
-
-Revision 1.8  2002/04/26 10:42:35  morsch
-Case kNoDecayHeavy added. (N. Carrer)
-
-Revision 1.7  2002/04/17 10:32:32  morsch
-Coding Rule violations corrected.
-
-Revision 1.6  2002/03/26 14:19:36  morsch
-Saver calculation of rapdity.
-
-Revision 1.5  2002/03/12 17:02:20  morsch
-Change in calculation of rapidity, include case in which numerically e == pz.
-
-Revision 1.4  2001/11/27 13:13:07  morsch
-Maximum lifetime for long-lived particles to be put on the stack is parameter.
-It can be set via SetMaximumLifetime(..).
-
-Revision 1.3  2001/10/16 08:48:56  morsch
-Common vertex related code moved to base class AliGenerator.
-
-Revision 1.2  2001/10/15 08:15:51  morsch
-Event vertex and vertex truncation setting moved into AliMC.
-
-Revision 1.1  2001/07/13 10:56:00  morsch
-AliGenMC base class for AliGenParam and AliGenPythia commonalities.
-
-*/
+/* $Id$ */
 
 // Base class for generators using external MC generators.
 // For example AliGenPythia using Pythia.
@@ -72,16 +21,18 @@ AliGenMC base class for AliGenParam and AliGenPythia commonalities.
 // decay products and particle selection.
 // andreas.morsch@cern.ch
 
+#include <TClonesArray.h>
 #include <TMath.h>
 #include <TPDGCode.h>
 #include <TParticle.h>
 
 #include "AliGenMC.h"
+#include "AliGeometry.h"
 
- ClassImp(AliGenMC)
+ClassImp(AliGenMC)
 
 AliGenMC::AliGenMC()
-                 :AliGenerator()
+    :AliGenerator()
 {
 // Default Constructor
     SetCutOnChild();
@@ -96,10 +47,13 @@ AliGenMC::AliGenMC()
     SetNumberOfAcceptedParticles();
     SetTarget();
     SetProjectile();
+    fParentSelect.Set(8);
+    fChildSelect.Set(8);
+    fForceDecay = kAll;
 }
 
 AliGenMC::AliGenMC(Int_t npart)
-                 :AliGenerator(npart)
+    :AliGenerator(npart)
 {
 //  Constructor
     SetCutOnChild();
@@ -118,11 +72,14 @@ AliGenMC::AliGenMC(Int_t npart)
     SetNumberOfAcceptedParticles();
     SetTarget();
     SetProjectile();
+    fForceDecay = kAll;
 }
 
-AliGenMC::AliGenMC(const AliGenMC & mc)
+AliGenMC::AliGenMC(const AliGenMC & mc):
+    AliGenerator(mc)
 {
-// copy constructor
+// Copy constructor
+    mc.Copy(*this);
 }
 
 AliGenMC::~AliGenMC()
@@ -141,6 +98,7 @@ void AliGenMC::Init()
     case kBPsiPrimeDiElectron:
        fChildSelect[0] = kElectron;    
        break;
+    case kHardMuons:   
     case kSemiMuonic:
     case kDiMuon:
     case kBJpsiDiMuon:
@@ -155,6 +113,10 @@ void AliGenMC::Init()
        break;
     case kPhiKK:
        fChildSelect[0]=kKPlus;
+       break;
+    case kBJpsi:
+       fChildSelect[0]=443;
+       break;
     case kOmega:       
     case kAll:
     case kNoDecay:
@@ -193,8 +155,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();
@@ -202,8 +162,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) {
@@ -297,24 +257,26 @@ Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) const
 
 Bool_t AliGenMC::CheckAcceptanceGeometry(Int_t np, TClonesArray* particles)
 {
-  Bool_t Check ;  // All fPdgCodeParticleforAcceptanceCut particles are in in the fGeometryAcceptance acceptance
-  Int_t NumberOfPdgCodeParticleforAcceptanceCut=0;
-  Int_t NumberOfAcceptedPdgCodeParticleforAcceptanceCut=0;
+// Check the geometrical acceptance for particle.
+
+  Bool_t check ;  
+  Int_t numberOfPdgCodeParticleforAcceptanceCut = 0;
+  Int_t numberOfAcceptedPdgCodeParticleforAcceptanceCut = 0;
   TParticle * particle;
   Int_t i;
-  for (i=0; i<np; i++) {
+  for (i = 0; i < np; i++) {
     particle =  (TParticle *) particles->At(i);
     if( TMath::Abs( particle->GetPdgCode() ) == TMath::Abs( fPdgCodeParticleforAcceptanceCut ) ) {
-      NumberOfPdgCodeParticleforAcceptanceCut++;
-      if (fGeometryAcceptance->Impact(particle)) NumberOfAcceptedPdgCodeParticleforAcceptanceCut++;
+      numberOfPdgCodeParticleforAcceptanceCut++;
+      if (fGeometryAcceptance->Impact(particle)) numberOfAcceptedPdgCodeParticleforAcceptanceCut++;
     }   
   }
-  if ( NumberOfAcceptedPdgCodeParticleforAcceptanceCut > (fNumberOfAcceptedParticles-1) )
-    Check = kTRUE;
+  if ( numberOfAcceptedPdgCodeParticleforAcceptanceCut > (fNumberOfAcceptedParticles-1) )
+    check = kTRUE;
   else
-    Check = kFALSE;
+    check = kFALSE;
 
-  return Check;
+  return check;
 }
 
 Int_t AliGenMC::CheckPDGCode(Int_t pdgcode) const
@@ -360,7 +322,7 @@ void AliGenMC::Boost()
     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);
+    //    printf("\n Boosting particles to lab frame %f %f %f", fDyBoost, beta, gamma);
     
     Int_t i;
     Int_t np = fParticles->GetEntriesFast();
@@ -385,6 +347,16 @@ void AliGenMC::Boost()
 AliGenMC& AliGenMC::operator=(const  AliGenMC& rhs)
 {
 // Assignment operator
+    rhs.Copy(*this);
     return *this;
 }
 
+void AliGenMC::Copy(TObject&) const
+{
+    //
+    // Copy 
+    //
+    Fatal("Copy","Not implemented!\n");
+}
+
+