]>
Commit | Line | Data |
---|---|---|
4c039060 | 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$ | |
2904363f | 18 | Revision 1.41 2003/01/09 17:38:47 morsch |
19 | Draw() method added. | |
20 | ||
5bd39445 | 21 | Revision 1.40 2002/10/14 14:55:35 hristov |
22 | Merging the VirtualMC branch to the main development branch (HEAD) | |
23 | ||
b9d0a01d | 24 | Revision 1.36.6.3 2002/10/10 16:40:08 hristov |
25 | Updating VirtualMC to v3-09-02 | |
26 | ||
27 | Revision 1.39 2002/09/16 08:21:16 morsch | |
28 | Use TDatabasePDG::Instance(); | |
29 | ||
349be858 | 30 | Revision 1.38 2002/05/30 14:59:12 morsch |
31 | Check geometrical acceptance. (G. Martinez) | |
32 | ||
1242532d | 33 | Revision 1.37 2002/04/17 10:20:44 morsch |
34 | Coding Rule violations corrected. | |
35 | ||
6d4dd317 | 36 | Revision 1.36 2002/02/08 16:50:50 morsch |
37 | Add name and title in constructor. | |
38 | ||
8b31bfac | 39 | Revision 1.35 2002/01/21 10:02:40 morsch |
40 | ty is Double_t | |
41 | Abort if too high rapidity causes numerical paroblem. User has to specify | |
42 | meaningful y-range. | |
43 | ||
2d7a47be | 44 | Revision 1.34 2001/11/27 13:13:07 morsch |
45 | Maximum lifetime for long-lived particles to be put on the stack is parameter. | |
46 | It can be set via SetMaximumLifetime(..). | |
47 | ||
47fc6bd5 | 48 | Revision 1.33 2001/10/21 18:35:56 hristov |
49 | Several pointers were set to zero in the default constructors to avoid memory management problems | |
50 | ||
2685bf00 | 51 | Revision 1.32 2001/07/27 17:09:36 morsch |
52 | Use local SetTrack, KeepTrack and SetHighWaterMark methods | |
53 | to delegate either to local stack or to stack owned by AliRun. | |
54 | (Piotr Skowronski, A.M.) | |
55 | ||
a99cf51f | 56 | Revision 1.31 2001/07/13 10:58:54 morsch |
57 | - Some coded moved to AliGenMC | |
58 | - Improved handling of secondary vertices. | |
59 | ||
fff02fee | 60 | Revision 1.30 2001/06/15 07:55:04 morsch |
61 | Put only first generation decay products on the stack. | |
62 | ||
6ba00c52 | 63 | Revision 1.29 2001/03/27 10:58:41 morsch |
64 | Initialize decayer before generation. Important if run inside cocktail. | |
65 | ||
771bbe45 | 66 | Revision 1.28 2001/03/09 13:01:41 morsch |
67 | - enum constants for paramterisation type (particle family) moved to AliGen*lib.h | |
68 | - use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants | |
69 | ||
34f60c01 | 70 | Revision 1.27 2001/02/02 15:21:10 morsch |
71 | Set high water mark after last particle. | |
72 | Use Vertex() method for Vertex. | |
73 | ||
d9ea0e3b | 74 | Revision 1.26 2000/12/21 16:24:06 morsch |
75 | Coding convention clean-up | |
76 | ||
675e9664 | 77 | Revision 1.25 2000/11/30 07:12:50 alibrary |
78 | Introducing new Rndm and QA classes | |
79 | ||
65fb704d | 80 | Revision 1.24 2000/10/18 19:11:27 hristov |
81 | Division by zero fixed | |
82 | ||
919c2096 | 83 | Revision 1.23 2000/10/02 21:28:06 fca |
84 | Removal of useless dependecies via forward declarations | |
85 | ||
94de3818 | 86 | Revision 1.22 2000/09/12 14:14:55 morsch |
87 | Call fDecayer->ForceDecay() at the beginning of Generate(). | |
88 | ||
00d6ce7d | 89 | Revision 1.21 2000/09/08 15:39:01 morsch |
90 | Handle the case fForceDecay=all during the generation, i.e. select all secondaries. | |
91 | ||
5ab0acc9 | 92 | Revision 1.20 2000/09/06 14:35:44 morsch |
93 | Use AliDecayerPythia for particle decays. | |
94 | ||
fa480368 | 95 | Revision 1.19 2000/07/11 18:24:56 fca |
96 | Coding convention corrections + few minor bug fixes | |
97 | ||
aee8290b | 98 | Revision 1.18 2000/06/29 21:08:27 morsch |
99 | All paramatrisation libraries derive from the pure virtual base class AliGenLib. | |
100 | This allows to pass a pointer to a library directly to AliGenParam and avoids the | |
101 | use of function pointers in Config.C. | |
102 | ||
b22ee262 | 103 | Revision 1.17 2000/06/09 20:33:30 morsch |
104 | All coding rule violations except RS3 corrected | |
105 | ||
f87cfe57 | 106 | Revision 1.16 2000/05/02 07:51:31 morsch |
107 | - Control precision of pT sampling TF1::SetNpx(..) | |
108 | - Correct initialisation of child-cuts in all constructors. | |
109 | - Most coding rule violations corrected. | |
110 | ||
749070b6 | 111 | Revision 1.15 2000/04/03 15:42:12 morsch |
112 | Cuts on primary particles are separated from those on the decay products. Methods | |
113 | SetChildMomentumRange, SetChildPtRange, SetChildPhiRange, SetChildThetaRange added. | |
114 | ||
cc5d764c | 115 | Revision 1.14 1999/11/09 07:38:48 fca |
116 | Changes for compatibility with version 2.23 of ROOT | |
117 | ||
084c1b4a | 118 | Revision 1.13 1999/11/04 11:30:31 fca |
119 | Correct the logics for SetForceDecay | |
120 | ||
28337bc1 | 121 | Revision 1.12 1999/11/03 17:43:20 fca |
122 | New version from G.Martinez & A.Morsch | |
123 | ||
886b6f73 | 124 | Revision 1.11 1999/09/29 09:24:14 fca |
125 | Introduction of the Copyright and cvs Log | |
126 | ||
4c039060 | 127 | */ |
128 | ||
6d4dd317 | 129 | |
130 | ||
131 | // Class to generate particles from using paramtrized pT and y distributions. | |
132 | // Distributions are obtained from pointer to object of type AliGenLib. | |
133 | // (For example AliGenMUONlib) | |
134 | // Decays are performed using Pythia. | |
135 | // andreas.morsch@cern.ch | |
136 | ||
fe4da5cc | 137 | #include "AliGenParam.h" |
2904363f | 138 | #include "AliDecayer.h" |
fe4da5cc | 139 | #include "AliGenMUONlib.h" |
140 | #include "AliRun.h" | |
1578254f | 141 | #include <TParticle.h> |
fa480368 | 142 | #include <TParticlePDG.h> |
143 | #include <TDatabasePDG.h> | |
144 | #include <TLorentzVector.h> | |
145 | ||
f87cfe57 | 146 | #include <TF1.h> |
5bd39445 | 147 | #include <TCanvas.h> |
148 | #include <TH1.h> | |
fe4da5cc | 149 | |
150 | ClassImp(AliGenParam) | |
151 | ||
152 | //------------------------------------------------------------ | |
153 | ||
154 | //Begin_Html | |
155 | /* | |
1439f98e | 156 | <img src="picts/AliGenParam.gif"> |
fe4da5cc | 157 | */ |
158 | //End_Html | |
159 | ||
160 | //____________________________________________________________ | |
161 | //____________________________________________________________ | |
162 | AliGenParam::AliGenParam() | |
fe4da5cc | 163 | { |
b22ee262 | 164 | // Deafault constructor |
165 | fPtPara = 0; | |
166 | fYPara = 0; | |
34f60c01 | 167 | fParam = 0; |
168 | fAnalog = kAnalog; | |
b22ee262 | 169 | SetDeltaPt(); |
675e9664 | 170 | // |
171 | // Set random number generator | |
172 | sRandom = fRandom; | |
2685bf00 | 173 | fDecayer = 0; |
8b31bfac | 174 | |
175 | ||
b22ee262 | 176 | } |
177 | ||
fff02fee | 178 | AliGenParam::AliGenParam(Int_t npart, AliGenLib * Library, Int_t param, char* tname):AliGenMC(npart) |
b22ee262 | 179 | { |
180 | // Constructor using number of particles parameterisation id and library | |
8b31bfac | 181 | fName = "Param"; |
182 | fTitle= "Particle Generator using pT and y parameterisation"; | |
b22ee262 | 183 | |
184 | fPtParaFunc = Library->GetPt(param, tname); | |
185 | fYParaFunc = Library->GetY (param, tname); | |
186 | fIpParaFunc = Library->GetIp(param, tname); | |
187 | ||
188 | fPtPara = 0; | |
189 | fYPara = 0; | |
190 | fParam = param; | |
34f60c01 | 191 | fAnalog = kAnalog; |
b22ee262 | 192 | SetForceDecay(); |
b22ee262 | 193 | SetDeltaPt(); |
675e9664 | 194 | // |
195 | // Set random number generator | |
196 | sRandom = fRandom; | |
fe4da5cc | 197 | } |
198 | ||
199 | //____________________________________________________________ | |
886b6f73 | 200 | |
fff02fee | 201 | AliGenParam::AliGenParam(Int_t npart, Int_t param, char* tname):AliGenMC(npart) |
fe4da5cc | 202 | { |
b22ee262 | 203 | // Constructor using parameterisation id and number of particles |
8b31bfac | 204 | // |
205 | fName = "Param"; | |
206 | fTitle= "Particle Generator using pT and y parameterisation"; | |
207 | ||
675e9664 | 208 | AliGenLib* pLibrary = new AliGenMUONlib(); |
b22ee262 | 209 | |
675e9664 | 210 | fPtParaFunc = pLibrary->GetPt(param, tname); |
211 | fYParaFunc = pLibrary->GetY (param, tname); | |
212 | fIpParaFunc = pLibrary->GetIp(param, tname); | |
b22ee262 | 213 | |
214 | fPtPara = 0; | |
215 | fYPara = 0; | |
216 | fParam = param; | |
34f60c01 | 217 | fAnalog = kAnalog; |
b22ee262 | 218 | fChildSelect.Set(5); |
219 | for (Int_t i=0; i<5; i++) fChildSelect[i]=0; | |
220 | SetForceDecay(); | |
221 | SetCutOnChild(); | |
222 | SetChildMomentumRange(); | |
223 | SetChildPtRange(); | |
224 | SetChildPhiRange(); | |
225 | SetChildThetaRange(); | |
226 | SetDeltaPt(); | |
fe4da5cc | 227 | } |
228 | ||
34f60c01 | 229 | AliGenParam::AliGenParam(Int_t npart, Int_t param, |
886b6f73 | 230 | Double_t (*PtPara) (Double_t*, Double_t*), |
231 | Double_t (*YPara ) (Double_t* ,Double_t*), | |
65fb704d | 232 | Int_t (*IpPara) (TRandom *)) |
fff02fee | 233 | :AliGenMC(npart) |
886b6f73 | 234 | { |
749070b6 | 235 | // Constructor |
28337bc1 | 236 | // Gines Martinez 1/10/99 |
8b31bfac | 237 | fName = "Param"; |
238 | fTitle= "Particle Generator using pT and y parameterisation"; | |
239 | ||
886b6f73 | 240 | fPtParaFunc = PtPara; |
241 | fYParaFunc = YPara; | |
242 | fIpParaFunc = IpPara; | |
28337bc1 | 243 | // |
886b6f73 | 244 | fPtPara = 0; |
245 | fYPara = 0; | |
246 | fParam = param; | |
34f60c01 | 247 | fAnalog = kAnalog; |
886b6f73 | 248 | fChildSelect.Set(5); |
249 | for (Int_t i=0; i<5; i++) fChildSelect[i]=0; | |
250 | SetForceDecay(); | |
251 | SetCutOnChild(); | |
749070b6 | 252 | SetChildMomentumRange(); |
253 | SetChildPtRange(); | |
254 | SetChildPhiRange(); | |
255 | SetChildThetaRange(); | |
256 | SetDeltaPt(); | |
886b6f73 | 257 | } |
258 | ||
f87cfe57 | 259 | |
6d4dd317 | 260 | AliGenParam::AliGenParam(const AliGenParam & Param) |
f87cfe57 | 261 | { |
262 | // copy constructor | |
6d4dd317 | 263 | Param.Copy(*this); |
f87cfe57 | 264 | } |
265 | ||
fe4da5cc | 266 | //____________________________________________________________ |
267 | AliGenParam::~AliGenParam() | |
268 | { | |
749070b6 | 269 | // Destructor |
fe4da5cc | 270 | delete fPtPara; |
271 | delete fYPara; | |
272 | } | |
273 | ||
274 | //____________________________________________________________ | |
275 | void AliGenParam::Init() | |
276 | { | |
749070b6 | 277 | // Initialisation |
fa480368 | 278 | |
2904363f | 279 | if (gMC) fDecayer = gMC->GetDecayer(); |
fe4da5cc | 280 | //Begin_Html |
281 | /* | |
1439f98e | 282 | <img src="picts/AliGenParam.gif"> |
fe4da5cc | 283 | */ |
284 | //End_Html | |
285 | ||
749070b6 | 286 | fPtPara = new TF1("Pt-Parametrization",fPtParaFunc,fPtMin,fPtMax,0); |
287 | // Set representation precision to 10 MeV | |
288 | Int_t npx= Int_t((fPtMax-fPtMin)/fDeltaPt); | |
289 | ||
290 | fPtPara->SetNpx(npx); | |
291 | ||
292 | fYPara = new TF1("Y -Parametrization",fYParaFunc,fYMin,fYMax,0); | |
293 | TF1* ptPara = new TF1("Pt-Parametrization",fPtParaFunc,0,15,0); | |
294 | TF1* yPara = new TF1("Y -Parametrization",fYParaFunc,-6,6,0); | |
b7601ac4 | 295 | |
fe4da5cc | 296 | // |
297 | // dN/dy| y=0 | |
749070b6 | 298 | Double_t y1=0; |
299 | Double_t y2=0; | |
300 | ||
301 | fdNdy0=fYParaFunc(&y1,&y2); | |
fe4da5cc | 302 | // |
303 | // Integral over generation region | |
749070b6 | 304 | Float_t intYS = yPara ->Integral(fYMin, fYMax); |
305 | Float_t intPt0 = ptPara->Integral(0,15); | |
306 | Float_t intPtS = ptPara->Integral(fPtMin,fPtMax); | |
307 | Float_t phiWgt=(fPhiMax-fPhiMin)/2./TMath::Pi(); | |
34f60c01 | 308 | if (fAnalog == kAnalog) { |
749070b6 | 309 | fYWgt = intYS/fdNdy0; |
310 | fPtWgt = intPtS/intPt0; | |
311 | fParentWeight = fYWgt*fPtWgt*phiWgt/fNpart; | |
312 | } else { | |
313 | fYWgt = intYS/fdNdy0; | |
314 | fPtWgt = (fPtMax-fPtMin)/intPt0; | |
315 | fParentWeight = fYWgt*fPtWgt*phiWgt/fNpart; | |
316 | } | |
fe4da5cc | 317 | // |
318 | // particle decay related initialization | |
00d6ce7d | 319 | fDecayer->SetForceDecay(fForceDecay); |
fa480368 | 320 | fDecayer->Init(); |
00d6ce7d | 321 | |
fe4da5cc | 322 | // |
fff02fee | 323 | AliGenMC::Init(); |
fe4da5cc | 324 | } |
325 | ||
326 | //____________________________________________________________ | |
327 | void AliGenParam::Generate() | |
328 | { | |
28337bc1 | 329 | // |
330 | // Generate 'npart' of light and heavy mesons (J/Psi, upsilon or phi, Pion, | |
331 | // Kaons, Etas, Omegas) and Baryons (proton, antiprotons, neutrons and | |
332 | // antineutrons in the the desired theta, phi and momentum windows; | |
333 | // Gaussian smearing on the vertex is done if selected. | |
cc5d764c | 334 | // The decay of heavy mesons is done using lujet, |
335 | // and the childern particle are tracked by GEANT | |
336 | // However, light mesons are directly tracked by GEANT | |
337 | // setting fForceDecay = nodecay (SetForceDecay(nodecay)) | |
28337bc1 | 338 | // |
771bbe45 | 339 | // |
340 | // Reinitialize decayer | |
341 | fDecayer->Init(); | |
342 | // | |
28337bc1 | 343 | Float_t polar[3]= {0,0,0}; // Polarisation of the parent particle (for GEANT tracking) |
344 | Float_t origin0[3]; // Origin of the generated parent particle (for GEANT tracking) | |
345 | Float_t pt, pl, ptot; // Transverse, logitudinal and total momenta of the parent particle | |
346 | Float_t phi, theta; // Phi and theta spherical angles of the parent particle momentum | |
347 | Float_t p[3], pc[3], | |
fff02fee | 348 | och[3]; // Momentum, polarisation and origin of the children particles from lujet |
2d7a47be | 349 | Double_t ty, xmt; |
fff02fee | 350 | Int_t nt, i, j; |
fe4da5cc | 351 | Float_t wgtp, wgtch; |
352 | Double_t dummy; | |
09fd3ea2 | 353 | static TClonesArray *particles; |
fe4da5cc | 354 | // |
fff02fee | 355 | if(!particles) particles = new TClonesArray("TParticle",1000); |
8b31bfac | 356 | |
349be858 | 357 | TDatabasePDG *pDataBase = TDatabasePDG::Instance(); |
fe4da5cc | 358 | // |
359 | Float_t random[6]; | |
28337bc1 | 360 | |
361 | // Calculating vertex position per event | |
fe4da5cc | 362 | for (j=0;j<3;j++) origin0[j]=fOrigin[j]; |
aee8290b | 363 | if(fVertexSmear==kPerEvent) { |
d9ea0e3b | 364 | Vertex(); |
365 | for (j=0;j<3;j++) origin0[j]=fVertex[j]; | |
fe4da5cc | 366 | } |
d9ea0e3b | 367 | |
21aaa175 | 368 | Int_t ipa=0; |
fff02fee | 369 | |
28337bc1 | 370 | // Generating fNpart particles |
21aaa175 | 371 | while (ipa<fNpart) { |
cc5d764c | 372 | while(1) { |
fe4da5cc | 373 | // |
374 | // particle type | |
65fb704d | 375 | Int_t iPart = fIpParaFunc(fRandom); |
fa480368 | 376 | fChildWeight=(fDecayer->GetPartialBranchingRatio(iPart))*fParentWeight; |
675e9664 | 377 | TParticlePDG *particle = pDataBase->GetParticle(iPart); |
fa480368 | 378 | Float_t am = particle->Mass(); |
8b31bfac | 379 | |
65fb704d | 380 | Rndm(random,2); |
fe4da5cc | 381 | // |
382 | // phi | |
383 | phi=fPhiMin+random[0]*(fPhiMax-fPhiMin); | |
384 | // | |
385 | // y | |
2d7a47be | 386 | ty = TMath::TanH(fYPara->GetRandom()); |
fe4da5cc | 387 | // |
388 | // pT | |
34f60c01 | 389 | if (fAnalog == kAnalog) { |
fe4da5cc | 390 | pt=fPtPara->GetRandom(); |
391 | wgtp=fParentWeight; | |
392 | wgtch=fChildWeight; | |
393 | } else { | |
394 | pt=fPtMin+random[1]*(fPtMax-fPtMin); | |
395 | Double_t ptd=pt; | |
396 | wgtp=fParentWeight*fPtParaFunc(& ptd, &dummy); | |
397 | wgtch=fChildWeight*fPtParaFunc(& ptd, &dummy); | |
398 | } | |
399 | xmt=sqrt(pt*pt+am*am); | |
2d7a47be | 400 | if (TMath::Abs(ty)==1.) { |
401 | ty=0.; | |
402 | Fatal("AliGenParam", | |
403 | "Division by 0: Please check you rapidity range !"); | |
404 | } | |
405 | ||
fe4da5cc | 406 | pl=xmt*ty/sqrt(1.-ty*ty); |
407 | theta=TMath::ATan2(pt,pl); | |
cc5d764c | 408 | // Cut on theta |
fe4da5cc | 409 | if(theta<fThetaMin || theta>fThetaMax) continue; |
410 | ptot=TMath::Sqrt(pt*pt+pl*pl); | |
cc5d764c | 411 | // Cut on momentum |
fe4da5cc | 412 | if(ptot<fPMin || ptot>fPMax) continue; |
fff02fee | 413 | // |
fe4da5cc | 414 | p[0]=pt*TMath::Cos(phi); |
415 | p[1]=pt*TMath::Sin(phi); | |
416 | p[2]=pl; | |
aee8290b | 417 | if(fVertexSmear==kPerTrack) { |
65fb704d | 418 | Rndm(random,6); |
fe4da5cc | 419 | for (j=0;j<3;j++) { |
420 | origin0[j]= | |
421 | fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
422 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
423 | } | |
424 | } | |
28337bc1 | 425 | |
426 | // Looking at fForceDecay : | |
cc5d764c | 427 | // if fForceDecay != none Primary particle decays using |
428 | // AliPythia and children are tracked by GEANT | |
28337bc1 | 429 | // |
cc5d764c | 430 | // if fForceDecay == none Primary particle is tracked by GEANT |
431 | // (In the latest, make sure that GEANT actually does all the decays you want) | |
fe4da5cc | 432 | // |
fff02fee | 433 | |
34f60c01 | 434 | if (fForceDecay != kNoDecay) { |
28337bc1 | 435 | // Using lujet to decay particle |
886b6f73 | 436 | Float_t energy=TMath::Sqrt(ptot*ptot+am*am); |
fa480368 | 437 | TLorentzVector pmom(p[0], p[1], p[2], energy); |
438 | fDecayer->Decay(iPart,&pmom); | |
fe4da5cc | 439 | // |
cc5d764c | 440 | // select decay particles |
fa480368 | 441 | Int_t np=fDecayer->ImportParticles(particles); |
1242532d | 442 | |
443 | // Selecting GeometryAcceptance for particles fPdgCodeParticleforAcceptanceCut; | |
444 | if (fGeometryAcceptance) | |
445 | if (!CheckAcceptanceGeometry(np,particles)) continue; | |
886b6f73 | 446 | Int_t ncsel=0; |
fff02fee | 447 | Int_t* pFlag = new Int_t[np]; |
448 | Int_t* pParent = new Int_t[np]; | |
449 | Int_t* pSelected = new Int_t[np]; | |
450 | Int_t* trackIt = new Int_t[np]; | |
451 | ||
452 | for (i=0; i<np; i++) { | |
453 | pFlag[i] = 0; | |
454 | pSelected[i] = 0; | |
455 | pParent[i] = -1; | |
456 | } | |
457 | ||
6ba00c52 | 458 | if (np >1) { |
459 | TParticle* iparticle = (TParticle *) particles->At(0); | |
fff02fee | 460 | Int_t ipF, ipL; |
461 | for (i = 1; i<np ; i++) { | |
462 | trackIt[i] = 1; | |
6ba00c52 | 463 | iparticle = (TParticle *) particles->At(i); |
464 | Int_t kf = iparticle->GetPdgCode(); | |
fff02fee | 465 | Int_t ks = iparticle->GetStatusCode(); |
466 | // flagged particle | |
467 | ||
468 | if (pFlag[i] == 1) { | |
fff02fee | 469 | ipF = iparticle->GetFirstDaughter(); |
470 | ipL = iparticle->GetLastDaughter(); | |
471 | if (ipF > 0) for (j=ipF-1; j<ipL; j++) pFlag[j]=1; | |
472 | continue; | |
473 | } | |
474 | ||
475 | // flag decay products of particles with long life-time (c tau > .3 mum) | |
476 | ||
477 | if (ks != 1) { | |
2d7a47be | 478 | // TParticlePDG *particle = pDataBase->GetParticle(kf); |
fff02fee | 479 | |
480 | Double_t lifeTime = fDecayer->GetLifetime(kf); | |
2d7a47be | 481 | // Double_t mass = particle->Mass(); |
482 | // Double_t width = particle->Width(); | |
47fc6bd5 | 483 | if (lifeTime > (Double_t) fMaxLifeTime) { |
fff02fee | 484 | ipF = iparticle->GetFirstDaughter(); |
485 | ipL = iparticle->GetLastDaughter(); | |
486 | if (ipF > 0) for (j=ipF-1; j<ipL; j++) pFlag[j]=1; | |
487 | } else{ | |
488 | trackIt[i] = 0; | |
489 | pSelected[i] = 1; | |
490 | } | |
491 | } // ks==1 ? | |
fe4da5cc | 492 | // |
493 | // children | |
47fc6bd5 | 494 | |
fff02fee | 495 | if (ChildSelected(TMath::Abs(kf)) || fForceDecay == kAll && trackIt[i]) |
6ba00c52 | 496 | { |
6ba00c52 | 497 | if (fCutOnChild) { |
fff02fee | 498 | pc[0]=iparticle->Px(); |
499 | pc[1]=iparticle->Py(); | |
500 | pc[2]=iparticle->Pz(); | |
501 | Bool_t childok = KinematicSelection(iparticle, 1); | |
502 | if(childok) { | |
503 | pSelected[i] = 1; | |
6ba00c52 | 504 | ncsel++; |
505 | } else { | |
506 | ncsel=-1; | |
507 | break; | |
508 | } // child kine cuts | |
509 | } else { | |
fff02fee | 510 | pSelected[i] = 1; |
886b6f73 | 511 | ncsel++; |
6ba00c52 | 512 | } // if child selection |
513 | } // select muon | |
514 | } // decay particle loop | |
515 | } // if decay products | |
516 | ||
886b6f73 | 517 | Int_t iparent; |
518 | if ((fCutOnChild && ncsel >0) || !fCutOnChild){ | |
519 | ipa++; | |
21aaa175 | 520 | // |
fff02fee | 521 | // Parent |
a99cf51f | 522 | SetTrack(0, -1, iPart, p, origin0, polar, 0, kPPrimary, nt, wgtp); |
fff02fee | 523 | pParent[0] = nt; |
a99cf51f | 524 | KeepTrack(nt); |
fff02fee | 525 | // |
526 | // Decay Products | |
527 | // | |
528 | for (i = 1; i < np; i++) { | |
529 | if (pSelected[i]) { | |
530 | TParticle* iparticle = (TParticle *) particles->At(i); | |
531 | Int_t kf = iparticle->GetPdgCode(); | |
532 | Int_t ipa = iparticle->GetFirstMother()-1; | |
533 | ||
534 | och[0] = origin0[0]+iparticle->Vx()/10; | |
535 | och[1] = origin0[1]+iparticle->Vy()/10; | |
536 | och[2] = origin0[2]+iparticle->Vz()/10; | |
537 | pc[0] = iparticle->Px(); | |
538 | pc[1] = iparticle->Py(); | |
539 | pc[2] = iparticle->Pz(); | |
540 | ||
541 | if (ipa > -1) { | |
542 | iparent = pParent[ipa]; | |
543 | } else { | |
544 | iparent = -1; | |
545 | } | |
1242532d | 546 | |
a99cf51f | 547 | SetTrack(fTrackIt*trackIt[i], iparent, kf, |
fff02fee | 548 | pc, och, polar, |
549 | 0, kPDecay, nt, wgtch); | |
550 | pParent[i] = nt; | |
a99cf51f | 551 | KeepTrack(nt); |
8b31bfac | 552 | } // Selected |
553 | } // Particle loop | |
28337bc1 | 554 | } // Decays by Lujet |
8b31bfac | 555 | particles->Clear(); |
fff02fee | 556 | if (pFlag) delete[] pFlag; |
557 | if (pParent) delete[] pParent; | |
558 | if (pSelected) delete[] pSelected; | |
8b31bfac | 559 | if (trackIt) delete[] trackIt; |
21aaa175 | 560 | } // kinematic selection |
28337bc1 | 561 | else // nodecay option, so parent will be tracked by GEANT (pions, kaons, eta, omegas, baryons) |
562 | { | |
563 | gAlice-> | |
65fb704d | 564 | SetTrack(fTrackIt,-1,iPart,p,origin0,polar,0,kPPrimary,nt,wgtp); |
28337bc1 | 565 | ipa++; |
566 | } | |
fe4da5cc | 567 | break; |
21aaa175 | 568 | } // while |
fe4da5cc | 569 | } // event loop |
a99cf51f | 570 | SetHighWaterMark(nt); |
fe4da5cc | 571 | } |
572 | ||
5bd39445 | 573 | void AliGenParam::Draw() |
574 | { | |
575 | // | |
576 | // Draw the pT and y Distributions | |
577 | // | |
578 | TCanvas *c0 = new TCanvas("c0","Canvas 0",400,10,600,700); | |
579 | c0->Divide(2,1); | |
580 | c0->cd(1); | |
581 | fPtPara->Draw(); | |
582 | fPtPara->GetHistogram()->SetXTitle("p_{T} (GeV)"); | |
583 | c0->cd(2); | |
584 | fYPara->Draw(); | |
585 | fYPara->GetHistogram()->SetXTitle("y"); | |
586 | } | |
587 | ||
f87cfe57 | 588 | AliGenParam& AliGenParam::operator=(const AliGenParam& rhs) |
589 | { | |
590 | // Assignment operator | |
591 | return *this; | |
592 | } | |
593 | ||
fe4da5cc | 594 | |
595 |