ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4UCNLoss.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4UCNLoss.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 //
28 // Ultra Cold Neutron Loss Class Implementation
30 //
31 // File: G4UCNLoss.cc
32 // Description: Discrete Process -- Loss of UCN
33 // energy-independent loss cross section inside a material
34 // Version: 1.0
35 // Created: 2014-05-05
36 // Author: Peter Gumplinger
37 // Adopted from: UCN simple absorption, Peter Fierlinger 7.9.04
38 // Marcin Kuzniaka 21.4.06
39 // Updated:
40 // mail: gum@triumf.ca
41 //
43 
44 #include "G4UCNProcessSubType.hh"
45 
46 #include "G4UCNLoss.hh"
47 
48 #include "G4SystemOfUnits.hh"
49 #include "G4PhysicalConstants.hh"
50 
52 // Class Implementation
54 
56  // Operators
58 
59 // G4UCNLoss::operator=(const G4UCNLoss &right)
60 // {
61 // }
62 
64  // Constructors
66 
67 G4UCNLoss::G4UCNLoss(const G4String& processName, G4ProcessType type)
68  : G4VDiscreteProcess(processName, type)
69 {
70  if (verboseLevel>0) G4cout << GetProcessName() << " is created " << G4endl;
71 
73 }
74 
75 // G4UCNLoss::G4UCNLoss(const G4UCNLoss &right)
76 // {
77 // }
78 
80  // Destructors
82 
84 
86  // Methods
88 
89 // PostStepDoIt
90 // -------------
91 
93 G4UCNLoss::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
94 {
96 
98 
99  if (verboseLevel>0) G4cout << "\n** UCN lost! **" << G4endl;
100 
101  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
102 }
103 
104 // GetMeanFreePath
105 // ---------------
106 
108  G4double ,
110 {
111  G4double AttenuationLength = DBL_MAX;
112 
113  const G4Material* aMaterial = aTrack.GetMaterial();
114  G4MaterialPropertiesTable* aMaterialPropertiesTable =
115  aMaterial->GetMaterialPropertiesTable();
116 
117  G4double crossect = 0.0;
118  if (aMaterialPropertiesTable) {
119  crossect = aMaterialPropertiesTable->GetConstProperty("LOSSCS");
120 // if (crossect == 0.0)
121 // G4cout << "No Loss Cross Section specified" << G4endl;
122  }
123 // else G4cout << "No Loss Cross Section specified" << G4endl;
124 
125  if (crossect) {
126 
127  // Calculate a UCN absorption length for this cross section
128 
129  G4double density = aMaterial->GetTotNbOfAtomsPerVolume();
130 
131  // Calculate cross section for a constant loss
132 
133  crossect *= barn;
134 
135  // Attenuation length
136 
137  AttenuationLength = 1./density/crossect;
138  }
139 
140  return AttenuationLength;
141 }