Geant4 Cross Reference |
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 // 27 // 28 // ---------------------------------------------------------------- 29 // GEANT 4 class header file 30 // 31 // History: first implementation, A. Feliciello, 20th May 1998 32 // 33 // Note: this class is a generalization of the 34 // G4PhaseSpaceDecayChannel one 35 // ---------------------------------------------------------------- 36 #ifndef G4GeneralPhaseSpaceDecay_h 37 #define G4GeneralPhaseSpaceDecay_h 1 38 39 #include "G4ios.hh" 40 #include "globals.hh" 41 #include "G4VDecayChannel.hh" 42 #include "G4HadronicException.hh" 43 44 class G4GeneralPhaseSpaceDecay : public G4VDecayChannel 45 { 46 public: 47 //Constructors 48 G4GeneralPhaseSpaceDecay(G4int Verbose = 1); 49 50 G4GeneralPhaseSpaceDecay(const G4String& theParentName, 51 G4double theBR, 52 G4int theNumberOfDaughters, 53 const G4String& theDaughterName1, 54 const G4String& theDaughterName2 = "", 55 const G4String& theDaughterName3 = ""); 56 57 G4GeneralPhaseSpaceDecay(const G4String& theParentName, 58 G4double theParentMass, 59 G4double theBR, 60 G4int theNumberOfDaughters, 61 const G4String& theDaughterName1, 62 const G4String& theDaughterName2 = "", 63 const G4String& theDaughterName3 = ""); 64 65 G4GeneralPhaseSpaceDecay(const G4String& theParentName, 66 G4double theParentMass, 67 G4double theBR, 68 G4int theNumberOfDaughters, 69 const G4String& theDaughterName1, 70 const G4String& theDaughterName2 , 71 const G4String& theDaughterName3 , 72 const G4double * masses); 73 74 G4GeneralPhaseSpaceDecay(const G4String& theParentName, 75 G4double theParentMass, 76 G4double theBR, 77 G4int theNumberOfDaughters, 78 const G4String& theDaughterName1, 79 const G4String& theDaughterName2 , 80 const G4String& theDaughterName3 , 81 const G4String& theDaughterName4 , 82 const G4double * masses); 83 84 // Destructor 85 virtual ~G4GeneralPhaseSpaceDecay(); 86 87 public: 88 G4double GetParentMass() const; 89 void SetParentMass(const G4double aParentMass); 90 virtual G4DecayProducts* DecayIt(G4double mass=0.0); 91 static G4double Pmx(G4double e, G4double p1, G4double p2); 92 93 protected: 94 G4DecayProducts* OneBodyDecayIt(); 95 G4DecayProducts* TwoBodyDecayIt(); 96 G4DecayProducts* ThreeBodyDecayIt(); 97 G4DecayProducts* ManyBodyDecayIt(); 98 99 private: 100 G4double parentmass; 101 const G4double * theDaughterMasses; 102 103 }; 104 105 106 107 inline G4double G4GeneralPhaseSpaceDecay::GetParentMass() const 108 { 109 return parentmass; 110 } 111 112 inline void G4GeneralPhaseSpaceDecay::SetParentMass(const G4double aParentMass) 113 { 114 parentmass = aParentMass; 115 } 116 117 118 119 inline 120 G4double G4GeneralPhaseSpaceDecay::Pmx(G4double e, G4double p1, G4double p2) 121 { 122 // calculate momentum of daughter particles in two-body decay 123 if (e-p1-p2 < 0 ) 124 { 125 throw G4HadronicException(__FILE__, __LINE__, "G4GeneralPhaseSpaceDecay::Pmx energy in cms < mass1+mass2"); 126 } 127 G4double ppp = (e+p1+p2)*(e+p1-p2)*(e-p1+p2)*(e-p1-p2)/(4.0*e*e); 128 if (ppp>0) return std::sqrt(ppp); 129 else return -1.; 130 } 131 132 #endif 133