CMS 3D CMS Logo

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