Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4ImportanceConfigurator.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 //
27 // $Id: G4ImportanceConfigurator.cc 108675 2018-02-27 07:34:55Z gcosmo $
28 //
29 // ----------------------------------------------------------------------
30 // Class G4ImportanceConfigurator
31 //
32 // Author: Michael Dressel (Michael.Dressel@cern.ch)
33 // ----------------------------------------------------------------------
34 
36 
37 #include "G4ImportanceProcess.hh"
38 #include "G4ProcessPlacer.hh"
39 #include "G4ImportanceAlgorithm.hh"
40 
42 #include "G4AutoLock.hh"
43 
44 #ifdef G4MULTITHREADED
45 namespace {
46  G4Mutex BiasConfigMutex = G4MUTEX_INITIALIZER;
47 }
48 #endif
49 
52  const G4String &particlename,
53  G4VIStore &istore,
54  const G4VImportanceAlgorithm *ialg, G4bool para)
55  : fWorld(worldvolume),
56  fWorldName(worldvolume->GetName()),
57  fPlacer(particlename),
58  fIStore(istore),
59  fDeleteIalg( ( ! ialg) ),
60  fIalgorithm(( (fDeleteIalg) ?
61  new G4ImportanceAlgorithm : ialg)),
62  fImportanceProcess(0),
63  paraflag(para)
64 {;}
65 
67 G4ImportanceConfigurator(const G4String &worldvolumeName,
68  const G4String &particlename,
69  G4VIStore &istore,
70  const G4VImportanceAlgorithm *ialg, G4bool para)
71 : fWorldName(worldvolumeName),
72  fPlacer(particlename),
73  fIStore(istore),
74  fDeleteIalg( ( ! ialg) ),
75  fIalgorithm(( (fDeleteIalg) ?
76  new G4ImportanceAlgorithm : ialg)),
77  fImportanceProcess(0),
78  paraflag(para)
79 {
82 }
83 
85 {
87  {
89  delete fImportanceProcess;
90  }
91  if (fDeleteIalg)
92  {
93  delete fIalgorithm;
94  }
95 }
96 
97 void
99 {
100  G4cout << "G4ImportanceConfigurator:: entering importance configure, paraflag " << paraflag << G4endl;
101  const G4VTrackTerminator *terminator = 0;
102  if (preConf)
103  {
104  terminator = preConf->GetTrackTerminator();
105  };
106 
107 
108 #ifdef G4MULTITHREADED
109  G4AutoLock l(&BiasConfigMutex);
110 #endif
113  fIStore,
114  terminator,"ImportanceProcess",paraflag);
115 
116  if (!fImportanceProcess)
117  {
118  G4Exception("G4ImportanceConfigurator::Configure()",
119  "FatalError", FatalException,
120  "Failed allocation of G4ImportanceProcess !");
121  }
122 
123  // G4cout << "G4ImportanceConfigurator:: setting parallel World " << paraflag << G4endl;
125 #ifdef G4MULTITHREADED
126  l.unlock();
127 // G4MUTEXUNLOCK(&G4ImportanceConfigurator::BiasConfigMutex);
128 #endif
129  // if(paraflag) fImportanceProcess->SetParallelWorld(fWorldName);
130  // G4cout << "G4ImportanceConfigurator:: set " << paraflag << " name: " << fWorld->GetName() << G4endl;
131  // getchar();
133 }
134 
137 {
138  return fImportanceProcess;
139 }
140 
142 {
143  G4cout << " G4ImportanceConfigurator:: setting world name: " << name << G4endl;
144  fWorldName = name;
145 }
const XML_Char * name
Definition: expat.h:151
virtual const G4VTrackTerminator * GetTrackTerminator() const
G4ImportanceConfigurator(const G4VPhysicalVolume *worldvolume, const G4String &particlename, G4VIStore &istore, const G4VImportanceAlgorithm *ialg, G4bool paraflag)
#define G4endl
Definition: G4ios.hh:61
G4ImportanceProcess * fImportanceProcess
G4Navigator * GetNavigatorForTracking() const
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
virtual void Configure(G4VSamplerConfigurator *preConf)
bool G4bool
Definition: G4Types.hh:79
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:88
void SetParallelWorld(const G4String &parallelWorldName)
virtual void AddProcessAsSecondDoIt(G4VProcess *process)
void SetWorldName(const G4String &Name)
virtual void RemoveProcess(G4VProcess *process)
static G4TransportationManager * GetTransportationManager()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
const G4VImportanceAlgorithm * fIalgorithm
const G4VPhysicalVolume * fWorld
G4GLOB_DLL std::ostream G4cout
virtual const G4VTrackTerminator * GetTrackTerminator() const =0
G4VPhysicalVolume * GetWorldVolume() const
const G4String & GetName() const
std::mutex G4Mutex
Definition: G4Threading.hh:84