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 **************************************************************************/
22 #include <TParticle.h>
29 // Default Constructor
31 SetChildMomentumRange();
38 AliGenMC::AliGenMC(Int_t npart)
43 SetChildMomentumRange();
51 for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0;
54 AliGenMC::AliGenMC(const AliGenMC & mc)
68 switch (fForceDecay) {
71 case kBJpsiDiElectron:
72 case kBPsiPrimeDiElectron:
73 fChildSelect[0]=kElectron;
78 case kBPsiPrimeDiMuon:
81 fChildSelect[0]=kMuonMinus;
84 fChildSelect[0]=kPiPlus;
85 fChildSelect[1]=kKPlus;
94 Bool_t AliGenMC::ParentSelected(Int_t ip)
96 // True if particle is in list of parent particles to be selected
97 for (Int_t i=0; i<8; i++)
99 if (fParentSelect[i]==ip) return kTRUE;
104 Bool_t AliGenMC::ChildSelected(Int_t ip)
106 // True if particle is in list of decay products to be selected
107 for (Int_t i=0; i<5; i++)
109 if (fChildSelect[i]==ip) return kTRUE;
114 Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag)
116 // Perform kinematic selection
117 Float_t px = particle->Px();
118 Float_t py = particle->Py();
119 Float_t pz = particle->Pz();
120 Float_t e = particle->Energy();
121 Float_t pt = particle->Pt();
122 Float_t p = particle->P();
123 Float_t theta = particle->Theta();
124 Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
127 if ( (e-pz)<=0 || (e+pz)<=0 ) {
130 y = 0.5*TMath::Log((e+pz)/(e-pz));
135 // Primary particle cuts
137 // transverse momentum cut
138 if (pt > fPtMax || pt < fPtMin) {
139 // printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax);
144 if (p > fPMax || p < fPMin) {
145 // printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax);
150 if (theta > fThetaMax || theta < fThetaMin) {
151 // printf("\n failed theta cut %f %f %f \n",theta,fThetaMin,fThetaMax);
156 if (y > fYMax || y < fYMin) {
157 // printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax);
162 if (phi > fPhiMax || phi < fPhiMin) {
163 // printf("\n failed phi cut %f %f %f \n",phi,fPhiMin,fPhiMax);
168 // Decay product cuts
170 // transverse momentum cut
171 if (pt > fChildPtMax || pt < fChildPtMin) {
172 // printf("\n failed pt cut %f %f %f \n",pt,fChildPtMin,fChildPtMax);
177 if (p > fChildPMax || p < fChildPMin) {
178 // printf("\n failed p cut %f %f %f \n",p,fChildPMin,fChildPMax);
183 if (theta > fChildThetaMax || theta < fChildThetaMin) {
184 // printf("\n failed theta cut %f %f %f \n",theta,fChildThetaMin,fChildThetaMax);
189 if (y > fChildYMax || y < fChildYMin) {
190 // printf("\n failed y cut %f %f %f \n",y,fChildYMin,fChildYMax);
195 if (phi > fChildPhiMax || phi < fChildPhiMin) {
196 // printf("\n failed phi cut %f %f %f \n",phi,fChildPhiMin,fChildPhiMax);
206 Int_t AliGenMC::CheckPDGCode(Int_t pdgcode)
209 // If the particle is in a diffractive state, then take action accordingly
214 //rho_diff0 -- difficult to translate, return rho0
217 //pi_diffr+ -- change to pi+
220 //omega_di0 -- change to omega0
223 //phi_diff0 -- return phi0
226 //J/psi_di0 -- return J/psi
229 //n_diffr -- return neutron
232 //p_diffr+ -- return proton
235 //non diffractive state -- return code unchanged
239 AliGenMC& AliGenMC::operator=(const AliGenMC& rhs)
241 // Assignment operator