Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 11:12:01 +02:00
parent 1a1316fea4
commit 2cce0e189d
238 changed files with 0 additions and 62655 deletions
@@ -1,105 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4UMultiUnion
//
// Class description:
//
// Wrapper class for G4UMultiUnion to make use of it from USolids module.
// History:
// 30.10.13 G.Cosmo, T.Nikitina, CERN/PH
// --------------------------------------------------------------------
#ifndef G4UMULTIUNION_HH
#define G4UMULTIUNION_HH
#include <CLHEP/Vector/Rotation.h>
#if defined(G4GEOM_USE_USOLIDS)
#include "G4USolid.hh"
#include "UMultiUnion.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "HepPolyhedronProcessor.h"
class G4UMultiUnion : public G4USolid
{
public: // with description
G4UMultiUnion(const G4String& name);
~G4UMultiUnion();
inline UMultiUnion* GetShape() const;
void AddNode(G4VSolid& solid, G4Transform3D& trans);
// Build the multiple union by adding nodes
G4Transform3D* GetTransformation(G4int index) const;
G4VSolid* GetSolid(G4int index) const;
G4int GetNumberOfSolids()const;
void Voxelize();
public: // without description
G4UMultiUnion(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UMultiUnion( const G4UMultiUnion& source );
G4UMultiUnion& operator=(const G4UMultiUnion& source);
// Copy constructor and assignment operator.
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const;
G4Polyhedron* CreatePolyhedron() const;
// Called by visualization engine
};
// --------------------------------------------------------------------
// Inline methods
// --------------------------------------------------------------------
inline UMultiUnion* G4UMultiUnion::GetShape() const
{
return (UMultiUnion*) fShape;
}
#endif // G4GEOM_USE_USOLIDS
#endif
@@ -1,228 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
//
// Implementation of G4UMultiUnion wrapper class
// --------------------------------------------------------------------
#include "G4UMultiUnion.hh"
#if defined(G4GEOM_USE_USOLIDS)
#include "G4VoxelLimits.hh"
#include "G4BoundingEnvelope.hh"
#include "G4Polyhedron.hh"
#include "G4DisplacedSolid.hh"
#include "G4RotationMatrix.hh"
////////////////////////////////////////////////////////////////////////
//
// Constructor (generic parameters)
//
G4UMultiUnion::G4UMultiUnion(const G4String& name)
: G4USolid(name, new UMultiUnion(name))
{
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UMultiUnion::G4UMultiUnion(__void__& a)
: G4USolid(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
//
G4UMultiUnion::~G4UMultiUnion()
{
}
//////////////////////////////////////////////////////////////////////////
//
// Copy constructor
//
G4UMultiUnion::G4UMultiUnion(const G4UMultiUnion &source)
: G4USolid(source)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Assignment operator
//
G4UMultiUnion& G4UMultiUnion::operator=(const G4UMultiUnion &source)
{
if (this == &source) return *this;
G4USolid::operator=( source );
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Accessors & modifiers
//
void G4UMultiUnion::AddNode(G4VSolid& solid, G4Transform3D& trans)
{
HepGeom::Rotate3D rot;
HepGeom::Translate3D transl ;
HepGeom::Scale3D scale;
trans.getDecomposition(scale,rot,transl);
G4ThreeVector pos = transl.getTranslation();
UTransform3D tr;
tr.fRot[0] = rot.xx(); tr.fRot[1] = rot.xy(); tr.fRot[2] = rot.xz();
tr.fRot[3] = rot.yx(); tr.fRot[4] = rot.yy(); tr.fRot[5] = rot.yz();
tr.fRot[6] = rot.zx(); tr.fRot[7] = rot.zy(); tr.fRot[8] = rot.zz();
tr.fTr = UVector3(pos.x(), pos.y(), pos.z());
GetShape()->AddNode(*(static_cast<G4USolid&>(solid).GetSolid()), tr);
}
G4Transform3D* G4UMultiUnion::GetTransformation(G4int index) const
{
UTransform3D tr = GetShape()->GetTransformation(index);
G4RotationMatrix
rot(CLHEP::HepRep3x3(tr.fRot[0], tr.fRot[1], tr.fRot[2],
tr.fRot[3], tr.fRot[4], tr.fRot[5],
tr.fRot[6], tr.fRot[7], tr.fRot[8]));
G4ThreeVector transl(tr.fTr.x(), tr.fTr.y(), tr.fTr.z());
return new G4Transform3D(rot, transl);
}
G4VSolid* G4UMultiUnion::GetSolid(G4int index) const
{
VUSolid* solid = GetShape()->GetSolid(index);
return new G4USolid(solid->GetName(), solid);
}
G4int G4UMultiUnion::GetNumberOfSolids()const
{
return GetShape()->GetNumberOfSolids();
}
void G4UMultiUnion::Voxelize()
{
GetShape()->Voxelize();
}
//////////////////////////////////////////////////////////////////////////
//
// Get bounding box
void G4UMultiUnion::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
{
UVector3 vmin, vmax;
GetShape()->Extent(vmin,vmax);
pMin.set(vmin.x(),vmin.y(),vmin.z());
pMax.set(vmax.x(),vmax.y(),vmax.z());
// Check correctness of the bounding box
//
if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
{
std::ostringstream message;
message << "Bad bounding box (min >= max) for solid: "
<< GetName() << " !"
<< "\npMin = " << pMin
<< "\npMax = " << pMax;
G4Exception("G4UMultiUnion::Extent()", "GeomMgt0001", JustWarning, message);
DumpInfo();
}
}
//////////////////////////////////////////////////////////////////////////
//
// Calculate extent under transform and specified limit
G4bool
G4UMultiUnion::CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const
{
G4ThreeVector bmin, bmax;
// Get bounding box
Extent(bmin,bmax);
// Find extent
G4BoundingEnvelope bbox(bmin,bmax);
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
}
//////////////////////////////////////////////////////////////////////////
//
// CreatePolyhedron
//
G4Polyhedron* G4UMultiUnion::CreatePolyhedron() const
{
HepPolyhedronProcessor processor;
HepPolyhedronProcessor::Operation operation = HepPolyhedronProcessor::UNION;
G4VSolid* solidA = GetSolid(0);
const G4Transform3D* transform0=GetTransformation(0);
G4RotationMatrix rot0=(*transform0).getRotation();
const G4ThreeVector transl0 = (*transform0).getTranslation();
G4DisplacedSolid dispSolidA("placedA",solidA,&rot0,transl0);
delete transform0;
G4Polyhedron* top = new G4Polyhedron(*dispSolidA.GetPolyhedron());
for(G4int i=1; i<GetNumberOfSolids(); ++i)
{
G4VSolid* solidB = GetSolid(i);
const G4Transform3D* transform=GetTransformation(i);
G4RotationMatrix rot=(*transform).getRotation();
const G4ThreeVector transl = (*transform).getTranslation();
G4DisplacedSolid dispSolidB("placedB",solidB,&rot,transl);
G4Polyhedron* operand = dispSolidB.GetPolyhedron();
processor.push_back (operation, *operand);
delete transform;
}
if (processor.execute(*top)) { return top; }
else { return 0; }
}
#endif // G4GEOM_USE_USOLIDS
@@ -1,255 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4SurfaceVoxelizer.hh 91755 2015-08-05 08:17:56Z gcosmo $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4SurfaceVoxelizer
//
// Class description:
//
// Voxelizer for tessellated surfaces, used in G4TessellatedSolid.
// History:
// 19.10.12 Marek Gayer, created
// --------------------------------------------------------------------
#ifndef G4SurfaceVoxelizer_HH
#define G4SurfaceVoxelizer_HH
#include <vector>
#include <string>
#include <map>
#include "G4SurfBits.hh"
#include "G4Box.hh"
#include "G4VFacet.hh"
struct G4VoxelBox
{
G4ThreeVector hlen; // half length of the box
G4ThreeVector pos; // position of the box
};
struct G4VoxelInfo
{
G4int count;
G4int previous;
G4int next;
};
class G4SurfaceVoxelizer
{
public:
template <typename T>
static inline G4int BinarySearch(const std::vector<T> &vec, T value);
void Voxelize(std::vector<G4VFacet *> &facets);
void DisplayVoxelLimits();
void DisplayBoundaries();
void DisplayListNodes() const;
G4SurfaceVoxelizer();
~G4SurfaceVoxelizer();
void GetCandidatesVoxel(std::vector<G4int> &voxels);
// Method displaying the nodes located in a voxel characterized
// by its three indexes.
G4int GetCandidatesVoxelArray(const G4ThreeVector &point,
std::vector<G4int> &list,
G4SurfBits *crossed=0) const;
// Method returning in a vector container the nodes located in a voxel
// characterized by its three indexes.
G4int GetCandidatesVoxelArray(const std::vector<G4int> &voxels,
const G4SurfBits bitmasks[],
std::vector<G4int> &list,
G4SurfBits *crossed=0) const;
G4int GetCandidatesVoxelArray(const std::vector<G4int> &voxels,
std::vector<G4int> &list,
G4SurfBits *crossed=0)const;
inline const std::vector<G4VoxelBox> &GetBoxes() const;
// Method returning the pointer to the array containing the
// characteristics of each box.
inline const std::vector<G4double> &GetBoundary(G4int index) const;
G4bool UpdateCurrentVoxel(const G4ThreeVector &point,
const G4ThreeVector &direction,
std::vector<G4int> &curVoxel) const;
inline void GetVoxel(std::vector<G4int> &curVoxel,
const G4ThreeVector &point) const;
inline G4int GetBitsPerSlice () const;
G4bool Contains(const G4ThreeVector &point) const;
G4double DistanceToNext(const G4ThreeVector &point,
const G4ThreeVector &direction,
const std::vector<G4int> &curVoxel) const;
G4double DistanceToFirst(const G4ThreeVector &point,
const G4ThreeVector &direction) const;
G4double DistanceToBoundingBox(const G4ThreeVector &point) const;
inline G4int GetVoxelsIndex(G4int x, G4int y, G4int z) const;
inline G4int GetVoxelsIndex(const std::vector<G4int> &voxels) const;
inline G4int GetPointIndex(const G4ThreeVector &p) const;
inline const G4SurfBits &Empty() const;
inline G4bool IsEmpty(G4int index) const;
void SetMaxVoxels(G4int max);
void SetMaxVoxels(const G4ThreeVector &reductionRatio);
inline G4int GetMaxVoxels(G4ThreeVector &ratioOfReduction);
G4int AllocatedMemory();
inline long long GetCountOfVoxels() const;
inline long long CountVoxels(std::vector<G4double> boundaries[]) const;
inline const std::vector<G4int> &
GetCandidates(std::vector<G4int> &curVoxel) const;
inline G4int GetVoxelBoxesSize() const;
inline const G4VoxelBox &GetVoxelBox(G4int i) const;
inline const std::vector<G4int> &GetVoxelBoxCandidates(G4int i) const;
inline G4int GetTotalCandidates() const;
static G4double MinDistanceToBox (const G4ThreeVector &aPoint,
const G4ThreeVector &f);
static G4int SetDefaultVoxelsCount(G4int count);
static G4int GetDefaultVoxelsCount();
private:
class G4VoxelComparator
{
public:
std::vector<G4VoxelInfo> &fVoxels;
G4VoxelComparator(std::vector<G4VoxelInfo> &voxels) : fVoxels(voxels) {}
G4bool operator()(const G4int& l, const G4int& r) const
{
G4VoxelInfo &lv = fVoxels[l], &rv = fVoxels[r];
G4int left = lv.count + fVoxels[lv.next].count;
G4int right = rv.count + fVoxels[rv.next].count;
return (left == right) ? l < r : left < right;
}
};
private:
static G4ThreadLocal G4int fDefaultVoxelsCount;
void BuildEmpty ();
G4String GetCandidatesAsString(const G4SurfBits &bits) const;
void CreateSortedBoundary(std::vector<G4double> &boundaryRaw, G4int axis);
void BuildBoundaries();
void BuildReduceVoxels(std::vector<G4double> fBoundaries[],
G4ThreeVector reductionRatio);
void BuildReduceVoxels2(std::vector<G4double> fBoundaries[],
G4ThreeVector reductionRatio);
void BuildVoxelLimits(std::vector<G4VFacet *> &facets);
void DisplayBoundaries(std::vector<G4double> &fBoundaries);
void BuildBitmasks(std::vector<G4double> fBoundaries[],
G4SurfBits bitmasks[], G4bool countsOnly=false);
void BuildBoundingBox();
void SetReductionRatio(G4int maxVoxels, G4ThreeVector &reductionRatio);
void CreateMiniVoxels(std::vector<G4double> fBoundaries[],
G4SurfBits bitmasks[]);
static void FindComponentsFastest(unsigned int mask,
std::vector<G4int> &list, G4int i);
private:
std::vector<G4VoxelBox> fVoxelBoxes;
std::vector<std::vector<G4int> > fVoxelBoxesCandidates;
mutable std::map<G4int, std::vector<G4int> > fCandidates;
const std::vector<G4int> fNoCandidates;
long long fCountOfVoxels;
G4int fNPerSlice;
std::vector<G4VoxelBox> fBoxes;
// Array of box limits on the 3 cartesian axis
std::vector<G4double> fBoundaries[3];
// Sorted and if need skimmed fBoundaries along X,Y,Z axis
std::vector<G4int> fCandidatesCounts[3];
G4int fTotalCandidates;
G4SurfBits fBitmasks[3];
G4ThreeVector fBoundingBoxCenter;
G4Box fBoundingBox;
G4ThreeVector fBoundingBoxSize;
G4ThreeVector fReductionRatio;
G4int fMaxVoxels;
G4double fTolerance;
G4SurfBits fEmpty;
};
#include "G4SurfaceVoxelizer.icc"
#endif
@@ -1,182 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4SurfaceVoxelizer.icc 91755 2015-08-05 08:17:56Z gcosmo $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4SurfaceVoxelizer inline methods
//
// History:
// 19.10.12 Marek Gayer, created
// --------------------------------------------------------------------
template <typename T> inline
G4int G4SurfaceVoxelizer::BinarySearch(const std::vector<T> &vec, T value)
{
typename std::vector<T>::const_iterator begin=vec.begin(), end=vec.end();
G4int res = std::upper_bound(begin, end, value) - begin - 1;
return res;
}
inline
const std::vector<G4VoxelBox> &G4SurfaceVoxelizer::GetBoxes() const
{
return fBoxes;
}
inline
const std::vector<G4double> &G4SurfaceVoxelizer::GetBoundary(G4int index) const
{
return fBoundaries[index];
}
inline
void G4SurfaceVoxelizer::GetVoxel(std::vector<G4int> &curVoxel,
const G4ThreeVector &point) const
{
for (G4int i=0; i<=2; ++i)
{
const std::vector<double> &boundary = GetBoundary(i);
G4int n = BinarySearch(boundary, point[i]);
if (n == -1)
{ n = 0; }
else if (n == G4int(boundary.size()) - 1)
{ n--; }
curVoxel[i] = n;
}
}
inline
G4int G4SurfaceVoxelizer::GetBitsPerSlice () const
{
return fNPerSlice*8*sizeof(unsigned int);
}
inline
G4int G4SurfaceVoxelizer::GetVoxelsIndex(G4int x, G4int y, G4int z) const
{
if (x < 0 || y < 0 || z < 0) { return -1; }
G4int maxX = fBoundaries[0].size();
G4int maxY = fBoundaries[1].size();
G4int index = x + y*maxX + z*maxX*maxY;
return index;
}
inline
G4int G4SurfaceVoxelizer::GetVoxelsIndex(const std::vector<G4int> &voxels) const
{
return GetVoxelsIndex(voxels[0], voxels[1], voxels[2]);
}
inline
G4int G4SurfaceVoxelizer::GetPointIndex(const G4ThreeVector &p) const
{
G4int maxX = fBoundaries[0].size();
G4int maxY = fBoundaries[1].size();
G4int x = BinarySearch(fBoundaries[0], p[0]);
G4int y = BinarySearch(fBoundaries[1], p[1]);
G4int z = BinarySearch(fBoundaries[2], p[2]);
G4int index = x + y*maxX + z*maxX*maxY;
return index;
}
inline
const G4SurfBits &G4SurfaceVoxelizer::Empty() const
{
return fEmpty;
}
inline
G4bool G4SurfaceVoxelizer::IsEmpty(G4int index) const
{
return fEmpty[index];
}
inline
G4int G4SurfaceVoxelizer::GetMaxVoxels(G4ThreeVector &ratioOfReduction)
{
ratioOfReduction = fReductionRatio;
return fMaxVoxels;
}
inline
long long G4SurfaceVoxelizer::GetCountOfVoxels() const
{
return fCountOfVoxels;
}
inline
long long G4SurfaceVoxelizer::CountVoxels(std::vector<G4double> boundaries[]) const
{
long long sx = boundaries[0].size() - 1;
long long sy = boundaries[1].size() - 1;
long long sz = boundaries[2].size() - 1;
return sx * sy *sz;
}
inline
const std::vector<G4int>&
G4SurfaceVoxelizer::GetCandidates(std::vector<G4int> &curVoxel) const
{
G4int voxelsIndex = GetVoxelsIndex(curVoxel);
if (voxelsIndex >= 0 && !fEmpty[voxelsIndex])
{
return fCandidates[voxelsIndex];
}
return fNoCandidates;
}
inline
G4int G4SurfaceVoxelizer::GetTotalCandidates() const
{
return fTotalCandidates;
}
inline
G4int G4SurfaceVoxelizer::GetVoxelBoxesSize() const
{
return fVoxelBoxes.size();
}
inline
const G4VoxelBox &G4SurfaceVoxelizer::GetVoxelBox(G4int i) const
{
return fVoxelBoxes[i];
}
inline
const std::vector<G4int>&
G4SurfaceVoxelizer::GetVoxelBoxCandidates(G4int i) const
{
return fVoxelBoxesCandidates[i];
}
File diff suppressed because it is too large Load Diff
@@ -1,92 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4coutDestination.hh 66241 2014-05-16 00:00:42Z adotti $
//
//
// ---------------------------------------------------------------
// GEANT 4 class header file
//
// G4ofstreamDestination.hh
// Sends G4cout and G4cerr to a file.
//
// To send G4cout to a file instantiate an instance of
// G4CoutToFile
// To send G4cerr to a file use instead
// G4CerrToFile
//
// Example:
// #include "G4ofstreamDestination.hh"
// #include "G4ios.hh"
// int main(int,char**) {
// G4UImanager::GetUIpointer();
// G4iosInitialization();
// G4CoutToFile myout("MyOut_out.log"); // G4cout to file
// G4CerrToFile myout("MyOut_err.log"); // G4cerr to file
// ---------------------------------------------------------------
#ifndef G4OFSTREAMDESTINATION_HH
#define G4OFSTREAMDESTINATION_HH
#include "G4coutDestination.hh"
#include <fstream>
class G4ofstreamDestinationBase : public G4coutDestination
{
public:
G4ofstreamDestinationBase(const G4String& defaultName , G4bool append);
virtual ~G4ofstreamDestinationBase();
virtual G4int ReceiveG4cout( const G4String& ) = 0;
virtual G4int ReceiveG4cerr( const G4String& ) = 0;
void SetFileName( const G4String& name , G4bool append = true );
void Close();
void Open();
private:
G4String fileName;
G4bool appendFlag;
protected:
std::ofstream g4file;
};
class G4CoutToFile : public G4ofstreamDestinationBase
{
public:
G4CoutToFile(const G4String& deafaultName = "Geant4_cout.txt", G4bool append = true);
virtual G4int ReceiveG4cout( const G4String& msg );
virtual G4int ReceiveG4cerr( const G4String& ) { return 0;}
};
class G4CerrToFile : public G4ofstreamDestinationBase
{
public:
G4CerrToFile(const G4String& deafaultName = "Geant4_cerr.txt", G4bool append = true);
virtual G4int ReceiveG4cout( const G4String& ) { return 0; }
virtual G4int ReceiveG4cerr( const G4String& msg );
};
#endif //G4OFSTREAMDESTINATION_HH
@@ -1,106 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4coutDestination.hh 66241 2014-05-16 00:00:42Z adotti $
//
//
// ---------------------------------------------------------------
// GEANT 4 class cc file
//
// G4ofstreamDestination.cc
//
// ---------------------------------------------------------------
#include "G4strstreambuf.hh"
#include "G4ofstreamDestination.hh"
#include <ios>
//TODO: make this that can be only cout / only cerr or both with a parameter,
// default is both
G4ofstreamDestinationBase::G4ofstreamDestinationBase(const G4String& fn ,
G4bool append)
: G4coutDestination(),
fileName(fn),
appendFlag(append)
{
}
G4ofstreamDestinationBase::~G4ofstreamDestinationBase()
{
Close();
}
void G4ofstreamDestinationBase::SetFileName(const G4String& fn , G4bool append )
{
fileName = fn;
appendFlag = append;
}
void G4ofstreamDestinationBase::Open()
{
if ( ! g4file.is_open() )
{
std::ios::openmode mode = std::ios::out;
if ( appendFlag )
mode |= std::ios::app;
g4file.open(fileName,mode);
}
}
void G4ofstreamDestinationBase::Close()
{
if ( g4file.is_open() )
g4file.close();
}
//========================
//Concrete implementations
//========================
G4CoutToFile::G4CoutToFile(const G4String& defaultName , G4bool append) :
G4ofstreamDestinationBase(defaultName,append)
{
G4coutbuf.SetDestination(this);
}
G4int G4CoutToFile::ReceiveG4cout(const G4String& msg)
{
if ( ! g4file.is_open() ) Open();
g4file<<msg<<std::flush;
return 0;
}
G4CerrToFile::G4CerrToFile(const G4String& defaultName, G4bool append) :
G4ofstreamDestinationBase(defaultName,append)
{
G4cerrbuf.SetDestination(this);
}
G4int G4CerrToFile::ReceiveG4cerr(const G4String& msg)
{
if ( !g4file.is_open() ) Open();
g4file<<msg<<std::flush;
return 0;
}
@@ -1,53 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef TheoModelFactory_hh
#define TheoModelFactory_hh
template<class C, class S, class F>
class TheoModelFactory
{
public:
static G4TheoFSGenerator * New()
{
G4TheoFSGenerator * result = new G4TheoFSGenerator;
G4VIntraNuclearTransportModel * theCascade = new C;
result->SetTransport(theCascade);
G4VLongitudinalStringDecay * theFragmentation = new F;
G4ExcitedStringDecay * theStringDecay = new G4ExcitedStringDecay(theFragmentation);
G4VPartonStringModel * theStringModel = new S;
theStringModel->SetFragmentationModel(theStringDecay);
result->SetHighEnergyGenerator(theStringModel);
return result;
}
private:
};
// 2002 by J.P. Wellisch
#endif
@@ -1,46 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VAlphaBuilder.cc,v 1.2 2013/02/26 10:34:24 arce Exp $
// GEANT4 tag $Name: $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VAlphaBuilder
//
// Author: 2002 J.P. Wellisch
//
// Modified:
// 30.03.2009 V.Ivanchenko move constructor and destructor to source
//
//----------------------------------------------------------------------------
//
#include "G4VAlphaBuilder.hh"
G4VAlphaBuilder::G4VAlphaBuilder()
{}
G4VAlphaBuilder::~G4VAlphaBuilder()
{}
@@ -1,45 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VAntiBarionBuilder.cc 66892 2013-01-17 10:57:59Z gunter $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VAntiBarionBuilder
//
// Author: 2002 J.P. Wellisch
//
// Modified:
// 30.03.2009 V.Ivanchenko move constructor and destructor to source
//
//----------------------------------------------------------------------------
//
#include "G4VAntiBarionBuilder.hh"
G4VAntiBarionBuilder::G4VAntiBarionBuilder()
{}
G4VAntiBarionBuilder::~G4VAntiBarionBuilder()
{}
@@ -1,46 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VDeuteronBuilder.cc,v 1.2 2013/02/26 10:34:25 arce Exp $
// GEANT4 tag $Name: $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VDeuteronBuilder
//
// Author: 2002 J.P. Wellisch
//
// Modified:
// 30.03.2009 V.Ivanchenko move constructor and destructor to source
//
//----------------------------------------------------------------------------
//
#include "G4VDeuteronBuilder.hh"
G4VDeuteronBuilder::G4VDeuteronBuilder()
{}
G4VDeuteronBuilder::~G4VDeuteronBuilder()
{}
@@ -1,46 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VHe3Builder.cc,v 1.2 2013/02/26 10:34:25 arce Exp $
// GEANT4 tag $Name: $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VHe3Builder
//
// Author: 2002 J.P. Wellisch
//
// Modified:
// 30.03.2009 V.Ivanchenko move constructor and destructor to source
//
//----------------------------------------------------------------------------
//
#include "G4VHe3Builder.hh"
G4VHe3Builder::G4VHe3Builder()
{}
G4VHe3Builder::~G4VHe3Builder()
{}
@@ -1,45 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VKaonBuilder.cc 66892 2013-01-17 10:57:59Z gunter $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VKaonBuilder
//
// Author: 2010 G.Folger
// devired from G4VPiKBuilder
//
// Modified:
//
//----------------------------------------------------------------------------
//
#include "G4VKaonBuilder.hh"
G4VKaonBuilder::G4VKaonBuilder()
{}
G4VKaonBuilder::~G4VKaonBuilder()
{}
@@ -1,45 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VNeutronBuilder.cc 66892 2013-01-17 10:57:59Z gunter $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VNeutronBuilder
//
// Author: 2002 J.P. Wellisch
//
// Modified:
// 30.03.2009 V.Ivanchenko move constructor and destructor to source
//
//----------------------------------------------------------------------------
//
#include "G4VNeutronBuilder.hh"
G4VNeutronBuilder::G4VNeutronBuilder()
{}
G4VNeutronBuilder::~G4VNeutronBuilder()
{}
@@ -1,45 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VPiKBuilder.cc 66892 2013-01-17 10:57:59Z gunter $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VPiKBuilder
//
// Author: 2002 J.P. Wellisch
//
// Modified:
// 30.03.2009 V.Ivanchenko move constructor and destructor to source
//
//----------------------------------------------------------------------------
//
#include "G4VPiKBuilder.hh"
G4VPiKBuilder::G4VPiKBuilder()
{}
G4VPiKBuilder::~G4VPiKBuilder()
{}
@@ -1,45 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VPionBuilder.cc 66892 2013-01-17 10:57:59Z gunter $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VPionBuilder
//
// Author: 2010 G.Folger
// devired from G4VPiKBuilder
//
// Modified:
//
//----------------------------------------------------------------------------
//
#include "G4VPionBuilder.hh"
G4VPionBuilder::G4VPionBuilder()
{}
G4VPionBuilder::~G4VPionBuilder()
{}
@@ -1,45 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VProtonBuilder.cc 66892 2013-01-17 10:57:59Z gunter $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VProtonBuilder
//
// Author: 2002 J.P. Wellisch
//
// Modified:
// 30.03.2009 V.Ivanchenko move constructor and destructor to source
//
//----------------------------------------------------------------------------
//
#include "G4VProtonBuilder.hh"
G4VProtonBuilder::G4VProtonBuilder()
{}
G4VProtonBuilder::~G4VProtonBuilder()
{}
@@ -1,46 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VTritonBuilder.cc,v 1.2 2013/02/26 10:34:26 arce Exp $
// GEANT4 tag $Name: $
//
//---------------------------------------------------------------------------
//
// ClassName: G4VTritonBuilder
//
// Author: 2002 J.P. Wellisch
//
// Modified:
// 30.03.2009 V.Ivanchenko move constructor and destructor to source
//
//----------------------------------------------------------------------------
//
#include "G4VTritonBuilder.hh"
G4VTritonBuilder::G4VTritonBuilder()
{}
G4VTritonBuilder::~G4VTritonBuilder()
{}
@@ -1,161 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4VDNAPTBMODEL_HH
#define G4VDNAPTBMODEL_HH
#include "G4VEmModel.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4DNAMolecularMaterial.hh"
#include "G4LogLogInterpolation.hh"
#include "G4ParticleTable.hh"
class G4VDNAPTBModel : public G4VEmModel
{
public:
G4VDNAPTBModel(const G4String& nam, const G4String& applyToMaterial);
virtual ~G4VDNAPTBModel();
// ***********************
// Initialisation
// ***********************
virtual void Initialise(const G4ParticleDefinition* particle,
const G4DataVector& cuts) =0;
G4bool IsMaterialDefine(const G4String& materialName);
G4bool IsParticleExistingInModel(const G4String& particleName);
G4bool IsMaterialExistingInModelForParticle(const G4String& particleName, const G4String& materialName);
void SetHighELimit(const G4String& material, const G4String& particle, G4double lim) {fHighEnergyLimits[particle][material]=lim;}
void SetLowELimit(const G4String& material, const G4String& particle, G4double lim) {fLowEnergyLimits[particle][material]=lim;}
G4double GetHighELimit(const G4String& material, const G4String& particle) {return fHighEnergyLimits[particle][material];}
G4double GetLowELimit(const G4String& material, const G4String& particle) {return fLowEnergyLimits[particle][material];}
// ***********************
// Runtime
// ***********************
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax) = 0;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin = 0,
G4double tmax = DBL_MAX) = 0;
G4double GetHighELimit(const G4Material* material) {return fHighEnergyLimitsRuntime.at(material->GetIndex() );}
G4double GetLowELimit(const G4Material* material) {return fLowEnergyLimitsRuntime.at(material->GetIndex() );}
void SetHighELimit(const G4Material* material, G4double lim) {fHighEnergyLimitsRuntime[material->GetIndex()]=lim;}
void SetLowELimit(const G4Material* material, G4double lim) {fLowEnergyLimitsRuntime[material->GetIndex()]=lim;}
protected:
// ***********************
// Initialisation variables
// ***********************
typedef std::map<G4String, std::map<G4String,G4DNACrossSectionDataSet*, std::less<G4String> > > TableMapData;
const G4String fStringOfMaterials;
TableMapData fTableData;
struct MaterialData
{
MaterialData(const G4String& mat, const G4String& particule, const G4String& CSFile,
const G4String& diffCSFile, G4double scaleFactor) :
fMaterial(mat),
fParticle(particule),
fCSFile(CSFile),
fDiffCSFile(diffCSFile),
fScaleFactor(scaleFactor)
{
}
G4String fMaterial; // materials that can be activated (and will be by default) within the model
G4String fParticle; // particles that can be activated within the model
G4String fCSFile; // cross section data files
G4String fDiffCSFile; // differential corss section data files
G4double fScaleFactor; // model scale factors (they could change with material)
};
std::vector<MaterialData> fModelMaterialData;
// Initisation energy limits
std::map<G4String, std::map<G4String, G4double> > fLowEnergyLimits; // List the low energy limits
std::map<G4String, std::map<G4String, G4double> > fHighEnergyLimits; // List the high energy limits
// ***********************
// Runtime variables
// ***********************
// This vector has the same index as G4MaterialTable. If a material is within G4MaterialTable but not declared in the current model, then
// this vector registered a nullptr.
std::map<G4int, G4DNACrossSectionDataSet*> fTableDataRuntime;
// We do not need the particule id since every model instance is associated to one particle
std::map<G4int, G4double> fLowEnergyLimitsRuntime;
std::map<G4int, G4double> fHighEnergyLimitsRuntime;
// ***********************
// Methods
// ***********************
TableMapData* GetTableData(){return &fTableData;}
G4DNACrossSectionDataSet* GetSigmaData(const G4Material* material) {return fTableDataRuntime.at(material->GetIndex() );}
std::vector<G4String> BuildApplyToMatVect(const G4String& materials);
void ReadAndSaveCSFile(const G4String& materialName, const G4String& particleName, const G4String& file, G4double scaleFactor);
G4int RandomSelectShell(G4double k, const G4Material* material);
void AddCrossSectionData(const G4String& materialName, const G4String& particleName, const G4String& fileCS, const G4String& fileDiffCS, G4double scaleFactor);
void AddCrossSectionData(const G4String& materialName, const G4String& particleName, const G4String& fileCS, G4double scaleFactor);
void LoadCrossSectionData(const G4String& particleName);
virtual void ReadDiffCSFile(const G4String& materialName,
const G4String& particleName,
const G4String& path,
const G4double scaleFactor);
void EnableForMaterialAndParticle(const G4String& materialName, const G4String& particleName);
};
#endif // G4VDNAPTBMODEL_HH
@@ -1,294 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4VDNAPTBModel.hh"
#include "G4SystemOfUnits.hh"
G4VDNAPTBModel::G4VDNAPTBModel(const G4String& nam, const G4String& applyToMaterial)
: G4VEmModel(nam),
fStringOfMaterials(applyToMaterial)
{
}
G4VDNAPTBModel::~G4VDNAPTBModel()
{
// Clean fTableData
std::map<G4String, std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> > >::iterator posOuter;
std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator posInner;
// iterate on each particle
for (posOuter = fTableData.begin(); posOuter != fTableData.end(); ++posOuter)
{
// iterate on each material
for(posInner = posOuter->second.begin(); posInner != posOuter->second.end(); ++posInner)
{
G4DNACrossSectionDataSet* table = posInner->second;
if(table != 0) delete table;
}
}
}
void G4VDNAPTBModel::AddCrossSectionData(const G4String& materialName, const G4String& particleName, const G4String& fileCS, const G4String& fileDiffCS, G4double scaleFactor)
{
fModelMaterialData.push_back(MaterialData(materialName, particleName, fileCS, fileDiffCS, scaleFactor) );
}
void G4VDNAPTBModel::AddCrossSectionData(const G4String& materialName, const G4String& particleName, const G4String& fileCS, G4double scaleFactor)
{
fModelMaterialData.push_back(MaterialData(materialName, particleName, fileCS, "", scaleFactor) );
}
void G4VDNAPTBModel::LoadCrossSectionData(const G4String& particleName)
{
G4String fileCS, fileDiffCS;
G4String materialName, particleNameData;
G4double scaleFactor;
// construct applyToMatVect with materials specified by the user
std::vector<G4String> applyToMatVect = BuildApplyToMatVect(fStringOfMaterials);
// iterate on each material contained into the fStringOfMaterials variable (through applyToMatVect)
for(unsigned int i=0;i<applyToMatVect.size();++i)
{
// We have selected a material coming from applyToMatVect
// We try to find if this material correspond to a model registered material
// If it is, then isMatFound becomes true
G4bool isMatFound = false;
// We iterate on each model registered materials to load the CS data
// We have to do a for loop because of the "all" option
// applyToMatVect[i] == "all" implies applyToMatVect.size()=1 and we want to iterate on all registered materials
for(unsigned int j=0, je=fModelMaterialData.size();j<je;j++)
{
materialName = fModelMaterialData[j].fMaterial;
particleNameData = fModelMaterialData[j].fParticle;
if( (applyToMatVect[i] == materialName || applyToMatVect[i] == "all")
&& particleNameData==particleName )
{
isMatFound = true;
fileCS = fModelMaterialData[j].fCSFile;
fileDiffCS = fModelMaterialData[j].fDiffCSFile;
scaleFactor = fModelMaterialData[j].fScaleFactor;
ReadAndSaveCSFile(materialName, particleNameData, fileCS, scaleFactor);
if(fileDiffCS != "") ReadDiffCSFile(materialName, particleNameData, fileDiffCS, scaleFactor);
}
}
// check if we found a correspondance, if not: fatal error
if(!isMatFound)
{
std::ostringstream oss;
oss << applyToMatVect[i] << " material was not found. It means the material specified in the UserPhysicsList is not a model material for ";
oss << particleName;
G4Exception("G4VDNAPTBModel::LoadCrossSectionData","em0003",
FatalException, oss.str().c_str());
return;
}
}
// ************************************************
// Generation of the data tables used at runtime
// ************************************************
G4MaterialTable* table = G4Material::GetMaterialTable();
// Loop on all the materials registered into the table
for(G4int i=0, ie=table->size(); i<ie; i++)
{
G4Material* material = table->at(i);
if(IsMaterialExistingInModelForParticle(particleName, material->GetName() ) )
{
fTableDataRuntime[i] = fTableData[particleName][materialName];
fLowEnergyLimitsRuntime[i] = fLowEnergyLimits[particleName][materialName];
fHighEnergyLimitsRuntime[i] = fHighEnergyLimits[particleName][materialName];
}
}
}
void G4VDNAPTBModel::ReadDiffCSFile(const G4String&, const G4String&, const G4String&, const G4double)
{
G4String text("ReadDiffCSFile must be implemented in the model class using a differential cross section data file");
G4Exception("G4VDNAPTBModel::ReadDiffCSFile","em0003",
FatalException, text);
}
void G4VDNAPTBModel::EnableForMaterialAndParticle(const G4String& materialName, const G4String& particleName)
{
fTableData[particleName][materialName] = 0;
}
std::vector<G4String> G4VDNAPTBModel::BuildApplyToMatVect(const G4String& materials)
{
// output material vector
std::vector<G4String> materialVect;
// if we don't find any "/" then it means we only have one "material" (could be the "all" option)
if(materials.find("/")==std::string::npos)
{
// we add the material to the output vector
materialVect.push_back(materials);
}
// if we have several materials listed in the string then we must retrieve them
else
{
G4String materialsNonIdentified = materials;
while(materialsNonIdentified.find_first_of("/") != std::string::npos)
{
// we select the first material and stop at the "/" caracter
G4String mat = materialsNonIdentified.substr(0, materialsNonIdentified.find_first_of("/"));
materialVect.push_back(mat);
// we remove the previous material from the materialsNonIdentified string
materialsNonIdentified = materialsNonIdentified.substr(materialsNonIdentified.find_first_of("/")+1,
materialsNonIdentified.size()-materialsNonIdentified.find_first_of("/"));
}
// we don't find "/" anymore, it means we only have one material string left
// we get it
materialVect.push_back(materialsNonIdentified);
}
return materialVect;
}
void G4VDNAPTBModel::ReadAndSaveCSFile(const G4String& materialName,
const G4String& particleName,
const G4String& file, G4double scaleFactor)
{
fTableData[particleName][materialName] = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV, scaleFactor);
fTableData[particleName][materialName]->LoadData(file);
}
G4int G4VDNAPTBModel::RandomSelectShell(G4double k, const G4Material* material)
{
G4int level = 0;
std::map<G4int, G4DNACrossSectionDataSet*>::iterator pos;
pos = fTableDataRuntime.find(material->GetIndex() );
if(pos != fTableDataRuntime.end())
{
G4DNACrossSectionDataSet* table = pos->second;
if (table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
G4double value = 0.;
while (i>0)
{
i--;
valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
value *= G4UniformRand();
i = n;
while (i > 0)
{
i--;
if (valuesBuffer[i] > value)
{
delete[] valuesBuffer;
return i;
}
value -= valuesBuffer[i];
}
if (valuesBuffer) delete[] valuesBuffer;
}
}
else
{
G4Exception("G4VDNAPTBModel::RandomSelectShell","em0002",
FatalException,"Model not applicable to particle type.");
}
return level;
}
G4bool G4VDNAPTBModel::IsMaterialDefine(const G4String& materialName)
{
// Check if the given material is defined in the simulation
G4bool exist (false);
double matTableSize = G4Material::GetMaterialTable()->size();
for(int i=0;i<matTableSize;i++)
{
if(materialName == G4Material::GetMaterialTable()->at(i)->GetName())
{
exist = true;
return exist;
}
}
return exist;
}
G4bool G4VDNAPTBModel::IsParticleExistingInModel(const G4String& particlelName)
{
// Check if the given material is defined in the current model class
if (fTableData.find(particlelName) == fTableData.end())
{
return false;
}
else
{
return true;
}
}
G4bool G4VDNAPTBModel::IsMaterialExistingInModelForParticle(const G4String& particleName, const G4String& materialName)
{
// To check two things:
// 1- is the material existing in model ?
// 2- if yes, is the particle defined for that material ?
if(IsParticleExistingInModel(particleName))
{
if (fTableData[particleName].find(materialName) == fTableData[particleName].end())
{
return false;
}
else return true;
}
else return false;
}
@@ -1,60 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4B9FermiFragment.hh 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko
#ifndef G4B9FermiFragment_h
#define G4B9FermiFragment_h 1
#include "G4UnstableFermiFragment.hh"
class G4B9FermiFragment : public G4UnstableFermiFragment
{
public:
G4B9FermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE);
virtual ~G4B9FermiFragment();
private:
G4B9FermiFragment(const G4B9FermiFragment &right);
const G4B9FermiFragment & operator=(const G4B9FermiFragment &right);
G4bool operator==(const G4B9FermiFragment &right) const;
G4bool operator!=(const G4B9FermiFragment &right) const;
};
#endif
@@ -1,60 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4Be8FermiFragment.hh 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko
#ifndef G4Be8FermiFragment_h
#define G4Be8FermiFragment_h 1
#include "G4UnstableFermiFragment.hh"
class G4Be8FermiFragment : public G4UnstableFermiFragment
{
public:
G4Be8FermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE);
virtual ~G4Be8FermiFragment();
private:
G4Be8FermiFragment(const G4Be8FermiFragment &right);
const G4Be8FermiFragment & operator=(const G4Be8FermiFragment &right);
G4bool operator==(const G4Be8FermiFragment &right) const;
G4bool operator!=(const G4Be8FermiFragment &right) const;
};
#endif
@@ -1,92 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4FermiBreakUp.hh 100379 2016-10-19 15:05:35Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
#ifndef G4FermiBreakUp_h
#define G4FermiBreakUp_h 1
#include "G4VFermiBreakUp.hh"
#include "globals.hh"
#include "G4FermiConfiguration.hh"
#include "G4VFermiFragment.hh"
#include "G4FermiPhaseSpaceDecay.hh"
#include <vector>
class G4FermiFragmentsPool;
class G4Pow;
class G4FermiBreakUp : public G4VFermiBreakUp
{
public:
explicit G4FermiBreakUp();
virtual ~G4FermiBreakUp();
virtual void Initialise() final;
virtual G4bool IsApplicable(G4int Z, G4int A, G4double mass) const final;
// new interface - vector of products is added to the provided vector
// primary fragment is deleted or is modified and added to the list
// of products
virtual void BreakFragment(G4FragmentVector*, G4Fragment* theNucleus) final;
private:
G4double CoulombBarrier(const std::vector<const G4VFermiFragment*>* v);
G4double DecayProbability(G4int A, G4double TotalE, const G4FermiConfiguration*);
const std::vector<const G4VFermiFragment*>*
SelectConfiguration(G4int Z, G4int A, G4double mass);
G4FermiBreakUp(const G4FermiBreakUp &right) = delete;
const G4FermiBreakUp & operator=(const G4FermiBreakUp &right) = delete;
G4bool operator==(const G4FermiBreakUp &right) const = delete;
G4bool operator!=(const G4FermiBreakUp &right) const = delete;
G4FermiFragmentsPool* thePool;
std::vector<G4double> NormalizedWeights;
G4double Coef;
G4double ConstCoeff;
size_t nmax;
G4Pow* g4calc;
const G4FermiPhaseSpaceDecay* thePhaseSpace;
std::vector<G4double> massRes;
std::vector<const G4VFermiFragment*> frag;
};
#endif
@@ -1,92 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4FermiConfiguration.hh 85841 2014-11-05 15:35:06Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
// 23.04.2011 V.Ivanchenko: make this class to be a simple container and no physics
#ifndef G4FermiConfiguration_h
#define G4FermiConfiguration_h 1
#include "globals.hh"
#include "G4VFermiFragment.hh"
#include "G4Fragment.hh"
class G4FermiConfiguration
{
public:
G4FermiConfiguration(const std::vector<const G4VFermiFragment*>&);
~G4FermiConfiguration();
inline G4int GetA() const;
inline G4int GetZ() const;
inline G4double GetMass() const;
inline const std::vector<const G4VFermiFragment*>* GetFragmentList() const;
private:
inline G4FermiConfiguration(const G4FermiConfiguration &);
inline const G4FermiConfiguration & operator=(const G4FermiConfiguration &);
inline G4bool operator==(const G4FermiConfiguration &) const;
inline G4bool operator!=(const G4FermiConfiguration &) const;
G4int totalZ;
G4int totalA;
G4double totalMass;
std::vector<const G4VFermiFragment*> Configuration;
};
inline G4int G4FermiConfiguration::GetA() const
{
return totalA;
}
inline G4int G4FermiConfiguration::GetZ() const
{
return totalZ;
}
inline G4double G4FermiConfiguration::GetMass() const
{
return totalMass;
}
inline const std::vector<const G4VFermiFragment*>*
G4FermiConfiguration::GetFragmentList() const
{
return &Configuration;
}
#endif
@@ -1,97 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4FermiFragmentsPool.hh,v 1.5 2006-06-29 20:13:13 gunter Exp $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko - more clean usage of static
#ifndef G4FermiFragmentsPool_hh
#define G4FermiFragmentsPool_hh 1
#include "globals.hh"
#include "G4VFermiFragment.hh"
#include "G4FermiConfiguration.hh"
#include "G4FermiPhaseSpaceDecay.hh"
#include <vector>
class G4FermiFragmentsPool
{
public:
static G4FermiFragmentsPool* Instance();
~G4FermiFragmentsPool();
G4bool IsApplicable(G4int Z, G4int A, G4double mass) const;
const std::vector<const G4FermiConfiguration*>*
GetConfigurationList(G4int Z, G4int A, G4double mass) const;
const G4VFermiFragment* GetFragment(G4int Z, G4int A) const;
const G4FermiPhaseSpaceDecay* GetFermiPhaseSpaceDecay() const;
G4int GetMaxZ() const;
G4int GetMaxA() const;
void DumpFragment(const G4VFermiFragment* f) const;
void Dump() const;
private:
G4FermiFragmentsPool();
void Initialise();
G4bool IsExist(G4int Z, G4int A, std::vector<const G4VFermiFragment*>&) const;
G4bool IsAvailable(G4int Z, G4int A) const;
static G4FermiFragmentsPool* theInstance;
std::vector<const G4VFermiFragment*> fragment_pool;
G4int maxZ;
G4int maxA;
G4int verbose;
// list of configuration sorted by A for 1, 2, 3, 4 final fragments
std::vector<const G4FermiConfiguration*> list1[17];
std::vector<const G4FermiConfiguration*> list2[17];
std::vector<const G4FermiConfiguration*> list3[17];
std::vector<const G4FermiConfiguration*> list4[17];
G4FermiPhaseSpaceDecay thePhaseSpace;
};
#endif
@@ -1,59 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4He5FermiFragment.hh 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko: integer Z and A, constructor
#ifndef G4He5FermiFragment_h
#define G4He5FermiFragment_h 1
#include "G4UnstableFermiFragment.hh"
class G4He5FermiFragment : public G4UnstableFermiFragment
{
public:
G4He5FermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE);
~G4He5FermiFragment();
private:
G4He5FermiFragment(const G4He5FermiFragment &right);
const G4He5FermiFragment & operator=(const G4He5FermiFragment &right);
G4bool operator==(const G4He5FermiFragment &right) const;
G4bool operator!=(const G4He5FermiFragment &right) const;
};
#endif
@@ -1,59 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Li5FermiFragment.hh 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko
#ifndef G4Li5FermiFragment_h
#define G4Li5FermiFragment_h 1
#include "G4UnstableFermiFragment.hh"
class G4Li5FermiFragment : public G4UnstableFermiFragment
{
public:
G4Li5FermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE);
virtual ~G4Li5FermiFragment();
private:
G4Li5FermiFragment(const G4Li5FermiFragment &right);
const G4Li5FermiFragment & operator=(const G4Li5FermiFragment &right);
G4bool operator==(const G4Li5FermiFragment &right) const;
G4bool operator!=(const G4Li5FermiFragment &right) const;
};
#endif
@@ -1,61 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4StableFermiFragment.hh 97097 2016-05-25 07:50:31Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko
#ifndef G4StableFermiFragment_h
#define G4StableFermiFragment_h 1
#include "G4VFermiFragment.hh"
class G4StableFermiFragment : public G4VFermiFragment
{
public:
explicit G4StableFermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE);
virtual ~G4StableFermiFragment();
virtual void FillFragment(G4FragmentVector*, const G4LorentzVector & aMomentum) const final;
private:
G4StableFermiFragment(const G4StableFermiFragment &right) = delete;
const G4StableFermiFragment & operator=(const G4StableFermiFragment &right) = delete;
G4bool operator==(const G4StableFermiFragment &right) const = delete;
G4bool operator!=(const G4StableFermiFragment &right) const = delete;
};
#endif
@@ -1,68 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UnstableFermiFragment.hh 97097 2016-05-25 07:50:31Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko: integer Z and A, constructor
#ifndef G4UnstableFermiFragment_h
#define G4UnstableFermiFragment_h 1
#include "G4VFermiFragment.hh"
#include "G4FermiPhaseSpaceDecay.hh"
class G4UnstableFermiFragment : public G4VFermiFragment
{
public:
explicit G4UnstableFermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE);
virtual ~G4UnstableFermiFragment();
virtual void FillFragment(G4FragmentVector*, const G4LorentzVector & aMomentum) const final;
private:
G4UnstableFermiFragment(const G4UnstableFermiFragment &right);
const G4UnstableFermiFragment & operator=(const G4UnstableFermiFragment &right);
G4bool operator==(const G4UnstableFermiFragment &right) const;
G4bool operator!=(const G4UnstableFermiFragment &right) const;
protected:
std::vector<G4double> Masses;
std::vector<G4int> Charges;
std::vector<G4int> AtomNum;
};
#endif
@@ -1,114 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VFermiFragment.hh 97097 2016-05-25 07:50:31Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko
#ifndef G4VFermiFragment_h
#define G4VFermiFragment_h 1
#include "G4FragmentVector.hh"
#include "globals.hh"
class G4VFermiFragment
{
public:
explicit G4VFermiFragment(G4int anA, G4int aZ, G4int Pol,
G4double exc, G4bool stable = true);
virtual ~G4VFermiFragment();
virtual void
FillFragment(G4FragmentVector*, const G4LorentzVector & aMomentum) const = 0;
inline G4FragmentVector * GetFragment(const G4LorentzVector & aMomentum) const
{
G4FragmentVector* vec = new G4FragmentVector();
FillFragment(vec, aMomentum);
return vec;
}
inline G4int GetA(void) const
{
return A;
}
inline G4int GetZ(void) const
{
return Z;
}
inline G4int GetPolarization(void) const
{
return Polarization;
}
inline G4double GetExcitationEnergy(void) const
{
return ExcitEnergy;
}
inline G4double GetFragmentMass(void) const
{
return fragmentMass;
}
inline G4double GetTotalEnergy(void) const
{
return (GetFragmentMass() + GetExcitationEnergy());
}
inline G4bool IsStable() const
{
return isStable;
}
private:
G4bool isStable;
G4int A;
G4int Z;
G4int Polarization;
G4double ExcitEnergy;
G4double fragmentMass;
G4VFermiFragment(const G4VFermiFragment &right) = delete;
const G4VFermiFragment & operator=(const G4VFermiFragment &right) = delete;
G4bool operator==(const G4VFermiFragment &right) const = delete;
G4bool operator!=(const G4VFermiFragment &right) const = delete;
};
#endif
@@ -1,57 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4B9FermiFragment.cc 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko:
#include "G4B9FermiFragment.hh"
#include "G4NucleiProperties.hh"
G4B9FermiFragment::G4B9FermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE)
: G4UnstableFermiFragment(anA,aZ,Pol,ExE)
{
// B9 ----> alpha + alpha + proton
Masses.push_back(G4NucleiProperties::GetNuclearMass(4,2));
Masses.push_back(G4NucleiProperties::GetNuclearMass(4,2));
Masses.push_back(CLHEP::proton_mass_c2);
AtomNum.push_back(4);
AtomNum.push_back(4);
AtomNum.push_back(1);
Charges.push_back(2);
Charges.push_back(2);
Charges.push_back(1);
}
G4B9FermiFragment::~G4B9FermiFragment()
{}
@@ -1,55 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Be8FermiFragment.cc 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko:
#include "G4Be8FermiFragment.hh"
#include "G4NucleiProperties.hh"
G4Be8FermiFragment::G4Be8FermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE)
: G4UnstableFermiFragment(anA,aZ,Pol,ExE)
{
// Be8 ----> alpha + alpha
Masses.push_back(G4NucleiProperties::GetNuclearMass(4,2));
Masses.push_back(G4NucleiProperties::GetNuclearMass(4,2));
AtomNum.push_back(4);
AtomNum.push_back(4);
Charges.push_back(2);
Charges.push_back(2);
}
G4Be8FermiFragment::~G4Be8FermiFragment()
{}
@@ -1,272 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VFermiBreakUp.cc,v 1.5 2006-06-29 20:13:13 gunter Exp $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko - use only one object
// theConfigurationList and do not instantiate it at each decay
#include "G4FermiBreakUp.hh"
#include "G4FermiFragmentsPool.hh"
#include "G4PhysicalConstants.hh"
#include "Randomize.hh"
#include "G4Pow.hh"
G4FermiBreakUp::G4FermiBreakUp() : thePhaseSpace(nullptr)
{
g4calc = G4Pow::GetInstance();
Coef = ConstCoeff = 0.0;
nmax = 16;
NormalizedWeights.resize(nmax,0.0);
massRes.reserve(4);
frag.resize(4, 0);
thePool = G4FermiFragmentsPool::Instance();
Initialise();
}
G4FermiBreakUp::~G4FermiBreakUp()
{}
void G4FermiBreakUp::Initialise()
{
if(thePhaseSpace != nullptr) { return; }
// Kappa = V/V_0 it is used in calculation of Coulomb energy
// Nuclear radius r0 (is a model parameter)
G4double Kappa = 6.0;
G4double r0 = 1.3*CLHEP::fermi;
Coef = 0.6*(CLHEP::elm_coupling/r0)/g4calc->Z13(1+G4int(Kappa));
ConstCoeff = g4calc->powN(r0/hbarc,3)*Kappa/(6.0*pi*pi);
thePhaseSpace = thePool->GetFermiPhaseSpaceDecay();
}
G4bool G4FermiBreakUp::IsApplicable(G4int Z, G4int A, G4double mass) const
{
return thePool->IsApplicable(Z, A, mass);
}
G4double G4FermiBreakUp::CoulombBarrier(
const std::vector<const G4VFermiFragment*>* conf)
{
// Calculates Coulomb Barrier (MeV) for given channel with K fragments.
G4int SumA = 0;
G4int SumZ = 0;
G4double CoulombEnergy = 0.;
size_t nn = conf->size();
for (size_t i=0; i<nn; ++i) {
G4int z = (*conf)[i]->GetZ();
G4int a = (*conf)[i]->GetA();
CoulombEnergy += G4double(z*z)/g4calc->Z13(a);
SumA += a;
SumZ += z;
}
CoulombEnergy -= SumZ*SumZ/g4calc->Z13(SumA);
return -Coef * CoulombEnergy;
}
void G4FermiBreakUp::BreakFragment(G4FragmentVector* theResult,
G4Fragment* theNucleus)
{
if(thePool == nullptr) { Initialise(); }
// Calculate Momenta of K fragments
G4double M = theNucleus->GetMomentum().m();
const std::vector<const G4VFermiFragment*>* conf =
SelectConfiguration(theNucleus->GetZ_asInt(),
theNucleus->GetA_asInt(), M);
// should never happen
if(!conf) {
theResult->push_back(theNucleus);
return;
}
size_t nn = conf->size();
// should never happen
if(0 == nn) {
theResult->push_back(theNucleus);
return;
}
G4LorentzVector fourMomentum = theNucleus->GetMomentum();
// one unstable fragment
if(1 == nn) {
(*conf)[0]->FillFragment(theResult, fourMomentum);
// normal case
} else {
G4ThreeVector boostVector = fourMomentum.boostVector();
massRes.clear();
for(size_t i=0; i<nn; ++i) {
massRes.push_back( (*conf)[i]->GetTotalEnergy() );
}
std::vector<G4LorentzVector*>* mom = thePhaseSpace->Decay(M, massRes);
// size_t nmom = mom->size();
// G4cout << "nmom= " << nmom << G4endl;
// Go back to the Lab Frame
for (size_t j=0; j<nn; ++j) {
(*mom)[j]->boost(boostVector);
(*conf)[j]->FillFragment(theResult, *((*mom)[j]));
delete (*mom)[j];
}
delete mom;
}
delete theNucleus;
}
const std::vector<const G4VFermiFragment*>*
G4FermiBreakUp::SelectConfiguration(G4int Z, G4int A, G4double mass)
{
const std::vector<const G4VFermiFragment*>* res = 0;
// new std::vector<const G4VFermiFragment*>;
const std::vector<const G4FermiConfiguration*>* conflist =
thePool->GetConfigurationList(Z, A, mass);
if(!conflist) { return res; }
size_t nn = conflist->size();
if(0 < nn) {
size_t idx = 0;
if(1 < nn) {
if(nn > nmax) {
nmax = nn;
NormalizedWeights.resize(nmax,0.0);
}
G4double prob = 0.0;
for(size_t i=0; i<nn; ++i) {
prob += DecayProbability(A, mass, (*conflist)[i]);
NormalizedWeights[i] = prob;
}
prob *= G4UniformRand();
for(idx=0; idx<nn; ++idx) {
if(NormalizedWeights[idx] >= prob) { break; }
}
}
//const std::vector<const G4VFermiFragment*> flist =
res = (*conflist)[idx]->GetFragmentList();
//size_t nf = flist.size();
//for(size_t i=0; i<nf; ++i) { res->push_back(flist[i]); }
//G4cout << "FermiBreakUp: " << nn << " conf; selected idx= "
// << idx << " Nprod= " << nf << G4endl;
}
delete conflist;
return res;
}
G4double G4FermiBreakUp::DecayProbability(G4int A, G4double TotalE,
const G4FermiConfiguration* conf)
// Decay probability for a given channel with K fragments
{
// A: Atomic Weight
// TotalE: Total energy of nucleus
G4double KineticEnergy = TotalE;
const std::vector<const G4VFermiFragment*>* flist =
conf->GetFragmentList();
// Number of fragments
size_t K = flist->size();
if(K > frag.size()) { frag.resize(K, 0); }
for (size_t i=0; i<K; ++i) {
frag[i] = (*flist)[i];
KineticEnergy -=
((*flist)[i]->GetFragmentMass() + (*flist)[i]->GetExcitationEnergy());
}
// Check that there is enough energy to produce K fragments
KineticEnergy -= CoulombBarrier(flist);
if (KineticEnergy <= 0.0) { return 0.0; }
// Spin factor S_n
G4double S_n = 1.0;
// mass factors
G4double ProdMass = 1.0;
G4double SumMass = 0.0;
for (size_t i=0; i<K; ++i) {
G4double mass = (*flist)[i]->GetFragmentMass();
ProdMass *= mass;
SumMass += mass;
S_n *= (*flist)[i]->GetPolarization();
}
G4double MassFactor = ProdMass/SumMass;
MassFactor *= std::sqrt(MassFactor);
G4double Coeff = g4calc->powN(ConstCoeff*A, K-1);
//JMQ 111009 Bug fixed: gamma function for odd K was wrong by a factor 2
//VI 251014 Use G4Pow
G4double Gamma = 1.0;
G4double Energ = twopi*KineticEnergy;
// integer argument of Gamma function
if ((K-1)%2 != 1) {
G4int N = 3*(K-1)/2;
Gamma = g4calc->factorial(N - 1);
Energ = g4calc->powN(Energ, N);
// n + 1/2 argument of Gamma function
// http://en.wikipedia.org/wiki/Gamma_function
} else {
G4int n2 = 3*K - 4;
G4int n1 = n2/2;
static const G4double sqrtpi = std::sqrt(CLHEP::pi);
Gamma = sqrtpi*g4calc->factorial(n2)/
(g4calc->powN(4.0,n1)*g4calc->factorial(n1));
Energ = g4calc->powN(Energ, n1)*std::sqrt(Energ);
}
// Permutation Factor G_n
// search for identical fragments
G4double G_n = 1.0;
for(size_t i=0; i<K-1; ++i) {
if(frag[i]) {
G4int nf = 1;
for(size_t j=i+1; j<K; ++j) {
if(frag[i] == frag[j]) {
++nf;
frag[j] = 0;
}
}
if(1 < nf) { G_n *= g4calc->factorial(nf); }
}
}
G4double Weight = Coeff*MassFactor*S_n*Energ/(G_n*Gamma*KineticEnergy);
return Weight;
}
@@ -1,53 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4FermiConfiguration.cc 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// J. M. Quesada (12 October 2009) new implementation of Gamma function in configuration weight
// J. M. Quesada (09 March 2010) Kappa is set to 6.
// 01.04.2011 General cleanup by V.Ivanchenko: integer Z and A, constructor
// 23.04.2011 V.Ivanchenko: make this class to be a simple container and no physics
#include "G4FermiConfiguration.hh"
G4FermiConfiguration::G4FermiConfiguration(const std::vector<const G4VFermiFragment*>& v)
{
Configuration = v;
totalA = totalZ = 0;
totalMass = 0.0;
size_t nn = v.size();
for(size_t i=0; i<nn; ++i) {
totalA += v[i]->GetA();
totalZ += v[i]->GetZ();
totalMass += v[i]->GetTotalEnergy();
}
}
G4FermiConfiguration::~G4FermiConfiguration()
{}
@@ -1,683 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4FermiFragmentsPool.cc,v 1.5 2006-06-29 20:13:13 gunter Exp $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
//
// Modifications:
// J.M.Quesada, July 2009, bug fixed in excitation energies:
// ALL of them are in MeV instead of keV (as they were expressed previously)
// source: http://www.nndc.bnl.gov/chart
// Unknown excitation energies in He5 and Li5 have been suppressed
// Long lived levels (half-lives of the order ps-fs have been included)
//
// J. M. Quesada, April 2010: excitation energies according to tabulated values
// in PhotonEvaporatoion2.0. Fake photons eliminated.
//
// 01.04.2011 General cleanup by V.Ivanchenko - more clean usage of static
//
// 04.05.2011 J. M. Quesada: added detailed printout for testing
#include "G4FermiFragmentsPool.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4StableFermiFragment.hh"
#include "G4B9FermiFragment.hh"
#include "G4Be8FermiFragment.hh"
#include "G4He5FermiFragment.hh"
#include "G4Li5FermiFragment.hh"
G4FermiFragmentsPool* G4FermiFragmentsPool::theInstance = nullptr;
G4FermiFragmentsPool* G4FermiFragmentsPool::Instance()
{
if(0 == theInstance) {
static G4FermiFragmentsPool instance;
theInstance = &instance;
}
return theInstance;
}
G4FermiFragmentsPool::G4FermiFragmentsPool()
{
maxZ = 9;
maxA = 17;
verbose = 0;
Initialise();
}
G4FermiFragmentsPool::~G4FermiFragmentsPool()
{
size_t nn;
for(size_t i=0; i<17; ++i) {
nn = list1[i].size();
if(0 < nn) { for(size_t j=0; j<nn; ++j) { delete (list1[i])[j]; }}
nn = list2[i].size();
if(0 < nn) { for(size_t j=0; j<nn; ++j) { delete (list2[i])[j]; }}
nn = list3[i].size();
if(0 < nn) { for(size_t j=0; j<nn; ++j) { delete (list3[i])[j]; }}
nn = list4[i].size();
if(0 < nn) { for(size_t j=0; j<nn; ++j) { delete (list4[i])[j]; }}
}
nn = fragment_pool.size();
if(0 < nn) { for(size_t j=0; j<nn; ++j) { delete fragment_pool[j]; }}
}
G4bool G4FermiFragmentsPool::IsAvailable(G4int Z, G4int A) const
{
G4bool res = true;
if (2 == Z && 5 == A) { res = false; }
else if(3 == Z && 5 == A) { res = false; }
else if(4 == Z && 8 == A) { res = false; }
else if(5 == Z && 9 == A) { res = false; }
return res;
}
G4int G4FermiFragmentsPool::GetMaxZ() const
{
return maxZ;
}
G4int G4FermiFragmentsPool::GetMaxA() const
{
return maxA;
}
const G4FermiPhaseSpaceDecay*
G4FermiFragmentsPool::GetFermiPhaseSpaceDecay() const
{
return &thePhaseSpace;
}
void G4FermiFragmentsPool::Initialise()
{
// JMQ 30/06/09 unknown levels have been supressed
// JMQ 01/07/09 corrected excitation energies for 64-66, according to
// http://www.nndc.bnl.gov/chart
// JMQ 19/04/10 new level, fragment numbering shifted accordingly from here onwards
// A Z Pol ExcitE
fragment_pool.push_back(new G4StableFermiFragment( 1, 0, 2, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 1, 1, 2, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 2, 1, 3, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 3, 1, 2, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 3, 2, 2, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 4, 2, 1, 0.00*MeV ));
fragment_pool.push_back(new G4He5FermiFragment ( 5, 2, 4, 0.00*MeV ));
fragment_pool.push_back(new G4Li5FermiFragment ( 5, 3, 4, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 6, 2, 1, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 6, 3, 3, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 6, 3, 1, 3.562880*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 7, 3, 4, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 7, 3, 2, 0.4776120*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 7, 4, 4, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 7, 4, 2, 0.4290800*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 8, 3, 5, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 8, 3, 3, 0.9808000*MeV ));
fragment_pool.push_back(new G4Be8FermiFragment ( 8, 4, 1, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 9, 4, 4, 0.00*MeV ));
fragment_pool.push_back(new G4B9FermiFragment ( 9, 5, 4, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 4, 1, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 4, 5, 3.368030*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 4, 8, 5.958390*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 4, 1, 6.179300*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 4, 5, 6.263300*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 5, 7, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 5, 3, 0.7183800*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 5, 1, 1.740050*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 5, 3, 2.154270*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 5, 5, 3.587130*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 6, 3, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 10, 6, 5, 3.353700*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 4, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 2, 2.124693*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 6, 4.444980*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 4, 5.020300*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 8, 6.741850*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 2, 6.791800*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 6, 7.285510*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 4, 7.977840*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 5, 6, 8.560100*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 4, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 2, 2.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 6, 4.318800*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 4, 4.804200*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 2, 6.339200*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 8, 6.478200*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 6, 6.904800*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 4, 7.499700*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 4, 8.104500*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 11, 6, 6, 8.420000*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 12, 5, 3, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 12, 5, 5, 0.9531400*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 12, 5, 5, 1.673650*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 12, 5, 3, 2.620800*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 12, 6, 1, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 12, 6, 5, 4.438910*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 13, 6, 2, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 13, 6, 2, 3.089443*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 13, 6, 4, 3.684507*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 13, 6, 6, 3.853807*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 13, 7, 2, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 6, 1, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 6, 3, 6.093800*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 6, 1, 6.589400*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 6, 7, 6.728200*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 6, 1, 6.902600*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 6, 5, 7.012000*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 6, 5, 7.341000*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 3, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 1, 2.312798*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 3, 3.948100*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 1, 4.915100*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 5, 5.105890*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 3, 5.691440*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 7, 5.834250*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 3, 6.203500*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 7, 6.446170*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 14, 7, 5, 7.029120*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 2, 0.00*MeV ));
// JMQ 010709 two very close levels instead of only one, with their own spins
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 6, 5.270155*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 2, 5.298822*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 4, 6.323780*MeV ));
//JMQ 010709 new level and corrected energy and spins
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 6, 7.155050*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 4, 7.300830*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 8, 7.567100*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 2, 8.312620*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 4, 8.571400*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 2, 9.049710*MeV ));
//JMQ 010709 new levels for N15
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 4, 9.151900*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 6, 9.154900*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 2, 9.222100*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 6, 9.760000*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 8, 9.829000*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 4, 9.925000*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 7, 4, 10.06600*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 8, 2, 0.00*MeV ));
//JMQ 010709 new level and spins
fragment_pool.push_back(new G4StableFermiFragment( 15, 8, 2, 5.183000*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 8, 6, 5.240900*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 8, 4, 6.176300*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 8, 4, 6.793100*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 8, 6, 6.859400*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 15, 8, 8, 7.275900*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 16, 7, 5, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 16, 7, 1, 0.1204200*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 16, 7, 7, 0.2982200*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 16, 7, 3, 0.3972700*MeV ));
//JMQ 010709 some energies and spins have been changed
fragment_pool.push_back(new G4StableFermiFragment( 16, 8, 1, 0.00*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 16, 8, 1, 6.049400*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 16, 8, 7, 6.129890*MeV ));
fragment_pool.push_back(new G4StableFermiFragment( 16, 8, 5, 6.917100*MeV ));
//JMQ 180510 fixed fragment 111
fragment_pool.push_back(new G4StableFermiFragment( 16, 8, 3, 7.116850*MeV ));
G4int nfrag = fragment_pool.size();
std::vector<const G4VFermiFragment*> newvec;
newvec.reserve(4);
// list of fragments ordered by A
newvec.resize(1);
for(G4int i=0; i<nfrag; ++i) {
newvec[0] = fragment_pool[i];
const G4FermiConfiguration* conf = new G4FermiConfiguration(newvec);
G4int A = fragment_pool[i]->GetA();
list1[A].push_back(conf);
}
if(verbose > 0) {
G4cout << "### G4FermiFragmentPool: " << nfrag
<< " fragments" << G4endl;
for(G4int A=1; A<maxA; ++A) {
G4cout << " A= " << A << " : Z= ";
for(size_t j=0; j<list1[A].size(); ++j) {
G4cout << (list1[A])[j]->GetZ() << " ";
}
G4cout << G4endl;
}
}
// list of fragment pairs ordered by A
G4int counter = 0;
G4int tot = 0;
newvec.resize(2);
for(G4int i=0; i<nfrag; ++i) {
G4int Z1 = fragment_pool[i]->GetZ();
G4int A1 = fragment_pool[i]->GetA();
for(G4int j=0; j<nfrag; ++j) {
G4int Z2 = fragment_pool[j]->GetZ();
G4int A2 = fragment_pool[j]->GetA();
G4int Z = Z1 + Z2;
G4int A = A1 + A2;
if(Z < maxZ && A < maxA && IsAvailable(Z, A)) {
newvec[0] = fragment_pool[i];
newvec[1] = fragment_pool[j];
if(!IsExist(Z, A, newvec)) {
const G4FermiConfiguration* conf = new G4FermiConfiguration(newvec);
list2[A].push_back(conf);
++counter;
}
}
}
}
if(verbose > 0) {
G4cout << G4endl;
G4cout << "### Pairs of fragments: " << counter << G4endl;
for(G4int A=2; A<maxA; ++A) {
G4cout << " A= " << A<<G4endl;
for(size_t j=0; j<list2[A].size(); ++j) {
const std::vector<const G4VFermiFragment*>* vec
= (list2[A])[j]->GetFragmentList();
G4int a1=(*vec)[0]->GetA();
G4int z1=(*vec)[0]->GetZ();
G4int a2=(*vec)[1]->GetA();
G4int z2=(*vec)[1]->GetZ();
G4cout << "("<<a1<<","<<z1<<")("<<a2<<","<<z2<<") % ";
}
G4cout<<G4endl;
G4cout<<"----------------------------------------------------------------"
<< G4endl;
}
}
// list of fragment triples ordered by A
tot += counter;
counter = 0;
newvec.resize(3);
for(G4int A1=2; A1<maxA; ++A1) {
size_t nz = list2[A1].size();
for(size_t idx=0; idx<nz; ++idx) {
const G4FermiConfiguration* conf2 = (list2[A1])[idx];
G4int Z1 = conf2->GetZ();
const std::vector<const G4VFermiFragment*>* vec2 =
conf2->GetFragmentList();
for(G4int j=0; j<nfrag; ++j) {
G4int Z2 = fragment_pool[j]->GetZ();
G4int A2 = fragment_pool[j]->GetA();
G4int Z = Z1 + Z2;
G4int A = A1 + A2;
if(Z < maxZ && A < maxA && IsAvailable(Z, A)) {
newvec[0] = (*vec2)[0];
newvec[1] = (*vec2)[1];
newvec[2] = fragment_pool[j];
if(!IsExist(Z, A, newvec)) {
const G4FermiConfiguration* conf3 = new G4FermiConfiguration(newvec);
list3[A].push_back(conf3);
++counter;
}
}
}
}
}
if(verbose > 0) {
G4cout << G4endl;
G4cout << "### Triples of fragments: " << counter << G4endl;
for(G4int A=3; A<maxA; ++A) {
G4cout << " A= " << A<<G4endl;
for(size_t j=0; j<list3[A].size(); ++j) {
const std::vector<const G4VFermiFragment*>* vec
= (list3[A])[j]->GetFragmentList();
G4int a1=(*vec)[0]->GetA();
G4int z1=(*vec)[0]->GetZ();
G4int a2=(*vec)[1]->GetA();
G4int z2=(*vec)[1]->GetZ();
G4int a3=(*vec)[2]->GetA();
G4int z3=(*vec)[2]->GetZ();
G4cout << "("<<a1<<","<<z1<<")("<<a2<<","<<z2<<")("<<a3<<","<<z3<<") % ";
}
G4cout<<G4endl;
G4cout<<"----------------------------------------------------------------"
<< G4endl;
}
}
// list of fragment quartets (3 + 1) ordered by A
tot += counter;
counter = 0;
newvec.resize(4);
for(G4int A1=3; A1<maxA; ++A1) {
size_t nz = list3[A1].size();
for(size_t idx=0; idx<nz; ++idx) {
const G4FermiConfiguration* conf3 = (list3[A1])[idx];
G4int Z1 = conf3->GetZ();
const std::vector<const G4VFermiFragment*>* vec3 =
conf3->GetFragmentList();
for(G4int j=0; j<nfrag; ++j) {
G4int Z2 = fragment_pool[j]->GetZ();
G4int A2 = fragment_pool[j]->GetA();
G4int Z = Z1 + Z2;
G4int A = A1 + A2;
if(Z < maxZ && A < maxA && IsAvailable(Z, A)) {
newvec[0] = (*vec3)[0];
newvec[1] = (*vec3)[1];
newvec[2] = (*vec3)[2];
newvec[3] = fragment_pool[j];
if(!IsExist(Z, A, newvec)) {
const G4FermiConfiguration* conf4 = new G4FermiConfiguration(newvec);
list4[A].push_back(conf4);
++counter;
}
}
}
}
}
// list of fragment quartets (2 + 2) ordered by A
for(G4int A1=2; A1<maxA; ++A1) {
size_t nz1 = list2[A1].size();
for(size_t id1=0; id1<nz1; ++id1) {
const G4FermiConfiguration* conf1 = (list2[A1])[id1];
G4int Z1 = conf1->GetZ();
const std::vector<const G4VFermiFragment*>* vec1 =
conf1->GetFragmentList();
for(G4int A2=2; A2<maxA; ++A2) {
size_t nz2 = list2[A2].size();
for(size_t id2=0; id2<nz2; ++id2) {
const G4FermiConfiguration* conf2 = (list2[A2])[id2];
G4int Z2 = conf2->GetZ();
const std::vector<const G4VFermiFragment*>* vec2 =
conf2->GetFragmentList();
G4int Z = Z1 + Z2;
G4int A = A1 + A2;
if(Z < maxZ && A < maxA && IsAvailable(Z, A)) {
newvec[0] = (*vec1)[0];
newvec[1] = (*vec1)[1];
newvec[2] = (*vec2)[0];
newvec[3] = (*vec2)[1];
if(!IsExist(Z, A, newvec)) {
const G4FermiConfiguration* conf4 =
new G4FermiConfiguration(newvec);
list4[A].push_back(conf4);
++counter;
}
}
}
}
}
}
if(verbose > 0) {
tot += counter;
G4cout << G4endl;
G4cout << "### Quartets of fragments: " << counter << G4endl;
for(G4int A=4; A<maxA; ++A) {
G4cout << " A= " << A<<G4endl;
for(size_t j=0; j<list4[A].size(); ++j) {
const std::vector<const G4VFermiFragment*>* vec
= (list4[A])[j]->GetFragmentList();
G4int a1=(*vec)[0]->GetA();
G4int z1=(*vec)[0]->GetZ();
G4int a2=(*vec)[1]->GetA();
G4int z2=(*vec)[1]->GetZ();
G4int a3=(*vec)[2]->GetA();
G4int z3=(*vec)[2]->GetZ();
G4int a4=(*vec)[3]->GetA();
G4int z4=(*vec)[3]->GetZ();
G4cout << "("<<a1<<","<<z1<<")("<<a2<<","<<z2<<")("<<a3<<","<<z3<<")("
<<a4<<","<<z4<<") % ";
}
G4cout<<G4endl;
G4cout<<"----------------------------------------------------------------"
<< G4endl;
}
G4cout << "Total number: " << tot << G4endl;
}
}
G4bool G4FermiFragmentsPool::IsApplicable(G4int Z, G4int A, G4double mass) const
{
if(Z >= maxZ || A >= maxA || A <= 0) { return false; }
// look into pair list
size_t nz = list2[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list2[A])[j];
if(Z == conf->GetZ() && mass >= conf->GetMass()) { return true; }
}
}
// look into triple list
nz = list3[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list3[A])[j];
if(Z == conf->GetZ() && mass >= conf->GetMass()) { return true; }
}
}
// look into quartet list
nz = list4[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list4[A])[j];
if(Z == conf->GetZ() && mass >= conf->GetMass()) { return true; }
}
}
// search in the pool and if found then return vector with one element
nz = list1[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list1[A])[j];
if(Z == conf->GetZ() && mass >= conf->GetMass()) {
if(!(*(conf->GetFragmentList()))[0]->IsStable()) { return true; }
}
}
}
return false;
}
const std::vector<const G4FermiConfiguration*>*
G4FermiFragmentsPool::GetConfigurationList(G4int Z, G4int A, G4double mass) const
{
std::vector<const G4FermiConfiguration*>* v =
new std::vector<const G4FermiConfiguration*>;
if(Z >= maxZ || A >= maxA) { return v; }
//G4cout << "G4FermiFragmentsPool::GetConfigurationList:"
// << " Z= " << Z << " A= " << A << " Mass(GeV)= " << mass/GeV<< G4endl;
// look into pair list
size_t nz = list2[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list2[A])[j];
if(Z == conf->GetZ() && mass >= conf->GetMass()) {
v->push_back(conf);
}
//G4cout << "Pair dM(MeV)= " << mass - conf->GetMass() << G4endl; }
}
}
// look into triple list
nz = list3[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list3[A])[j];
if(Z == conf->GetZ() && mass >= conf->GetMass()) {
v->push_back(conf);
}
//G4cout << "Triple dM(MeV)= " << mass - conf->GetMass() << G4endl; }
}
}
// look into quartet list
nz = list4[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list4[A])[j];
if(Z == conf->GetZ() && mass >= conf->GetMass()) {
v->push_back(conf);
}
// G4cout << "Quartet dM(MeV)= " << mass - conf->GetMass() << G4endl; }
}
}
// return if vector not empty
if(0 < v->size()) {
if(verbose > 0) {
G4double ExEn= mass - G4NucleiProperties::GetNuclearMass(A,Z);
G4cout<<"Total number of configurations = "<<v->size()<<" for A= "
<<A<<" Z= "<<Z<<" E*= "<< ExEn<<" MeV"<<G4endl;
size_t size_vector_conf = v->size();
for(size_t jc=0; jc<size_vector_conf; ++jc) {
const std::vector<const G4VFermiFragment*>* v_frag =
(*v)[jc]->GetFragmentList();
size_t size_vector_fragments = v_frag->size();
G4cout<<size_vector_fragments<<"-body configuration "<<jc+1<<": ";
for(size_t jf=0;jf<size_vector_fragments;++jf){
G4int af= (*v_frag)[jf]->GetA();
G4int zf= (*v_frag)[jf]->GetZ();
G4double ex=(*v_frag)[jf]->GetExcitationEnergy();
G4cout<<"(a="<<af<<", z="<<zf<<", ex="<<ex<<") ";
}
G4cout<<G4endl;
G4cout<<"-----------------------------------------------------"<<G4endl;
}
}
return v;
}
// search in the pool and if found then return vector with one element
nz = list1[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list1[A])[j];
// G4cout << "Single dM(MeV)= " << mass - conf->GetMass() << G4endl; }
if(Z == conf->GetZ() && mass >= conf->GetMass()) {
if(!(*(conf->GetFragmentList()))[0]->IsStable()) {
v->push_back(conf);
if(verbose > 0) {
G4double ExEn= mass -G4NucleiProperties::GetNuclearMass(A,Z);
G4cout<<"Only 1 configurations for A= "
<<A<<" Z= "<<Z<<" E*= "<< ExEn<<" MeV"<<G4endl;
const std::vector<const G4VFermiFragment*>* v_frag
= (*v)[0]->GetFragmentList();
size_t size_vector_fragments=v_frag->size();
G4cout<<"1 Fragment configuration: ";
for(size_t jf=0;jf<size_vector_fragments;++jf){
G4int af= (*v_frag)[jf]->GetA();
G4int zf= (*v_frag)[jf]->GetZ();
G4double ex=(*v_frag)[jf]->GetExcitationEnergy();
G4cout<<"(a="<<af<<", z="<<zf<<", ex="<<ex<<") ";
}
G4cout<<G4endl;
G4cout<<"-----------------------------------------------------"<<G4endl;
}
return v;
}
}
}
}
//failer
if(verbose > 0) {
G4cout << "G4FermiFragmentsPool::GetConfigurationList: WARNING: not "
<< "able decay fragment Z= " << Z << " A= " << A
<< " Mass(GeV)= " << mass/GeV<< G4endl;
}
return v;
}
G4bool G4FermiFragmentsPool::IsExist(G4int Z, G4int A,
std::vector<const G4VFermiFragment*>& newconf) const
{
size_t nn = newconf.size();
G4double mass = 0.0;
for(size_t i=0; i<nn; ++i) { mass += newconf[i]->GetTotalEnergy(); }
// look into pair list
if(2 == nn) {
size_t nz = list2[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list2[A])[j];
if(Z == conf->GetZ() && A == conf->GetA() &&
std::fabs(mass - conf->GetMass()) < keV) {return true; }
}
}
return false;
}
// look into triple list
if(3 == nn) {
size_t nz = list3[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list3[A])[j];
if(Z == conf->GetZ() && A == conf->GetA() &&
std::fabs(mass - conf->GetMass()) < keV) { return true; }
}
}
return false;
}
// look into quartet list
if(4 == nn) {
size_t nz = list4[A].size();
if(0 < nz) {
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list4[A])[j];
if(Z == conf->GetZ() && A == conf->GetA() &&
std::fabs(mass - conf->GetMass()) < keV) { return true; }
}
}
return false;
}
return false;
}
const G4VFermiFragment*
G4FermiFragmentsPool::GetFragment(G4int Z, G4int A) const
{
const G4VFermiFragment* f = 0;
if(Z < maxZ && A < maxA) {
size_t nz = list1[A].size();
for(size_t j=0; j<nz; ++j) {
const G4FermiConfiguration* conf = (list1[A])[j];
if(Z == conf->GetZ()) {
f = (*(conf->GetFragmentList()))[0];
break;
}
}
}
return f;
}
void G4FermiFragmentsPool::DumpFragment(const G4VFermiFragment* f) const
{
if(f) {
G4cout << "Z= " << f->GetZ() << " A= " << f->GetA()
<< " Mass(GeV)= " << f->GetFragmentMass()/GeV
<< " Eexc(MeV)= " << f->GetExcitationEnergy() << G4endl;
}
}
void G4FermiFragmentsPool::Dump() const
{
G4cout << "##### List of Fragments in the Fermi Fragment Pool #####"
<< G4endl;
G4int nfrag = fragment_pool.size();
for(G4int i=0; i<nfrag; ++i) {
DumpFragment(fragment_pool[i]);
}
G4cout << G4endl;
}
@@ -1,54 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4He5FermiFragment.cc 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko:
#include "G4He5FermiFragment.hh"
#include "G4NucleiProperties.hh"
G4He5FermiFragment::G4He5FermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE)
: G4UnstableFermiFragment(anA,aZ,Pol,ExE)
{
// He5 ----> alpha + neutron
Masses.push_back(G4NucleiProperties::GetNuclearMass(4,2));
Masses.push_back(CLHEP::neutron_mass_c2);
AtomNum.push_back(4);
AtomNum.push_back(1);
Charges.push_back(2);
Charges.push_back(0);
}
G4He5FermiFragment::~G4He5FermiFragment()
{}
@@ -1,49 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Li5FermiFragment.cc 67983 2013-03-13 10:42:03Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
#include "G4Li5FermiFragment.hh"
#include "G4NucleiProperties.hh"
G4Li5FermiFragment::G4Li5FermiFragment(G4int anA, G4int aZ, G4int Pol, G4double ExE)
: G4UnstableFermiFragment(anA,aZ,Pol,ExE)
{
// Li5 ----> alpha + proton
Masses.push_back(G4NucleiProperties::GetNuclearMass(4,2));
Masses.push_back(CLHEP::proton_mass_c2);
AtomNum.push_back(4);
AtomNum.push_back(1);
Charges.push_back(2);
Charges.push_back(1);
}
G4Li5FermiFragment::~G4Li5FermiFragment()
{}
@@ -1,48 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4StableFermiFragment.cc 97097 2016-05-25 07:50:31Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko
#include "G4StableFermiFragment.hh"
G4StableFermiFragment::G4StableFermiFragment(G4int anA, G4int aZ,
G4int Pol, G4double ExE)
: G4VFermiFragment(anA,aZ,Pol,ExE, true)
{}
G4StableFermiFragment::~G4StableFermiFragment()
{}
void G4StableFermiFragment::FillFragment(G4FragmentVector* theResult,
const G4LorentzVector & aMomentum) const
{
theResult->push_back(new G4Fragment(GetA(),GetZ(),aMomentum));
}
@@ -1,66 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UnstableFermiFragment.cc 97097 2016-05-25 07:50:31Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
//
// Modifications:
// 01.04.2011 General cleanup by V.Ivanchenko: integer Z and A, constructor
#include "G4UnstableFermiFragment.hh"
#include "G4FermiFragmentsPool.hh"
G4UnstableFermiFragment::G4UnstableFermiFragment(G4int anA, G4int aZ,
G4int Pol, G4double ExE)
: G4VFermiFragment(anA,aZ,Pol,ExE, false)
{}
G4UnstableFermiFragment::~G4UnstableFermiFragment()
{}
void G4UnstableFermiFragment::FillFragment(G4FragmentVector* theResult,
const G4LorentzVector& aMomentum) const
{
const G4FermiPhaseSpaceDecay* thePhaseSpace
= G4FermiFragmentsPool::Instance()->GetFermiPhaseSpaceDecay();
std::vector<G4LorentzVector*> * P = thePhaseSpace->Decay(aMomentum.m(), Masses);
G4ThreeVector Beta = aMomentum.boostVector();
size_t N = P->size();
for (size_t i=0; i<N; ++i)
{
G4LorentzVector* v = (*P)[i];
v->boost(Beta);
theResult->push_back(new G4Fragment(AtomNum[i],Charges[i],*v));
delete v;
}
delete P;
}
@@ -1,49 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VFermiFragment.cc 97097 2016-05-25 07:50:31Z gcosmo $
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Nov 1998)
#include "G4VFermiFragment.hh"
#include "G4NucleiProperties.hh"
G4VFermiFragment::G4VFermiFragment(G4int anA, G4int aZ, G4int Pol,
G4double exc, G4bool stable):
isStable(stable),
A(anA),
Z(aZ),
Polarization(Pol),
ExcitEnergy(exc)
{
fragmentMass = 0.0;
if(A > 0) { fragmentMass = G4NucleiProperties::GetNuclearMass(A, Z); }
}
G4VFermiFragment::~G4VFermiFragment()
{}
@@ -1,78 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedGammaTransition.hh 85659 2014-11-03 10:59:10Z vnivanch $
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// CERN, Geneva, Switzerland
//
// File name: G4PolarizedGammaTransition
//
// Author: Vladimir Ivanchenko
//
// Creation date: 6 November 2015
//
// Modifications:
//
//
// -------------------------------------------------------------------
#ifndef G4POLARIZEDGAMMATRANSITION_HH
#define G4POLARIZEDGAMMATRANSITION_HH 1
#include "G4GammaTransition.hh"
class G4PolarizationTransition;
class G4PolarizedGammaTransition : public G4GammaTransition
{
public:
explicit G4PolarizedGammaTransition();
virtual ~G4PolarizedGammaTransition();
virtual void SampleDirection(G4Fragment* nuc, G4double ratio,
G4int twoJ1, G4int twoJ2, G4int mp);
private:
G4PolarizedGammaTransition(const G4PolarizedGammaTransition &right) = delete;
const G4PolarizedGammaTransition& operator=(const G4PolarizedGammaTransition &right) = delete;
G4bool operator==(const G4PolarizedGammaTransition &right) const = delete;
G4bool operator!=(const G4PolarizedGammaTransition &right) const = delete;
G4PolarizationTransition* fPolarization;
};
#endif
@@ -1,61 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedGammaTransition.cc 85659 2014-11-03 10:59:10Z vnivanch $
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// CERN, Geneva, Switzerland
//
// File name: G4PolarizedGammaTransition
//
// Author V.Ivanchenko 6 November 2015
//
// -------------------------------------------------------------------
#include "G4PolarizedGammaTransition.hh"
#include "Randomize.hh"
#include "G4RandomDirection.hh"
#include "G4LorentzVector.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "G4PolarizationTransition.hh"
G4PolarizedGammaTransition::G4PolarizedGammaTransition()
{
fPolarization = new G4PolarizationTransition();
}
G4PolarizedGammaTransition::~G4PolarizedGammaTransition()
{
delete fPolarization;
}
void G4PolarizedGammaTransition::SampleDirection(
G4Fragment*, G4double, G4int, G4int, G4int)
{
fDirection = G4RandomDirection();
}
@@ -1,126 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4PomeronCrossSection_h
#define G4PomeronCrossSection_h 1
//
// $Id: G4PomeronCrossSection.hh 100828 2016-11-02 15:25:59Z gcosmo $
//
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4PionZero.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4KaonZero.hh"
#include "G4KaonZeroShort.hh"
#include "G4KaonZeroLong.hh"
#include "G4Gamma.hh"
class G4PomeronCrossSection
{
public:
G4PomeronCrossSection(const G4ParticleDefinition * );
G4PomeronCrossSection(const G4Proton * );
G4PomeronCrossSection(const G4Neutron * );
G4PomeronCrossSection(const G4PionPlus * );
G4PomeronCrossSection(const G4PionMinus * );
G4PomeronCrossSection(const G4PionZero * );
G4PomeronCrossSection(const G4KaonPlus * );
G4PomeronCrossSection(const G4KaonMinus * );
G4PomeronCrossSection(const G4KaonZero * );
G4PomeronCrossSection(const G4KaonZeroLong * );
G4PomeronCrossSection(const G4KaonZeroShort * );
G4PomeronCrossSection(const G4Gamma * );
~G4PomeronCrossSection();
// s = (center of mass energy)**2
G4double GetTotalCrossSection(const G4double s);
G4double GetDiffractiveCrossSection(const G4double s);
G4double GetElasticCrossSection(const G4double s);
G4double GetInelasticCrossSection(const G4double s);
G4double GetTotalProbability(const G4double s, const G4double impactsquare);
G4double GetDiffractiveProbability(const G4double s, const G4double impactsquare);
G4double GetNondiffractiveProbability(const G4double s, const G4double impactsquare);
G4double GetElasticProbability(const G4double s, const G4double impactsquare);
G4double GetInelasticProbability(const G4double s, const G4double impactsquare);
G4double GetCutPomeronProbability(const G4double s, const G4double impactsquare,
const G4int nPomerons);
void Setgamma(const G4double agam); // temporary only! GF.
G4double SoftEikonal(G4double s, G4double impactsquare);
G4double HardEikonal(G4double s, G4double impactsquare);
void Pomeron_S(G4double apomeron_S){ pomeron_S = apomeron_S;}
void Pomeron_Gamma(G4double apomeron_Gamma){ pomeron_Gamma = apomeron_Gamma;}
void Pomeron_C(G4double apomeron_C){ pomeron_C = apomeron_C;}
void Pomeron_Rsquare(G4double apomeron_Rsquare){ pomeron_Rsquare = apomeron_Rsquare;}
void Pomeron_Alpha(G4double apomeron_Alpha){ pomeron_Alpha = apomeron_Alpha;}
void Pomeron_Alphaprime(G4double apomeron_Alphaprime){ pomeron_Alphaprime = apomeron_Alphaprime;}
void Pomeron_Gamma_Hard(G4double apomeron_Gamma_Hard){ pomeron_Gamma_Hard = apomeron_Gamma_Hard;}
void Pomeron_Alpha_Hard(G4double apomeron_Alpha_Hard){ pomeron_Alpha_Hard = apomeron_Alpha_Hard;}
private:
G4double PowerSoft(const G4double s);
G4double PowerHard(const G4double s);
G4double LambdaSoft(const G4double s);
G4double LambdaHard(const G4double s);
G4double Zsoft(const G4double s);
G4double Zhard(const G4double s);
G4PomeronCrossSection();
void InitForNucleon();
void InitForPion();
void InitForKaon();
void InitForGamma();
G4double Expand(G4double z);
inline G4double Z(const G4double Scms);
inline G4double SigP(const G4double Scms);
inline G4double Power(const G4double Scms);
inline G4double Lambda(const G4double s);
inline G4double Eikonal(const G4double s,const G4double impactsquare);
G4double pomeron_Alpha;
G4double pomeron_Alpha_Hard;
G4double pomeron_Alphaprime;
G4double pomeron_C;
G4double pomeron_Gamma;
G4double pomeron_Gamma_Hard;
G4double pomeron_Rsquare;
G4double pomeron_S;
};
#endif
@@ -1,326 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4PomeronCrossSection.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
#include "G4PomeronCrossSection.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Pow.hh"
#include "G4Exp.hh"
#include "G4Log.hh"
G4PomeronCrossSection::G4PomeronCrossSection() :
pomeron_Alpha(0), pomeron_Alpha_Hard(0), pomeron_Alphaprime(0),
pomeron_C(0), pomeron_Gamma(0), pomeron_Gamma_Hard(0),
pomeron_Rsquare(0), pomeron_S(0)
{}
G4PomeronCrossSection::~G4PomeronCrossSection()
{;}
//**********************************************************************************************
G4PomeronCrossSection::G4PomeronCrossSection(const G4ParticleDefinition * particle)
{
G4int Encoding = std::abs(particle->GetPDGEncoding());
if (std::abs(particle->GetBaryonNumber())!=0)
InitForNucleon();
else if (Encoding/100== 3 || Encoding/10 == 3)
InitForKaon();
else
InitForPion();
}
//**********************************************************************************************
G4PomeronCrossSection::G4PomeronCrossSection(const G4Proton * )
{
InitForNucleon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4Neutron * )
{
InitForNucleon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionPlus * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionMinus * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionZero * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonPlus * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonMinus * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZero * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZeroLong * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZeroShort * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4Gamma * )
{
InitForGamma();
}
G4double G4PomeronCrossSection::GetTotalCrossSection(const G4double S)
{
G4double FZ2= Expand(Z(S)/2);
return SigP(S) * FZ2;
}
G4double G4PomeronCrossSection::GetElasticCrossSection(const G4double S)
{
return SigP(S)/pomeron_C *(Expand(Z(S)/2) - Expand(Z(S)));
}
G4double G4PomeronCrossSection::GetDiffractiveCrossSection(const G4double S)
{
return ( pomeron_C -1) * GetElasticCrossSection(S);
}
G4double G4PomeronCrossSection::GetInelasticCrossSection(const G4double S)
{
return GetTotalCrossSection(S) - GetElasticCrossSection(S);
}
//-------------------------Probabilities ----------------------------
G4double G4PomeronCrossSection::GetTotalProbability(const G4double S,
const G4double impactsquare)
{
return 2/pomeron_C*(1-G4Exp(-1*Eikonal(S,impactsquare)));
}
G4double G4PomeronCrossSection::GetDiffractiveProbability(const G4double S,
const G4double impactsquare)
{
return (pomeron_C-1)/pomeron_C *
(GetTotalProbability(S,impactsquare) - GetNondiffractiveProbability(S,impactsquare));
}
G4double G4PomeronCrossSection::GetNondiffractiveProbability(const G4double S,
const G4double impactsquare)
{
return (1-G4Exp(-2*Eikonal(S,impactsquare)))/pomeron_C;
}
G4double G4PomeronCrossSection::GetElasticProbability(const G4double S,
const G4double impactsquare)
{
return (GetTotalProbability(S,impactsquare) - GetInelasticProbability(S,impactsquare));
}
G4double G4PomeronCrossSection::GetInelasticProbability(const G4double S,
const G4double impactsquare)
{
return GetNondiffractiveProbability(S,impactsquare) + GetDiffractiveProbability(S,impactsquare);
}
G4double G4PomeronCrossSection::GetCutPomeronProbability(const G4double S,
const G4double impactsquare, const G4int nPomerons)
{
G4double factorial=G4Pow::GetInstance()->factorial(nPomerons);
return G4Exp(-2*Eikonal(S,impactsquare))/pomeron_C*
G4Pow::GetInstance()->powN(2*Eikonal(S,impactsquare),nPomerons)/factorial;
}
// ---------------Temporary --- GF
void G4PomeronCrossSection::Setgamma(const G4double agam)
{
pomeron_Gamma=agam/GeV/GeV;
}
//----------------- private/Implementation methods
void G4PomeronCrossSection::InitForNucleon()
{
//pomeron_S= 3.0*GeV*GeV;
pomeron_S= 2.7*GeV*GeV;
//pomeron_Gamma= 2.16/GeV/GeV;
//pomeron_Gamma= 3.96/GeV/GeV;
pomeron_Gamma= (2.6+3.96)/GeV/GeV;
pomeron_C= 1.4;
pomeron_Rsquare= 3.56/GeV/GeV;
//pomeron_Alpha= 1.0808;
pomeron_Alpha= 0.9808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV; // Note! if pomeron_Gamma_Hard != 0 to fit total pp-crosscection
// pomeron_Gamma_Soft shold be 2.35/GeV/GeV
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForPion()
{
pomeron_S= 1.5*GeV*GeV;
//pomeron_Gamma= 1.46/GeV/GeV;
pomeron_Gamma= 2.17/GeV/GeV;
pomeron_C= 1.6;
pomeron_Rsquare= 2.36/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForKaon()
{
pomeron_S= 2.3*GeV*GeV;
//pomeron_Gamma= 1.31/GeV/GeV;
pomeron_Gamma= 1.92/GeV/GeV;
pomeron_C= 1.8;
pomeron_Rsquare= 1.96/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForGamma()
{
pomeron_S= 1.7*GeV*GeV;
//pomeron_Gamma= 1.42/GeV/GeV;
pomeron_Gamma= 2.07/GeV/GeV;
pomeron_C= 1.7;
pomeron_Rsquare= 2.16/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
G4double G4PomeronCrossSection::Expand(G4double z)
{
G4double sum=1.;
G4double current=1.;
for (G4int j=2; j<21; j++ ) {
current *= -z *(j-1)/sqr(j);
sum+=current;
}
return sum;
}
G4double G4PomeronCrossSection::Power(const G4double S)
{
return pomeron_Gamma * G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha -1);
}
G4double G4PomeronCrossSection::Z(const G4double S)
{
return 2*pomeron_C * Power(S) / Lambda(S);
}
G4double G4PomeronCrossSection::Lambda(const G4double S)
{
return pomeron_Rsquare+pomeron_Alphaprime*G4Log(S/pomeron_S);
}
G4double G4PomeronCrossSection::SigP(const G4double S)
{
return 8 * pi * hbarc_squared * Power(S);
}
G4double G4PomeronCrossSection::Eikonal(const G4double S, const G4double impactsquare)
{
return Z(S)/2 * G4Exp(-impactsquare/(4*Lambda(S)*hbarc_squared));
}
//*************************************************************************************************
G4double G4PomeronCrossSection::PowerSoft(const G4double S)
{
return pomeron_Gamma * G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha -1);
}
G4double G4PomeronCrossSection::PowerHard(const G4double S)
{
return pomeron_Gamma_Hard*G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha_Hard -1);
}
G4double G4PomeronCrossSection::LambdaSoft(const G4double S)
{
return pomeron_Rsquare+pomeron_Alphaprime*G4Log(S/pomeron_S);
}
G4double G4PomeronCrossSection::LambdaHard(const G4double /*S*/)
{
return pomeron_Rsquare; //+pomeron_Alphaprime*G4Log(s/pomeron_S);
}
G4double G4PomeronCrossSection::Zsoft(const G4double S)
{
return 2*pomeron_C*PowerHard(S) / LambdaSoft(S);
}
G4double G4PomeronCrossSection::Zhard(const G4double S)
{
return 2*pomeron_C*PowerHard(S)/LambdaHard(S);
}
G4double G4PomeronCrossSection::SoftEikonal(G4double S, G4double impactsquare)
{
return Zsoft(S)/2*G4Exp(-impactsquare/LambdaSoft(S)/hbarc_squared/4);
}
G4double G4PomeronCrossSection::HardEikonal(G4double S, G4double impactsquare)
{
return Zhard(S)/2*G4Exp(-impactsquare/LambdaHard(S)/hbarc_squared/4);
}
//*************************************************************************************************
-18
View File
@@ -1,18 +0,0 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4phonon
# Package: Geant4.src.G4processes.G4phonon
#
# CMakeLists.txt for building a single granular library.
#
# Generated on : 24/10/2013
#
# $Id: CMakeLists.txt 75844 2013-11-06 17:35:56Z gcosmo $
#
#------------------------------------------------------------------------------
if(GEANT4_BUILD_GRANULAR_LIBS)
include(Geant4MacroLibraryTargets)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
endif()
-25
View File
@@ -1,25 +0,0 @@
# $Id: GNUmakefile 75844 2013-11-06 17:35:56Z gcosmo $
# ------------------------------------------------------------
# GNUmakefile for phonons library. M.Kelsey 24-Oct-2013
# ------------------------------------------------------------
name := G4phonon
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
-95
View File
@@ -1,95 +0,0 @@
$Id: History 84196 2014-10-10 14:31:48Z gcosmo $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the SVN log-message one should put at every
committal in the SVN repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
8 October 2014 Michael Kelsey (prophonon-V10-00-01)
----------------------------------------------------
- G4LatticeManager: Change to globally shared object (simple "static", not
G4ThreadLocal). Fixes null-pointer crash in MT phononExample.
13 March 2014 Gabriele Cosmo (prophonon-V10-00-00)
---------------------------------------------------
- Removed inline keywords in methods in G4PhononDownconversion.cc
and make coherent use of G4 types.
15 November 2013 Michael Kelsey (prophonon-V09-06-07)
------------------------------------------------------
- G4PhononDownconversion.cc: Address Coverity #53462, initialize data
buffers in ctor.
- G4PhononReflection.cc: Address Coverity #53407, throw exception if input
track polarization is invalid (i.e., track is not a phonon).
- G4LatticeManager.hh: Address Coverity #53461, drop lattice counters.
- G4LatticeReader.hh: Move ctor, dtor implementations to .cc file; fix
comment on psLatfile, as stream is owned by reader.
- G4LatticeReader.cc: Address Coverity #53491-53495, check input data fNX
and fNY against allowed size of lattice array (G4LatticeLogical::MAXRES)
before using them. NOTE: Requires materials-V09-06-32 or later.
15 November 2013 Michael Kelsey (prophonon-V09-06-06)
------------------------------------------------------
- G4VPhononProcess.cc: Add verbosity reporting of vgroup before and after
rotation.
13 November 2013 Michael Kelsey (prophonon-V09-06-05)
------------------------------------------------------
- G4LatticeManager: Avoid double-delete at end of job by registering unique
lattice pointers into std::set<>, and deleting those instead of std::map
entries. Supporting non-virtual utility functions for use in ctor/dtor.
12 November 2013 Michael Kelsey (prophonon-V09-06-04)
------------------------------------------------------
- G4LatticeReader.cc: Per G.Folger, errors processing input file should
throw fatal exception, not return null pointer.
12 November 2013 Michael Kelsey (prophonon-V09-06-03)
------------------------------------------------------
- G4VPhononProcess.cc: Add verboseLevel-controlled output to show
generation of secondaries.
- G4PhononDownConversion.cc, G4PhononScattering.cc: Add verboseLevel output
to show MFP.
11 November 2013 Michael Kelsey (prophonon-V09-06-02)
------------------------------------------------------
- G4PhononTrackMap: Move implementation of Clear() to .cc file. Called
from constructor to try to ensure that map data member isn't wonky on
Windows.
6 November 2013 Michael Kelsey (prophonon-V09-06-01)
-----------------------------------------------------
- G4LatticeReader.cc: Fix compiler warning about implicit cast of string
literal to char*, by casting getenv() to (const char*).
5 November 2013 Michael Kelsey (prophonon-V09-06-00)
-----------------------------------------------------
NEW PACKAGE for Release 10, containing processes for phonon propagation
and interaction in materials:
README
G4LatticeManager.hh,.cc
G4LatticeReader.hh,.cc
G4PhononDownconversion.hh,.cc
G4PhononPolarization.hh,.cc
G4PhononReflection.hh,.cc
G4PhononScattering.hh,.cc
G4PhononTrackMap.hh,.cc
G4VPhononProcess.hh,.cc
-39
View File
@@ -1,39 +0,0 @@
$Id: README 75844 2013-11-06 17:35:56Z gcosmo $
Contains processes for phonon propagation and interaction in materials.
G4LatticeManager: Singleton (TLS) for logical and physical lattices
associated with materials and volumes.
G4LatticeReader: Driver to create logical lattices by reading in
configuration files and velocity map tables. NOTE: This class will
be moved to source/materials/ once Release 10.0 is deployed.
The lattice data files should be stored under $G4LATTICEDATA (set to
"./CrystalMaps" by default, to support the extended example). The
configuration and velocity map files for a given material should be stored
in a subdirectory with that material's name (e.g., "Ge").
Documentation for the lattice configuration files will be expanded in the
future.
G4VPhononProcess: Virtual base class for all processes below, providing
some utility functions.
G4PhononDownconversion: Process to convert single longitudinal phonons
either into pairs of two transverse phonons, or to emit a transverse
phonon.
G4PhononReflection: Placeholder process to reflect phonons off of crystal
surfaces. Currently phonons are absorbed, or converted to hits.
G4PhononScattering: Process to scatter phonons off the surrounding
lattice. Currently handles "transportation" as well, but each
scatter destroys the phonon and creates a new one.
G4PhononPolarization: Enum with conversion functions to map the three
phonon particle definitions onto internal codes (L=0, TS=1, TF=2).
G4PhononTrackMap: Singleton (TLS) map file to connect tracks with
wavevectors. for temporary use until wavevector is added to G4Track
as a data member, after Release 10.0.
@@ -1,106 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file materials/include/G4LatticeManager.hh
/// \brief Definition of the G4LatticeManager class
//
// $Id: G4LatticeManager.hh 84196 2014-10-10 14:31:48Z gcosmo $
//
// 20131113 Add registry to carry unique lattice pointers, for EOJ deletion
// 20131115 Drop lattice counters, not used anywhere
// 20141008 Change to global singleton; must be shared across worker threads
#ifndef G4LatticeManager_h
#define G4LatticeManager_h 1
#include "G4ThreeVector.hh"
#include <map>
#include <set>
class G4LatticeLogical;
class G4LatticePhysical;
class G4Material;
class G4VPhysicalVolume;
class G4LatticeManager {
private:
static G4LatticeManager* fLM; // Global, shared singleton
public:
static G4LatticeManager* GetLatticeManager();
void SetVerboseLevel(G4int vb) { verboseLevel = vb; }
void Reset(); // Remove and delete all registered lattices
// Users may register physical or logical lattices with volumes
G4bool RegisterLattice(G4VPhysicalVolume*, G4LatticePhysical*);
G4bool RegisterLattice(G4VPhysicalVolume*, G4LatticeLogical*);
// Logical lattices are associated with materials
G4bool RegisterLattice(G4Material*, G4LatticeLogical*);
// Logical lattices may be read from <latDir>/config.txt data file
G4LatticeLogical* LoadLattice(G4Material*, const G4String& latDir);
G4LatticeLogical* GetLattice(G4Material*) const;
G4bool HasLattice(G4Material*) const;
// Combine loading and registration (Material extracted from volume)
G4LatticePhysical* LoadLattice(G4VPhysicalVolume*, const G4String& latDir);
// NOTE: Passing Vol==0 will return the default lattice
G4LatticePhysical* GetLattice(G4VPhysicalVolume*) const;
G4bool HasLattice(G4VPhysicalVolume*) const;
G4double MapKtoV(G4VPhysicalVolume*, G4int, const G4ThreeVector &) const;
G4ThreeVector MapKtoVDir(G4VPhysicalVolume*, G4int,
const G4ThreeVector&) const;
protected:
void Clear(); // Remove entries from lookup tables w/o deletion
protected:
G4int verboseLevel; // Allow users to enable diagnostic messages
typedef std::map<G4Material*, G4LatticeLogical*> LatticeMatMap;
typedef std::set<G4LatticeLogical*> LatticeLogReg;
LatticeLogReg fLLattices; // Registry of unique lattice pointers
LatticeMatMap fLLatticeList;
typedef std::map<G4VPhysicalVolume*, G4LatticePhysical*> LatticeVolMap;
typedef std::set<G4LatticePhysical*> LatticePhyReg;
LatticePhyReg fPLattices; // Registry of unique lattice pointers
LatticeVolMap fPLatticeList;
private:
G4LatticeManager();
virtual ~G4LatticeManager();
};
#endif
@@ -1,78 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/include/G4LatticeReader.hh
/// \brief Definition of the G4LatticeReader class
//
// NOTE: This reader class for logical lattices should be moved to
// materials/ after the 10.0 release (and this comment removed).
// $Id: G4LatticeReader.hh 76885 2013-11-18 12:55:15Z gcosmo $
//
// 20131115 Move ctor, dtor implementations to .cc file.
#ifndef G4LatticeReader_h
#define G4LatticeReader_h 1
#include "globals.hh"
#include <iosfwd>
class G4LatticeLogical;
class G4LatticeReader {
public:
G4LatticeReader(G4int vb=0);
~G4LatticeReader();
void SetVerboseLevel(G4int vb) { verboseLevel = vb; }
G4LatticeLogical* MakeLattice(const G4String& filepath);
protected:
G4bool OpenFile(const G4String& filepath);
G4bool ProcessToken();
G4bool ProcessValue(const G4String& name); // Numerical parameters
G4bool ProcessConstants(); // Four dynamical constants
G4bool ProcessMap(); // Velocity magnitudes file
G4bool ProcessNMap(); // Direction vectors file
G4bool ReadMapInfo(); // Get map file parameters
G4bool SkipComments(); // Everything after '#'
void CloseFile();
private:
G4int verboseLevel; // For reporting progress, also use G4VERBOSE
std::ifstream* psLatfile; // Configuration file being read
G4LatticeLogical* pLattice; // Lattice under construction (not owned)
G4String fMapPath; // Path to config file to find velocity maps
G4String fToken; // Reusable buffers for reading file
G4double fValue; // ... floating point data values
G4String fMap, fsPol; // ... map filename and polarization code
G4int fPol, fNX, fNY; // ... map binning in each direction
static const G4String fDataDir; // Directory path ($G4LATTICEDATA)
};
#endif /* G4LatticeReader_h */
@@ -1,67 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/include/G4PhononDownconversion.hh
/// \brief Definition of the G4PhononDownconversion class
//
// $Id: G4PhononDownconversion.hh 79778 2014-03-13 17:24:53Z gcosmo $
//
#ifndef G4PhononDownconversion_h
#define G4PhononDownconversion_h 1
#include "G4VPhononProcess.hh"
class G4PhononDownconversion : public G4VPhononProcess {
public:
G4PhononDownconversion(const G4String& processName ="phononDownconversion");
virtual ~G4PhononDownconversion();
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
virtual G4bool IsApplicable(const G4ParticleDefinition&);
protected:
virtual G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition*);
private:
// relative probability that anharmonic decay occurs L->L'+T'
G4double GetLTDecayProb(G4double, G4double) const;
G4double GetTTDecayProb(G4double, G4double) const;
G4double MakeLDeviation(G4double, G4double) const;
G4double MakeTTDeviation(G4double, G4double) const;
G4double MakeTDeviation(G4double, G4double) const;
void MakeTTSecondaries(const G4Track&);
void MakeLTSecondaries(const G4Track&);
private:
G4double fBeta, fGamma, fLambda, fMu; // Local buffers for calculations
// hide assignment operator as private
G4PhononDownconversion(G4PhononDownconversion&);
G4PhononDownconversion& operator=(const G4PhononDownconversion& right);
};
#endif
@@ -1,46 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/include/G4PhononPolarization.hh
/// \brief Definition of the G4PhononPolarization enum
//
// $Id: G4PhononPolarization.hh 75725 2013-11-05 16:52:30Z mkelsey $
//
#ifndef G4PhononPolarization_h
#define G4PhononPolarization_h 1
#include "globals.hh"
class G4ParticleDefinition;
namespace G4PhononPolarization {
enum { Long=0, TransSlow=1, TransFast=2, UNKNOWN=-1 };
G4int Get(const G4ParticleDefinition* aPD);
G4ParticleDefinition* Get(G4int pol);
}
#endif /* G4PhononPolarization_h */
@@ -1,66 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/include/G4PhononReflection.hh
/// \brief Definition of the G4PhononReflection class
//
// $Id: G4PhononReflection.hh 75725 2013-11-05 16:52:30Z mkelsey $
//
#ifndef G4PhononReflection_h
#define G4PhononReflection_h 1
#include "G4VPhononProcess.hh"
class G4PhononReflection : public G4VPhononProcess {
public:
G4PhononReflection(const G4String& processName ="phononReflection" );
virtual ~G4PhononReflection();
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
protected:
virtual G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition*);
private:
G4double kCarTolerance;
private:
// hide assignment operator as private
G4PhononReflection(G4PhononReflection&);
G4PhononReflection& operator=(const G4PhononReflection& right);
};
#endif
@@ -1,63 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/include/G4PhononScattering.hh
/// \brief Definition of the G4PhononScattering class
//
// $Id: G4PhononScattering.hh 75725 2013-11-05 16:52:30Z mkelsey $
//
#ifndef G4PhononScattering_h
#define G4PhononScattering_h 1
#include "G4VPhononProcess.hh"
class G4PhononScattering : public G4VPhononProcess {
public:
G4PhononScattering(const G4String& processName ="phononScattering" );
virtual ~G4PhononScattering();
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
protected:
virtual G4double GetMeanFreePath(const G4Track&, G4double,
G4ForceCondition* );
private:
// hide assignment operator as private
G4PhononScattering(G4PhononScattering&);
G4PhononScattering& operator=(const G4PhononScattering& right);
};
#endif
@@ -1,74 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/include/G4PhononTrackMap.hh
/// \brief Definition of the G4PhononTrackMap base class
//
// $Id: G4PhononTrackMap.hh 76503 2013-11-12 08:20:50Z gcosmo $
//
// 20131111 Move implementation of Clear() to .cc file
#ifndef G4PhononTrackMap_h
#define G4PhononTrackMap_h 1
#include "G4ThreeVector.hh"
#include <map>
class G4Track;
class G4PhononTrackMap {
public:
typedef std::map<const G4Track*, G4ThreeVector> TrkIDKmap;
static G4ThreadLocal G4PhononTrackMap* theTrackMap;
public:
static G4PhononTrackMap* GetPhononTrackMap(); // Synonyms for access
static G4PhononTrackMap* GetInstance() { return GetPhononTrackMap(); }
// Update the wavevector for specified track, add track if not found
void SetK(const G4Track* track, const G4ThreeVector& K);
void SetK(const G4Track& track, const G4ThreeVector& K) { SetK(&track, K); }
// Access current wavevector for specified track (NULL if doesn't exist)
const G4ThreeVector& GetK(const G4Track* track) const;
const G4ThreeVector& GetK(const G4Track& track) const { return GetK(&track); }
// Check if specified track is already loaded
G4bool Find(const G4Track* track) const;
G4bool Find(const G4Track& track) const { return Find(&track); }
// Remove specified track from map (used by EndTracking)
void RemoveTrack(const G4Track* track);
void Clear(); // Remove all entries from map
private:
TrkIDKmap theMap; // Associate track ID numbers with vectors
private:
G4PhononTrackMap() { Clear(); } // Ensure map is empty
~G4PhononTrackMap() {;}
};
#endif /* G4PhononTrackMap_h */
@@ -1,82 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/include/G4VPhononProcess.hh
/// \brief Definition of the G4VPhononProcess base class
//
// $Id: G4VPhononProcess.hh 75725 2013-11-05 16:52:30Z mkelsey $
//
#ifndef G4VPhononProcess_h
#define G4VPhononProcess_h 1
#include "globals.hh"
#include "G4VDiscreteProcess.hh"
#include "G4ThreeVector.hh"
class G4PhononTrackMap;
class G4LatticePhysical;
class G4VPhononProcess : public G4VDiscreteProcess {
public:
G4VPhononProcess(const G4String& processName);
virtual ~G4VPhononProcess();
virtual G4bool IsApplicable(const G4ParticleDefinition& aPD);
// Initialize wave vectors for currently active track(s)
// NOTE: These functions must call back to base class implementations!
virtual void StartTracking(G4Track* track);
virtual void EndTracking();
protected:
// For convenience, map phonon type to polarization code
virtual G4int GetPolarization(const G4Track& track) const;
virtual G4int GetPolarization(const G4Track* track) const {
return GetPolarization(*track);
}
// For convenience, generate random polarization from density of states
// Values passed may be zero to suppress particular states
virtual G4int ChoosePolarization(G4double Ldos, G4double STdos,
G4double FTdos) const;
// Construct new track with correct momentum, position, etc.
virtual G4Track* CreateSecondary(G4int polarization, const G4ThreeVector& K,
G4double energy) const;
protected:
G4PhononTrackMap* trackKmap; // For convenient access by processes
const G4LatticePhysical* theLattice;
private:
const G4Track* currentTrack; // For use by Start/EndTracking
// hide assignment operators as private
G4VPhononProcess(G4VPhononProcess&);
G4VPhononProcess& operator=(const G4VPhononProcess& right);
};
#endif /* G4VPhononProcess_h */
-75
View File
@@ -1,75 +0,0 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4phonon
# Package: Geant4.src.G4processes.G4phonon
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/10/2013
#
# $Id: sources.cmake 75844 2013-11-06 17:35:56Z gcosmo $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/bosons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4phonon
HEADERS
G4LatticeManager.hh
G4LatticeReader.hh
G4PhononDownconversion.hh
G4PhononPolarization.hh
G4PhononReflection.hh
G4PhononScattering.hh
G4PhononTrackMap.hh
G4VPhononProcess.hh
SOURCES
G4LatticeManager.cc
G4LatticeReader.cc
G4PhononDownconversion.cc
G4PhononPolarization.cc
G4PhononReflection.cc
G4PhononScattering.cc
G4PhononTrackMap.cc
G4VPhononProcess.cc
GRANULAR_DEPENDENCIES
G4bosons
G4geometrymng
G4globman
G4materials
G4partman
G4procman
G4track
G4volumes
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4materials
G4particles
G4track
LINK_LIBRARIES
)
# List any source specific properties here
@@ -1,293 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file materials/src/G4LatticeManager.cc
/// \brief Implementation of the G4LatticeManager class
//
// $Id: G4LatticeManager.cc 84196 2014-10-10 14:31:48Z gcosmo $
//
// 20131113 Delete lattices in (new) registry, not in lookup maps
// 20141008 Change to global singleton; must be shared across worker threads
#include "G4LatticeManager.hh"
#include "G4AutoLock.hh"
#include "G4LatticeLogical.hh"
#include "G4LatticePhysical.hh"
#include "G4LatticeReader.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4VPhysicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4Threading.hh"
#include <fstream>
G4LatticeManager* G4LatticeManager::fLM = 0; // Global (shared) singleton
namespace {
G4Mutex latMutex = G4MUTEX_INITIALIZER; // For thread protection
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LatticeManager::G4LatticeManager() : verboseLevel(0) {
Clear();
}
G4LatticeManager::~G4LatticeManager() {
Reset(); // Deletes all lattices
}
// Delete all registered lattices and clear entries from lookup tables
void G4LatticeManager::Reset() {
for (LatticeLogReg::iterator lm=fLLattices.begin();
lm != fLLattices.end(); ++lm) {
delete (*lm);
}
for (LatticePhyReg::iterator pm=fPLattices.begin();
pm != fPLattices.end(); ++pm) {
delete (*pm);
}
Clear();
}
// Remove entries without deletion (for begin-job and end-job initializing)
void G4LatticeManager::Clear() {
fPLatticeList.clear();
fPLattices.clear();
fLLatticeList.clear();
fLLattices.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LatticeManager* G4LatticeManager::GetLatticeManager() {
// if no lattice manager exists, create one.
G4AutoLock latLock(&latMutex); // Protect before changing pointer
if (!fLM) fLM = new G4LatticeManager();
latLock.unlock();
return fLM;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Associate logical lattice with material
G4bool G4LatticeManager::RegisterLattice(G4Material* Mat,
G4LatticeLogical* Lat) {
if (!Mat || !Lat) return false; // Don't register null pointers
G4AutoLock latLock(&latMutex); // Protect before changing registry
fLLattices.insert(Lat); // Take ownership in registry
fLLatticeList[Mat] = Lat;
latLock.unlock();
if (verboseLevel) {
G4cout << "G4LatticeManager::RegisterLattice: "
<< " Total number of logical lattices: " << fLLatticeList.size()
<< " (" << fLLattices.size() << " unique)" << G4endl;
}
return true;
}
// Construct logical lattice for material from config file
G4LatticeLogical* G4LatticeManager::LoadLattice(G4Material* Mat,
const G4String& latDir) {
if (verboseLevel) {
G4cout << "G4LatticeManager::LoadLattice material " << Mat->GetName()
<< " " << latDir << G4endl;
}
G4LatticeReader latReader(verboseLevel);
G4LatticeLogical* newLat = latReader.MakeLattice(latDir+"/config.txt");
if (verboseLevel>1) G4cout << " Created newLat " << newLat << G4endl;
if (newLat) RegisterLattice(Mat, newLat);
else {
G4cerr << "ERROR creating " << latDir << " lattice for material "
<< Mat->GetName() << G4endl;
}
return newLat;
}
// Combine loading and registration (Material extracted from volume)
G4LatticePhysical* G4LatticeManager::LoadLattice(G4VPhysicalVolume* Vol,
const G4String& latDir) {
if (verboseLevel) {
G4cout << "G4LatticeManager::LoadLattice volume " << Vol->GetName()
<< " " << latDir << G4endl;
}
G4Material* theMat = Vol->GetLogicalVolume()->GetMaterial();
// Create and register the logical lattice, then the physical lattice
G4LatticeLogical* lLattice = LoadLattice(theMat, latDir);
if (!lLattice) return 0;
G4LatticePhysical* pLattice =
new G4LatticePhysical(lLattice, Vol->GetFrameRotation());
if (pLattice) RegisterLattice(Vol, pLattice);
if (verboseLevel>1) G4cout << " Created pLattice " << pLattice << G4endl;
return pLattice;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Associate physical (oriented) lattice with physical volume
G4bool G4LatticeManager::RegisterLattice(G4VPhysicalVolume* Vol,
G4LatticePhysical* Lat) {
if (!Vol || !Lat) return false; // Don't register null pointers
G4AutoLock latLock(&latMutex); // Protect before changing registry
// SPECIAL: Register first lattice with a null volume to act as default
if (fPLatticeList.empty()) fPLatticeList[0] = Lat;
fPLattices.insert(Lat);
fPLatticeList[Vol] = Lat;
latLock.unlock();
if (verboseLevel) {
G4cout << "G4LatticeManager::RegisterLattice: "
<< " Total number of physical lattices: " << fPLatticeList.size()-1
<< " (" << fPLattices.size() << " unique)" << G4endl;
}
return true;
}
G4bool G4LatticeManager::RegisterLattice(G4VPhysicalVolume* Vol,
G4LatticeLogical* LLat) {
if (!Vol || !LLat) return false; // Don't register null pointers
// Make sure logical lattice is registered for material
RegisterLattice(Vol->GetLogicalVolume()->GetMaterial(), LLat);
// Create and register new physical lattice to go with volume
return RegisterLattice(Vol, new G4LatticePhysical(LLat, Vol->GetFrameRotation()));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Returns a pointer to the LatticeLogical associated with material
G4LatticeLogical* G4LatticeManager::GetLattice(G4Material* Mat) const {
LatticeMatMap::const_iterator latFind = fLLatticeList.find(Mat);
if (latFind != fLLatticeList.end()) {
if (verboseLevel)
G4cout << "G4LatticeManager::GetLattice found " << latFind->second
<< " for " << (Mat?Mat->GetName():"NULL") << "." << G4endl;
return latFind->second;
}
if (verboseLevel)
G4cerr << "G4LatticeManager:: Found no matching lattices for "
<< (Mat?Mat->GetName():"NULL") << "." << G4endl;
return 0; // No lattice associated with volume
}
// Returns a pointer to the LatticePhysical associated with volume
// NOTE: Passing Vol==0 will return the default lattice
G4LatticePhysical* G4LatticeManager::GetLattice(G4VPhysicalVolume* Vol) const {
LatticeVolMap::const_iterator latFind = fPLatticeList.find(Vol);
if (latFind != fPLatticeList.end()) {
if (verboseLevel)
G4cout << "G4LatticeManager::GetLattice found " << latFind->second
<< " for " << (Vol?Vol->GetName():"default") << "." << G4endl;
return latFind->second;
}
if (verboseLevel)
G4cerr << "G4LatticeManager::GetLattice found no matching lattices for "
<< (Vol?Vol->GetName():"default") << "." << G4endl;
return 0; // No lattice associated with volume
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Return true if volume Vol has a physical lattice
G4bool G4LatticeManager::HasLattice(G4VPhysicalVolume* Vol) const {
return (fPLatticeList.find(Vol) != fPLatticeList.end());
}
// Return true if material Mat has a logical lattice
G4bool G4LatticeManager::HasLattice(G4Material* Mat) const {
return (fLLatticeList.find(Mat) != fLLatticeList.end());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//Given the phonon wave vector k, phonon physical volume Vol
//and polarizationState(0=LON, 1=FT, 2=ST),
//returns phonon velocity in m/s
G4double G4LatticeManager::MapKtoV(G4VPhysicalVolume* Vol,
G4int polarizationState,
const G4ThreeVector & k) const {
G4LatticePhysical* theLattice = GetLattice(Vol);
if (verboseLevel)
G4cout << "G4LatticeManager::MapKtoV using lattice " << theLattice
<< G4endl;
// If no lattice available, use generic "speed of sound"
return theLattice ? theLattice->MapKtoV(polarizationState, k) : 300.*m/s;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Given the phonon wave vector k, phonon physical volume Vol
// and polarizationState(0=LON, 1=FT, 2=ST),
// returns phonon propagation direction as dimensionless unit vector
G4ThreeVector G4LatticeManager::MapKtoVDir(G4VPhysicalVolume* Vol,
G4int polarizationState,
const G4ThreeVector & k) const {
G4LatticePhysical* theLattice = GetLattice(Vol);
if (verboseLevel)
G4cout << "G4LatticeManager::MapKtoVDir using lattice " << theLattice
<< G4endl;
// If no lattice available, propagate along input wavevector
return theLattice ? theLattice->MapKtoVDir(polarizationState, k) : k.unit();
}
@@ -1,248 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/include/G4LatticeReader.hh
/// \brief Implementation of the G4LatticeReader class
//
// NOTE: This reader class for logical lattices should be moved to
// materials/ after the 10.0 release (and this comment removed).
// $Id: G4LatticeReader.cc 76885 2013-11-18 12:55:15Z gcosmo $
//
// 20131106 M.Kelsey -- Add const to getenv() to avoid compiler warning.
// 20131112 Throw exception if input file fails.
// 20131115 Check file input arguments for maps for validity before use;
// move ctor, dtor here; check stream pointer before closing.
#include "G4LatticeReader.hh"
#include "G4ExceptionSeverity.hh"
#include "G4LatticeLogical.hh"
#include "G4SystemOfUnits.hh"
#include <fstream>
#include <limits>
#include <stdlib.h>
// Default path to lattice files, for use with filenames below
const G4String G4LatticeReader::fDataDir =
getenv("G4LATTICEDATA") ? (const char*)getenv("G4LATTICEDATA") : "./CrystalMaps";
// Constructor and destructor
G4LatticeReader::G4LatticeReader(G4int vb)
: verboseLevel(vb), psLatfile(0), pLattice(0), fMapPath(""),
fToken(""), fValue(0.), fMap(""), fsPol(""), fPol(-1), fNX(0), fNY(0) {;}
G4LatticeReader::~G4LatticeReader() {
delete psLatfile; psLatfile = 0;
}
// Main drivers to read configuration from file or stream
G4LatticeLogical* G4LatticeReader::MakeLattice(const G4String& filename) {
if (verboseLevel) G4cout << "G4LatticeReader " << filename << G4endl;
if (!OpenFile(filename)) {
G4ExceptionDescription msg;
msg << "Unable to open " << filename;
G4Exception("G4LatticeReader::MakeLattice", "Lattice001",
FatalException, msg);
return 0;
}
pLattice = new G4LatticeLogical; // Create lattice to be filled
G4bool goodLattice = true;
while (!psLatfile->eof()) {
goodLattice &= ProcessToken();
}
CloseFile();
if (!goodLattice) {
G4ExceptionDescription msg;
msg << "Error reading lattice from " << filename;
G4Exception("G4LatticeReader::MakeLattice", "Lattice002",
FatalException, msg);
delete pLattice;
pLattice = 0;
}
return pLattice; // Lattice complete; return pointer with ownership
}
// Open local file or file found under data path
G4bool G4LatticeReader::OpenFile(const G4String& filename) {
if (verboseLevel)
G4cout << "G4LatticeReader::OpenFile " << filename << G4endl;
G4String filepath = filename;
psLatfile = new std::ifstream(filepath);
if (!psLatfile->good()) { // Local file not found
filepath = fDataDir + "/" + filename;
psLatfile->open(filepath); // Try data directory
if (!psLatfile->good()) {
CloseFile();
return false;
}
if (verboseLevel>1) G4cout << " Found file " << filepath << G4endl;
}
// Extract path from filename to use in finding .ssv map files
size_t lastdir = filepath.last('/');
if (lastdir == std::string::npos) fMapPath = "."; // No path at all
else fMapPath = filepath(0,lastdir);
return true;
}
// Close and delete input stream
void G4LatticeReader::CloseFile() {
if (psLatfile) psLatfile->close();
delete psLatfile;
psLatfile = 0;
}
// Read next token from file, use it to store next data into lattice
G4bool G4LatticeReader::ProcessToken() {
fToken = "";
*psLatfile >> fToken;
if (fToken.empty() || psLatfile->eof()) return true; // End of file reached
if (verboseLevel>1) G4cout << " ProcessToken " << fToken << G4endl;
fToken.toLower();
if (fToken.contains('#')) return SkipComments(); // Ignore rest of line
if (fToken == "vdir") return ProcessNMap(); // Direction vector map
if (fToken == "vg") return ProcessMap(); // Velocity magnitudes
if (fToken == "dyn") return ProcessConstants(); // Dynamical parameters
return ProcessValue(fToken); // Single numeric value
}
// Eat remainder of line, assuming a '#' token was found
G4bool G4LatticeReader::SkipComments() {
psLatfile->ignore(std::numeric_limits<std::streamsize>::max(), '\n');
return true; // Never fails
}
// Read double value from file, store based on name string
G4bool G4LatticeReader::ProcessValue(const G4String& name) {
*psLatfile >> fValue;
if (verboseLevel>1) G4cout << " ProcessValue " << fValue << G4endl;
G4bool good = true;
/***** NOTE: Individual Set functions not included in Release 10.0
if (name == "beta") pLattice->SetBeta(fValue);
else if (name == "gamma") pLattice->SetGamma(fValue);
else if (name == "lambda") pLattice->SetLambda(fValue);
else if (name == "mu") pLattice->SetMu(fValue);
else *****/
if (name == "scat") pLattice->SetScatteringConstant(fValue*s*s*s);
else if (name == "b") pLattice->SetScatteringConstant(fValue*s*s*s);
else if (name == "decay") pLattice->SetAnhDecConstant(fValue*s*s*s*s);
else if (name == "a") pLattice->SetAnhDecConstant(fValue*s*s*s*s);
else if (name == "ldos") pLattice->SetLDOS(fValue);
else if (name == "stdos") pLattice->SetSTDOS(fValue);
else if (name == "ftdos") pLattice->SetFTDOS(fValue);
else {
G4cerr << "G4LatticeReader: Unrecognized token " << name << G4endl;
good = false;
}
return good;
}
G4bool G4LatticeReader::ProcessConstants() {
G4double beta=0., gamma=0., lambda=0., mu=0.;
*psLatfile >> beta >> gamma >> lambda >> mu;
if (verboseLevel>1)
G4cout << " ProcessConstants " << beta << " " << gamma
<< " " << lambda << " " << mu << G4endl;
pLattice->SetDynamicalConstants(beta, gamma, lambda, mu);
return psLatfile->good();
}
// Read map filename, polarization, and binning dimensions
G4bool G4LatticeReader::ReadMapInfo() {
*psLatfile >> fMap >> fsPol >> fNX >> fNY;
if (verboseLevel>1)
G4cout << " ReadMapInfo " << fMap << " " << fsPol
<< " " << fNX << " " << fNY << G4endl;
if (fNX < 0 || fNX >= G4LatticeLogical::MAXRES) {
G4cerr << "G4LatticeReader: Invalid map theta dimension " << fNX << G4endl;
return false;
}
if (fNY < 0 || fNY >= G4LatticeLogical::MAXRES) {
G4cerr << "G4LatticeReader: Invalid map phi dimension " << fNY << G4endl;
return false;
}
// Prepend path to data files to map filename
fMap = fMapPath + "/" + fMap;
// Convert string code (L,ST,LT) to polarization index
fsPol.toLower();
fPol = ( (fsPol=="l") ? 0 : // Longitudinal
(fsPol=="st") ? 1 : // Slow-transverse
(fsPol=="ft") ? 2 : // Fast-transverse
-1 ); // Invalid code
if (fPol<0 || fPol>2) {
G4cerr << "G4LatticeReader: Invalid polarization code " << fsPol << G4endl;
return false;
}
return true;
}
G4bool G4LatticeReader::ProcessMap() {
if (!ReadMapInfo()) { // Get specific parameters for map to load
G4cerr << "G4LatticeReader: Unable to process mapfile directive." << G4endl;
return false;
}
return pLattice->LoadMap(fNX, fNY, fPol, fMap);
}
G4bool G4LatticeReader::ProcessNMap() {
if (!ReadMapInfo()) { // Get specific parameters for map to load
G4cerr << "G4LatticeReader: Unable to process mapfile directive." << G4endl;
return false;
}
return pLattice->Load_NMap(fNX, fNY, fPol, fMap);
}
@@ -1,265 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/src/G4PhononDownconversion.cc
/// \brief Implementation of the G4PhononDownconversion class
//
// $Id: G4PhononDownconversion.cc 79778 2014-03-13 17:24:53Z gcosmo $
//
// 20131111 Add verbose output for MFP calculation
// 20131115 Initialize data buffers in ctor
#include "G4PhononDownconversion.hh"
#include "G4LatticePhysical.hh"
#include "G4PhononLong.hh"
#include "G4PhononPolarization.hh"
#include "G4PhononTrackMap.hh"
#include "G4PhononTransFast.hh"
#include "G4PhononTransSlow.hh"
#include "G4PhysicalConstants.hh"
#include "G4RandomDirection.hh"
#include "G4Step.hh"
#include "G4SystemOfUnits.hh"
#include "G4VParticleChange.hh"
#include "Randomize.hh"
#include <cmath>
G4PhononDownconversion::G4PhononDownconversion(const G4String& aName)
: G4VPhononProcess(aName), fBeta(0.), fGamma(0.), fLambda(0.), fMu(0.) {;}
G4PhononDownconversion::~G4PhononDownconversion() {;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4PhononDownconversion::GetMeanFreePath(const G4Track& aTrack,
G4double /*previousStepSize*/,
G4ForceCondition* condition) {
//Determines mean free path for longitudinal phonons to split
G4double A = theLattice->GetAnhDecConstant();
G4double Eoverh = aTrack.GetKineticEnergy()/h_Planck;
//Calculate mean free path for anh. decay
G4double mfp = aTrack.GetVelocity()/(Eoverh*Eoverh*Eoverh*Eoverh*Eoverh*A);
if (verboseLevel > 1)
G4cout << "G4PhononDownconversion::GetMeanFreePath = " << mfp << G4endl;
*condition = NotForced;
return mfp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4PhononDownconversion::PostStepDoIt( const G4Track& aTrack,
const G4Step&) {
aParticleChange.Initialize(aTrack);
//Obtain dynamical constants from this volume's lattice
fBeta=theLattice->GetBeta();
fGamma=theLattice->GetGamma();
fLambda=theLattice->GetLambda();
fMu=theLattice->GetMu();
//Destroy the parent phonon and create the daughter phonons.
//74% chance that daughter phonons are both transverse
//26% Transverse and Longitudinal
if (G4UniformRand()>0.740) MakeLTSecondaries(aTrack);
else MakeTTSecondaries(aTrack);
aParticleChange.ProposeEnergy(0.);
aParticleChange.ProposeTrackStatus(fStopAndKill);
return &aParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4PhononDownconversion::IsApplicable(const G4ParticleDefinition& aPD) {
//Only L-phonons decay
return (&aPD==G4PhononLong::PhononDefinition());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//probability density of energy distribution of L'-phonon in L->L'+T process
G4double G4PhononDownconversion::GetLTDecayProb(G4double d, G4double x) const {
//d=delta= ratio of group velocities vl/vt and x is the fraction of energy in the longitudinal mode, i.e. x=EL'/EL
return (1/(x*x))*(1-x*x)*(1-x*x)*((1+x)*(1+x)-d*d*((1-x)*(1-x)))*(1+x*x-d*d*(1-x)*(1-x))*(1+x*x-d*d*(1-x)*(1-x));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//probability density of energy distribution of T-phonon in L->T+T process
G4double G4PhononDownconversion::GetTTDecayProb(G4double d, G4double x) const {
//dynamic constants from Tamura, PRL31, 1985
G4double A = 0.5*(1-d*d)*(fBeta+fLambda+(1+d*d)*(fGamma+fMu));
G4double B = fBeta+fLambda+2*d*d*(fGamma+fMu);
G4double C = fBeta + fLambda + 2*(fGamma+fMu);
G4double D = (1-d*d)*(2*fBeta+4*fGamma+fLambda+3*fMu);
return (A+B*d*x-B*x*x)*(A+B*d*x-B*x*x)+(C*x*(d-x)-D/(d-x)*(x-d-(1-d*d)/(4*x)))*(C*x*(d-x)-D/(d-x)*(x-d-(1-d*d)/(4*x)));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4PhononDownconversion::MakeLDeviation(G4double d, G4double x) const {
//change in L'-phonon propagation direction after decay
return std::acos((1+(x*x)-((d*d)*(1-x)*(1-x)))/(2*x));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4PhononDownconversion::MakeTDeviation(G4double d, G4double x) const {
//change in T-phonon propagation direction after decay (L->L+T process)
return std::acos((1-x*x+d*d*(1-x)*(1-x))/(2*d*(1-x)));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4PhononDownconversion::MakeTTDeviation(G4double d, G4double x) const {
//change in T-phonon propagation direction after decay (L->T+T process)
return std::acos((1-d*d*(1-x)*(1-x)+d*d*x*x)/(2*d*x));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//Generate daughter phonons from L->T+T process
void G4PhononDownconversion::MakeTTSecondaries(const G4Track& aTrack) {
//d is the velocity ratio vL/vT
G4double d=1.6338;
G4double upperBound=(1+(1/d))/2;
G4double lowerBound=(1-(1/d))/2;
//Use MC method to generate point from distribution:
//if a random point on the energy-probability plane is
//smaller that the curve of the probability density,
//then accept that point.
//x=fraction of parent phonon energy in first T phonon
G4double x = G4UniformRand()*(upperBound-lowerBound) + lowerBound;
G4double p = 1.5*G4UniformRand();
while(p >= GetTTDecayProb(d, x*d)) {
x = G4UniformRand()*(upperBound-lowerBound) + lowerBound;
p = 1.5*G4UniformRand();
}
//using energy fraction x to calculate daughter phonon directions
G4double theta1=MakeTTDeviation(d, x);
G4double theta2=MakeTTDeviation(d, 1-x);
G4ThreeVector dir1=trackKmap->GetK(aTrack);
G4ThreeVector dir2=dir1;
// FIXME: These extra randoms change timing and causting outputs of example!
G4ThreeVector ran = G4RandomDirection(); // FIXME: Drop this line
G4double ph=G4UniformRand()*twopi;
dir1 = dir1.rotate(dir1.orthogonal(),theta1).rotate(dir1, ph);
dir2 = dir2.rotate(dir2.orthogonal(),-theta2).rotate(dir2,ph);
G4double E=aTrack.GetKineticEnergy();
G4double Esec1 = x*E, Esec2 = E-Esec1;
// Make FT or ST phonon (0. means no longitudinal)
G4int polarization1 = ChoosePolarization(0., theLattice->GetSTDOS(),
theLattice->GetFTDOS());
// Make FT or ST phonon (0. means no longitudinal)
G4int polarization2 = ChoosePolarization(0., theLattice->GetSTDOS(),
theLattice->GetFTDOS());
// Construct the secondaries and set their wavevectors
G4Track* sec1 = CreateSecondary(polarization1, dir1, Esec1);
G4Track* sec2 = CreateSecondary(polarization2, dir2, Esec2);
aParticleChange.SetNumberOfSecondaries(2);
aParticleChange.AddSecondary(sec1);
aParticleChange.AddSecondary(sec2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//Generate daughter phonons from L->L'+T process
void G4PhononDownconversion::MakeLTSecondaries(const G4Track& aTrack) {
//d is the velocity ratio vL/v
G4double d=1.6338;
G4double upperBound=1;
G4double lowerBound=(d-1)/(d+1);
//Use MC method to generate point from distribution:
//if a random point on the energy-probability plane is
//smaller that the curve of the probability density,
//then accept that point.
//x=fraction of parent phonon energy in L phonon
G4double x = G4UniformRand()*(upperBound-lowerBound) + lowerBound;
G4double p = 4.0*G4UniformRand();
while(p >= GetLTDecayProb(d, x)) {
x = G4UniformRand()*(upperBound-lowerBound) + lowerBound;
p = 4.0*G4UniformRand(); //4.0 is about the max in the PDF
}
//using energy fraction x to calculate daughter phonon directions
G4double thetaL=MakeLDeviation(d, x);
G4double thetaT=MakeTDeviation(d, x); // FIXME: Should be 1-x?
G4ThreeVector dir1=trackKmap->GetK(aTrack);
G4ThreeVector dir2=dir1;
G4double ph=G4UniformRand()*twopi;
dir1 = dir1.rotate(dir1.orthogonal(),thetaL).rotate(dir1, ph);
dir2 = dir2.rotate(dir2.orthogonal(),-thetaT).rotate(dir2,ph);
G4double E=aTrack.GetKineticEnergy();
G4double Esec1 = x*E, Esec2 = E-Esec1;
// First secondary is longitudnal
G4int polarization1 = G4PhononPolarization::Long;
// Make FT or ST phonon (0. means no longitudinal)
G4int polarization2 = ChoosePolarization(0., theLattice->GetSTDOS(),
theLattice->GetFTDOS());
// Construct the secondaries and set their wavevectors
G4Track* sec1 = CreateSecondary(polarization1, dir1, Esec1);
G4Track* sec2 = CreateSecondary(polarization2, dir2, Esec2);
aParticleChange.SetNumberOfSecondaries(2);
aParticleChange.AddSecondary(sec1);
aParticleChange.AddSecondary(sec2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,55 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/src/G4PhononPolarization.cc
/// \brief implementation of the G4PhononPolarization enum
//
// $Id: G4PhononPolarization.cc 75725 2013-11-05 16:52:30Z mkelsey $
//
#include "G4PhononPolarization.hh"
#include "G4ParticleDefinition.hh"
#include "G4PhononLong.hh"
#include "G4PhononTransFast.hh"
#include "G4PhononTransSlow.hh"
G4int G4PhononPolarization::Get(const G4ParticleDefinition* aPD) {
if (aPD == G4PhononLong::Definition()) return Long;
if (aPD == G4PhononTransSlow::Definition()) return TransSlow;
if (aPD == G4PhononTransFast::Definition()) return TransFast;
return UNKNOWN;
}
G4ParticleDefinition* G4PhononPolarization::Get(G4int pol) {
switch (pol) {
case Long: return G4PhononLong::Definition(); break;
case TransSlow: return G4PhononTransSlow::Definition(); break;
case TransFast: return G4PhononTransFast::Definition(); break;
default: ;
}
return 0;
}
@@ -1,120 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/src/G4PhononReflection.cc
/// \brief Implementation of the G4PhononReflection class
//
// This process handles the interaction of phonons with
// boundaries. Implementation of this class is highly
// geometry dependent.Currently, phonons are killed when
// they reach a boundary. If the other side of the
// boundary was Al, a hit is registered.
//
// $Id: G4PhononReflection.cc 76885 2013-11-18 12:55:15Z gcosmo $
//
// 20131115 Throw exception if track's polarization state is invalid.
#include "G4PhononReflection.hh"
#include "G4ExceptionSeverity.hh"
#include "G4GeometryTolerance.hh"
#include "G4LatticePhysical.hh"
#include "G4PhononLong.hh"
#include "G4PhononTransFast.hh"
#include "G4PhononTransSlow.hh"
#include "G4PhysicalConstants.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4SystemOfUnits.hh"
#include "G4VParticleChange.hh"
G4PhononReflection::G4PhononReflection(const G4String& aName)
: G4VPhononProcess(aName),
kCarTolerance(G4GeometryTolerance::GetInstance()->GetSurfaceTolerance()) {;}
G4PhononReflection::~G4PhononReflection() {;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Always return DBL_MAX and Forced. This ensures that the process is
// called at the end of every step. In PostStepDoIt the process
// decides whether the step encountered a volume boundary and a
// reflection should be applied
G4double G4PhononReflection::GetMeanFreePath(const G4Track&, G4double,
G4ForceCondition* condition) {
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This process handles the interaction of phonons with
// boundaries. Implementation of this class is highly geometry
// dependent.Currently, phonons are killed when they reach a
// boundary. If the other side of the boundary was Al, a hit is
// registered.
G4VParticleChange* G4PhononReflection::PostStepDoIt(const G4Track& aTrack,
const G4Step& aStep) {
aParticleChange.Initialize(aTrack);
//Check if current step is limited by a volume boundary
G4StepPoint* postStepPoint = aStep.GetPostStepPoint();
if (postStepPoint->GetStepStatus()!=fGeomBoundary) {
//make sure that correct phonon velocity is used after the step
int pol = GetPolarization(aTrack);
if (pol < 0 || pol > 2) {
G4Exception("G4PhononReflection::PostStepDoIt","Phonon001",
EventMustBeAborted, "Track is not a phonon");
return &aParticleChange; // NOTE: Will never get here
}
// FIXME: This should be using wave-vector, shouldn't it?
G4double vg = theLattice->MapKtoV(pol, aTrack.GetMomentumDirection());
//Since step was not a volume boundary, just set correct phonon velocity and return
aParticleChange.ProposeVelocity(vg);
return &aParticleChange;
}
// do nothing but return is the step is too short
// This is to allow actual reflection where after
// the first boundary crossing a second, infinitesimal
// step occurs crossing back into the original volume
if (aTrack.GetStepLength()<=kCarTolerance/2) {
return &aParticleChange;
}
G4double eKin = aTrack.GetKineticEnergy();
aParticleChange.ProposeNonIonizingEnergyDeposit(eKin);
aParticleChange.ProposeTrackStatus(fStopAndKill);
return &aParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,105 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/src/G4PhononScattering.cc
/// \brief Implementation of the G4PhononScattering class
//
// $Id: G4PhononScattering.cc 76693 2013-11-14 08:47:37Z gcosmo $
//
// 20131111 Add verbose output for MFP calculation
#include "G4PhononScattering.hh"
#include "G4LatticePhysical.hh"
#include "G4PhononPolarization.hh"
#include "G4PhononLong.hh"
#include "G4PhononTrackMap.hh"
#include "G4PhononTransFast.hh"
#include "G4PhononTransSlow.hh"
#include "G4PhysicalConstants.hh"
#include "G4RandomDirection.hh"
#include "G4Step.hh"
#include "G4SystemOfUnits.hh"
#include "G4VParticleChange.hh"
#include "Randomize.hh"
G4PhononScattering::G4PhononScattering(const G4String& aName)
: G4VPhononProcess(aName) {;}
G4PhononScattering::~G4PhononScattering() {;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4PhononScattering::GetMeanFreePath(const G4Track& aTrack,
G4double /*previousStepSize*/,
G4ForceCondition* condition) {
//Dynamical constants retrieved from PhysicalLattice
G4double B = theLattice->GetScatteringConstant();
G4double Eoverh = aTrack.GetKineticEnergy()/h_Planck;
//Calculate mean free path
G4double mfp = aTrack.GetVelocity()/(Eoverh*Eoverh*Eoverh*Eoverh*B);
if (verboseLevel > 1)
G4cout << "G4PhononScattering::GetMeanFreePath = " << mfp << G4endl;
*condition = NotForced;
return mfp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4PhononScattering::PostStepDoIt( const G4Track& aTrack,
const G4Step& aStep) {
G4StepPoint* postStepPoint = aStep.GetPostStepPoint();
if (postStepPoint->GetStepStatus()==fGeomBoundary) {
return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
}
//Initialize particle change
aParticleChange.Initialize(aTrack);
//randomly generate a new direction and polarization state
G4ThreeVector newDir = G4RandomDirection();
G4int polarization = ChoosePolarization(theLattice->GetLDOS(),
theLattice->GetSTDOS(),
theLattice->GetFTDOS());
// Generate the new track after scattering
// FIXME: If polarization state is the same, just step the track!
G4Track* sec =
CreateSecondary(polarization, newDir, aTrack.GetKineticEnergy());
aParticleChange.SetNumberOfSecondaries(1);
aParticleChange.AddSecondary(sec);
// Scattered phonon replaces current track
aParticleChange.ProposeEnergy(0.);
aParticleChange.ProposeTrackStatus(fStopAndKill);
return &aParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,86 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/src/G4PhononTrackMap.hh
/// \brief Implementation of the G4PhononTrackMap base class
//
// $Id: G4PhononTrackMap.cc 76503 2013-11-12 08:20:50Z gcosmo $
//
// 20131111 Move Clear() function to .cc file
#include "G4PhononTrackMap.hh"
#include "G4ThreeVector.hh"
#include "G4Track.hh"
#include <map>
namespace { const G4ThreeVector nullVec(0.,0.,0.); } // For convenience below
// Singleton instance, must be created at first request
G4ThreadLocal G4PhononTrackMap* G4PhononTrackMap::theTrackMap = 0;
// Pseudo-constructor creates singleton instance
G4PhononTrackMap* G4PhononTrackMap::GetPhononTrackMap() {
if (!theTrackMap) theTrackMap = new G4PhononTrackMap;
return theTrackMap;
}
void G4PhononTrackMap::Clear() {
theMap.clear(); // Remove all entries from map
}
// Check if specified track is already loaded
G4bool G4PhononTrackMap::Find(const G4Track* track) const {
return (!track || theMap.find(track) != theMap.end());
}
// Remove specified track from map (used by EndTracking)
void G4PhononTrackMap::RemoveTrack(const G4Track* track) {
TrkIDKmap::iterator entry = theMap.find(track);
if (entry != theMap.end()) theMap.erase(entry);
}
// Update the wavevector for specified track, add track if non-existent
void G4PhononTrackMap::SetK(const G4Track* track, const G4ThreeVector& K) {
if (track) theMap[track] = K;
}
// Access current wavevector for specified track (NULL if doesn't exist)
const G4ThreeVector& G4PhononTrackMap::GetK(const G4Track* track) const {
TrkIDKmap::const_iterator entry = theMap.find(track);
return (entry != theMap.end()) ? entry->second : nullVec;
}
@@ -1,158 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file processes/phonon/src/G4VPhononProcess.cc
/// \brief Implementation of the G4VPhononProcess base class
//
// $Id: G4VPhononProcess.cc 76885 2013-11-18 12:55:15Z gcosmo $
//
// 20131111 Add verbosity to report creating secondaries
#include "G4VPhononProcess.hh"
#include "G4DynamicParticle.hh"
#include "G4ExceptionSeverity.hh"
#include "G4LatticeManager.hh"
#include "G4LatticePhysical.hh"
#include "G4ParticleDefinition.hh"
#include "G4PhononLong.hh"
#include "G4PhononPolarization.hh"
#include "G4PhononTrackMap.hh"
#include "G4PhononTransFast.hh"
#include "G4PhononTransSlow.hh"
#include "G4ProcessType.hh"
#include "G4ThreeVector.hh"
#include "G4Track.hh"
namespace {
const G4ThreeVector nullVec(0.,0.,0.); // For convenience below
}
// Constructor and destructor
G4VPhononProcess::G4VPhononProcess(const G4String& processName)
: G4VDiscreteProcess(processName, fPhonon),
trackKmap(G4PhononTrackMap::GetInstance()), theLattice(0),
currentTrack(0) {}
G4VPhononProcess::~G4VPhononProcess() {;}
// Only applies to the known phonon polarization states
G4bool G4VPhononProcess::IsApplicable(const G4ParticleDefinition& aPD) {
return (&aPD==G4PhononLong::Definition() ||
&aPD==G4PhononTransFast::Definition() ||
&aPD==G4PhononTransSlow::Definition() );
}
// Initialize wave vectors for currently active track(s)
void G4VPhononProcess::StartTracking(G4Track* track) {
G4VProcess::StartTracking(track); // Apply base class actions
// FIXME: THE WAVEVECTOR SHOULD BE COMPUTED BY INVERTING THE K/V MAP
if (!trackKmap->Find(track))
trackKmap->SetK(track, track->GetMomentumDirection());
currentTrack = track; // Save for use by EndTracking
// Fetch lattice for current track once, use in subsequent steps
G4LatticeManager* LM = G4LatticeManager::GetLatticeManager();
theLattice = LM->GetLattice(track->GetVolume());
}
void G4VPhononProcess::EndTracking() {
G4VProcess::EndTracking(); // Apply base class actions
trackKmap->RemoveTrack(currentTrack);
currentTrack = 0;
theLattice = 0;
}
// For convenience, map phonon type to polarization code
G4int G4VPhononProcess::GetPolarization(const G4Track& track) const {
return G4PhononPolarization::Get(track.GetParticleDefinition());
}
// Generate random polarization from density of states
G4int G4VPhononProcess::ChoosePolarization(G4double Ldos, G4double STdos,
G4double FTdos) const {
G4double norm = Ldos + STdos + FTdos;
G4double cProbST = STdos/norm;
G4double cProbFT = FTdos/norm + cProbST;
// NOTE: Order of selection done to match previous random sequences
G4double modeMixer = G4UniformRand();
if (modeMixer<cProbST) return G4PhononPolarization::TransSlow;
if (modeMixer<cProbFT) return G4PhononPolarization::TransFast;
return G4PhononPolarization::Long;
}
// Create new secondary track from phonon configuration
G4Track* G4VPhononProcess::CreateSecondary(G4int polarization,
const G4ThreeVector& waveVec,
G4double energy) const {
if (verboseLevel>1) {
G4cout << GetProcessName() << " CreateSecondary pol " << polarization
<< " K " << waveVec << " E " << energy << G4endl;
}
G4ThreeVector vgroup = theLattice->MapKtoVDir(polarization, waveVec);
if (verboseLevel>1) G4cout << " MapKtoVDir returned " << vgroup << G4endl;
vgroup = theLattice->RotateToGlobal(vgroup);
if (verboseLevel>1) G4cout << " RotateToGlobal returned " << vgroup << G4endl;
if (verboseLevel && std::fabs(vgroup.mag()-1.) > 0.01) {
G4cout << "WARNING: " << GetProcessName() << " vgroup not a unit vector: "
<< vgroup << G4endl;
}
G4ParticleDefinition* thePhonon = G4PhononPolarization::Get(polarization);
// Secondaries are created at the current track coordinates
G4Track* sec = new G4Track(new G4DynamicParticle(thePhonon, vgroup, energy),
currentTrack->GetGlobalTime(),
currentTrack->GetPosition());
// Store wavevector in lookup table for future tracking
trackKmap->SetK(sec, theLattice->RotateToGlobal(waveVec));
if (verboseLevel>1) {
G4cout << GetProcessName() << " secondary K rotated to "
<< trackKmap->GetK(sec) << G4endl;
}
sec->SetVelocity(theLattice->MapKtoV(polarization, waveVec));
sec->UseGivenVelocity(true);
return sec;
}