CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
gen::HydjetHadronizer Class Reference

#include <HydjetHadronizer.h>

Inheritance diagram for gen::HydjetHadronizer:
gen::BaseHadronizer

Public Member Functions

const char * classname () const
 
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
void finalizeEvent ()
 
bool generatePartonsAndHadronize ()
 
bool hadronize ()
 
 HydjetHadronizer (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons ()
 
bool readSettings (int)
 
bool residualDecay ()
 
void statistics ()
 
 ~HydjetHadronizer () override
 
- Public Member Functions inherited from gen::BaseHadronizer
 BaseHadronizer (edm::ParameterSet const &ps)
 
void cleanLHE ()
 
void generateLHE (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine, unsigned int ncpu)
 
edm::EventgetEDMEvent () const
 
std::unique_ptr< HepMC::GenEventgetGenEvent ()
 
std::unique_ptr< HepMC3::GenEvent > getGenEvent3 ()
 
std::unique_ptr< GenEventInfoProductgetGenEventInfo ()
 
std::unique_ptr< GenEventInfoProduct3getGenEventInfo3 ()
 
virtual std::unique_ptr< GenLumiInfoHeadergetGenLumiInfoHeader () const
 
GenRunInfoProductgetGenRunInfo ()
 
std::unique_ptr< lhef::LHEEventgetLHEEvent ()
 
const std::shared_ptr< lhef::LHERunInfo > & getLHERunInfo () const
 
unsigned int getVHepMC ()
 
const std::string & gridpackPath () const
 
int randomIndex () const
 
const std::string & randomInitConfigDescription () const
 
void randomizeIndex (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
 
void resetEvent (std::unique_ptr< HepMC::GenEvent > event)
 
void resetEvent3 (std::unique_ptr< HepMC3::GenEvent > event3)
 
void resetEventInfo (std::unique_ptr< GenEventInfoProduct > eventInfo)
 
void resetEventInfo3 (std::unique_ptr< GenEventInfoProduct3 > eventInfo)
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (std::unique_ptr< lhef::LHEEvent > event)
 
void setLHERunInfo (std::unique_ptr< lhef::LHERunInfo > runInfo)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
std::vector< std::string > const & sharedResources () const
 
virtual ~BaseHadronizer () noexcept(false)
 

Private Member Functions

void add_heavy_ion_rec (HepMC::GenEvent *evt)
 
HepMC::GenParticle * build_hyjet (int index, int barcode)
 
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)
 
int convertStatus (int st)
 
void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
std::vector< std::string > const & doSharedResources () const override
 
bool get_particles (HepMC::GenEvent *evt)
 
bool hydjet_init (const edm::ParameterSet &pset)
 
double nuclear_radius () const
 
void rotateEvtPlane ()
 

Private Attributes

double abeamtarget_
 beam/target atomic mass number More...
 
int angularspecselector_
 angular emitted gluon spectrum selection More...
 
double bfixed_
 fixed impact param (fm); valid only if cflag_=0 More...
 
double bmax_
 
double bmin_
 
int cflag_
 
double comenergy
 collision energy More...
 
double cosphi0_
 
bool docollisionalenloss_
 DEFAULT = true. More...
 
bool doradiativeenloss_
 DEFAULT = true. More...
 
bool embedding_
 Switch for embedding mode. More...
 
HepMC::GenEventevt
 
double fracsoftmult_
 
HepMC::FourVector * fVertex_
 Event signal vertex. More...
 
double hadfreeztemp_
 
std::string hymode_
 Hydjet running mode. More...
 
unsigned int maxEventsToPrint_
 Events to print if verbosity. More...
 
double maxlongy_
 
double maxtrany_
 
int nhard_
 multiplicity of PYTHIA(+PYQUEN)-induced particles in event More...
 
int nmultiplicity_
 
unsigned int nquarkflavor_
 
int nsoft_
 multiplicity of HYDRO-induced particles in event More...
 
int nsub_
 number of sub-events More...
 
double phi0_
 Event plane angle. More...
 
edm::ParameterSet pset_
 
Pythia6Servicepythia6Service_
 
unsigned int pythiaPylistVerbosity_
 pythia verbosity; def=1 More...
 
double qgpt0_
 
double qgptau0_
 
bool rotate_
 Switch to rotate event plane. More...
 
unsigned int shadowingswitch_
 
std::vector< double > signalVtx_
 Pset double vector to set event signal vertex. More...
 
double signn_
 
double sinphi0_
 
edm::EDGetTokenT< CrossingFrame< edm::HepMCProduct > > src_
 

Static Private Attributes

static const std::vector< std::string > theSharedResources
 

Additional Inherited Members

- Protected Member Functions inherited from gen::BaseHadronizer
std::unique_ptr< HepMC::GenEvent > & event ()
 
std::unique_ptr< HepMC3::GenEvent > & event3 ()
 
std::unique_ptr< GenEventInfoProduct > & eventInfo ()
 
std::unique_ptr< GenEventInfoProduct3 > & eventInfo3 ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Attributes inherited from gen::BaseHadronizer
unsigned int ivhepmc = 2
 
std::string lheFile_
 
int randomIndex_
 

Detailed Description

Definition at line 40 of file HydjetHadronizer.h.

Constructor & Destructor Documentation

◆ HydjetHadronizer()

HydjetHadronizer::HydjetHadronizer ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)

Definition at line 55 of file HydjetHadronizer.cc.

