10 #include "boost/lexical_cast.hpp"
25 #include "HepMC/IO_HEPEVT.h"
26 #include "HepMC/PythiaWrapper6_4.h"
27 #include "HepMC/GenEvent.h"
28 #include "HepMC/HeavyIon.h"
29 #include "HepMC/SimpleVector.h"
43 int convertStatus(
int st) {
65 abeamtarget_(
pset.getParameter<double>(
"aBeamTarget")),
66 angularspecselector_(
pset.getParameter<
int>(
"angularSpectrumSelector")),
67 bfixed_(
pset.getParameter<double>(
"bFixed")),
68 bmax_(
pset.getParameter<double>(
"bMax")),
69 bmin_(
pset.getParameter<double>(
"bMin")),
70 cflag_(
pset.getParameter<
int>(
"cFlag")),
71 embedding_(
pset.getParameter<
bool>(
"embeddingMode")),
72 comenergy(
pset.getParameter<double>(
"comEnergy")),
73 doradiativeenloss_(
pset.getParameter<
bool>(
"doRadiativeEnLoss")),
74 docollisionalenloss_(
pset.getParameter<
bool>(
"doCollisionalEnLoss")),
75 fracsoftmult_(
pset.getParameter<double>(
"fracSoftMultiplicity")),
76 hadfreeztemp_(
pset.getParameter<double>(
"hadronFreezoutTemperature")),
77 hymode_(
pset.getParameter<
string>(
"hydjetMode")),
78 maxEventsToPrint_(
pset.getUntrackedParameter<
int>(
"maxEventsToPrint", 1)),
79 maxlongy_(
pset.getParameter<double>(
"maxLongitudinalRapidity")),
80 maxtrany_(
pset.getParameter<double>(
"maxTransverseRapidity")),
83 nmultiplicity_(
pset.getParameter<
int>(
"nMultiplicity")),
85 nquarkflavor_(
pset.getParameter<
int>(
"qgpNumQuarkFlavor")),
86 pythiaPylistVerbosity_(
pset.getUntrackedParameter<
int>(
"pythiaPylistVerbosity", 0)),
87 qgpt0_(
pset.getParameter<double>(
"qgpInitialTemperature")),
88 qgptau0_(
pset.getParameter<double>(
"qgpProperTimeFormation")),
92 rotate_(
pset.getParameter<
bool>(
"rotateEventPlane")),
93 shadowingswitch_(
pset.getParameter<
int>(
"shadowingSwitch")),
94 signn_(
pset.getParameter<double>(
"sigmaInelNN")),
99 if (
pset.exists(
"signalVtx"))
100 signalVtx_ =
pset.getUntrackedParameter<std::vector<double> >(
"signalVtx");
105 LogDebug(
"EventSignalVertex") <<
"Setting event signal vertex "
126 int cm = 1, va, vb, vc;
128 HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
145 int nproj = static_cast<int>(
npart / 2);
146 int ntarg = static_cast<int>(
npart - nproj);
148 HepMC::HeavyIon*
hi =
new HepMC::HeavyIon(
nsub_,
151 static_cast<int>(
hyfpar.nbcol),
163 evt->set_heavy_ion(*
hi);
184 p->suggest_barcode(barcode);
198 HepMC::GenVertex*
vertex =
new HepMC::GenVertex(HepMC::FourVector(x, y, z,
t),
id);
210 HepMC::GenVertex* genvtx =
nullptr;
213 e.getByToken(
src_, cf);
215 if (
mix.size() < 1) {
216 throw cms::Exception(
"MatchVtx") <<
"Mixing has " <<
mix.size() <<
" sub-events, should have been at least 1"
221 throw cms::Exception(
"MatchVtx") <<
"Input background does not have smeared vertex!" << endl;
226 genvtx = inev->signal_process_vertex();
229 throw cms::Exception(
"MatchVtx") <<
"Input background does not have signal process vertex!" << endl;
231 double aX, aY, aZ, aT;
233 aX = genvtx->position().x();
234 aY = genvtx->position().y();
235 aZ = genvtx->position().z();
236 aT = genvtx->position().t();
241 LogInfo(
"MatchVtx") <<
" setting vertex "
242 <<
" aX " << aX <<
" aY " << aY <<
" aZ " << aZ <<
" aT " << aT << endl;
245 const HepMC::HeavyIon*
hi = inev->heavy_ion();
249 phi0_ =
hi->event_plane_angle();
253 LogWarning(
"EventEmbedding") <<
"Background event does not have heavy ion record!";
265 edm::LogInfo(
"HYDJETinTemp") <<
"##### HYDJET: QGP init temperature, T0 =" <<
pyqpar.T0u;
266 edm::LogInfo(
"HYDJETinTau") <<
"##### HYDJET: QGP formation time,tau0 =" <<
pyqpar.tau0u;
271 edm::LogError(
"HydjetEmptyEvent") <<
"##### HYDJET: No Particles generated, Number of tries =" << ntry;
276 std::ostringstream sstr;
277 sstr <<
"HydjetHadronizerProducer: No particles generated after " << ntry <<
" tries.\n";
298 evt->set_signal_process_id(
pypars.msti[0]);
312 HepMC::HEPEVT_Wrapper::check_hepevt_consistency();
313 LogDebug(
"HEPEVT_info") <<
"Ev numb: " << HepMC::HEPEVT_Wrapper::event_number()
314 <<
" Entries number: " << HepMC::HEPEVT_Wrapper::number_entries() <<
" Max. entries "
315 << HepMC::HEPEVT_Wrapper::max_number_entries() << std::endl;
342 vector<HepMC::GenParticle*> primary_particle(
hyjets.nhj);
343 vector<HepMC::GenParticle*> particle(
hyjets.nhj);
345 HepMC::GenVertex* sub_vertices =
new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, 0), 0);
350 while (ihy <
hyjets.nhj) {
351 isub = std::floor((
hyjets.khj[2][ihy] / 50000));
352 int hjoffset = isub * 50000;
354 if (isub != isub_l) {
355 sub_vertices =
new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, 0), isub);
356 evt->add_vertex(sub_vertices);
357 if (!
evt->signal_process_vertex())
358 evt->set_signal_process_vertex(sub_vertices);
359 index[isub] = ihy - 1;
363 if (convertStatus(
hyjets.khj[0][ihy]) == 1)
365 LogDebug(
"Hydjet_array") << ihy <<
" MULTin ev.:" <<
hyjets.nhj <<
" SubEv.#" << isub <<
" Part #" << ihy + 1
366 <<
", PDG: " <<
hyjets.khj[1][ihy] <<
" (st. " << convertStatus(
hyjets.khj[0][ihy])
367 <<
") mother=" <<
hyjets.khj[2][ihy] - (isub * 50000) +
index[isub] + 1 <<
" ("
368 <<
hyjets.khj[2][ihy] <<
"), childs ("
369 <<
hyjets.khj[3][ihy] - (isub * 50000) +
index[isub] + 1 <<
"-"
370 <<
hyjets.khj[4][ihy] - (isub * 50000) +
index[isub] + 1 <<
"), vtx ("
371 <<
hyjets.vhj[0][ihy] <<
"," <<
hyjets.vhj[1][ihy] <<
"," <<
hyjets.vhj[2][ihy] <<
") "
374 if (
hyjets.khj[2][ihy] == 0) {
376 sub_vertices->add_particle_out(primary_particle[ihy]);
377 LogDebug(
"Hydjet_array") <<
" ---> " << ihy + 1 << std::endl;
380 int mid =
hyjets.khj[2][ihy] - hjoffset +
index[isub];
382 while ((mid < ihy) && (
hyjets.khj[1][mid] < 100) && (
hyjets.khj[3][mid + 1] - hjoffset +
index[isub] == ihy))
384 if (
hyjets.khj[1][mid] < 100)
391 mother = particle[mid];
392 primary_particle[mid] = mother;
395 HepMC::GenVertex* prod_vertex = mother->end_vertex();
398 prod_vertex->add_particle_in(mother);
399 LogDebug(
"Hydjet_array") <<
" <--- " << mid + 1 << std::endl;
400 evt->add_vertex(prod_vertex);
404 prod_vertex->add_particle_out(particle[ihy]);
405 LogDebug(
"Hydjet_array") <<
" ---" << mid + 1 <<
"---> " << ihy + 1 << std::endl;
412 LogDebug(
"Hydjet_array") <<
" MULTin ev.:" <<
hyjets.nhj <<
", last index: " << ihy - 1
413 <<
", Sub events: " << isub + 1 <<
", stable particles: " << stab << std::endl;
440 else if (
hymode_ ==
"kHydroJets")
442 else if (
hymode_ ==
"kHydroQJets")
444 else if (
hymode_ ==
"kJetsOnly")
446 else if (
hymode_ ==
"kQJetsOnly")
483 edm::LogInfo(
"HydjetEnLoss") <<
"##### Radiative AND Collisional partonic energy loss ON ####";
486 edm::LogInfo(
"HydjetenLoss") <<
"##### Only RADIATIVE partonic energy loss ON ####";
489 edm::LogInfo(
"HydjetEnLoss") <<
"##### Only COLLISIONAL partonic energy loss ON ####";
492 edm::LogInfo(
"HydjetEnLoss") <<
"##### Radiative AND Collisional partonic energy loss ON ####";
515 LogInfo(
"RAScaling") <<
"Nuclear radius(RA) = " << ra;
530 std::vector<int>
pdg = _pdg;
531 for (
size_t i = 0;
i <
pdg.size();
i++) {
533 std::ostringstream pyCard;
534 pyCard <<
"MDCY(" << pyCode <<
",1)=0";
543 const double pi = 3.14159265358979;