1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.3 2001/10/16 08:48:56 morsch
19 Common vertex related code moved to base class AliGenerator.
21 Revision 1.2 2001/10/15 08:15:51 morsch
22 Event vertex and vertex truncation setting moved into AliMC.
24 Revision 1.1 2001/07/13 10:56:00 morsch
25 AliGenMC base class for AliGenParam and AliGenPythia commonalities.
31 #include <TParticle.h>
38 // Default Constructor
40 SetChildMomentumRange();
48 AliGenMC::AliGenMC(Int_t npart)
53 SetChildMomentumRange();
61 for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0;
65 AliGenMC::AliGenMC(const AliGenMC & mc)
79 switch (fForceDecay) {
82 case kBJpsiDiElectron:
83 case kBPsiPrimeDiElectron:
84 fChildSelect[0] = kElectron;
89 case kBPsiPrimeDiMuon:
92 fChildSelect[0]=kMuonMinus;
95 fChildSelect[0]=kPiPlus;
96 fChildSelect[1]=kKPlus;
105 Bool_t AliGenMC::ParentSelected(Int_t ip)
107 // True if particle is in list of parent particles to be selected
108 for (Int_t i=0; i<8; i++)
110 if (fParentSelect[i]==ip) return kTRUE;
115 Bool_t AliGenMC::ChildSelected(Int_t ip)
117 // True if particle is in list of decay products to be selected
118 for (Int_t i=0; i<5; i++)
120 if (fChildSelect[i]==ip) return kTRUE;
125 Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag)
127 // Perform kinematic selection
128 Float_t px = particle->Px();
129 Float_t py = particle->Py();
130 Float_t pz = particle->Pz();
131 Float_t e = particle->Energy();
132 Float_t pt = particle->Pt();
133 Float_t p = particle->P();
134 Float_t theta = particle->Theta();
135 Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
138 if ( (e-pz)<=0 || (e+pz)<=0 ) {
141 y = 0.5*TMath::Log((e+pz)/(e-pz));
146 // Primary particle cuts
148 // transverse momentum cut
149 if (pt > fPtMax || pt < fPtMin) {
150 // printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax);
155 if (p > fPMax || p < fPMin) {
156 // printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax);
161 if (theta > fThetaMax || theta < fThetaMin) {
162 // printf("\n failed theta cut %f %f %f \n",theta,fThetaMin,fThetaMax);
167 if (y > fYMax || y < fYMin) {
168 // printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax);
173 if (phi > fPhiMax || phi < fPhiMin) {
174 // printf("\n failed phi cut %f %f %f \n",phi,fPhiMin,fPhiMax);
179 // Decay product cuts
181 // transverse momentum cut
182 if (pt > fChildPtMax || pt < fChildPtMin) {
183 // printf("\n failed pt cut %f %f %f \n",pt,fChildPtMin,fChildPtMax);
188 if (p > fChildPMax || p < fChildPMin) {
189 // printf("\n failed p cut %f %f %f \n",p,fChildPMin,fChildPMax);
194 if (theta > fChildThetaMax || theta < fChildThetaMin) {
195 // printf("\n failed theta cut %f %f %f \n",theta,fChildThetaMin,fChildThetaMax);
200 if (y > fChildYMax || y < fChildYMin) {
201 // printf("\n failed y cut %f %f %f \n",y,fChildYMin,fChildYMax);
206 if (phi > fChildPhiMax || phi < fChildPhiMin) {
207 // printf("\n failed phi cut %f %f %f \n",phi,fChildPhiMin,fChildPhiMax);
217 Int_t AliGenMC::CheckPDGCode(Int_t pdgcode)
220 // If the particle is in a diffractive state, then take action accordingly
225 //rho_diff0 -- difficult to translate, return rho0
228 //pi_diffr+ -- change to pi+
231 //omega_di0 -- change to omega0
234 //phi_diff0 -- return phi0
237 //J/psi_di0 -- return J/psi
240 //n_diffr -- return neutron
243 //p_diffr+ -- return proton
246 //non diffractive state -- return code unchanged
250 AliGenMC& AliGenMC::operator=(const AliGenMC& rhs)
252 // Assignment operator