References cflag_, embedding_, fVertex_, HYJVER, ProducerED_cfi::InputTag, LogDebug, maxEventsToPrint_, muonDTDigis_cfi::pset, pythiaPylistVerbosity_, signalVtx_, and src_.

57  evt(nullptr),
58  pset_(pset),
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")),
75  nsub_(0),
76  nhard_(0),
77  nmultiplicity_(pset.getParameter<int>("nMultiplicity")),
78  nsoft_(0),
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")),
83  phi0_(0.),
84  sinphi0_(0.),
85  cosphi0_(1.),
86  rotate_(pset.getParameter<bool>("rotateEventPlane")),
87  shadowingswitch_(pset.getParameter<int>("shadowingSwitch")),
88  signn_(pset.getParameter<double>("sigmaInelNN")),
89  fVertex_(nullptr),
91  // Default constructor
92 
93  if (pset.exists("signalVtx"))
94  signalVtx_ = pset.getUntrackedParameter<std::vector<double> >("signalVtx");
95 
96  if (signalVtx_.size() == 4) {
97  if (!fVertex_)
98  fVertex_ = new HepMC::FourVector();
99  LogDebug("EventSignalVertex") << "Setting event signal vertex "
100  << " x = " << signalVtx_.at(0) << " y = " << signalVtx_.at(1)
101  << " z= " << signalVtx_.at(2) << " t = " << signalVtx_.at(3) << endl;
102  fVertex_->set(signalVtx_.at(0), signalVtx_.at(1), signalVtx_.at(2), signalVtx_.at(3));
103  }
104 
105  // PYLIST Verbosity Level
106  // Valid PYLIST arguments are: 1, 2, 3, 5, 7, 11, 12, 13
107  pythiaPylistVerbosity_ = pset.getUntrackedParameter<int>("pythiaPylistVerbosity", 0);
108  LogDebug("PYLISTverbosity") << "Pythia PYLIST verbosity level = " << pythiaPylistVerbosity_;
109 
110  //Max number of events printed on verbosity level
111  maxEventsToPrint_ = pset.getUntrackedParameter<int>("maxEventsToPrint", 0);
112  LogDebug("Events2Print") << "Number of events to be printed = " << maxEventsToPrint_;
113 
114  if (embedding_) {
115  cflag_ = 0;
117  pset.getUntrackedParameter<edm::InputTag>("backgroundLabel", edm::InputTag("mix", "generatorSmeared")));
118  }
119 
120  int cm = 1, va, vb, vc;
121  HYJVER(cm, va, vb, vc);
122  HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
123 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
double bfixed_
fixed impact param (fm); valid only if cflag_=0
HepMC::GenEvent * evt
bool docollisionalenloss_
DEFAULT = true.
BaseHadronizer(edm::ParameterSet const &ps)
#define HYJVER
Definition: HydjetWrapper.h:25
double comenergy
collision energy
bool embedding_
Switch for embedding mode.
std::string hymode_
Hydjet running mode.
int nsoft_
multiplicity of HYDRO-induced particles in event
unsigned int maxEventsToPrint_
Events to print if verbosity.
Pythia6Service * pythia6Service_
int nsub_
number of sub-events
std::vector< double > signalVtx_
Pset double vector to set event signal vertex.
int nhard_
multiplicity of PYTHIA(+PYQUEN)-induced particles in event
unsigned int pythiaPylistVerbosity_
pythia verbosity; def=1
double abeamtarget_
beam/target atomic mass number
edm::EDGetTokenT< CrossingFrame< edm::HepMCProduct > > src_
edm::ParameterSet pset_
unsigned int shadowingswitch_
bool doradiativeenloss_
DEFAULT = true.
int angularspecselector_
angular emitted gluon spectrum selection
bool rotate_
Switch to rotate event plane.
double phi0_
Event plane angle.
HepMC::FourVector * fVertex_
Event signal vertex.
#define LogDebug(id)

◆ ~HydjetHadronizer()

HydjetHadronizer::~HydjetHadronizer ( )
override

Definition at line 126 of file HydjetHadronizer.cc.

References pythia6Service_.

126  {
127  // destructor
128  call_pystat(1);
129  delete pythia6Service_;
130 }
Pythia6Service * pythia6Service_

Member Function Documentation

◆ add_heavy_ion_rec()

void HydjetHadronizer::add_heavy_ion_rec ( HepMC::GenEvent evt)
private

Definition at line 136 of file HydjetHadronizer.cc.

References evt, hyfpar, hyjpar, npart, nsub_, nuclear_radius(), and phi0_.

Referenced by generatePartonsAndHadronize().

136  {
137  // heavy ion record in the final CMSSW Event
138  double npart = hyfpar.npart;
139  int nproj = static_cast<int>(npart / 2);
140  int ntarg = static_cast<int>(npart - nproj);
141 
142  HepMC::HeavyIon* hi = new HepMC::HeavyIon(nsub_, // Ncoll_hard/N of SubEvents
143  nproj, // Npart_proj
144  ntarg, // Npart_targ
145  static_cast<int>(hyfpar.nbcol), // Ncoll
146  0, // spectator_neutrons
147  0, // spectator_protons
148  0, // N_Nwounded_collisions
149  0, // Nwounded_N_collisions
150  0, // Nwounded_Nwounded_collisions
151  hyfpar.bgen * nuclear_radius(), // impact_parameter in [fm]
152  phi0_, // event_plane_angle
153  0, //hypsi3.psi3, // eccentricity
154  hyjpar.sigin // sigma_inel_NN
155  );
156 
157  evt->set_heavy_ion(*hi);
158  delete hi;
159 }
HepMC::GenEvent * evt
double npart
Definition: HydjetWrapper.h:48
#define hyfpar
Definition: HydjetWrapper.h:53
double nuclear_radius() const
Definition: EPCuts.h:4
#define hyjpar
Definition: HydjetWrapper.h:95
int nsub_
number of sub-events
double phi0_
Event plane angle.

