]>
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 | ||
88cb7938 | 16 | /* $Id$ */ |
6d4dd317 | 17 | |
18 | // Class to generate particles from using paramtrized pT and y distributions. | |
19 | // Distributions are obtained from pointer to object of type AliGenLib. | |
20 | // (For example AliGenMUONlib) | |
21 | // Decays are performed using Pythia. | |
22 | // andreas.morsch@cern.ch | |
23 | ||
ac3faee4 | 24 | #include <TCanvas.h> |
7ca4655f | 25 | #include <TClonesArray.h> |
fa480368 | 26 | #include <TDatabasePDG.h> |
ac3faee4 | 27 | #include <TF1.h> |
28 | #include <TH1F.h> | |
fa480368 | 29 | #include <TLorentzVector.h> |
ac3faee4 | 30 | #include <TMath.h> |
31 | #include <TParticle.h> | |
32 | #include <TParticlePDG.h> | |
828fff0d | 33 | #include <TROOT.h> |
ac3faee4 | 34 | #include <TVirtualMC.h> |
fa480368 | 35 | |
ac3faee4 | 36 | #include "AliDecayer.h" |
37 | #include "AliGenMUONlib.h" | |
38 | #include "AliGenParam.h" | |
5d12ce38 | 39 | #include "AliMC.h" |
ac3faee4 | 40 | #include "AliRun.h" |
7cf36cae | 41 | #include "AliGenEventHeader.h" |
fe4da5cc | 42 | |
43 | ClassImp(AliGenParam) | |
44 | ||
45 | //------------------------------------------------------------ | |
46 | ||
6078e216 | 47 | //Begin_Html |
48 | /* | |
1439f98e | 49 | <img src="picts/AliGenParam.gif"> |
6078e216 | 50 | */ |
51 | //End_Html | |
fe4da5cc | 52 | |
fe4da5cc | 53 | //____________________________________________________________ |
6078e216 | 54 | AliGenParam::AliGenParam() |
55 | : fPtParaFunc(0), | |
1c56e311 | 56 | fYParaFunc(0), |
57 | fIpParaFunc(0), | |
6078e216 | 58 | fV2ParaFunc(0), |
1c56e311 | 59 | fPtPara(0), |
60 | fYPara(0), | |
6078e216 | 61 | fV2Para(0), |
62 | fdNdPhi(0), | |
1c56e311 | 63 | fParam(0), |
64 | fdNdy0(0.), | |
65 | fYWgt(0.), | |
66 | fPtWgt(0.), | |
67 | fBias(0.), | |
68 | fTrials(0), | |
69 | fDeltaPt(0.01), | |
18e09c20 | 70 | fSelectAll(kFALSE), |
1c56e311 | 71 | fDecayer(0) |
fe4da5cc | 72 | { |
6078e216 | 73 | // Default constructor |
b22ee262 | 74 | } |
2ad38d56 | 75 | //____________________________________________________________ |
f2c13e03 | 76 | AliGenParam::AliGenParam(Int_t npart, const AliGenLib * Library, Int_t param, const char* tname) |
1c56e311 | 77 | :AliGenMC(npart), |
78 | fPtParaFunc(Library->GetPt(param, tname)), | |
79 | fYParaFunc (Library->GetY (param, tname)), | |
80 | fIpParaFunc(Library->GetIp(param, tname)), | |
6078e216 | 81 | fV2ParaFunc(Library->GetV2(param, tname)), |
1c56e311 | 82 | fPtPara(0), |
83 | fYPara(0), | |
6078e216 | 84 | fV2Para(0), |
85 | fdNdPhi(0), | |
1c56e311 | 86 | fParam(param), |
87 | fdNdy0(0.), | |
88 | fYWgt(0.), | |
89 | fPtWgt(0.), | |
90 | fBias(0.), | |
91 | fTrials(0), | |
92 | fDeltaPt(0.01), | |
18e09c20 | 93 | fSelectAll(kFALSE), |
1c56e311 | 94 | fDecayer(0) |
b22ee262 | 95 | { |
6078e216 | 96 | // Constructor using number of particles parameterisation id and library |
8b31bfac | 97 | fName = "Param"; |
98 | fTitle= "Particle Generator using pT and y parameterisation"; | |
34f60c01 | 99 | fAnalog = kAnalog; |
b22ee262 | 100 | SetForceDecay(); |
fe4da5cc | 101 | } |
fe4da5cc | 102 | //____________________________________________________________ |
1c56e311 | 103 | AliGenParam::AliGenParam(Int_t npart, Int_t param, const char* tname, const char* name): |
104 | AliGenMC(npart), | |
105 | fPtParaFunc(0), | |
106 | fYParaFunc (0), | |
107 | fIpParaFunc(0), | |
6078e216 | 108 | fV2ParaFunc(0), |
1c56e311 | 109 | fPtPara(0), |
110 | fYPara(0), | |
6078e216 | 111 | fV2Para(0), |
112 | fdNdPhi(0), | |
1c56e311 | 113 | fParam(param), |
114 | fdNdy0(0.), | |
115 | fYWgt(0.), | |
116 | fPtWgt(0.), | |
117 | fBias(0.), | |
118 | fTrials(0), | |
119 | fDeltaPt(0.01), | |
18e09c20 | 120 | fSelectAll(kFALSE), |
1c56e311 | 121 | fDecayer(0) |
fe4da5cc | 122 | { |
6078e216 | 123 | // Constructor using parameterisation id and number of particles |
124 | // | |
1c56e311 | 125 | fName = name; |
126 | fTitle= "Particle Generator using pT and y parameterisation"; | |
8b31bfac | 127 | |
675e9664 | 128 | AliGenLib* pLibrary = new AliGenMUONlib(); |
675e9664 | 129 | fPtParaFunc = pLibrary->GetPt(param, tname); |
130 | fYParaFunc = pLibrary->GetY (param, tname); | |
131 | fIpParaFunc = pLibrary->GetIp(param, tname); | |
6078e216 | 132 | fV2ParaFunc = pLibrary->GetV2(param, tname); |
b22ee262 | 133 | |
34f60c01 | 134 | fAnalog = kAnalog; |
b22ee262 | 135 | fChildSelect.Set(5); |
136 | for (Int_t i=0; i<5; i++) fChildSelect[i]=0; | |
137 | SetForceDecay(); | |
138 | SetCutOnChild(); | |
139 | SetChildMomentumRange(); | |
140 | SetChildPtRange(); | |
141 | SetChildPhiRange(); | |
142 | SetChildThetaRange(); | |
fe4da5cc | 143 | } |
2ad38d56 | 144 | //____________________________________________________________ |
fe4da5cc | 145 | |
34f60c01 | 146 | AliGenParam::AliGenParam(Int_t npart, Int_t param, |
75e0cc59 | 147 | Double_t (*PtPara) (const Double_t*, const Double_t*), |
148 | Double_t (*YPara ) (const Double_t* ,const Double_t*), | |
6078e216 | 149 | Double_t (*V2Para) (const Double_t* ,const Double_t*), |
65fb704d | 150 | Int_t (*IpPara) (TRandom *)) |
1c56e311 | 151 | :AliGenMC(npart), |
152 | ||
153 | fPtParaFunc(PtPara), | |
154 | fYParaFunc(YPara), | |
155 | fIpParaFunc(IpPara), | |
6078e216 | 156 | fV2ParaFunc(V2Para), |
1c56e311 | 157 | fPtPara(0), |
158 | fYPara(0), | |
6078e216 | 159 | fV2Para(0), |
160 | fdNdPhi(0), | |
1c56e311 | 161 | fParam(param), |
162 | fdNdy0(0.), | |
163 | fYWgt(0.), | |
164 | fPtWgt(0.), | |
165 | fBias(0.), | |
166 | fTrials(0), | |
167 | fDeltaPt(0.01), | |
18e09c20 | 168 | fSelectAll(kFALSE), |
1c56e311 | 169 | fDecayer(0) |
886b6f73 | 170 | { |
6078e216 | 171 | // Constructor |
172 | // Gines Martinez 1/10/99 | |
8b31bfac | 173 | fName = "Param"; |
174 | fTitle= "Particle Generator using pT and y parameterisation"; | |
175 | ||
34f60c01 | 176 | fAnalog = kAnalog; |
886b6f73 | 177 | fChildSelect.Set(5); |
178 | for (Int_t i=0; i<5; i++) fChildSelect[i]=0; | |
179 | SetForceDecay(); | |
180 | SetCutOnChild(); | |
749070b6 | 181 | SetChildMomentumRange(); |
182 | SetChildPtRange(); | |
183 | SetChildPhiRange(); | |
184 | SetChildThetaRange(); | |
886b6f73 | 185 | } |
186 | ||
fe4da5cc | 187 | //____________________________________________________________ |
188 | AliGenParam::~AliGenParam() | |
189 | { | |
6078e216 | 190 | // Destructor |
fe4da5cc | 191 | delete fPtPara; |
192 | delete fYPara; | |
6078e216 | 193 | delete fV2Para; |
194 | delete fdNdPhi; | |
fe4da5cc | 195 | } |
196 | ||
197 | //____________________________________________________________ | |
198 | void AliGenParam::Init() | |
199 | { | |
6078e216 | 200 | // Initialisation |
fa480368 | 201 | |
2904363f | 202 | if (gMC) fDecayer = gMC->GetDecayer(); |
fe4da5cc | 203 | //Begin_Html |
204 | /* | |
1439f98e | 205 | <img src="picts/AliGenParam.gif"> |
fe4da5cc | 206 | */ |
207 | //End_Html | |
c5c3e4b0 | 208 | char name[256]; |
8f8399ab | 209 | snprintf(name, 256, "pt-parameterisation for %s", GetName()); |
c5c3e4b0 | 210 | |
2ad38d56 | 211 | if (fPtPara) fPtPara->Delete(); |
c5c3e4b0 | 212 | fPtPara = new TF1(name, fPtParaFunc, fPtMin, fPtMax,0); |
828fff0d | 213 | gROOT->GetListOfFunctions()->Remove(fPtPara); |
6078e216 | 214 | // Set representation precision to 10 MeV |
c5c3e4b0 | 215 | Int_t npx= Int_t((fPtMax - fPtMin) / fDeltaPt); |
749070b6 | 216 | |
217 | fPtPara->SetNpx(npx); | |
c5c3e4b0 | 218 | |
8f8399ab | 219 | snprintf(name, 256, "y-parameterisation for %s", GetName()); |
2ad38d56 | 220 | if (fYPara) fYPara->Delete(); |
c5c3e4b0 | 221 | fYPara = new TF1(name, fYParaFunc, fYMin, fYMax, 0); |
828fff0d | 222 | gROOT->GetListOfFunctions()->Remove(fYPara); |
223 | ||
6078e216 | 224 | snprintf(name, 256, "v2-parameterisation for %s", GetName()); |
225 | if (fV2Para) fV2Para->Delete(); | |
226 | fV2Para = new TF1(name, fV2ParaFunc, fPtMin, fPtMax, 0); | |
227 | // fV2Para = new TF1(name, "2*[0]/(1+TMath::Exp([1]*([2]-x)))-[0]", fPtMin, fPtMax); | |
228 | // fV2Para->SetParameter(0, 0.236910); | |
229 | // fV2Para->SetParameter(1, 1.71122); | |
230 | // fV2Para->SetParameter(2, 0.0827617); | |
231 | //gROOT->GetListOfFunctions()->Remove(fV2Para); //TR: necessary? | |
232 | ||
233 | snprintf(name, 256, "dNdPhi for %s", GetName()); | |
234 | if (fdNdPhi) fdNdPhi->Delete(); | |
235 | fdNdPhi = new TF1(name, "1+2*[0]*TMath::Cos(2*(x-[1]))", fPhiMin, fPhiMax); | |
236 | //gROOT->GetListOfFunctions()->Remove(fdNdPhi); //TR: necessary? | |
749070b6 | 237 | |
8f8399ab | 238 | snprintf(name, 256, "pt-for-%s", GetName()); |
c5c3e4b0 | 239 | TF1 ptPara(name ,fPtParaFunc, 0, 15, 0); |
8f8399ab | 240 | snprintf(name, 256, "y-for-%s", GetName()); |
c5c3e4b0 | 241 | TF1 yPara(name, fYParaFunc, -6, 6, 0); |
b7601ac4 | 242 | |
6078e216 | 243 | // |
244 | // dN/dy| y=0 | |
749070b6 | 245 | Double_t y1=0; |
246 | Double_t y2=0; | |
247 | ||
248 | fdNdy0=fYParaFunc(&y1,&y2); | |
6078e216 | 249 | // |
250 | // Integral over generation region | |
389a9124 | 251 | Float_t intYS = yPara.Integral(fYMin, fYMax,(Double_t*) 0x0,1.e-6); |
252 | Float_t intPt0 = ptPara.Integral(0,15,(Double_t *) 0x0,1.e-6); | |
253 | Float_t intPtS = ptPara.Integral(fPtMin,fPtMax,(Double_t*) 0x0,1.e-6); | |
6078e216 | 254 | Float_t phiWgt=(fPhiMax-fPhiMin)/2./TMath::Pi(); //TR: should probably be done differently in case of anisotropic phi... |
34f60c01 | 255 | if (fAnalog == kAnalog) { |
749070b6 | 256 | fYWgt = intYS/fdNdy0; |
257 | fPtWgt = intPtS/intPt0; | |
258 | fParentWeight = fYWgt*fPtWgt*phiWgt/fNpart; | |
259 | } else { | |
260 | fYWgt = intYS/fdNdy0; | |
261 | fPtWgt = (fPtMax-fPtMin)/intPt0; | |
262 | fParentWeight = fYWgt*fPtWgt*phiWgt/fNpart; | |
263 | } | |
6078e216 | 264 | // |
265 | // particle decay related initialization | |
00d6ce7d | 266 | fDecayer->SetForceDecay(fForceDecay); |
fa480368 | 267 | fDecayer->Init(); |
00d6ce7d | 268 | |
6078e216 | 269 | // |
fff02fee | 270 | AliGenMC::Init(); |
fe4da5cc | 271 | } |
272 | ||
273 | //____________________________________________________________ | |
274 | void AliGenParam::Generate() | |
275 | { | |
6078e216 | 276 | // |
277 | // Generate 'npart' of light and heavy mesons (J/Psi, upsilon or phi, Pion, | |
278 | // Kaons, Etas, Omegas) and Baryons (proton, antiprotons, neutrons and | |
279 | // antineutrons in the the desired theta, phi and momentum windows; | |
280 | // Gaussian smearing on the vertex is done if selected. | |
281 | // The decay of heavy mesons is done using lujet, | |
282 | // and the childern particle are tracked by GEANT | |
283 | // However, light mesons are directly tracked by GEANT | |
284 | // setting fForceDecay = nodecay (SetForceDecay(nodecay)) | |
285 | // | |
286 | // | |
287 | // Reinitialize decayer | |
2ad38d56 | 288 | fDecayer->SetForceDecay(fForceDecay); |
289 | fDecayer->Init(); | |
290 | ||
6078e216 | 291 | // |
28337bc1 | 292 | Float_t polar[3]= {0,0,0}; // Polarisation of the parent particle (for GEANT tracking) |
293 | Float_t origin0[3]; // Origin of the generated parent particle (for GEANT tracking) | |
21391258 | 294 | Float_t time0; // Time0 of the generated parent particle |
28337bc1 | 295 | Float_t pt, pl, ptot; // Transverse, logitudinal and total momenta of the parent particle |
296 | Float_t phi, theta; // Phi and theta spherical angles of the parent particle momentum | |
297 | Float_t p[3], pc[3], | |
fff02fee | 298 | och[3]; // Momentum, polarisation and origin of the children particles from lujet |
2d7a47be | 299 | Double_t ty, xmt; |
fff02fee | 300 | Int_t nt, i, j; |
fe4da5cc | 301 | Float_t wgtp, wgtch; |
302 | Double_t dummy; | |
09fd3ea2 | 303 | static TClonesArray *particles; |
fe4da5cc | 304 | // |
fff02fee | 305 | if(!particles) particles = new TClonesArray("TParticle",1000); |
8b31bfac | 306 | |
349be858 | 307 | TDatabasePDG *pDataBase = TDatabasePDG::Instance(); |
fe4da5cc | 308 | // |
309 | Float_t random[6]; | |
28337bc1 | 310 | |
6078e216 | 311 | // Calculating vertex position per event |
fe4da5cc | 312 | for (j=0;j<3;j++) origin0[j]=fOrigin[j]; |
21391258 | 313 | time0 = fTimeOrigin; |
aee8290b | 314 | if(fVertexSmear==kPerEvent) { |
d9ea0e3b | 315 | Vertex(); |
316 | for (j=0;j<3;j++) origin0[j]=fVertex[j]; | |
21391258 | 317 | time0 = fTime; |
fe4da5cc | 318 | } |
d9ea0e3b | 319 | |
21aaa175 | 320 | Int_t ipa=0; |
fff02fee | 321 | |
6078e216 | 322 | // Generating fNpart particles |
7cf36cae | 323 | fNprimaries = 0; |
324 | ||
21aaa175 | 325 | while (ipa<fNpart) { |
cc5d764c | 326 | while(1) { |
6078e216 | 327 | // |
328 | // particle type | |
65fb704d | 329 | Int_t iPart = fIpParaFunc(fRandom); |
fa480368 | 330 | fChildWeight=(fDecayer->GetPartialBranchingRatio(iPart))*fParentWeight; |
675e9664 | 331 | TParticlePDG *particle = pDataBase->GetParticle(iPart); |
fa480368 | 332 | Float_t am = particle->Mass(); |
8b31bfac | 333 | |
65fb704d | 334 | Rndm(random,2); |
6078e216 | 335 | // |
336 | // y | |
2d7a47be | 337 | ty = TMath::TanH(fYPara->GetRandom()); |
6078e216 | 338 | // |
339 | // pT | |
34f60c01 | 340 | if (fAnalog == kAnalog) { |
fe4da5cc | 341 | pt=fPtPara->GetRandom(); |
342 | wgtp=fParentWeight; | |
343 | wgtch=fChildWeight; | |
344 | } else { | |
345 | pt=fPtMin+random[1]*(fPtMax-fPtMin); | |
346 | Double_t ptd=pt; | |
347 | wgtp=fParentWeight*fPtParaFunc(& ptd, &dummy); | |
348 | wgtch=fChildWeight*fPtParaFunc(& ptd, &dummy); | |
349 | } | |
350 | xmt=sqrt(pt*pt+am*am); | |
2d7a47be | 351 | if (TMath::Abs(ty)==1.) { |
352 | ty=0.; | |
353 | Fatal("AliGenParam", | |
354 | "Division by 0: Please check you rapidity range !"); | |
355 | } | |
6078e216 | 356 | // |
357 | // phi | |
358 | // if(!ipa) | |
359 | // phi=fEvPlane; //align first particle of each event with event plane | |
360 | // else{ | |
361 | double v2 = fV2Para->Eval(pt); | |
362 | fdNdPhi->SetParameter(0,v2); | |
363 | fdNdPhi->SetParameter(1,fEvPlane); | |
364 | phi=fdNdPhi->GetRandom(); | |
365 | // } | |
2d7a47be | 366 | |
60e55aee | 367 | pl=xmt*ty/sqrt((1.-ty)*(1.+ty)); |
fe4da5cc | 368 | theta=TMath::ATan2(pt,pl); |
6078e216 | 369 | // Cut on theta |
fe4da5cc | 370 | if(theta<fThetaMin || theta>fThetaMax) continue; |
371 | ptot=TMath::Sqrt(pt*pt+pl*pl); | |
6078e216 | 372 | // Cut on momentum |
fe4da5cc | 373 | if(ptot<fPMin || ptot>fPMax) continue; |
6078e216 | 374 | // |
fe4da5cc | 375 | p[0]=pt*TMath::Cos(phi); |
376 | p[1]=pt*TMath::Sin(phi); | |
377 | p[2]=pl; | |
aee8290b | 378 | if(fVertexSmear==kPerTrack) { |
65fb704d | 379 | Rndm(random,6); |
fe4da5cc | 380 | for (j=0;j<3;j++) { |
381 | origin0[j]= | |
382 | fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
383 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
384 | } | |
21391258 | 385 | Rndm(random,2); |
386 | time0 = fTimeOrigin + fOsigma[2]/TMath::Ccgs()* | |
387 | TMath::Cos(2*random[0]*TMath::Pi())* | |
388 | TMath::Sqrt(-2*TMath::Log(random[1])); | |
fe4da5cc | 389 | } |
28337bc1 | 390 | |
6078e216 | 391 | // Looking at fForceDecay : |
392 | // if fForceDecay != none Primary particle decays using | |
393 | // AliPythia and children are tracked by GEANT | |
394 | // | |
395 | // if fForceDecay == none Primary particle is tracked by GEANT | |
396 | // (In the latest, make sure that GEANT actually does all the decays you want) | |
397 | // | |
cd716030 | 398 | Bool_t decayed = kFALSE; |
399 | ||
fff02fee | 400 | |
34f60c01 | 401 | if (fForceDecay != kNoDecay) { |
6078e216 | 402 | // Using lujet to decay particle |
886b6f73 | 403 | Float_t energy=TMath::Sqrt(ptot*ptot+am*am); |
fa480368 | 404 | TLorentzVector pmom(p[0], p[1], p[2], energy); |
405 | fDecayer->Decay(iPart,&pmom); | |
6078e216 | 406 | // |
407 | // select decay particles | |
fa480368 | 408 | Int_t np=fDecayer->ImportParticles(particles); |
1242532d | 409 | |
410 | // Selecting GeometryAcceptance for particles fPdgCodeParticleforAcceptanceCut; | |
411 | if (fGeometryAcceptance) | |
412 | if (!CheckAcceptanceGeometry(np,particles)) continue; | |
886b6f73 | 413 | Int_t ncsel=0; |
fff02fee | 414 | Int_t* pFlag = new Int_t[np]; |
415 | Int_t* pParent = new Int_t[np]; | |
416 | Int_t* pSelected = new Int_t[np]; | |
417 | Int_t* trackIt = new Int_t[np]; | |
418 | ||
419 | for (i=0; i<np; i++) { | |
420 | pFlag[i] = 0; | |
421 | pSelected[i] = 0; | |
422 | pParent[i] = -1; | |
423 | } | |
424 | ||
6ba00c52 | 425 | if (np >1) { |
cd716030 | 426 | decayed = kTRUE; |
08bffa4d | 427 | TParticle* iparticle = 0; |
fff02fee | 428 | Int_t ipF, ipL; |
429 | for (i = 1; i<np ; i++) { | |
430 | trackIt[i] = 1; | |
6ba00c52 | 431 | iparticle = (TParticle *) particles->At(i); |
432 | Int_t kf = iparticle->GetPdgCode(); | |
fff02fee | 433 | Int_t ks = iparticle->GetStatusCode(); |
6078e216 | 434 | // flagged particle |
fff02fee | 435 | |
436 | if (pFlag[i] == 1) { | |
fff02fee | 437 | ipF = iparticle->GetFirstDaughter(); |
438 | ipL = iparticle->GetLastDaughter(); | |
439 | if (ipF > 0) for (j=ipF-1; j<ipL; j++) pFlag[j]=1; | |
440 | continue; | |
441 | } | |
442 | ||
6078e216 | 443 | // flag decay products of particles with long life-time (c tau > .3 mum) |
fff02fee | 444 | |
445 | if (ks != 1) { | |
6078e216 | 446 | // TParticlePDG *particle = pDataBase->GetParticle(kf); |
fff02fee | 447 | |
448 | Double_t lifeTime = fDecayer->GetLifetime(kf); | |
6078e216 | 449 | // Double_t mass = particle->Mass(); |
450 | // Double_t width = particle->Width(); | |
47fc6bd5 | 451 | if (lifeTime > (Double_t) fMaxLifeTime) { |
fff02fee | 452 | ipF = iparticle->GetFirstDaughter(); |
453 | ipL = iparticle->GetLastDaughter(); | |
454 | if (ipF > 0) for (j=ipF-1; j<ipL; j++) pFlag[j]=1; | |
455 | } else{ | |
456 | trackIt[i] = 0; | |
457 | pSelected[i] = 1; | |
458 | } | |
459 | } // ks==1 ? | |
6078e216 | 460 | // |
461 | // children | |
47fc6bd5 | 462 | |
18e09c20 | 463 | if ((ChildSelected(TMath::Abs(kf)) || fForceDecay == kAll || fSelectAll) && trackIt[i]) |
6ba00c52 | 464 | { |
6ba00c52 | 465 | if (fCutOnChild) { |
fff02fee | 466 | pc[0]=iparticle->Px(); |
467 | pc[1]=iparticle->Py(); | |
468 | pc[2]=iparticle->Pz(); | |
469 | Bool_t childok = KinematicSelection(iparticle, 1); | |
470 | if(childok) { | |
471 | pSelected[i] = 1; | |
6ba00c52 | 472 | ncsel++; |
473 | } else { | |
474 | ncsel=-1; | |
475 | break; | |
476 | } // child kine cuts | |
477 | } else { | |
fff02fee | 478 | pSelected[i] = 1; |
886b6f73 | 479 | ncsel++; |
6ba00c52 | 480 | } // if child selection |
481 | } // select muon | |
482 | } // decay particle loop | |
483 | } // if decay products | |
484 | ||
886b6f73 | 485 | Int_t iparent; |
486 | if ((fCutOnChild && ncsel >0) || !fCutOnChild){ | |
487 | ipa++; | |
6078e216 | 488 | // |
489 | // Parent | |
cd716030 | 490 | |
491 | ||
21391258 | 492 | PushTrack(0, -1, iPart, p, origin0, polar, time0, kPPrimary, nt, wgtp, ((decayed)? 11 : 1)); |
fff02fee | 493 | pParent[0] = nt; |
a99cf51f | 494 | KeepTrack(nt); |
7cf36cae | 495 | fNprimaries++; |
496 | ||
6078e216 | 497 | // |
498 | // Decay Products | |
499 | // | |
fff02fee | 500 | for (i = 1; i < np; i++) { |
501 | if (pSelected[i]) { | |
502 | TParticle* iparticle = (TParticle *) particles->At(i); | |
ea79897e | 503 | Int_t kf = iparticle->GetPdgCode(); |
cd716030 | 504 | Int_t ksc = iparticle->GetStatusCode(); |
ea79897e | 505 | Int_t jpa = iparticle->GetFirstMother()-1; |
fff02fee | 506 | |
507 | och[0] = origin0[0]+iparticle->Vx()/10; | |
508 | och[1] = origin0[1]+iparticle->Vy()/10; | |
509 | och[2] = origin0[2]+iparticle->Vz()/10; | |
510 | pc[0] = iparticle->Px(); | |
511 | pc[1] = iparticle->Py(); | |
512 | pc[2] = iparticle->Pz(); | |
513 | ||
ea79897e | 514 | if (jpa > -1) { |
515 | iparent = pParent[jpa]; | |
fff02fee | 516 | } else { |
517 | iparent = -1; | |
518 | } | |
1242532d | 519 | |
ea79897e | 520 | PushTrack(fTrackIt * trackIt[i], iparent, kf, |
fff02fee | 521 | pc, och, polar, |
21391258 | 522 | time0 + iparticle->T(), kPDecay, nt, wgtch, ksc); |
fff02fee | 523 | pParent[i] = nt; |
a99cf51f | 524 | KeepTrack(nt); |
7cf36cae | 525 | fNprimaries++; |
8b31bfac | 526 | } // Selected |
527 | } // Particle loop | |
28337bc1 | 528 | } // Decays by Lujet |
8b31bfac | 529 | particles->Clear(); |
fff02fee | 530 | if (pFlag) delete[] pFlag; |
531 | if (pParent) delete[] pParent; | |
532 | if (pSelected) delete[] pSelected; | |
8b31bfac | 533 | if (trackIt) delete[] trackIt; |
21aaa175 | 534 | } // kinematic selection |
28337bc1 | 535 | else // nodecay option, so parent will be tracked by GEANT (pions, kaons, eta, omegas, baryons) |
536 | { | |
5d12ce38 | 537 | gAlice->GetMCApp()-> |
21391258 | 538 | PushTrack(fTrackIt,-1,iPart,p,origin0,polar,time0,kPPrimary,nt,wgtp, 1); |
28337bc1 | 539 | ipa++; |
7cf36cae | 540 | fNprimaries++; |
28337bc1 | 541 | } |
fe4da5cc | 542 | break; |
21aaa175 | 543 | } // while |
fe4da5cc | 544 | } // event loop |
7cf36cae | 545 | |
a99cf51f | 546 | SetHighWaterMark(nt); |
7cf36cae | 547 | |
548 | AliGenEventHeader* header = new AliGenEventHeader("PARAM"); | |
549 | header->SetPrimaryVertex(fVertex); | |
21391258 | 550 | header->SetInteractionTime(fTime); |
7cf36cae | 551 | header->SetNProduced(fNprimaries); |
552 | AddHeader(header); | |
fe4da5cc | 553 | } |
2ad38d56 | 554 | //____________________________________________________________________________________ |
555 | Float_t AliGenParam::GetRelativeArea(Float_t ptMin, Float_t ptMax, Float_t yMin, Float_t yMax, Float_t phiMin, Float_t phiMax) | |
556 | { | |
6078e216 | 557 | // |
558 | // Normalisation for selected kinematic region | |
559 | // | |
2ad38d56 | 560 | Float_t ratio = |
389a9124 | 561 | fPtPara->Integral(ptMin,ptMax,(Double_t *)0,1.e-6) / fPtPara->Integral( fPtPara->GetXmin(), fPtPara->GetXmax(),(Double_t *)0,1.e-6) * |
562 | fYPara->Integral(yMin,yMax,(Double_t *)0,1.e-6)/fYPara->Integral(fYPara->GetXmin(),fYPara->GetXmax(),(Double_t *)0,1.e-6) * | |
2ad38d56 | 563 | (phiMax-phiMin)/360.; |
564 | return TMath::Abs(ratio); | |
565 | } | |
566 | ||
567 | //____________________________________________________________________________________ | |
fe4da5cc | 568 | |
dc1d768c | 569 | void AliGenParam::Draw( const char * /*opt*/) |
5bd39445 | 570 | { |
571 | // | |
572 | // Draw the pT and y Distributions | |
573 | // | |
574 | TCanvas *c0 = new TCanvas("c0","Canvas 0",400,10,600,700); | |
575 | c0->Divide(2,1); | |
576 | c0->cd(1); | |
577 | fPtPara->Draw(); | |
578 | fPtPara->GetHistogram()->SetXTitle("p_{T} (GeV)"); | |
579 | c0->cd(2); | |
580 | fYPara->Draw(); | |
581 | fYPara->GetHistogram()->SetXTitle("y"); | |
582 | } | |
583 | ||
f87cfe57 | 584 | |
fe4da5cc | 585 | |
586 |