CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
gen::EvtGenInterface Class Reference

#include <EvtGenInterface.h>

Inheritance diagram for gen::EvtGenInterface:
gen::EvtGenInterfaceBase

Public Member Functions

virtual HepMC::GenEvent * decay (HepMC::GenEvent *)
 
 EvtGenInterface (const edm::ParameterSet &)
 
virtual void init ()
 
virtual const std::vector< int > & operatesOnParticles ()
 
virtual void setRandomEngine (CLHEP::HepRandomEngine *v)
 
 ~EvtGenInterface ()
 
- Public Member Functions inherited from gen::EvtGenInterfaceBase
 EvtGenInterfaceBase ()
 
virtual void SetPhotosDecayRandomEngine (CLHEP::HepRandomEngine *decayRandomEngine)
 
virtual const std::vector
< std::string > & 
specialSettings ()
 
virtual ~EvtGenInterfaceBase ()
 

Static Public Member Functions

static double flat ()
 

Private Member Functions

bool addToHepMC (HepMC::GenParticle *partHep, const EvtId &idEvt, HepMC::GenEvent *theEvent, bool allowMixing=true, bool mixforce=false, bool noforced=false)
 
bool findLastinChain (HepMC::GenParticle *&p)
 
bool hasnoDaughter (HepMC::GenParticle *p)
 
void SetDefault_m_PDGs ()
 
void update_particles (HepMC::GenParticle *partHep, HepMC::GenEvent *theEvent, HepMC::GenParticle *p, bool allowMixing=true, bool mixforce=false, bool noforced=false)
 

Private Attributes

int BmixingOption = 1
 
std::vector< EvtId > forced_id
 
std::vector< int > forced_pdgids
 
edm::ParameterSetfPSet
 
std::vector< int > ignore_pdgids
 
EvtGen * m_EvtGen
 
std::map< int, float > polarizations
 
std::vector< int > polarize_ids
 
std::vector< double > polarize_pol
 
myEvtRandomEnginethe_engine
 

Static Private Attributes

static CLHEP::HepRandomEngine * fRandomEngine
 

Additional Inherited Members

- Protected Attributes inherited from gen::EvtGenInterfaceBase
std::vector< std::string > fSpecialSettings
 
std::vector< int > m_PDGs
 

Detailed Description

Definition at line 37 of file EvtGenInterface.h.

Constructor & Destructor Documentation

EvtGenInterface::EvtGenInterface ( const edm::ParameterSet pset)

Definition at line 54 of file EvtGenInterface.cc.

54  {
55  fPSet=new ParameterSet(pset);
56  the_engine = new myEvtRandomEngine(nullptr);
57 }
edm::ParameterSet * fPSet
myEvtRandomEngine * the_engine
EvtGenInterface::~EvtGenInterface ( )

Definition at line 286 of file EvtGenInterface.cc.

286  {
287 }

Member Function Documentation

bool EvtGenInterface::addToHepMC ( HepMC::GenParticle *  partHep,
const EvtId &  idEvt,
HepMC::GenEvent *  theEvent,
bool  allowMixing = true,
bool  mixforce = false,
bool  noforced = false 
)
private

Definition at line 492 of file EvtGenInterface.cc.

