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.7 2002/04/17 10:32:32 morsch
19 Coding Rule violations corrected.
21 Revision 1.6 2002/03/26 14:19:36 morsch
22 Saver calculation of rapdity.
24 Revision 1.5 2002/03/12 17:02:20 morsch
25 Change in calculation of rapidity, include case in which numerically e == pz.
27 Revision 1.4 2001/11/27 13:13:07 morsch
28 Maximum lifetime for long-lived particles to be put on the stack is parameter.
29 It can be set via SetMaximumLifetime(..).
31 Revision 1.3 2001/10/16 08:48:56 morsch
32 Common vertex related code moved to base class AliGenerator.
34 Revision 1.2 2001/10/15 08:15:51 morsch
35 Event vertex and vertex truncation setting moved into AliMC.
37 Revision 1.1 2001/07/13 10:56:00 morsch
38 AliGenMC base class for AliGenParam and AliGenPythia commonalities.
42 // Base class for generators using external MC generators.
43 // For example AliGenPythia using Pythia.
44 // Provides basic functionality: setting of kinematic cuts on
45 // decay products and particle selection.
46 // andreas.morsch@cern.ch
50 #include <TParticle.h>
57 // Default Constructor
59 SetChildMomentumRange();
67 AliGenMC::AliGenMC(Int_t npart)
72 SetChildMomentumRange();
80 for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0;
84 AliGenMC::AliGenMC(const AliGenMC & mc)
98 switch (fForceDecay) {
101 case kBJpsiDiElectron:
102 case kBPsiPrimeDiElectron:
103 fChildSelect[0] = kElectron;
108 case kBPsiPrimeDiMuon:
111 fChildSelect[0]=kMuonMinus;
114 fChildSelect[0]=kPiPlus;
115 fChildSelect[1]=kKPlus;
126 Bool_t AliGenMC::ParentSelected(Int_t ip) const
128 // True if particle is in list of parent particles to be selected
129 for (Int_t i=0; i<8; i++)
131 if (fParentSelect.At(i) == ip) return kTRUE;
136 Bool_t AliGenMC::ChildSelected(Int_t ip) const
138 // True if particle is in list of decay products to be selected
139 for (Int_t i=0; i<5; i++)
141 if (fChildSelect.At(i) == ip) return kTRUE;
146 Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) const
148 // Perform kinematic selection
149 Float_t px = particle->Px();
150 Float_t py = particle->Py();
151 Float_t pz = particle->Pz();
152 Float_t e = particle->Energy();
153 Float_t pt = particle->Pt();
154 Float_t p = particle->P();
155 Float_t theta = particle->Theta();
156 Float_t mass = particle->GetMass();
157 Float_t mt2 = pt * pt + mass * mass;
159 Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
162 if (TMath::Abs(pz) < e) {
163 y = 0.5*TMath::Log((e+pz)/(e-pz));
169 y0 = 0.5*TMath::Log((e+TMath::Abs(pz))*(e+TMath::Abs(pz))/mt2);
171 if (TMath::Abs(y) < 1.e10) {
178 y = (pz < 0) ? -y0 : y0;
182 // Primary particle cuts
184 // transverse momentum cut
185 if (pt > fPtMax || pt < fPtMin) {
186 // printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax);
191 if (p > fPMax || p < fPMin) {
192 // printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax);
197 if (theta > fThetaMax || theta < fThetaMin) {
198 // printf("\n failed theta cut %f %f %f \n",theta,fThetaMin,fThetaMax);
203 if (y > fYMax || y < fYMin) {
204 // printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax);
209 if (phi > fPhiMax || phi < fPhiMin) {
210 // printf("\n failed phi cut %f %f %f \n",phi,fPhiMin,fPhiMax);
215 // Decay product cuts
217 // transverse momentum cut
218 if (pt > fChildPtMax || pt < fChildPtMin) {
219 // printf("\n failed pt cut %f %f %f \n",pt,fChildPtMin,fChildPtMax);
224 if (p > fChildPMax || p < fChildPMin) {
225 // printf("\n failed p cut %f %f %f \n",p,fChildPMin,fChildPMax);
230 if (theta > fChildThetaMax || theta < fChildThetaMin) {
231 // printf("\n failed theta cut %f %f %f \n",theta,fChildThetaMin,fChildThetaMax);
236 if (y > fChildYMax || y < fChildYMin) {
237 // printf("\n failed y cut %f %f %f \n",y,fChildYMin,fChildYMax);
242 if (phi > fChildPhiMax || phi < fChildPhiMin) {
243 // printf("\n failed phi cut %f %f %f \n",phi,fChildPhiMin,fChildPhiMax);
253 Int_t AliGenMC::CheckPDGCode(Int_t pdgcode) const
256 // If the particle is in a diffractive state, then take action accordingly
261 //rho_diff0 -- difficult to translate, return rho0
264 //pi_diffr+ -- change to pi+
267 //omega_di0 -- change to omega0
270 //phi_diff0 -- return phi0
273 //J/psi_di0 -- return J/psi
276 //n_diffr -- return neutron
279 //p_diffr+ -- return proton
282 //non diffractive state -- return code unchanged
286 AliGenMC& AliGenMC::operator=(const AliGenMC& rhs)
288 // Assignment operator