Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Multibody "phase space" generator using GENBOD (CERNLIB W515) method.
0028 //
0029 // Author:  Michael Kelsey (SLAC) <kelsey@slac.stanford.edu>
0030 
0031 #ifndef G4HadPhaseSpaceGenbod_HH
0032 #define G4HadPhaseSpaceGenbod_HH 1
0033 
0034 #include "G4VHadPhaseSpaceAlgorithm.hh"
0035 
0036 
0037 class G4HadPhaseSpaceGenbod : public G4VHadPhaseSpaceAlgorithm {
0038 public:
0039   G4HadPhaseSpaceGenbod(G4int verbose=0);
0040   virtual ~G4HadPhaseSpaceGenbod() {;}
0041 
0042 protected:
0043   virtual void GenerateMultiBody(G4double initialMass,
0044                  const std::vector<G4double>& masses,
0045                  std::vector<G4LorentzVector>& finalState);
0046 
0047 protected:
0048   void Initialize(G4double initialMass,
0049           const std::vector<G4double>& masses);
0050               
0051   void FillRandomBuffer();
0052 
0053   void ComputeWeightScale(const std::vector<G4double>& masses);
0054 
0055   void FillEnergySteps(G4double initialMass,
0056                const std::vector<G4double>& masses);
0057 
0058   void GenerateMomenta(const std::vector<G4double>& masses,
0059                std::vector<G4LorentzVector>& finalState);
0060 
0061   void AccumulateFinalState(size_t i,
0062                 const std::vector<G4double>& masses,
0063                 std::vector<G4LorentzVector>& finalState);
0064 
0065   G4bool AcceptEvent() const;   // Use accept-reject to generate distribution
0066   G4double ComputeWeight() const;
0067 
0068 private:
0069   size_t nFinal;        // Number of final state particles
0070   G4double totalMass;       // Sum of final state masses
0071   G4double massExcess;      // Available kinetic energy
0072   G4double weightMax;       // Maximum possible weight
0073   G4int nTrials;        // Accept/reject cycles taken
0074 
0075   std::vector<G4double> msum;   // Cumulative sum of masses
0076   std::vector<G4double> msq;    // Final state squared masses
0077   std::vector<G4double> rndm;   // Random sequence for effective masses
0078   std::vector<G4double> meff;   // Random final-state effective masses
0079   std::vector<G4double> pd; // Random momentum magnitudes
0080 };
0081 
0082 #endif  /* G4HadPhaseSpaceGenbod_HH */