Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4GeneralParticleSourceData.hh
이 파일의 문서화 페이지로 가기
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 // -------------------------------------------------------------------
28 //
29 // GEANT4 Class file
30 //
31 //
32 // File name: G4GeneralParticleSourceData.hh
33 //
34 // Author: Andrew Green
35 //
36 // Creation date: 20 Mar 2014
37 //
38 // Class Description:
39 // This class uses the singleton pattern to create a single copy of the data
40 // needed for the G4GPS class. As yet, only the largest parts have been split
41 // off.
42 //
43 // Thread Safety:
44 // Singleton creation (G4GeneralParticleSourceData::Instance()) is thread safe.
45 // Getters are thread-safe if no other thread is adding/deleting a source or normalizing
46 // However please note that the setters are usually accessed via messenger. This should be
47 // instantiated in master thread.
48 //
49 // For convinience Lock and Unlock methods are provided that can be used to serialize calls.
50 // For example:
51 // gpsdata=G4GeneralParticleSourceData::Instance();
52 // gpsdata->Lock();
53 // gpsdata->AddASource(1.0);
54 // gpsdata->Unlock();
55 
56 
57 #ifndef G4GPS_DATA_HH
58 #define G4GPS_DATA_HH 1
59 
61 #include "G4Threading.hh"
62 
64 {
65  public:
67 
68  void AddASource(G4double intensity);
69  void DeleteASource(G4int idx);
70  void ClearSources();
71 
72  void IntensityNormalise();
73 
74  G4bool Normalised() const {return normalised;}
75 
78 
79  G4int GetSourceVectorSize() const {return G4int(sourceVector.size());}
81  G4double GetIntensity(G4int idx)const {return sourceIntensity.at(idx);}
83 
85 
86  void SetFlatSampling(G4bool fSamp){flat_sampling = fSamp;}
87  G4bool GetFlatSampling() const { return flat_sampling; }
88 
89  void SetMultipleVertex(G4bool flag) { multiple_vertex = flag; }
91 
93 
95  //Lock/Unlock shared mutex
96  void Lock();
97  void Unlock();
98 
99  private:
102 
103 
104  private:
105 
106  std::vector<G4SingleParticleSource*> sourceVector;
107  std::vector <G4double> sourceIntensity;
108  std::vector <G4double> sourceProbability;
109 
113 
117 };
118 
119 #endif
std::vector< G4SingleParticleSource * > sourceVector
static G4GeneralParticleSourceData * Instance()
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4SingleParticleSource * GetCurrentSource() const
G4double GetSourceProbability(G4int idx) const
int G4int
Definition: G4Types.hh:78
G4double GetIntensity(G4int idx) const
std::mutex G4Mutex
Definition: G4Threading.hh:84