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) {
344 isub = std::floor((
hyjets.khj[2][ihy] / 50000));
345 int hjoffset = isub * 50000;
347 if (isub != isub_l) {
348 sub_vertices =
new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, 0), isub);
349 evt->add_vertex(sub_vertices);
350 if (!
evt->signal_process_vertex())
351 evt->set_signal_process_vertex(sub_vertices);
352 index[isub] = ihy - 1;
358 LogDebug(
"Hydjet_array") << ihy <<
" MULTin ev.:" <<
hyjets.nhj <<
" SubEv.#" << isub <<
" Part #" << ihy + 1
360 <<
") mother=" <<
hyjets.khj[2][ihy] - (isub * 50000) +
index[isub] + 1 <<
" (" 361 <<
hyjets.khj[2][ihy] <<
"), childs (" 362 <<
hyjets.khj[3][ihy] - (isub * 50000) +
index[isub] + 1 <<
"-" 363 <<
hyjets.khj[4][ihy] - (isub * 50000) +
index[isub] + 1 <<
"), vtx (" 364 <<
hyjets.vhj[0][ihy] <<
"," <<
hyjets.vhj[1][ihy] <<
"," <<
hyjets.vhj[2][ihy] <<
") " 370 LogError(
"Hydjet_array") <<
"##### HYDJET2: Vertex not initialized!";
372 sub_vertices->add_particle_out(primary_particle[ihy]);
373 LogDebug(
"Hydjet_array") <<
" ---> " << ihy + 1 << std::endl;
376 int mid =
hyjets.khj[2][ihy] - hjoffset +
index[isub];
378 while (((mid + 1) < ihy) && (
std::abs(
hyjets.khj[1][mid]) < 100) &&
379 (
hyjets.khj[3][mid + 1] - hjoffset +
index[isub] <= ihy))
388 mother = particle[mid];
389 primary_particle[mid] = mother;
392 HepMC::GenVertex* prod_vertex = mother->end_vertex();
395 prod_vertex->add_particle_in(mother);
396 LogDebug(
"Hydjet_array") <<
" <--- " << mid + 1 << std::endl;
397 evt->add_vertex(prod_vertex);
401 prod_vertex->add_particle_out(particle[ihy]);
402 LogDebug(
"Hydjet_array") <<
" ---" << mid + 1 <<
"---> " << ihy + 1 << std::endl;
407 LogDebug(
"Hydjet_array") <<
" MULTin ev.:" <<
hyjets.nhj <<
", last index: " << ihy - 1
408 <<
", Sub events: " << isub + 1 <<
", stable particles: " << stab << std::endl;
435 else if (
hymode_ ==
"kHydroJets")
437 else if (
hymode_ ==
"kHydroQJets")
439 else if (
hymode_ ==
"kJetsOnly")
441 else if (
hymode_ ==
"kQJetsOnly")
478 edm::LogInfo(
"HydjetEnLoss") <<
"##### Radiative AND Collisional partonic energy loss ON ####";
481 edm::LogInfo(
"HydjetenLoss") <<
"##### Only RADIATIVE partonic energy loss ON ####";
484 edm::LogInfo(
"HydjetEnLoss") <<
"##### Only COLLISIONAL partonic energy loss ON ####";
487 edm::LogInfo(
"HydjetEnLoss") <<
"##### Radiative AND Collisional partonic energy loss ON ####";
510 LogInfo(
"RAScaling") <<
"Nuclear radius(RA) = " << ra;
525 std::vector<int>
pdg = _pdg;
526 for (
size_t i = 0;
i <
pdg.size();
i++) {
528 std::ostringstream pyCard;
529 pyCard <<
"MDCY(" << pyCode <<
",1)=0";
538 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 > &)
bool rotate_
Switch to rotate event plane.
double phi0_
Event plane angle.
HepMC::FourVector * fVertex_
Event signal vertex.
bool get_particles(HepMC::GenEvent *evt)