◆ build_hyjet()

HepMC::GenParticle * HydjetHadronizer::build_hyjet ( int  index,
int  barcode 
)
private

Definition at line 162 of file HydjetHadronizer.cc.

References convertStatus(), cosphi0_, GenParticle::GenParticle, hyjets, gen::p, sinphi0_, and x.

Referenced by get_particles().

162  {
163  // Build particle object corresponding to index in hyjets (soft+hard)
164  double x0 = hyjets.phj[0][index];
165  double y0 = hyjets.phj[1][index];
166 
167  double x = x0 * cosphi0_ - y0 * sinphi0_;
168  double y = y0 * cosphi0_ + x0 * sinphi0_;
169 
170  HepMC::GenParticle* p = new HepMC::GenParticle(HepMC::FourVector(x, // px
171  y, // py
172  hyjets.phj[2][index], // pz
173  hyjets.phj[3][index]), // E
174  hyjets.khj[1][index], // id
175  convertStatus(hyjets.khj[0][index] // status
176  ));
177 
178  p->suggest_barcode(barcode);
179  return p;
180 }
double p[5][pyjets_maxn]
#define hyjets
Definition: HydjetWrapper.h:82

◆ build_hyjet_vertex()

HepMC::GenVertex * HydjetHadronizer::build_hyjet_vertex ( int  i,
int  id 
)
private

Definition at line 183 of file HydjetHadronizer.cc.

References cosphi0_, hyjets, mps_fire::i, sinphi0_, submitPVValidationJobs::t, bphysicsOniaDQM_cfi::vertex, and x.

Referenced by get_particles().

183  {
184  // build verteces for the hyjets stored events
185  double x0 = hyjets.vhj[0][i];
186  double y0 = hyjets.vhj[1][i];
187  double x = x0 * cosphi0_ - y0 * sinphi0_;
188  double y = y0 * cosphi0_ + x0 * sinphi0_;
189  double z = hyjets.vhj[2][i];
190  double t = hyjets.vhj[4][i];
191 
192  HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(x, y, z, t), id);
193  return vertex;
194 }
#define hyjets
Definition: HydjetWrapper.h:82

◆ call_hyinit()

bool HydjetHadronizer::call_hyinit ( double  energy,
double  a,
int  ifb,
double  bmin,
double  bmax,
double  bfix,
int  nh 
)
private

◆ classname()

const char * HydjetHadronizer::classname ( ) const

Definition at line 565 of file HydjetHadronizer.cc.

565 { return "gen::HydjetHadronizer"; }

◆ convertStatus()

int HydjetHadronizer::convertStatus ( int  st)
private

Definition at line 38 of file HydjetHadronizer.cc.

Referenced by build_hyjet(), and get_particles().

38  {
39  if (st <= 0)
40  return 0;
41  if (st <= 10)
42  return 1;
43  if (st <= 20)
44  return 2;
45  if (st <= 30)
46  return 3;
47  else
48  return st;
49 }

◆ decay()

bool HydjetHadronizer::decay ( )

Definition at line 557 of file HydjetHadronizer.cc.

557 { return true; }

◆ declareSpecialSettings()

bool gen::HydjetHadronizer::declareSpecialSettings ( const std::vector< std::string > &  )
inline

Definition at line 53 of file HydjetHadronizer.h.

53 { return true; }

◆ declareStableParticles()

bool HydjetHadronizer::declareStableParticles ( const std::vector< int > &  _pdg)

Definition at line 534 of file HydjetHadronizer.cc.

References gen::call_pygive(), gather_cfg::cout, mps_fire::i, and gen::pycomp_().

534  {
535  std::vector<int> pdg = _pdg;
536  for (size_t i = 0; i < pdg.size(); i++) {
537  int pyCode = pycomp_(pdg[i]);
538  std::ostringstream pyCard;
539  pyCard << "MDCY(" << pyCode << ",1)=0";
540  std::cout << pyCard.str() << std::endl;
541  call_pygive(pyCard.str());
542  }
543  return true;
544 }
bool call_pygive(const std::string &line)
int pycomp_(int &)

◆ doSetRandomEngine()

void HydjetHadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
overrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 133 of file HydjetHadronizer.cc.

References pythia6Service_, gen::Pythia6Service::setRandomEngine(), and gen::v.

double v[5][pyjets_maxn]
Pythia6Service * pythia6Service_
void setRandomEngine(CLHEP::HepRandomEngine *v)

◆ doSharedResources()

std::vector<std::string> const& gen::HydjetHadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 61 of file HydjetHadronizer.h.

References theSharedResources.

61 { return theSharedResources; }
static const std::vector< std::string > theSharedResources

◆ finalizeEvent()

void HydjetHadronizer::finalizeEvent ( )

Definition at line 561 of file HydjetHadronizer.cc.

561 {}

◆ generatePartonsAndHadronize()

bool HydjetHadronizer::generatePartonsAndHadronize ( )

Definition at line 198 of file HydjetHadronizer.cc.

