23 #include "HepMC/IO_HEPEVT.h" 24 #include "HepMC/PythiaWrapper6_4.h" 25 #include "HepMC/GenEvent.h" 26 #include "HepMC/HeavyIon.h" 27 #include "HepMC/SimpleVector.h" 38 int HydjetHadronizer::convertStatus(
int st) {
59 abeamtarget_(
pset.getParameter<double>(
"aBeamTarget")),
60 angularspecselector_(
pset.getParameter<
int>(
"angularSpectrumSelector")),
61 bfixed_(
pset.getParameter<double>(
"bFixed")),
62 bmax_(
pset.getParameter<double>(
"bMax")),
63 bmin_(
pset.getParameter<double>(
"bMin")),
64 cflag_(
pset.getParameter<
int>(
"cFlag")),
65 embedding_(
pset.getParameter<
int>(
"embeddingMode")),
66 comenergy(
pset.getParameter<double>(
"comEnergy")),
67 doradiativeenloss_(
pset.getParameter<
bool>(
"doRadiativeEnLoss")),
68 docollisionalenloss_(
pset.getParameter<
bool>(
"doCollisionalEnLoss")),
69 fracsoftmult_(
pset.getParameter<double>(
"fracSoftMultiplicity")),
70 hadfreeztemp_(
pset.getParameter<double>(
"hadronFreezoutTemperature")),
71 hymode_(
pset.getParameter<
string>(
"hydjetMode")),
72 maxEventsToPrint_(
pset.getUntrackedParameter<
int>(
"maxEventsToPrint", 1)),
73 maxlongy_(
pset.getParameter<double>(
"maxLongitudinalRapidity")),
74 maxtrany_(
pset.getParameter<double>(
"maxTransverseRapidity")),
77 nmultiplicity_(
pset.getParameter<
int>(
"nMultiplicity")),
79 nquarkflavor_(
pset.getParameter<
int>(
"qgpNumQuarkFlavor")),
80 pythiaPylistVerbosity_(
pset.getUntrackedParameter<
int>(
"pythiaPylistVerbosity", 0)),
81 qgpt0_(
pset.getParameter<double>(
"qgpInitialTemperature")),
82 qgptau0_(
pset.getParameter<double>(
"qgpProperTimeFormation")),
86 rotate_(
pset.getParameter<
bool>(
"rotateEventPlane")),
87 shadowingswitch_(
pset.getParameter<
int>(
"shadowingSwitch")),
88 signn_(
pset.getParameter<double>(
"sigmaInelNN")),
93 if (
pset.exists(
"signalVtx"))
94 signalVtx_ =
pset.getUntrackedParameter<std::vector<double> >(
"signalVtx");
99 LogDebug(
"EventSignalVertex") <<
"Setting event signal vertex " 120 int cm = 1, va, vb, vc;
122 HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
139 int nproj =
static_cast<int>(
npart / 2);
140 int ntarg =
static_cast<int>(
npart - nproj);
142 HepMC::HeavyIon*
hi =
new HepMC::HeavyIon(
nsub_,
145 static_cast<int>(
hyfpar.nbcol),
157 evt->set_heavy_ion(*
hi);
178 p->suggest_barcode(barcode);
192 HepMC::GenVertex*
vertex =
new HepMC::GenVertex(HepMC::FourVector(
x, y, z,
t),
id);
204 HepMC::GenVertex* genvtx =
nullptr;
207 e.getByToken(
src_, cf);
209 if (
mix.size() < 1) {
210 throw cms::Exception(
"MatchVtx") <<
"Mixing has " <<
mix.size() <<
" sub-events, should have been at least 1" 215 throw cms::Exception(
"MatchVtx") <<
"Input background does not have smeared vertex!" << endl;
220 genvtx = inev->signal_process_vertex();
223 throw cms::Exception(
"MatchVtx") <<
"Input background does not have signal process vertex!" << endl;
225 double aX, aY, aZ, aT;
227 aX = genvtx->position().x();
228 aY = genvtx->position().y();
229 aZ = genvtx->position().z();
230 aT = genvtx->position().t();
235 LogInfo(
"MatchVtx") <<
" setting vertex " 236 <<
" aX " << aX <<
" aY " << aY <<
" aZ " << aZ <<
" aT " << aT << endl;
239 const HepMC::HeavyIon*
hi = inev->heavy_ion();
243 phi0_ =
hi->event_plane_angle();
247 LogWarning(
"EventEmbedding") <<
"Background event does not have heavy ion record!";
259 edm::LogInfo(
"HYDJETinTemp") <<
"##### HYDJET: QGP init temperature, T0 =" <<
pyqpar.T0u;
260 edm::LogInfo(
"HYDJETinTau") <<
"##### HYDJET: QGP formation time,tau0 =" <<
pyqpar.tau0u;
265 edm::LogError(
"HydjetEmptyEvent") <<
"##### HYDJET: No Particles generated, Number of tries =" << ntry;
270 std::ostringstream sstr;
271 sstr <<
"HydjetHadronizerProducer: No particles generated after " << ntry <<
" tries.\n";
287 std::unique_ptr<HepMC::GenEvent>
evt = std::make_unique<HepMC::GenEvent>();
288 std::unique_ptr<edm::HepMCProduct> HepMCEvt = std::make_unique<edm::HepMCProduct>();
293 evt->set_signal_process_id(
pypars.msti[0]);
300 HepMCEvt = std::make_unique<edm::HepMCProduct>(
evt.get());
302 evt = std::make_unique<HepMC::GenEvent>(*HepMCEvt->GetEvent());
305 HepMC::HEPEVT_Wrapper::check_hepevt_consistency();
306 LogDebug(
"HEPEVT_info") <<
"Ev numb: " << HepMC::HEPEVT_Wrapper::event_number()
307 <<
" Entries number: " << HepMC::HEPEVT_Wrapper::number_entries() <<
" Max. entries " 308 << HepMC::HEPEVT_Wrapper::max_number_entries() << std::endl;
335 vector<HepMC::GenParticle*> primary_particle(
hyjets.nhj);
336 vector<HepMC::GenParticle*> particle(
hyjets.nhj);
338 HepMC::GenVertex* sub_vertices =
nullptr;
343 while (ihy <
hyjets.nhj) {
345 isub = std::floor((
hyjets.khj[2][ihy] / kMaxMultiplicity));
346 int hjoffset = isub * kMaxMultiplicity;
348 if (isub != isub_l) {
349 sub_vertices =
new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, 0), isub);
350 evt->add_vertex(sub_vertices);
351 if (!
evt->signal_process_vertex())
352 evt->set_signal_process_vertex(sub_vertices);
353 if (isub >= static_cast<int>(
index.size())) {
354 index.resize(isub + 1);
356 index[isub] = ihy - 1;
362 LogDebug(
"Hydjet_array") << ihy <<
" MULTin ev.:" <<
hyjets.nhj <<
" SubEv.#" << isub <<
" Part #" << ihy + 1
364 <<
") mother=" <<
hyjets.khj[2][ihy] - (isub * kMaxMultiplicity) +
index[isub] + 1 <<
" (" 365 <<
hyjets.khj[2][ihy] <<
"), childs (" 366 <<
hyjets.khj[3][ihy] - (isub * kMaxMultiplicity) +
index[isub] + 1 <<
"-" 367 <<
hyjets.khj[4][ihy] - (isub * kMaxMultiplicity) +
index[isub] + 1 <<
"), vtx (" 368 <<
hyjets.vhj[0][ihy] <<
"," <<
hyjets.vhj[1][ihy] <<
"," <<
hyjets.vhj[2][ihy] <<
") " 374 LogError(
"Hydjet_array") <<
"##### HYDJET2: Vertex not initialized!";
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 throw cms::Exception(
"BadHydjetParent") <<
"Parent ID " << mid <<
" is greater than child id " << ihy
383 <<
" this is not allowed.\n When this happened in the past it was " 384 "caused the sub event multiplicity being > " 385 << kMaxMultiplicity <<
" which caused an offset overflow.";
388 while (((mid + 1) < ihy) && (
std::abs(
hyjets.khj[1][mid]) < 100) &&
389 (
hyjets.khj[3][mid + 1] - hjoffset +
index[isub] <= ihy))
398 mother = particle[mid];
399 primary_particle[mid] = mother;
402 HepMC::GenVertex* prod_vertex = mother->end_vertex();
405 prod_vertex->add_particle_in(mother);
406 LogDebug(
"Hydjet_array") <<
" <--- " << mid + 1 << std::endl;
407 evt->add_vertex(prod_vertex);
411 prod_vertex->add_particle_out(particle[ihy]);
412 LogDebug(
"Hydjet_array") <<
" ---" << mid + 1 <<
"---> " << ihy + 1 << std::endl;
417 LogDebug(
"Hydjet_array") <<
" MULTin ev.:" <<
hyjets.nhj <<
", last index: " << ihy - 1
418 <<
", Sub events: " << isub + 1 <<
", stable particles: " << stab << std::endl;
445 else if (
hymode_ ==
"kHydroJets")
447 else if (
hymode_ ==
"kHydroQJets")
449 else if (
hymode_ ==
"kJetsOnly")
451 else if (
hymode_ ==
"kQJetsOnly")
488 edm::LogInfo(
"HydjetEnLoss") <<
"##### Radiative AND Collisional partonic energy loss ON ####";
491 edm::LogInfo(
"HydjetenLoss") <<
"##### Only RADIATIVE partonic energy loss ON ####";
494 edm::LogInfo(
"HydjetEnLoss") <<
"##### Only COLLISIONAL partonic energy loss ON ####";
497 edm::LogInfo(
"HydjetEnLoss") <<
"##### Radiative AND Collisional partonic energy loss ON ####";
520 LogInfo(
"RAScaling") <<
"Nuclear radius(RA) = " << ra;
535 std::vector<int>
pdg = _pdg;
536 for (
size_t i = 0;
i <
pdg.size();
i++) {
538 std::ostringstream pyCard;
539 pyCard <<
"MDCY(" << pyCode <<
",1)=0";
548 const double pi = 3.14159265358979;
double bfixed_
fixed impact param (fm); valid only if cflag_=0
void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
bool docollisionalenloss_
DEFAULT = true.
bool isVtxGenApplied() const
bool hydjet_init(const edm::ParameterSet &pset)
Sin< T >::type sin(const T &t)
T const * product() const
bool call_pygive(const std::string &line)
void add_heavy_ion_rec(HepMC::GenEvent *evt)
Log< level::Error, false > LogError
double comenergy
collision energy
double nuclear_radius() const
static const std::string kPythia6
bool generatePartonsAndHadronize()
bool embedding_
Switch for embedding mode.
edm::Event & getEDMEvent() const
std::string hymode_
Hydjet running mode.
int nsoft_
multiplicity of HYDRO-induced particles in event
int convertStatus(int st)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
const char * classname() const
unsigned int maxEventsToPrint_
Events to print if verbosity.
std::unique_ptr< HepMC::GenEvent > & event()
HepMC::GenParticle * build_hyjet(int index, int barcode)
const HepMC::GenEvent * GetEvent() const
Pythia6Service * pythia6Service_
~HydjetHadronizer() override
int nsub_
number of sub-events
std::vector< double > signalVtx_
Pset double vector to set event signal vertex.
Log< level::Info, false > LogInfo
static const std::string kFortranInstance
int nhard_
multiplicity of PYTHIA(+PYQUEN)-induced particles in event
HepMC::GenVertex * build_hyjet_vertex(int i, int id)
bool call_hyinit(double energy, double a, int ifb, double bmin, double bmax, double bfix, int nh)
unsigned int pythiaPylistVerbosity_
pythia verbosity; def=1
void setRandomEngine(CLHEP::HepRandomEngine *v)
double abeamtarget_
beam/target atomic mass number
bool initializeForInternalPartons()
edm::EDGetTokenT< CrossingFrame< edm::HepMCProduct > > src_
unsigned int shadowingswitch_
bool doradiativeenloss_
DEFAULT = true.
unsigned int nquarkflavor_
int angularspecselector_
angular emitted gluon spectrum selection
Log< level::Warning, false > LogWarning
bool declareStableParticles(const std::vector< int > &)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
bool rotate_
Switch to rotate event plane.
double phi0_
Event plane angle.
HepMC::FourVector * fVertex_
Event signal vertex.
bool get_particles(HepMC::GenEvent *evt)