Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HadDecayGenerator.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id$
27 //
28 // Multibody "phase space" generator, which provides interface to
29 // algorithms for sampling. Momentum vectors are generated in the
30 // center-of-mass frame of the decay, and returned in a user-supplied
31 // buffer.
32 //
33 // Sampling algorithm is specified via constructor argument, either by
34 // code for centrally supplied algorithms (Kopylov, GENBOD, or NBody),
35 // or by pointer (which is owned by the generator).
36 //
37 // Author: Michael Kelsey (SLAC) <kelsey@slac.stanford.edu>
38 
39 #ifndef G4HadDecayGenerator_HH
40 #define G4HadDecayGenerator_HH 1
41 
42 #include "globals.hh"
43 #include "G4LorentzVector.hh"
44 #include <vector>
45 
48 
49 
51 public:
52  // Flags to select algorithm by code in constructor
53  enum Algorithm { NONE=0, Kopylov=1, GENBOD=2, NBody=3 };
54 
55  // Specify "standard" algorithm by code or by object (takes ownership)
58  virtual ~G4HadDecayGenerator();
59 
60  // Enable (or disable if 0) diagnostic messages
61  void SetVerboseLevel(G4int verbose);
62  const G4String& GetAlgorithmName() const;
63 
64  // Initial state (rest mass) and list of final masses
65  G4bool Generate(G4double initialMass,
66  const std::vector<G4double>& masses,
67  std::vector<G4LorentzVector>& finalState);
68 
69  // Initial state particle and list of final masses
70  G4bool Generate(const G4ParticleDefinition* initialPD,
71  const std::vector<G4double>& masses,
72  std::vector<G4LorentzVector>& finalState);
73 
74  // Initial state (frame) and list of final masses
75  // Final state particles will be boosted to initial-state frame
76  G4bool Generate(const G4LorentzVector& initialState,
77  const std::vector<G4double>& masses,
78  std::vector<G4LorentzVector>& finalState);
79 
80 protected:
81  // Special case for one-body final state
82  G4bool GenerateOneBody(G4double initialMass,
83  const std::vector<G4double>& masses,
84  std::vector<G4LorentzVector>& finalState) const;
85 
86  // Special function used by constructor for unrecognized algorithm code
87  void ReportInvalidAlgorithm(Algorithm alg) const;
88  void ReportMissingAlgorithm() const;
89 
90 protected:
91  // SPECIAL FUNCTION FOR SUBCLASSES: A subclass may implement a
92  // collection of algorithms, to be switched on an event-by-event
93  // basis. This function allows the subclass to switch the "active"
94  // algorithm before Generate() is called.
95  //
96  // If this function is used by the subclass, then the subclass has
97  // ownership of _all_ instantiated algorithms, and should delete
98  // them in its own dtor. The subclass dtor must also call
99  // UseAlgorithm(0) to set the base algorithm to a null pointer, to
100  // prevent a double-delete error.
102 
105 };
106 
107 #endif /* G4HadDecayGenerator_HH */
G4bool Generate(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
void ReportInvalidAlgorithm(Algorithm alg) const
const G4String & GetAlgorithmName() const
G4bool GenerateOneBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState) const
void UseAlgorithm(G4VHadDecayAlgorithm *alg)
int G4int
Definition: G4Types.hh:78
G4VHadDecayAlgorithm * theAlgorithm
bool G4bool
Definition: G4Types.hh:79
void SetVerboseLevel(G4int verbose)
double G4double
Definition: G4Types.hh:76
G4HadDecayGenerator(Algorithm alg=Kopylov, G4int verbose=0)
void ReportMissingAlgorithm() const