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.2 2001/10/15 08:15:51 morsch
19 Event vertex and vertex truncation setting moved into AliMC.
21 Revision 1.1 2001/07/13 10:56:00 morsch
22 AliGenMC base class for AliGenParam and AliGenPythia commonalities.
28 #include <TParticle.h>
35 // Default Constructor
37 SetChildMomentumRange();
44 AliGenMC::AliGenMC(Int_t npart)
49 SetChildMomentumRange();
57 for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0;
61 AliGenMC::AliGenMC(const AliGenMC & mc)
75 switch (fForceDecay) {
78 case kBJpsiDiElectron:
79 case kBPsiPrimeDiElectron:
80 fChildSelect[0]=kElectron;
85 case kBPsiPrimeDiMuon:
88 fChildSelect[0]=kMuonMinus;
91 fChildSelect[0]=kPiPlus;
92 fChildSelect[1]=kKPlus;
101 Bool_t AliGenMC::ParentSelected(Int_t ip)
103 // True if particle is in list of parent particles to be selected
104 for (Int_t i=0; i<8; i++)
106 if (fParentSelect[i]==ip) return kTRUE;
111 Bool_t AliGenMC::ChildSelected(Int_t ip)
113 // True if particle is in list of decay products to be selected
114 for (Int_t i=0; i<5; i++)
116 if (fChildSelect[i]==ip) return kTRUE;
121 Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag)
123 // Perform kinematic selection
124 Float_t px = particle->Px();
125 Float_t py = particle->Py();
126 Float_t pz = particle->Pz();
127 Float_t e = particle->Energy();
128 Float_t pt = particle->Pt();
129 Float_t p = particle->P();
130 Float_t theta = particle->Theta();
131 Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
134 if ( (e-pz)<=0 || (e+pz)<=0 ) {
137 y = 0.5*TMath::Log((e+pz)/(e-pz));
142 // Primary particle cuts
144 // transverse momentum cut
145 if (pt > fPtMax || pt < fPtMin) {
146 // printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax);
151 if (p > fPMax || p < fPMin) {
152 // printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax);
157 if (theta > fThetaMax || theta < fThetaMin) {
158 // printf("\n failed theta cut %f %f %f \n",theta,fThetaMin,fThetaMax);
163 if (y > fYMax || y < fYMin) {
164 // printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax);
169 if (phi > fPhiMax || phi < fPhiMin) {
170 // printf("\n failed phi cut %f %f %f \n",phi,fPhiMin,fPhiMax);
175 // Decay product cuts
177 // transverse momentum cut
178 if (pt > fChildPtMax || pt < fChildPtMin) {
179 // printf("\n failed pt cut %f %f %f \n",pt,fChildPtMin,fChildPtMax);
184 if (p > fChildPMax || p < fChildPMin) {
185 // printf("\n failed p cut %f %f %f \n",p,fChildPMin,fChildPMax);
190 if (theta > fChildThetaMax || theta < fChildThetaMin) {
191 // printf("\n failed theta cut %f %f %f \n",theta,fChildThetaMin,fChildThetaMax);
196 if (y > fChildYMax || y < fChildYMin) {
197 // printf("\n failed y cut %f %f %f \n",y,fChildYMin,fChildYMax);
202 if (phi > fChildPhiMax || phi < fChildPhiMin) {
203 // printf("\n failed phi cut %f %f %f \n",phi,fChildPhiMin,fChildPhiMax);
213 Int_t AliGenMC::CheckPDGCode(Int_t pdgcode)
216 // If the particle is in a diffractive state, then take action accordingly
221 //rho_diff0 -- difficult to translate, return rho0
224 //pi_diffr+ -- change to pi+
227 //omega_di0 -- change to omega0
230 //phi_diff0 -- return phi0
233 //J/psi_di0 -- return J/psi
236 //n_diffr -- return neutron
239 //p_diffr+ -- return proton
242 //non diffractive state -- return code unchanged
246 AliGenMC& AliGenMC::operator=(const AliGenMC& rhs)
248 // Assignment operator