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.5 2002/03/12 17:02:20 morsch
19 Change in calculation of rapidity, include case in which numerically e == pz.
21 Revision 1.4 2001/11/27 13:13:07 morsch
22 Maximum lifetime for long-lived particles to be put on the stack is parameter.
23 It can be set via SetMaximumLifetime(..).
25 Revision 1.3 2001/10/16 08:48:56 morsch
26 Common vertex related code moved to base class AliGenerator.
28 Revision 1.2 2001/10/15 08:15:51 morsch
29 Event vertex and vertex truncation setting moved into AliMC.
31 Revision 1.1 2001/07/13 10:56:00 morsch
32 AliGenMC base class for AliGenParam and AliGenPythia commonalities.
38 #include <TParticle.h>
45 // Default Constructor
47 SetChildMomentumRange();
55 AliGenMC::AliGenMC(Int_t npart)
60 SetChildMomentumRange();
68 for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0;
72 AliGenMC::AliGenMC(const AliGenMC & mc)
86 switch (fForceDecay) {
89 case kBJpsiDiElectron:
90 case kBPsiPrimeDiElectron:
91 fChildSelect[0] = kElectron;
96 case kBPsiPrimeDiMuon:
99 fChildSelect[0]=kMuonMinus;
102 fChildSelect[0]=kPiPlus;
103 fChildSelect[1]=kKPlus;
112 Bool_t AliGenMC::ParentSelected(Int_t ip)
114 // True if particle is in list of parent particles to be selected
115 for (Int_t i=0; i<8; i++)
117 if (fParentSelect[i]==ip) return kTRUE;
122 Bool_t AliGenMC::ChildSelected(Int_t ip)
124 // True if particle is in list of decay products to be selected
125 for (Int_t i=0; i<5; i++)
127 if (fChildSelect[i]==ip) return kTRUE;
132 Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag)
134 // Perform kinematic selection
135 Float_t px = particle->Px();
136 Float_t py = particle->Py();
137 Float_t pz = particle->Pz();
138 Float_t e = particle->Energy();
139 Float_t pt = particle->Pt();
140 Float_t p = particle->P();
141 Float_t theta = particle->Theta();
142 Float_t mass = particle->GetMass();
143 Float_t mt2 = pt * pt + mass * mass;
145 Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
148 if (TMath::Abs(pz) < e) {
149 y = 0.5*TMath::Log((e+pz)/(e-pz));
155 y0 = 0.5*TMath::Log((e+TMath::Abs(pz))*(e+TMath::Abs(pz))/mt2);
157 if (TMath::Abs(y) < 1.e10) {
164 y = (pz < 0) ? -y0 : y0;
168 // Primary particle cuts
170 // transverse momentum cut
171 if (pt > fPtMax || pt < fPtMin) {
172 // printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax);
177 if (p > fPMax || p < fPMin) {
178 // printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax);
183 if (theta > fThetaMax || theta < fThetaMin) {
184 // printf("\n failed theta cut %f %f %f \n",theta,fThetaMin,fThetaMax);
189 if (y > fYMax || y < fYMin) {
190 // printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax);
195 if (phi > fPhiMax || phi < fPhiMin) {
196 // printf("\n failed phi cut %f %f %f \n",phi,fPhiMin,fPhiMax);
201 // Decay product cuts
203 // transverse momentum cut
204 if (pt > fChildPtMax || pt < fChildPtMin) {
205 // printf("\n failed pt cut %f %f %f \n",pt,fChildPtMin,fChildPtMax);
210 if (p > fChildPMax || p < fChildPMin) {
211 // printf("\n failed p cut %f %f %f \n",p,fChildPMin,fChildPMax);
216 if (theta > fChildThetaMax || theta < fChildThetaMin) {
217 // printf("\n failed theta cut %f %f %f \n",theta,fChildThetaMin,fChildThetaMax);
222 if (y > fChildYMax || y < fChildYMin) {
223 // printf("\n failed y cut %f %f %f \n",y,fChildYMin,fChildYMax);
228 if (phi > fChildPhiMax || phi < fChildPhiMin) {
229 // printf("\n failed phi cut %f %f %f \n",phi,fChildPhiMin,fChildPhiMax);
239 Int_t AliGenMC::CheckPDGCode(Int_t pdgcode)
242 // If the particle is in a diffractive state, then take action accordingly
247 //rho_diff0 -- difficult to translate, return rho0
250 //pi_diffr+ -- change to pi+
253 //omega_di0 -- change to omega0
256 //phi_diff0 -- return phi0
259 //J/psi_di0 -- return J/psi
262 //n_diffr -- return neutron
265 //p_diffr+ -- return proton
268 //non diffractive state -- return code unchanged
272 AliGenMC& AliGenMC::operator=(const AliGenMC& rhs)
274 // Assignment operator