References add_heavy_ion_rec(), bfixed_, funct::cos(), cosphi0_, MillePedeFileConverter_cfg::e, embedding_, gen::BaseHadronizer::event(), edm::errors::EventCorruption, evt, Exception, fVertex_, get_particles(), gen::BaseHadronizer::getEDMEvent(), edm::HepMCProduct::GetEvent(), HYEVNT, hyflow, hyfpar, hyjpar, edm::HepMCProduct::isVtxGenApplied(), LogDebug, GeneratorMix_cff::mix, eostools::move(), nhard_, nsoft_, nsub_, nuclear_radius(), phi0_, edm::Handle< T >::product(), pypars, pyqpar, pythia6Service_, rotate_, rotateEvtPlane(), funct::sin(), sinphi0_, and src_.

198  {
199  Pythia6Service::InstanceWrapper guard(pythia6Service_);
200 
201  // generate single event
202  if (embedding_) {
203  const edm::Event& e = getEDMEvent();
204  HepMC::GenVertex* genvtx = nullptr;
205  const HepMC::GenEvent* inev = 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"
211  << endl;
212  }
213  const HepMCProduct& bkg = mix.getObject(0);
214  if (!(bkg.isVtxGenApplied())) {
215  throw cms::Exception("MatchVtx") << "Input background does not have smeared vertex!" << endl;
216  } else {
217  inev = bkg.GetEvent();
218  }
219 
220  genvtx = inev->signal_process_vertex();
221 
222  if (!genvtx)
223  throw cms::Exception("MatchVtx") << "Input background does not have signal process vertex!" << endl;
224 
225  double aX, aY, aZ, aT;
226 
227  aX = genvtx->position().x();
228  aY = genvtx->position().y();
229  aZ = genvtx->position().z();
230  aT = genvtx->position().t();
231 
232  if (!fVertex_) {
233  fVertex_ = new HepMC::FourVector();
234  }
235  LogInfo("MatchVtx") << " setting vertex "
236  << " aX " << aX << " aY " << aY << " aZ " << aZ << " aT " << aT << endl;
237  fVertex_->set(aX, aY, aZ, aT);
238 
239  const HepMC::HeavyIon* hi = inev->heavy_ion();
240 
241  if (hi) {
242  bfixed_ = (hi->impact_parameter()) / nuclear_radius();
243  phi0_ = hi->event_plane_angle();
244  sinphi0_ = sin(phi0_);
245  cosphi0_ = cos(phi0_);
246  } else {
247  LogWarning("EventEmbedding") << "Background event does not have heavy ion record!";
248  }
249 
250  } else if (rotate_)
251  rotateEvtPlane();
252 
253  nsoft_ = 0;
254  nhard_ = 0;
255 
256  edm::LogInfo("HYDJETmode") << "##### HYDJET nhsel = " << hyjpar.nhsel;
257  edm::LogInfo("HYDJETfpart") << "##### HYDJET fpart = " << hyflow.fpart;
258  edm::LogInfo("HYDJETtf") << "##### HYDJET hadron freez-out temp, Tf = " << hyflow.Tf;
259  edm::LogInfo("HYDJETinTemp") << "##### HYDJET: QGP init temperature, T0 =" << pyqpar.T0u;
260  edm::LogInfo("HYDJETinTau") << "##### HYDJET: QGP formation time,tau0 =" << pyqpar.tau0u;
261 
262  int ntry = 0;
263  while (nsoft_ == 0 && nhard_ == 0) {
264  if (ntry > 100) {
265  edm::LogError("HydjetEmptyEvent") << "##### HYDJET: No Particles generated, Number of tries =" << ntry;
266 
267  // Throw an exception. Use the EventCorruption exception since it maps onto SkipEvent
268  // which is what we want to do here.
269 
270  std::ostringstream sstr;
271  sstr << "HydjetHadronizerProducer: No particles generated after " << ntry << " tries.\n";
272  edm::Exception except(edm::errors::EventCorruption, sstr.str());
273  throw except;
274  } else {
275  HYEVNT(bfixed_);
276  nsoft_ = hyfpar.nhyd;
277  nsub_ = hyjpar.njet;
278  nhard_ = hyfpar.npyt;
279  ++ntry;
280  }
281  }
282 
283  if (hyjpar.nhsel < 3)
284  nsub_++;
285 
286  // event information
287  std::unique_ptr<HepMC::GenEvent> evt = std::make_unique<HepMC::GenEvent>();
288  std::unique_ptr<edm::HepMCProduct> HepMCEvt = std::make_unique<edm::HepMCProduct>();
289 
290  if (nhard_ > 0 || nsoft_ > 0)
291  get_particles(evt.get());
292 
293  evt->set_signal_process_id(pypars.msti[0]); // type of the process
294  evt->set_event_scale(pypars.pari[16]); // Q^2
295  add_heavy_ion_rec(evt.get());
296 
297  if (fVertex_) {
298  // generate new vertex & apply the shift
299  // Copy the HepMC::GenEvent
300  HepMCEvt = std::make_unique<edm::HepMCProduct>(evt.get());
301  HepMCEvt->applyVtxGen(fVertex_);
302  evt = std::make_unique<HepMC::GenEvent>(*HepMCEvt->GetEvent());
303  }
304 
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;
309 
310  event() = std::move(evt);
311  return true;
312 }
#define HYEVNT
Definition: HydjetWrapper.h:20
double bfixed_
fixed impact param (fm); valid only if cflag_=0
HepMC::GenEvent * evt
bool isVtxGenApplied() const
Definition: HepMCProduct.h:39
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T const * product() const
Definition: Handle.h:70
void add_heavy_ion_rec(HepMC::GenEvent *evt)
Log< level::Error, false > LogError
#define hyfpar
Definition: HydjetWrapper.h:53
double nuclear_radius() const
bool embedding_
Switch for embedding mode.
edm::Event & getEDMEvent() const
Definition: EPCuts.h:4
int nsoft_
multiplicity of HYDRO-induced particles in event
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::unique_ptr< HepMC::GenEvent > & event()
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
Pythia6Service * pythia6Service_
#define hyjpar
Definition: HydjetWrapper.h:95
int nsub_
number of sub-events
Log< level::Info, false > LogInfo
int nhard_
multiplicity of PYTHIA(+PYQUEN)-induced particles in event
#define pypars
#define pyqpar
#define hyflow
Definition: HydjetWrapper.h:42
edm::EDGetTokenT< CrossingFrame< edm::HepMCProduct > > src_
Log< level::Warning, false > LogWarning
bool rotate_
Switch to rotate event plane.
double phi0_
Event plane angle.
HepMC::FourVector * fVertex_
Event signal vertex.
def move(src, dest)
Definition: eostools.py:511
bool get_particles(HepMC::GenEvent *evt)
#define LogDebug(id)

