Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4ExtendedMaterial.cc
이 파일의 문서화 페이지로 가기
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: G4ExtendedMaterial.cc 96792 2016-05-09 09:18:43Z vnivanch $
27 //
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 //
30 // 18-10-07, move definition of material index to InitialisePointers (V.Ivanchenko)
31 // 13-08-08, do not use fixed size arrays (V.Ivanchenko)
32 // 26-10-11, new scheme for G4Exception (mma)
33 // 13-04-12, map<G4Material*,G4double> fMatComponents, filled in AddMaterial()
34 // 21-04-12, fMassOfMolecule, computed for AtomsCount (mma)
35 //
36 //
37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
38 
39 #include "G4ExtendedMaterial.hh"
40 #include "G4VMaterialExtension.hh"
41 #include "G4PhysicsModelCatalog.hh"
42 
43 // Constructor to create an extended material from the base-class G4Material
44 
46  const G4Material* baseMaterial)
47  : G4Material(name,baseMaterial->GetDensity(),baseMaterial,
48  baseMaterial->GetState(),baseMaterial->GetTemperature(),
49  baseMaterial->GetPressure())
50 {;}
51 
52 // Constructor to create an extended material from single element
53 
55  G4double a, G4double density,
56  G4State state, G4double temp, G4double pressure)
57  : G4Material(name,z,a,density,state,temp,pressure)
58 {;}
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
62 // Constructor to create an extended material from a combination of elements
63 // (elements and/or materials) added with AddElement or AddMaterial
64 
66  G4int nComponents,
67  G4State state, G4double temp, G4double pressure)
68  : G4Material(name,density,nComponents,state,temp,pressure)
69 {;}
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
73 // Constructor to create an extended material from the base extended material
74 
76  const G4ExtendedMaterial* bmat,
77  G4State state, G4double temp, G4double pressure)
78  : G4Material(name,density,bmat,state,temp,pressure)
79 {;}
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82 
83 
84 // register G4VMaterialExtension
85 
86 void G4ExtendedMaterial::RegisterExtension(std::unique_ptr<G4VMaterialExtension> extension)
87 {
88  auto iter = fExtensionMap.find(extension->GetName());
89  if(iter!=fExtensionMap.end())
90  {
92  msg << "G4ExtendedMaterial <"<<GetName()<<"> already has extension for "
93  << extension->GetName()
94  << ". Extension is replaced.";
95  G4Exception("G4ExtendedMaterial::RegisterExtension(...)","MatExt001",JustWarning,msg);
96  }
97  fExtensionMap.insert(std::make_pair(extension->GetName(),std::move(extension)));
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
102 // retrieve G4VMaterialExtension, null pointer is returned if model is not available
103 
105 {
106  const auto iter = fExtensionMap.find(name);
107  if(iter!=fExtensionMap.end())
108  { return iter->second.get(); }
109  else
110  {
112  msg << "G4ExtendedMAterial <"<<GetName()<<"> cannot find extension for "
113  << name;
114  G4Exception("G4ExtendedMaterial::RetreiveExtension(...)","MatExt002",JustWarning,msg);
115  return nullptr;
116  }
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120 
122 { return true; }
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125 
126 void G4ExtendedMaterial::Print(std::ostream& flux) const
127 {
128  flux << "\n Registered material extensions :\n";
129  auto iter = fExtensionMap.begin();
130  for(;iter!=fExtensionMap.end();iter++)
131  { flux << " " << iter->first << "\n"; }
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const XML_Char * name
Definition: expat.h:151
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:45
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
G4VMaterialExtension * RetrieveExtension(const G4String &name)
Double_t z
const G4String & GetName() const
Definition: G4Material.hh:179
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
void Print(std::ostream &flux) const
int G4int
Definition: G4Types.hh:78
G4ExtendedMaterial(const G4String &name, const G4Material *baseMaterial)
virtual G4bool IsExtended() const
G4State
Definition: G4Material.hh:115
G4MaterialExtensionMap fExtensionMap
void RegisterExtension(std::unique_ptr< G4VMaterialExtension > extension)