Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4UCNLoss.cc
Go to the documentation of this file.
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: G4UCNLoss.cc 69576 2013-05-08 13:48:13Z gcosmo $
27 //
29 // Ultra Cold Neutron Loss Class Implementation
31 //
32 // File: G4UCNLoss.cc
33 // Description: Discrete Process -- Loss of UCN
34 // energy-independent loss cross section inside a material
35 // Version: 1.0
36 // Created: 2014-05-05
37 // Author: Peter Gumplinger
38 // Adopted from: UCN simple absorption, Peter Fierlinger 7.9.04
39 // Marcin Kuzniaka 21.4.06
40 // Updated:
41 // mail: gum@triumf.ca
42 //
44 
45 #include "G4UCNProcessSubType.hh"
46 
47 #include "G4UCNLoss.hh"
48 
49 #include "G4SystemOfUnits.hh"
50 #include "G4PhysicalConstants.hh"
51 
53 // Class Implementation
55 
57  // Operators
59 
60 // G4UCNLoss::operator=(const G4UCNLoss &right)
61 // {
62 // }
63 
65  // Constructors
67 
68 G4UCNLoss::G4UCNLoss(const G4String& processName, G4ProcessType type)
69  : G4VDiscreteProcess(processName, type)
70 {
71  if (verboseLevel>0) G4cout << GetProcessName() << " is created " << G4endl;
72 
74 }
75 
76 // G4UCNLoss::G4UCNLoss(const G4UCNLoss &right)
77 // {
78 // }
79 
81  // Destructors
83 
85 
87  // Methods
89 
90 // PostStepDoIt
91 // -------------
92 
94 G4UCNLoss::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
95 {
97 
99 
100  if (verboseLevel>0) G4cout << "\n** UCN lost! **" << G4endl;
101 
102  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
103 }
104 
105 // GetMeanFreePath
106 // ---------------
107 
109  G4double ,
111 {
112  G4double AttenuationLength = DBL_MAX;
113 
114  const G4Material* aMaterial = aTrack.GetMaterial();
115  G4MaterialPropertiesTable* aMaterialPropertiesTable =
116  aMaterial->GetMaterialPropertiesTable();
117 
118  G4double crossect = 0.0;
119  if (aMaterialPropertiesTable) {
120  crossect = aMaterialPropertiesTable->GetConstProperty("LOSSCS");
121 // if (crossect == 0.0)
122 // G4cout << "No Loss Cross Section specified" << G4endl;
123  }
124 // else G4cout << "No Loss Cross Section specified" << G4endl;
125 
126  if (crossect) {
127 
128  // Calculate a UCN absorption length for this cross section
129 
130  G4double density = aMaterial->GetTotNbOfAtomsPerVolume();
131 
132  // Calculate cross section for a constant loss
133 
134  crossect *= barn;
135 
136  // Attenuation length
137 
138  AttenuationLength = 1./density/crossect;
139  }
140 
141  return AttenuationLength;
142 }
G4int verboseLevel
Definition: G4VProcess.hh:368
virtual ~G4UCNLoss()
Definition: G4UCNLoss.cc:84
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *condition)
Definition: G4UCNLoss.cc:108
G4GLOB_DLL std::ostream G4cout
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
Definition: G4Step.hh:76
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4Material * GetMaterial() const
G4double GetTotNbOfAtomsPerVolume() const
Definition: G4Material.hh:209
virtual void Initialize(const G4Track &)
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
Definition: G4UCNLoss.cc:94
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:289
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
G4ForceCondition
static constexpr double barn
Definition: G4SIunits.hh:105
#define DBL_MAX
Definition: templates.hh:83
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4double GetConstProperty(const char *key) const
G4ProcessType
G4UCNLoss(const G4String &processName="UCNLoss", G4ProcessType type=fUCN)
Definition: G4UCNLoss.cc:68