◆ get_particles()

bool HydjetHadronizer::get_particles ( HepMC::GenEvent evt)
private

Definition at line 315 of file HydjetHadronizer.cc.

References funct::abs(), build_hyjet(), build_hyjet_vertex(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), convertStatus(), evt, Exception, GenParticle::GenParticle, hyjets, hyjpar, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), LogDebug, nhard_, nsoft_, and nsub_.

Referenced by generatePartonsAndHadronize().

315  {
316  // Hard particles. The first nhard_ lines from hyjets array.
317  // Pythia/Pyquen sub-events (sub-collisions) for a given event
318  // Return T/F if success/failure
319  // Create particles from lujet entries, assign them into vertices and
320  // put the vertices in the GenEvent, for each SubEvent
321  // The SubEvent information is kept by storing indeces of main vertices
322  // of subevents as a vector in GenHIEvent.
323 
324  LogDebug("Hydjet") << " Number of sub events " << nsub_;
325  LogDebug("Hydjet") << " Number of hard events " << hyjpar.njet;
326  LogDebug("Hydjet") << " Number of hard particles " << nhard_;
327  LogDebug("Hydjet") << " Number of soft particles " << nsoft_;
328  LogDebug("Hydjet") << " nhard_ + nsoft_ = " << nhard_ + nsoft_ << " hyjets.nhj = " << hyjets.nhj << endl;
329 
330  int ihy = 0;
331  int isub = -1;
332  int isub_l = -1;
333  int stab = 0;
334 
335  vector<HepMC::GenParticle*> primary_particle(hyjets.nhj);
336  vector<HepMC::GenParticle*> particle(hyjets.nhj);
337 
338  HepMC::GenVertex* sub_vertices = nullptr; // just initialization
339 
340  // contain the last index in for each subevent
341  vector<int> index(nsub_);
342 
343  while (ihy < hyjets.nhj) {
344  constexpr int kMaxMultiplicity = 200000;
345  isub = std::floor((hyjets.khj[2][ihy] / kMaxMultiplicity));
346  int hjoffset = isub * kMaxMultiplicity;
347 
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);
355  }
356  index[isub] = ihy - 1;
357  isub_l = isub;
358  }
359 
360  if (convertStatus(hyjets.khj[0][ihy]) == 1)
361  stab++;
362  LogDebug("Hydjet_array") << ihy << " MULTin ev.:" << hyjets.nhj << " SubEv.#" << isub << " Part #" << ihy + 1
363  << ", PDG: " << hyjets.khj[1][ihy] << " (st. " << convertStatus(hyjets.khj[0][ihy])
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] << ") "
369  << std::endl;
370 
371  if (hyjets.khj[2][ihy] == 0) {
372  primary_particle[ihy] = build_hyjet(ihy, ihy + 1);
373  if (!sub_vertices)
374  LogError("Hydjet_array") << "##### HYDJET2: Vertex not initialized!";
375  else
376  sub_vertices->add_particle_out(primary_particle[ihy]);
377  LogDebug("Hydjet_array") << " ---> " << ihy + 1 << std::endl;
378  } else {
379  particle[ihy] = build_hyjet(ihy, ihy + 1);
380  int mid = hyjets.khj[2][ihy] - hjoffset + index[isub];
381  if (mid > ihy) {
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.";
386  }
387  int mid_t = mid;
388  while (((mid + 1) < ihy) && (std::abs(hyjets.khj[1][mid]) < 100) &&
389  (hyjets.khj[3][mid + 1] - hjoffset + index[isub] <= ihy))
390  mid++;
391  if (std::abs(hyjets.khj[1][mid]) < 100)
392  mid = mid_t;
393 
394  HepMC::GenParticle* mother = primary_particle.at(mid);
395  HepMC::GenVertex* prods = build_hyjet_vertex(ihy, isub);
396 
397  if (!mother) {
398  mother = particle[mid];
399  primary_particle[mid] = mother;
400  }
401 
402  HepMC::GenVertex* prod_vertex = mother->end_vertex();
403  if (!prod_vertex) {
404  prod_vertex = prods;
405  prod_vertex->add_particle_in(mother);
406  LogDebug("Hydjet_array") << " <--- " << mid + 1 << std::endl;
407  evt->add_vertex(prod_vertex);
408  prods = nullptr;
409  }
410 
411  prod_vertex->add_particle_out(particle[ihy]);
412  LogDebug("Hydjet_array") << " ---" << mid + 1 << "---> " << ihy + 1 << std::endl;
413  delete prods;
414  }
415  ihy++;
416  }
417  LogDebug("Hydjet_array") << " MULTin ev.:" << hyjets.nhj << ", last index: " << ihy - 1
418  << ", Sub events: " << isub + 1 << ", stable particles: " << stab << std::endl;
419 
420  return true;
421 }
HepMC::GenEvent * evt
Log< level::Error, false > LogError
int nsoft_
multiplicity of HYDRO-induced particles in event
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HepMC::GenParticle * build_hyjet(int index, int barcode)
#define hyjpar
Definition: HydjetWrapper.h:95
int nsub_
number of sub-events
int nhard_
multiplicity of PYTHIA(+PYQUEN)-induced particles in event
HepMC::GenVertex * build_hyjet_vertex(int i, int id)
#define hyjets
Definition: HydjetWrapper.h:82
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
#define LogDebug(id)

