File indexing completed on 2025-10-31 09:02:48
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0020 
0021 
0022 
0023 
0024 
0025 
0026 
0027 
0028 
0029 
0030 
0031 
0032 
0033 
0034 
0035 
0036 #ifndef G4GeneralPhaseSpaceDecay_h
0037 #define G4GeneralPhaseSpaceDecay_h 1
0038 
0039 #include "G4ios.hh"
0040 #include "globals.hh"
0041 #include "G4VDecayChannel.hh"
0042 #include "G4HadronicException.hh"
0043 
0044 class G4GeneralPhaseSpaceDecay : public G4VDecayChannel
0045 {
0046   public:
0047     
0048       G4GeneralPhaseSpaceDecay(G4int Verbose = 1);
0049 
0050       G4GeneralPhaseSpaceDecay(const G4String& theParentName,
0051                    G4double        theBR,
0052                    G4int           theNumberOfDaughters,
0053                    const G4String& theDaughterName1,
0054                    const G4String& theDaughterName2 = "",
0055                    const G4String& theDaughterName3 = "");
0056 
0057       G4GeneralPhaseSpaceDecay(const G4String& theParentName,
0058                                G4double        theParentMass,
0059                    G4double        theBR,
0060                    G4int           theNumberOfDaughters,
0061                    const G4String& theDaughterName1,
0062                    const G4String& theDaughterName2 = "",
0063                    const G4String& theDaughterName3 = "");
0064 
0065       G4GeneralPhaseSpaceDecay(const G4String& theParentName,
0066                                G4double        theParentMass,
0067                    G4double        theBR,
0068                    G4int           theNumberOfDaughters,
0069                    const G4String& theDaughterName1,
0070                    const G4String& theDaughterName2 ,
0071                    const G4String& theDaughterName3 ,
0072                    const G4double * masses);
0073 
0074       G4GeneralPhaseSpaceDecay(const G4String& theParentName,
0075                                G4double        theParentMass,
0076                    G4double        theBR,
0077                    G4int           theNumberOfDaughters,
0078                    const G4String& theDaughterName1,
0079                    const G4String& theDaughterName2 ,
0080                    const G4String& theDaughterName3 ,
0081                    const G4String& theDaughterName4 ,
0082                    const G4double * masses);
0083 
0084     
0085       virtual ~G4GeneralPhaseSpaceDecay();
0086 
0087   public:
0088      G4double GetParentMass() const;
0089      void SetParentMass(const G4double aParentMass);
0090      virtual G4DecayProducts* DecayIt(G4double mass=0.0);   
0091      static G4double Pmx(G4double e, G4double p1, G4double p2);
0092 
0093   protected:
0094      G4DecayProducts* OneBodyDecayIt();
0095      G4DecayProducts* TwoBodyDecayIt();
0096      G4DecayProducts* ThreeBodyDecayIt();
0097      G4DecayProducts* ManyBodyDecayIt();
0098      
0099   private:
0100      G4double parentmass;
0101      const G4double * theDaughterMasses;
0102     
0103 };  
0104 
0105 
0106 
0107 inline G4double G4GeneralPhaseSpaceDecay::GetParentMass() const
0108 {
0109   return parentmass;
0110 }
0111 
0112 inline void G4GeneralPhaseSpaceDecay::SetParentMass(const G4double aParentMass)
0113 {
0114   parentmass = aParentMass;
0115 }
0116 
0117 
0118 
0119 inline
0120  G4double G4GeneralPhaseSpaceDecay::Pmx(G4double e, G4double p1, G4double p2)
0121 {
0122    
0123    if (e-p1-p2 < 0 )
0124    {  
0125      throw G4HadronicException(__FILE__, __LINE__, "G4GeneralPhaseSpaceDecay::Pmx energy in cms < mass1+mass2");    
0126    }
0127    G4double ppp = (e+p1+p2)*(e+p1-p2)*(e-p1+p2)*(e-p1-p2)/(4.0*e*e);
0128    if (ppp>0) return std::sqrt(ppp);
0129    else       return -1.;
0130 }
0131 
0132 #endif