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"
41 int convertStatus(
int st) {
63 abeamtarget_(
pset.getParameter<double>(
"aBeamTarget")),
64 angularspecselector_(
pset.getParameter<
int>(
"angularSpectrumSelector")),
65 bfixed_(
pset.getParameter<double>(
"bFixed")),
66 bmax_(
pset.getParameter<double>(
"bMax")),
67 bmin_(
pset.getParameter<double>(
"bMin")),
68 cflag_(
pset.getParameter<
int>(
"cFlag")),
69 embedding_(
pset.getParameter<
bool>(
"embeddingMode")),
70 comenergy(
pset.getParameter<double>(
"comEnergy")),
71 doradiativeenloss_(
pset.getParameter<
bool>(
"doRadiativeEnLoss")),
72 docollisionalenloss_(
pset.getParameter<
bool>(
"doCollisionalEnLoss")),
73 fracsoftmult_(
pset.getParameter<double>(
"fracSoftMultiplicity")),
74 hadfreeztemp_(
pset.getParameter<double>(
"hadronFreezoutTemperature")),
75 hymode_(
pset.getParameter<
string>(
"hydjetMode")),
76 maxEventsToPrint_(
pset.getUntrackedParameter<
int>(
"maxEventsToPrint", 1)),
77 maxlongy_(
pset.getParameter<double>(
"maxLongitudinalRapidity")),
78 maxtrany_(
pset.getParameter<double>(
"maxTransverseRapidity")),
81 nmultiplicity_(
pset.getParameter<
int>(
"nMultiplicity")),
83 nquarkflavor_(
pset.getParameter<
int>(
"qgpNumQuarkFlavor")),
84 pythiaPylistVerbosity_(
pset.getUntrackedParameter<
int>(
"pythiaPylistVerbosity", 0)),
85 qgpt0_(
pset.getParameter<double>(
"qgpInitialTemperature")),
86 qgptau0_(
pset.getParameter<double>(
"qgpProperTimeFormation")),
90 rotate_(
pset.getParameter<
bool>(
"rotateEventPlane")),
91 shadowingswitch_(
pset.getParameter<
int>(
"shadowingSwitch")),
92 signn_(
pset.getParameter<double>(
"sigmaInelNN")),
97 if (
pset.exists(
"signalVtx"))
98 signalVtx_ =
pset.getUntrackedParameter<std::vector<double> >(
"signalVtx");
103 LogDebug(
"EventSignalVertex") <<
"Setting event signal vertex "
124 int cm = 1, va, vb, vc;
126 HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
143 int nproj = static_cast<int>(
npart / 2);
144 int ntarg = static_cast<int>(
npart - nproj);
146 HepMC::HeavyIon*
hi =
new HepMC::HeavyIon(
nsub_,
149 static_cast<int>(
hyfpar.nbcol),
161 evt->set_heavy_ion(*
hi);
182 p->suggest_barcode(barcode);
196 HepMC::GenVertex*
vertex =
new HepMC::GenVertex(HepMC::FourVector(x, y, z,
t),
id);
208 HepMC::GenVertex* genvtx =
nullptr;
211 e.getByToken(
src_, cf);
213 if (
mix.size() < 1) {
214 throw cms::Exception(
"MatchVtx") <<
"Mixing has " <<
mix.size() <<
" sub-events, should have been at least 1"
219 throw cms::Exception(
"MatchVtx") <<
"Input background does not have smeared vertex!" << endl;
224 genvtx = inev->signal_process_vertex();
227 throw cms::Exception(
"MatchVtx") <<
"Input background does not have signal process vertex!" << endl;
229 double aX, aY, aZ, aT;
231 aX = genvtx->position().x();
232 aY = genvtx->position().y();
233 aZ = genvtx->position().z();
234 aT = genvtx->position().t();
239 LogInfo(
"MatchVtx") <<
" setting vertex "
240 <<
" aX " << aX <<
" aY " << aY <<
" aZ " << aZ <<
" aT " << aT << endl;
243 const HepMC::HeavyIon*
hi = inev->heavy_ion();
247 phi0_ =
hi->event_plane_angle();
251 LogWarning(
"EventEmbedding") <<
"Background event does not have heavy ion record!";
263 edm::LogInfo(
"HYDJETinTemp") <<
"##### HYDJET: QGP init temperature, T0 =" <<
pyqpar.T0u;
264 edm::LogInfo(
"HYDJETinTau") <<
"##### HYDJET: QGP formation time,tau0 =" <<
pyqpar.tau0u;
269 edm::LogError(
"HydjetEmptyEvent") <<
"##### HYDJET: No Particles generated, Number of tries =" << ntry;
274 std::ostringstream sstr;
275 sstr <<
"HydjetHadronizerProducer: No particles generated after " << ntry <<
" tries.\n";
296 evt->set_signal_process_id(
pypars.msti[0]);
310 HepMC::HEPEVT_Wrapper::check_hepevt_consistency();
311 LogDebug(
"HEPEVT_info") <<
"Ev numb: " << HepMC::HEPEVT_Wrapper::event_number()
312 <<
" Entries number: " << HepMC::HEPEVT_Wrapper::number_entries() <<
" Max. entries "
313 << HepMC::HEPEVT_Wrapper::max_number_entries() << std::endl;
340 vector<HepMC::GenParticle*> primary_particle(
hyjets.nhj);
341 vector<HepMC::GenParticle*> particle(
hyjets.nhj);
343 HepMC::GenVertex* sub_vertices =
new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, 0), 0);
348 while (ihy <
hyjets.nhj) {
349 isub = std::floor((
hyjets.khj[2][ihy] / 50000));
350 int hjoffset = isub * 50000;
352 if (isub != isub_l) {
353 sub_vertices =
new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, 0), isub);
354 evt->add_vertex(sub_vertices);
355 if (!
evt->signal_process_vertex())
356 evt->set_signal_process_vertex(sub_vertices);
357 index[isub] = ihy - 1;
361 if (convertStatus(
hyjets.khj[0][ihy]) == 1)
363 LogDebug(
"Hydjet_array") << ihy <<
" MULTin ev.:" <<
hyjets.nhj <<
" SubEv.#" << isub <<
" Part #" << ihy + 1
364 <<
", PDG: " <<
hyjets.khj[1][ihy] <<
" (st. " << convertStatus(
hyjets.khj[0][ihy])
365 <<
") mother=" <<
hyjets.khj[2][ihy] - (isub * 50000) +
index[isub] + 1 <<
" ("
366 <<
hyjets.khj[2][ihy] <<
"), childs ("
367 <<
hyjets.khj[3][ihy] - (isub * 50000) +
index[isub] + 1 <<
"-"
368 <<
hyjets.khj[4][ihy] - (isub * 50000) +
index[isub] + 1 <<
"), vtx ("
369 <<
hyjets.vhj[0][ihy] <<
"," <<
hyjets.vhj[1][ihy] <<
"," <<
hyjets.vhj[2][ihy] <<
") "
374 sub_vertices->add_particle_out(primary_particle[ihy]);
375 LogDebug(
"Hydjet_array") <<
" ---> " << ihy + 1 << std::endl;
378 int mid =
hyjets.khj[2][ihy] - hjoffset +
index[isub];
380 while ((mid < ihy) && (
hyjets.khj[1][mid] < 100) && (
hyjets.khj[3][mid + 1] - hjoffset +
index[isub] == ihy))
382 if (
hyjets.khj[1][mid] < 100)
389 mother = particle[mid];
390 primary_particle[mid] = mother;
393 HepMC::GenVertex* prod_vertex = mother->end_vertex();
396 prod_vertex->add_particle_in(mother);
397 LogDebug(
"Hydjet_array") <<
" <--- " << mid + 1 << std::endl;
398 evt->add_vertex(prod_vertex);
402 prod_vertex->add_particle_out(particle[ihy]);
403 LogDebug(
"Hydjet_array") <<
" ---" << mid + 1 <<
"---> " << ihy + 1 << std::endl;
410 LogDebug(
"Hydjet_array") <<
" MULTin ev.:" <<
hyjets.nhj <<
", last index: " << ihy - 1
411 <<
", Sub events: " << isub + 1 <<
", stable particles: " << stab << std::endl;
438 else if (
hymode_ ==
"kHydroJets")
440 else if (
hymode_ ==
"kHydroQJets")
442 else if (
hymode_ ==
"kJetsOnly")
444 else if (
hymode_ ==
"kQJetsOnly")
481 edm::LogInfo(
"HydjetEnLoss") <<
"##### Radiative AND Collisional partonic energy loss ON ####";
484 edm::LogInfo(
"HydjetenLoss") <<
"##### Only RADIATIVE partonic energy loss ON ####";
487 edm::LogInfo(
"HydjetEnLoss") <<
"##### Only COLLISIONAL partonic energy loss ON ####";
490 edm::LogInfo(
"HydjetEnLoss") <<
"##### Radiative AND Collisional partonic energy loss ON ####";
513 LogInfo(
"RAScaling") <<
"Nuclear radius(RA) = " << ra;
528 std::vector<int>
pdg = _pdg;
529 for (
size_t i = 0;
i <
pdg.size();
i++) {
531 std::ostringstream pyCard;
532 pyCard <<
"MDCY(" << pyCode <<
",1)=0";
541 const double pi = 3.14159265358979;