Geant4  10.01.p03
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 90900 2015-06-11 08:06:17Z 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;
65 class G4ITGun;
66 
68 {
72 };
73 
88 {
89 protected:
90  virtual ~G4DNAChemistryManager();
91 
92 public:
93  //============================================================================
94  // STATIC METHODS
95  //============================================================================
98 
102  static void DeleteInstance();
105  static G4bool IsActivated();
106  static void Activated(G4bool flag = true);
107 
108  //============================================================================
109  // VIRTUAL METHODS
110  //============================================================================
111  virtual G4bool Notify(G4ApplicationState requestedState);
112  virtual void SetNewValue(G4UIcommand*, G4String);
113  virtual G4String GetCurrentValue(G4UIcommand * command);
114 
115  //============================================================================
116  // INITIALIZATION AND FINALIZATION METHODS
117  //============================================================================
118  void Initialize();
120  inline void Deregister(G4VUserChemistryList*);
121 
122  inline void ForceMasterReinitialization();
123  inline void TagThreadForReinitialization();
124 
125  void Run();
126  void Clear();
127  void Gun(G4ITGun*, bool physicsTableToBuild = true);
128  inline void ForceThreadReinitialization();
129  inline void ForceRebuildingPhysicsTable();
130 
131  //============================================================================
132  // FILE OPERATIONS
133  //============================================================================
139  void WriteInto(const G4String&, std::ios_base::openmode mode =
140  std::ios_base::out);
142 
146  void CloseFile();
147 
148  //============================================================================
149  // PUSH MOLECULES
150  //============================================================================
159  G4int /*electronicLevel*/,
160  const G4Track* /*theIncomingTrack*/);
161 
167  void CreateSolvatedElectron(const G4Track* /*theIncomingTrack*/,
168  G4ThreeVector* finalPosition = 0);
169 
179  void PushMolecule(G4Molecule*& molecule,
180  double time,
181  const G4ThreeVector& position,
182  int parentID);
183 
193  const G4Track* /*theIncomingTrack*/);
194 
195 
196  inline void SetVerbose(G4int verbose)
197  {
198  fVerbose = verbose;
199  }
200 
201 protected:
204  void InitializeFile();
205  void InitializeMaster();
206  void InitializeThread();
207 
209 
210 private:
214 
216 // static bool fActiveChemistry;
220  static G4ThreadLocal std::ofstream* fpgOutput_tl;
224 
227 
231 
233 
235 };
236 
238 {
239  fPhysicsTableBuilt = false;
240 }
241 
243 {
244  fpUserChemistryList = chemistryList;
245  Activated();
246 }
247 
249 {
250  if (fpUserChemistryList == chemistryList) fpUserChemistryList = 0;
251 }
252 
254 {
255  fMasterInitialized = false;
257 }
258 
260 {
261  // TODO
263 }
264 
266 {
268 }
269 
270 #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...
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
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:605
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 ...
bool G4bool
Definition: G4Types.hh:79
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.
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:93
void Gun(G4ITGun *, bool physicsTableToBuild=true)
static G4DNAChemistryManager * GetInstanceIfExists()
G4DNAWaterIonisationStructure * GetIonisationLevel()
G4ApplicationState
G4UIdirectory * fpChemDNADirectory
static G4ThreadLocal std::ofstream * fpgOutput_tl
G4UIcmdWithABool * fpActivateChem
static G4ThreadLocal G4bool * fpgThreadInitialized_tl