Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Author: Mathieu Karamitros
0028 ////
0029 // The code is developed in the framework of the ESA AO7146
0030 //
0031 // We would be very happy hearing from you, so do not hesitate to
0032 // send us your feedback!
0033 //
0034 // In order for Geant4-DNA to be maintained and still open-source,
0035 // article citations are crucial.
0036 // If you use Geant4-DNA chemistry and you publish papers about
0037 // your software, in addition to the general paper on Geant4-DNA:
0038 //
0039 // The Geant4-DNA project, S. Incerti et al.,
0040 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
0041 //
0042 // we ask that you please cite the following papers reference papers
0043 // related to chemistry:
0044 //
0045 // Diffusion-controlled reactions modelling in Geant4-DNA,
0046 // M. Karamitros et al., 2014 (submitted)
0047 // Modeling Radiation Chemistry in the Geant4 Toolkit, M. Karamitros et al.,
0048 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
0049 
0050 #ifndef G4VITTimeStepper_H
0051 #define G4VITTimeStepper_H
0052 
0053 #include "G4Track.hh"
0054 #include "G4ITReactionTable.hh"
0055 #include "G4ReferenceCountedHandle.hh"
0056 #include "AddClone_def.hh"
0057 #include "G4memory.hh"
0058 
0059 //typedef G4ReferenceCountedHandle< std::vector<G4Track*> > G4TrackVectorHandle;
0060 using G4TrackVectorHandle = std::shared_ptr<std::vector<G4Track *>>;
0061 
0062 /**
0063   * Before stepping all tracks G4Scheduler calls all the G4VITModel
0064   * which may contain a G4VITTimeStepper (optionnal).
0065   * G4VITTimeStepper returns what should be the next global time step.
0066   * Time step that will be used to step all tracks.
0067   */
0068 
0069 class G4VITTimeStepComputer
0070 {
0071 public:
0072     G4VITTimeStepComputer();
0073     virtual ~G4VITTimeStepComputer();
0074 
0075     G4VITTimeStepComputer(const G4VITTimeStepComputer&);
0076     G4VITTimeStepComputer& operator=(const G4VITTimeStepComputer& other);
0077 
0078     /** This macro defined in AddClone_def **/
0079     G4IT_TO_BE_CLONED(G4VITTimeStepComputer)
0080 
0081     // First initialization (done once for all at the begin of the run)
0082     // eg. check if the reaction table is given ...
0083     inline virtual void Initialize(){;}
0084 
0085     // Preparation part
0086     static void SetTimes(const G4double&, const G4double&);
0087 //    inline virtual void PrepareForAllProcessors(){;}
0088     inline virtual void Prepare() ;
0089 
0090     virtual G4double CalculateStep(const G4Track&, const G4double&) = 0;
0091     virtual G4double CalculateMinTimeStep(G4double, G4double) = 0;
0092 
0093     inline G4TrackVectorHandle GetReactants();
0094     inline virtual void ResetReactants()
0095 //    {fReactants = 0;}
0096     {fReactants.reset();}
0097 
0098     //
0099     inline G4double GetSampledMinTimeStep() ;
0100     
0101     inline void SetReactionTable(const G4ITReactionTable*);
0102     inline const G4ITReactionTable* GetReactionTable();
0103 
0104 
0105 protected :
0106     static G4ThreadLocal G4double fCurrentGlobalTime ;
0107     static G4ThreadLocal G4double fUserMinTimeStep   ;
0108 
0109     G4double fSampledMinTimeStep ;
0110     G4TrackVectorHandle fReactants;
0111 
0112     const G4ITReactionTable* fpReactionTable;
0113 
0114 private:
0115     G4int fVerbose ;
0116 };
0117 
0118 inline void G4VITTimeStepComputer::SetReactionTable(const G4ITReactionTable* table)
0119 {
0120     fpReactionTable = table;
0121 }
0122 
0123 inline const G4ITReactionTable* G4VITTimeStepComputer::GetReactionTable()
0124 {
0125     return fpReactionTable ;
0126 }
0127 
0128 inline void G4VITTimeStepComputer::Prepare()
0129 {
0130 //    fReactants = 0 ;
0131     fReactants.reset() ;
0132 }
0133 
0134 inline G4double G4VITTimeStepComputer::GetSampledMinTimeStep()
0135 {
0136     return fSampledMinTimeStep ;
0137 }
0138 
0139 inline G4TrackVectorHandle G4VITTimeStepComputer::GetReactants()
0140 {
0141     return  fReactants ;
0142 }
0143 #endif // G4VITTimeStepper_H