Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:51: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 // 20/2/2019
0028 // Author: HoangTRAN
0029 
0030 #ifndef G4DNAIndependentReactionTimeStepper_hh
0031 #define G4DNAIndependentReactionTimeStepper_hh 1
0032 
0033 #include "G4VITTimeStepComputer.hh"
0034 #include "G4KDTreeResult.hh"
0035 #include "G4IRTUtils.hh"
0036 #include <memory>
0037 #include <set>
0038 #include "G4ITTrackHolder.hh"
0039 #include "G4ITReaction.hh"
0040 #include "G4ReferenceCast.hh"
0041 #include <unordered_map>
0042 
0043 class G4VDNAReactionModel;
0044 class G4DNAMolecularReactionTable;
0045 class G4MolecularConfiguration;
0046 class G4Molecule;
0047 class G4ITReactionSet;
0048 class G4ITReactionChange;
0049 class G4VITReactionProcess;
0050 class G4ITTrackHolder;
0051 
0052 class G4DNAIndependentReactionTimeStepper : public G4VITTimeStepComputer
0053 {
0054  public:
0055   G4DNAIndependentReactionTimeStepper();
0056   ~G4DNAIndependentReactionTimeStepper() override = default;
0057   G4DNAIndependentReactionTimeStepper(
0058     const G4DNAIndependentReactionTimeStepper&) = delete;
0059   G4DNAIndependentReactionTimeStepper& operator =(
0060     const G4DNAIndependentReactionTimeStepper&) = delete;
0061 
0062   void Prepare() override;
0063   G4double CalculateStep(const G4Track&, const G4double&) override;
0064   G4double CalculateMinTimeStep(G4double, G4double) override;
0065 
0066   void SetReactionModel(G4VDNAReactionModel*);
0067   G4VDNAReactionModel* GetReactionModel();
0068 
0069   std::unique_ptr<G4ITReactionChange> FindReaction(
0070     G4ITReactionSet* pReactionSet,
0071     G4double& currentStepTime,
0072     const G4double globalTime);
0073   void SetReactionProcess(G4VITReactionProcess* pReactionProcess);
0074   void SetVerbose(G4int);
0075 
0076  private:
0077   void InitializeForNewTrack();
0078   class Utils;
0079   void CheckAndRecordResults(G4double reactionTime, const Utils& utils);
0080 
0081   G4double GetTimeToEncounter(const G4Track& trackA, const G4Track& trackB);
0082 
0083   const G4DNAMolecularReactionTable*& fMolecularReactionTable =
0084     reference_cast<const G4DNAMolecularReactionTable*>(fpReactionTable);
0085   G4VDNAReactionModel* fReactionModel     = nullptr;
0086   G4ITTrackHolder* fpTrackContainer       = G4ITTrackHolder::Instance();
0087   G4ITReactionSet* fReactionSet           = G4ITReactionSet::Instance();
0088   G4int fVerbose                          = 0;
0089   G4double fRCutOff                       = G4IRTUtils::GetRCutOff();
0090   G4VITReactionProcess* fpReactionProcess = nullptr;
0091   std::vector<const G4Track *> fSecondaries;
0092   std::unordered_map<G4int, G4ThreeVector> fSampledPositions;
0093   std::set<G4int> fCheckedTracks;
0094   void InitializeReactions(G4double currentGlobalTime);
0095   G4bool fIsInitialized = false;
0096   G4double GetNextReactionTime();
0097   const G4ITReaction* GetNextReaction();
0098 
0099   class Utils
0100   {
0101    public:
0102     Utils(const G4Track& tA, const G4Track& tB);
0103     ~Utils() = default;
0104 
0105     G4Track* fpTrackA{nullptr};
0106     G4Track* fpTrackB{nullptr};
0107     const G4Molecule* fpMoleculeA{nullptr};
0108     const G4Molecule* fpMoleculeB{nullptr};
0109   };
0110 };
0111 #endif