* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.2 2001/10/15 08:15:51 morsch
-Event vertex and vertex truncation setting moved into AliMC.
+/* $Id$ */
-Revision 1.1 2001/07/13 10:56:00 morsch
-AliGenMC base class for AliGenParam and AliGenPythia commonalities.
+// Base class for generators using external MC generators.
+// For example AliGenPythia using Pythia.
+// Provides basic functionality: setting of kinematic cuts on
+// decay products and particle selection.
+// andreas.morsch@cern.ch
-*/
+#include <TMath.h>
+#include <TPDGCode.h>
+#include <TParticle.h>
#include "AliGenMC.h"
-#include "AliPDG.h"
-#include <TParticle.h>
ClassImp(AliGenMC)
SetChildPhiRange();
SetChildThetaRange();
SetChildYRange();
+ SetMaximumLifetime();
+ SetGeometryAcceptance();
+ SetPdgCodeParticleforAcceptanceCut();
+ SetNumberOfAcceptedParticles();
+ SetTarget();
+ SetProjectile();
}
AliGenMC::AliGenMC(Int_t npart)
fParentSelect.Set(8);
fChildSelect.Set(8);
for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0;
-
+ SetMaximumLifetime();
+ SetGeometryAcceptance();
+ SetPdgCodeParticleforAcceptanceCut();
+ SetNumberOfAcceptedParticles();
+ SetTarget();
+ SetProjectile();
}
AliGenMC::AliGenMC(const AliGenMC & mc)
case kDiElectron:
case kBJpsiDiElectron:
case kBPsiPrimeDiElectron:
- fChildSelect[0]=kElectron;
+ fChildSelect[0] = kElectron;
break;
case kSemiMuonic:
case kDiMuon:
fChildSelect[0]=kPiPlus;
fChildSelect[1]=kKPlus;
break;
+ case kPhiKK:
+ fChildSelect[0]=kKPlus;
+ case kOmega:
case kAll:
case kNoDecay:
+ 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)));
+ }
}
-Bool_t AliGenMC::ParentSelected(Int_t ip)
+Bool_t AliGenMC::ParentSelected(Int_t ip) const
{
// True if particle is in list of parent particles to be selected
for (Int_t i=0; i<8; i++)
{
- if (fParentSelect[i]==ip) return kTRUE;
+ if (fParentSelect.At(i) == ip) return kTRUE;
}
return kFALSE;
}
-Bool_t AliGenMC::ChildSelected(Int_t ip)
+Bool_t AliGenMC::ChildSelected(Int_t ip) const
{
// True if particle is in list of decay products to be selected
for (Int_t i=0; i<5; i++)
{
- if (fChildSelect[i]==ip) return kTRUE;
+ if (fChildSelect.At(i) == ip) return kTRUE;
}
return kFALSE;
}
-Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag)
+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();
Float_t p = particle->P();
Float_t theta = particle->Theta();
- Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
- Float_t y;
+ Float_t mass = particle->GetCalcMass();
+ Float_t mt2 = pt * pt + mass * mass;
+ Float_t phi = particle->Phi();
- if ( (e-pz)<=0 || (e+pz)<=0 ) {
- return kFALSE;
+ Double_t y, y0;
+
+ if (TMath::Abs(pz) < e) {
+ y = 0.5*TMath::Log((e+pz)/(e-pz));
} else {
- y = 0.5*TMath::Log((e+pz)/(e-pz));
+ y = 1.e10;
}
+ if (mt2) {
+ y0 = 0.5*TMath::Log((e+TMath::Abs(pz))*(e+TMath::Abs(pz))/mt2);
+ } else {
+ if (TMath::Abs(y) < 1.e10) {
+ y0 = y;
+ } else {
+ y0 = 1.e10;
+ }
+ }
+
+ y = (pz < 0) ? -y0 : y0;
+
if (flag == 0) {
//
// Primary particle cuts
}
}
-
-
return kTRUE;
}
-Int_t AliGenMC::CheckPDGCode(Int_t pdgcode)
+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;
+ TParticle * particle;
+ Int_t 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++;
+ }
+ }
+ if ( NumberOfAcceptedPdgCodeParticleforAcceptanceCut > (fNumberOfAcceptedParticles-1) )
+ Check = kTRUE;
+ else
+ Check = kFALSE;
+
+ return Check;
+}
+
+Int_t AliGenMC::CheckPDGCode(Int_t pdgcode) const
{
//
// If the particle is in a diffractive state, then take action accordingly
//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)
{