CMS 3D CMS Logo

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