20 #include "HepMC/IO_HEPEVT.h"
21 #include "HepMC/PythiaWrapper.h"
35 abeamtarget_(pset.getParameter<double>(
"aBeamTarget")),
36 angularspecselector_(pset.getParameter<int>(
"angularSpectrumSelector")),
37 bmin_(pset.getParameter<double>(
"bMin")),
38 bmax_(pset.getParameter<double>(
"bMax")),
39 bfixed_(pset.getParameter<double>(
"bFixed")),
40 cflag_(pset.getParameter<int>(
"cFlag")),
41 comenergy(pset.getParameter<double>(
"comEnergy")),
42 doquench_(pset.getParameter<bool>(
"doQuench")),
43 doradiativeenloss_(pset.getParameter<bool>(
"doRadiativeEnLoss")),
44 docollisionalenloss_(pset.getParameter<bool>(
"doCollisionalEnLoss")),
45 doIsospin_(pset.getParameter<bool>(
"doIsospin")),
46 protonSide_(pset.getUntrackedParameter<int>(
"protonSide", 0)),
47 embedding_(pset.getParameter<bool>(
"embeddingMode")),
49 nquarkflavor_(pset.getParameter<int>(
"qgpNumQuarkFlavor")),
50 qgpt0_(pset.getParameter<double>(
"qgpInitialTemperature")),
51 qgptau0_(pset.getParameter<double>(
"qgpProperTimeFormation")),
52 maxEventsToPrint_(pset.getUntrackedParameter<int>(
"maxEventsToPrint", 1)),
54 pythiaHepMCVerbosity_(pset.getUntrackedParameter<bool>(
"pythiaHepMCVerbosity",
false)),
55 pythiaPylistVerbosity_(pset.getUntrackedParameter<int>(
"pythiaPylistVerbosity", 0)),
57 filterType_(pset.getUntrackedParameter<
string>(
"filterType",
"None")) {
58 if (pset.
exists(
"signalVtx"))
64 LogDebug(
"EventSignalVertex") <<
"Setting event signal vertex "
88 int cm = 1, va, vb, vc;
106 HepMC::HeavyIon* hi =
new HepMC::HeavyIon(1,
121 evt->set_heavy_ion(*hi);
136 HepMC::GenVertex* genvtx =
nullptr;
141 if (
mix.size() < 1) {
142 throw cms::Exception(
"MatchVtx") <<
"Mixing has " <<
mix.size() <<
" sub-events, should have been at least 1"
147 throw cms::Exception(
"MatchVtx") <<
"Input background does not have smeared vertex!" << endl;
152 genvtx = inev->signal_process_vertex();
155 throw cms::Exception(
"MatchVtx") <<
"Input background does not have signal process vertex!" << endl;
157 double aX, aY, aZ, aT;
159 aX = genvtx->position().x();
160 aY = genvtx->position().y();
161 aZ = genvtx->position().z();
162 aT = genvtx->position().t();
170 <<
" aX " << aX <<
" aY " << aY <<
" aZ " << aZ <<
" aT " << aT << endl;
173 const HepMC::HeavyIon* hi = inev->heavy_ion();
176 bfixed_ = hi->impact_parameter();
179 LogWarning(
"EventEmbedding") <<
"Background event does not have heavy ion record!";
194 call_pyinit(
"CMS", projN.data(), targN.data(),
comenergy);
205 edm::LogInfo(
"PYQUENinAction") <<
"##### Calling PYQUEN: QUENCHING OFF!! This is just PYTHIA !!!! ####";
218 evt->set_signal_process_id(
pypars.msti[0]);
219 evt->set_event_scale(
pypars.pari[16]);
270 string sHadOff(
"MSTP(111)=0");
285 edm::LogInfo(
"PYQUENinEnLoss") <<
"##### PYQUEN: Radiative AND Collisional partonic energy loss ON ####";
288 edm::LogInfo(
"PYQUENinRad") <<
"##### PYQUEN: Only RADIATIVE partonic energy loss ON ####";
291 edm::LogInfo(
"PYQUENinColl") <<
"##### PYQUEN: Only COLLISIONAL partonic energy loss ON ####";
294 edm::LogInfo(
"PYQUENinEnLoss") <<
"##### PYQUEN: Radiative AND Collisional partonic energy loss ON ####";
309 int* dummy =
nullptr;
311 const char* nuc =
nullptr;
321 double sinphi0 =
sin(angle);
322 double cosphi0 =
cos(angle);
325 double x0 = (*vt)->position().x();
326 double y0 = (*vt)->position().y();
327 double z = (*vt)->position().z();
328 double t = (*vt)->position().t();
330 double x = x0 * cosphi0 - y0 * sinphi0;
331 double y = y0 * cosphi0 + x0 * sinphi0;
333 (*vt)->set_position(HepMC::FourVector(x, y, z, t));
336 for (HepMC::GenEvent::particle_iterator vt = evt->particles_begin(); vt != evt->particles_end(); ++vt) {
337 double x0 = (*vt)->momentum().x();
338 double y0 = (*vt)->momentum().y();
339 double z = (*vt)->momentum().z();
340 double t = (*vt)->momentum().t();
342 double x = x0 * cosphi0 - y0 * sinphi0;
343 double y = y0 * cosphi0 + x0 * sinphi0;
345 (*vt)->set_momentum(HepMC::FourVector(x, y, z, t));
350 std::vector<int> pdg = _pdg;
351 for (
size_t i = 0;
i < pdg.size();
i++) {
353 std::ostringstream pyCard;
354 pyCard <<
"MDCY(" << pyCode <<
",1)=0";
T getUntrackedParameter(std::string const &, T const &) const
unsigned int maxEventsToPrint_
Events to print if verbosity.
bool pyquen_init(const edm::ParameterSet &pset)
bool declareStableParticles(const std::vector< int > &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Sin< T >::type sin(const T &t)
bool call_pygive(const std::string &line)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
bool doradiativeenloss_
DEFAULT = true.
bool docollisionalenloss_
DEFAULT = true.
void rotateEvtPlane(HepMC::GenEvent *evt, double angle)
bool initializeForInternalPartons()
double bmax_
max impact param (fm); valid only if cflag_!=0
double abeamtarget_
beam/target atomic mass number
static const std::string kPythia6
int cflag_
centrality flag =0 fixed impact param, <>0 minbias
unsigned int pythiaPylistVerbosity_
Pythia PYLIST Verbosity flag.
bool doIsospin_
Run n&p with proper ratios; if false, only p+p collisions.
static BaseHiGenEvtSelector * get(std::string, const edm::ParameterSet &)
unsigned int angularspecselector_
bool generatePartonsAndHadronize()
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< CrossingFrame< edm::HepMCProduct > > src_
HepMC::FourVector * fVertex_
Event signal vertex.
void add_heavy_ion_rec(HepMC::GenEvent *evt)
Pythia6Service * pythia6Service_
std::unique_ptr< HepMC::GenEvent > & event()
PyquenHadronizer(const edm::ParameterSet &, edm::ConsumesCollector &&)
Log< level::Info, false > LogInfo
static const std::string kFortranInstance
const HepMC::GenEvent * GetEvent() const
T const * product() const
bool pyqpythia_init(const edm::ParameterSet &pset)
unsigned int nquarkflavor_
bool doquench_
if true perform quenching (default = true)
bool isVtxGenApplied() const
const char * classname() const
std::vector< double > signalVtx_
Pset double vector to set event signal vertex.
double comenergy
collision energy
bool pythiaHepMCVerbosity_
HepMC verbosity flag.
void setRandomEngine(CLHEP::HepRandomEngine *v)
static const std::vector< std::string > theSharedResources
BaseHiGenEvtSelector * selector_
double bmin_
min impact param (fm); valid only if cflag_!=0
VertexRefVector::iterator vertex_iterator
iterator over a vector of references to Vertex objects in the same collection
double bfixed_
fixed impact param (fm); valid only if cflag_=0
Log< level::Warning, false > LogWarning
void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
double pfrac_
Proton fraction in the nucleus.
Power< A, B >::type pow(const A &a, const B &b)
edm::Event & getEDMEvent() const
HepMC::IO_HEPEVT pyquen_hepevtio
~PyquenHadronizer() override
T angle(T x1, T y1, T z1, T x2, T y2, T z2)