CMS 3D CMS Logo

Cascade2Hadronizer.cc
Go to the documentation of this file.
2 
3 #include "HepMC/GenEvent.h"
4 #include "HepMC/PdfInfo.h"
5 #include "HepMC/PythiaWrapper6_4.h"
7 
8 #include "HepMC/HEPEVT_Wrapper.h"
9 #include "HepMC/IO_HEPEVT.h"
10 #include "HepMC/IO_GenEvent.h"
11 
16 
17 HepMC::IO_HEPEVT hepevtio;
18 
19 #include "HepPID/ParticleIDTranslations.hh"
20 
22 
23 //-- Pythia6 routines and functionalities to pass around Pythia6 params
24 
27 
29 
30 #include "CLHEP/Random/RandomEngine.h"
31 
32 using namespace edm;
33 using namespace std;
34 
35 #define debug 0
36 
37 static CLHEP::HepRandomEngine* cascade2RandomEngine;
38 
39 extern "C" {
40 
41 double dcasrn_(int* idummy) {
42  static int call = 0;
43 
44  double rdm_nb = cascade2RandomEngine->flat();
45 
46  if (debug && ++call < 100)
47  cout << "dcasrn from c++, call: " << call << " random number: " << rdm_nb << endl;
48 
49  return rdm_nb;
50 }
51 }
52 
53 namespace gen {
54 
56  public:
58 
59  private:
60  void upInit() override { FortranCallback::getInstance()->fillHeader(); }
61 
62  void upEvnt() override { FortranCallback::getInstance()->fillEvent(); }
63 
64  bool upVeto() override {
65  bool veto = false;
66  if (!hepeup_.nup)
67  veto = true; //-- LHE Common Blocks
68  return (veto);
69  }
70  };
71 
72  static struct {
73  int n, npad, k[5][pyjets_maxn];
74  double p[5][pyjets_maxn], v[5][pyjets_maxn];
75  } pyjets_local;
76 
77  const std::vector<std::string> Cascade2Hadronizer::theSharedResources = {edm::SharedResourceNames::kPythia6,
79 
80  Cascade2Hadronizer::Cascade2Hadronizer(edm::ParameterSet const& pset)
82  fPy6Service(new Pythia6ServiceWithCallback(pset)), //-- this will store py6 parameters for further settings
83 
84  fComEnergy(pset.getParameter<double>("comEnergy")),
85  fextCrossSection(pset.getUntrackedParameter<double>("crossSection", -1.)),
86  fextCrossSectionError(pset.getUntrackedParameter<double>("crossSectionError", -1.)),
87  fFilterEfficiency(pset.getUntrackedParameter<double>("filterEfficiency", -1.)),
88 
89  fMaxEventsToPrint(pset.getUntrackedParameter<int>("maxEventsToPrint", 0)),
90  fHepMCVerbosity(pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity", false)),
91  fPythiaListVerbosity(pset.getUntrackedParameter<int>("pythiaPylistVerbosity", 0)),
92 
93  fDisplayPythiaBanner(pset.getUntrackedParameter<bool>("displayPythiaBanner", false)),
94  fDisplayPythiaCards(pset.getUntrackedParameter<bool>("displayPythiaCards", false)) {
95  fParameters = pset.getParameter<ParameterSet>("Cascade2Parameters");
96 
97  fConvertToPDG = false;
98  if (pset.exists("doPDGConvert"))
99  fConvertToPDG = pset.getParameter<bool>("doPDGConvert");
100 
101  //-- silence Pythia6 banner printout, unless display requested
102 
103  if (!fDisplayPythiaBanner) {
104  if (!call_pygive("MSTU(12)=12345")) {
105  throw edm::Exception(edm::errors::Configuration, "PythiaError") << " Pythia did not accept MSTU(12)=12345";
106  }
107  }
108 
109  //-- silence printouts from PYGIVE, unless display requested
110 
111  if (!fDisplayPythiaCards) {
112  if (!call_pygive("MSTU(13)=0")) {
113  throw edm::Exception(edm::errors::Configuration, "PythiaError") << " Pythia did not accept MSTU(13)=0";
114  }
115  }
116 
117  //-- tmp stuff to deal with EvtGen corrupting pyjets
118  flushTmpStorage();
119  }
120 
122  if (fPy6Service != nullptr)
123  delete fPy6Service;
124  }
125 
126  void Cascade2Hadronizer::doSetRandomEngine(CLHEP::HepRandomEngine* v) {
129  }
130 
132  pyjets_local.n = 0;
133  pyjets_local.npad = 0;
134 
135  for (int ip = 0; ip < pyjets_maxn; ip++) {
136  for (int i = 0; i < 5; i++) {
137  pyjets_local.k[i][ip] = 0;
138  pyjets_local.p[i][ip] = 0.;
139  pyjets_local.v[i][ip] = 0.;
140  }
141  }
142  return;
143  }
144 
146  pyjets_local.n = pyjets.n;
147  pyjets_local.npad = pyjets.npad;
148 
149  for (int ip = 0; ip < pyjets_maxn; ip++) {
150  for (int i = 0; i < 5; i++) {
151  pyjets_local.k[i][ip] = pyjets.k[i][ip];
152  pyjets_local.p[i][ip] = pyjets.p[i][ip];
153  pyjets_local.v[i][ip] = pyjets.v[i][ip];
154  }
155  }
156  return;
157  }
158 
160  HepMC::PdfInfo pdf;
161 
162  //-- filling factorization "Q scale" now! pthat moved to binningValues()
163 
164  if (event()->signal_process_id() <= 0)
165  event()->set_signal_process_id(pypars.msti[0]);
166  if (event()->event_scale() <= 0)
167  event()->set_event_scale(pypars.pari[22]);
168  if (event()->alphaQED() <= 0)
169  event()->set_alphaQED(pyint1.vint[56]);
170  if (event()->alphaQCD() <= 0)
171  event()->set_alphaQCD(pyint1.vint[57]);
172 
173  //-- get pdf info directly from Pythia6 and set it up into HepMC::GenEvent
174  //-- S. Mrenna: Prefer vint block
175 
176  if (pdf.id1() <= 0)
177  pdf.set_id1(pyint1.mint[14] == 21 ? 0 : pyint1.mint[14]);
178  if (pdf.id2() <= 0)
179  pdf.set_id2(pyint1.mint[15] == 21 ? 0 : pyint1.mint[15]);
180  if (pdf.x1() <= 0)
181  pdf.set_x1(pyint1.vint[40]);
182  if (pdf.x2() <= 0)
183  pdf.set_x2(pyint1.vint[41]);
184  if (pdf.pdf1() <= 0)
185  pdf.set_pdf1(pyint1.vint[38] / pyint1.vint[40]);
186  if (pdf.pdf2() <= 0)
187  pdf.set_pdf2(pyint1.vint[39] / pyint1.vint[41]);
188  if (pdf.scalePDF() <= 0)
189  pdf.set_scalePDF(pyint1.vint[50]);
190 
191  event()->set_pdf_info(pdf);
192 
193  if (debug) {
194  cout << "standard Py6 event weight: pyint1.vint[96]: " << pyint1.vint[96] << endl;
195  cout << "event weight returned by PYEVWT: 1./(pyint1.vint[98]): " << 1. / (pyint1.vint[98]) << endl;
196  }
197 
198  //-- this is "standard" Py6 event weight (corresponds to PYINT1/VINT(97))
199  // event()->weights().push_back(pyint1.vint[96]);
200 
201  //-- this is event weight as 1./VINT(99) (PYINT1/VINT(99) is returned by the PYEVWT)
202  // event()->weights().push_back(1./(pyint1.vint[98]));
203 
204  //-- all cascade events have weight = 1
205  event()->weights().push_back(1.);
206 
207  //-- now create the GenEventInfo product from the GenEvent and fill the missing pieces
208 
209  eventInfo().reset(new GenEventInfoProduct(event().get()));
210 
211  //-- in Pythia6 pthat is used to subdivide samples into different bins
212  //-- in LHE mode the binning is done by the external ME generator
213  //-- which is likely not pthat, so only filling it for Py6 internal mode
214 
215  eventInfo()->setBinningValues(vector<double>(1, pypars.pari[16]));
216 
217  //-- here we treat long-lived particles
218 
219  if (pydat1.mstj[21] == 3 || pydat1.mstj[21] == 4)
221 
222  //-- convert particle IDs Py6 -> PDG (if requested)
223 
224  if (fConvertToPDG) {
225  for (HepMC::GenEvent::particle_iterator part = event()->particles_begin(); part != event()->particles_end();
226  ++part) {
227  (*part)->set_pdg_id(HepPID::translatePythiatoPDT((*part)->pdg_id()));
228  }
229  }
230 
231  //-- service printouts, if requested
232  if (fMaxEventsToPrint > 0) {
236  if (fHepMCVerbosity) {
237  cout << "Event process = " << pypars.msti[0] << endl << "----------------------" << endl;
238  event()->print();
239  }
240  }
241 
242  return;
243  }
244 
245  bool Cascade2Hadronizer::hadronize() { return false; }
246 
248  //-- grab Py6 instance
250 
252 
253  //-- skip event if py6 considers it bad
254  if (pyint1.mint[50] != 0) {
255  event().reset();
256  return false;
257  }
258 
259  //-- generation of the event with CASCADE
260  call_event();
261 
262  //-- pythia pyhepc routine converts common PYJETS in common HEPEVT
263  call_pyhepc(1);
264 
265  //-- delete the created event from memory
266  event().reset(hepevtio.read_next_event());
267 
268  //-- this is to deal with post-gen tools & residualDecay() that may reuse PYJETS
269  flushTmpStorage();
270  fillTmpStorage();
271 
272  return true;
273  }
274 
275  bool Cascade2Hadronizer::decay() { return true; }
276 
278  //-- grab Py6 instance
280 
281  int NPartsBeforeDecays = pyjets_local.n;
282  int NPartsAfterDecays = event().get()->particles_size();
283  int barcode = NPartsAfterDecays;
284 
285  // JVY: well, in principle, it's not a 100% fair to go up to NPartsBeforeDecays,
286  // because Photos will attach gamma's to existing vertices, i.e. in the middle
287  // of the event rather than at the end; but this will only shift pointers down,
288  // so we'll be going again over a few "original" particle...
289  // in the alternative, we may go all the way up to the beginning of the event
290  // and re-check if anything remains to decay, that's fine even if it'll take
291  // some extra CPU...
292 
293  for (int ipart = NPartsAfterDecays; ipart > NPartsBeforeDecays; ipart--) {
294  HepMC::GenParticle* part = event().get()->barcode_to_particle(ipart);
295  int status = part->status();
296  if (status != 1)
297  continue; // check only "stable" particles,
298  // as some undecayed may still be marked as such
299  int pdgid = part->pdg_id();
300  int py6ptr = pycomp_(pdgid);
301 
302  if (pydat3.mdcy[0][py6ptr - 1] != 1)
303  continue; // particle is not expected to decay
304 
305  int py6id = HepPID::translatePDTtoPythia(pdgid);
306 
307  // first, will need to zero out, then fill up PYJETS
308  // I better do it directly (by hands) rather than via py1ent
309  // - to avoid (additional) mass smearing
310 
311  if (part->momentum().t() <= part->generated_mass()) {
312  continue; // e == m -> 0-momentum, nothing to decay...
313  }
314 
315  else {
316  pyjets.n = 0;
317 
318  for (int i = 0; i < 5; i++) {
319  pyjets.k[i][0] = 0;
320  pyjets.p[i][0] = 0.;
321  pyjets.v[i][0] = 0.;
322  }
323 
324  pyjets.k[0][0] = 1;
325  pyjets.k[1][0] = py6id;
326  pyjets.p[4][0] = part->generated_mass();
327  pyjets.p[3][0] = part->momentum().t();
328  pyjets.p[0][0] = part->momentum().x();
329  pyjets.p[1][0] = part->momentum().y();
330  pyjets.p[2][0] = part->momentum().z();
331  HepMC::GenVertex* prod_vtx = part->production_vertex();
332  if (!prod_vtx)
333  continue; // in principle, should never happen but...
334  pyjets.v[0][0] = prod_vtx->position().x();
335  pyjets.v[1][0] = prod_vtx->position().y();
336  pyjets.v[2][0] = prod_vtx->position().z();
337  pyjets.v[3][0] = prod_vtx->position().t();
338  pyjets.v[4][0] = 0.;
339  pyjets.n = 1;
340  pyjets.npad = pyjets_local.npad;
341  }
342 
343  //-- now call Py6 decay routine
344 
345  int parent = 1; // since we always pass to Py6 a single particle
346  pydecy_(parent);
347 
348  //-- now attach decay products to mother
349 
350  for (int iprt1 = 1; iprt1 < pyjets.n; iprt1++) {
351  part->set_status(2);
352 
353  HepMC::GenVertex* DecVtx = new HepMC::GenVertex(
354  HepMC::FourVector(pyjets.v[0][iprt1], pyjets.v[1][iprt1], pyjets.v[2][iprt1], pyjets.v[3][iprt1]));
355  DecVtx->add_particle_in(part); // this will cleanup end_vertex if exists, replace with the new one
356  // I presume (vtx) barcode will be given automatically
357 
358  HepMC::FourVector pmom(pyjets.p[0][iprt1], pyjets.p[1][iprt1], pyjets.p[2][iprt1], pyjets.p[3][iprt1]);
359 
360  int dstatus = 0;
361  if (pyjets.k[0][iprt1] >= 1 && pyjets.k[0][iprt1] <= 10)
362  dstatus = 1;
363  else if (pyjets.k[0][iprt1] >= 11 && pyjets.k[0][iprt1] <= 20)
364  dstatus = 2;
365  else if (pyjets.k[0][iprt1] >= 21 && pyjets.k[0][iprt1] <= 30)
366  dstatus = 3;
367  else if (pyjets.k[0][iprt1] >= 31 && pyjets.k[0][iprt1] <= 100)
368  dstatus = pyjets.k[0][iprt1];
369 
370  HepMC::GenParticle* daughter =
371  new HepMC::GenParticle(pmom, HepPID::translatePythiatoPDT(pyjets.k[1][iprt1]), dstatus);
372  barcode++;
373  daughter->suggest_barcode(barcode);
374  DecVtx->add_particle_out(daughter);
375 
376  int iprt2;
377  for (iprt2 = iprt1 + 1; iprt2 < pyjets.n; iprt2++) { // the pointer is shifted by -1, c++ style
378 
379  if (pyjets.k[2][iprt2] != parent) {
380  parent = pyjets.k[2][iprt2];
381  break; // another parent particle; reset & break the loop
382  }
383 
384  HepMC::FourVector pmomN(pyjets.p[0][iprt2], pyjets.p[1][iprt2], pyjets.p[2][iprt2], pyjets.p[3][iprt2]);
385 
386  dstatus = 0;
387  if (pyjets.k[0][iprt2] >= 1 && pyjets.k[0][iprt2] <= 10)
388  dstatus = 1;
389  else if (pyjets.k[0][iprt2] >= 11 && pyjets.k[0][iprt2] <= 20)
390  dstatus = 2;
391  else if (pyjets.k[0][iprt2] >= 21 && pyjets.k[0][iprt2] <= 30)
392  dstatus = 3;
393  else if (pyjets.k[0][iprt2] >= 31 && pyjets.k[0][iprt2] <= 100)
394  dstatus = pyjets.k[0][iprt2];
395 
396  HepMC::GenParticle* daughterN =
397  new HepMC::GenParticle(pmomN, HepPID::translatePythiatoPDT(pyjets.k[1][iprt2]), dstatus);
398  barcode++;
399  daughterN->suggest_barcode(barcode);
400  DecVtx->add_particle_out(daughterN);
401  } //-- end iprt2 loop
402 
403  iprt1 = iprt2 - 1; // reset counter such that it doesn't go over the same child more than once
404  // don't forget to offset back into c++ counting, as it's already +1 forward
405 
406  event().get()->add_vertex(DecVtx);
407  } //-- end iprt1 loop
408  } //-- end loop over decay products
409 
410  // now restore the very original Py6 event record
411 
412  if (pyjets_local.n != pyjets.n) {
413  // restore pyjets to its state as it was before external decays -
414  // might have been jammed by action above or by py1ent calls in EvtGen
415 
416  pyjets.n = pyjets_local.n;
417  pyjets.npad = pyjets_local.npad;
418  for (int ip = 0; ip < pyjets_local.n; ip++) {
419  for (int i = 0; i < 5; i++) {
420  pyjets.k[i][ip] = pyjets_local.k[i][ip];
421  pyjets.p[i][ip] = pyjets_local.p[i][ip];
422  pyjets.v[i][ip] = pyjets_local.v[i][ip];
423  }
424  }
425  }
426 
427  return true;
428  }
429 
431  //-- grab Py6 instance
433 
435 
436  if (key == 0)
439 
440  return true;
441  }
442 
444 
446  //-- grab Py6 instance
448 
449  //-- change standard parameters of JETSET/PYTHIA - replace call_pytcha()
450 
452 
456 
458 
459  //-- mstu(8) is set to NMXHEP in this dummy call (version >=6.404)
460  call_pyhepc(1);
461 
462  //-- initialise random number generator: has been changed to be CMSSW compliant
463  //-- dcasrn overloaded: call to rluxgo not needed anymore
464  //-- call_rluxgo(4,314159265,0,0);
465 
466  //-- initialise CASCADE parameters (default values)
467  call_casini();
468 
469  //-- Read the parameters and pass them to the common blocks
470  //-- call_steer();
471 
472  //-- initialise CASCADE parameters (user values)
473 
474  //-- retrieve all the different sets
475  vector<string> AllSets = fParameters.getParameter<vector<string> >("parameterSets");
476 
477  //-- loop over the different sets
478  for (unsigned i = 0; i < AllSets.size(); ++i) {
479  string Set = AllSets[i];
480  vector<string> Para_Set = fParameters.getParameter<vector<string> >(Set);
481 
482  //-- loop over all the parameters and stop in case of mistake
483  for (vector<string>::const_iterator itPara = Para_Set.begin(); itPara != Para_Set.end(); ++itPara) {
484  if (!cascadeReadParameters(*itPara)) {
485  throw edm::Exception(edm::errors::Configuration, "CascadeError")
486  << " Cascade did not accept the following parameter: \"" << *itPara << "\"" << endl;
487  }
488  } //-- end loop over all the parameters
489  } //-- end loop over the different sets
490 
491  cainpu.plepin = -fComEnergy / 2;
492  cainpu.ppin = fComEnergy / 2;
493 
495 
496  //-- change standard parameters of CASCADE
497  call_cascha();
498 
499  //-- change standard parameters of JETSET/PYTHIA
500  //-- call_pytcha();
501 
502  //-- set up for running CASCADE (integration of the cross-section)
503  call_cascade();
504 
505  //-- print cross-section result from integration
506  call_caend(1);
507 
509 
511 
512  return true;
513  }
514 
515  bool Cascade2Hadronizer::declareStableParticles(const vector<int>& _pdg) {
516  vector<int> pdg = _pdg;
517  for (size_t i = 0; i < pdg.size(); i++) {
518  int PyID = HepPID::translatePDTtoPythia(pdg[i]);
519  int pyCode = pycomp_(PyID);
520 
521  if (pyCode > 0) {
522  ostringstream pyCard;
523  pyCard << "MDCY(" << pyCode << ",1)=0";
524  //-- cout << "pdg= " << pdg[i] << " " << pyCard.str() << endl;
525 
526  call_pygive(pyCard.str());
527  }
528  }
529 
530  return true;
531  }
532 
534  // this is practically a copy/paste of the original code by J.Alcaraz,
535  // taken directly from PythiaSource
536 
537  int dumm = 0;
538  HepMC::GenEvent::vertex_const_iterator vbegin = event()->vertices_begin();
539  HepMC::GenEvent::vertex_const_iterator vend = event()->vertices_end();
540  HepMC::GenEvent::vertex_const_iterator vitr = vbegin;
541 
542  for (; vitr != vend; ++vitr) {
543  HepMC::GenVertex::particle_iterator pbegin = (*vitr)->particles_begin(HepMC::children);
544  HepMC::GenVertex::particle_iterator pend = (*vitr)->particles_end(HepMC::children);
545  HepMC::GenVertex::particle_iterator pitr = pbegin;
546 
547  for (; pitr != pend; ++pitr) {
548  if ((*pitr)->end_vertex())
549  continue;
550  if ((*pitr)->status() != 1)
551  continue;
552 
553  int pdgcode = abs((*pitr)->pdg_id());
554  // Do nothing if the particle is not expected to decay
555  if (pydat3.mdcy[0][pycomp_(pdgcode) - 1] != 1)
556  continue;
557 
558  double ctau = pydat2.pmas[3][pycomp_(pdgcode) - 1];
559  HepMC::FourVector mom = (*pitr)->momentum();
560  HepMC::FourVector vin = (*vitr)->position();
561  double x = 0.;
562  double y = 0.;
563  double z = 0.;
564  double t = 0.;
565  bool decayInRange = false;
566  while (!decayInRange) {
567  double unif_rand = fPy6Service->call(pyr_, &dumm);
568  // Value of 0 is excluded, so following line is OK
569  double proper_length = -ctau * log(unif_rand);
570  double factor = proper_length / mom.m();
571  x = vin.x() + factor * mom.px();
572  y = vin.y() + factor * mom.py();
573  z = vin.z() + factor * mom.pz();
574  t = vin.t() + factor * mom.e();
575 
576  // Decay must be happen outside a cylindrical region
577  if (pydat1.mstj[21] == 4) {
578  if (sqrt(x * x + y * y) > pydat1.parj[72] || fabs(z) > pydat1.parj[73])
579  decayInRange = true;
580  // Decay must be happen outside a given sphere
581  } else if (pydat1.mstj[21] == 3) {
582  if (sqrt(x * x + y * y + z * z) > pydat1.parj[71])
583  decayInRange = true;
584  }
585  // Decay is always OK otherwise
586  else {
587  decayInRange = true;
588  }
589  }
590 
591  HepMC::GenVertex* vdec = new HepMC::GenVertex(HepMC::FourVector(x, y, z, t));
592  event()->add_vertex(vdec);
593  vdec->add_particle_in((*pitr));
594  }
595  }
596 
597  return;
598  }
599 
602 
604 
605  if (!runInfo().internalXSec()) {
606  double sigma_CMS = 0.001 * caeffic.avgi;
607  double error_CMS = 0.001 * caeffic.sd;
608  runInfo().setInternalXSec(GenRunInfoProduct::XSec(sigma_CMS, error_CMS));
609  }
610 
611  //-- print out generated event summary
612  call_caend(2);
613 
614  //-- write out some information from Pythia to the screen
615  call_pystat(1);
616 
617  return;
618  }
619 
620  const char* Cascade2Hadronizer::classname() const { return "gen::Cascade2Hadronizer"; }
621 
622  //-- Read the parameters and pass them to the common blocks
623 
624  bool Cascade2Hadronizer::cascadeReadParameters(const string& ParameterString) {
625  bool accepted = true;
626 
627  if (!strncmp(ParameterString.c_str(), "KE", 2))
628  caluco.ke = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
629 
630  else if (!strncmp(ParameterString.c_str(), "IRES(1)", 7))
631  capar6.ires[0] = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
632 
633  else if (!strncmp(ParameterString.c_str(), "KP", 2))
634  caluco.kp = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
635 
636  else if (!strncmp(ParameterString.c_str(), "IRES(2)", 7))
637  capar6.ires[1] = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
638 
639  else if (!strncmp(ParameterString.c_str(), "NFRAG", 5))
640  cainpu.nfrag = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
641 
642  else if (!strncmp(ParameterString.c_str(), "IPST", 4))
643  cashower.ipst = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
644 
645  else if (!strncmp(ParameterString.c_str(), "IPSIPOL", 7))
646  jpsi.ipsipol = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
647 
648  //-- from version 2.2.03 on
649  // else if(!strncmp(ParameterString.c_str(),"I23S",4))
650  // jpsi.i23s = atoi(&ParameterString[strcspn(ParameterString.c_str(),"=")+1]);
651 
652  else if (!strncmp(ParameterString.c_str(), "IFPS", 4))
653  cainpu.ifps = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
654 
655  else if (!strncmp(ParameterString.c_str(), "ITIMSHR", 7))
656  casshwr.itimshr = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
657 
658  else if (!strncmp(ParameterString.c_str(), "IRUNAEM", 7))
659  capar1.irunaem = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
660 
661  else if (!strncmp(ParameterString.c_str(), "IRUNA", 5))
662  capar1.iruna = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
663 
664  else if (!strncmp(ParameterString.c_str(), "IQ2", 3))
665  capar1.iq2 = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
666 
667  else if (!strncmp(ParameterString.c_str(), "IPRO", 4))
668  capar1.ipro = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
669 
670  else if (!strncmp(ParameterString.c_str(), "NFLAV", 5))
671  caluco.nflav = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
672 
673  else if (!strncmp(ParameterString.c_str(), "INTER", 5))
674  cainpu.inter = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
675 
676  else if (!strncmp(ParameterString.c_str(), "IHFLA", 5))
677  cahflav.ihfla = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
678 
679  else if (!strncmp(ParameterString.c_str(), "IRPA", 4))
680  cascol.irpa = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
681 
682  else if (!strncmp(ParameterString.c_str(), "IRPB", 4))
683  cascol.irpb = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
684 
685  else if (!strncmp(ParameterString.c_str(), "IRPC", 4))
686  cascol.irpc = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
687 
688  else if (!strncmp(ParameterString.c_str(), "ICCFM", 5))
689  casshwr.iccfm = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
690 
691  else if (!strncmp(ParameterString.c_str(), "IFINAL", 6))
692  cainpu.ifinal = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
693 
694  else if (!strncmp(ParameterString.c_str(), "IGLU", 4))
695  cagluon.iglu = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
696 
697  else if (!strncmp(ParameterString.c_str(), "IRspl", 5))
698  casprre.irspl = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
699 
700  else if (!strncmp(ParameterString.c_str(), "PT2CUT", 6))
701  captcut.pt2cut[capar1.ipro - 1] = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
702 
703  else if (!strncmp(ParameterString.c_str(), "NCB", 3))
704  integr.ncb = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
705 
706  else if (!strncmp(ParameterString.c_str(), "ACC1", 4))
707  integr.acc1 = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
708 
709  else if (!strncmp(ParameterString.c_str(), "ACC2", 4))
710  integr.acc2 = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
711 
712  else if (!strncmp(ParameterString.c_str(), "SCALFAF", 7))
713  scalf.scalfaf = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
714 
715  else if (!strncmp(ParameterString.c_str(), "SCALFA", 6))
716  scalf.scalfa = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
717 
718  else
719  accepted = false;
720 
721  return accepted;
722  }
723 
725  cout << "" << endl;
726  cout << "----------------------------------" << endl;
727  cout << "---- Cascade Parameters ----" << endl;
728  cout << "----------------------------------" << endl;
729  cout << "" << endl;
730 
731  cout << "computation switch: " << endl;
732  cout << "number of calls per iteration for bases: " << integr.ncb << endl;
733  cout << "relative precision for grid optimisation: " << integr.acc1 << " %" << endl;
734  cout << "relative precision for integration: " << integr.acc2 << " %" << endl;
735  cout << "" << endl;
736 
737  cout << "kinematics: " << endl;
738  cout << "flavour code of beam 1: " << caluco.ke << endl;
739  cout << "direct or resolved particle 1: " << capar6.ires[0] << endl;
740  cout << "pz of incoming beam 1: " << cainpu.plepin << " GeV" << endl;
741  cout << "flavour code of beam 2: " << caluco.kp << endl;
742  cout << "direct or resolved particle 2: " << capar6.ires[1] << endl;
743  cout << "pz of incoming beam 2: " << cainpu.ppin << " GeV" << endl;
744  cout << "number of active flavors: " << caluco.nflav << endl;
745  cout << "" << endl;
746 
747  cout << "hard subprocess selection: " << endl;
748  cout << "hard subprocess number (IPRO): " << capar1.ipro << endl;
749  cout << "IPRO = 10, switch to select QCD process g* g* -> q qbar: " << cascol.irpa << endl;
750  cout << "IPRO = 10, switch to select QCD process g* g -> g g: " << cascol.irpb << endl;
751  cout << "IPRO = 10, switch to select QCD process g* q -> g q: " << cascol.irpc << endl;
752  cout << "flavor of heavy quark produced (IPRO = 11, 504, 514): " << cahflav.ihfla << endl;
753  // cout<<"select vector meson state: "<<jpsi.i23s<<endl;
754  cout << "use matrix element including J/psi (Upsilon) polarisation: " << jpsi.ipsipol << endl;
755  cout << "pt2 cut in matrix element for massless partons: " << captcut.pt2cut[capar1.ipro - 1] << " GeV^2" << endl;
756  cout << "" << endl;
757 
758  cout << "parton shower and fragmentation: " << endl;
759  cout << "switch for fragmentation: " << cainpu.nfrag << endl;
760  cout << "switch for parton shower (0 off - 1 initial state - 2 final state - 3 initial & final state): "
761  << cainpu.ifps << endl;
762  cout << "switch for time like parton shower in initial state: " << casshwr.itimshr << endl;
763  cout << "select CCFM (1) or DGLAP (0) evolution: " << casshwr.iccfm << endl;
764  cout << "scale switch for final state parton shower: " << cainpu.ifinal << endl;
765  cout << "scale factor for final state parton shower: " << scalf.scalfaf << endl;
766  cout << "switch for proton remnant treatment: " << casprre.irspl << endl;
767  cout << "keep track of intermediate state in parton shower: " << cashower.ipst << endl;
768  cout << "mode of interaction for e p: " << cainpu.inter << endl;
769  cout << "" << endl;
770 
771  cout << "pdfs, couplings and scales: " << endl;
772  cout << "switch for running alphaem: " << capar1.irunaem << endl;
773  cout << "switch for running alphas: " << capar1.iruna << endl;
774  cout << "scale in alphas: " << capar1.iq2 << endl;
775  cout << "scale factor for scale in alphas: " << scalf.scalfa << endl;
776  cout << "unintegrated pdf: " << cagluon.iglu << endl;
777  cout << "path where updf are stored: " << caspdf.pdfpath << endl;
778  cout << "" << endl;
779 
780  cout << "center of mass energy, cross section, filter efficiency: " << endl;
781  cout << "center of mass energy: " << fComEnergy << " GeV" << endl;
782  cout << "external LO cross section: " << fextCrossSection << " +/- " << fextCrossSectionError << " pb" << endl;
783  cout << "filter efficiency: " << fFilterEfficiency << endl;
784  cout << "" << endl;
785  }
786 
788  cout << "" << endl;
789  cout << "----------------------------------" << endl;
790  cout << "---- Pythia6 Parameters ----" << endl;
791  cout << "----------------------------------" << endl;
792  cout << "" << endl;
793 
794  cout << "charm mass: " << pydat2.pmas[0][3] << " GeV (default value = 1.5 GeV)" << endl;
795  cout << "bottom mass: " << pydat2.pmas[0][4] << " GeV (default value = 4.8 GeV)" << endl;
796  cout << "Higgs mass: " << pydat2.pmas[0][24] << " GeV (default value = 115 GeV)" << endl;
797 
798  cout << "lambda QCD: " << pydat1.paru[111] << " GeV (default value = 0.25 GeV)" << endl;
799 
800  cout << "alphas behaviour: " << pydat1.mstu[110] << " (default value = 1)" << endl;
801  cout << "nr of flavours wrt lambda QCD: " << pydat1.mstu[111] << " (default value = 5)" << endl;
802  cout << "min nr of flavours for alphas: " << pydat1.mstu[112] << " (default value = 3)" << endl;
803  cout << "max nr of flavours for alphas: " << pydat1.mstu[113] << " (default value = 5)" << endl;
804 
805  cout << "maximum angle settings: " << pydat1.mstj[47] << " (default value = 0)" << endl;
806 
807  cout << "" << endl;
808  }
809 
810 } // namespace gen
GenEventInfoProduct
Definition: GenEventInfoProduct.h:17
call_casini
void call_casini()
Definition: CascadeWrapper.h:133
vend
#define vend()
Definition: vmac.h:43
caluco
#define caluco
Definition: CascadeWrapper.h:16
gen::Cascade2Hadronizer::finalizeEvent
void finalizeEvent()
Definition: Cascade2Hadronizer.cc:159
electrons_cff.bool
bool
Definition: electrons_cff.py:372
Cascade2Hadronizer.h
mps_fire.i
i
Definition: mps_fire.py:355
gen::Cascade2Hadronizer::initializeForExternalPartons
bool initializeForExternalPartons()
Definition: Cascade2Hadronizer.cc:443
MessageLogger.h
funct::false
false
Definition: Factorize.h:34
cagluon
#define cagluon
Definition: CascadeWrapper.h:76
gen::pycomp_
int pycomp_(int &)
mps_update.status
status
Definition: mps_update.py:69
pyint1
#define pyint1
Definition: ExhumeHadronizer.cc:51
gen::Pythia6ServiceWithCallback::upInit
void upInit() override
Definition: Cascade2Hadronizer.cc:60
hepevtio
HepMC::IO_HEPEVT hepevtio
Definition: Cascade2Hadronizer.cc:17
edm
HLT enums.
Definition: AlignableModifier.h:19
class-composition.children
children
Definition: class-composition.py:88
gen::pyr_
double pyr_(int *idummy)
Definition: Pythia6Service.cc:60
cascol
#define cascol
Definition: CascadeWrapper.h:70
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pypars
#define pypars
Definition: ExhumeHadronizer.cc:45
gen::FortranInstance::kFortranInstance
static const std::string kFortranInstance
Definition: FortranInstance.h:88
gen::Cascade2Hadronizer::fDisplayPythiaBanner
bool fDisplayPythiaBanner
Definition: Cascade2Hadronizer.h:77
gen::Cascade2Hadronizer::fillTmpStorage
void fillTmpStorage()
Definition: Cascade2Hadronizer.cc:145
gen::Cascade2Hadronizer::cascadePrintParameters
void cascadePrintParameters()
Definition: Cascade2Hadronizer.cc:724
Pythia6Declarations.h
gen::k
int k[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:73
gen::Pythia6Service::setPYUPDAParams
void setPYUPDAParams(bool afterPyinit)
Definition: Pythia6Service.cc:276
gen::Cascade2Hadronizer::doSetRandomEngine
void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
Definition: Cascade2Hadronizer.cc:126
GenRunInfoProduct::setInternalXSec
void setInternalXSec(const XSec &xsec)
Definition: GenRunInfoProduct.h:26
gen::Pythia6Service::setRandomEngine
void setRandomEngine(CLHEP::HepRandomEngine *v)
Definition: Pythia6Service.h:46
vbegin
#define vbegin()
Definition: vmac.h:36
call_cascade
void call_cascade()
Definition: CascadeWrapper.h:136
gen::Pythia6Service::setSLHAParams
void setSLHAParams()
Definition: Pythia6Service.cc:239
call_caend
void call_caend(int mode)
Definition: CascadeWrapper.h:137
gen::Cascade2Hadronizer::fMaxEventsToPrint
unsigned int fMaxEventsToPrint
Definition: Cascade2Hadronizer.h:73
gen::BaseHadronizer
Definition: BaseHadronizer.h:46
GenRunInfoProduct.h
gen::Pythia6ServiceWithCallback
Definition: Cascade2Hadronizer.cc:55
gen::Pythia6Service::setGeneralParams
void setGeneralParams()
Definition: Pythia6Service.cc:157
gen::FortranCallback::getInstance
static FortranCallback * getInstance()
Definition: FortranCallback.h:52
scalf
#define scalf
Definition: CascadeWrapper.h:103
captcut
#define captcut
Definition: CascadeWrapper.h:88
EDMException.h
gen::Pythia6Service::closeSLHA
void closeSLHA()
Definition: Pythia6Service.cc:227
gen::Cascade2Hadronizer::generatePartonsAndHadronize
bool generatePartonsAndHadronize()
Definition: Cascade2Hadronizer.cc:247
part
part
Definition: HCALResponse.h:20
gen::Pythia6ServiceWithCallback::upVeto
bool upVeto() override
Definition: Cascade2Hadronizer.cc:64
gen::Pythia6Service::setCSAParams
void setCSAParams()
Definition: Pythia6Service.cc:168
gen::Cascade2Hadronizer::fextCrossSection
double fextCrossSection
Definition: Cascade2Hadronizer.h:69
hepeup_
struct HEPEUP_ hepeup_
gen::p
double p[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:74
gen::Cascade2Hadronizer::fHepMCVerbosity
bool fHepMCVerbosity
Definition: Cascade2Hadronizer.h:74
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
cms::dd::accepted
bool accepted(std::vector< std::regex > const &, std::string_view)
capar6
#define capar6
Definition: CascadeWrapper.h:22
gen::FortranInstance::InstanceWrapper
Definition: FortranInstance.h:54
gen::Cascade2Hadronizer::fComEnergy
double fComEnergy
Definition: Cascade2Hadronizer.h:68
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
gen::BaseHadronizer::eventInfo
std::unique_ptr< GenEventInfoProduct > & eventInfo()
Definition: BaseHadronizer.h:87
CascadeWrapper.h
SharedResourceNames.h
gen
Definition: PythiaDecays.h:13
OrderedSet.t
t
Definition: OrderedSet.py:90
gen::Cascade2Hadronizer::hadronize
bool hadronize()
Definition: Cascade2Hadronizer.cc:245
integr
#define integr
Definition: CascadeWrapper.h:97
gen::Cascade2Hadronizer::cascadeReadParameters
bool cascadeReadParameters(const std::string &ParameterString)
Definition: Cascade2Hadronizer.cc:624
capar1
#define capar1
Definition: CascadeWrapper.h:58
FortranInstance.h
call_event
void call_event()
Definition: CascadeWrapper.h:138
gen::FortranCallback::resetIterationsPerEvent
void resetIterationsPerEvent()
Definition: FortranCallback.h:23
gen::FortranInstance::call
void call(void(&fn)())
Definition: FortranInstance.h:20
gen::Cascade2Hadronizer::residualDecay
bool residualDecay()
Definition: Cascade2Hadronizer.cc:277
casshwr
#define casshwr
Definition: CascadeWrapper.h:52
edm::ParameterSet
Definition: ParameterSet.h:36
GenRunInfoProduct::XSec
Definition: GenRunInfoProduct.h:32
gen::pyjets_local
static struct gen::@662 pyjets_local
gen::Cascade2Hadronizer::fParameters
edm::ParameterSet fParameters
Definition: Cascade2Hadronizer.h:63
debug
#define debug
Definition: Cascade2Hadronizer.cc:35
gen::Cascade2Hadronizer::fFilterEfficiency
double fFilterEfficiency
Definition: Cascade2Hadronizer.h:71
caspdf
#define caspdf
Definition: CascadeWrapper.h:109
gen::v
double v[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:74
gen::Cascade2Hadronizer::fPythiaListVerbosity
unsigned int fPythiaListVerbosity
Definition: Cascade2Hadronizer.h:75
gen::pydecy_
void pydecy_(int &ip)
createfilelist.int
int
Definition: createfilelist.py:10
gen::call_pylist
void call_pylist(int mode)
Definition: ExhumeHadronizer.cc:63
jpsi
#define jpsi
Definition: CascadeWrapper.h:46
gen::Cascade2Hadronizer::fPy6Service
Pythia6Service * fPy6Service
Definition: Cascade2Hadronizer.h:65
casprre
#define casprre
Definition: CascadeWrapper.h:82
get
#define get
gen::Cascade2Hadronizer::imposeProperTime
void imposeProperTime()
Definition: Cascade2Hadronizer.cc:533
gen::Cascade2Hadronizer::classname
const char * classname() const
Definition: Cascade2Hadronizer.cc:620
cascade2RandomEngine
static CLHEP::HepRandomEngine * cascade2RandomEngine
Definition: Cascade2Hadronizer.cc:37
gen::Cascade2Hadronizer::pythia6PrintParameters
void pythia6PrintParameters()
Definition: Cascade2Hadronizer.cc:787
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
gen::Cascade2Hadronizer::fextCrossSectionError
double fextCrossSectionError
Definition: Cascade2Hadronizer.h:70
gen::Pythia6ServiceWithCallback::Pythia6ServiceWithCallback
Pythia6ServiceWithCallback(const edm::ParameterSet &pset)
Definition: Cascade2Hadronizer.cc:57
caeffic
#define caeffic
Definition: CascadeWrapper.h:118
gen::Cascade2Hadronizer::fConvertToPDG
bool fConvertToPDG
Definition: Cascade2Hadronizer.h:80
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
std
Definition: JetResolutionObject.h:76
gen::BaseHadronizer::event
std::unique_ptr< HepMC::GenEvent > & event()
Definition: BaseHadronizer.h:86
gen::Cascade2Hadronizer::flushTmpStorage
void flushTmpStorage()
Definition: Cascade2Hadronizer.cc:131
gen::Cascade2Hadronizer::decay
bool decay()
Definition: Cascade2Hadronizer.cc:275
gen::Cascade2Hadronizer::initializeForInternalPartons
bool initializeForInternalPartons()
Definition: Cascade2Hadronizer.cc:445
edm::SharedResourceNames::kPythia6
static const std::string kPythia6
Definition: SharedResourceNames.h:26
cainpu
#define cainpu
Definition: CascadeWrapper.h:31
gen::Cascade2Hadronizer::statistics
void statistics()
Definition: Cascade2Hadronizer.cc:600
Exception
Definition: hltDiff.cc:246
gen::Pythia6ServiceWithCallback::upEvnt
void upEvnt() override
Definition: Cascade2Hadronizer.cc:62
HEPEUP_::nup
int nup
Definition: LHECommonBlocks.h:21
Pythia6Service.h
gen::Cascade2Hadronizer::declareStableParticles
bool declareStableParticles(const std::vector< int > &)
Definition: Cascade2Hadronizer.cc:515
pdg
Definition: pdg_functions.h:28
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
gen::Cascade2Hadronizer::~Cascade2Hadronizer
~Cascade2Hadronizer() override
Definition: Cascade2Hadronizer.cc:121
gen::npad
int npad
Definition: Cascade2Hadronizer.cc:73
cashower
#define cashower
Definition: CascadeWrapper.h:37
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GenRunInfoProduct::setExternalXSecLO
void setExternalXSecLO(const XSec &xsec)
Definition: GenRunInfoProduct.h:27
gen::Pythia6Service
Definition: Pythia6Service.h:24
FortranCallback.h
gen::Cascade2Hadronizer::fDisplayPythiaCards
bool fDisplayPythiaCards
Definition: Cascade2Hadronizer.h:78
dcasrn_
double dcasrn_(int *idummy)
Definition: Cascade2Hadronizer.cc:41
gen::Cascade2Hadronizer::readSettings
bool readSettings(int)
Definition: Cascade2Hadronizer.cc:430
EgammaValidation_cff.pdgid
pdgid
Definition: EgammaValidation_cff.py:30
PbPb_ZMuSkimMuonDPG_cff.veto
veto
Definition: PbPb_ZMuSkimMuonDPG_cff.py:61
crabWrapper.key
key
Definition: crabWrapper.py:19
gen::BaseHadronizer::runInfo
GenRunInfoProduct & runInfo()
Definition: BaseHadronizer.h:85
gen::n
int n
Definition: Cascade2Hadronizer.cc:73
gen::call_pygive
bool call_pygive(const std::string &line)
Definition: ExhumeHadronizer.cc:64
edm::errors::Configuration
Definition: EDMException.h:36
class-composition.parent
parent
Definition: class-composition.py:88
GenRunInfoProduct::setExternalXSecNLO
void setExternalXSecNLO(const XSec &xsec)
Definition: GenRunInfoProduct.h:28
pydat1
#define pydat1
Definition: ExhumeHadronizer.cc:37
call_cascha
void call_cascha()
Definition: CascadeWrapper.h:135
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
cahflav
#define cahflav
Definition: CascadeWrapper.h:64