Back to home page

EIC code displayed by LXR

 
 

    


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

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 //                                                                            //
0028 //  File:   G4RadioactiveDecay.hh                                             //
0029 //  Author: D.H. Wright (SLAC)                                                //
0030 //  Date:   9 August 2017                                                     //
0031 //  Description: version the G4RadioactiveDecay process by F. Lei and         //
0032 //               P.R. Truscott with biasing and activation calculations       //
0033 //               removed to a derived class.  It performs alpha, beta,        //
0034 //               electron capture and isomeric transition decays of           //
0035 //               radioactive nuclei.                                          //
0036 //                                                                            //
0037 ////////////////////////////////////////////////////////////////////////////////
0038 
0039 #ifndef G4RadioactiveDecay_h
0040 #define G4RadioactiveDecay_h 1
0041 
0042 #include <vector>
0043 #include <map>
0044 #include <CLHEP/Units/SystemOfUnits.h>
0045 
0046 #include "G4ios.hh"
0047 #include "globals.hh"
0048 #include "G4VRestDiscreteProcess.hh"
0049 #include "G4ParticleChangeForRadDecay.hh"
0050 
0051 #include "G4NucleusLimits.hh"
0052 #include "G4ThreeVector.hh"
0053 #include "G4RadioactiveDecayMode.hh"
0054 
0055 class G4Fragment;
0056 class G4RadioactiveDecayMessenger;
0057 class G4PhotonEvaporation;
0058 class G4Ions;
0059 class G4DecayTable;
0060 class G4ITDecay;
0061 
0062 typedef std::map<G4String, G4DecayTable*> DecayTableMap;
0063 
0064 
0065 class G4RadioactiveDecay : public G4VRestDiscreteProcess 
0066 {
0067   // class description
0068 
0069   // Implementation of the radioactive decay process which simulates the
0070   // decays of radioactive nuclei.  These nuclei are submitted to RDM as
0071   // G4Ions.  The required half-lives and decay schemes are retrieved from
0072   // the Radioactivity database which was derived from ENSDF.
0073   // All decay products are submitted back to the particle tracking process
0074   // through the G4ParticleChangeForRadDecay object.
0075   // class description - end 
0076 
0077   public: // with description
0078 
0079     G4RadioactiveDecay(const G4String& processName="RadioactiveDecay",
0080                        const G4double timeThreshold=-1.0);
0081     ~G4RadioactiveDecay() override;
0082 
0083     G4bool IsApplicable(const G4ParticleDefinition&) override;
0084     // Return true if the specified isotope is
0085     //  1) defined as "nucleus" and
0086     //  2) it is within theNucleusLimit
0087 
0088     G4VParticleChange* AtRestDoIt(const G4Track& theTrack,
0089                                   const G4Step& theStep) override;
0090 
0091     G4VParticleChange* PostStepDoIt(const G4Track& theTrack,
0092                                     const G4Step& theStep) override;
0093 
0094     void BuildPhysicsTable(const G4ParticleDefinition &) override;
0095 
0096     void ProcessDescription(std::ostream& outFile) const override;
0097 
0098     virtual G4VParticleChange* DecayIt(const G4Track& theTrack,
0099                                        const G4Step& theStep);
0100 
0101     // Return decay table if it exists, if not, load it from file
0102     G4DecayTable* GetDecayTable(const G4ParticleDefinition*);
0103 
0104     // Select a logical volume in which RDM applies
0105     void SelectAVolume(const G4String& aVolume);
0106 
0107     // Remove a logical volume from the RDM applied list
0108     void DeselectAVolume(const G4String& aVolume);
0109 
0110     // Select all logical volumes for the application of RDM
0111     void SelectAllVolumes();
0112 
0113     // Remove all logical volumes from RDM applications
0114     void DeselectAllVolumes();
0115 
0116     // Enable/disable ARM
0117     void SetARM(G4bool arm) {applyARM = arm;}
0118 
0119     G4DecayTable* LoadDecayTable(const G4Ions*);
0120     // Load the decay data of isotope theParentNucleus
0121 
0122     void AddUserDecayDataFile(G4int Z, G4int A, const G4String& filename);
0123     // Allow the user to replace the radio-active decay data provided in Geant4
0124     // by its own data file for a given isotope
0125 
0126     inline void SetNucleusLimits(G4NucleusLimits theNucleusLimits1)
0127       {theNucleusLimits = theNucleusLimits1 ;}
0128     // Sets theNucleusLimits which specifies the range of isotopes
0129     // the G4RadioactiveDecay applies.
0130 
0131     // Returns theNucleusLimits which specifies the range of isotopes used
0132     // by G4RadioactiveDecay
0133     inline G4NucleusLimits GetNucleusLimits() const {return theNucleusLimits;}
0134 
0135     inline void SetDecayDirection(const G4ThreeVector& theDir) {
0136       forceDecayDirection = theDir.unit();
0137     }
0138 
0139     inline const G4ThreeVector& GetDecayDirection() const {
0140       return forceDecayDirection; 
0141     }
0142 
0143     inline void SetDecayHalfAngle(G4double halfAngle=0.*CLHEP::deg) {
0144       forceDecayHalfAngle = std::min(std::max(0.*CLHEP::deg,halfAngle),180.*CLHEP::deg);
0145     }
0146 
0147     inline G4double GetDecayHalfAngle() const {return forceDecayHalfAngle;}
0148 
0149     // Force direction (random within half-angle) for "visible" daughters
0150     // (applies to electrons, positrons, gammas, neutrons, protons or alphas)
0151     inline void SetDecayCollimation(const G4ThreeVector& theDir,
0152                                     G4double halfAngle = 0.*CLHEP::deg) {
0153       SetDecayDirection(theDir);
0154       SetDecayHalfAngle(halfAngle);
0155     }
0156 
0157     // Ignore radioactive decays at rest of nuclides happening after this (very long) time threshold
0158     inline void SetThresholdForVeryLongDecayTime(const G4double inputThreshold) {
0159       fThresholdForVeryLongDecayTime = std::max( 0.0, inputThreshold );
0160     }
0161     inline G4double GetThresholdForVeryLongDecayTime() const {return fThresholdForVeryLongDecayTime;}
0162 
0163     void StreamInfo(std::ostream& os, const G4String& endline);
0164 
0165     G4RadioactiveDecay(const G4RadioactiveDecay& right) = delete;
0166     G4RadioactiveDecay& operator=(const G4RadioactiveDecay& right) = delete;
0167 
0168   protected:
0169 
0170     G4double GetMeanFreePath(const G4Track& theTrack, G4double previousStepSize,
0171                              G4ForceCondition* condition) override;
0172 
0173     G4double GetMeanLifeTime(const G4Track& theTrack,
0174                              G4ForceCondition* condition) override;
0175 
0176     // sampling of products 
0177     void DecayAnalog(const G4Track& theTrack, G4DecayTable*);
0178 
0179     // sampling products at rest
0180     G4DecayProducts* DoDecay(const G4ParticleDefinition&, G4DecayTable*);
0181 
0182     // Apply directional bias for "visible" daughters (e+-, gamma, n, p, alpha)
0183     void CollimateDecay(G4DecayProducts* products);
0184     void CollimateDecayProduct(G4DynamicParticle* product);
0185     G4ThreeVector ChooseCollimationDirection() const;
0186 
0187     // ParticleChange for decay process
0188     G4ParticleChangeForRadDecay fParticleChangeForRadDecay;
0189 
0190     G4RadioactiveDecayMessenger* theRadioactiveDecayMessenger;
0191     G4PhotonEvaporation* photonEvaporation;
0192     G4ITDecay* decayIT;
0193 
0194     std::vector<G4String> ValidVolumes;
0195     bool isAllVolumesMode{true};
0196 
0197     static const G4double levelTolerance;
0198 
0199     // Library of decay tables
0200     static DecayTableMap* master_dkmap;
0201 
0202   private:
0203 
0204     G4NucleusLimits theNucleusLimits;
0205 
0206     G4bool isInitialised{false};
0207     G4bool applyARM{true};
0208 
0209     // Parameters for pre-collimated (biased) decay products
0210     G4ThreeVector forceDecayDirection{G4ThreeVector(0., 0., 0.)};
0211     G4double forceDecayHalfAngle{0.0};
0212     static const G4ThreeVector origin;  // (0,0,0) for convenience
0213 
0214     // Radioactive decay database directory path 
0215     static G4String dirPath;
0216 
0217     // User define radioactive decay data files replacing some files in the G4RADECAY database
0218     static std::map<G4int, G4String>* theUserRDataFiles;
0219 
0220     // The last RadDecayMode
0221     G4RadioactiveDecayMode theRadDecayMode{G4RadioactiveDecayMode::IT};
0222  
0223     // Ignore radioactive decays at rest of nuclides happening after this (very long) time threshold
0224     G4double fThresholdForVeryLongDecayTime;
0225 };
0226 
0227 #endif
0228