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