Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4UniversalFluctuation.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 // $Id: G4UniversalFluctuation.hh 106204 2017-09-19 10:37:49Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class header file
31 //
32 //
33 // File name: G4UniversalFluctuation
34 //
35 // Author: V.Ivanchenko make a class with the Laszlo Urban model
36 //
37 // Creation date: 03.01.2002
38 //
39 // Modifications:
40 //
41 //
42 // Class Description:
43 //
44 // Implementation of energy loss fluctuations
45 
46 // -------------------------------------------------------------------
47 //
48 
49 #ifndef G4UniversalFluctuation_h
50 #define G4UniversalFluctuation_h 1
51 
52 
53 #include "G4VEmFluctuationModel.hh"
54 #include "G4ParticleDefinition.hh"
55 #include "G4Poisson.hh"
57 
59 {
60 
61 public:
62 
63  explicit G4UniversalFluctuation(const G4String& nam = "UniFluc");
64 
65  virtual ~G4UniversalFluctuation();
66 
68  const G4DynamicParticle*,
69  G4double,
70  G4double,
71  G4double) override;
72 
73  virtual G4double Dispersion(const G4Material*,
74  const G4DynamicParticle*,
75  G4double,
76  G4double) override;
77 
78  virtual void InitialiseMe(const G4ParticleDefinition*) final;
79 
80  // Initialisation prestep
81  virtual void SetParticleAndCharge(const G4ParticleDefinition*,
82  G4double q2) final;
83 
84 private:
85 
86  inline void AddExcitation(CLHEP::HepRandomEngine* rndm,
87  G4double a, G4double e, G4double& eav,
88  G4double& eloss, G4double& esig2);
89 
90  inline void SampleGauss(CLHEP::HepRandomEngine* rndm,
91  G4double eav, G4double esig2,
92  G4double& eloss);
93 
94  // hide assignment operator
97 
100 
102 
103  // Derived quantities
107 
108  // data members to speed up the fluctuation calculation
111 
121 
123 
128 
131 
132 };
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 
136 
137 inline void
139  G4double ax, G4double ex, G4double& eav,
140  G4double& eloss, G4double& esig2)
141 {
142  if(ax > nmaxCont) {
143  eav += ax*ex;
144  esig2 += ax*ex*ex;
145  } else {
146  G4int p = G4Poisson(ax);
147  if(p > 0) { eloss += ((p + 1) - 2.*rndm->flat())*ex; }
148  }
149 }
150 
151 inline void
153  G4double eav, G4double esig2,
154  G4double& eloss)
155 {
156  G4double x = eav;
157  G4double sig = std::sqrt(esig2);
158  if(eav < 0.25*sig) {
159  x += (2.*rndm->flat() - 1.)*eav;
160  } else {
161  do {
162  x = G4RandGauss::shoot(rndm, eav, sig);
163  } while (x < 0.0 || x > 2*eav);
164  // Loop checking, 23-Feb-2016, Vladimir Ivanchenko
165  }
166  eloss += x;
167 }
168 
169 #endif
170 
Float_t x
Definition: compare.C:6
virtual void InitialiseMe(const G4ParticleDefinition *) final
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
const G4Material * lastMaterial
virtual G4double Dispersion(const G4Material *, const G4DynamicParticle *, G4double, G4double) override
virtual G4double SampleFluctuations(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double, G4double, G4double) override
const char * p
Definition: xmltok.h:285
G4UniversalFluctuation & operator=(const G4UniversalFluctuation &right)=delete
void AddExcitation(CLHEP::HepRandomEngine *rndm, G4double a, G4double e, G4double &eav, G4double &eloss, G4double &esig2)
double G4double
Definition: G4Types.hh:76
virtual double flat()=0
virtual void SetParticleAndCharge(const G4ParticleDefinition *, G4double q2) final
ThreeVector shoot(const G4int Ap, const G4int Af)
int G4int
Definition: G4Types.hh:78
const G4ParticleDefinition * particle
void SampleGauss(CLHEP::HepRandomEngine *rndm, G4double eav, G4double esig2, G4double &eloss)
G4UniversalFluctuation(const G4String &nam="UniFluc")
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:51