◆ hadronize()

bool HydjetHadronizer::hadronize ( )

Definition at line 555 of file HydjetHadronizer.cc.

555 { return false; }

◆ hydjet_init()

bool HydjetHadronizer::hydjet_init ( const edm::ParameterSet pset)
private

Definition at line 433 of file HydjetHadronizer.cc.

References angularspecselector_, docollisionalenloss_, doradiativeenloss_, fracsoftmult_, hadfreeztemp_, hyflow, hyjpar, hymode_, maxlongy_, maxtrany_, nquarkflavor_, pyqpar, qgpt0_, qgptau0_, shadowingswitch_, and signn_.

Referenced by initializeForInternalPartons().

433  {
434  // set hydjet options
435 
436  // hydjet running mode mode
437  // kHydroOnly --- nhsel=0 jet production off (pure HYDRO event), nhsel=0
438  // kHydroJets --- nhsle=1 jet production on, jet quenching off (HYDRO+njet*PYTHIA events)
439  // kHydroQJet --- nhsel=2 jet production & jet quenching on (HYDRO+njet*PYQUEN events)
440  // kJetsOnly --- nhsel=3 jet production on, jet quenching off, HYDRO off (njet*PYTHIA events)
441  // kQJetsOnly --- nhsel=4 jet production & jet quenching on, HYDRO off (njet*PYQUEN events)
442 
443  if (hymode_ == "kHydroOnly")
444  hyjpar.nhsel = 0;
445  else if (hymode_ == "kHydroJets")
446  hyjpar.nhsel = 1;
447  else if (hymode_ == "kHydroQJets")
448  hyjpar.nhsel = 2;
449  else if (hymode_ == "kJetsOnly")
450  hyjpar.nhsel = 3;
451  else if (hymode_ == "kQJetsOnly")
452  hyjpar.nhsel = 4;
453  else
454  hyjpar.nhsel = 2;
455 
456  // fraction of soft hydro induced multiplicity
457  hyflow.fpart = fracsoftmult_;
458 
459  // hadron freez-out temperature
460  hyflow.Tf = hadfreeztemp_;
461 
462  // maximum longitudinal collective rapidity
463  hyflow.ylfl = maxlongy_;
464 
465  // maximum transverse collective rapidity
466  hyflow.ytfl = maxtrany_;
467 
468  // shadowing on=1, off=0
469  hyjpar.ishad = shadowingswitch_;
470 
471  // set inelastic nucleon-nucleon cross section
472  hyjpar.sigin = signn_;
473 
474  // angular emitted gluon spectrum selection
475  pyqpar.ianglu = angularspecselector_;
476 
477  // number of active quark flavors in qgp
478  pyqpar.nfu = nquarkflavor_;
479 
480  // initial temperature of QGP
481  pyqpar.T0u = qgpt0_;
482 
483  // proper time of QGP formation
484  pyqpar.tau0u = qgptau0_;
485 
486  // type of medium induced partonic energy loss
488  edm::LogInfo("HydjetEnLoss") << "##### Radiative AND Collisional partonic energy loss ON ####";
489  pyqpar.ienglu = 0;
490  } else if (doradiativeenloss_) {
491  edm::LogInfo("HydjetenLoss") << "##### Only RADIATIVE partonic energy loss ON ####";
492  pyqpar.ienglu = 1;
493  } else if (docollisionalenloss_) {
494  edm::LogInfo("HydjetEnLoss") << "##### Only COLLISIONAL partonic energy loss ON ####";
495  pyqpar.ienglu = 2;
496  } else {
497  edm::LogInfo("HydjetEnLoss") << "##### Radiative AND Collisional partonic energy loss ON ####";
498  pyqpar.ienglu = 0;
499  }
500  return true;
501 }
bool docollisionalenloss_
DEFAULT = true.
std::string hymode_
Hydjet running mode.
#define hyjpar
Definition: HydjetWrapper.h:95
Log< level::Info, false > LogInfo
#define pyqpar
#define hyflow
Definition: HydjetWrapper.h:42
unsigned int shadowingswitch_
bool doradiativeenloss_
DEFAULT = true.
int angularspecselector_
angular emitted gluon spectrum selection

◆ initializeForExternalPartons()

bool gen::HydjetHadronizer::initializeForExternalPartons ( )

◆ initializeForInternalPartons()

bool HydjetHadronizer::initializeForInternalPartons ( )

Definition at line 514 of file HydjetHadronizer.cc.

