]>
Commit | Line | Data |
---|---|---|
110410f9 | 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$ | |
8b31bfac | 18 | Revision 1.36 2002/01/31 20:17:55 morsch |
19 | Allow for triggered jets with simplified topology: Exact pT, back-to-back | |
20 | ||
3792091f | 21 | Revision 1.35 2001/12/13 07:56:25 hristov |
22 | Set pointers to zero in the default constructor | |
23 | ||
60b030a9 | 24 | Revision 1.34 2001/12/11 16:55:42 morsch |
25 | Correct initialization for jet phi-range. | |
26 | ||
777b4893 | 27 | Revision 1.33 2001/12/05 10:18:51 morsch |
28 | Possibility of kinematic biasing of jet phi range. (J. Klay) | |
29 | ||
7a186781 | 30 | Revision 1.32 2001/11/28 13:51:11 morsch |
31 | Introduce kinematic biasing (etamin, etamax) of jet trigger. Bookkeeping | |
32 | (number of trials) done in AliGenHijingEventHeader. | |
33 | ||
e4ffda63 | 34 | Revision 1.31 2001/11/06 12:30:34 morsch |
35 | Add Boost() method to boost all particles to LHC lab frame. Needed for asymmetric collision systems. | |
36 | ||
cc71f2d3 | 37 | Revision 1.30 2001/10/21 18:35:56 hristov |
38 | Several pointers were set to zero in the default constructors to avoid memory management problems | |
39 | ||
2685bf00 | 40 | Revision 1.29 2001/10/15 08:12:24 morsch |
41 | - Vertex smearing with truncated gaussian. | |
42 | - Store triggered jet info before and after final state radiation into mc-heade | |
43 | ||
f8b85aa9 | 44 | Revision 1.28 2001/10/08 11:55:25 morsch |
45 | Store 4-momenta of trigegred jets in event header. | |
46 | Possibility to switch of initial and final state radiation. | |
47 | ||
332c8db0 | 48 | Revision 1.27 2001/10/08 07:13:14 morsch |
49 | Add setter for minimum transverse momentum of triggered jet. | |
50 | ||
ed6361b0 | 51 | Revision 1.26 2001/10/04 08:12:24 morsch |
52 | Redefinition of stable condition. | |
53 | ||
79bf94df | 54 | Revision 1.25 2001/07/27 17:09:36 morsch |
55 | Use local SetTrack, KeepTrack and SetHighWaterMark methods | |
56 | to delegate either to local stack or to stack owned by AliRun. | |
57 | (Piotr Skowronski, A.M.) | |
58 | ||
a99cf51f | 59 | Revision 1.24 2001/07/20 09:34:56 morsch |
60 | Count the number of spectator neutrons and protons and add information | |
61 | to the event header. (Chiara Oppedisano) | |
62 | ||
b46f2676 | 63 | Revision 1.23 2001/07/13 17:30:22 morsch |
64 | Derive from AliGenMC. | |
65 | ||
55d6adcf | 66 | Revision 1.22 2001/06/11 13:09:23 morsch |
67 | - Store cross-Section and number of binary collisions as a function of impact parameter | |
68 | - Pass AliGenHijingEventHeader to gAlice. | |
69 | ||
21ce2e6f | 70 | Revision 1.21 2001/02/28 17:35:24 morsch |
71 | Consider elastic interactions (ks = 1 and ks = 11) as spectator (Chiara Oppedisano) | |
72 | ||
cf6bac7b | 73 | Revision 1.20 2001/02/14 15:50:40 hristov |
74 | The last particle in event marked using SetHighWaterMark | |
75 | ||
28adac24 | 76 | Revision 1.19 2000/12/21 16:24:06 morsch |
77 | Coding convention clean-up | |
78 | ||
675e9664 | 79 | Revision 1.18 2000/12/06 17:46:30 morsch |
80 | Avoid random numbers 1 and 0. | |
81 | ||
7498b3ad | 82 | Revision 1.17 2000/12/04 11:22:03 morsch |
83 | Init of sRandom as in 1.15 | |
84 | ||
097ec7c1 | 85 | Revision 1.16 2000/12/02 11:41:39 morsch |
86 | Use SetRandom() to initialize random number generator in constructor. | |
87 | ||
1ed25e11 | 88 | Revision 1.15 2000/11/30 20:29:02 morsch |
89 | Initialise static variable sRandom in constructor: sRandom = fRandom; | |
90 | ||
ad1df918 | 91 | Revision 1.14 2000/11/30 07:12:50 alibrary |
92 | Introducing new Rndm and QA classes | |
93 | ||
65fb704d | 94 | Revision 1.13 2000/11/09 17:40:27 morsch |
95 | Possibility to select/unselect spectator protons and neutrons. | |
96 | Method SetSpectators(Int_t spect) added. (FCA, Ch. Oppedisano) | |
97 | ||
2705454f | 98 | Revision 1.12 2000/10/20 13:38:38 morsch |
99 | Debug printouts commented. | |
100 | ||
1df2195f | 101 | Revision 1.11 2000/10/20 13:22:26 morsch |
102 | - skip particle type 92 (string) | |
103 | - Charmed and beauty baryions (5122, 4122) are considered as stable consistent with | |
104 | mesons. | |
105 | ||
608708ba | 106 | Revision 1.10 2000/10/17 15:10:20 morsch |
107 | Write first all the parent particles to the stack and then the final state particles. | |
108 | ||
e06552ba | 109 | Revision 1.9 2000/10/17 13:38:59 morsch |
110 | Protection against division by zero in EvaluateCrossSection() and KinematicSelection(..) (FCA) | |
111 | ||
c007646a | 112 | Revision 1.8 2000/10/17 12:46:31 morsch |
113 | Protect EvaluateCrossSections() against division by zero. | |
114 | ||
73bc6a56 | 115 | Revision 1.7 2000/10/02 21:28:06 fca |
116 | Removal of useless dependecies via forward declarations | |
117 | ||
94de3818 | 118 | Revision 1.6 2000/09/11 13:23:37 morsch |
119 | Write last seed to file (fortran lun 50) and reed back from same lun using calls to | |
120 | luget_hijing and luset_hijing. | |
121 | ||
b78ff279 | 122 | Revision 1.5 2000/09/07 16:55:40 morsch |
123 | fHijing->Initialize(); after change of parameters. (Dmitri Yurevitch Peressounko) | |
124 | ||
ba244bac | 125 | Revision 1.4 2000/07/11 18:24:56 fca |
126 | Coding convention corrections + few minor bug fixes | |
127 | ||
aee8290b | 128 | Revision 1.3 2000/06/30 12:08:36 morsch |
129 | In member data: char* replaced by TString, Init takes care of resizing the strings to | |
130 | 8 characters required by Hijing. | |
131 | ||
3b8bd63f | 132 | Revision 1.2 2000/06/15 14:15:05 morsch |
133 | Add possibility for heavy flavor selection: charm and beauty. | |
134 | ||
eb342d2d | 135 | Revision 1.1 2000/06/09 20:47:27 morsch |
136 | AliGenerator interface class to HIJING using THijing (test version) | |
137 | ||
110410f9 | 138 | */ |
139 | ||
675e9664 | 140 | |
141 | ||
142 | // Generator using HIJING as an external generator | |
143 | // The main HIJING options are accessable for the user through this interface. | |
144 | // Uses the THijing implementation of TGenerator. | |
145 | // | |
146 | // andreas.morsch@cern.ch | |
147 | ||
110410f9 | 148 | #include "AliGenHijing.h" |
3b8bd63f | 149 | #include "AliGenHijingEventHeader.h" |
110410f9 | 150 | #include "AliRun.h" |
b46f2676 | 151 | #include "AliPDG.h" |
110410f9 | 152 | |
153 | #include <TArrayI.h> | |
154 | #include <TParticle.h> | |
155 | #include <THijing.h> | |
21ce2e6f | 156 | #include <TGraph.h> |
332c8db0 | 157 | #include <TLorentzVector.h> |
110410f9 | 158 | |
ad1df918 | 159 | |
110410f9 | 160 | ClassImp(AliGenHijing) |
161 | ||
162 | AliGenHijing::AliGenHijing() | |
55d6adcf | 163 | :AliGenMC() |
110410f9 | 164 | { |
165 | // Constructor | |
8b31bfac | 166 | fHijing = 0; |
167 | fDsigmaDb = 0; | |
168 | fDnDb = 0; | |
110410f9 | 169 | } |
170 | ||
171 | AliGenHijing::AliGenHijing(Int_t npart) | |
55d6adcf | 172 | :AliGenMC(npart) |
110410f9 | 173 | { |
174 | // Default PbPb collisions at 5. 5 TeV | |
175 | // | |
8b31bfac | 176 | fName = "Hijing"; |
177 | fTitle= "Particle Generator using HIJING"; | |
178 | ||
110410f9 | 179 | SetEnergyCMS(); |
180 | SetImpactParameterRange(); | |
181 | SetTarget(); | |
182 | SetProjectile(); | |
cc71f2d3 | 183 | SetBoostLHC(); |
e4ffda63 | 184 | SetJetEtaRange(); |
777b4893 | 185 | SetJetPhiRange(); |
e4ffda63 | 186 | |
ed6361b0 | 187 | fKeep = 0; |
188 | fQuench = 1; | |
189 | fShadowing = 1; | |
190 | fTrigger = 0; | |
191 | fDecaysOff = 1; | |
192 | fEvaluate = 0; | |
193 | fSelectAll = 0; | |
194 | fFlavor = 0; | |
195 | fSpectators = 1; | |
196 | fDsigmaDb = 0; | |
197 | fDnDb = 0; | |
198 | fPtMinJet = -2.5; | |
332c8db0 | 199 | fRadiation = 1; |
f8b85aa9 | 200 | fEventVertex.Set(3); |
3792091f | 201 | // |
202 | SetSimpleJets(); | |
203 | ||
ad1df918 | 204 | // |
1ed25e11 | 205 | // Set random number generator |
097ec7c1 | 206 | sRandom = fRandom; |
2685bf00 | 207 | fHijing = 0; |
208 | ||
110410f9 | 209 | } |
210 | ||
211 | AliGenHijing::AliGenHijing(const AliGenHijing & Hijing) | |
212 | { | |
213 | // copy constructor | |
214 | } | |
215 | ||
216 | ||
217 | AliGenHijing::~AliGenHijing() | |
218 | { | |
219 | // Destructor | |
21ce2e6f | 220 | if ( fDsigmaDb) delete fDsigmaDb; |
221 | if ( fDnDb) delete fDnDb; | |
110410f9 | 222 | } |
223 | ||
224 | void AliGenHijing::Init() | |
225 | { | |
226 | // Initialisation | |
3b8bd63f | 227 | fFrame.Resize(8); |
228 | fTarget.Resize(8); | |
229 | fProjectile.Resize(8); | |
230 | ||
110410f9 | 231 | SetMC(new THijing(fEnergyCMS, fFrame, fProjectile, fTarget, |
232 | fAProjectile, fZProjectile, fATarget, fZTarget, | |
233 | fMinImpactParam, fMaxImpactParam)); | |
234 | ||
235 | fHijing=(THijing*) fgMCEvGen; | |
332c8db0 | 236 | fHijing->SetIHPR2(2, fRadiation); |
110410f9 | 237 | fHijing->SetIHPR2(3, fTrigger); |
238 | fHijing->SetIHPR2(4, fQuench); | |
239 | fHijing->SetIHPR2(6, fShadowing); | |
240 | fHijing->SetIHPR2(12, fDecaysOff); | |
241 | fHijing->SetIHPR2(21, fKeep); | |
ed6361b0 | 242 | fHijing->SetHIPR1(10, fPtMinJet); |
3792091f | 243 | fHijing->SetHIPR1(50, fSimpleJet); |
ba244bac | 244 | fHijing->Initialize(); |
110410f9 | 245 | // |
246 | if (fEvaluate) EvaluateCrossSections(); | |
ad1df918 | 247 | // |
248 | // | |
249 | // Initialize random generator | |
110410f9 | 250 | } |
251 | ||
252 | void AliGenHijing::Generate() | |
253 | { | |
254 | // Generate one event | |
255 | ||
21ce2e6f | 256 | Float_t polar[3] = {0,0,0}; |
257 | Float_t origin[3] = {0,0,0}; | |
258 | Float_t origin0[3] = {0,0,0}; | |
28adac24 | 259 | Float_t p[3], random[6]; |
260 | Float_t tof; | |
110410f9 | 261 | |
28adac24 | 262 | static TClonesArray *particles; |
110410f9 | 263 | // converts from mm/c to s |
21ce2e6f | 264 | const Float_t kconv = 0.001/2.999792458e8; |
110410f9 | 265 | // |
21ce2e6f | 266 | Int_t nt = 0; |
267 | Int_t jev = 0; | |
28adac24 | 268 | Int_t j, kf, ks, imo; |
21ce2e6f | 269 | kf = 0; |
eb342d2d | 270 | |
21ce2e6f | 271 | if(!particles) particles = new TClonesArray("TParticle",10000); |
110410f9 | 272 | |
21ce2e6f | 273 | fTrials = 0; |
274 | for (j = 0;j < 3; j++) origin0[j] = fOrigin[j]; | |
275 | if(fVertexSmear == kPerEvent) { | |
f8b85aa9 | 276 | Float_t dv[3]; |
277 | dv[2] = 1.e10; | |
278 | while(TMath::Abs(dv[2]) > fCutVertexZ*fOsigma[2]) { | |
279 | Rndm(random,6); | |
280 | for (j=0; j < 3; j++) { | |
281 | dv[j] = fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
282 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
283 | } | |
284 | } | |
285 | for (j=0; j < 3; j++) origin0[j] += dv[j]; | |
21ce2e6f | 286 | } else if (fVertexSmear == kPerTrack) { |
28adac24 | 287 | // fHijing->SetMSTP(151,0); |
21ce2e6f | 288 | for (j = 0; j < 3; j++) { |
28adac24 | 289 | // fHijing->SetPARP(151+j, fOsigma[j]*10.); |
21ce2e6f | 290 | } |
28adac24 | 291 | } |
292 | while(1) | |
21ce2e6f | 293 | { |
294 | // Generate one event | |
b46f2676 | 295 | // -------------------------------------------------------------------------- |
296 | fSpecn = 0; | |
297 | fSpecp = 0; | |
298 | // -------------------------------------------------------------------------- | |
28adac24 | 299 | fHijing->GenerateEvent(); |
300 | fTrials++; | |
e4ffda63 | 301 | if (fTrigger != kNoTrigger) { |
302 | if (!CheckTrigger()) continue; | |
303 | } | |
304 | ||
28adac24 | 305 | fHijing->ImportParticles(particles,"All"); |
cc71f2d3 | 306 | if (fLHC) Boost(particles); |
307 | ||
e4ffda63 | 308 | |
28adac24 | 309 | Int_t np = particles->GetEntriesFast(); |
310 | printf("\n **************************************************%d\n",np); | |
21ce2e6f | 311 | Int_t nc = 0; |
28adac24 | 312 | if (np == 0 ) continue; |
313 | Int_t i; | |
314 | Int_t * newPos = new Int_t[np]; | |
315 | ||
21ce2e6f | 316 | for (i = 0; i < np; i++) *(newPos+i) = i; |
f8b85aa9 | 317 | // Get event vertex |
318 | // | |
319 | TParticle * iparticle = (TParticle *) particles->At(0); | |
320 | fEventVertex[0] = origin0[0]; | |
321 | fEventVertex[1] = origin0[1]; | |
322 | fEventVertex[2] = origin0[2]; | |
323 | ||
e06552ba | 324 | // |
325 | // First write parent particles | |
326 | // | |
327 | ||
21ce2e6f | 328 | for (i = 0; i < np; i++) { |
f8b85aa9 | 329 | iparticle = (TParticle *) particles->At(i); |
e06552ba | 330 | // Is this a parent particle ? |
f8b85aa9 | 331 | if (Stable(iparticle)) continue; |
e06552ba | 332 | // |
28adac24 | 333 | Bool_t hasMother = (iparticle->GetFirstMother() >=0); |
334 | Bool_t selected = kTRUE; | |
335 | Bool_t hasSelectedDaughters = kFALSE; | |
e06552ba | 336 | |
337 | ||
28adac24 | 338 | kf = iparticle->GetPdgCode(); |
339 | ks = iparticle->GetStatusCode(); | |
340 | if (kf == 92) continue; | |
608708ba | 341 | |
55d6adcf | 342 | if (!fSelectAll) selected = KinematicSelection(iparticle, 0)&&SelectFlavor(kf); |
28adac24 | 343 | hasSelectedDaughters = DaughtersSelection(iparticle, particles); |
110410f9 | 344 | // |
345 | // Put particle on the stack if it is either selected or it is the mother of at least one seleted particle | |
346 | // | |
28adac24 | 347 | if (selected || hasSelectedDaughters) { |
21ce2e6f | 348 | nc++; |
349 | p[0] = iparticle->Px(); | |
350 | p[1] = iparticle->Py(); | |
351 | p[2] = iparticle->Pz(); | |
352 | origin[0] = origin0[0]+iparticle->Vx()/10; | |
353 | origin[1] = origin0[1]+iparticle->Vy()/10; | |
354 | origin[2] = origin0[2]+iparticle->Vz()/10; | |
355 | tof = kconv*iparticle->T(); | |
356 | imo = -1; | |
79bf94df | 357 | TParticle* mother = 0; |
21ce2e6f | 358 | if (hasMother) { |
359 | imo = iparticle->GetFirstMother(); | |
79bf94df | 360 | mother = (TParticle *) particles->At(imo); |
21ce2e6f | 361 | imo = (mother->GetPdgCode() != 92) ? imo =* (newPos+imo) : -1; |
79bf94df | 362 | |
21ce2e6f | 363 | } |
e06552ba | 364 | // Put particle on the stack ... |
1df2195f | 365 | // printf("\n set track mother: %d %d %d %d %d %d ",i,imo, kf, nt+1, selected, hasSelectedDaughters); |
21ce2e6f | 366 | |
a99cf51f | 367 | SetTrack(0,imo,kf,p,origin,polar, tof,kPPrimary,nt); |
e06552ba | 368 | // ... and keep it there |
a99cf51f | 369 | KeepTrack(nt); |
e06552ba | 370 | // |
21ce2e6f | 371 | *(newPos+i)=nt; |
28adac24 | 372 | } // selected |
373 | } // particle loop parents | |
e06552ba | 374 | // |
375 | // Now write the final state particles | |
376 | // | |
377 | ||
28adac24 | 378 | for (i = 0; i<np; i++) { |
379 | TParticle * iparticle = (TParticle *) particles->At(i); | |
e06552ba | 380 | // Is this a final state particle ? |
28adac24 | 381 | if (!Stable(iparticle)) continue; |
b46f2676 | 382 | |
28adac24 | 383 | Bool_t hasMother = (iparticle->GetFirstMother() >=0); |
384 | Bool_t selected = kTRUE; | |
385 | kf = iparticle->GetPdgCode(); | |
386 | ks = iparticle->GetStatusCode(); | |
b46f2676 | 387 | // -------------------------------------------------------------------------- |
388 | // Count spectator neutrons and protons | |
389 | if(ks == 0 || ks == 1 || ks == 10 || ks == 11){ | |
390 | if(kf == kNeutron) fSpecn += 1; | |
391 | if(kf == kProton) fSpecp += 1; | |
392 | } | |
393 | // -------------------------------------------------------------------------- | |
394 | // | |
28adac24 | 395 | if (!fSelectAll) { |
55d6adcf | 396 | selected = KinematicSelection(iparticle,0)&&SelectFlavor(kf); |
21ce2e6f | 397 | if (!fSpectators && selected) selected = (ks != 0 && ks != 1 && ks != 10 |
398 | && ks != 11); | |
28adac24 | 399 | } |
e06552ba | 400 | // |
401 | // Put particle on the stack if selected | |
402 | // | |
28adac24 | 403 | if (selected) { |
21ce2e6f | 404 | nc++; |
405 | p[0] = iparticle->Px(); | |
406 | p[1] = iparticle->Py(); | |
407 | p[2] = iparticle->Pz(); | |
408 | origin[0] = origin0[0]+iparticle->Vx()/10; | |
409 | origin[1] = origin0[1]+iparticle->Vy()/10; | |
410 | origin[2] = origin0[2]+iparticle->Vz()/10; | |
411 | tof = kconv*iparticle->T(); | |
412 | imo = -1; | |
79bf94df | 413 | TParticle* mother = 0; |
21ce2e6f | 414 | if (hasMother) { |
415 | imo = iparticle->GetFirstMother(); | |
79bf94df | 416 | mother = (TParticle *) particles->At(imo); |
21ce2e6f | 417 | imo = (mother->GetPdgCode() != 92) ? imo=*(newPos+imo) : -1; |
418 | } | |
e06552ba | 419 | // Put particle on the stack |
a99cf51f | 420 | SetTrack(fTrackIt,imo,kf,p,origin,polar, |
79bf94df | 421 | tof,kPNoProcess,nt); |
a99cf51f | 422 | KeepTrack(nt); |
21ce2e6f | 423 | *(newPos+i)=nt; |
28adac24 | 424 | } // selected |
425 | } // particle loop final state | |
e06552ba | 426 | |
79bf94df | 427 | delete[] newPos; |
28adac24 | 428 | |
429 | printf("\n I've put %i particles on the stack \n",nc); | |
430 | if (nc > 0) { | |
21ce2e6f | 431 | jev += nc; |
432 | if (jev >= fNpart || fNpart == -1) { | |
433 | fKineBias = Float_t(fNpart)/Float_t(fTrials); | |
434 | printf("\n Trials: %i %i %i\n",fTrials, fNpart, jev); | |
435 | break; | |
436 | } | |
28adac24 | 437 | } |
21ce2e6f | 438 | } // event loop |
439 | MakeHeader(); | |
440 | ||
a99cf51f | 441 | SetHighWaterMark(nt); |
110410f9 | 442 | } |
443 | ||
110410f9 | 444 | void AliGenHijing::KeepFullEvent() |
445 | { | |
446 | fKeep=1; | |
447 | } | |
448 | ||
449 | void AliGenHijing::EvaluateCrossSections() | |
450 | { | |
451 | // Glauber Calculation of geometrical x-section | |
452 | // | |
21ce2e6f | 453 | Float_t xTot = 0.; // barn |
454 | Float_t xTotHard = 0.; // barn | |
455 | Float_t xPart = 0.; // barn | |
456 | Float_t xPartHard = 0.; // barn | |
457 | Float_t sigmaHard = 0.1; // mbarn | |
458 | Float_t bMin = 0.; | |
459 | Float_t bMax = fHijing->GetHIPR1(34)+fHijing->GetHIPR1(35); | |
460 | const Float_t kdib = 0.2; | |
461 | Int_t kMax = Int_t((bMax-bMin)/kdib)+1; | |
110410f9 | 462 | |
463 | ||
464 | printf("\n Projectile Radius (fm): %f \n",fHijing->GetHIPR1(34)); | |
465 | printf("\n Target Radius (fm): %f \n",fHijing->GetHIPR1(35)); | |
466 | Int_t i; | |
21ce2e6f | 467 | Float_t oldvalue= 0.; |
468 | ||
469 | Float_t* b = new Float_t[kMax]; | |
470 | Float_t* si1 = new Float_t[kMax]; | |
471 | Float_t* si2 = new Float_t[kMax]; | |
110410f9 | 472 | |
21ce2e6f | 473 | for (i = 0; i < kMax; i++) |
110410f9 | 474 | { |
21ce2e6f | 475 | Float_t xb = bMin+i*kdib; |
110410f9 | 476 | Float_t ov; |
477 | ov=fHijing->Profile(xb); | |
21ce2e6f | 478 | Float_t gb = 2.*0.01*fHijing->GetHIPR1(40)*kdib*xb*(1.-TMath::Exp(-fHijing->GetHINT1(12)*ov)); |
479 | Float_t gbh = 2.*0.01*fHijing->GetHIPR1(40)*kdib*xb*sigmaHard*ov; | |
110410f9 | 480 | xTot+=gb; |
21ce2e6f | 481 | xTotHard += gbh; |
110410f9 | 482 | if (xb > fMinImpactParam && xb < fMaxImpactParam) |
483 | { | |
21ce2e6f | 484 | xPart += gb; |
485 | xPartHard += gbh; | |
110410f9 | 486 | } |
487 | ||
c007646a | 488 | if(oldvalue) if ((xTot-oldvalue)/oldvalue<0.0001) break; |
21ce2e6f | 489 | oldvalue = xTot; |
110410f9 | 490 | printf("\n Total cross section (barn): %d %f %f \n",i, xb, xTot); |
491 | printf("\n Hard cross section (barn): %d %f %f \n\n",i, xb, xTotHard); | |
21ce2e6f | 492 | if (i>0) { |
493 | si1[i] = gb/kdib; | |
494 | si2[i] = gbh/gb; | |
495 | b[i] = xb; | |
496 | } | |
110410f9 | 497 | } |
21ce2e6f | 498 | |
110410f9 | 499 | printf("\n Total cross section (barn): %f \n",xTot); |
500 | printf("\n Hard cross section (barn): %f \n \n",xTotHard); | |
501 | printf("\n Partial cross section (barn): %f %f \n",xPart, xPart/xTot*100.); | |
502 | printf("\n Partial hard cross section (barn): %f %f \n",xPartHard, xPartHard/xTotHard*100.); | |
21ce2e6f | 503 | |
504 | // Store result as a graph | |
505 | b[0] = 0; | |
506 | si1[0] = 0; | |
507 | si2[0]=si2[1]; | |
508 | ||
509 | fDsigmaDb = new TGraph(i, b, si1); | |
510 | fDnDb = new TGraph(i, b, si2); | |
110410f9 | 511 | } |
512 | ||
513 | Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle, TClonesArray* particles) | |
514 | { | |
515 | // | |
516 | // Looks recursively if one of the daughters has been selected | |
517 | // | |
518 | // printf("\n Consider daughters %d:",iparticle->GetPdgCode()); | |
21ce2e6f | 519 | Int_t imin = -1; |
520 | Int_t imax = -1; | |
110410f9 | 521 | Int_t i; |
21ce2e6f | 522 | Bool_t hasDaughters = (iparticle->GetFirstDaughter() >=0); |
523 | Bool_t selected = kFALSE; | |
110410f9 | 524 | if (hasDaughters) { |
21ce2e6f | 525 | imin = iparticle->GetFirstDaughter(); |
526 | imax = iparticle->GetLastDaughter(); | |
527 | for (i = imin; i <= imax; i++){ | |
528 | TParticle * jparticle = (TParticle *) particles->At(i); | |
529 | Int_t ip = jparticle->GetPdgCode(); | |
55d6adcf | 530 | if (KinematicSelection(jparticle,0)&&SelectFlavor(ip)) { |
608708ba | 531 | selected=kTRUE; break; |
532 | } | |
110410f9 | 533 | if (DaughtersSelection(jparticle, particles)) {selected=kTRUE; break; } |
534 | } | |
535 | } else { | |
536 | return kFALSE; | |
537 | } | |
110410f9 | 538 | return selected; |
539 | } | |
540 | ||
541 | ||
eb342d2d | 542 | Bool_t AliGenHijing::SelectFlavor(Int_t pid) |
543 | { | |
544 | // Select flavor of particle | |
545 | // 0: all | |
546 | // 4: charm and beauty | |
547 | // 5: beauty | |
548 | if (fFlavor == 0) return kTRUE; | |
549 | ||
21ce2e6f | 550 | Int_t ifl = TMath::Abs(pid/100); |
eb342d2d | 551 | if (ifl > 10) ifl/=10; |
608708ba | 552 | return (fFlavor == ifl); |
553 | } | |
eb342d2d | 554 | |
608708ba | 555 | Bool_t AliGenHijing::Stable(TParticle* particle) |
556 | { | |
675e9664 | 557 | // Return true for a stable particle |
558 | // | |
79bf94df | 559 | if (particle->GetFirstDaughter() < 0 ) |
608708ba | 560 | { |
561 | return kTRUE; | |
562 | } else { | |
563 | return kFALSE; | |
564 | } | |
eb342d2d | 565 | } |
110410f9 | 566 | |
cc71f2d3 | 567 | |
568 | void AliGenHijing::Boost(TClonesArray* particles) | |
569 | { | |
570 | // | |
571 | // Boost cms into LHC lab frame | |
572 | // | |
573 | Double_t dy = - 0.5 * TMath::Log(Double_t(fZProjectile) * Double_t(fATarget) / | |
574 | (Double_t(fZTarget) * Double_t(fAProjectile))); | |
575 | Double_t beta = TMath::TanH(dy); | |
576 | Double_t gamma = 1./TMath::Sqrt(1.-beta*beta); | |
577 | Double_t gb = gamma * beta; | |
578 | ||
579 | printf("\n Boosting particles to lab frame %f %f %f", dy, beta, gamma); | |
580 | ||
581 | Int_t i; | |
582 | Int_t np = particles->GetEntriesFast(); | |
583 | for (i = 0; i < np; i++) | |
584 | { | |
585 | TParticle* iparticle = (TParticle*) particles->At(i); | |
586 | ||
587 | Double_t e = iparticle->Energy(); | |
588 | Double_t px = iparticle->Px(); | |
589 | Double_t py = iparticle->Py(); | |
590 | Double_t pz = iparticle->Pz(); | |
591 | ||
592 | Double_t eb = gamma * e - gb * pz; | |
593 | Double_t pzb = -gb * e + gamma * pz; | |
594 | ||
595 | iparticle->SetMomentum(px, py, pzb, eb); | |
596 | } | |
597 | } | |
598 | ||
599 | ||
3b8bd63f | 600 | void AliGenHijing::MakeHeader() |
601 | { | |
602 | // Builds the event header, to be called after each event | |
21ce2e6f | 603 | AliGenEventHeader* header = new AliGenHijingEventHeader("Hijing"); |
332c8db0 | 604 | ((AliGenHijingEventHeader*) header)->SetNProduced(fHijing->GetNATT()); |
605 | ((AliGenHijingEventHeader*) header)->SetImpactParameter(fHijing->GetHINT1(19)); | |
606 | ((AliGenHijingEventHeader*) header)->SetTotalEnergy(fHijing->GetEATT()); | |
607 | ((AliGenHijingEventHeader*) header)->SetHardScatters(fHijing->GetJATT()); | |
608 | ((AliGenHijingEventHeader*) header)->SetParticipants(fHijing->GetNP(), fHijing->GetNT()); | |
609 | ((AliGenHijingEventHeader*) header)->SetCollisions(fHijing->GetN0(), | |
610 | fHijing->GetN01(), | |
611 | fHijing->GetN10(), | |
612 | fHijing->GetN11()); | |
613 | ((AliGenHijingEventHeader*) header)->SetSpectators(fSpecn, fSpecp); | |
614 | ||
f8b85aa9 | 615 | // 4-momentum vectors of the triggered jets. |
616 | // | |
617 | // Before final state gluon radiation. | |
332c8db0 | 618 | TLorentzVector* jet1 = new TLorentzVector(fHijing->GetHINT1(21), |
619 | fHijing->GetHINT1(22), | |
620 | fHijing->GetHINT1(23), | |
621 | fHijing->GetHINT1(24)); | |
622 | ||
623 | TLorentzVector* jet2 = new TLorentzVector(fHijing->GetHINT1(31), | |
624 | fHijing->GetHINT1(32), | |
625 | fHijing->GetHINT1(33), | |
626 | fHijing->GetHINT1(34)); | |
f8b85aa9 | 627 | // After final state gluon radiation. |
628 | TLorentzVector* jet3 = new TLorentzVector(fHijing->GetHINT1(26), | |
629 | fHijing->GetHINT1(27), | |
630 | fHijing->GetHINT1(28), | |
631 | fHijing->GetHINT1(29)); | |
632 | ||
633 | TLorentzVector* jet4 = new TLorentzVector(fHijing->GetHINT1(36), | |
634 | fHijing->GetHINT1(37), | |
635 | fHijing->GetHINT1(38), | |
636 | fHijing->GetHINT1(39)); | |
637 | ((AliGenHijingEventHeader*) header)->SetJets(jet1, jet2, jet3, jet4); | |
7a186781 | 638 | // Bookkeeping for kinematic bias |
e4ffda63 | 639 | ((AliGenHijingEventHeader*) header)->SetTrials(fTrials); |
f8b85aa9 | 640 | // Event Vertex |
641 | header->SetPrimaryVertex(fEventVertex); | |
332c8db0 | 642 | gAlice->SetGenEventHeader(header); |
3b8bd63f | 643 | } |
644 | ||
e4ffda63 | 645 | Bool_t AliGenHijing::CheckTrigger() |
646 | { | |
647 | // Check the kinematic trigger condition | |
648 | // | |
649 | TLorentzVector* jet1 = new TLorentzVector(fHijing->GetHINT1(26), | |
650 | fHijing->GetHINT1(27), | |
651 | fHijing->GetHINT1(28), | |
652 | fHijing->GetHINT1(29)); | |
653 | ||
654 | TLorentzVector* jet2 = new TLorentzVector(fHijing->GetHINT1(36), | |
655 | fHijing->GetHINT1(37), | |
656 | fHijing->GetHINT1(38), | |
657 | fHijing->GetHINT1(39)); | |
658 | Double_t eta1 = jet1->Eta(); | |
659 | Double_t eta2 = jet2->Eta(); | |
7a186781 | 660 | Double_t phi1 = jet1->Phi(); |
661 | Double_t phi2 = jet2->Phi(); | |
e4ffda63 | 662 | Bool_t triggered = kFALSE; |
7a186781 | 663 | //Check eta range first... |
e4ffda63 | 664 | if ((eta1 < fEtaMaxJet && eta1 > fEtaMinJet) || |
665 | (eta2 < fEtaMaxJet && eta2 > fEtaMinJet)) | |
666 | { | |
7a186781 | 667 | //Eta is okay, now check phi range |
668 | if ((phi1 < fPhiMaxJet && phi1 > fPhiMinJet) || | |
669 | (phi2 < fPhiMaxJet && phi2 > fPhiMinJet)) | |
670 | { | |
671 | triggered = kTRUE; | |
672 | } | |
e4ffda63 | 673 | } |
674 | return triggered; | |
675 | } | |
cc71f2d3 | 676 | |
3792091f | 677 | |
678 | ||
679 | ||
110410f9 | 680 | AliGenHijing& AliGenHijing::operator=(const AliGenHijing& rhs) |
681 | { | |
682 | // Assignment operator | |
683 | return *this; | |
684 | } | |
608708ba | 685 | |
65fb704d | 686 | #ifndef WIN32 |
687 | # define rluget_hijing rluget_hijing_ | |
688 | # define rluset_hijing rluset_hijing_ | |
689 | # define rlu_hijing rlu_hijing_ | |
690 | # define type_of_call | |
691 | #else | |
692 | # define rluget_hijing RLUGET_HIJING | |
693 | # define rluset_hijing RLUSET_HIJING | |
694 | # define rlu_hijing RLU_HIJING | |
695 | # define type_of_call _stdcall | |
696 | #endif | |
697 | ||
698 | ||
699 | extern "C" { | |
700 | void type_of_call rluget_hijing(Int_t & /*lfn*/, Int_t & /*move*/) | |
701 | {printf("Dummy version of rluget_hijing reached\n");} | |
702 | ||
703 | void type_of_call rluset_hijing(Int_t & /*lfn*/, Int_t & /*move*/) | |
704 | {printf("Dummy version of rluset_hijing reached\n");} | |
705 | ||
706 | Double_t type_of_call rlu_hijing(Int_t & /*idum*/) | |
7498b3ad | 707 | { |
708 | Float_t r; | |
709 | do r=sRandom->Rndm(); while(0 >= r || r >= 1); | |
710 | return r; | |
711 | } | |
65fb704d | 712 | } |