Geant4  10.02.p01
G4DNAChemistryManager.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4DNAChemistryManager.hh 93883 2015-11-03 08:25:04Z gcosmo $
27 //
28 
29 // Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
30 //
31 // The code is developed in the framework of the ESA AO7146
32 //
33 // We would be very happy hearing from you, send us your feedback! :)
34 //
35 // In order for Geant4-DNA to be maintained and still open-source,
36 // article citations are crucial.
37 // If you use Geant4-DNA chemistry and you publish papers about your software,
38 // in addition to the general paper on Geant4-DNA:
39 //
40 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
41 //
42 // we would be very happy if you could please also cite the following
43 // reference papers on chemistry:
44 //
45 // J. Comput. Phys. 274 (2014) 841-882
46 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
47 
48 #ifndef G4DNACHEMISTRYMANAGER_HH
49 #define G4DNACHEMISTRYMANAGER_HH
50 
51 #include "globals.hh"
52 #include "G4ThreeVector.hh"
53 #include <fstream>
54 #include <memory>
55 #include "G4UImessenger.hh"
56 #include "G4VStateDependent.hh"
57 
58 class G4Track;
61 class G4Molecule;
63 class G4UIcmdWithABool;
66 class G4ITGun;
67 
69 {
73 };
74 
89 {
90 protected:
91  virtual ~G4DNAChemistryManager();
92 
93 public:
94  //============================================================================
95  // STATIC METHODS
96  //============================================================================
99 
103  static void DeleteInstance();
106  static G4bool IsActivated();
107  static void Activated(G4bool flag = true);
108 
109  //============================================================================
110  // VIRTUAL METHODS
111  //============================================================================
112  virtual G4bool Notify(G4ApplicationState requestedState);
113  virtual void SetNewValue(G4UIcommand*, G4String);
114  virtual G4String GetCurrentValue(G4UIcommand * command);
115 
116  //============================================================================
117  // INITIALIZATION AND FINALIZATION METHODS
118  //============================================================================
119  void Initialize();
121  inline void Deregister(G4VUserChemistryList*);
122  void SetGlobalTemperature(double temp_K);
123 
124  inline void ForceMasterReinitialization();
125  inline void TagThreadForReinitialization();
126 
127  void Run();
128  void Clear();
129  void Gun(G4ITGun*, bool physicsTableToBuild = true);
130  inline void ForceThreadReinitialization();
131  inline void ForceRebuildingPhysicsTable();
132 
133  //============================================================================
134  // FILE OPERATIONS
135  //============================================================================
141  void WriteInto(const G4String&, std::ios_base::openmode mode =
142  std::ios_base::out);
144 
148  void CloseFile();
149 
150  //============================================================================
151  // PUSH MOLECULES
152  //============================================================================
161  G4int /*electronicLevel*/,
162  const G4Track* /*theIncomingTrack*/);
163 
169  void CreateSolvatedElectron(const G4Track* /*theIncomingTrack*/,
170  G4ThreeVector* finalPosition = 0);
171 
181  void PushMolecule(G4Molecule*& molecule,
182  double time,
183  const G4ThreeVector& position,
184  int parentID);
185 
195  const G4Track* /*theIncomingTrack*/);
196 
197 
198  inline void SetVerbose(G4int verbose)
199  {
200  fVerbose = verbose;
201  }
202 
203  inline void SetBuildPhysicsTable(bool flag)
204  {fBuildPhysicsTable = flag;}
205 
207  {
209  }
210 
211  void ResetCounterWhenRunEnds(G4bool resetCounterWhenRunEnds)
212  {
213  fResetCounterWhenRunEnds = resetCounterWhenRunEnds;
214  }
215 
216 protected:
219  void InitializeFile();
220  void InitializeMaster();
221  void InitializeThread();
222 
224 
225 private:
230  //G4UIcmdWithADoubleAndUnit* fpGridSize;
233 
235 // static bool fActiveChemistry;
239  static G4ThreadLocal std::ofstream* fpgOutput_tl;
243 
246 
251 
253 
256 };
257 
259 {
260  fPhysicsTableBuilt = false;
261 }
262 
264 {
265  fpUserChemistryList = chemistryList;
266  Activated();
267 }
268 
270 {
271  if (fpUserChemistryList == chemistryList) fpUserChemistryList = 0;
272 }
273 
275 {
276  fMasterInitialized = false;
278 }
279 
281 {
282  // TODO
284 }
285 
287 {
289 }
290 
291 #endif // G4DNACHEMISTRYMANAGER_HH
void Deregister(G4VUserChemistryList *)
void WriteInto(const G4String &, std::ios_base::openmode mode=std::ios_base::out)
Tells the chemMan to write into a file the position and electronic state of the water molecule and th...
void PushMoleculeAtParentTimeAndPlace(G4Molecule *&molecule, const G4Track *)
WARNING : In case chemistry is not activated, PushMoleculeAtParentTimeAndPlace will take care of dele...
G4UIcmdWithADoubleAndUnit * fpScaleForNewTemperature
CLHEP::Hep3Vector G4ThreeVector
void CreateSolvatedElectron(const G4Track *, G4ThreeVector *finalPosition=0)
On the same idea as the previous method but for solvated electron.
WARNING: THIS CLASS IS A PROTOTYPE G4DNAChemistryManager is called from the physics models...
G4DNAWaterIonisationStructure * fpIonisationLevel
G4UIcmdWithoutParameter * fpSkipReactionsFromChemList
ElectronicModification
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
G4DNAWaterExcitationStructure * GetExcitationLevel()
void SetChemistryList(G4VUserChemistryList *)
static G4DNAChemistryManager * fgInstance
#define position
Definition: xmlparse.cc:622
virtual G4bool Notify(G4ApplicationState requestedState)
virtual void SetNewValue(G4UIcommand *, G4String)
G4VUserChemistryList * fpUserChemistryList
void PushMolecule(G4Molecule *&molecule, double time, const G4ThreeVector &position, int parentID)
WARNING : In case chemistry is not activated, PushMolecule will take care of deleting the transfered ...
G4bool IsCounterResetWhenRunEnds() const
bool G4bool
Definition: G4Types.hh:79
void SetGlobalTemperature(double temp_K)
static void DeleteInstance()
You should rather use DeleteInstance than the destructor of this class.
virtual G4String GetCurrentValue(G4UIcommand *command)
void SetVerbose(G4int verbose)
static G4DNAChemistryManager * Instance()
G4UIcmdWithoutParameter * fpRunChem
G4DNAWaterExcitationStructure * fpExcitationLevel
void CreateWaterMolecule(ElectronicModification, G4int, const G4Track *)
Method used by DNA physics model to create a water molecule.
void CloseFile()
Close the file specified with WriteInto.
void ResetCounterWhenRunEnds(G4bool resetCounterWhenRunEnds)
void SetBuildPhysicsTable(bool flag)
static void Activated(G4bool flag=true)
Class Description The dynamic molecule holds all the data that change for a molecule It has a pointer...
Definition: G4Molecule.hh:94
void Gun(G4ITGun *, bool physicsTableToBuild=true)
static G4DNAChemistryManager * GetInstanceIfExists()
G4UIcmdWithoutParameter * fpInitChem
G4DNAWaterIonisationStructure * GetIonisationLevel()
G4ApplicationState
G4UIdirectory * fpChemDNADirectory
static G4ThreadLocal std::ofstream * fpgOutput_tl
G4UIcmdWithABool * fpActivateChem
static G4ThreadLocal G4bool * fpgThreadInitialized_tl