Geant4  10.01.p03
G4DNAMolecularMaterial.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: G4DNAMolecularMaterial.hh 85244 2014-10-27 08:24:13Z gcosmo $
27 //
28 // Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
29 
30 // The code is developed in the framework of the ESA AO7146
31 //
32 // We would be very happy hearing from you, send us your feedback! :)
33 //
34 // In order for Geant4-DNA to be maintained and still open-source,
35 // article citations are crucial.
36 // If you use Geant4-DNA chemistry and you publish papers about your software,
37 // in addition to the general paper on Geant4-DNA:
38 //
39 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
40 //
41 // we would be very happy if you could please also cite the following
42 // reference papers on chemistry:
43 //
44 // J. Comput. Phys. 274 (2014) 841-882
45 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
46 
47 #ifndef G4DNAMolecularMaterial_HH
48 #define G4DNAMolecularMaterial_HH
49 
50 #include "globals.hh"
51 #include "G4ios.hh"
52 #include <map>
53 #include <vector>
54 #include "G4VStateDependent.hh"
55 
56 class G4Material;
57 
59 {
60  // If the materials derives from a base material,
61  // it should be able to find the derived material using the base material.
62  bool operator()(const G4Material* mat1, const G4Material* mat2) const;
63 };
64 
65 typedef std::map<const G4Material*, double, CompareMaterial> ComponentMap;
66 
67 // G4DNAMolecularMaterial is initialized when G4ApplicationState == G4State_Idle
68 
70 {
71 public:
73  static void DeleteInstance();
74  void Initialize();
75  void Clear();
76 
77  virtual G4bool Notify(G4ApplicationState requestedState);
78 
79  inline const std::vector<ComponentMap>* GetMassFractionTable() const;
80  inline const std::vector<ComponentMap>* GetDensityTable() const;
81 // const std::vector<double>* GetMassFractionTableFor(const G4Material*) const;
82  const std::vector<double>* GetDensityTableFor(const G4Material*) const;
83  const std::vector<double>* GetNumMolPerVolTableFor(const G4Material*) const;
84 
85 protected:
87 // static G4ThreadLocal G4DNAMolecularMaterial* fInstance;
91  virtual ~G4DNAMolecularMaterial();
92  void Create();
94  void InitializeDensity();
95  void RecordMolecularMaterial(G4Material* parentMaterial,
96  G4Material* molecularMaterial,
97  G4double fraction);
98  void SearchMolecularMaterial(G4Material* parentMaterial,
99  G4Material* material,
100  double currentFraction);
101 
102  void AddMaterial(const G4Material*, double fraction);
103 
104  void PrintNotAMolecularMaterial(const char* methodName,
105  const G4Material* lookForMaterial) const;
106 
107  std::vector<ComponentMap>* fpCompFractionTable;
108  std::vector<ComponentMap>* fpCompDensityTable;
109  std::vector<ComponentMap>* fpCompNumMolPerVolTable;
110 
111  mutable std::map<const G4Material*, std::vector<double>*, CompareMaterial>
113  mutable std::map<const G4Material*, std::vector<double>*, CompareMaterial>
115  mutable std::map<const G4Material*, bool, CompareMaterial> fWarningPrinted;
116 
118  size_t fNMaterials;
119 };
120 
121 inline const std::vector<ComponentMap>*
123 {
124  return fpCompFractionTable;
125 }
126 
127 inline const std::vector<ComponentMap>*
129 {
130  return fpCompDensityTable;
131 }
132 
133 #endif // G4DNAMolecularMaterial_HH
const std::vector< double > * GetDensityTableFor(const G4Material *) const
std::map< const G4Material *, double, CompareMaterial > ComponentMap
void SearchMolecularMaterial(G4Material *parentMaterial, G4Material *material, double currentFraction)
virtual G4bool Notify(G4ApplicationState requestedState)
std::map< const G4Material *, std::vector< double > *, CompareMaterial > fAskedNumPerVolTable
void RecordMolecularMaterial(G4Material *parentMaterial, G4Material *molecularMaterial, G4double fraction)
const std::vector< ComponentMap > * GetMassFractionTable() const
bool operator()(const G4Material *mat1, const G4Material *mat2) const
void PrintNotAMolecularMaterial(const char *methodName, const G4Material *lookForMaterial) const
void AddMaterial(const G4Material *, double fraction)
std::vector< ComponentMap > * fpCompNumMolPerVolTable
std::map< const G4Material *, std::vector< double > *, CompareMaterial > fAskedDensityTable
static G4DNAMolecularMaterial * fInstance
const std::vector< double > * GetNumMolPerVolTableFor(const G4Material *) const
bool G4bool
Definition: G4Types.hh:79
G4DNAMolecularMaterial & operator=(const G4DNAMolecularMaterial &)
std::map< const G4Material *, bool, CompareMaterial > fWarningPrinted
static G4DNAMolecularMaterial * Instance()
std::vector< ComponentMap > * fpCompFractionTable
std::vector< ComponentMap > * fpCompDensityTable
double G4double
Definition: G4Types.hh:76
const std::vector< ComponentMap > * GetDensityTable() const
G4ApplicationState