evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtTauolaEngine.cpp
Go to the documentation of this file.
1 
2 /***********************************************************************
3 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4 * *
5 * This file is part of EvtGen. *
6 * *
7 * EvtGen is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * EvtGen is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19 ***********************************************************************/
20 
21 #ifdef EVTGEN_TAUOLA
22 
24 
26 #include "EvtGenBase/EvtPDL.hh"
27 #include "EvtGenBase/EvtRandom.hh"
28 #include "EvtGenBase/EvtReport.hh"
31 
32 #include "Tauola/Log.h"
33 #include "Tauola/Tauola.h"
34 
35 #include <cmath>
36 #include <iostream>
37 #include <memory>
38 #include <sstream>
39 #include <string>
40 
41 using std::endl;
42 
43 EvtTauolaEngine::EvtTauolaEngine( bool useEvtGenRandom )
44 {
45  // PDG standard code integer ID for tau particle
46  _tauPDG = 15;
47  // Number of possible decay modes in Tauola
48  _nTauolaModes = 22;
49 
50  EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Setting up TAUOLA." << endl;
51 
52  // These three lines are not really necessary since they are the default.
53  // But they are here so that we know what the initial conditions are.
54  Tauolapp::Tauola::setDecayingParticle( _tauPDG ); // tau PDG code
55  Tauolapp::Tauola::setSameParticleDecayMode(
56  Tauolapp::Tauola::All ); // all modes allowed
57  Tauolapp::Tauola::setOppositeParticleDecayMode(
58  Tauolapp::Tauola::All ); // all modes allowed
59 
60  // Limit the number of warnings printed out. Can't choose zero here, unfortunately
61  Tauolapp::Log::SetWarningLimit( 1 );
62 
63  // Initial the Tauola external generator
64  if ( useEvtGenRandom == true ) {
65  EvtGenReport( EVTGEN_INFO, "EvtGen" )
66  << "Using EvtGen random number engine also for Tauola++" << endl;
67 
68  Tauolapp::Tauola::setRandomGenerator( EvtRandom::Flat );
69  }
70 
71  // Use the BaBar-tuned chiral current calculations by default. Can be changed using the
72  // TauolaCurrentOption keyword in decay files
73  Tauolapp::Tauola::setNewCurrents( 1 );
74 
75  Tauolapp::Tauola::initialize();
76 
77  // Initialise various default parameters
78  // Neutral and charged spin propagator choices
79  _neutPropType = 0;
80  _posPropType = 0;
81  _negPropType = 0;
82 
83  // Set-up possible decay modes _after_ we have read the (user) decay file
84  _initialised = false;
85 }
86 
87 void EvtTauolaEngine::initialise()
88 {
89  // Set up all possible tau decay modes.
90  // This should be done just before the first doDecay() call,
91  // since we want to make sure that any decay.dec files are processed
92  // first to get lists of particle modes and their alias definitions
93  // (for creating EvtParticles with the right history information).
94 
95  if ( _initialised == false ) {
96  this->setUpPossibleTauModes();
97  this->setOtherParameters();
98 
99  _initialised = true;
100  }
101 }
102 
103 void EvtTauolaEngine::setUpPossibleTauModes()
104 {
105  // Get the decay table list defined by the decay.dec files.
106  // Only look for the first tau particle decay mode definitions with the Tauola name,
107  // since that generator only allows the same BFs for both tau+ and tau- decays.
108  // We can not choose a specific tau decay event-by-event, since this is
109  // only possible before we call Tauola::initialize().
110  // Otherwise, we could have selected a random mode ourselves for tau- and tau+
111  // separately (via selecting a random number and comparing it to be less than
112  // the cumulative BF) for each event.
113 
114  int nPDL = EvtPDL::entries();
115  int iPDL( 0 );
116 
117  bool gotAnyTauolaModes( false );
118 
119  for ( iPDL = 0; iPDL < nPDL; iPDL++ ) {
120  EvtId particleId = EvtPDL::getEntry( iPDL );
121  int PDGId = EvtPDL::getStdHep( particleId );
122 
123  if ( abs( PDGId ) == _tauPDG && gotAnyTauolaModes == false ) {
124  int aliasInt = particleId.getAlias();
125 
126  // Get the list of decay modes for this tau particle (alias)
127  int nModes = EvtDecayTable::getInstance()->getNModes( aliasInt );
128  int iMode( 0 ), iTauMode( 0 );
129 
130  // Vector to store tau mode branching fractions.
131  // The size of this vector equals the total number of possible
132  // Tauola decay modes. Initialise all BFs to zero.
133  std::vector<double> tauolaModeBFs( _nTauolaModes );
134 
135  for ( iTauMode = 0; iTauMode < _nTauolaModes; iTauMode++ ) {
136  tauolaModeBFs[iTauMode] = 0.0;
137  }
138 
139  double totalTauModeBF( 0.0 );
140 
141  int nNonTauolaModes( 0 );
142 
143  // Loop through each decay mode
144  for ( iMode = 0; iMode < nModes; iMode++ ) {
145  EvtDecayBase* decayModel =
147  iMode );
148  if ( decayModel ) {
149  // Check that the decay model name matches TAUOLA
150  std::string modelName = decayModel->getName();
151  if ( modelName == "TAUOLA" ) {
152  if ( gotAnyTauolaModes == false ) {
153  gotAnyTauolaModes = true;
154  }
155 
156  // Extract the decay mode integer type and branching fraction
157  double BF = decayModel->getBranchingFraction();
158  int modeArrayInt = this->getModeInt( decayModel ) - 1;
159 
160  if ( modeArrayInt >= 0 && modeArrayInt < _nTauolaModes ) {
161  tauolaModeBFs[modeArrayInt] = BF;
162  totalTauModeBF += BF;
163  }
164 
165  } else {
166  nNonTauolaModes++;
167  }
168 
169  } // Decay mode exists
170 
171  } // Loop over decay models
172 
173  if ( gotAnyTauolaModes == true && nNonTauolaModes > 0 ) {
174  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
175  << "Please remove all non-TAUOLA decay modes for particle "
176  << EvtPDL::name( particleId ) << endl;
177  ::abort();
178  }
179 
180  // Normalise all (non-zero) tau mode BFs to sum up to 1.0, and
181  // let Tauola know about these normalised branching fractions
182  if ( totalTauModeBF > 0.0 ) {
183  EvtGenReport( EVTGEN_INFO, "EvtGen" )
184  << "Setting TAUOLA BF modes using the definitions for the particle "
185  << EvtPDL::name( particleId ) << endl;
186 
187  for ( iTauMode = 0; iTauMode < _nTauolaModes; iTauMode++ ) {
188  tauolaModeBFs[iTauMode] /= totalTauModeBF;
189  double modeBF = tauolaModeBFs[iTauMode];
190  EvtGenReport( EVTGEN_INFO, "EvtGen" )
191  << "Setting TAUOLA BF for mode " << iTauMode + 1
192  << " = " << modeBF << endl;
193  Tauolapp::Tauola::setTauBr( iTauMode + 1, modeBF );
194  }
195 
196  EvtGenReport( EVTGEN_INFO, "EvtGen" )
197  << "Any other TAUOLA BF modes for other tau particle decay mode definitions will be ignored!"
198  << endl;
199  }
200 
201  } // Got tau particle and have yet to get a TAUOLA mode
202 
203  } // Loop through PDL entries
204 }
205 
206 int EvtTauolaEngine::getModeInt( EvtDecayBase* decayModel )
207 {
208  int modeInt( 0 );
209 
210  if ( decayModel ) {
211  int nVars = decayModel->getNArg();
212 
213  if ( nVars > 0 ) {
214  modeInt = static_cast<int>( decayModel->getArg( 0 ) );
215  }
216  }
217 
218  return modeInt;
219 }
220 
221 void EvtTauolaEngine::setOtherParameters()
222 {
223  // Set other Tauola parameters using the "Defined" keyword in the decay file. If any of
224  // these are not found in the decay file, then default values are assumed/kept
225 
226  // 1) TauolaNeutralProp: Specify the neutral propagator type used for spin matrix calculations
227  // "Z" (default), "Gamma", "Higgs" (H0), "PseudoHiggs" (A0), "MixedHiggs" (A0/H0)
228  int iErr( 0 );
229  std::string neutPropName = EvtSymTable::get( "TauolaNeutralProp", iErr );
230  if ( neutPropName == "Z0" || neutPropName == "Z" ) {
231  _neutPropType = Tauolapp::TauolaParticle::Z0;
232  } else if ( neutPropName == "Gamma" ) {
233  _neutPropType = Tauolapp::TauolaParticle::GAMMA;
234  } else if ( neutPropName == "Higgs" ) {
235  _neutPropType = Tauolapp::TauolaParticle::HIGGS;
236  } else if ( neutPropName == "PseudoHiggs" ) {
237  _neutPropType = Tauolapp::TauolaParticle::HIGGS_A;
238  } else if ( neutPropName == "MixedHiggs" ) {
239  _neutPropType = Tauolapp::Tauola::getHiggsScalarPseudoscalarPDG();
240  }
241 
242  if ( _neutPropType != 0 ) {
243  EvtGenReport( EVTGEN_INFO, "EvtGen" )
244  << "TAUOLA neutral spin propagator PDG id set to " << _neutPropType
245  << endl;
246  }
247 
248  // 2) TauolaChargedProp: Specify the charged propagator type used for spin matrix calculations
249  // "W" (default), "Higgs" (H+/H-)
250  std::string chargedPropName = EvtSymTable::get( "TauolaChargedProp", iErr );
251  if ( chargedPropName == "W" ) {
252  _negPropType = Tauolapp::TauolaParticle::W_MINUS;
253  _posPropType = Tauolapp::TauolaParticle::W_PLUS;
254  } else if ( chargedPropName == "Higgs" ) {
255  _negPropType = Tauolapp::TauolaParticle::HIGGS_MINUS;
256  _posPropType = Tauolapp::TauolaParticle::HIGGS_PLUS;
257  }
258 
259  if ( _negPropType != 0 ) {
260  EvtGenReport( EVTGEN_INFO, "EvtGen" )
261  << "TAUOLA negative charge spin propagator PDG id set to "
262  << _negPropType << endl;
263  }
264 
265  if ( _posPropType != 0 ) {
266  EvtGenReport( EVTGEN_INFO, "EvtGen" )
267  << "TAUOLA positive charge spin propagator PDG id set to "
268  << _posPropType << endl;
269  }
270 
271  // 3) TauolaHiggsMixingAngle: Specify the mixing angle between the neutral scalar & pseudoscalar Higgs
272  // A0/H0; the default mixing angle is pi/4 radians
273  std::string mixString = EvtSymTable::get( "TauolaHiggsMixingAngle", iErr );
274  // If the definition name is not found, get() just returns the first argument string
275  if ( mixString != "TauolaHiggsMixingAngle" ) {
276  double mixAngle = std::atof( mixString.c_str() );
277  EvtGenReport( EVTGEN_INFO, "EvtGen" )
278  << "TAUOLA Higgs mixing angle set to " << mixAngle << " radians"
279  << endl;
280  Tauolapp::Tauola::setHiggsScalarPseudoscalarMixingAngle( mixAngle );
281  }
282 
283  // 4) TauolaBRi, where i = 1,2,3,4: Redefine sub-channel branching fractions using the setTaukle
284  // function, after initialized() has been called. Default values = 0.5, 0.5, 0.5 and 0.6667
285  int j( 1 );
286  std::vector<double> BRVect;
287  BRVect.push_back( 0.5 );
288  BRVect.push_back( 0.5 );
289  BRVect.push_back( 0.5 );
290  BRVect.push_back( 0.6667 );
291 
292  for ( j = 1; j < 5; j++ ) {
293  std::ostringstream o;
294  o << j;
295  std::string BRName = "TauolaBR" + o.str();
296  std::string stringBR = EvtSymTable::get( BRName, iErr );
297 
298  // If the definition name is not found, get() just returns the first argument string
299  if ( stringBR != BRName ) {
300  BRVect[j - 1] = std::atof( stringBR.c_str() );
301  }
302  }
303 
304  EvtGenReport( EVTGEN_INFO, "EvtGen" )
305  << "TAUOLA::setTaukle values are " << BRVect[0] << ", " << BRVect[1]
306  << ", " << BRVect[2] << ", " << BRVect[3] << endl;
307 
308  Tauolapp::Tauola::setTaukle( BRVect[0], BRVect[1], BRVect[2], BRVect[3] );
309 
310  // 5) Specify the hadronic current option, e.g. orig CLEO = 0, BaBar-tuned = 1 (default), ...
311  // No check is made by EvtGen on valid integer options - its just passed to Tauola
312  std::string currentOption = EvtSymTable::get( "TauolaCurrentOption", iErr );
313  // If the definition name is not found, get() just returns the first argument string
314  if ( currentOption != "TauolaCurrentOption" ) {
315  int currentOpt = std::atoi( currentOption.c_str() );
316  EvtGenReport( EVTGEN_INFO, "EvtGen" )
317  << "TAUOLA current option = " << currentOpt << endl;
318 
319  Tauolapp::Tauola::setNewCurrents( currentOpt );
320  }
321 }
322 
323 bool EvtTauolaEngine::doDecay( EvtParticle* tauParticle )
324 {
325  if ( _initialised == false ) {
326  this->initialise();
327  }
328 
329  if ( tauParticle == 0 ) {
330  return false;
331  }
332 
333  // Check that we have a tau particle.
334  EvtId partId = tauParticle->getId();
335  if ( abs( EvtPDL::getStdHep( partId ) ) != _tauPDG ) {
336  return false;
337  }
338 
339  int nTauDaug = tauParticle->getNDaug();
340 
341  // If the number of tau daughters is not zero, then we have already decayed
342  // it using Tauola/another decay algorithm.
343  if ( nTauDaug > 0 ) {
344  return true;
345  }
346 
347  this->decayTauEvent( tauParticle );
348 
349  return true;
350 }
351 
352 void EvtTauolaEngine::decayTauEvent( EvtParticle* tauParticle )
353 {
354  // Either we have a tau particle within a decay chain, or a single particle.
355  // Create a dummy HepMC event & vertex for the parent particle, containing the tau as
356  // one of the outgoing particles. If we have a decay chain, the parent will be the
357  // incoming particle, while the daughters, including the tau, are outgoing particles.
358  // For the single particle case, the incoming particle is null, while the single tau
359  // is the only outgoing particle.
360  // We can then pass this event to Tauola which should then decay the tau particle.
361  // We also consider all other tau particles from the parent decay in the logic below.
362 
363  // Create the dummy event.
364  auto theEvent = std::make_unique<GenEvent>( Units::GEV, Units::MM );
365 
366  // Create the decay "vertex".
367  GenVertexPtr theVertex = newGenVertexPtr();
368  theEvent->add_vertex( theVertex );
369 
370  // Get the parent of this tau particle
371  EvtParticle* theParent = tauParticle->getParent();
372  GenParticlePtr hepMCParent( 0 );
373 
374  // Assign the parent particle as the incoming particle to the vertex.
375  if ( theParent ) {
376  hepMCParent = this->createGenParticle( theParent );
377  theVertex->add_particle_in( hepMCParent );
378  } else {
379  // The tau particle has no parent. Set "itself" as the incoming particle for the first vertex.
380  // This is needed, otherwise Tauola warns of momentum non-conservation for this (1st) vertex.
381  GenParticlePtr tauGenInit = this->createGenParticle( tauParticle );
382  theVertex->add_particle_in( tauGenInit );
383  }
384 
385  // Find all daughter particles and assign them as outgoing particles to the vertex.
386  // This will include the tau particle we are currently processing.
387  // If the parent decay has more than one tau particle, we need to include them as well.
388  // This is important since Tauola needs the correct physics correlations: we do not
389  // want Tauola to decay each particle separately if they are from tau pair combinations.
390  // Tauola will process the event, and we will create EvtParticles from all tau decay
391  // products, i.e. the tau particle we currently have and any other tau particles.
392  // EvtGen will try to decay the other tau particle(s) by calling EvtTauola and therefore
393  // this function. However, we check to see if the tau candidate has any daughters already.
394  // If it does, then we have already set the tau decay products from Tauola.
395 
396  // Map to store (HepMC,EvtParticle) pairs for each tau candidate from the parent
397  // decay. This is needed to find out what EvtParticle corresponds to a given tau HepMC
398  // candidate: we do not want to recreate existing EvtParticle pointers.
399  std::map<GenParticlePtr, EvtParticle*> tauMap;
400 
401  // Keep track of the original EvtId of the parent particle, since we may need to set
402  // the equivalent HepMCParticle has a gauge boson to let Tauola calculate spin effects
403  EvtId origParentId( -1, -1 );
404 
405  if ( theParent ) {
406  // Original parent id
407  origParentId = EvtPDL::getId( theParent->getName() );
408 
409  // Find all tau particles in the decay tree and store them in the map.
410  // Keep track of how many tau daughters this parent particle has
411  int nTaus( 0 );
412  int nDaug( theParent->getNDaug() );
413  int iDaug( 0 );
414 
415  for ( iDaug = 0; iDaug < nDaug; iDaug++ ) {
416  EvtParticle* theDaughter = theParent->getDaug( iDaug );
417 
418  if ( theDaughter ) {
419  GenParticlePtr hepMCDaughter = this->createGenParticle(
420  theDaughter );
421  theVertex->add_particle_out( hepMCDaughter );
422 
423  EvtId theId = theDaughter->getId();
424  int PDGInt = EvtPDL::getStdHep( theId );
425 
426  if ( abs( PDGInt ) == _tauPDG ) {
427  // Delete any siblings for the tau particle
428  if ( theDaughter->getNDaug() > 0 ) {
429  theDaughter->deleteDaughters( false );
430  }
431  tauMap[hepMCDaughter] = theDaughter;
432  nTaus++;
433  } else {
434  // Treat all other particles as "stable"
435  hepMCDaughter->set_status( Tauolapp::TauolaParticle::STABLE );
436  }
437 
438  } // theDaughter != 0
439  } // Loop over daughters
440 
441  // For the parent particle, artifically set the PDG to a boson with the same 4-momentum
442  // so that spin correlations are calculated inside Tauola.
443  // This leaves the original parent _EvtParticle_ unchanged
444  if ( nTaus > 0 && hepMCParent ) {
445  int parCharge = EvtPDL::chg3( origParentId ) /
446  3; // (3*particle charge)/3 = particle charge
447  if ( parCharge == 0 && _neutPropType != 0 ) {
448  hepMCParent->set_pdg_id( _neutPropType );
449  } else if ( parCharge == -1 && _negPropType != 0 ) {
450  hepMCParent->set_pdg_id( _negPropType );
451  } else if ( parCharge == 1 && _posPropType != 0 ) {
452  hepMCParent->set_pdg_id( _posPropType );
453  }
454  }
455 
456  } else {
457  // We only have the one tau particle. Store only this in the map.
458  GenParticlePtr singleTau = this->createGenParticle( tauParticle );
459  theVertex->add_particle_out( singleTau );
460  tauMap[singleTau] = tauParticle;
461  }
462 
463  // Now pass the event to Tauola for processing
464  // Create a Tauola event object
465 #ifdef EVTGEN_HEPMC3
466  Tauolapp::TauolaHepMC3Event tauolaEvent( theEvent.get() );
467 #else
468  Tauolapp::TauolaHepMCEvent tauolaEvent( theEvent.get() );
469 #endif
470 
471  // Run the Tauola algorithm
472  tauolaEvent.decayTaus();
473 
474  // Loop over all tau particles in the HepMC event and create their EvtParticle daughters.
475  // Store all final "stable" descendent particles as the tau daughters, i.e.
476  // let Tauola decay any resonances such as a_1 or rho.
477  // If there is more than one tau particle in the event, then also create the
478  // corresponding EvtParticles for their daughters as well. They will not be
479  // re-decayed since we check at the start of this function if the tau particle has
480  // any daughters before running Tauola decayTaus().
481 
482 #ifdef EVTGEN_HEPMC3
483  for ( auto aParticle : theEvent->particles() ) {
484 #else
485  HepMC::GenEvent::particle_iterator eventIter;
486  for ( eventIter = theEvent->particles_begin();
487  eventIter != theEvent->particles_end(); ++eventIter ) {
488  // Check to see if we have a tau particle
489  HepMC::GenParticle* aParticle = ( *eventIter );
490 #endif
491 
492  if ( aParticle && abs( aParticle->pdg_id() ) == _tauPDG ) {
493  // Find out what EvtParticle corresponds to the HepMC particle.
494  // We need this to create and attach EvtParticle daughters.
495  EvtParticle* tauEvtParticle = tauMap[aParticle];
496 
497  if ( tauEvtParticle ) {
498  // Get the tau 4-momentum in the lab (first mother) frame. We need to boost
499  // all the tau daughters to this frame, such that daug.getP4() is in the tau restframe.
500  EvtVector4R tauP4CM = tauEvtParticle->getP4Lab();
501  tauP4CM.set( tauP4CM.get( 0 ), -tauP4CM.get( 1 ),
502  -tauP4CM.get( 2 ), -tauP4CM.get( 3 ) );
503 
504  // Get the decay vertex for the tau particle
505  GenVertexPtr endVertex = aParticle->end_vertex();
506 
507  std::vector<EvtId> daugIdVect;
508  std::vector<EvtVector4R> daugP4Vect;
509 
510  // Loop through all descendants
511 #ifdef EVTGEN_HEPMC3
512  for ( auto tauDaug :
513  HepMC3::Relatives::DESCENDANTS( endVertex ) ) {
514 #else
515  HepMC::GenVertex::particle_iterator tauIter;
516  // Loop through all descendants
517  for ( tauIter = endVertex->particles_begin( HepMC::descendants );
518  tauIter != endVertex->particles_end( HepMC::descendants );
519  ++tauIter ) {
520  HepMC::GenParticle* tauDaug = ( *tauIter );
521 #endif
522  // Check to see if this descendant has its own decay vertex, e.g. rho resonance.
523  // If so, skip this daughter and continue looping through the descendant list
524  // until we reach the final "stable" products (e.g. pi pi from rho -> pi pi).
525  GenVertexPtr daugDecayVtx = tauDaug->end_vertex();
526  if ( daugDecayVtx ) {
527  continue;
528  }
529 
530  // Store the particle id and 4-momentum
531  int tauDaugPDG = tauDaug->pdg_id();
532  EvtId daugId = EvtPDL::evtIdFromStdHep( tauDaugPDG );
533  daugIdVect.push_back( daugId );
534 
535  FourVector tauDaugP4 = tauDaug->momentum();
536  double tauDaug_px = tauDaugP4.px();
537  double tauDaug_py = tauDaugP4.py();
538  double tauDaug_pz = tauDaugP4.pz();
539  double tauDaug_E = tauDaugP4.e();
540 
541  EvtVector4R daugP4( tauDaug_E, tauDaug_px, tauDaug_py,
542  tauDaug_pz );
543  daugP4Vect.push_back( daugP4 );
544 
545  } // Loop over HepMC tau daughters
546 
547  // Create the tau EvtParticle daughters and assign their ids and 4-mtm
548  int nDaug = daugIdVect.size();
549 
550  tauEvtParticle->makeDaughters( nDaug, daugIdVect );
551 
552  int iDaug( 0 );
553  for ( iDaug = 0; iDaug < nDaug; iDaug++ ) {
554  EvtParticle* theDaugPart = tauEvtParticle->getDaug( iDaug );
555 
556  if ( theDaugPart ) {
557  EvtId theDaugId = daugIdVect[iDaug];
558  EvtVector4R theDaugP4 = daugP4Vect[iDaug];
559  theDaugP4.applyBoostTo(
560  tauP4CM ); // Boost the 4-mtm to the tau rest frame
561  theDaugPart->init( theDaugId, theDaugP4 );
562  }
563 
564  } // Loop over tau daughters
565  }
566 
567  } // We have a tau HepMC particle in the event
568  }
569 
570  theEvent->clear();
571 }
572 
573 GenParticlePtr EvtTauolaEngine::createGenParticle( EvtParticle* theParticle )
574 {
575  // Method to create an HepMC::GenParticle version of the given EvtParticle.
576  if ( theParticle == 0 ) {
577  return 0;
578  }
579 
580  // Get the 4-momentum (E, px, py, pz) for the EvtParticle
581  EvtVector4R p4 = theParticle->getP4Lab();
582 
583  // Convert this to the HepMC 4-momentum
584  double E = p4.get( 0 );
585  double px = p4.get( 1 );
586  double py = p4.get( 2 );
587  double pz = p4.get( 3 );
588 
589  FourVector hepMC_p4( px, py, pz, E );
590 
591  int PDGInt = EvtPDL::getStdHep( theParticle->getId() );
592 
593  // Set the status flag for the particle.
594  int status = Tauolapp::TauolaParticle::HISTORY;
595 
596  GenParticlePtr genParticle = newGenParticlePtr( hepMC_p4, PDGInt, status );
597 
598  return genParticle;
599 }
600 
601 #endif
static std::string name(EvtId i)
Definition: EvtPDL.cpp:382
static EvtDecayTable * getInstance()
EvtParticle * getParent() const
Definition: EvtParticle.cpp:96
std::string getName()
HepMC::GenParticle * GenParticlePtr
static EvtId getEntry(int i)
Definition: EvtPDL.cpp:392
double getArg(unsigned int j)
EvtVector4R getP4Lab() const
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtId getId() const
void makeDaughters(unsigned int ndaug, EvtId *id)
void set(int i, double d)
Definition: EvtVector4R.hh:167
static int chg3(EvtId i)
Definition: EvtPDL.cpp:372
static std::string get(const std::string &name, int &ierr)
Definition: EvtSymTable.cpp:55
HepMC::FourVector FourVector
GenVertexPtr newGenVertexPtr(const FourVector &pos=FourVector(0.0, 0.0, 0.0, 0.0))
Definition: EvtId.hh:27
size_t getNDaug() const
double get(int i) const
Definition: EvtVector4R.hh:162
double getBranchingFraction() const
Definition: EvtDecayBase.hh:62
int getNModes(int aliasInt)
void deleteDaughters(bool keepChannel=false)
EvtDecayBase * findDecayModel(int aliasInt, int modeInt)
static double Flat()
Definition: EvtRandom.cpp:72
static size_t entries()
Definition: EvtPDL.cpp:387
double abs(const EvtComplex &c)
Definition: EvtComplex.hh:201
static EvtId evtIdFromStdHep(int stdhep)
Definition: EvtPDL.cpp:246
static EvtId getId(const std::string &name)
Definition: EvtPDL.cpp:287
HepMC::GenVertex * GenVertexPtr
virtual std::string getName()=0
void applyBoostTo(const EvtVector4R &p4, bool inverse=false)
EvtParticle * getDaug(int i)
Definition: EvtParticle.cpp:91
int getAlias() const
Definition: EvtId.hh:44
GenParticlePtr newGenParticlePtr(const FourVector &mom=FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
int getNArg() const
Definition: EvtDecayBase.hh:68
static int getStdHep(EvtId id)
Definition: EvtPDL.cpp:362