G4INCLNuclearDensity.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // INCL++ intra-nuclear cascade model
00027 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
00028 // Davide Mancusi, CEA
00029 // Alain Boudard, CEA
00030 // Sylvie Leray, CEA
00031 // Joseph Cugnon, University of Liege
00032 //
00033 #define INCLXX_IN_GEANT4_MODE 1
00034 
00035 #include "globals.hh"
00036 
00037 #include "G4INCLNuclearDensity.hh"
00038 #include "G4INCLParticleTable.hh"
00039 #include "G4INCLGlobals.hh"
00040 #include <algorithm>
00041 
00042 namespace G4INCL {
00043 
00044   NuclearDensity::NuclearDensity(G4int A, G4int Z, InverseInterpolationTable *rpCorrelationTable) :
00045     theA(A),
00046     theZ(Z),
00047     theMaximumRadius((*rpCorrelationTable)(1.)),
00048     theNuclearRadius(ParticleTable::getNuclearRadius(theA,theZ)),
00049     rFromP(rpCorrelationTable),
00050     // The interpolation table for local-energy look-ups is simply obtained by
00051     // inverting the r-p correlation table.
00052     tFromR(new InverseInterpolationTable(rFromP->getNodeValues(), rFromP->getNodeAbscissae()))
00053   {
00054     DEBUG("Interpolation table for local energy (A=" << theA << ", Z=" << theZ << ") initialised:"
00055         << std::endl
00056         << tFromR->print()
00057         << std::endl);
00058     initializeTransmissionRadii();
00059   }
00060 
00061   NuclearDensity::~NuclearDensity() {
00062     // We don't delete the rFromP table, which is cached in the
00063     // NuclearDensityFactory
00064     delete tFromR;
00065   }
00066 
00067   NuclearDensity::NuclearDensity(const NuclearDensity &rhs) :
00068     theA(rhs.theA),
00069     theZ(rhs.theZ),
00070     theMaximumRadius(rhs.theMaximumRadius),
00071     theNuclearRadius(rhs.theNuclearRadius),
00072     // rFromP is owned by NuclearDensityFactory, so shallow copy is sufficient
00073     rFromP(rhs.rFromP),
00074     // deep copy for tFromR
00075     tFromR(new InverseInterpolationTable(*(rhs.tFromR)))
00076   {
00077     std::copy(rhs.transmissionRadius, rhs.transmissionRadius+UnknownParticle, transmissionRadius);
00078   }
00079 
00080   NuclearDensity &NuclearDensity::operator=(const NuclearDensity &rhs) {
00081     NuclearDensity temporaryDensity(rhs);
00082     swap(temporaryDensity);
00083     return *this;
00084   }
00085 
00086   void NuclearDensity::swap(NuclearDensity &rhs) {
00087     std::swap(theA, rhs.theA);
00088     std::swap(theZ, rhs.theZ);
00089     std::swap(theMaximumRadius, rhs.theMaximumRadius);
00090     std::swap(theNuclearRadius, rhs.theNuclearRadius);
00091     std::swap_ranges(transmissionRadius, transmissionRadius+UnknownParticle, rhs.transmissionRadius);
00092     std::swap(rFromP, rhs.rFromP);
00093     std::swap(tFromR, rhs.tFromR);
00094  }
00095 
00096   void NuclearDensity::initializeTransmissionRadii() {
00097     const G4double theProtonRadius = 0.88; // fm
00098     const G4double theProtonTransmissionRadius = theNuclearRadius + theProtonRadius;
00099 
00100     transmissionRadius[Proton] = theProtonTransmissionRadius;
00101     transmissionRadius[PiPlus] = theNuclearRadius;
00102     transmissionRadius[PiMinus] = theNuclearRadius;
00103     transmissionRadius[DeltaPlusPlus] = theProtonTransmissionRadius;
00104     transmissionRadius[DeltaPlus] = theProtonTransmissionRadius;
00105     transmissionRadius[DeltaMinus] = theProtonTransmissionRadius;
00106     transmissionRadius[Composite] = theNuclearRadius;
00107     // transmission radii for neutral particles intentionally left uninitialised
00108   }
00109 
00110   G4double NuclearDensity::getMaxRFromP(G4double p) const {
00111     return (*rFromP)(p);
00112   }
00113 
00114   G4double NuclearDensity::getMaxTFromR(G4double r) const {
00115     return (*tFromR)(r);
00116   }
00117 
00118 }

Generated on Mon May 27 17:48:36 2013 for Geant4 by  doxygen 1.4.7