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