Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4Pythia6Decayer Class Reference

#include <G4Pythia6Decayer.hh>

Inheritance diagram for G4Pythia6Decayer:
G4VExtDecayer

Public Member Functions

 G4Pythia6Decayer ()
 
virtual ~G4Pythia6Decayer ()
 
virtual G4DecayProductsImportDecayProducts (const G4Track &track)
 
void ForceDecayType (EDecayType decayType)
 
void SetVerboseLevel (G4int verboseLevel)
 
- Public Member Functions inherited from G4VExtDecayer
 G4VExtDecayer (const G4String &name="")
 
virtual ~G4VExtDecayer ()
 
const G4StringGetName () const
 

Additional Inherited Members

- Protected Attributes inherited from G4VExtDecayer
G4String decayerName
 

Detailed Description

Pythia6 decayer

Implements the G4VExtDecayer abstract class using the Pythia6 interface. According to TPythia6Decayer class in Root: http://root.cern.ch/ see http://root.cern.ch/root/License.html

Definition at line 53 of file G4Pythia6Decayer.hh.

Constructor & Destructor Documentation

G4Pythia6Decayer::G4Pythia6Decayer ( )

Standard constructor

Definition at line 55 of file G4Pythia6Decayer.cc.

56  : G4VExtDecayer("G4Pythia6Decayer"),
57  fMessenger(this),
58  fVerboseLevel(0),
59  fDecayType(fgkDefaultDecayType),
60  fDecayProductsArray(0)
61 {
62 /// Standard constructor
63 
64  fDecayProductsArray = new ParticleVector();
65 
66  ForceDecay(fDecayType);
67 }
std::vector< Pythia6Particle * > ParticleVector
Definition: Pythia6.hh:149
G4VExtDecayer(const G4String &name="")
G4Pythia6Decayer::~G4Pythia6Decayer ( )
virtual

Destructor

Definition at line 71 of file G4Pythia6Decayer.cc.

72 {
73 /// Destructor
74 
75  delete fDecayProductsArray;
76 }

Member Function Documentation

void G4Pythia6Decayer::ForceDecayType ( EDecayType  decayType)

Force a given decay type

Definition at line 618 of file G4Pythia6Decayer.cc.

Referenced by G4Pythia6DecayerMessenger::SetNewValue().

619 {
620 /// Force a given decay type
621 
622  // Do nothing if the decay type is not different from current one
623  if ( decayType == fDecayType ) return;
624 
625  fDecayType = decayType;
626  ForceDecay(fDecayType);
627 }
G4DecayProducts * G4Pythia6Decayer::ImportDecayProducts ( const G4Track track)
virtual

Import decay products

Implements G4VExtDecayer.

Definition at line 539 of file G4Pythia6Decayer.cc.

References Pythia6Particle::fKF, Pythia6Particle::fKS, G4cout, G4endl, G4Track::GetDefinition(), G4DynamicParticle::GetDefinition(), G4Track::GetDynamicParticle(), G4Track::GetMomentum(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGEncoding(), G4DynamicParticle::GetTotalEnergy(), python.hepunit::GeV, G4DecayProducts::PushProducts(), status, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

540 {
541 /// Import decay products
542 
543  // get particle momentum
544  G4ThreeVector momentum = track.GetMomentum();
545  G4double etot = track.GetDynamicParticle()->GetTotalEnergy();;
547  p[0] = momentum.x() / GeV;
548  p[1] = momentum.y() / GeV;
549  p[2] = momentum.z() / GeV;
550  p[3] = etot / GeV;
551 
552  // get particle PDG
553  // ask G4Pythia6Decayer to get PDG encoding
554  // (in order to get PDG from extended TDatabasePDG
555  // in case the standard PDG code is not defined)
556  G4ParticleDefinition* particleDef = track.GetDefinition();
557  G4int pdgEncoding = particleDef->GetPDGEncoding();
558 
559  // let Pythia6Decayer decay the particle
560  // and import the decay products
561  Decay(pdgEncoding, p);
562  G4int nofParticles = ImportParticles(fDecayProductsArray);
563 
564  if ( fVerboseLevel > 0 ) {
565  G4cout << "nofParticles: " << nofParticles << G4endl;
566  }
567 
568  // convert decay products Pythia6Particle type
569  // to G4DecayProducts
570  G4DecayProducts* decayProducts
571  = new G4DecayProducts(*(track.GetDynamicParticle()));
572 
573  G4int counter = 0;
574  for (G4int i=0; i<nofParticles; i++) {
575 
576  // get particle from ParticleVector
577  Pythia6Particle* particle = (*fDecayProductsArray)[i];
578 
579  G4int status = particle->fKS;
580  G4int pdg = particle->fKF;
581  if ( status>0 && status<11 &&
582  std::abs(pdg)!=12 && std::abs(pdg)!=14 && std::abs(pdg)!=16 ) {
583  // pass to tracking final particles only;
584  // skip neutrinos
585 
586  if ( fVerboseLevel > 0 ) {
587  G4cout << " " << i << "th particle PDG: " << pdg << " ";
588  }
589 
590  // create G4DynamicParticle
591  G4DynamicParticle* dynamicParticle
592  = CreateDynamicParticle(particle);
593 
594  if (dynamicParticle) {
595 
596  if ( fVerboseLevel > 0 ) {
597  G4cout << " G4 particle name: "
598  << dynamicParticle->GetDefinition()->GetParticleName()
599  << G4endl;
600  }
601 
602  // add dynamicParticle to decayProducts
603  decayProducts->PushProducts(dynamicParticle);
604 
605  counter++;
606  }
607  }
608  }
609  if ( fVerboseLevel > 0 ) {
610  G4cout << "nofParticles for tracking: " << counter << G4endl;
611  }
612 
613  return decayProducts;
614 }
G4ParticleDefinition * GetDefinition() const
G4double GetTotalEnergy() const
double x() const
const G4DynamicParticle * GetDynamicParticle() const
G4int PushProducts(G4DynamicParticle *aParticle)
const char * p
Definition: xmltok.h:285
Structure for Pythia6 particle properties.
Definition: Pythia6.hh:119
G4ParticleDefinition * GetDefinition() const
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
double z() const
G4GLOB_DLL std::ostream G4cout
int status
Definition: tracer.cxx:24
G4ThreeVector GetMomentum() const
double y() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4Pythia6Decayer::SetVerboseLevel ( G4int  verboseLevel)
inline

Definition at line 63 of file G4Pythia6Decayer.hh.

Referenced by P6DExtDecayerPhysics::ConstructProcess(), and G4Pythia6DecayerMessenger::SetNewValue().

63 { fVerboseLevel = verboseLevel; }

The documentation for this class was generated from the following files: