]>
Commit | Line | Data |
---|---|---|
e36044d6 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
027677ae | 18 | Revision 1.10 2002/06/05 14:05:46 morsch |
19 | Decayer option kPhiKK for forced phi->K+K- decay added. | |
20 | ||
00cb2f27 | 21 | Revision 1.9 2002/05/30 14:58:29 morsch |
22 | Add pointer to AliGeometry to handle geometrical acceptance. (G. MArtinez) | |
23 | ||
65de9f86 | 24 | Revision 1.8 2002/04/26 10:42:35 morsch |
25 | Case kNoDecayHeavy added. (N. Carrer) | |
26 | ||
d5f86442 | 27 | Revision 1.7 2002/04/17 10:32:32 morsch |
28 | Coding Rule violations corrected. | |
29 | ||
62d0ae06 | 30 | Revision 1.6 2002/03/26 14:19:36 morsch |
31 | Saver calculation of rapdity. | |
32 | ||
fef61e14 | 33 | Revision 1.5 2002/03/12 17:02:20 morsch |
34 | Change in calculation of rapidity, include case in which numerically e == pz. | |
35 | ||
95450c6d | 36 | Revision 1.4 2001/11/27 13:13:07 morsch |
37 | Maximum lifetime for long-lived particles to be put on the stack is parameter. | |
38 | It can be set via SetMaximumLifetime(..). | |
39 | ||
47fc6bd5 | 40 | Revision 1.3 2001/10/16 08:48:56 morsch |
41 | Common vertex related code moved to base class AliGenerator. | |
42 | ||
b80a8e41 | 43 | Revision 1.2 2001/10/15 08:15:51 morsch |
44 | Event vertex and vertex truncation setting moved into AliMC. | |
45 | ||
dba8ac91 | 46 | Revision 1.1 2001/07/13 10:56:00 morsch |
47 | AliGenMC base class for AliGenParam and AliGenPythia commonalities. | |
48 | ||
e36044d6 | 49 | */ |
50 | ||
62d0ae06 | 51 | // Base class for generators using external MC generators. |
52 | // For example AliGenPythia using Pythia. | |
53 | // Provides basic functionality: setting of kinematic cuts on | |
54 | // decay products and particle selection. | |
55 | // andreas.morsch@cern.ch | |
56 | ||
e36044d6 | 57 | #include "AliGenMC.h" |
58 | #include "AliPDG.h" | |
65de9f86 | 59 | #include <TMath.h> |
e36044d6 | 60 | #include <TParticle.h> |
61 | ||
62 | ClassImp(AliGenMC) | |
63 | ||
64 | AliGenMC::AliGenMC() | |
65 | :AliGenerator() | |
66 | { | |
67 | // Default Constructor | |
68 | SetCutOnChild(); | |
69 | SetChildMomentumRange(); | |
70 | SetChildPtRange(); | |
71 | SetChildPhiRange(); | |
72 | SetChildThetaRange(); | |
73 | SetChildYRange(); | |
47fc6bd5 | 74 | SetMaximumLifetime(); |
65de9f86 | 75 | SetGeometryAcceptance(); |
76 | SetPdgCodeParticleforAcceptanceCut(); | |
77 | SetNumberOfAcceptedParticles(); | |
e36044d6 | 78 | } |
79 | ||
80 | AliGenMC::AliGenMC(Int_t npart) | |
81 | :AliGenerator(npart) | |
82 | { | |
83 | // Constructor | |
84 | SetCutOnChild(); | |
85 | SetChildMomentumRange(); | |
86 | SetChildPtRange(); | |
87 | SetChildPhiRange(); | |
88 | SetChildThetaRange(); | |
89 | SetChildYRange(); | |
90 | // | |
91 | fParentSelect.Set(8); | |
92 | fChildSelect.Set(8); | |
93 | for (Int_t i=0; i<8; i++) fParentSelect[i]=fChildSelect[i]=0; | |
47fc6bd5 | 94 | SetMaximumLifetime(); |
65de9f86 | 95 | SetGeometryAcceptance(); |
96 | SetPdgCodeParticleforAcceptanceCut(); | |
97 | SetNumberOfAcceptedParticles(); | |
e36044d6 | 98 | } |
99 | ||
100 | AliGenMC::AliGenMC(const AliGenMC & mc) | |
101 | { | |
102 | // copy constructor | |
103 | } | |
104 | ||
105 | AliGenMC::~AliGenMC() | |
106 | { | |
107 | // Destructor | |
108 | } | |
109 | ||
110 | void AliGenMC::Init() | |
111 | { | |
112 | // | |
113 | // Initialization | |
114 | switch (fForceDecay) { | |
115 | case kSemiElectronic: | |
116 | case kDiElectron: | |
117 | case kBJpsiDiElectron: | |
118 | case kBPsiPrimeDiElectron: | |
47fc6bd5 | 119 | fChildSelect[0] = kElectron; |
e36044d6 | 120 | break; |
121 | case kSemiMuonic: | |
122 | case kDiMuon: | |
123 | case kBJpsiDiMuon: | |
124 | case kBPsiPrimeDiMuon: | |
125 | case kPiToMu: | |
126 | case kKaToMu: | |
127 | fChildSelect[0]=kMuonMinus; | |
128 | break; | |
129 | case kHadronicD: | |
130 | fChildSelect[0]=kPiPlus; | |
131 | fChildSelect[1]=kKPlus; | |
132 | break; | |
00cb2f27 | 133 | case kPhiKK: |
027677ae | 134 | fChildSelect[0]=kKPlus; |
62d0ae06 | 135 | case kOmega: |
e36044d6 | 136 | case kAll: |
137 | case kNoDecay: | |
d5f86442 | 138 | case kNoDecayHeavy: |
e36044d6 | 139 | break; |
140 | } | |
141 | } | |
142 | ||
143 | ||
62d0ae06 | 144 | Bool_t AliGenMC::ParentSelected(Int_t ip) const |
e36044d6 | 145 | { |
146 | // True if particle is in list of parent particles to be selected | |
147 | for (Int_t i=0; i<8; i++) | |
148 | { | |
62d0ae06 | 149 | if (fParentSelect.At(i) == ip) return kTRUE; |
e36044d6 | 150 | } |
151 | return kFALSE; | |
152 | } | |
153 | ||
62d0ae06 | 154 | Bool_t AliGenMC::ChildSelected(Int_t ip) const |
e36044d6 | 155 | { |
156 | // True if particle is in list of decay products to be selected | |
157 | for (Int_t i=0; i<5; i++) | |
158 | { | |
62d0ae06 | 159 | if (fChildSelect.At(i) == ip) return kTRUE; |
e36044d6 | 160 | } |
161 | return kFALSE; | |
162 | } | |
163 | ||
62d0ae06 | 164 | Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) const |
e36044d6 | 165 | { |
166 | // Perform kinematic selection | |
167 | Float_t px = particle->Px(); | |
168 | Float_t py = particle->Py(); | |
169 | Float_t pz = particle->Pz(); | |
170 | Float_t e = particle->Energy(); | |
171 | Float_t pt = particle->Pt(); | |
172 | Float_t p = particle->P(); | |
173 | Float_t theta = particle->Theta(); | |
95450c6d | 174 | Float_t mass = particle->GetMass(); |
175 | Float_t mt2 = pt * pt + mass * mass; | |
176 | ||
e36044d6 | 177 | Float_t phi = Float_t(TMath::ATan2(Double_t(py),Double_t(px))); |
95450c6d | 178 | Double_t y, y0; |
179 | ||
fef61e14 | 180 | if (TMath::Abs(pz) < e) { |
95450c6d | 181 | y = 0.5*TMath::Log((e+pz)/(e-pz)); |
182 | } else { | |
183 | y = 1.e10; | |
184 | } | |
e36044d6 | 185 | |
95450c6d | 186 | if (mt2) { |
187 | y0 = 0.5*TMath::Log((e+TMath::Abs(pz))*(e+TMath::Abs(pz))/mt2); | |
e36044d6 | 188 | } else { |
95450c6d | 189 | if (TMath::Abs(y) < 1.e10) { |
190 | y0 = y; | |
191 | } else { | |
192 | y0 = 1.e10; | |
193 | } | |
e36044d6 | 194 | } |
95450c6d | 195 | |
196 | y = (pz < 0) ? -y0 : y0; | |
e36044d6 | 197 | |
198 | if (flag == 0) { | |
199 | // | |
200 | // Primary particle cuts | |
201 | // | |
202 | // transverse momentum cut | |
203 | if (pt > fPtMax || pt < fPtMin) { | |
204 | // printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax); | |
205 | return kFALSE; | |
206 | } | |
207 | // | |
208 | // momentum cut | |
209 | if (p > fPMax || p < fPMin) { | |
210 | // printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax); | |
211 | return kFALSE; | |
212 | } | |
213 | // | |
214 | // theta cut | |
215 | if (theta > fThetaMax || theta < fThetaMin) { | |
216 | // printf("\n failed theta cut %f %f %f \n",theta,fThetaMin,fThetaMax); | |
217 | return kFALSE; | |
218 | } | |
219 | // | |
220 | // rapidity cut | |
221 | if (y > fYMax || y < fYMin) { | |
222 | // printf("\n failed y cut %f %f %f \n",y,fYMin,fYMax); | |
223 | return kFALSE; | |
224 | } | |
225 | // | |
226 | // phi cut | |
227 | if (phi > fPhiMax || phi < fPhiMin) { | |
228 | // printf("\n failed phi cut %f %f %f \n",phi,fPhiMin,fPhiMax); | |
229 | return kFALSE; | |
230 | } | |
231 | } else { | |
232 | // | |
233 | // Decay product cuts | |
234 | // | |
235 | // transverse momentum cut | |
236 | if (pt > fChildPtMax || pt < fChildPtMin) { | |
237 | // printf("\n failed pt cut %f %f %f \n",pt,fChildPtMin,fChildPtMax); | |
238 | return kFALSE; | |
239 | } | |
240 | // | |
241 | // momentum cut | |
242 | if (p > fChildPMax || p < fChildPMin) { | |
243 | // printf("\n failed p cut %f %f %f \n",p,fChildPMin,fChildPMax); | |
244 | return kFALSE; | |
245 | } | |
246 | // | |
247 | // theta cut | |
248 | if (theta > fChildThetaMax || theta < fChildThetaMin) { | |
249 | // printf("\n failed theta cut %f %f %f \n",theta,fChildThetaMin,fChildThetaMax); | |
250 | return kFALSE; | |
251 | } | |
252 | // | |
253 | // rapidity cut | |
254 | if (y > fChildYMax || y < fChildYMin) { | |
255 | // printf("\n failed y cut %f %f %f \n",y,fChildYMin,fChildYMax); | |
256 | return kFALSE; | |
257 | } | |
258 | // | |
259 | // phi cut | |
260 | if (phi > fChildPhiMax || phi < fChildPhiMin) { | |
261 | // printf("\n failed phi cut %f %f %f \n",phi,fChildPhiMin,fChildPhiMax); | |
262 | return kFALSE; | |
263 | } | |
264 | } | |
265 | ||
e36044d6 | 266 | return kTRUE; |
267 | } | |
268 | ||
65de9f86 | 269 | Bool_t AliGenMC::CheckAcceptanceGeometry(Int_t np, TClonesArray* particles) |
270 | { | |
271 | Bool_t Check ; // All fPdgCodeParticleforAcceptanceCut particles are in in the fGeometryAcceptance acceptance | |
272 | Int_t NumberOfPdgCodeParticleforAcceptanceCut=0; | |
273 | Int_t NumberOfAcceptedPdgCodeParticleforAcceptanceCut=0; | |
274 | TParticle * particle; | |
275 | Int_t i; | |
276 | for (i=0; i<np; i++) { | |
277 | particle = (TParticle *) particles->At(i); | |
278 | if( TMath::Abs( particle->GetPdgCode() ) == TMath::Abs( fPdgCodeParticleforAcceptanceCut ) ) { | |
279 | NumberOfPdgCodeParticleforAcceptanceCut++; | |
280 | if (fGeometryAcceptance->Impact(particle)) NumberOfAcceptedPdgCodeParticleforAcceptanceCut++; | |
281 | } | |
282 | } | |
283 | if ( NumberOfAcceptedPdgCodeParticleforAcceptanceCut > (fNumberOfAcceptedParticles-1) ) | |
284 | Check = kTRUE; | |
285 | else | |
286 | Check = kFALSE; | |
287 | ||
288 | return Check; | |
289 | } | |
290 | ||
62d0ae06 | 291 | Int_t AliGenMC::CheckPDGCode(Int_t pdgcode) const |
e36044d6 | 292 | { |
293 | // | |
294 | // If the particle is in a diffractive state, then take action accordingly | |
295 | switch (pdgcode) { | |
296 | case 91: | |
297 | return 92; | |
298 | case 110: | |
299 | //rho_diff0 -- difficult to translate, return rho0 | |
300 | return 113; | |
301 | case 210: | |
302 | //pi_diffr+ -- change to pi+ | |
303 | return 211; | |
304 | case 220: | |
305 | //omega_di0 -- change to omega0 | |
306 | return 223; | |
307 | case 330: | |
308 | //phi_diff0 -- return phi0 | |
309 | return 333; | |
310 | case 440: | |
311 | //J/psi_di0 -- return J/psi | |
312 | return 443; | |
313 | case 2110: | |
314 | //n_diffr -- return neutron | |
315 | return 2112; | |
316 | case 2210: | |
317 | //p_diffr+ -- return proton | |
318 | return 2212; | |
319 | } | |
320 | //non diffractive state -- return code unchanged | |
321 | return pdgcode; | |
322 | } | |
323 | ||
324 | AliGenMC& AliGenMC::operator=(const AliGenMC& rhs) | |
325 | { | |
326 | // Assignment operator | |
327 | return *this; | |
328 | } | |
329 |