ATLAS Offline Software
Loading...
Searching...
No Matches
Hydjet_i.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5// -------------------------------------------------------------
6// Generators/Hydjet.cxx Description: Allows the user
7// to generate Hydjet events and store the result in the
8// Transient Store.
9//
10// AuthorList:
11// Andrzej Olszewski: Initial Code February 2007
12//
13// m_hyipar used only for stoing precalculated AW nad RA
14
15#include "Hydjet_i/Hydjet_i.h"
16
17#include "GaudiKernel/MsgStream.h"
18
20
21#include "AtlasHepMC/GenEvent.h"
25
26#include <stdlib.h>
27
28#include "CLHEP/Random/RandFlat.h"
29#include "CLHEP/Vector/LorentzVector.h"
30
31
32// calls to fortran routines
33extern "C"
34{
35 void luedit_(int*);
36
37 void hyinit_(double*, double*, int*, double*, double*, double*, int*);
38
39 void hyevnt_();
40}
41
42Hydjet::Hydjet(const std::string& name,
43 ISvcLocator* pSvcLocator): GenModule(name,pSvcLocator)
44{
46}
47
49{
50
51 ATH_CHECK(m_event_paramsKey.initialize());
52 // Initialisation of input parameters
53 //
54 ATH_MSG_INFO( "===> March 13 2008 HYDJET INTERFACE VERSION. \n" );
55 ATH_MSG_INFO( "===> HYDJET INITIALISING. \n" );
56
57 // Set the users' initialisation parameters choices
59
60 /*
61 std::cout << " PRINTING HYFLOW " << std::endl;
62 std::cout << "ytfl,ylfl,tf,fpart" << ", "
63 << m_hyflow.ytfl() << ", " << m_hyflow.ylfl() << ", "
64 << m_hyflow.tf() << ", " << m_hyflow.fpart()
65 << std::endl;
66 std::cout << " PRINTING HYJPAR " << std::endl;
67 std::cout << "ptmin,sigin,sigjet,nhsel,ishad,njet" << ", "
68 << m_hyjpar.ptmin() << ", " << m_hyjpar.sigin() << ", "
69 << m_hyjpar.sigjet() << ", " << m_hyjpar.nhsel() << ", "
70 << m_hyjpar.ishad() << ", " << m_hyjpar.njet()
71 << std::endl;
72 std::cout << " PRINTING PYQPAR " << std::endl;
73 std::cout << "ienglu,ianglu,t0,tau0,nf" << ", "
74 << m_pyqpar.ienglu() << ", " << m_pyqpar.ianglu() << ", "
75 << m_pyqpar.t0() << ", " << m_pyqpar.tau0() << ", "
76 << m_pyqpar.nf() << std::endl;
77 */
78
80
81 /*
82 std::cout << " PRINTING MSTU " << std::endl;
83 for (int i = 1; i <= m_pydat1.lenMstu(); ++i)
84 std::cout << i << ":" << m_pydat1.mstu(i) << ", ";
85 std::cout << std::endl;
86 std::cout << " PRINTING PARU " << std::endl;
87 for (int i = 1; i <= m_pydat1.lenParu(); ++i)
88 std::cout << i << ":" << m_pydat1.paru(i) << ", ";
89 std::cout << std::endl;
90 std::cout << " PRINTING MSTJ " << std::endl;
91 for (int i = 1; i <= m_pydat1.lenMstj(); ++i)
92 std::cout << i << ":" << m_pydat1.mstj(i) << ", ";
93 std::cout << std::endl;
94 std::cout << " PRINTING PARJ " << std::endl;
95 for (int i = 1; i <= m_pydat1.lenParj(); ++i)
96 std::cout << i << ":" << m_pydat1.parj(i) << ", ";
97 std::cout << std::endl;
98
99 std::cout << " PRINTING MSTP " << std::endl;
100 for (int i = 1; i <= m_pypars.lenMstp(); ++i)
101 std::cout << i << ":" << m_pypars.mstp(i) << ", ";
102 std::cout << std::endl;
103 std::cout << " PRINTING PARP " << std::endl;
104 for (int i = 1; i <= m_pypars.lenParp(); ++i)
105 std::cout << i << ":" << m_pypars.parp(i) << ", ";
106 std::cout << std::endl;
107 std::cout << " PRINTING MSTI " << std::endl;
108 for (int i = 1; i <= m_pypars.lenMsti(); ++i)
109 std::cout << i << ":" << m_pypars.msti(i) << ", ";
110 std::cout << std::endl;
111 std::cout << " PRINTING PARI " << std::endl;
112 for (int i = 1; i <= m_pypars.lenPari(); ++i)
113 std::cout << i << ":" << m_pypars.pari(i) << ", ";
114 std::cout << std::endl;
115
116 std::cout << " PRINTING PYSUBS " << std::endl;
117 std::cout << "msel,mselpd" << ", "
118 << m_pysubs.msel() << ", " << m_pysubs.mselpd() << std::endl;
119 std::cout << " PRINTING MSUB " << std::endl;
120 for (int i = 1; i <= m_pysubs.lenMsub(); ++i)
121 std::cout << i << ":" << m_pysubs.msub(i) << ", ";
122 std::cout << std::endl;
123 std::cout << " PRINTING KFIN " << std::endl;
124 for (int i = 1; i <= m_pysubs.leniKfin(); ++i)
125 for (int j = 1; j <= m_pysubs.lenjKfin(); ++j)
126 std::cout << i << ":" << j << ":" << m_pysubs.kfin(i,j) << ", ";
127 std::cout << std::endl;
128 std::cout << " PRINTING CKIN " << std::endl;
129 for (int i = 1; i <= m_pysubs.lenCkin(); ++i)
130 std::cout << i << ":" << m_pysubs.ckin(i) << ", ";
131 std::cout << std::endl;
132 */
133
134 return StatusCode::SUCCESS;
135}
136
138{
139 ATH_MSG_INFO( " HYDJET generating. \n" );
140
141 // Generate event
142 hyevnt_();
143
144 // Remove unstable particles and partons
145 int luedit_init = 2;
146 luedit_(&luedit_init);
147
148 // update event counter
149 ++m_events;
150
151 /*
152 std::cout << " PRINTING HYIPAR " << std::endl;
153 std::cout << "bminh,bmaxh,AW,RA,npar0,nbco0,Apb,Rpb,np,init,ipr" << ", "
154 << m_hyipar.bminh() << ", " << m_hyipar.bmaxh() << ", "
155 << m_hyipar.AW() << ", " << m_hyipar.RA() << ", "
156 << m_hyipar.npar0() << ", " << m_hyipar.nbco0() << ", "
157 << m_hyipar.Apb() << ", " << m_hyipar.Rpb() << ", "
158 << m_hyipar.np() << ", " << m_hyipar.init() << ", "
159 << m_hyipar.ipr() << std::endl;
160 std::cout << " PRINTING HYFPAR " << std::endl;
161 std::cout << "bgen,nbcol,npart,npyt,nhyd" << ", "
162 << m_hyfpar.bgen() << ", " << m_hyfpar.nbcol() << ", "
163 << m_hyfpar.npart() << ", " << m_hyfpar.npyt() << ", "
164 << m_hyfpar.nhyd() << std::endl;
165 */
166
167 // store hijing event parameters
168 // -----------------------------
169 ATH_MSG_DEBUG( "New HijingEventParams" );
170 int np = (int) round(m_hyfpar.npart()/2);
171 int nt = (int) round(m_hyfpar.npart()/2);
172 int n0 = (int) round(m_hyfpar.nbcol());
173 int n01 = -1;
174 int n10 = -1;
175 int n11 = -1;
176 int natt = m_hyfpar.nhyd() + m_hyfpar.npyt();
177 int jatt = m_hyjpar.njet();
178 float b = m_hyfpar.bgen() * m_hyipar.RA();
179 float bphi = 0;
180
182 event_params = std::make_unique<HijingEventParams>(np, nt, n0, n01, n10, n11, natt, jatt, b, bphi);
183
184 ATH_MSG_INFO( "\n=================================================\n"
185 << " HYDJET event description: \n"
186 << " b = " << b << " fm \n"
187 << " # total participants = " << m_hyfpar.npart() << "\n"
188 << " # collisions = " << m_hyfpar.nbcol() << "\n"
189 << " # jets = " << m_hyjpar.njet() << "\n"
190 << " # pythia particles = " << m_hyfpar.npyt() << "\n"
191 << " # hydro particles = " << m_hyfpar.nhyd() << "\n"
192 << "=================================================\n" );
193
194 ATH_MSG_DEBUG( " HIJING generating done. \n" );
195 return StatusCode::SUCCESS;
196}
197
198StatusCode
200{
201 ATH_MSG_INFO( " HIJING Ending. \n" );
202 return StatusCode::SUCCESS;
203}
204
205StatusCode
206Hydjet::fillEvt(HepMC::GenEvent* evt)
207{
208 ATH_MSG_INFO( " HYDJET Filing. \n" );
209
210 // Set the event number
211 evt->set_event_number( m_events );
212
213 // Set the random generator seeds
214 // evt->set_random_states(m_seeds);
215
216 // Set the generator id
217 HepMC::set_signal_process_id(evt,100000000 + int(m_a));
218
219 // Create the event vertex
221 evt->add_vertex( v1 );
222
223 double eproj = m_e/2.0;
224 int proj_id = (int) m_a;
225 v1->add_particle_in( HepMC::newGenParticlePtr( HepMC::FourVector(0., 0., eproj, eproj), proj_id, 101 ) );
226
227 double etarg = m_e/2.0;
228 int targ_id = (int) m_a;
229 v1->add_particle_in( HepMC::newGenParticlePtr( HepMC::FourVector(0., 0., -etarg, etarg), targ_id, 102 ) );
230
231 // Loop on all final particles and
232 // put them all as outgoing from the event vertex
233 for (int i = 1; i <= m_lujets.n(); ++i)
234 {
235 v1->add_particle_out( HepMC::newGenParticlePtr(
236 HepMC::FourVector(m_lujets.p(i, 1), m_lujets.p(i, 2),
237 m_lujets.p(i, 3), m_lujets.p(i, 4)), m_lujets.k(i, 2), 1 ) );
238 }
239
240 // Set the generator id
241 HepMC::set_signal_process_id(evt,100000000 + int(m_a));
242
243 MC::GeVToMeV(evt); //Only scales momenta and masses
244
245 return StatusCode::SUCCESS;
246}
247
248void
250{
251 m_e = 5520.0;
252 m_a = 208;
253
254 // copy of HYDJET calculations
255 m_hyipar.AW() = m_a;
256 m_hyipar.RA() = 1.15 * std::pow(m_a,0.333333);
257
258 m_ifb = 1;
259 m_bmin = 0;
260 m_bmax = 1;
261 m_bfix = 0;
262 m_nh = 20000;
263
264 // set hydro parameters
265 // nhsel=0 - hydro (no jets), nhsel=1 - hydro + pythia jets,
266 // nhsel=2 - hydro + pyquen jets, nhsel=3 - pythia jets (no hydro),
267 // nhsel=4 - pyquen jets (no hydro)
268 m_hyjpar.nhsel()=2; // flag to include hard scatterings
269 m_hyjpar.ishad()=1; // flag to include "nuclear shadowing"
270 m_hyflow.ylfl()=4.; // maximum longitudinal flow rapidity
271 m_hyflow.ytfl()=1.5; // maximum transverse flow rapidity
272 m_hyflow.tf()=0.1; // freeze-out temperature in GeV
273 m_hyflow.fpart()=1.; // fraction of soft multiplicity proportional
274 // # of nucleons-participants
275
276 // set quenching parameters
277 // ienglu=0 - radiative and collisional loss,
278 // ienglu=1 - only radiative loss, ienglu=2 - only collisional loss;
279 // ianglu=0 - small-angular radiation, ianglu=1 - wide angular radiation,
280 // inanglu=2 - collinear radiation
281 m_pyqpar.ienglu()=0; // radiative and collisional loss
282 m_pyqpar.ianglu()=0; // radiative and collisional loss
283 m_pyqpar.t0()=0; // initial QGP temperature
284 m_pyqpar.tau0()=0.1; // proper time of QGP formation
285 m_pyqpar.nf()=0; // number of active quark flavours in QGP
286
287 // set input PYTHIA parameters
288 m_pysubs.msel()=1; // QCD-dijet production
289 m_hyjpar.ptmin()=10.;
290 // hydjet recommendation
291 m_pysubs.ckin(3)=m_hyjpar.ptmin();// minimum pt in initial hard sub-process
292 m_pypars.mstp(51)=7; // CTEQ5M pdf
293 m_pypars.mstp(81)=0; // pp multiple scattering off
294 m_pydat1.mstu(21)=1; // avoid stopping run
295 m_pydat1.paru(14)=1.; // tolerance parameter to adjust fragmentation
296
297 // Set user Initialization parameters
298 for(CommandVector::iterator i = m_InitializeVector.begin(); i != m_InitializeVector.end(); ++i )
299 {
300 ATH_MSG_INFO( " Command is: " << *i );
301 StringParse mystring(*i);
302 std::string myparam = mystring.piece<std::string>(1);
303 if (myparam == "e")
304 {
305 m_e = mystring.piece<double>(2);
306 }
307 else if (myparam == "a")
308 {
309 m_a = mystring.piece<int>(2);
310 }
311 else if (myparam == "ifb")
312 {
313 m_ifb = mystring.piece<int>(2);
314 }
315 else if (myparam == "bmin")
316 {
317 m_bmin = mystring.piece<double>(2);
318 m_bmin /= m_hyipar.RA();
319 }
320 else if (myparam == "bmax")
321 {
322 m_bmax = mystring.piece<double>(2);
323 m_bmax /= m_hyipar.RA();
324 }
325 else if (myparam == "bfix")
326 {
327 m_bfix = mystring.piece<double>(2);
328 m_bfix /= m_hyipar.RA();
329 }
330 else if (myparam == "nh")
331 {
332 m_nh = mystring.piece<int>(2);
333 }
334 else if (myparam == "nseed")
335 {
336 m_ludatr.mrlu(1) = mystring.piece<int>(2);
337 }
338 else if (myparam == "ytfl")
339 {
340 m_hyflow.ytfl() = mystring.piece<double>(2);
341 }
342 else if (myparam == "ylfl")
343 {
344 m_hyflow.ylfl() = mystring.piece<double>(2);
345 }
346 else if (myparam == "tf")
347 {
348 m_hyflow.tf() = mystring.piece<double>(2);
349 }
350 else if (myparam == "fpart")
351 {
352 m_hyflow.fpart() = mystring.piece<double>(2);
353 }
354 else if (myparam == "nhsel")
355 {
356 m_hyjpar.nhsel() = mystring.piece<int>(2);
357 }
358 else if (myparam == "ishad")
359 {
360 m_hyjpar.ishad() = mystring.piece<int>(2);
361 }
362 else if (myparam == "ptmin")
363 {
364 m_hyjpar.ptmin() = mystring.piece<double>(2);
365 // hydjet recommendation
366 m_pysubs.ckin(3) = mystring.piece<double>(2);
367 }
368 else if (myparam == "ienglu")
369 {
370 m_pyqpar.ienglu() = mystring.piece<int>(2);
371 }
372 else if (myparam == "ianglu")
373 {
374 m_pyqpar.ianglu() = mystring.piece<int>(2);
375 }
376 else if (myparam == "t0")
377 {
378 m_pyqpar.t0() = mystring.piece<double>(2);
379 }
380 else if (myparam == "tau0")
381 {
382 m_pyqpar.tau0() = mystring.piece<double>(2);
383 }
384 else if (myparam == "nf")
385 {
386 m_pyqpar.nf() = mystring.piece<int>(2);
387 }
388 else if (myparam == "mstu")
389 {
390 int myelem = mystring.piece<int>(2);
391 m_pydat1.mstu(myelem) = mystring.piece<int>(3);
392 }
393 else if (myparam == "paru")
394 {
395 int myelem = mystring.piece<int>(2);
396 m_pydat1.paru(myelem) = mystring.piece<double>(3);
397 }
398 else if (myparam == "mstj")
399 {
400 int myelem = mystring.piece<int>(2);
401 m_pydat1.mstj(myelem) = mystring.piece<int>(3);
402 }
403 else if (myparam == "parj")
404 {
405 int myelem = mystring.piece<int>(2);
406 m_pydat1.parj(myelem) = mystring.piece<double>(3);
407 }
408 else if (myparam == "msel")
409 {
410 m_pysubs.msel() = mystring.piece<int>(2);
411 }
412 else if (myparam == "mselpd")
413 {
414 m_pysubs.mselpd() = mystring.piece<int>(2);
415 }
416 else if (myparam == "msub")
417 {
418 int myelem = mystring.piece<int>(2);
419 m_pysubs.msub(myelem) = mystring.piece<int>(3);
420 }
421 else if (myparam == "kfin")
422 {
423 int myelem1 = mystring.piece<int>(2);
424 int myelem2 = mystring.piece<int>(3);
425 m_pysubs.kfin(myelem1,myelem2) = mystring.piece<int>(4);
426 }
427 else if (myparam == "ckin")
428 {
429 int myelem = mystring.piece<int>(2);
430 m_pysubs.ckin(myelem) = mystring.piece<double>(3);
431 }
432 else if (myparam == "mstp")
433 {
434 int myelem = mystring.piece<int>(2);
435 m_pypars.mstp(myelem) = mystring.piece<int>(3);
436 }
437 else if (myparam == "parp")
438 {
439 int myelem = mystring.piece<int>(2);
440 m_pypars.parp(myelem) = mystring.piece<double>(3);
441 }
442 else if (myparam == "msti")
443 {
444 int myelem = mystring.piece<int>(2);
445 m_pypars.msti(myelem) = mystring.piece<int>(3);
446 }
447 else if (myparam == "pari")
448 {
449 int myelem = mystring.piece<int>(2);
450 m_pypars.pari(myelem) = mystring.piece<double>(3);
451 }
452 else
453 {
454 ATH_MSG_ERROR( " ERROR in HIJING INITIALIZATION PARAMETERS " << myparam
455 << " is an invalid parameter !" );
456 }
457 }
458}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
ATLAS-specific HepMC functions.
void hyevnt_()
void luedit_(int *)
void hyinit_(double *, double *, int *, double *, double *, double *, int *)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenModule.cxx:14
virtual StatusCode callGenerator()
For calling the generator on each iteration of the event loop.
Definition Hydjet_i.cxx:137
int m_events
Definition Hydjet_i.h:69
double m_bmax
Definition Hydjet_i.h:61
HyfPar m_hyfpar
Definition Hydjet_i.h:77
CommandVector m_InitializeVector
Definition Hydjet_i.h:72
PyDat1 m_pydat1
Definition Hydjet_i.h:83
virtual StatusCode fillEvt(HepMC::GenEvent *evt)
For filling the HepMC event object.
Definition Hydjet_i.cxx:206
PySubs m_pysubs
Definition Hydjet_i.h:82
PyqPar m_pyqpar
Definition Hydjet_i.h:86
Hydjet(const std::string &name, ISvcLocator *pSvcLocator)
Definition Hydjet_i.cxx:42
double m_a
Definition Hydjet_i.h:58
HyjPar m_hyjpar
Definition Hydjet_i.h:76
double m_bfix
Definition Hydjet_i.h:62
HyFlow m_hyflow
Definition Hydjet_i.h:78
virtual StatusCode genInitialize()
For initializing the generator, if required.
Definition Hydjet_i.cxx:48
virtual StatusCode genFinalize()
For finalising the generator, if required.
Definition Hydjet_i.cxx:199
double m_bmin
Definition Hydjet_i.h:60
double m_e
Definition Hydjet_i.h:57
LuDatr m_ludatr
Definition Hydjet_i.h:89
void set_user_params(void)
Definition Hydjet_i.cxx:249
LuJets m_lujets
Definition Hydjet_i.h:92
int m_ifb
Definition Hydjet_i.h:59
HyiPar m_hyipar
Definition Hydjet_i.h:75
PyPars m_pypars
Definition Hydjet_i.h:81
int m_nh
Definition Hydjet_i.h:63
SG::WriteHandleKey< HijingEventParams > m_event_paramsKey
Definition Hydjet_i.h:97
Utility object for parsing a string into tokens and returning them as a variety of types.
Definition StringParse.h:33
T piece(size_t num) const
Templated function to get the num'th token as any numeric type.
Definition StringParse.h:44
HepMC::GenVertex * GenVertexPtr
Definition GenVertex.h:59
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
Definition GenVertex.h:64
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
Definition GenParticle.h:39
void set_signal_process_id(GenEvent *e, const int i)
Definition GenEvent.h:641
void GeVToMeV(HepMC::GenEvent *evt)