References funct::abs(), Vector3DBase< T, FrameTag >::cross(), configurableAnalysis::GenParticle, i, gen::p, dbtoconf::parent, edm::second(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

492  {
493  // Set up the parent particle from the HepMC GenEvent tree.
494  //EvtVector4R pInit(EvtPDL::getMass(idEvt),partHep->momentum().px(),partHep->momentum().py(),partHep->momentum().pz());
495  EvtVector4R pInit(partHep->momentum().e(),partHep->momentum().px(),partHep->momentum().py(),partHep->momentum().pz());
496  EvtParticle* parent = EvtParticleFactory::particleFactory(idEvt, pInit);
497  // Reset polarization if requested....
498  if(EvtPDL::getSpinType(idEvt) == EvtSpinType::DIRAC && polarizations.count(partHep->pdg_id())>0){
499  HepMC::FourVector momHep = partHep->momentum();
500  EvtVector4R momEvt;
501  momEvt.set(momHep.t(),momHep.x(),momHep.y(),momHep.z());
502  // Particle is spin 1/2, so we can polarize it. Check polarizations map for particle, grab its polarization if it exists
503  // and make the spin density matrix
504  float pol = polarizations.find(partHep->pdg_id())->second;
505  GlobalVector pPart(momHep.x(), momHep.y(), momHep.z());
506  GlobalVector zHat(0., 0., 1.);
507  GlobalVector zCrossP = zHat.cross(pPart);
508  GlobalVector polVec = pol * zCrossP.unit();
509  EvtSpinDensity theSpinDensity;
510  theSpinDensity.setDim(2);
511  theSpinDensity.set(0, 0, EvtComplex(1./2. + polVec.z()/2., 0.));
512  theSpinDensity.set(0, 1, EvtComplex(polVec.x()/2., -polVec.y()/2.));
513  theSpinDensity.set(1, 0, EvtComplex(polVec.x()/2., polVec.y()/2.));
514  theSpinDensity.set(1, 1, EvtComplex(1./2. - polVec.z()/2., 0.));
515  parent->setSpinDensityForwardHelicityBasis(theSpinDensity);
516  }
517  if(parent){
518  // Generate the event
519  m_EvtGen->generateDecay(parent);
520 
521  // Write out the results
522  EvtHepMCEvent evtHepMCEvent;
523  evtHepMCEvent.constructEvent(parent);
524  HepMC::GenEvent* evtGenHepMCTree = evtHepMCEvent.getEvent();
525 
526  // reject events where forced decay is mixed and mixforce is not on
527  if(!mixforce){
528  bool isforced=false;
529  HepMC::GenParticle* p=(*evtGenHepMCTree->particles_begin());
530  for(unsigned int i=0;i<forced_pdgids.size();i++){
531  if(p->pdg_id()==forced_pdgids[i]){
532  isforced=true;
533  break;
534  }
535  }
536  if(isforced){
537  if(p->end_vertex()){
538  if(p->end_vertex()->particles_out_size()!=0){
539  for(HepMC::GenVertex::particles_out_const_iterator d=p->end_vertex()->particles_out_const_begin(); d!=p->end_vertex()->particles_out_const_end();d++){
540  if(abs((*d)->pdg_id())==abs(p->pdg_id())){
541  return false;
542  }
543  }
544  }
545  }
546  }
547  }
548 
549  // update the event using a recursive function
550  if(!evtGenHepMCTree->particles_empty()) update_particles(partHep,theEvent,(*evtGenHepMCTree->particles_begin()),allowMixing,mixforce,noforced);
551 
552  //clean up
553  parent->deleteTree();
554  }
555  return true;
556 }
int i
Definition: DBlmapReader.cc:9
void update_particles(HepMC::GenParticle *partHep, HepMC::GenEvent *theEvent, HepMC::GenParticle *p, bool allowMixing=true, bool mixforce=false, bool noforced=false)
list parent
Definition: dbtoconf.py:74
T y() const
Definition: PV3DBase.h:63
std::vector< int > forced_pdgids
U second(std::pair< T, U > const &p)
double p[5][pyjets_maxn]
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
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< int, float > polarizations
Vector3DBase unit() const
Definition: Vector3DBase.h:57
T x() const
Definition: PV3DBase.h:62
HepMC::GenEvent * EvtGenInterface::decay ( HepMC::GenEvent *  evt)
virtual

Reimplemented from gen::EvtGenInterfaceBase.

Definition at line 412 of file EvtGenInterface.cc.

References funct::abs(), edm::hlt::Exception, i, customizeTrackingMonitorSeedNumber::idx, j, edm::errors::LogicError, and gen::p.

412  {
413  if(the_engine->engine() == nullptr){
415  << "The EvtGen code attempted to use a random number engine while\n"
416  << "the engine pointer was null in EvtGenInterface::decay. This might\n"
417  << "mean that the code was modified to generate a random number outside\n"
418  << "the event and beginLuminosityBlock methods, which is not allowed.\n";
419  }
420  CLHEP::RandFlat m_flat(*the_engine->engine(), 0., 1.);
421 
422  // decay all request unforced particles
423  for (HepMC::GenEvent::particle_const_iterator p= evt->particles_begin(); p != evt->particles_end(); ++p){
424  if((*p)->status()==1){ // all particles to be decays are set to status 1 by generator.hadronizer
425  int idHep = (*p)->pdg_id();
426  bool isignore=false;
427  for(unsigned int i=0;i<ignore_pdgids.size();i++){
428  if(idHep==ignore_pdgids[i])isignore=true;
429  }
430  if(!isignore){
431  bool isforced=false;
432  bool isDefaultEvtGen=false;
433  EvtId idEvt = EvtPDL::evtIdFromStdHep(idHep);
434  for(unsigned int i=0;i<forced_pdgids.size();i++){
435  if(idHep==forced_pdgids[i]){
436  isforced=true;
437  break;
438  }
439  }
440  for(unsigned int i=0;i<m_PDGs.size();i++){
441  if(abs(idHep)==abs(m_PDGs[i])){
442  isDefaultEvtGen=true;
443  break;
444  }
445  }
446  int ipart = idEvt.getId();
447  EvtDecayTable *evtDecayTable=EvtDecayTable::getInstance();
448  if(!isforced && isDefaultEvtGen && ipart!=-1 && evtDecayTable->getNMode(ipart)!=0){
449  addToHepMC(*p,idEvt,evt,true,true,true); // generate decay
450  }
451  }
452  }
453  }
454  // find all forced particles (after mixing)
455  unsigned int nisforced=0;
456  std::vector<std::vector<HepMC::GenParticle*> > forcedparticles;
457  for(unsigned int i=0;i<forced_pdgids.size();i++) forcedparticles.push_back(std::vector<HepMC::GenParticle*>());
458  for (HepMC::GenEvent::particle_const_iterator p= evt->particles_begin(); p != evt->particles_end(); ++p){
459  if((*p)->status()==1){
460  int idHep = (*p)->pdg_id();
461  for(unsigned int i=0;i<forced_pdgids.size();i++){
462  if(idHep==forced_pdgids[i]){
463  forcedparticles.at(i).push_back(*p);
464  nisforced++;
465  }
466  }
467  }
468  }
469  // decay all forced particles (only 1/event is forced)... with no mixing allowed
470  unsigned int which = (unsigned int)(nisforced*flat());
471  if(which==nisforced && nisforced>0) which=nisforced-1;
472  unsigned int idx=0;
473  for(unsigned int i=0; i<forcedparticles.size();i++){
474  for(unsigned int j=0; j<forcedparticles.at(i).size();j++){
475  EvtId idEvt = EvtPDL::evtIdFromStdHep(forcedparticles.at(i).at(j)->pdg_id());
476  if(idx==which){idEvt = forced_id[i]; }
477  bool decayed=false;
478  while(!decayed){decayed=addToHepMC(forcedparticles.at(i).at(j),idEvt,evt,false,false,false);} // mixing already done (false)
479  idx++;
480  }
481  }
482 
483  // add code to ensure all particles have an end vertex and if they are undecayed with no end vertes set to status 1
484  for (HepMC::GenEvent::particle_const_iterator p= evt->particles_begin(); p != evt->particles_end(); ++p){
485  if((*p)->end_vertex() && (*p)->status() == 1)(*p)->set_status(2);
486  if((*p)->end_vertex() && (*p)->end_vertex()->particles_out_size()==0) edm::LogWarning("EvtGenInterface::decay error: empty end vertex!");
487  }
488  return evt;
489 }
int i
Definition: DBlmapReader.cc:9
static double flat()
std::vector< int > forced_pdgids
double p[5][pyjets_maxn]
CLHEP::HepRandomEngine * engine() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
std::vector< EvtId > forced_id
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
myEvtRandomEngine * the_engine
std::vector< int > ignore_pdgids
bool addToHepMC(HepMC::GenParticle *partHep, const EvtId &idEvt, HepMC::GenEvent *theEvent, bool allowMixing=true, bool mixforce=false, bool noforced=false)
bool EvtGenInterface::findLastinChain ( HepMC::GenParticle *&  p)
private

Definition at line 655 of file EvtGenInterface.cc.

References funct::abs().

655  {
656  if(p->end_vertex()){
657  if(p->end_vertex()->particles_out_size()!=0){
658  for(HepMC::GenVertex::particles_out_const_iterator d=p->end_vertex()->particles_out_const_begin(); d!=p->end_vertex()->particles_out_const_end();d++){
659  if(abs((*d)->pdg_id())==abs(p->pdg_id())){
660  p=*d;
662  return false;
663  }
664  }
665  }
666  }
667  return true;
668 }
double p[5][pyjets_maxn]
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool findLastinChain(HepMC::GenParticle *&p)
double EvtGenInterface::flat ( )
static

Definition at line 644 of file EvtGenInterface.cc.

References edm::hlt::Exception.

644  {
645  if ( !fRandomEngine ) {
646  throw cms::Exception("LogicError")
647  << "EvtGenInterface::flat: Attempt to generate random number when engine pointer is null\n"
648  << "This might mean that the code was modified to generate a random number outside the\n"
649  << "event and beginLuminosityBlock methods, which is not allowed.\n";
650  }
651  return fRandomEngine->flat();
652 }
static CLHEP::HepRandomEngine * fRandomEngine
bool EvtGenInterface::hasnoDaughter ( HepMC::GenParticle *  p)
private

Definition at line 670 of file EvtGenInterface.cc.

670  {
671  if(p->end_vertex()){
672  if(p->end_vertex()->particles_out_size()!=0){
673  return false;
674  }
675  }
676  return true;
677 }
double p[5][pyjets_maxn]
void EvtGenInterface::init ( void  )
virtual

Reimplemented from gen::EvtGenInterfaceBase.

Definition at line 289 of file EvtGenInterface.cc.

References edm::hlt::Exception, cmsRelvalreport::exit, newFWLiteAna::found, edm::FileInPath::fullPath(), getId(), EvtModelUserReg::getUserModels(), i, j, mergeVDriftHistosByStation::name, NULL, and AlCaHLTBitMon_QueryRunRegistry::string.

289  {
290  // flags for pythia8
291  fSpecialSettings.push_back("Pythia8:ParticleDecays:mixB = off");
292  //
293 
294  edm::FileInPath decay_table(fPSet->getParameter<std::string>("decay_table"));
295  edm::FileInPath pdt(fPSet->getParameter<edm::FileInPath>("particle_property_file"));
296 
297  bool usePythia = fPSet->getUntrackedParameter<bool>("use_internal_pythia",true);
298  bool useTauola = fPSet->getUntrackedParameter<bool>("use_internal_tauola",true);
299  bool usePhotos = fPSet->getUntrackedParameter<bool>("use_internal_photos",true);
300 
301  //Setup evtGen following instructions on http://evtgen.warwick.ac.uk/docs/external/
302  bool convertPythiaCodes=fPSet->getUntrackedParameter<bool>("convertPythiaCodes",true); // Specify if we want to use Pythia 6 physics codes for decays
303  std::string pythiaDir = getenv ("PYTHIA8DATA"); // Specify the pythia xml data directory to use the default PYTHIA8DATA location
304  if(pythiaDir==NULL){
305  edm::LogError("EvtGenInterface::~EvtGenInterface") << "EvtGenInterface::init() PYTHIA8DATA not defined. Terminating program ";
306  exit(0);
307  }
308  std::string photonType("gamma"); // Specify the photon type for Photos
309  bool useEvtGenRandom(true); // Specify if we want to use the EvtGen random number engine for these generators
310 
311  // Set up the default external generator list: Photos, Pythia and/or Tauola
312  EvtExternalGenList genList(convertPythiaCodes, pythiaDir, photonType, useEvtGenRandom);
313  EvtAbsRadCorr* radCorrEngine=0;
314  if(usePhotos) radCorrEngine = genList.getPhotosModel(); // Get interface to radiative correction engine
315  std::list<EvtDecayBase*> extraModels = genList.getListOfModels(); // get interface to Pythia and Tauola
316  std::list<EvtDecayBase*> myExtraModels;
317  for(unsigned int i=0; i<extraModels.size();i++){
318  std::list<EvtDecayBase*>::iterator it = extraModels.begin();
319  std::advance(it,i);
320  TString name=(*it)->getName();
321  if(name.Contains("PYTHIA") && usePythia) myExtraModels.push_back(*it);
322  if(name.Contains("TAUOLA") && useTauola) myExtraModels.push_back(*it);
323  }
324 
325  //Set up user evtgen models
326 
327  EvtModelUserReg userList;
328  std::list<EvtDecayBase*> userModels = userList.getUserModels(); // get interface to user models
329  for(unsigned int i=0; i<userModels.size();i++){
330  std::list<EvtDecayBase*>::iterator it = userModels.begin();
331  std::advance(it,i);
332  TString name=(*it)->getName();
333  edm::LogInfo("EvtGenInterface::~EvtGenInterface") << "Adding user model: "<<name;
334  myExtraModels.push_back(*it);
335  }
336 
337 
338 
339  // Set up the incoherent (1) or coherent (0) B mixing option
340  BmixingOption = fPSet->getUntrackedParameter<int>("B_Mixing",1);
341  if(BmixingOption!=0 && BmixingOption!=1){
342  throw cms::Exception("Configuration") << "EvtGenProducer requires B_Mixing to be 0 (coherent) or 1 (incoherent) \n"
343  "Please fix this in your configuration.";
344  }
345 
347  // Create the EvtGen generator object, passing the external generators
348  m_EvtGen = new EvtGen(decay_table.fullPath().c_str(),pdt.fullPath().c_str(),the_engine,radCorrEngine,&myExtraModels,BmixingOption);
349 
350  // Add additional user information
351  if (fPSet->exists("user_decay_file")){
352  std::vector<std::string> user_decays = fPSet->getParameter<std::vector<std::string> >("user_decay_file");
353  for(unsigned int i=0;i<user_decays.size();i++){
354  edm::FileInPath user_decay(user_decays.at(i));
355  m_EvtGen->readUDecay(user_decay.fullPath().c_str());
356  }
357  }
358 
359  // setup pdgid which the generator/hadronizer should not decay
360  if (fPSet->exists("operates_on_particles")){
361  std::vector<int> tmpPIDs = fPSet->getParameter< std::vector<int> >("operates_on_particles");
362  m_PDGs.clear();
363  bool goodinput=false;
364  if(tmpPIDs.size()>0){ if(tmpPIDs.size()==1 && tmpPIDs[0]==0) goodinput=false;}
365  else{goodinput=false;}
366  if(goodinput) m_PDGs = tmpPIDs;
367  else SetDefault_m_PDGs();
368  }
369  else SetDefault_m_PDGs();
370 
371  for(unsigned int i=0;i<m_PDGs.size();i++){
372  edm::LogInfo("EvtGenInterface::~EvtGenInterface") << "EvtGenInterface::init() Particles to Operate on: " << m_PDGs[i];
373  }
374 
375  // Obtain information to set polarization of particles
376  polarize_ids = fPSet->getUntrackedParameter<std::vector<int> >("particles_to_polarize",std::vector<int>());
377  polarize_pol = fPSet->getUntrackedParameter<std::vector<double> >("particle_polarizations",std::vector<double>());
378  if (polarize_ids.size() != polarize_pol.size()) {
379  throw cms::Exception("Configuration") << "EvtGenProducer requires that the particles_to_polarize and particle_polarization\n"
380  "vectors be the same size. Please fix this in your configuration.";
381  }
382  for (unsigned int ndx = 0; ndx < polarize_ids.size(); ndx++) {
383  if (polarize_pol[ndx] < -1. || polarize_pol[ndx] > 1.) {
384  throw cms::Exception("Configuration") << "EvtGenProducer error: particle polarizations must be in the range -1 < P < 1";
385  }
386  polarizations.insert(std::pair<int, float>(polarize_ids[ndx], polarize_pol[ndx]));
387  }
388 
389  // Forced decays are particles that are aliased and forced to be decayed by EvtGen
390  if (fPSet->exists("list_forced_decays")){
391  std::vector<std::string> forced_names = fPSet->getParameter< std::vector<std::string> >("list_forced_decays");
392  for(unsigned int i=0;i<forced_names.size();i++){
393  EvtId found = EvtPDL::getId(forced_names[i]);
394  if(found.getId() == -1) throw cms::Exception("Configuration") << "name in part list for ignored decays not found: " << forced_names[i];
395  if(found.getId() == found.getAlias()) throw cms::Exception("Configuration") << "name of ignored decays is not an alias: " << forced_names[i];
396  forced_id.push_back(found);
397  forced_pdgids.push_back(EvtPDL::getStdHep(found)); // force_pdgids is the list of stdhep codes
398  }
399  }
400  edm::LogInfo("EvtGenInterface::~EvtGenInterface") << "Number of Forced Paricles is: " << forced_pdgids.size() << std::endl;
401  for(unsigned int j=0;j<forced_id.size();j++){
402  edm::LogInfo("EvtGenInterface::~EvtGenInterface") << "Forced Paricles are: " << forced_pdgids.at(j) << " " << forced_id.at(j) << std::endl;
403  }
404  // Ignore decays are particles that are not to be decayed by EvtGen
405  if (fPSet->exists("list_ignored_pdgids")){
406  ignore_pdgids = fPSet->getUntrackedParameter< std::vector<int> >("list_ignored_pdgids");
407  }
408 
409  return;
410 }
T getParameter(std::string const &) const
edm::ParameterSet * fPSet
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
static unsigned int getId(void)
bool exists(std::string const &parameterName) const
checks if a parameter exists
#define NULL
Definition: scimark2.h:8
std::vector< int > polarize_ids
std::vector< int > forced_pdgids
int j
Definition: DBlmapReader.cc:9
std::map< int, float > polarizations
std::vector< EvtId > forced_id
std::vector< double > polarize_pol
myEvtRandomEngine * the_engine
std::vector< std::string > fSpecialSettings
std::list< EvtDecayBase * > getUserModels()
std::vector< int > ignore_pdgids
virtual const std::vector<int>& gen::EvtGenInterface::operatesOnParticles ( )
inlinevirtual

Reimplemented from gen::EvtGenInterfaceBase.

Definition at line 44 of file EvtGenInterface.h.

References gen::EvtGenInterfaceBase::m_PDGs.

44 { return m_PDGs; }
void EvtGenInterface::SetDefault_m_PDGs ( )
private

Definition at line 59 of file EvtGenInterface.cc.

References i.

59  {
60  // fill up default list of particles to be declared stable in the "master generator"
61  // these are assumed to be PDG ID's
62  //
63  // Note: Pythia6's kc=43, 44, and 84 commented out because they're obsolete (per S.Mrenna)
64  //
65  m_PDGs.push_back( 300553 ) ;
66  m_PDGs.push_back( 511 ) ;
67  m_PDGs.push_back( 521 ) ;
68  m_PDGs.push_back( 523 ) ;
69  m_PDGs.push_back( 513 ) ;
70  m_PDGs.push_back( 533 ) ;
71  m_PDGs.push_back( 531 ) ; //B_s0
72 
73  m_PDGs.push_back( 15 ) ;
74 
75  m_PDGs.push_back( 413 ) ;
76  m_PDGs.push_back( 423 ) ;
77  m_PDGs.push_back( 433 ) ;
78  m_PDGs.push_back( 411 ) ;
79  m_PDGs.push_back( 421 ) ;
80  m_PDGs.push_back( 431 ) ;
81  m_PDGs.push_back( 10411 );
82  m_PDGs.push_back( 10421 );
83  m_PDGs.push_back( 10413 );
84  m_PDGs.push_back( 10423 );
85  m_PDGs.push_back( 20413 );
86  m_PDGs.push_back( 20423 );
87 
88  m_PDGs.push_back( 415 );
89  m_PDGs.push_back( 425 );
90  m_PDGs.push_back( 10431 );
91  m_PDGs.push_back( 20433 );
92  m_PDGs.push_back( 10433 );
93  m_PDGs.push_back( 435 );
94 
95  m_PDGs.push_back( 310 );
96  m_PDGs.push_back( 311 );
97  m_PDGs.push_back( 313 );
98  m_PDGs.push_back( 323 );
99  m_PDGs.push_back( 10321 );
100  m_PDGs.push_back( 10311 );
101  m_PDGs.push_back( 10313 );
102  m_PDGs.push_back( 10323 );
103  m_PDGs.push_back( 20323 );
104  m_PDGs.push_back( 20313 );
105  m_PDGs.push_back( 325 );
106  m_PDGs.push_back( 315 );
107 
108  m_PDGs.push_back( 100313 );
109  m_PDGs.push_back( 100323 );
110  m_PDGs.push_back( 30313 );
111  m_PDGs.push_back( 30323 );
112  m_PDGs.push_back( 30343 );
113  m_PDGs.push_back( 30353 );
114  m_PDGs.push_back( 30363 );
115 
116  m_PDGs.push_back( 111 );
117  m_PDGs.push_back( 221 );
118  m_PDGs.push_back( 113 );
119  m_PDGs.push_back( 213 );
120  m_PDGs.push_back( 223 );
121  m_PDGs.push_back( 331 );
122  m_PDGs.push_back( 333 );
123  m_PDGs.push_back( 20213 );
124  m_PDGs.push_back( 20113 );
125  m_PDGs.push_back( 215 );
126  m_PDGs.push_back( 115 );
127  m_PDGs.push_back( 10213 );
128  m_PDGs.push_back( 10113 );
129  m_PDGs.push_back( 9000111 ); // PDG ID = 9000111, Pythia6 ID = 10111
130  m_PDGs.push_back( 9000211 ); // PDG ID = 9000211, Pythia6 ID = 10211
131  m_PDGs.push_back( 9010221 ); // PDG ID = 9010211, Pythia6 ID = ???
132  m_PDGs.push_back( 10221 );
133  m_PDGs.push_back( 20223 );
134  m_PDGs.push_back( 20333 );
135  m_PDGs.push_back( 225 );
136  m_PDGs.push_back( 9020221 ); // PDG ID = 9020211, Pythia6 ID = ???
137  m_PDGs.push_back( 335 );
138  m_PDGs.push_back( 10223 );
139  m_PDGs.push_back( 10333 );
140  m_PDGs.push_back( 100213 );
141  m_PDGs.push_back( 100113 );
142 
143  m_PDGs.push_back( 441 );
144  m_PDGs.push_back( 100441 );
145  m_PDGs.push_back( 443 );
146  m_PDGs.push_back( 100443 );
147  m_PDGs.push_back( 9000443 );
148  m_PDGs.push_back( 9010443 );
149  m_PDGs.push_back( 9020443 );
150  m_PDGs.push_back( 10441 );
151  m_PDGs.push_back( 20443 );
152  m_PDGs.push_back( 445 );
153 
154  m_PDGs.push_back( 30443 );
155  m_PDGs.push_back( 551 );
156  m_PDGs.push_back( 553 );
157  m_PDGs.push_back( 100553 );
158  m_PDGs.push_back( 200553 );
159  m_PDGs.push_back( 10551 );
160  m_PDGs.push_back( 20553 );
161  m_PDGs.push_back( 555 );
162  m_PDGs.push_back( 10553 );
163 
164  m_PDGs.push_back( 110551 );
165  m_PDGs.push_back( 120553 );
166  m_PDGs.push_back( 100555 );
167  m_PDGs.push_back( 210551 );
168  m_PDGs.push_back( 220553 );
169  m_PDGs.push_back( 200555 );
170  m_PDGs.push_back( 30553 );
171  m_PDGs.push_back( 20555 );
172 
173  m_PDGs.push_back( 557 );
174  m_PDGs.push_back( 130553 );
175  m_PDGs.push_back( 120555 );
176  m_PDGs.push_back( 100557 );
177  m_PDGs.push_back( 110553 );
178  m_PDGs.push_back( 210553 );
179  m_PDGs.push_back( 10555 );
180  m_PDGs.push_back( 110555 );
181 
182  m_PDGs.push_back( 4122 );
183  m_PDGs.push_back( 4132 );
184  // m_PDGs.push_back( 84 ); // obsolete
185  m_PDGs.push_back( 4112 );
186  m_PDGs.push_back( 4212 );
187  m_PDGs.push_back( 4232 );
188  m_PDGs.push_back( 4222 );
189  m_PDGs.push_back( 4322 );
190  m_PDGs.push_back( 4312 );
191 
192  m_PDGs.push_back( 13122 );
193  m_PDGs.push_back( 13124 );
194  m_PDGs.push_back( 23122 );
195  m_PDGs.push_back( 33122 );
196  m_PDGs.push_back( 43122 );
197  m_PDGs.push_back( 53122 );
198  m_PDGs.push_back( 13126 );
199  m_PDGs.push_back( 13212 );
200  //m_PDGs.push_back( 13241 ); unknown particle -typo?
201 
202  m_PDGs.push_back( 3126 );
203  m_PDGs.push_back( 3124 );
204  m_PDGs.push_back( 3122 );
205  m_PDGs.push_back( 3222 );
206  m_PDGs.push_back( 2214 );
207  m_PDGs.push_back( 2224 );
208  m_PDGs.push_back( 3324 );
209  m_PDGs.push_back( 2114 );
210  m_PDGs.push_back( 1114 );
211  m_PDGs.push_back( 3112 );
212  m_PDGs.push_back( 3212 );
213  m_PDGs.push_back( 3114 );
214  m_PDGs.push_back( 3224 );
215  m_PDGs.push_back( 3214 );
216  m_PDGs.push_back( 3216 );
217  m_PDGs.push_back( 3322 );
218  m_PDGs.push_back( 3312 );
219  m_PDGs.push_back( 3314 );
220  m_PDGs.push_back( 3334 );
221 
222  m_PDGs.push_back( 4114 );
223  m_PDGs.push_back( 4214 );
224  m_PDGs.push_back( 4224 );
225  m_PDGs.push_back( 4314 );
226  m_PDGs.push_back( 4324 );
227  m_PDGs.push_back( 4332 );
228  m_PDGs.push_back( 4334 );
229  //m_PDGs.push_back( 43 ); // obsolete (?)
230  //m_PDGs.push_back( 44 ); // obsolete (?)
231  m_PDGs.push_back( 10443 );
232 
233  m_PDGs.push_back( 5122 );
234  m_PDGs.push_back( 5132 );
235  m_PDGs.push_back( 5232 );
236  m_PDGs.push_back( 5332 );
237  m_PDGs.push_back( 5222 );
238  m_PDGs.push_back( 5112 );
239  m_PDGs.push_back( 5212 );
240  m_PDGs.push_back( 541 );
241  m_PDGs.push_back( 14122 );
242  m_PDGs.push_back( 14124 );
243  m_PDGs.push_back( 5312 );
244  m_PDGs.push_back( 5322 );
245  m_PDGs.push_back( 10521 );
246  m_PDGs.push_back( 20523 );
247  m_PDGs.push_back( 10523 );
248 
249  m_PDGs.push_back( 525 );
250  m_PDGs.push_back( 10511 );
251  m_PDGs.push_back( 20513 );
252  m_PDGs.push_back( 10513 );
253  m_PDGs.push_back( 515 );
254  m_PDGs.push_back( 10531 );
255  m_PDGs.push_back( 20533 );
256  m_PDGs.push_back( 10533 );
257  m_PDGs.push_back( 535 );
258  m_PDGs.push_back( 543 );
259  m_PDGs.push_back( 545 );
260  m_PDGs.push_back( 5114 );
261  m_PDGs.push_back( 5224 );
262  m_PDGs.push_back( 5214 );
263  m_PDGs.push_back( 5314 );
264  m_PDGs.push_back( 5324 );
265  m_PDGs.push_back( 5334 );
266  m_PDGs.push_back( 10541 );
267  m_PDGs.push_back( 10543 );
268  m_PDGs.push_back( 20543 );
269 
270  m_PDGs.push_back( 4424 );
271  m_PDGs.push_back( 4422 );
272  m_PDGs.push_back( 4414 );
273  m_PDGs.push_back( 4412 );
274  m_PDGs.push_back( 4432 );
275  m_PDGs.push_back( 4434 );
276 
277  m_PDGs.push_back( 130 );
278 
279 
280  for(unsigned int i=0; i<m_PDGs.size();i++){
281  int pdt=HepPID::translatePythiatoPDT (m_PDGs.at(i));
282  if(pdt!=m_PDGs.at(i))m_PDGs.at(i)=pdt;
283  }
284 }
int i
Definition: DBlmapReader.cc:9
void EvtGenInterface::setRandomEngine ( CLHEP::HepRandomEngine *  v)
virtual

Implements gen::EvtGenInterfaceBase.

Definition at line 639 of file EvtGenInterface.cc.

References gen::v.

639  {
642 }
double v[5][pyjets_maxn]
static CLHEP::HepRandomEngine * fRandomEngine
myEvtRandomEngine * the_engine
void setRandomEngine(CLHEP::HepRandomEngine *v)
void EvtGenInterface::update_particles ( HepMC::GenParticle *  partHep,
HepMC::GenEvent *  theEvent,
HepMC::GenParticle *  p,
bool  allowMixing = true,
bool  mixforce = false,
bool  noforced = false 
)
private

Definition at line 559 of file EvtGenInterface.cc.

References funct::abs(), createTree::dd, configurableAnalysis::GenParticle, i, SequenceTypes::ignore(), and ntuplemaker::status.

559  {
560  if(p->end_vertex()){
561  if(!partHep->end_vertex()){
562  HepMC::GenVertex* vtx = new HepMC::GenVertex(p->end_vertex()->position());
563  theEvent->add_vertex(vtx);
564  vtx->add_particle_in(partHep);
565  }
566  if(p->end_vertex()->particles_out_size()!=0){
567  for(HepMC::GenVertex::particles_out_const_iterator d=p->end_vertex()->particles_out_const_begin(); d!=p->end_vertex()->particles_out_const_end();d++){
568 
569  // set status to 1 for forced
570  bool isforced=false;
571  for(unsigned int i=0;i<forced_pdgids.size();i++){
572  if((*d)->pdg_id()==forced_pdgids[i]){
573  isforced=true;
574  break;
575  }
576  }
577 
578  // check if decay products are the results of mixing
579  bool mforced=false;
580  bool hasmixing=false;
581  if((*d)->end_vertex()){
582  if((*d)->end_vertex()->particles_out_size()!=0){
583  for(HepMC::GenVertex::particles_out_const_iterator dd=(*d)->end_vertex()->particles_out_const_begin(); dd!=(*d)->end_vertex()->particles_out_const_end();dd++){
584  if(abs((*dd)->pdg_id())==abs((*d)->pdg_id())){
585  if(mixforce && isforced) mforced=true; // turn off for mixing
586  if(allowMixing) hasmixing=true;
587  }
588  }
589  }
590  }
591  //check it particle is the result of mixing
592  bool ismixing=false;
593  if(abs(p->pdg_id())==abs((*d)->pdg_id())) ismixing=true;
594 
595  // Create daughter and add to event
596  int status =(*d)->status();
597  if(isforced && !mforced) status=1;
598  if(isforced && mforced) status=2;
599  HepMC::GenParticle *daughter = new HepMC::GenParticle((*d)->momentum(),(*d)->pdg_id(),status);
600  daughter->suggest_barcode(theEvent->particles_size()+1);
601  partHep->end_vertex()->add_particle_out(daughter);
602 
603  // add forced mix particles
604  if(isforced && noforced && !mforced){ continue;}
605  if(isforced && mforced){update_particles(daughter,theEvent,(*d),true,true,true); continue;}
606 
607  // Ensure forced decays are done with the alias
608  bool ignore=false;
609  bool isDefaultEvtGen=false;
610  // check to see if particle is on list of particles not be decayed by EvtGen
611  for(unsigned int i=0;i<ignore_pdgids.size();i++){
612  if(daughter->pdg_id()==ignore_pdgids[i])ignore=true;
613  }
614  int idHep = daughter->pdg_id();
615  EvtId idEvt = EvtPDL::evtIdFromStdHep(idHep);
616  if(!(hasmixing || ignore)){
617  // re-run is daughter is on EvtGen decay list (pythia8 does not return the event to EvtGen)
618  for(unsigned int i=0;i<m_PDGs.size();i++){
619  if(abs(idHep)==abs(m_PDGs[i])){
620  isDefaultEvtGen=true;
621  break;
622  }
623  }
624  }
625  int ipart = idEvt.getId();
626  EvtDecayTable *evtDecayTable=EvtDecayTable::getInstance();
627  if(!isforced && isDefaultEvtGen && ipart!=-1 && evtDecayTable->getNMode(ipart)!=0){
628  addToHepMC(daughter,idEvt,theEvent,!ismixing,true,true); // re-run if required
629  }
630  else{
631  // Recursively add daughters without re-running
632  if((*d)->end_vertex()) update_particles(daughter,theEvent,(*d),hasmixing,mixforce);
633  }
634  }
635  }
636  }
637 }
int i
Definition: DBlmapReader.cc:9
void update_particles(HepMC::GenParticle *partHep, HepMC::GenEvent *theEvent, HepMC::GenParticle *p, bool allowMixing=true, bool mixforce=false, bool noforced=false)
std::vector< int > forced_pdgids
double p[5][pyjets_maxn]
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > ignore_pdgids
tuple status
Definition: ntuplemaker.py:245
bool addToHepMC(HepMC::GenParticle *partHep, const EvtId &idEvt, HepMC::GenEvent *theEvent, bool allowMixing=true, bool mixforce=false, bool noforced=false)

Member Data Documentation

int gen::EvtGenInterface::BmixingOption = 1
private

Definition at line 67 of file EvtGenInterface.h.

std::vector<EvtId> gen::EvtGenInterface::forced_id
private

Definition at line 58 of file EvtGenInterface.h.

std::vector<int> gen::EvtGenInterface::forced_pdgids
private

Definition at line 59 of file EvtGenInterface.h.

edm::ParameterSet* gen::EvtGenInterface::fPSet
private

Definition at line 68 of file EvtGenInterface.h.

CLHEP::HepRandomEngine * EvtGenInterface::fRandomEngine
staticprivate

Definition at line 70 of file EvtGenInterface.h.

std::vector<int> gen::EvtGenInterface::ignore_pdgids
private

Definition at line 61 of file EvtGenInterface.h.

EvtGen* gen::EvtGenInterface::m_EvtGen
private

Definition at line 56 of file EvtGenInterface.h.

std::map<int, float> gen::EvtGenInterface::polarizations
private

Definition at line 66 of file EvtGenInterface.h.

std::vector<int> gen::EvtGenInterface::polarize_ids
private

Definition at line 64 of file EvtGenInterface.h.

std::vector<double> gen::EvtGenInterface::polarize_pol
private

Definition at line 65 of file EvtGenInterface.h.

myEvtRandomEngine* gen::EvtGenInterface::the_engine
private

Definition at line 71 of file EvtGenInterface.h.