Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4EmDataHandler.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: G4EmDataHandler.cc 73844 2013-09-13 14:16:30Z vnivanch $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 // File name: G4EmDataHandler
33 //
34 // Author: V. Ivanchenko
35 //
36 // Creation date: 16 August 2017
37 //
38 // Modifications:
39 //
40 // -------------------------------------------------------------------
41 //
42 //
43 
44 #include "G4EmDataHandler.hh"
45 #include "G4ParticleDefinition.hh"
46 #include "G4EmParameters.hh"
47 #include "G4PhysicsTableHelper.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
51 G4EmDataHandler::G4EmDataHandler(size_t n) : tLength(0)
52 {
53  data.reserve(n);
54 }
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 {
60  for(auto & table : data) {
61  if(table) {
62  table->clearAndDestroy();
63  delete table;
64  }
65  }
66  data.clear();
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 {
73  data.push_back(ptr);
74  ++tLength;
75  return tLength-1;
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79 
81 {
82  G4PhysicsTable* table = nullptr;
84  data.push_back(table);
85  ++tLength;
86  return table;
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90 
93  const G4String& namet,
94  const G4String& procname,
95  G4bool ascii)
96 {
97  G4bool yes = true;
98  if(data[idx]) {
99  yes = data[idx]->StorePhysicsTable(namet, ascii);
100 
101  if ( yes ) {
102  G4cout << "Physics table is stored for "
103  << part->GetParticleName()
104  << " and process " << procname
105  << " <" << namet << "> " << G4endl;
106  } else {
107  G4cout << "Fail to store Physics Table for "
108  << part->GetParticleName()
109  << " and process " << procname
110  << " <" << namet << "> " << G4endl;
111  }
112  }
113  return yes;
114 }
115 
116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117 
119  const G4ParticleDefinition* part,
120  const G4String& namet,
121  const G4String& procname,
122  G4bool ascii)
123 {
124  G4bool yes =
126  namet, ascii);
128  if ( yes ) {
129  if (0 < param->Verbose()) {
130  G4cout << "Physics table for "
131  << part->GetParticleName()
132  << " and " << procname
133  << " is retrieved from <" << namet << ">"
134  << G4endl;
135  }
136  if(param->Spline()) {
137  G4PhysicsTable* table = data[idx];
138  size_t n = table->length();
139  for(size_t i=0; i<n; ++i) {
140  if((*table)[i]) { (*table)[i]->SetSpline(true); }
141  }
142  }
143  } else if (1 < param->Verbose()) {
144  G4cout << "Fail to retrieve physics table for "
145  << part->GetParticleName()
146  << " and " << procname << " from <"
147  << namet << ">" << G4endl;
148  }
149  return yes;
150 }
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool StorePhysicsTable(size_t idx, const G4ParticleDefinition *part, const G4String &namet, const G4String &procname, G4bool ascii)
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
#define G4endl
Definition: G4ios.hh:61
const G4String & GetParticleName() const
G4PhysicsTable * MakeTable()
const XML_Char const XML_Char * data
Definition: expat.h:268
bool G4bool
Definition: G4Types.hh:79
TString part[npart]
Definition: Style.C:32
G4bool RetrievePhysicsTable(size_t idx, const G4ParticleDefinition *part, const G4String &namet, const G4String &procname, G4bool ascii)
size_t SetTable(G4PhysicsTable *)
G4int Verbose() const
G4GLOB_DLL std::ostream G4cout
Char_t n[5]
G4EmDataHandler(size_t nTable)
G4bool Spline() const
static G4EmParameters * Instance()
static G4bool RetrievePhysicsTable(G4PhysicsTable *physTable, const G4String &fileName, G4bool ascii)
size_t length() const