References abeamtarget_, bfixed_, bmax_, bmin_, call_hyinit(), cflag_, comenergy, hydjet_init(), nmultiplicity_, nuclear_radius(), pset_, and pythia6Service_.

514  {
515  Pythia6Service::InstanceWrapper guard(pythia6Service_);
516  // pythia6Service_->setGeneralParams();
517 
518  // the input impact parameter (bxx_) is in [fm]; transform in [fm/RA] for hydjet usage
519  const float ra = nuclear_radius();
520  LogInfo("RAScaling") << "Nuclear radius(RA) = " << ra;
521  bmin_ /= ra;
522  bmax_ /= ra;
523  bfixed_ /= ra;
524 
525  // hydjet running options
527  // initialize hydjet
528  LogInfo("HYDJETinAction") << "##### Calling HYINIT(" << comenergy << "," << abeamtarget_ << "," << cflag_ << ","
529  << bmin_ << "," << bmax_ << "," << bfixed_ << "," << nmultiplicity_ << ") ####";
531  return true;
532 }
double bfixed_
fixed impact param (fm); valid only if cflag_=0
bool hydjet_init(const edm::ParameterSet &pset)
double comenergy
collision energy
double nuclear_radius() const
Pythia6Service * pythia6Service_
Log< level::Info, false > LogInfo
bool call_hyinit(double energy, double a, int ifb, double bmin, double bmax, double bfix, int nh)
double abeamtarget_
beam/target atomic mass number
edm::ParameterSet pset_

◆ nuclear_radius()

double HydjetHadronizer::nuclear_radius ( ) const
inlineprivate

Return the nuclear radius derived from the beam/target atomic mass number.

Definition at line 140 of file HydjetHadronizer.h.

References abeamtarget_, and funct::pow().

Referenced by add_heavy_ion_rec(), generatePartonsAndHadronize(), and initializeForInternalPartons().

140 { return 1.15 * pow((double)abeamtarget_, 1. / 3.); }
double abeamtarget_
beam/target atomic mass number
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ readSettings()

bool HydjetHadronizer::readSettings ( int  )

Definition at line 505 of file HydjetHadronizer.cc.

References pythia6Service_, and gen::Pythia6Service::setGeneralParams().

505  {
506  Pythia6Service::InstanceWrapper guard(pythia6Service_);
508 
509  return true;
510 }
Pythia6Service * pythia6Service_

◆ residualDecay()

bool HydjetHadronizer::residualDecay ( )

Definition at line 559 of file HydjetHadronizer.cc.

559 { return true; }

◆ rotateEvtPlane()

void HydjetHadronizer::rotateEvtPlane ( )
private

Definition at line 547 of file HydjetHadronizer.cc.

References funct::cos(), cosphi0_, phi0_, pi, gen::pyr_(), funct::sin(), and sinphi0_.

Referenced by generatePartonsAndHadronize().

547  {
548  const double pi = 3.14159265358979;
549  phi0_ = 2. * pi * gen::pyr_(nullptr) - pi;
550  sinphi0_ = sin(phi0_);
551  cosphi0_ = cos(phi0_);
552 }
double pyr_(int *idummy)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const Double_t pi
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double phi0_
Event plane angle.

◆ statistics()

void HydjetHadronizer::statistics ( )

Definition at line 563 of file HydjetHadronizer.cc.

563 {}

Member Data Documentation

◆ abeamtarget_

double gen::HydjetHadronizer::abeamtarget_
private

beam/target atomic mass number

Definition at line 77 of file HydjetHadronizer.h.

Referenced by initializeForInternalPartons(), and nuclear_radius().

◆ angularspecselector_

int gen::HydjetHadronizer::angularspecselector_
private

angular emitted gluon spectrum selection

Definition at line 78 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ bfixed_

double gen::HydjetHadronizer::bfixed_
private

fixed impact param (fm); valid only if cflag_=0

Definition at line 79 of file HydjetHadronizer.h.

Referenced by generatePartonsAndHadronize(), and initializeForInternalPartons().

◆ bmax_

double gen::HydjetHadronizer::bmax_
private

max impact param; units of nucl radius

Definition at line 80 of file HydjetHadronizer.h.

Referenced by initializeForInternalPartons().

◆ bmin_

double gen::HydjetHadronizer::bmin_
private

min impact param; units of nucl radius

Definition at line 82 of file HydjetHadronizer.h.

Referenced by initializeForInternalPartons().

◆ cflag_

int gen::HydjetHadronizer::cflag_
private

centrality flag = 0 fixed impact param, <> 0 between bmin and bmax

Definition at line 84 of file HydjetHadronizer.h.

Referenced by HydjetHadronizer(), and initializeForInternalPartons().

◆ comenergy

double gen::HydjetHadronizer::comenergy
private

collision energy

Definition at line 88 of file HydjetHadronizer.h.

Referenced by initializeForInternalPartons().

◆ cosphi0_

double gen::HydjetHadronizer::cosphi0_
private

◆ docollisionalenloss_

bool gen::HydjetHadronizer::docollisionalenloss_
private

DEFAULT = true.

Definition at line 90 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ doradiativeenloss_

bool gen::HydjetHadronizer::doradiativeenloss_
private

DEFAULT = true.

Definition at line 89 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ embedding_

bool gen::HydjetHadronizer::embedding_
private

Switch for embedding mode.

Definition at line 87 of file HydjetHadronizer.h.

Referenced by generatePartonsAndHadronize(), and HydjetHadronizer().

◆ evt

