Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HadDecayGenerator Class Reference

#include <G4HadDecayGenerator.hh>

Inheritance diagram for G4HadDecayGenerator:
Collaboration diagram for G4HadDecayGenerator:

Public Types

enum  Algorithm { NONE =0, Kopylov =1, GENBOD =2, NBody =3 }
 

Public Member Functions

 G4HadDecayGenerator (Algorithm alg=Kopylov, G4int verbose=0)
 
 G4HadDecayGenerator (G4VHadDecayAlgorithm *alg, G4int verbose=0)
 
virtual ~G4HadDecayGenerator ()
 
void SetVerboseLevel (G4int verbose)
 
const G4StringGetAlgorithmName () const
 
G4bool Generate (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
G4bool Generate (const G4ParticleDefinition *initialPD, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
G4bool Generate (const G4LorentzVector &initialState, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 

Protected Member Functions

G4bool GenerateOneBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState) const
 
void ReportInvalidAlgorithm (Algorithm alg) const
 
void ReportMissingAlgorithm () const
 
void UseAlgorithm (G4VHadDecayAlgorithm *alg)
 

Protected Attributes

G4int verboseLevel
 
G4VHadDecayAlgorithmtheAlgorithm
 

Detailed Description

Definition at line 50 of file G4HadDecayGenerator.hh.

Member Enumeration Documentation

Constructor & Destructor Documentation

G4HadDecayGenerator::G4HadDecayGenerator ( Algorithm  alg = Kopylov,
G4int  verbose = 0 
)

Definition at line 56 of file G4HadDecayGenerator.cc.

57  : verboseLevel(verbose), theAlgorithm(0) {
58  switch (alg) {
62  case NONE: theAlgorithm = 0; break; // User may explicitly set no algorithm
63  default: ReportInvalidAlgorithm(alg);
64  }
65 
66  if (verboseLevel) {
67  G4cout << " >>> G4HadDecayGenerator";
68  if (theAlgorithm) G4cout << " using " << theAlgorithm->GetName();
69  G4cout << G4endl;
70  }
71 }
void ReportInvalidAlgorithm(Algorithm alg) const
G4VHadDecayAlgorithm * theAlgorithm
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4HadDecayGenerator::G4HadDecayGenerator ( G4VHadDecayAlgorithm alg,
G4int  verbose = 0 
)

Definition at line 73 of file G4HadDecayGenerator.cc.

75  : verboseLevel(verbose), theAlgorithm(alg) {
76  if (verboseLevel) {
77  G4cout << " >>> G4HadDecayGenerator";
78  if (theAlgorithm) G4cout << " using " << theAlgorithm->GetName();
79  G4cout << G4endl;
80  }
81 }
G4VHadDecayAlgorithm * theAlgorithm
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4HadDecayGenerator::~G4HadDecayGenerator ( )
virtual

Definition at line 83 of file G4HadDecayGenerator.cc.

83  {
84  delete theAlgorithm;
85  theAlgorithm = 0;
86 }
G4VHadDecayAlgorithm * theAlgorithm

Member Function Documentation

G4bool G4HadDecayGenerator::Generate ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)

Definition at line 121 of file G4HadDecayGenerator.cc.

123  {
124  if (verboseLevel)
125  G4cout << " >>> G4HadDecayGenerator::Generate (mass)" << G4endl;
126 
128 
129  if (masses.size() == 1U)
130  return GenerateOneBody(initialMass, masses, finalState);
131 
132  theAlgorithm->Generate(initialMass, masses, finalState);
133  return !finalState.empty(); // Generator failure returns empty state
134 }
G4bool GenerateOneBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState) const
G4VHadDecayAlgorithm * theAlgorithm
G4GLOB_DLL std::ostream G4cout
void Generate(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
#define G4endl
Definition: G4ios.hh:61
void ReportMissingAlgorithm() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4HadDecayGenerator::Generate ( const G4ParticleDefinition initialPD,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)

Definition at line 139 of file G4HadDecayGenerator.cc.

141  {
142  if (verboseLevel)
143  G4cout << " >>> G4HadDecayGenerator::Generate (particle)" << G4endl;
144 
145  return (initialPD && Generate(initialPD->GetPDGMass(), masses, finalState));
146 }
G4bool Generate(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
G4GLOB_DLL std::ostream G4cout
G4double GetPDGMass() const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4bool G4HadDecayGenerator::Generate ( const G4LorentzVector initialState,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)

Definition at line 151 of file G4HadDecayGenerator.cc.

153  {
154  if (verboseLevel)
155  G4cout << " >>> G4HadDecayGenerator::Generate (frame)" << G4endl;
156 
157  G4bool good = Generate(initialState.m(), masses, finalState);
158  if (good) {
159  G4ThreeVector bv = initialState.boostVector();
160  for (size_t i=0; i<finalState.size(); i++) {
161  finalState[i].boost(bv);
162  }
163  }
164 
165  return good;
166 }
Hep3Vector boostVector() const
G4bool Generate(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4bool G4HadDecayGenerator::GenerateOneBody ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
) const
protected

Definition at line 172 of file G4HadDecayGenerator.cc.

174  {
175  if (verboseLevel>1)
176  G4cout << " >>> G4HadDecayGenerator::GenerateOneBody" << G4endl;
177 
178  // Initialization and sanity checks
179  finalState.clear();
180 
181  if (masses.size() != 1U) return false; // Should not have been called
182  if (std::fabs(initialMass-masses[0]) > eV) return false;
183 
184  if (verboseLevel>2) G4cout << " finalState mass = " << masses[0] << G4endl;
185 
186  finalState.push_back(G4LorentzVector(0.,0.,0.,masses[0]));
187  return true;
188 }
G4GLOB_DLL std::ostream G4cout
static constexpr double eV
Definition: G4SIunits.hh:215
#define G4endl
Definition: G4ios.hh:61
CLHEP::HepLorentzVector G4LorentzVector

Here is the caller graph for this function:

const G4String & G4HadDecayGenerator::GetAlgorithmName ( ) const

Definition at line 112 of file G4HadDecayGenerator.cc.

112  {
113  static const G4String& none = "NONE";
114  return (theAlgorithm ? theAlgorithm->GetName() : none);
115 }
G4VHadDecayAlgorithm * theAlgorithm
const G4String & GetName() const

Here is the call graph for this function:

void G4HadDecayGenerator::ReportInvalidAlgorithm ( Algorithm  alg) const
protected

Definition at line 91 of file G4HadDecayGenerator.cc.

91  {
92  if (verboseLevel)
93  G4cerr << "G4HadDecayGenerator: bad algorithm code " << alg << G4endl;
94 
95  throw G4HadronicException(__FILE__, __LINE__, "Invalid algorithm code");
96 }
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the caller graph for this function:

void G4HadDecayGenerator::ReportMissingAlgorithm ( ) const
protected

Definition at line 98 of file G4HadDecayGenerator.cc.

98  {
99  if (verboseLevel)
100  G4cerr << "G4HadDecayGenerator: no algorithm specified" << G4endl;
101 
102  throw G4HadronicException(__FILE__, __LINE__, "Null algorithm pointer");
103 }
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the caller graph for this function:

void G4HadDecayGenerator::SetVerboseLevel ( G4int  verbose)

Definition at line 107 of file G4HadDecayGenerator.cc.

107  {
108  verboseLevel = verbose;
110 }
G4VHadDecayAlgorithm * theAlgorithm
virtual void SetVerboseLevel(G4int verbose)

Here is the call graph for this function:

void G4HadDecayGenerator::UseAlgorithm ( G4VHadDecayAlgorithm alg)
inlineprotected

Definition at line 101 of file G4HadDecayGenerator.hh.

101 { theAlgorithm = alg; }
G4VHadDecayAlgorithm * theAlgorithm

Member Data Documentation

G4VHadDecayAlgorithm* G4HadDecayGenerator::theAlgorithm
protected

Definition at line 104 of file G4HadDecayGenerator.hh.

G4int G4HadDecayGenerator::verboseLevel
protected

Definition at line 103 of file G4HadDecayGenerator.hh.


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