Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4CascadeCoalescence:  Factory model for final-state interactions to
0027 //   produce light ions from cascade nucleons.  The algorithm implemented
0028 //   here is descirbed in Section 2.3 of the LAQGSM documentation (p. 11-12)
0029 //   [http://lib-www.lanl.gov/la-pubs/00818645.pdf].
0030 //
0031 // 20110917  Michael Kelsey
0032 // 20110920  M. Kelsey -- Use environment variables to set momentum cuts for tuning,
0033 //       replace polymorphic argument lists with use of "ClusterCandidate"
0034 // 20140116  M. Kelsey -- Move statics to const data members to avoid weird
0035 //      interactions with MT.
0036 // 20151016  M. Kelsey -- Replace forward declare of G4InuclElemPart w/include.
0037 // 20170406  M. Kelsey -- Remove clusterHash and triedClusters registry.
0038 
0039 #ifndef G4CASCADE_COALESCENCE_HH
0040 #define G4CASCADE_COALESCENCE_HH
0041 
0042 #include "globals.hh"
0043 #include "G4InuclElementaryParticle.hh"
0044 #include "G4InuclNuclei.hh"
0045 #include "G4LorentzVector.hh"
0046 #include <vector>
0047 #include <set>
0048 
0049 class G4CollisionOutput;
0050 
0051 
0052 class G4CascadeCoalescence {
0053 public:
0054   G4CascadeCoalescence(G4int verbose=0);
0055   virtual ~G4CascadeCoalescence();
0056 
0057   // Final state particle list is modified directly
0058   void FindClusters(G4CollisionOutput& finalState);
0059 
0060   void setVerboseLevel(G4int verbose) { verboseLevel = verbose; }
0061 
0062 private:
0063   typedef std::vector<size_t> ClusterCandidate; // Indices of constituents
0064 
0065   G4int verboseLevel;               // Control diagnostic messages
0066 
0067   std::vector<ClusterCandidate> allClusters;    // List of candidates found
0068   std::set<size_t> usedNucleons;        // List of converted nucleons
0069 
0070   G4CollisionOutput* thisFinalState;        // Pointers to current event
0071   const std::vector<G4InuclElementaryParticle>* thisHadrons;
0072 
0073   ClusterCandidate thisCluster;         // Reusable buffer for attempts
0074   G4InuclNuclei thisLightIon;           // Reusable construction buffer
0075 
0076   const G4double dpMaxDoublet;          // Relative momenta for clusters
0077   const G4double dpMaxTriplet;
0078   const G4double dpMaxAlpha;
0079 
0080   // Processing stages -- search, construct, cleanup
0081   void selectCandidates();
0082   void createNuclei();
0083   void removeNucleons();
0084 
0085   // Do combinatorics of given nucleons to make candidates
0086   void tryClusters(size_t idx1, size_t idx2);
0087   void tryClusters(size_t idx1, size_t idx2, size_t idx3);
0088   void tryClusters(size_t idx1, size_t idx2, size_t idx3, size_t idx4);
0089 
0090   // Create cluster candidate with listed indices
0091   void fillCluster(size_t idx1, size_t idx2);
0092   void fillCluster(size_t idx1, size_t idx2, size_t idx3);
0093   void fillCluster(size_t idx1, size_t idx2, size_t idx3, size_t idx4);
0094 
0095   // Check if indexed nucleon is already in a cluster
0096   bool nucleonUsed(size_t idx) const {
0097     return usedNucleons.find(idx) != usedNucleons.end();
0098   }
0099 
0100   // Evaluate conditions for cluster to form light ion
0101   bool allNucleons(const ClusterCandidate& clus) const;
0102   bool goodCluster(const ClusterCandidate& clus) const;
0103   G4int clusterType(const ClusterCandidate& aCluster) const;
0104 
0105   // Extract hadron from final state list
0106   const G4InuclElementaryParticle& getHadron(size_t idx) const {
0107     return (*thisHadrons)[idx];
0108   }
0109 
0110   // Convert candidate nucleon set into output nucleus (true == success)
0111   bool makeLightIon(const ClusterCandidate& aCluster);
0112 
0113   // Kinematics for cluster evaluations
0114   G4LorentzVector getClusterMomentum(const ClusterCandidate& aCluster) const;
0115   mutable G4LorentzVector pCluster; // Reusable buffer to reduce churn
0116 
0117   G4double maxDeltaP(const ClusterCandidate& aCluster) const;
0118 
0119   // Report cluster arguments for validation
0120   void reportArgs(const G4String& name, const ClusterCandidate& clus) const;
0121   void reportResult(const G4String& name, const G4InuclNuclei& nucl) const;
0122 };
0123 
0124 #endif  /* G4CASCADE_COALESCENCE_HH */