HepMC::GenEvent* gen::HydjetHadronizer::evt
private

◆ fracsoftmult_

double gen::HydjetHadronizer::fracsoftmult_
private

fraction of soft hydro induced hadronic multiplicity proportional to no of nucleon participants (1-fracsoftmult_)— fraction of soft multiplicity proportional to the numebr of nucleon-nucleon binary collisions DEFAULT=1., allowed range [0.01,1]

Definition at line 91 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ fVertex_

HepMC::FourVector* gen::HydjetHadronizer::fVertex_
private

Event signal vertex.

Definition at line 129 of file HydjetHadronizer.h.

Referenced by generatePartonsAndHadronize(), and HydjetHadronizer().

◆ hadfreeztemp_

double gen::HydjetHadronizer::hadfreeztemp_
private

hadron freez-out temperature DEFAULT=0.14MeV, allowed ranges [0.08,0.2]MeV

Definition at line 97 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ hymode_

std::string gen::HydjetHadronizer::hymode_
private

Hydjet running mode.

Definition at line 99 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ maxEventsToPrint_

unsigned int gen::HydjetHadronizer::maxEventsToPrint_
private

Events to print if verbosity.

Definition at line 100 of file HydjetHadronizer.h.

Referenced by HydjetHadronizer().

◆ maxlongy_

double gen::HydjetHadronizer::maxlongy_
private

max longitudinal collective rapidity: controls width of eta-spectra DEFAULT=4, allowed range [0.01,7.0]

Definition at line 101 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ maxtrany_

double gen::HydjetHadronizer::maxtrany_
private

max transverse collective rapidity: controls slope of low-pt spectra DEFAULT=1.5, allowed range [0.01,3.0]

Definition at line 104 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ nhard_

int gen::HydjetHadronizer::nhard_
private

multiplicity of PYTHIA(+PYQUEN)-induced particles in event

Definition at line 108 of file HydjetHadronizer.h.

Referenced by generatePartonsAndHadronize(), and get_particles().

◆ nmultiplicity_

int gen::HydjetHadronizer::nmultiplicity_
private

mean soft multiplicity in central PbPb automatically calculated for other centralitie and beams

Definition at line 109 of file HydjetHadronizer.h.

Referenced by initializeForInternalPartons().

◆ nquarkflavor_

unsigned int gen::HydjetHadronizer::nquarkflavor_
private

number of active quark flavors in qgp DEFAULT=0; allowed values: 0,1,2,3.

Definition at line 112 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ nsoft_

int gen::HydjetHadronizer::nsoft_
private

multiplicity of HYDRO-induced particles in event

Definition at line 111 of file HydjetHadronizer.h.

Referenced by generatePartonsAndHadronize(), and get_particles().

◆ nsub_

int gen::HydjetHadronizer::nsub_
private

number of sub-events

Definition at line 107 of file HydjetHadronizer.h.

Referenced by add_heavy_ion_rec(), generatePartonsAndHadronize(), and get_particles().

◆ phi0_

double gen::HydjetHadronizer::phi0_
private

Event plane angle.

Definition at line 120 of file HydjetHadronizer.h.

Referenced by add_heavy_ion_rec(), generatePartonsAndHadronize(), and rotateEvtPlane().

◆ pset_

edm::ParameterSet gen::HydjetHadronizer::pset_
private

Definition at line 76 of file HydjetHadronizer.h.

Referenced by initializeForInternalPartons().

◆ pythia6Service_

Pythia6Service* gen::HydjetHadronizer::pythia6Service_
private

◆ pythiaPylistVerbosity_

unsigned int gen::HydjetHadronizer::pythiaPylistVerbosity_
private

pythia verbosity; def=1

Definition at line 114 of file HydjetHadronizer.h.

Referenced by HydjetHadronizer().

◆ qgpt0_

double gen::HydjetHadronizer::qgpt0_
private

initial temperature of QGP DEFAULT = 1GeV; allowed range [0.2,2.0]GeV;

Definition at line 115 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ qgptau0_

double gen::HydjetHadronizer::qgptau0_
private

proper time of QGP formation DEFAULT = 0.1 fm/c; allowed range [0.01,10.0]fm/

Definition at line 117 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ rotate_

bool gen::HydjetHadronizer::rotate_
private

Switch to rotate event plane.

Definition at line 123 of file HydjetHadronizer.h.

Referenced by generatePartonsAndHadronize().

◆ shadowingswitch_

unsigned int gen::HydjetHadronizer::shadowingswitch_
private

shadowing switcher 1-ON, 0-OFF

Definition at line 125 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ signalVtx_

std::vector<double> gen::HydjetHadronizer::signalVtx_
private

Pset double vector to set event signal vertex.

Definition at line 130 of file HydjetHadronizer.h.

Referenced by HydjetHadronizer().

◆ signn_

double gen::HydjetHadronizer::signn_
private

inelastic nucleon nucleon cross section [mb] DEFAULT= 58 mb

Definition at line 127 of file HydjetHadronizer.h.

Referenced by hydjet_init().

◆ sinphi0_

double gen::HydjetHadronizer::sinphi0_
private

◆ src_

edm::EDGetTokenT<CrossingFrame<edm::HepMCProduct> > gen::HydjetHadronizer::src_
private

Definition at line 133 of file HydjetHadronizer.h.

Referenced by generatePartonsAndHadronize(), and HydjetHadronizer().

◆ theSharedResources

const std::vector< std::string > HydjetHadronizer::theSharedResources
staticprivate