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 // Defines an interface to Bertini (BERT) cascade
0027 // based on INUCL  intra-nuclear transport.models 
0028 // with bullet hadron energy ~< 10 GeV
0029 //
0030 // 20100405  M. Kelsey -- Fix constness of op== and op!=
0031 // 20100519  M. Kelsey -- Remove Collider data members
0032 // 20100617  M. Kelsey -- Make G4InuclCollider a local data member
0033 // 20100723  M. Kelsey -- Move G4CollisionOutput here for reuse
0034 // 20100916  M. Kelsey -- Add functions to encapsulate ApplyYourself() actions,
0035 //      make colliders pointers (don't expose dependencies)
0036 // 20100922  M. Kelsey -- Add functions to select de-excitation method
0037 // 20110224  M. Kelsey -- Add createTarget() for use with Propagate(); split
0038 //      conservation law messages to separate function.  Move verbose
0039 //      setting to .cc file, and apply to all member objects.
0040 // 20110301  M. Kelsey -- Add copyPreviousCascade() for use with Propagate()  
0041 //      along with new buffers and related particle-conversion  
0042 //      functions.  Encapulate buffer deletion in clear()
0043 // 20110303  M. Kelsey -- Change "bulletList" name to "inputFragments"
0044 // 20110304  M. Kelsey -- Drop conversion of Propagate() arguments; pass
0045 //      directly to collider for processing.  Rename makeReactionProduct
0046 //      to makeDynamicParticle.
0047 // 20110502  M. Kelsey -- Add filename string to capture random seeds.
0048 // 20110720  M. Kelsey -- Discard elastic-cut array (no longer needed),
0049 //      discard local "theFinalState" (avail in base class).
0050 // 20110801  M. Kelsey -- Make bullet and target buffers local objects (with
0051 //      hadron and nucleus versions) to reduce memory churn
0052 // 20120522  M. Kelsey -- Implement base class IsApplicable, and add overloaded
0053 //      version which takes G4ParticleDefintion, a la G4VProcess.
0054 // 20120822  M. Kelsey -- Add function to dump user configuration settings.
0055 //      Remove local verboseLevel; shadows base class data member.
0056 // 20130501  M. Kelsey -- Add static initializer to created shared objects.
0057 // 20130628  M. Kelsey -- Address Coverity warnings about copy operations.
0058 // 20140116  M. Kelsey -- Move statics to const data members to avoid weird
0059 //      interactions with MT.
0060 
0061 #ifndef G4CASCADEINTERFACE_H
0062 #define G4CASCADEINTERFACE_H 1
0063 
0064 #include "G4VIntraNuclearTransportModel.hh"
0065 #include "G4FragmentVector.hh"
0066 #include "G4InuclElementaryParticle.hh"
0067 #include "G4InuclNuclei.hh"
0068 #include "G4LorentzRotation.hh"
0069 #include "G4Nucleon.hh"
0070 #include "G4Nucleus.hh"
0071 #include "G4ParticleChange.hh"
0072 #include "G4ReactionProduct.hh"
0073 #include "G4ReactionProductVector.hh"
0074 #include <vector>
0075 
0076 class G4CascadParticle;
0077 class G4CascadeCheckBalance;
0078 class G4CollisionOutput;
0079 class G4DynamicParticle;
0080 class G4HadFinalState;
0081 class G4InuclCollider;
0082 class G4LightTargetCollider;
0083 class G4InuclParticle;
0084 class G4ParticleDefinition;
0085 class G4V3DNucleus;
0086 
0087 
0088 class G4CascadeInterface : public G4VIntraNuclearTransportModel {
0089 
0090 public:
0091   G4CascadeInterface(const G4String& name = "BertiniCascade");
0092 
0093   virtual ~G4CascadeInterface();
0094 
0095   G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries,
0096                      G4V3DNucleus* theNucleus);
0097   
0098   G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
0099                  G4Nucleus& theNucleus);
0100 
0101   void SetVerboseLevel(G4int verbose);      // Overrides base class
0102 
0103   G4bool IsApplicable(const G4HadProjectile& aTrack,
0104               G4Nucleus& theNucleus);
0105 
0106   G4bool IsApplicable(const G4ParticleDefinition* aPD) const;
0107 
0108   // Used with multithreaded applications to preload shared objects
0109   static void Initialize();
0110 
0111   // Select betweeen different post-cascade de-excitation models
0112   void useCascadeDeexcitation();
0113   void usePreCompoundDeexcitation();
0114   void useAblaDeexcitation();
0115 
0116   virtual void ModelDescription(std::ostream& outFile) const;
0117   virtual void DumpConfiguration(std::ostream& outFile) const;
0118 
0119 protected:
0120   void clear();         // Delete previously created particles
0121 
0122   // Convert input projectile and target to Bertini internal types
0123   G4bool createBullet(const G4HadProjectile& aTrack);
0124   G4bool createTarget(G4Nucleus& theNucleus);
0125   G4bool createTarget(G4V3DNucleus* theNucleus);
0126   G4bool createTarget(G4int A, G4int Z);
0127 
0128   // Evaluate whether any outgoing particles penetrated Coulomb barrier
0129   G4bool coulombBarrierViolation() const;
0130 
0131   // Conditions for rejecting cascade attempt
0132   G4bool retryInelasticProton() const;
0133   G4bool retryInelasticNucleus() const;
0134 
0135   // Transfer Bertini internal final state to hadronics interface
0136   void copyOutputToHadronicResult();
0137   G4ReactionProductVector* copyOutputToReactionProducts();
0138 
0139   // Replicate input particles onto output
0140   G4HadFinalState* NoInteraction(const G4HadProjectile& aTrack,
0141                  G4Nucleus& theNucleus);
0142 
0143   // Report violations of conservation laws in original frame
0144   void checkFinalResult();
0145 
0146   // Terminate job because of energy/momentum/etc. violations
0147   void throwNonConservationFailure();
0148 
0149   // Convert between Bertini and external particle types
0150   G4DynamicParticle* makeDynamicParticle(const G4InuclElementaryParticle& iep) const;
0151   G4DynamicParticle* makeDynamicParticle(const G4InuclNuclei& inuc) const;
0152 
0153 
0154 private:
0155   G4bool operator==(const G4CascadeInterface& right) const {
0156     return (this == &right);
0157   }
0158 
0159   G4bool operator!=(const G4CascadeInterface& right) const {
0160     return (this != &right);
0161   }
0162 
0163   const G4String randomFile;        // Filename to capture random seeds
0164   const G4int maximumTries;     // Number of iterations for inelastic
0165 
0166   G4int numberOfTries;
0167 
0168   G4InuclCollider* collider;
0169   G4CascadeCheckBalance* balance;
0170 
0171   G4LightTargetCollider* ltcollider;
0172 
0173   G4InuclParticle* bullet;      // Pointers to last filled versions
0174   G4InuclParticle* target;
0175 
0176   G4CollisionOutput* output;
0177 
0178   G4InuclElementaryParticle hadronBullet;   // Buffers for bullet, target
0179   G4InuclNuclei             nucleusBullet;
0180 
0181   G4InuclElementaryParticle hadronTarget;
0182   G4InuclNuclei             nucleusTarget;
0183 
0184   G4int secID;  // Creator model ID for the secondaries
0185   
0186 private:
0187   // Copying of modules is forbidden
0188   G4CascadeInterface(const G4CascadeInterface&);
0189   G4CascadeInterface& operator=(const G4CascadeInterface&);
0190 };
0191 
0192 #endif // G4CASCADEINTERFACE_H