G4InuclEvaporation.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 // $Id$
00027 //
00028 // 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
00029 // 20100405  M. Kelsey -- Pass const-ref std::vector<>
00030 // 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide(), use
00031 //              const_iterator.
00032 // 20100428  M. Kelsey -- Use G4InuclParticleNames enum
00033 // 20100429  M. Kelsey -- Change "case gamma:" to "case photon:"
00034 // 20100517  M. Kelsey -- Follow new ctors for G4*Collider family.  Make
00035 //              G4EvaporationInuclCollider a data member.
00036 // 20100520  M. Kelsey -- Simplify collision loop, move momentum rotations to
00037 //              G4CollisionOutput, copy G4DynamicParticle directly from
00038 //              G4InuclParticle, no switch-block required.  Fix scaling factors.
00039 // 20100914  M. Kelsey -- Migrate to integer A and Z
00040 // 20100924  M. Kelsey -- Migrate to "OutgoingNuclei" names in CollisionOutput 
00041 // 20110728  M. Kelsey -- Fix Coverity #28776, remove return after throw.
00042 // 20120608  M. Kelsey -- Fix variable-name "shadowing" compiler warnings.
00043 
00044 #include <numeric>
00045 
00046 #include "G4InuclEvaporation.hh"
00047 #include "globals.hh"
00048 #include "G4SystemOfUnits.hh"
00049 #include "G4IonTable.hh"
00050 #include "G4V3DNucleus.hh"
00051 #include "G4DynamicParticleVector.hh"
00052 #include "G4EvaporationInuclCollider.hh"
00053 #include "G4InuclNuclei.hh"
00054 #include "G4Track.hh"
00055 #include "G4Nucleus.hh"
00056 #include "G4Nucleon.hh"
00057 #include "G4NucleiModel.hh"
00058 #include "G4HadronicException.hh"
00059 #include "G4LorentzVector.hh"
00060 #include "G4EquilibriumEvaporator.hh"
00061 #include "G4InuclElementaryParticle.hh"
00062 #include "G4InuclParticle.hh"
00063 #include "G4CollisionOutput.hh"
00064 #include "G4InuclParticleNames.hh"
00065 
00066 using namespace G4InuclParticleNames;
00067 
00068 typedef std::vector<G4InuclElementaryParticle>::const_iterator particleIterator;
00069 typedef std::vector<G4InuclNuclei>::const_iterator nucleiIterator;
00070 
00071 
00072 G4InuclEvaporation::G4InuclEvaporation() 
00073   : verboseLevel(0),   evaporator(new G4EvaporationInuclCollider) {}
00074 
00075 G4InuclEvaporation::G4InuclEvaporation(const G4InuclEvaporation &) : G4VEvaporation() {
00076   throw G4HadronicException(__FILE__, __LINE__, "G4InuclEvaporation::copy_constructor meant to not be accessable.");
00077 }
00078 
00079 G4InuclEvaporation::~G4InuclEvaporation() {
00080   delete evaporator;
00081 }
00082 
00083 const G4InuclEvaporation & G4InuclEvaporation::operator=(const G4InuclEvaporation &) {
00084   throw G4HadronicException(__FILE__, __LINE__, "G4InuclEvaporation::operator= meant to not be accessable.");
00085 }
00086 
00087 
00088 G4bool G4InuclEvaporation::operator==(const G4InuclEvaporation &) const {
00089   return false;
00090 }
00091 
00092 G4bool G4InuclEvaporation::operator!=(const G4InuclEvaporation &) const {
00093   return true;
00094 }
00095 
00096 void G4InuclEvaporation::setVerboseLevel( const G4int verbose ) {
00097   verboseLevel = verbose;
00098 }
00099 
00100 G4FragmentVector* G4InuclEvaporation::BreakItUp(const G4Fragment &theNucleus) {
00101   G4FragmentVector* theResult = new G4FragmentVector;
00102 
00103   if (theNucleus.GetExcitationEnergy() <= 0.0) { // Check that Excitation Energy > 0
00104     theResult->push_back(new G4Fragment(theNucleus));
00105     return theResult;
00106   }
00107 
00108   G4int A = theNucleus.GetA_asInt();
00109   G4int Z = theNucleus.GetZ_asInt();
00110   G4double mTar  = G4NucleiProperties::GetNuclearMass(A, Z); // Mass of the target nucleus
00111 
00112   G4ThreeVector momentum =  theNucleus.GetMomentum().vect();
00113   G4double exitationE = theNucleus.GetExcitationEnergy();
00114 
00115   G4double mass = mTar;
00116   G4ThreeVector boostToLab( momentum/mass ); 
00117 
00118   if ( verboseLevel > 2 )
00119     G4cout << " G4InuclEvaporation : initial kinematics : boostToLab vector = " << boostToLab << G4endl
00120            << "                     excitation energy  : " << exitationE << G4endl;
00121 
00122   if (verboseLevel > 2) {
00123     G4cout << "G4InuclEvaporation::BreakItUp >>> A: " << A << " Z: " << Z
00124            << " exitation E: " << exitationE << " mass: " << mTar/GeV << " GeV"
00125            << G4endl;
00126   };
00127 
00128   G4InuclNuclei* nucleus = new G4InuclNuclei(A, Z);
00129   nucleus->setExitationEnergy(exitationE);
00130 
00131   G4CollisionOutput output;
00132   evaporator->collide(0, nucleus, output);
00133 
00134   const std::vector<G4InuclNuclei>& outgoingNuclei = output.getOutgoingNuclei();
00135   const std::vector<G4InuclElementaryParticle>& particles = output.getOutgoingParticles();
00136 
00137   G4double eTot=0.0;
00138   G4int  i=1;
00139 
00140   if (!particles.empty()) { 
00141     G4int outgoingType;
00142     particleIterator ipart = particles.begin();
00143     for (; ipart != particles.end(); ipart++) {
00144       outgoingType = ipart->type();
00145 
00146       if (verboseLevel > 2) {
00147         G4cout << "Evaporated particle:  " << i << " of type: "
00148                << outgoingType << G4endl;
00149         i++;
00150       }
00151 
00152       eTot += ipart->getEnergy();
00153       
00154       G4LorentzVector vlab = ipart->getMomentum().boost(boostToLab);
00155 
00156       theResult->push_back( new G4Fragment(vlab, ipart->getDefinition()) );
00157     }  
00158   }
00159 
00160   //  G4cout << "# fragments " << output.getOutgoingNuclei().size() << G4endl;
00161   if (!outgoingNuclei.empty()) { 
00162     nucleiIterator ifrag = outgoingNuclei.begin();
00163     for (i=1; ifrag != outgoingNuclei.end(); ifrag++) {
00164       if (verboseLevel > 2) {
00165         G4cout << " Nuclei fragment: " << i << G4endl; i++;
00166       }
00167 
00168       eTot += ifrag->getEnergy();
00169 
00170       G4LorentzVector vlab = ifrag->getMomentum().boost(boostToLab);
00171  
00172       G4int fragA = ifrag->getA();
00173       G4int fragZ = ifrag->getZ();
00174       if (verboseLevel > 2) {
00175         G4cout << "boosted v" << vlab << G4endl;
00176       }
00177       theResult->push_back( new G4Fragment(fragA, fragZ, vlab) ); 
00178     }
00179   }
00180 
00181   //G4cout << ">>>> G4InuclEvaporation::BreakItUp end " << G4endl;
00182   return theResult;
00183 }

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