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.1 2001/07/13 10:56:00 morsch
19 AliGenMC base class for AliGenParam and AliGenPythia commonalities.
25 #include <TParticle.h>
32 // Default Constructor
34 SetChildMomentumRange();
41 AliGenMC::AliGenMC(Int_t npart)
46 SetChildMomentumRange();
55 for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0;
59 AliGenMC::AliGenMC(const AliGenMC & mc)
73 switch (fForceDecay) {
76 case kBJpsiDiElectron:
77 case kBPsiPrimeDiElectron:
78 fChildSelect[0]=kElectron;
83 case kBPsiPrimeDiMuon:
86 fChildSelect[0]=kMuonMinus;
89 fChildSelect[0]=kPiPlus;
90 fChildSelect[1]=kKPlus;
99 Bool_t AliGenMC::ParentSelected(Int_t ip)
101 // True if particle is in list of parent particles to be selected
102 for (Int_t i=0; i<8; i++)
104 if (fParentSelect[i]==ip) return kTRUE;
109 Bool_t AliGenMC::ChildSelected(Int_t ip)
111 // True if particle is in list of decay products to be selected
112 for (Int_t i=0; i<5; i++)
114 if (fChildSelect[i]==ip) return kTRUE;
119 Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag)
121 // Perform kinematic selection
122 Float_t px = particle->Px();
123 Float_t py = particle->Py();
124 Float_t pz = particle->Pz();
125 Float_t e = particle->Energy();
126 Float_t pt = particle->Pt();
127 Float_t p = particle->P();
128 Float_t theta = particle->Theta();
129 Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
132 if ( (e-pz)<=0 || (e+pz)<=0 ) {
135 y = 0.5*TMath::Log((e+pz)/(e-pz));
140 // Primary particle cuts
142 // transverse momentum cut
143 if (pt > fPtMax || pt < fPtMin) {
144 // printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax);
149 if (p > fPMax || p < fPMin) {
150 // printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax);
155 if (theta > fThetaMax || theta < fThetaMin) {
156 // printf("\n failed theta cut %f %f %f \n",theta,fThetaMin,fThetaMax);
161 if (y > fYMax || y < fYMin) {
162 // printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax);
167 if (phi > fPhiMax || phi < fPhiMin) {
168 // printf("\n failed phi cut %f %f %f \n",phi,fPhiMin,fPhiMax);
173 // Decay product cuts
175 // transverse momentum cut
176 if (pt > fChildPtMax || pt < fChildPtMin) {
177 // printf("\n failed pt cut %f %f %f \n",pt,fChildPtMin,fChildPtMax);
182 if (p > fChildPMax || p < fChildPMin) {
183 // printf("\n failed p cut %f %f %f \n",p,fChildPMin,fChildPMax);
188 if (theta > fChildThetaMax || theta < fChildThetaMin) {
189 // printf("\n failed theta cut %f %f %f \n",theta,fChildThetaMin,fChildThetaMax);
194 if (y > fChildYMax || y < fChildYMin) {
195 // printf("\n failed y cut %f %f %f \n",y,fChildYMin,fChildYMax);
200 if (phi > fChildPhiMax || phi < fChildPhiMin) {
201 // printf("\n failed phi cut %f %f %f \n",phi,fChildPhiMin,fChildPhiMax);
211 Int_t AliGenMC::CheckPDGCode(Int_t pdgcode)
214 // If the particle is in a diffractive state, then take action accordingly
219 //rho_diff0 -- difficult to translate, return rho0
222 //pi_diffr+ -- change to pi+
225 //omega_di0 -- change to omega0
228 //phi_diff0 -- return phi0
231 //J/psi_di0 -- return J/psi
234 //n_diffr -- return neutron
237 //p_diffr+ -- return proton
240 //non diffractive state -- return code unchanged
244 AliGenMC& AliGenMC::operator=(const AliGenMC& rhs)
246 // Assignment operator