X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EVGEN%2FAliGenMC.cxx;h=69c583e07d2149a1dec2e7ca539f72567c662de5;hb=7cdba479ac84d9e3621351018a6917570b21b797;hp=34b1e2e97e2559857588cdc85650b50dc3a86551;hpb=95450c6d20e9ae7e3fc1d016a5eb658fb0872aba;p=u%2Fmrichter%2FAliRoot.git diff --git a/EVGEN/AliGenMC.cxx b/EVGEN/AliGenMC.cxx index 34b1e2e97e2..69c583e07d2 100644 --- a/EVGEN/AliGenMC.cxx +++ b/EVGEN/AliGenMC.cxx @@ -15,6 +15,45 @@ /* $Log$ +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 + +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(..). @@ -30,10 +69,18 @@ AliGenMC base class for AliGenParam and AliGenPythia commonalities. */ -#include "AliGenMC.h" -#include "AliPDG.h" +// 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 +#include #include +#include "AliGenMC.h" + ClassImp(AliGenMC) AliGenMC::AliGenMC() @@ -47,6 +94,11 @@ AliGenMC::AliGenMC() SetChildThetaRange(); SetChildYRange(); SetMaximumLifetime(); + SetGeometryAcceptance(); + SetPdgCodeParticleforAcceptanceCut(); + SetNumberOfAcceptedParticles(); + SetTarget(); + SetProjectile(); } AliGenMC::AliGenMC(Int_t npart) @@ -64,6 +116,11 @@ AliGenMC::AliGenMC(Int_t npart) 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) @@ -99,34 +156,44 @@ void AliGenMC::Init() 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(); @@ -136,13 +203,13 @@ Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) Float_t pt = particle->Pt(); Float_t p = particle->P(); Float_t theta = particle->Theta(); - Float_t mass = particle->GetMass(); + Float_t mass = particle->GetCalcMass(); Float_t mt2 = pt * pt + mass * mass; Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px))); Double_t y, y0; - if (TMath::Abs(pz) != e) { + if (TMath::Abs(pz) < e) { y = 0.5*TMath::Log((e+pz)/(e-pz)); } else { y = 1.e10; @@ -228,12 +295,32 @@ Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) } } - - 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; iAt(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 @@ -265,6 +352,38 @@ Int_t AliGenMC::CheckPDGCode(Int_t pdgcode) //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) {