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.6 2002/03/26 14:19:36 morsch
19 Saver calculation of rapdity.
21 Revision 1.5 2002/03/12 17:02:20 morsch
22 Change in calculation of rapidity, include case in which numerically e == pz.
24 Revision 1.4 2001/11/27 13:13:07 morsch
25 Maximum lifetime for long-lived particles to be put on the stack is parameter.
26 It can be set via SetMaximumLifetime(..).
28 Revision 1.3 2001/10/16 08:48:56 morsch
29 Common vertex related code moved to base class AliGenerator.
31 Revision 1.2 2001/10/15 08:15:51 morsch
32 Event vertex and vertex truncation setting moved into AliMC.
34 Revision 1.1 2001/07/13 10:56:00 morsch
35 AliGenMC base class for AliGenParam and AliGenPythia commonalities.
39 // Base class for generators using external MC generators.
40 // For example AliGenPythia using Pythia.
41 // Provides basic functionality: setting of kinematic cuts on
42 // decay products and particle selection.
43 // andreas.morsch@cern.ch
47 #include <TParticle.h>
54 // Default Constructor
56 SetChildMomentumRange();
64 AliGenMC::AliGenMC(Int_t npart)
69 SetChildMomentumRange();
77 for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0;
81 AliGenMC::AliGenMC(const AliGenMC & mc)
95 switch (fForceDecay) {
98 case kBJpsiDiElectron:
99 case kBPsiPrimeDiElectron:
100 fChildSelect[0] = kElectron;
105 case kBPsiPrimeDiMuon:
108 fChildSelect[0]=kMuonMinus;
111 fChildSelect[0]=kPiPlus;
112 fChildSelect[1]=kKPlus;
122 Bool_t AliGenMC::ParentSelected(Int_t ip) const
124 // True if particle is in list of parent particles to be selected
125 for (Int_t i=0; i<8; i++)
127 if (fParentSelect.At(i) == ip) return kTRUE;
132 Bool_t AliGenMC::ChildSelected(Int_t ip) const
134 // True if particle is in list of decay products to be selected
135 for (Int_t i=0; i<5; i++)
137 if (fChildSelect.At(i) == ip) return kTRUE;
142 Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) const
144 // Perform kinematic selection
145 Float_t px = particle->Px();
146 Float_t py = particle->Py();
147 Float_t pz = particle->Pz();
148 Float_t e = particle->Energy();
149 Float_t pt = particle->Pt();
150 Float_t p = particle->P();
151 Float_t theta = particle->Theta();
152 Float_t mass = particle->GetMass();
153 Float_t mt2 = pt * pt + mass * mass;
155 Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px)));
158 if (TMath::Abs(pz) < e) {
159 y = 0.5*TMath::Log((e+pz)/(e-pz));
165 y0 = 0.5*TMath::Log((e+TMath::Abs(pz))*(e+TMath::Abs(pz))/mt2);
167 if (TMath::Abs(y) < 1.e10) {
174 y = (pz < 0) ? -y0 : y0;
178 // Primary particle cuts
180 // transverse momentum cut
181 if (pt > fPtMax || pt < fPtMin) {
182 // printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax);
187 if (p > fPMax || p < fPMin) {
188 // printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax);
193 if (theta > fThetaMax || theta < fThetaMin) {
194 // printf("\n failed theta cut %f %f %f \n",theta,fThetaMin,fThetaMax);
199 if (y > fYMax || y < fYMin) {
200 // printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax);
205 if (phi > fPhiMax || phi < fPhiMin) {
206 // printf("\n failed phi cut %f %f %f \n",phi,fPhiMin,fPhiMax);
211 // Decay product cuts
213 // transverse momentum cut
214 if (pt > fChildPtMax || pt < fChildPtMin) {
215 // printf("\n failed pt cut %f %f %f \n",pt,fChildPtMin,fChildPtMax);
220 if (p > fChildPMax || p < fChildPMin) {
221 // printf("\n failed p cut %f %f %f \n",p,fChildPMin,fChildPMax);
226 if (theta > fChildThetaMax || theta < fChildThetaMin) {
227 // printf("\n failed theta cut %f %f %f \n",theta,fChildThetaMin,fChildThetaMax);
232 if (y > fChildYMax || y < fChildYMin) {
233 // printf("\n failed y cut %f %f %f \n",y,fChildYMin,fChildYMax);
238 if (phi > fChildPhiMax || phi < fChildPhiMin) {
239 // printf("\n failed phi cut %f %f %f \n",phi,fChildPhiMin,fChildPhiMax);
249 Int_t AliGenMC::CheckPDGCode(Int_t pdgcode) const
252 // If the particle is in a diffractive state, then take action accordingly
257 //rho_diff0 -- difficult to translate, return rho0
260 //pi_diffr+ -- change to pi+
263 //omega_di0 -- change to omega0
266 //phi_diff0 -- return phi0
269 //J/psi_di0 -- return J/psi
272 //n_diffr -- return neutron
275 //p_diffr+ -- return proton
278 //non diffractive state -- return code unchanged
282 AliGenMC& AliGenMC::operator=(const AliGenMC& rhs)
284 // Assignment operator