Geant4_10
G4VHadDecayAlgorithm.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 // Abstract base class for multibody "phase space" generators. Subclasses
29 // implement a specific algorithm, such as Kopylov, GENBOD, or Makoto's
30 // NBody. Subclasses are used by G4HadPhaseSpaceGenerator.
31 //
32 // Author: Michael Kelsey (SLAC) <kelsey@slac.stanford.edu>
33 
34 #ifndef G4VHadDecayAlgorithm_HH
35 #define G4VHadDecayAlgorithm_HH 1
36 
37 #include "globals.hh"
38 #include "G4LorentzVector.hh"
39 #include "G4ThreeVector.hh"
40 #include <vector>
41 #include <iosfwd>
42 
44 public:
45  G4VHadDecayAlgorithm(const G4String& algName, G4int verbose=0)
46  : name(algName), verboseLevel(verbose) {;}
47  virtual ~G4VHadDecayAlgorithm() {;}
48 
49  // Initial state (rest mass) and list of final masses
50  void Generate(G4double initialMass,
51  const std::vector<G4double>& masses,
52  std::vector<G4LorentzVector>& finalState);
53 
54  // Enable (or disable if 0) diagnostic messages (subclass may overload)
55  virtual void SetVerboseLevel(G4int verbose) { verboseLevel = verbose; }
56  G4int GetVerboseLevel() const { return verboseLevel; }
57  const G4String& GetName() const { return name; }
58 
59 protected:
60  // Subclasses MUST implement these functions
61  virtual void GenerateTwoBody(G4double initialMass,
62  const std::vector<G4double>& masses,
63  std::vector<G4LorentzVector>& finalState) = 0;
64 
65  virtual void GenerateMultiBody(G4double initialMass,
66  const std::vector<G4double>& masses,
67  std::vector<G4LorentzVector>& finalState) = 0;
68 
69  // Validate kinematics (e.g., limit number of final state particles)
70  // Subclasses may override or call back to this function
71  virtual G4bool IsDecayAllowed(G4double initialMass,
72  const std::vector<G4double>& masses) const;
73 
74  // Two-body momentum function (c.f. PDK from CERNLIB W505)
76 
77  // Convenience functions for uniform angular distributions
78  G4double UniformTheta() const;
79  G4double UniformPhi() const;
80 
81  // Utility to dump vector contents to line of output
82  void PrintVector(const std::vector<G4double>& v, const G4String& name,
83  std::ostream& os) const;
84 
85 private:
86  G4String name;
87  G4int verboseLevel;
88 };
89 
90 #endif /* G4VHadDecayAlgorithm_HH */
virtual void GenerateTwoBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)=0
G4double UniformTheta() const
virtual G4bool IsDecayAllowed(G4double initialMass, const std::vector< G4double > &masses) const
virtual void GenerateMultiBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)=0
const XML_Char * name
Definition: expat.h:151
G4int GetVerboseLevel() const
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
G4VHadDecayAlgorithm(const G4String &algName, G4int verbose=0)
tuple v
Definition: test.py:18
void Generate(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
void PrintVector(const std::vector< G4double > &v, const G4String &name, std::ostream &os) const
virtual void SetVerboseLevel(G4int verbose)
const G4String & GetName() const
G4double UniformPhi() const
G4double TwoBodyMomentum(G4double M0, G4double M1, G4double M2) const
double G4double
Definition: G4Types.hh:76