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, which provides interface to
0028 // algorithms for sampling.  Momentum vectors are generated in the
0029 // center-of-mass frame of the decay, and returned in a user-supplied
0030 // buffer.  
0031 //
0032 // Sampling algorithm is specified via constructor argument, either by
0033 // code for centrally supplied algorithms (Kopylov, GENBOD, or NBody),
0034 // or by pointer (which is owned by the generator).
0035 //
0036 // Author:  Michael Kelsey (SLAC) <kelsey@slac.stanford.edu>
0037 
0038 #ifndef G4HadDecayGenerator_HH
0039 #define G4HadDecayGenerator_HH 1
0040 
0041 #include "globals.hh"
0042 #include "G4LorentzVector.hh"
0043 #include <vector>
0044 
0045 class G4ParticleDefinition;
0046 class G4VHadDecayAlgorithm;
0047 
0048 
0049 class G4HadDecayGenerator {
0050 public:
0051   // Flags to select algorithm by code in constructor
0052   enum Algorithm { NONE=0, Kopylov=1, GENBOD=2, NBody=3 };
0053 
0054   // Specify "standard" algorithm by code or by object (takes ownership)
0055   G4HadDecayGenerator(Algorithm alg=Kopylov, G4int verbose=0);
0056   G4HadDecayGenerator(G4VHadDecayAlgorithm* alg, G4int verbose=0);
0057   virtual ~G4HadDecayGenerator();
0058 
0059   // Enable (or disable if 0) diagnostic messages
0060   void SetVerboseLevel(G4int verbose);
0061   const G4String& GetAlgorithmName() const;
0062 
0063   // Initial state (rest mass) and list of final masses
0064   G4bool Generate(G4double initialMass,
0065           const std::vector<G4double>& masses,
0066           std::vector<G4LorentzVector>& finalState);
0067 
0068   // Initial state particle and list of final masses
0069   G4bool Generate(const G4ParticleDefinition* initialPD,
0070           const std::vector<G4double>& masses,
0071           std::vector<G4LorentzVector>& finalState);
0072 
0073   // Initial state (frame) and list of final masses
0074   // Final state particles will be boosted to initial-state frame
0075   G4bool Generate(const G4LorentzVector& initialState,
0076           const std::vector<G4double>& masses,
0077           std::vector<G4LorentzVector>& finalState);
0078 
0079 protected:
0080   // Special case for one-body final state
0081   G4bool GenerateOneBody(G4double initialMass,
0082              const std::vector<G4double>& masses,
0083              std::vector<G4LorentzVector>& finalState) const;
0084 
0085   // Special function used by constructor for unrecognized algorithm code
0086   void ReportInvalidAlgorithm(Algorithm alg) const;
0087   void ReportMissingAlgorithm() const;
0088 
0089 protected:
0090   // SPECIAL FUNCTION FOR SUBCLASSES: A subclass may implement a
0091   // collection of algorithms, to be switched on an event-by-event
0092   // basis.  This function allows the subclass to switch the "active"
0093   // algorithm before Generate() is called.
0094   //
0095   // If this function is used by the subclass, then the subclass has
0096   // ownership of _all_ instantiated algorithms, and should delete
0097   // them in its own dtor.  The subclass dtor must also call
0098   // UseAlgorithm(0) to set the base algorithm to a null pointer, to
0099   // prevent a double-delete error.
0100   void UseAlgorithm(G4VHadDecayAlgorithm* alg) { theAlgorithm = alg; }
0101 
0102   G4int verboseLevel;
0103   G4VHadDecayAlgorithm* theAlgorithm;
0104 };
0105 
0106 #endif  /* G4HadDecayGenerator_HH */