Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:20

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 // ----------------------------------------------------------------
0029 //      GEANT 4 class header file
0030 //
0031 //      History: first implementation, A. Feliciello, 20th May 1998
0032 //
0033 //      Note: this class is a generalization of the 
0034 //            G4PhaseSpaceDecayChannel one
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     //Constructors 
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     //  Destructor
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    // calculate momentum of daughter particles in two-body decay
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