CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EvtGenLHCInterface.cc
Go to the documentation of this file.
2 
12 
16 
19 
20 #include "HepMC/GenEvent.h"
21 // #include "HepMC/PythiaWrapper6_2.h"
22 
24 
25 #include "CLHEP/Random/RandFlat.h"
26 
27 using namespace gen;
28 using namespace edm;
29 
30 CLHEP::HepRandomEngine* EvtGenLHCInterface::fRandomEngine;
31 
32 extern "C"{
33 
34  void phoini_( void );
35  void photos_( int& );
36 
37  double phoran_(int *idummy)
38  {
39  return EvtGenLHCInterface::flat();
40  }
41  extern struct {
42  // bool qedrad[NMXHEP];
43  bool qedrad[4000]; // hardcoded for now...
44  } phoqed_;
45 
46 }
47 
48 
50 {
51 
52  ntotal = 0;
53  nevent = 0;
54  std::cout << " EvtGenProducer starting ... " << std::endl;
55 
56  the_engine = new myEvtRandomEngine(nullptr);
57 
58  // Get data from parameter set
59  edm::FileInPath decay_table = pset.getParameter<edm::FileInPath>("decay_table");
60  edm::FileInPath pdt = pset.getParameter<edm::FileInPath>("particle_property_file");
61  useDefault = pset.getUntrackedParameter<bool>("use_default_decay",true);
62  usePythia = pset.getUntrackedParameter<bool>("use_internal_pythia",true);
63  polarize_ids = pset.getUntrackedParameter<std::vector<int> >("particles_to_polarize",
64  std::vector<int>());
65  polarize_pol = pset.getUntrackedParameter<std::vector<double> >("particle_polarizations",
66  std::vector<double>());
67  if (polarize_ids.size() != polarize_pol.size()) {
68  throw cms::Exception("Configuration")
69  << "EvtGenProducer requires that the particles_to_polarize and particle_polarization\n"
70  "vectors be the same size. Please fix this in your configuration.";
71  }
72  for (unsigned int ndx = 0; ndx < polarize_ids.size(); ndx++) {
73  if (polarize_pol[ndx] < -1. || polarize_pol[ndx] > 1.) {
74  throw cms::Exception("Configuration")
75  << "EvtGenProducer error: particle polarizations must be in the range -1 < P < 1";
76  }
77  polarizations.insert(std::pair<int, float>(polarize_ids[ndx], polarize_pol[ndx]));
78  }
79 
80  edm::FileInPath user_decay = pset.getParameter<edm::FileInPath>("user_decay_file");
81  decay_table_s = decay_table.fullPath();
82  pdt_s = pdt.fullPath();
83  user_decay_s = user_decay.fullPath();
84 
85  //-->pythia_params = pset.getParameter< std::vector<std::string> >("processParameters");
86 
87 
88  // any number of alias names for forced decays can be specified using dynamic std vector of strings
89  forced_names = pset.getParameter< std::vector<std::string> >("list_forced_decays");
90 
91 
92  // fill up default list of particles to be declared stable in the "master generator"
93  // these are assumed to be PDG ID's
94  // in case of combo with Pythia6, translation is done in Pythia6Hadronizer
95  //
96  // Note: Pythia6's kc=43, 44, and 84 commented out because they're obsolete (per S.Mrenna)
97  //
98  m_PDGs.push_back( 300553 ) ;
99  m_PDGs.push_back( 511 ) ;
100  m_PDGs.push_back( 521 ) ;
101  m_PDGs.push_back( 523 ) ;
102  m_PDGs.push_back( 513 ) ;
103  m_PDGs.push_back( 533 ) ;
104  m_PDGs.push_back( 531 ) ;
105 
106  m_PDGs.push_back( 15 ) ;
107 
108  m_PDGs.push_back( 413 ) ;
109  m_PDGs.push_back( 423 ) ;
110  m_PDGs.push_back( 433 ) ;
111  m_PDGs.push_back( 411 ) ;
112  m_PDGs.push_back( 421 ) ;
113  m_PDGs.push_back( 431 ) ;
114  m_PDGs.push_back( 10411 );
115  m_PDGs.push_back( 10421 );
116  m_PDGs.push_back( 10413 );
117  m_PDGs.push_back( 10423 );
118  m_PDGs.push_back( 20413 );
119  m_PDGs.push_back( 20423 );
120 
121  m_PDGs.push_back( 415 );
122  m_PDGs.push_back( 425 );
123  m_PDGs.push_back( 10431 );
124  m_PDGs.push_back( 20433 );
125  m_PDGs.push_back( 10433 );
126  m_PDGs.push_back( 435 );
127 
128  m_PDGs.push_back( 310 );
129  m_PDGs.push_back( 311 );
130  m_PDGs.push_back( 313 );
131  m_PDGs.push_back( 323 );
132  m_PDGs.push_back( 10321 );
133  m_PDGs.push_back( 10311 );
134  m_PDGs.push_back( 10313 );
135  m_PDGs.push_back( 10323 );
136  m_PDGs.push_back( 20323 );
137  m_PDGs.push_back( 20313 );
138  m_PDGs.push_back( 325 );
139  m_PDGs.push_back( 315 );
140 
141  m_PDGs.push_back( 100313 );
142  m_PDGs.push_back( 100323 );
143  m_PDGs.push_back( 30313 );
144  m_PDGs.push_back( 30323 );
145  m_PDGs.push_back( 30343 );
146  m_PDGs.push_back( 30353 );
147  m_PDGs.push_back( 30363 );
148 
149  m_PDGs.push_back( 111 );
150  m_PDGs.push_back( 221 );
151  m_PDGs.push_back( 113 );
152  m_PDGs.push_back( 213 );
153  m_PDGs.push_back( 223 );
154  m_PDGs.push_back( 331 );
155  m_PDGs.push_back( 333 );
156  m_PDGs.push_back( 20213 );
157  m_PDGs.push_back( 20113 );
158  m_PDGs.push_back( 215 );
159  m_PDGs.push_back( 115 );
160  m_PDGs.push_back( 10213 );
161  m_PDGs.push_back( 10113 );
162  m_PDGs.push_back( 9000111 ); // PDG ID = 9000111, Pythia6 ID = 10111
163  m_PDGs.push_back( 9000211 ); // PDG ID = 9000211, Pythia6 ID = 10211
164  m_PDGs.push_back( 9010221 ); // PDG ID = 9010211, Pythia6 ID = ???
165  m_PDGs.push_back( 10221 );
166  m_PDGs.push_back( 20223 );
167  m_PDGs.push_back( 20333 );
168  m_PDGs.push_back( 225 );
169  m_PDGs.push_back( 9020221 ); // PDG ID = 9020211, Pythia6 ID = ???
170  m_PDGs.push_back( 335 );
171  m_PDGs.push_back( 10223 );
172  m_PDGs.push_back( 10333 );
173  m_PDGs.push_back( 100213 );
174  m_PDGs.push_back( 100113 );
175 
176  m_PDGs.push_back( 441 );
177  m_PDGs.push_back( 100441 );
178  m_PDGs.push_back( 443 );
179  m_PDGs.push_back( 100443 );
180  m_PDGs.push_back( 9000443 );
181  m_PDGs.push_back( 9010443 );
182  m_PDGs.push_back( 9020443 );
183  m_PDGs.push_back( 10441 );
184  m_PDGs.push_back( 20443 );
185  m_PDGs.push_back( 445 );
186 
187  m_PDGs.push_back( 30443 );
188  m_PDGs.push_back( 551 );
189  m_PDGs.push_back( 553 );
190  m_PDGs.push_back( 100553 );
191  m_PDGs.push_back( 200553 );
192  m_PDGs.push_back( 10551 );
193  m_PDGs.push_back( 20553 );
194  m_PDGs.push_back( 555 );
195  m_PDGs.push_back( 10553 );
196 
197  m_PDGs.push_back( 110551 );
198  m_PDGs.push_back( 120553 );
199  m_PDGs.push_back( 100555 );
200  m_PDGs.push_back( 210551 );
201  m_PDGs.push_back( 220553 );
202  m_PDGs.push_back( 200555 );
203  m_PDGs.push_back( 30553 );
204  m_PDGs.push_back( 20555 );
205 
206  m_PDGs.push_back( 557 );
207  m_PDGs.push_back( 130553 );
208  m_PDGs.push_back( 120555 );
209  m_PDGs.push_back( 100557 );
210  m_PDGs.push_back( 110553 );
211  m_PDGs.push_back( 210553 );
212  m_PDGs.push_back( 10555 );
213  m_PDGs.push_back( 110555 );
214 
215  m_PDGs.push_back( 4122 );
216  m_PDGs.push_back( 4132 );
217  // m_PDGs.push_back( 84 ); // obsolete
218  m_PDGs.push_back( 4112 );
219  m_PDGs.push_back( 4212 );
220  m_PDGs.push_back( 4232 );
221  m_PDGs.push_back( 4222 );
222  m_PDGs.push_back( 4322 );
223  m_PDGs.push_back( 4312 );
224 
225  m_PDGs.push_back( 13122 );
226  m_PDGs.push_back( 13124 );
227  m_PDGs.push_back( 23122 );
228  m_PDGs.push_back( 33122 );
229  m_PDGs.push_back( 43122 );
230  m_PDGs.push_back( 53122 );
231  m_PDGs.push_back( 13126 );
232  m_PDGs.push_back( 13212 );
233  m_PDGs.push_back( 13241 );
234 
235  m_PDGs.push_back( 3126 );
236  m_PDGs.push_back( 3124 );
237  m_PDGs.push_back( 3122 );
238  m_PDGs.push_back( 3222 );
239  m_PDGs.push_back( 2214 );
240  m_PDGs.push_back( 2224 );
241  m_PDGs.push_back( 3324 );
242  m_PDGs.push_back( 2114 );
243  m_PDGs.push_back( 1114 );
244  m_PDGs.push_back( 3112 );
245  m_PDGs.push_back( 3212 );
246  m_PDGs.push_back( 3114 );
247  m_PDGs.push_back( 3224 );
248  m_PDGs.push_back( 3214 );
249  m_PDGs.push_back( 3216 );
250  m_PDGs.push_back( 3322 );
251  m_PDGs.push_back( 3312 );
252  m_PDGs.push_back( 3314 );
253  m_PDGs.push_back( 3334 );
254 
255  m_PDGs.push_back( 4114 );
256  m_PDGs.push_back( 4214 );
257  m_PDGs.push_back( 4224 );
258  m_PDGs.push_back( 4314 );
259  m_PDGs.push_back( 4324 );
260  m_PDGs.push_back( 4332 );
261  m_PDGs.push_back( 4334 );
262  //m_PDGs.push_back( 43 ); // obsolete (?)
263  //m_PDGs.push_back( 44 ); // obsolete (?)
264  m_PDGs.push_back( 10443 );
265 
266  m_PDGs.push_back( 5122 );
267  m_PDGs.push_back( 5132 );
268  m_PDGs.push_back( 5232 );
269  m_PDGs.push_back( 5332 );
270  m_PDGs.push_back( 5222 );
271  m_PDGs.push_back( 5112 );
272  m_PDGs.push_back( 5212 );
273  m_PDGs.push_back( 541 );
274  m_PDGs.push_back( 14122 );
275  m_PDGs.push_back( 14124 );
276  m_PDGs.push_back( 5312 );
277  m_PDGs.push_back( 5322 );
278  m_PDGs.push_back( 10521 );
279  m_PDGs.push_back( 20523 );
280  m_PDGs.push_back( 10523 );
281 
282  m_PDGs.push_back( 525 );
283  m_PDGs.push_back( 10511 );
284  m_PDGs.push_back( 20513 );
285  m_PDGs.push_back( 10513 );
286  m_PDGs.push_back( 515 );
287  m_PDGs.push_back( 10531 );
288  m_PDGs.push_back( 20533 );
289  m_PDGs.push_back( 10533 );
290  m_PDGs.push_back( 535 );
291  m_PDGs.push_back( 543 );
292  m_PDGs.push_back( 545 );
293  m_PDGs.push_back( 5114 );
294  m_PDGs.push_back( 5224 );
295  m_PDGs.push_back( 5214 );
296  m_PDGs.push_back( 5314 );
297  m_PDGs.push_back( 5324 );
298  m_PDGs.push_back( 5334 );
299  m_PDGs.push_back( 10541 );
300  m_PDGs.push_back( 10543 );
301  m_PDGs.push_back( 20543 );
302 
303  m_PDGs.push_back( 4424 );
304  m_PDGs.push_back( 4422 );
305  m_PDGs.push_back( 4414 );
306  m_PDGs.push_back( 4412 );
307  m_PDGs.push_back( 4432 );
308  m_PDGs.push_back( 4434 );
309 
310  m_PDGs.push_back( 130 );
311 
312  // now check if we need to override default list of particles/IDs
313  if ( pset.exists("operates_on_particles") )
314  {
315  std::vector<int> tmpPIDs = pset.getParameter< std::vector<int> >("operates_on_particles");
316  if ( tmpPIDs.size() > 0 )
317  {
318  if ( tmpPIDs[0] > 0 ) // 0 means default !!!
319  {
320  m_PDGs.clear();
321  m_PDGs = tmpPIDs;
322  }
323  }
324  }
325  m_Py6Service = new Pythia6Service;
326 }
327 
329 {
330  std::cout << " EvtGenProducer terminating ... " << std::endl;
331  delete m_Py6Service;
332 }
333 
335 {
336  m_EvtGen = new EvtGen (decay_table_s.c_str(), pdt_s.c_str(), the_engine);
337  // 4th parameter should be rad cor - set to PHOTOS (default)
338 
339  if (!useDefault) m_EvtGen->readUDecay( user_decay_s.c_str() );
340 
341  nforced = 0;
342  for (auto const& forced_name : forced_names) {
343  ++nforced;
344  EvtId found = EvtPDL::getId(forced_name);
345  if (found.getId() == -1) {
346  throw cms::Exception("Configuration")
347  << "name in part list for forced decays not found: " << forced_name;
348  }
349  if (found.getId() == found.getAlias()) {
350  throw cms::Exception("Configuration")
351  << "name in part list for forced decays is not an alias: " << forced_name;
352  }
353  forced_Evt.push_back(found); // forced_Evt is the list of EvtId's
354  forced_Hep.push_back(EvtPDL::getStdHep(found)); // forced_Hep is the list of stdhep codes
355  }
356 
357  Pythia6Service::InstanceWrapper guard(m_Py6Service); // grab Py6 instance
358 
359  // Do here initialization of EvtPythia then restore original settings
360  if (usePythia) EvtPythia::pythiaInit(0);
361 
362 // no need - will be done via Pythia6Hadronizer::declareStableParticles
363 //
364 // for( std::vector<std::string>::const_iterator itPar = pythia_params.begin(); itPar != pythia_params.end(); ++itPar ) {
365 // call_pygive(*itPar);
366 // }
367 
368  return;
369 }
370 
371 HepMC::GenEvent* EvtGenLHCInterface::decay( HepMC::GenEvent* evt )
372 {
373  if(the_engine->engine() == nullptr) {
375  << "The EvtGen code attempted to use a random number engine while\n"
376  << "the engine pointer was null in EvtGenLHCInterface::decay. This might\n"
377  << "mean that the code was modified to generate a random number outside\n"
378  << "the event and beginLuminosityBlock methods, which is not allowed.\n";
379  }
380  CLHEP::RandFlat m_flat(*the_engine->engine(), 0., 1.);
381 
382  Pythia6Service::InstanceWrapper guard(m_Py6Service); // grab Py6 instance
383 
384  nevent++;
385  npartial = 0;
386  // std::cout << "nevent = " << nevent << std::endl ;
387 
388  int idHep,ipart,status;
389  EvtId idEvt;
390 
391  nPythia = evt->particles_size();
392  // FIX A MEMORY LEAK (RC)
393  // HepMC::GenEvent* newEvt = new HepMC::GenEvent( *evt );
394 
395  // First pass through undecayed Pythia particles to decay particles known to EvtGen left stable by Pythia
396  // except candidates to be forced which will be searched later to include EvtGen decay products
397  nlist = 0;
398 
399  // Notice dynamical use of evt
400  for (HepMC::GenEvent::particle_const_iterator p= evt->particles_begin(); p != evt->particles_end(); ++p)
401  {
402  status = (*p)->status();
403 
404  if(status==1) { // only not decayed (status = 1) particles
405 
406 
407  idHep = (*p)->pdg_id();
408  int do_force=0;
409  for(int i=0;i<nforced;i++) // First check if part with forced decay
410  { // In that case do not decay immediately
411  if(idHep == forced_Hep[i]) // (only 1 per event will be forced)
412  { // Fill list
413  update_candlist(i,*p);
414  do_force=1;
415  }
416  }
417  if(do_force==0) // particles with decays not forced are decayed immediately
418  {
419  idEvt = EvtPDL::evtIdFromStdHep(idHep);
420  ipart = idEvt.getId();
421  if (ipart==-1) continue; // particle not known to EvtGen
422  if (EvtDecayTable::getNMode(ipart)==0) continue; // particles stable for EvtGen
423  addToHepMC(*p,idEvt,evt,true); // generate decay
424  }
425  }
426  }
427 
428  if(nlist!=0)
429  {
430  // decide randomly which one to decay as alias
431  int which = (int)(nlist * m_flat.fire());
432  if (which == nlist) which = nlist-1;
433 
434  for(int k=0;k < nlist; k++)
435  {
436  if(k == which || !usePythia) {
437  addToHepMC(listp[k],forced_Evt[index[k]],evt,false); // decay as alias
438  }
439  else
440  {
441  int id_non_alias = forced_Evt[index[k]].getId();
442  EvtId non_alias(id_non_alias,id_non_alias); // create new EvtId with id = alias
443  addToHepMC(listp[k],non_alias,evt,false); // decay as standard (non alias)
444  }
445  }
446  }
447 
448  return evt;
449 
450 }
451 
452 void EvtGenLHCInterface::addToHepMC(HepMC::GenParticle* partHep, EvtId idEvt, HepMC::GenEvent* theEvent, bool del_daug )
453 {
454  // Set spin type
455  EvtSpinType::spintype stype = EvtPDL::getSpinType(idEvt);
456  EvtParticle* partEvt;
457  switch (stype){
458  case EvtSpinType::SCALAR:
459  partEvt = new EvtScalarParticle();
460  break;
461  case EvtSpinType::STRING:
462  partEvt = new EvtStringParticle();
463  break;
464  case EvtSpinType::DIRAC:
465  partEvt = new EvtDiracParticle();
466  break;
467  case EvtSpinType::VECTOR:
468  partEvt = new EvtVectorParticle();
469  break;
470  case EvtSpinType::RARITASCHWINGER:
471  partEvt = new EvtRaritaSchwingerParticle();
472  break;
473  case EvtSpinType::TENSOR:
474  partEvt = new EvtTensorParticle();
475  break;
476  case EvtSpinType::SPIN5HALF: case EvtSpinType::SPIN3: case EvtSpinType::SPIN7HALF: case EvtSpinType::SPIN4:
477  partEvt = new EvtHighSpinParticle();
478  break;
479  default:
480  std::cout << "Unknown spintype in EvtSpinType!" << std::endl;
481  return;
482  }
483 
484  // Generate decay
485  EvtVector4R momEvt;
486  HepMC::FourVector momHep = partHep->momentum();
487  momEvt.set(momHep.t(),momHep.x(),momHep.y(),momHep.z());
488  EvtVector4R posEvt;
489  HepMC::GenVertex* initVert = partHep->production_vertex();
490  HepMC::FourVector posHep = initVert->position();
491  posEvt.set(posHep.t(),posHep.x(),posHep.y(),posHep.z());
492  partEvt->init(idEvt,momEvt);
493  if (stype == EvtSpinType::DIRAC
494  && polarizations.find(partHep->pdg_id()) != polarizations.end()) {
495  // std::cout << "Polarize particle" << std::endl;
496  //Particle is spin 1/2, so we can polarize it.
497  //Check polarizations map for particle, grab its polarization if it exists
498  // and make the spin density matrix
499  float pol = polarizations.find(partHep->pdg_id())->second;
500  GlobalVector pPart(momHep.x(), momHep.y(), momHep.z());
501  //std::cout << "Polarizing particle with PDG ID "
502  // << partHep->pdg_id()
503  // << " at " << pol*100 << "%" << std::endl;
504  GlobalVector zHat(0., 0., 1.);
505  GlobalVector zCrossP = zHat.cross(pPart);
506  GlobalVector polVec = pol * zCrossP.unit();
507 
508  EvtSpinDensity theSpinDensity;
509  theSpinDensity.SetDim(2);
510  theSpinDensity.Set(0, 0, EvtComplex(1./2. + polVec.z()/2., 0.));
511  theSpinDensity.Set(0, 1, EvtComplex(polVec.x()/2., -polVec.y()/2.));
512  theSpinDensity.Set(1, 0, EvtComplex(polVec.x()/2., polVec.y()/2.));
513  theSpinDensity.Set(1, 1, EvtComplex(1./2. - polVec.z()/2., 0.));
514 
515  partEvt->setSpinDensityForwardHelicityBasis(theSpinDensity);
516 
517  } else {
518  partEvt->setDiagonalSpinDensity();
519  }
520  partEvt->decay();
521 
522  // extend the search of candidates to be forced to EvtGen decay products and delete their daughters **
523  // otherwise they wouldn't get their chance to take part in the forced decay lottery **
524  if (del_daug) go_through_daughters(partEvt); // recursive function go_through_daughters will do **
525 
526  // Change particle in stdHEP format
527  static EvtStdHep evtstdhep;
528 
529  evtstdhep.init();
530  partEvt->makeStdHep(evtstdhep);
531 
532  ntotal++;
533  partEvt->deleteTree();
534 
535  // ********* Now add to the HepMC Event **********
536 
537  // Then loop on evtstdhep to add vertexes...
538  HepMC::GenVertex* theVerts[200];
539  for (int ivert = 0; ivert < 200; ivert++) {
540  theVerts[ivert] = 0;
541  }
542 
543  for (int ipart = 0; ipart < evtstdhep.getNPart(); ipart++) {
544  int theMum = evtstdhep.getFirstMother(ipart);
545  if (theMum != -1 && !theVerts[theMum]) {
546  EvtVector4R theVpos = evtstdhep.getX4(ipart) + posEvt;
547  theVerts[theMum] =
548  new HepMC::GenVertex(HepMC::FourVector(theVpos.get(1),
549  theVpos.get(2),
550  theVpos.get(3),
551  theVpos.get(0)),0);
552  }
553  }
554 
555  // ...then particles
556  partHep->set_status(2);
557  if (theVerts[0]) theVerts[0]->add_particle_in( partHep );
558 
559  for (int ipart2 = 1; ipart2 < evtstdhep.getNPart(); ipart2++) {
560  int idHep = evtstdhep.getStdHepID(ipart2);
561  HepMC::GenParticle* thePart =
562  new HepMC::GenParticle( HepMC::FourVector(evtstdhep.getP4(ipart2).get(1),
563  evtstdhep.getP4(ipart2).get(2),
564  evtstdhep.getP4(ipart2).get(3),
565  evtstdhep.getP4(ipart2).get(0)),
566  idHep,
567  evtstdhep.getIStat(ipart2));
568  npartial++;
569  thePart->suggest_barcode(npartial + nPythia);
570  int theMum2 = evtstdhep.getFirstMother(ipart2);
571  if (theMum2 != -1 && theVerts[theMum2]) theVerts[theMum2]->add_particle_out( thePart );
572  if (theVerts[ipart2]) theVerts[ipart2]->add_particle_in( thePart );
573 
574  }
575 
576  for (int ipart3 = 0; ipart3 < evtstdhep.getNPart(); ipart3++) {
577  if (theVerts[ipart3]) theEvent->add_vertex( theVerts[ipart3] );
578  }
579 
580 }
581 
582 /*
583 void
584 EvtGenLHCInterface::call_pygive(const std::string& iParm ) {
585 
586  //call the fortran routine pygive with a fortran string
587  PYGIVE( iParm.c_str(), iParm.length() );
588 
589 }
590 */
591 
592 void
594 
595  int NDaug=part->getNDaug();
596  if(NDaug)
597  {
598  EvtParticle* Daughter;
599  for (int i=0;i<NDaug;i++)
600  {
601  Daughter=part->getDaug(i);
602  int idHep = EvtPDL::getStdHep(Daughter->getId());
603  int found=0;
604  for(int k=0;k<nforced;k++)
605  {
606  if(idHep == forced_Hep[k])
607  {
608  found = 1;
609  Daughter->deleteDaughters();
610  }
611  }
612  if (!found) go_through_daughters(Daughter);
613  }
614  }
615 }
616 
617 void
619 {
620  if(nlist<10) // not nice ... but is 10 a reasonable maximum?
621  {
622  bool isThere = false;
623  if (nlist) {
624  for (int check=0; check < nlist; check++) {
625  if (listp[check]->barcode() == thePart->barcode()) isThere = true;
626  }
627  }
628  if (!isThere) {
629  listp[nlist] = thePart;
630  index[nlist++] = theIndex;
631  }
632  }
633  else
634  {
635  throw cms::Exception("runtime")
636  << "more than 10 candidates to be forced ";
637  return;
638  }
639  return;
640 }
641 
642 void
643 EvtGenLHCInterface::setRandomEngine(CLHEP::HepRandomEngine* v) {
644  the_engine->setRandomEngine(v);
645  fRandomEngine=v;
646  m_Py6Service->setRandomEngine(v);
647 }
648 
650  if ( !fRandomEngine ) {
651  throw cms::Exception("LogicError")
652  << "EvtGenLHCInterface::flat: Attempt to generate random number when engine pointer is null\n"
653  << "This might mean that the code was modified to generate a random number outside the\n"
654  << "event and beginLuminosityBlock methods, which is not allowed.\n";
655  }
656  return fRandomEngine->flat();
657 }
658 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
def which
Definition: eostools.py:333
HepMC::GenEvent * decay(HepMC::GenEvent *)
static unsigned int getId(void)
T y() const
Definition: PV3DBase.h:63
bool exists(std::string const &parameterName) const
checks if a parameter exists
theIndex(0)
void photos_(int &)
void addToHepMC(HepMC::GenParticle *partHep, EvtId idEvt, HepMC::GenEvent *theEvent, bool del_daug)
double v[5][pyjets_maxn]
U second(std::pair< T, U > const &p)
int nevent
Definition: AMPTWrapper.h:74
double p[5][pyjets_maxn]
static CLHEP::HepRandomEngine * fRandomEngine
void setRandomEngine(CLHEP::HepRandomEngine *v)
bool check(const std::string &)
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
T z() const
Definition: PV3DBase.h:64
void phoini_(void)
bool qedrad[4000]
void go_through_daughters(EvtParticle *part)
int k[5][pyjets_maxn]
Vector3DBase unit() const
Definition: Vector3DBase.h:57
EvtGenLHCInterface(const edm::ParameterSet &)
part
Definition: HCALResponse.h:20
void update_candlist(int theIndex, HepMC::GenParticle *thePart)
struct @504 phoqed_
tuple cout
Definition: gather_cfg.py:121
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::string fullPath() const
Definition: FileInPath.cc:165
tuple status
Definition: ntuplemaker.py:245
T x() const
Definition: PV3DBase.h:62
double phoran_(int *idummy)