Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:22

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 // Abstract base class for multibody "phase space" generators.  Subclasses
0028 // implement a specific algorithm, such as Kopylov, GENBOD, or Makoto's
0029 // NBody.  Subclasses are used by G4HadPhaseSpaceGenerator.
0030 //
0031 // Author:  Michael Kelsey (SLAC) <kelsey@slac.stanford.edu>
0032 
0033 #ifndef G4VHadDecayAlgorithm_HH
0034 #define G4VHadDecayAlgorithm_HH 1
0035 
0036 #include "globals.hh"
0037 #include "G4LorentzVector.hh"
0038 #include "G4ThreeVector.hh"
0039 #include <vector>
0040 #include <iosfwd>
0041 
0042 class G4VHadDecayAlgorithm {
0043 public:
0044   G4VHadDecayAlgorithm(const G4String& algName, G4int verbose=0)
0045     : name(algName), verboseLevel(verbose) {;}
0046   virtual ~G4VHadDecayAlgorithm() {;}
0047 
0048   // Initial state (rest mass) and list of final masses
0049   void Generate(G4double initialMass,
0050         const std::vector<G4double>& masses,
0051         std::vector<G4LorentzVector>& finalState);
0052 
0053   // Enable (or disable if 0) diagnostic messages (subclass may overload)
0054   virtual void  SetVerboseLevel(G4int verbose) { verboseLevel = verbose; }
0055   G4int GetVerboseLevel() const { return verboseLevel; }
0056   const G4String& GetName() const { return name; }
0057   
0058 protected:
0059   // Subclasses MUST implement these functions
0060   virtual void GenerateTwoBody(G4double initialMass,
0061                    const std::vector<G4double>& masses,
0062                    std::vector<G4LorentzVector>& finalState) = 0;
0063 
0064   virtual void GenerateMultiBody(G4double initialMass,
0065                  const std::vector<G4double>& masses,
0066                  std::vector<G4LorentzVector>& finalState) = 0;
0067 
0068   // Validate kinematics (e.g., limit number of final state particles)
0069   // Subclasses may override or call back to this function
0070   virtual G4bool IsDecayAllowed(G4double initialMass,
0071                 const std::vector<G4double>& masses) const;
0072 
0073   // Two-body momentum function (c.f. PDK from CERNLIB W505)
0074   G4double TwoBodyMomentum(G4double M0, G4double M1, G4double M2) const;
0075 
0076   // Convenience functions for uniform angular distributions
0077   G4double UniformTheta() const;
0078   G4double UniformPhi() const;
0079 
0080   // Utility to dump vector contents to line of output
0081   void PrintVector(const std::vector<G4double>& v, const G4String& name,
0082            std::ostream& os) const;
0083 
0084 private:
0085   G4String name;
0086   G4int verboseLevel;
0087 };
0088 
0089 #endif  /* G4VHadDecayAlgorithm_HH */