ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4UCNAbsorption.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4UCNAbsorption.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 // UCN Absorption Class Implementation
30 //
31 // File: G4UCNAbsorption.cc
32 // Description: Discrete Process -- Absorption of Ultra Cold Neutrons
33 // Version: 1.0
34 // Created: 2014-05-12
35 // Author: Peter Gumplinger
36 // adopted from Geant4UCN by Peter Fierlinger (7.9.04) and
37 // Marcin Kuzniak (21.4.06)
38 // 1/v energy dependent absorption cross section
39 // inside materials
40 // Updated:
41 //
42 // mail: gum@triumf.ca
43 //
45 
46 #include "G4UCNProcessSubType.hh"
47 
48 #include "G4UCNAbsorption.hh"
49 
50 //#include "G4Nucleus.hh"
51 //#include "G4ReactionProduct.hh"
52 //#include "G4NucleiPropertiesTable.hh"
53 
54 #include "G4SystemOfUnits.hh"
55 #include "G4PhysicalConstants.hh"
56 
58 // Class Implementation
60 
62  // Operators
64 
65 // G4UCNAbsorption::operator=(const G4UCNAbsorption &right)
66 // {
67 // }
68 
70  // Constructors
72 
74  : G4VDiscreteProcess(processName, type)
75 {
76  if (verboseLevel>0) G4cout << GetProcessName() << " is created " << G4endl;
77 
79 }
80 
81 // G4UCNAbsorption::G4UCNAbsorption(const G4UCNAbsorpton &right)
82 // {
83 // }
84 
86  // Destructors
88 
90 
92  // Methods
94 
95 // PostStepDoIt
96 // -------------
97 
99 G4UCNAbsorption::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
100 {
101  aParticleChange.Initialize(aTrack);
102 
104 
105  if ( verboseLevel > 0 ) G4cout << "UCNABSORPTION at: "
106  << aTrack.GetProperTime()/s << "s, "
107  << aTrack.GetGlobalTime()/s << "s. "
108  << ", after track length " << aTrack.GetTrackLength()/cm << "cm, "
109  << "in volume "
111  << G4endl;
112 
113  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
114 }
115 
116 // GetMeanFreePath
117 // ---------------
118 
120  G4double ,
122 {
123  G4double AttenuationLength = DBL_MAX;
124 
125  const G4Material* aMaterial = aTrack.GetMaterial();
126  G4MaterialPropertiesTable* aMaterialPropertiesTable =
127  aMaterial->GetMaterialPropertiesTable();
128 
129  G4double losscs = 0.0;
130  if (aMaterialPropertiesTable) {
131  losscs = aMaterialPropertiesTable->GetConstProperty("ABSCS");
132 // if (losscs == 0.0)
133 // G4cout << "No UCN Absorption length specified" << G4endl;
134  }
135 // else G4cout << "No UCN Absorption length specified" << G4endl;
136 
137  if (losscs) {
138 
139  // Calculate a UCN absorption length for this cross section
140 
141  // *** Thermal boost ***
142 
143  // Prepare neutron
144 
145  //G4double theA = aMaterial->GetElement(0)->GetN();
146  //G4double theZ = aMaterial->GetElement(0)->GetZ();
147 
148  //G4ReactionProduct
149  // theNeutron(const_cast<G4ParticleDefinition *>(aTrack.GetDefinition()));
150  //theNeutron.SetMomentum(aTrack.GetMomentum());
151  //theNeutron.SetKineticEnergy(aTrack.GetKineticEnergy());
152  //G4ThreeVector neuVelo = theNeutron.GetMomentum()/
153  // aTrack.GetDefinition()->GetPDGMass());
154 
155  // Prepare properly biased thermal nucleus
156 
157  //G4double theA = aMaterial->GetElement(0)->GetN();
158  //G4double theZ = aMaterial->GetElement(0)->GetZ();
159 
160  //G4double eps = 0.0001;
161 
162  //G4double eleMass =
163  // G4NucleiPropertiesTable::
164  // GetNuclearMass(static_cast<G4int>(theZ+eps),
165  // static_cast<G4int>(theA+eps)))
166  // / G4Neutron::Neutron()->GetPDGMass();
167 
168  //G4Nucleus aNuc;
169 
170  //G4ReactionProduct aThermalNuc =
171  // aNuc.GetBiasedThermalNucleus(eleMass,
172  // neuVelo,
173  // aMaterial->GetTemperature());
174 
175  // Boost to rest system and return
176 
177  //G4ReactionProduct boosted;
178  //boosted.Lorentz(theNeutron, aThermalNuc);
179 
180  //G4double vel = sqrt(2*boosted.GetKineticEnergy()/
181  // neutron_mass_c2*c_squared);
182 
183  G4double density = aMaterial->GetTotNbOfAtomsPerVolume();
184 
185  // Calculate cross section for a constant loss
186 
187  G4double vel = aTrack.GetVelocity();
188 
189  //G4cout << aTrack.GetVelocity()/meter*second << " "
190  // << vel/meter*second << "meters/second" << G4endl;
191 
192  // Input data is normally taken from the website:
193  // http://rrdjazz.nist.gov/resources/n-lengths/list.html
194  // and coresponds to 2200 m/s fast neutrons
195 
196  G4double crossect = losscs*barn*2200.*meter/second/vel;
197 
198  // In principle, if one asks for the MaterialProperty incoherent cross
199  // section, one could put the formula for inelastic up scattering here
200  // and add the cross section to the absorption
201 
202  // sigma inelastic = ... ignatovic, p. 174.
203 
204  // attenuation length in mm
205  AttenuationLength = 1./density/crossect;
206 
207  if (verboseLevel>0) G4cout << "UCNABSORPTION with"
208  << " AttenuationLength: " << AttenuationLength/m << "m"
209  << " CrossSection: " << crossect/barn << "barn" << G4endl;
210  }
211 
212  return AttenuationLength;
213 }