Import Geant4 9.5.0 source tree
This commit is contained in:
+284
@@ -0,0 +1,284 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 10 Oct 2011 M.Karamitros created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4MolecularConfiguration.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// G4MolecularConfigurationManager
|
||||
G4MolecularConfiguration::G4MolecularConfigurationManager* G4MolecularConfiguration::fgManager = 0 ;
|
||||
|
||||
G4MolecularConfiguration::G4MolecularConfigurationManager*
|
||||
G4MolecularConfiguration::GetManager()
|
||||
{
|
||||
if(!fgManager)
|
||||
{
|
||||
fgManager = new G4MolecularConfiguration::G4MolecularConfigurationManager;
|
||||
}
|
||||
|
||||
return fgManager;
|
||||
}
|
||||
|
||||
G4MolecularConfiguration::G4MolecularConfigurationManager::~G4MolecularConfigurationManager()
|
||||
{
|
||||
G4MolecularConfigurationManager::MolecularConfigurationTable::iterator it1;
|
||||
std::map<const G4ElectronOccupancy, G4MolecularConfiguration*, comparator>::iterator it2;
|
||||
|
||||
for(it1 = fTable.begin() ; it1 != fTable.end() ; it1++)
|
||||
{
|
||||
for(it2=it1->second.begin(); it2!=it1->second.end(); it2++)
|
||||
{
|
||||
if(it2->second)
|
||||
{
|
||||
delete it2->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// Static method in G4MolecularConfiguration
|
||||
G4MolecularConfiguration* G4MolecularConfiguration::GetMolecularConfiguration(const G4MoleculeDefinition* molDef)
|
||||
{
|
||||
const G4ElectronOccupancy& elecOcc = *molDef->GetGroundStateElectronOccupancy();
|
||||
if(GetManager()->fTable[molDef][elecOcc])
|
||||
{
|
||||
return GetManager()->fTable[molDef][elecOcc];
|
||||
}
|
||||
else
|
||||
{
|
||||
G4MolecularConfiguration* newConf = new G4MolecularConfiguration(molDef, elecOcc);
|
||||
return newConf ;
|
||||
}
|
||||
}
|
||||
|
||||
G4MolecularConfiguration* G4MolecularConfiguration::GetMolecularConfiguration(const G4MoleculeDefinition* molDef,
|
||||
const G4ElectronOccupancy& elecOcc )
|
||||
{
|
||||
if(GetManager()->fTable[molDef][elecOcc])
|
||||
{
|
||||
return GetManager()->fTable[molDef][elecOcc];
|
||||
}
|
||||
else
|
||||
{
|
||||
G4MolecularConfiguration* newConf = new G4MolecularConfiguration(molDef, elecOcc);
|
||||
return newConf ;
|
||||
}
|
||||
}
|
||||
|
||||
void G4MolecularConfiguration::DeleteManager()
|
||||
{
|
||||
if(fgManager) delete fgManager;
|
||||
fgManager = 0;
|
||||
}
|
||||
|
||||
//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// G4MolecularConfiguration
|
||||
G4MolecularConfiguration::G4MolecularConfiguration(const G4MoleculeDefinition* moleculeDef,
|
||||
const G4ElectronOccupancy& elecOcc)
|
||||
{
|
||||
fMoleculeDefinition = moleculeDef ;
|
||||
fgManager->fTable[fMoleculeDefinition][elecOcc] = this;
|
||||
std::map<const G4ElectronOccupancy, G4MolecularConfiguration*, comparator>::iterator it ;
|
||||
it = fgManager->fTable[moleculeDef].find(elecOcc);
|
||||
fElectronOccupancy = &(it->first);
|
||||
|
||||
fDynCharge = fMoleculeDefinition->GetNbElectrons()-fElectronOccupancy->GetTotalOccupancy();
|
||||
fDynMass = fMoleculeDefinition->GetMass() ;
|
||||
|
||||
fDynDiffusionCoefficient = fMoleculeDefinition->GetDiffusionCoefficient() ;
|
||||
fDynVanDerVaalsRadius = fMoleculeDefinition->GetVanDerVaalsRadius() ;
|
||||
fDynDecayTime = fMoleculeDefinition->GetDecayTime() ;
|
||||
}
|
||||
|
||||
G4MolecularConfiguration::~G4MolecularConfiguration()
|
||||
{
|
||||
if(fElectronOccupancy)
|
||||
{
|
||||
delete fElectronOccupancy;
|
||||
fElectronOccupancy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
G4MolecularConfiguration* G4MolecularConfiguration::ChangeConfiguration(const G4ElectronOccupancy& newElectronOccupancy)
|
||||
{
|
||||
G4MolecularConfiguration* output = fgManager->fTable[fMoleculeDefinition][newElectronOccupancy] ;
|
||||
if(! output)
|
||||
{
|
||||
output = new G4MolecularConfiguration(fMoleculeDefinition, newElectronOccupancy);
|
||||
}
|
||||
return output ;
|
||||
}
|
||||
|
||||
G4MolecularConfiguration& G4MolecularConfiguration::operator=(G4MolecularConfiguration& right)
|
||||
{
|
||||
if (&right==this) return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/** Method used in Geant4-DNA to excite water molecules
|
||||
*/
|
||||
G4MolecularConfiguration* G4MolecularConfiguration::ExciteMolecule(G4int ExcitedLevel)
|
||||
{
|
||||
G4ElectronOccupancy newElectronOccupancy (*fElectronOccupancy);
|
||||
|
||||
newElectronOccupancy.RemoveElectron(ExcitedLevel,1);
|
||||
newElectronOccupancy.AddElectron(5,1);
|
||||
|
||||
return ChangeConfiguration(newElectronOccupancy);
|
||||
}
|
||||
|
||||
/** Method used in Geant4-DNA to ionize water molecules
|
||||
*/
|
||||
G4MolecularConfiguration* G4MolecularConfiguration::IonizeMolecule(G4int IonizedLevel)
|
||||
{
|
||||
G4ElectronOccupancy newElectronOccupancy(*fElectronOccupancy);
|
||||
|
||||
if(newElectronOccupancy.GetOccupancy(IonizedLevel) != 0)
|
||||
{
|
||||
newElectronOccupancy.RemoveElectron(IonizedLevel,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String errMsg = "There is no electron on the orbit " + G4UIcommand::ConvertToString(IonizedLevel) +
|
||||
" you want to free. The molecule's name you want to ionized is "+ GetName();
|
||||
G4Exception("G4Molecule::IonizeMolecule","",FatalErrorInArgument, errMsg);
|
||||
PrintState();
|
||||
}
|
||||
|
||||
// PrintState();
|
||||
|
||||
return ChangeConfiguration(newElectronOccupancy);
|
||||
}
|
||||
|
||||
G4MolecularConfiguration* G4MolecularConfiguration::AddElectron(G4int orbit, G4int number)
|
||||
{
|
||||
G4ElectronOccupancy newElectronOccupancy(*fElectronOccupancy);
|
||||
newElectronOccupancy.AddElectron(orbit, number);
|
||||
return ChangeConfiguration(newElectronOccupancy);
|
||||
}
|
||||
|
||||
G4MolecularConfiguration* G4MolecularConfiguration::RemoveElectron(G4int orbit,G4int number)
|
||||
{
|
||||
G4ElectronOccupancy newElectronOccupancy (*fElectronOccupancy);
|
||||
|
||||
if(newElectronOccupancy.GetOccupancy(orbit) != 0)
|
||||
{
|
||||
newElectronOccupancy.RemoveElectron(orbit, number );
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String errMsg = "There is already no electron into the orbit " + G4UIcommand::ConvertToString(orbit) +
|
||||
" you want to free. The molecule's name is "+ GetName();
|
||||
G4Exception("G4Molecule::RemoveElectron","",JustWarning, errMsg);
|
||||
PrintState();
|
||||
}
|
||||
|
||||
return ChangeConfiguration(newElectronOccupancy);
|
||||
}
|
||||
|
||||
G4MolecularConfiguration* G4MolecularConfiguration::MoveOneElectron(G4int orbitToFree,G4int orbitToFill)
|
||||
{
|
||||
G4ElectronOccupancy newElectronOccupancy (*fElectronOccupancy);
|
||||
|
||||
if(newElectronOccupancy . GetOccupancy(orbitToFree)>=1)
|
||||
{
|
||||
newElectronOccupancy . RemoveElectron(orbitToFree,1);
|
||||
newElectronOccupancy . AddElectron(orbitToFill,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String errMsg = "There is no electron on the orbit " + G4UIcommand::ConvertToString(orbitToFree) +
|
||||
" you want to free. The molecule's name is "+ GetName();
|
||||
G4Exception("G4Molecule::MoveOneElectron","",FatalErrorInArgument, errMsg);
|
||||
PrintState();
|
||||
}
|
||||
|
||||
return ChangeConfiguration(newElectronOccupancy);
|
||||
}
|
||||
|
||||
const G4String& G4MolecularConfiguration::GetName() const
|
||||
{
|
||||
if(fName.isNull())
|
||||
{
|
||||
fName = fMoleculeDefinition->GetName();
|
||||
fName+= "^";
|
||||
fName+= G4UIcommand::ConvertToString(fDynCharge);
|
||||
}
|
||||
return fName;
|
||||
}
|
||||
|
||||
G4int G4MolecularConfiguration::GetAtomsNumber() const
|
||||
{
|
||||
return fMoleculeDefinition->GetAtomsNumber();
|
||||
}
|
||||
|
||||
G4double G4MolecularConfiguration::GetNbElectrons() const
|
||||
{
|
||||
return fElectronOccupancy->GetTotalOccupancy();
|
||||
}
|
||||
|
||||
void G4MolecularConfiguration::PrintState() const
|
||||
{
|
||||
G4cout<<"--------------Print electronic state of "<<GetName()<<"---------------"<<G4endl;
|
||||
fElectronOccupancy->DumpInfo();
|
||||
if(fElectronOccupancy==fMoleculeDefinition->GetGroundStateElectronOccupancy())
|
||||
{
|
||||
G4cout<<"At ground state"<<G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fMoleculeDefinition->GetDecayTable())
|
||||
G4cout<<"Transition :"<<(fMoleculeDefinition->GetDecayTable())->GetExcitedState(fElectronOccupancy)<<G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
// added - to be transformed in a "Decay method"
|
||||
const vector <const G4MolecularDecayChannel*>* G4MolecularConfiguration::GetDecayChannel() const
|
||||
{
|
||||
return fMoleculeDefinition-> GetDecayChannels(fElectronOccupancy);
|
||||
}
|
||||
|
||||
G4int G4MolecularConfiguration::GetMoleculeID() const
|
||||
{
|
||||
if(fMoleculeDefinition)
|
||||
return fMoleculeDefinition->GetPDGEncoding();
|
||||
else
|
||||
G4Exception("G4Molecule::GetMoleculeID","",FatalErrorInArgument, "You should first enter a molecule defintion");
|
||||
|
||||
return INT_MAX;
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// History: first implementation by Alfonso Mantero 4 Mar 2009
|
||||
//
|
||||
// **********************************************************************
|
||||
|
||||
#include "G4MolecularDecayChannel.hh"
|
||||
#include "G4Molecule.hh"
|
||||
#include "G4MoleculeHandleManager.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// ######################################################################
|
||||
// ### MolecularDecayChannel ###
|
||||
// ######################################################################
|
||||
|
||||
struct CompMoleculePointer
|
||||
{
|
||||
bool operator()(const G4Molecule* mol1, const G4Molecule* mol2) const
|
||||
{
|
||||
return (*mol1) < (*mol2);
|
||||
}
|
||||
};
|
||||
|
||||
G4MolecularDecayChannel::G4MolecularDecayChannel(G4String aName) : fName(aName)
|
||||
{
|
||||
//pointer
|
||||
fProductsVector = 0;
|
||||
//double
|
||||
fDecayTime = 0;
|
||||
fProbability = 0;
|
||||
fReleasedEnergy = 0;
|
||||
fRMSMotherMoleculeDisplacement = 0;
|
||||
fDisplacementType = 0; // meaning no displacement cf G4VMolecularDisplacer
|
||||
}
|
||||
|
||||
G4MolecularDecayChannel::G4MolecularDecayChannel()
|
||||
{
|
||||
// pointer
|
||||
fProductsVector = 0;
|
||||
// double
|
||||
fReleasedEnergy = 0;
|
||||
fDecayTime = 0;
|
||||
fProbability = 0;
|
||||
fRMSMotherMoleculeDisplacement = 0;
|
||||
fDisplacementType = 0; // meaning no displacement cf G4VMolecularDisplacer
|
||||
}
|
||||
|
||||
G4MolecularDecayChannel::~G4MolecularDecayChannel()
|
||||
{
|
||||
if(fProductsVector)
|
||||
{
|
||||
fProductsVector->clear();
|
||||
delete fProductsVector;
|
||||
}
|
||||
}
|
||||
|
||||
G4MolecularDecayChannel::G4MolecularDecayChannel(const G4MolecularDecayChannel& right)
|
||||
{
|
||||
// String
|
||||
fName = right.fName;
|
||||
//displacement type
|
||||
fDisplacementType = right.fDisplacementType;
|
||||
// pointers
|
||||
if(right.fProductsVector)
|
||||
fProductsVector = new vector<G4MoleculeHandle>(*(right.fProductsVector) );
|
||||
else
|
||||
fProductsVector = 0 ;
|
||||
|
||||
// double
|
||||
fReleasedEnergy = right.fReleasedEnergy;
|
||||
fDecayTime = right.fDecayTime;
|
||||
fProbability = right.fProbability;
|
||||
// vector
|
||||
fRMSMotherMoleculeDisplacement = right.fRMSMotherMoleculeDisplacement;
|
||||
fRMSProductsDisplacementVector = right.fRMSProductsDisplacementVector;
|
||||
}
|
||||
|
||||
G4MolecularDecayChannel& G4MolecularDecayChannel::operator=
|
||||
(const G4MolecularDecayChannel& right)
|
||||
{
|
||||
if(this == &right) return *this; // hendle self assignement
|
||||
|
||||
// string
|
||||
fName = right.fName;
|
||||
//displacement type
|
||||
fDisplacementType = right.fDisplacementType;
|
||||
// pointer
|
||||
if(right.fProductsVector)
|
||||
{
|
||||
fProductsVector = new vector<G4MoleculeHandle>(*(right.fProductsVector));
|
||||
}
|
||||
else fProductsVector = 0;
|
||||
|
||||
// double
|
||||
fReleasedEnergy = right.fReleasedEnergy;
|
||||
fDecayTime = right.fDecayTime;
|
||||
fProbability = right.fProbability;
|
||||
// vector
|
||||
fRMSMotherMoleculeDisplacement = right.fRMSMotherMoleculeDisplacement;
|
||||
fRMSProductsDisplacementVector = right.fRMSProductsDisplacementVector;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void G4MolecularDecayChannel::AddProduct(const G4Molecule* molecule, G4double displacement)
|
||||
{
|
||||
if(!fProductsVector) fProductsVector = new vector<G4MoleculeHandle> ;
|
||||
|
||||
G4MoleculeHandle molHandle(G4MoleculeHandleManager::Instance()->GetMoleculeHandle(molecule));
|
||||
fProductsVector->push_back(molHandle);
|
||||
fRMSProductsDisplacementVector.push_back(displacement);
|
||||
}
|
||||
|
||||
G4int G4MolecularDecayChannel::GetNbProducts() const
|
||||
{
|
||||
if(fProductsVector)
|
||||
return fProductsVector->size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const G4Molecule* G4MolecularDecayChannel::GetProduct(int index) const
|
||||
{
|
||||
if(fProductsVector)
|
||||
return ((*fProductsVector)[index]).get();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
G4double G4MolecularDecayChannel::GetRMSRadialDisplacementOfProduct(const G4Molecule* product)
|
||||
{
|
||||
if(!fProductsVector) return -1.;
|
||||
|
||||
G4int sz = fProductsVector->size();
|
||||
G4double value = DBL_MAX;
|
||||
for (G4int i=0; i<sz ; i++)
|
||||
{
|
||||
if(*product != *((*fProductsVector)[i]).get())
|
||||
{
|
||||
value = fRMSProductsDisplacementVector[i];
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// WARNING : This class is released as a prototype.
|
||||
// It might strongly evolve or even disapear in the next releases.
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// History: first implementation by Alfonso Mantero 4 Mar 2009
|
||||
//
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
#include "G4MolecularDecayTable.hh"
|
||||
#include "G4MolecularDecayChannel.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
G4MolecularDecayTable::G4MolecularDecayTable()
|
||||
{;}
|
||||
|
||||
G4MolecularDecayTable::~G4MolecularDecayTable()
|
||||
{
|
||||
channelsMap::iterator it_map = fDecayChannelsMap.begin();
|
||||
|
||||
for(;it_map != fDecayChannelsMap.end() ; it_map++)
|
||||
{
|
||||
vector<const G4MolecularDecayChannel*>& decayChannels = it_map->second;
|
||||
if(!decayChannels.empty())
|
||||
{
|
||||
for(int i = 0 ; i < (int) decayChannels.size() ; i++)
|
||||
{
|
||||
if(decayChannels [i])
|
||||
{
|
||||
delete decayChannels[i];
|
||||
decayChannels[i] = 0;
|
||||
}
|
||||
}
|
||||
decayChannels.clear();
|
||||
}
|
||||
}
|
||||
fDecayChannelsMap.clear();
|
||||
}
|
||||
|
||||
G4MolecularDecayTable::G4MolecularDecayTable(const G4MolecularDecayTable& right)
|
||||
{
|
||||
*this = right;
|
||||
}
|
||||
|
||||
G4MolecularDecayTable& G4MolecularDecayTable::operator=(const G4MolecularDecayTable& aMolecularDecayTable)
|
||||
{
|
||||
fExcitedStatesMap = aMolecularDecayTable.fExcitedStatesMap;
|
||||
fDecayChannelsMap = channelsMap(aMolecularDecayTable.GetDecayChannelsMap());
|
||||
return *this;
|
||||
}
|
||||
|
||||
const vector<const G4MolecularDecayChannel*>* G4MolecularDecayTable::GetDecayChannels(const G4ElectronOccupancy* conf) const
|
||||
{
|
||||
statesMap::const_iterator it_exstates = fExcitedStatesMap.find(*conf);
|
||||
if(it_exstates == fExcitedStatesMap.end()) return 0;
|
||||
channelsMap::const_iterator it_decchannel = fDecayChannelsMap.find(it_exstates->second) ;
|
||||
if(it_decchannel == fDecayChannelsMap.end()) return 0;
|
||||
return &(it_decchannel->second);
|
||||
}
|
||||
|
||||
const vector<const G4MolecularDecayChannel*>* G4MolecularDecayTable::GetDecayChannels(const G4String& exState) const
|
||||
{
|
||||
channelsMap::const_iterator it_decchannel = fDecayChannelsMap.find(exState);
|
||||
if(it_decchannel == fDecayChannelsMap.end()) return 0;
|
||||
return &(it_decchannel->second);
|
||||
}
|
||||
|
||||
const G4String& G4MolecularDecayTable::GetExcitedState(const G4ElectronOccupancy* conf) const
|
||||
{
|
||||
statesMap::const_iterator it_exstates = fExcitedStatesMap.find(*conf);
|
||||
if(it_exstates != fExcitedStatesMap.end())
|
||||
{
|
||||
return it_exstates->second;
|
||||
}
|
||||
|
||||
G4String errMsg = "Excited state not found";
|
||||
G4Exception("G4MolecularDecayTable::GetExcitedState(const G4ElectronOccupancy*)",
|
||||
"G4MolecularDecayTable001",FatalErrorInArgument, errMsg);
|
||||
return it_exstates->second; // fake return statement
|
||||
}
|
||||
|
||||
const G4ElectronOccupancy& G4MolecularDecayTable::GetElectronOccupancy(const G4String& exState) const
|
||||
{
|
||||
statesMap::const_iterator statesIter;
|
||||
const G4ElectronOccupancy* conf(0);
|
||||
for (statesIter=fExcitedStatesMap.begin(); statesIter!=fExcitedStatesMap.end(); statesIter++ )
|
||||
{
|
||||
if(exState == statesIter->second) conf = &(statesIter->first);
|
||||
}
|
||||
|
||||
if(statesIter == fExcitedStatesMap.end())
|
||||
{
|
||||
G4String errMsg = "Excited state" + exState + " not found";
|
||||
G4Exception("G4MolecularDecayTable::GetElectronOccupancy(const G4String&)",
|
||||
"G4MolecularDecayTable002",FatalErrorInArgument, errMsg);
|
||||
}
|
||||
return *conf;
|
||||
}
|
||||
|
||||
void G4MolecularDecayTable::AddExcitedState(const G4String& label)
|
||||
{
|
||||
channelsMap::iterator channelsIter = fDecayChannelsMap.find(label);
|
||||
if(channelsIter != fDecayChannelsMap.end())
|
||||
{
|
||||
G4String errMsg = "Excited state" + label + " already registered in the decay table.";
|
||||
G4Exception("G4MolecularDecayTable::AddExcitedState",
|
||||
"G4MolecularDecayTable003",FatalErrorInArgument, errMsg);
|
||||
}
|
||||
fDecayChannelsMap[label] ;
|
||||
}
|
||||
|
||||
void G4MolecularDecayTable::AddeConfToExcitedState(const G4String& label, const G4ElectronOccupancy& conf)
|
||||
{
|
||||
statesMap::iterator statesIter = fExcitedStatesMap.find(conf);
|
||||
|
||||
if (statesIter == fExcitedStatesMap.end())
|
||||
{
|
||||
fExcitedStatesMap[conf] = label;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4MolecularDecayTable::AddExcitedState","G4MolecularDecayTable004",
|
||||
FatalErrorInArgument,"Electronic configuration already registered in the decay table");
|
||||
}
|
||||
}
|
||||
|
||||
void G4MolecularDecayTable::AddDecayChannel(const G4String& label, const G4MolecularDecayChannel* channel)
|
||||
{
|
||||
fDecayChannelsMap[label].push_back(channel);
|
||||
}
|
||||
|
||||
void G4MolecularDecayTable::CheckDataConsistency()
|
||||
{
|
||||
channelsMap::iterator channelsIter;
|
||||
|
||||
//Let's check probabilities
|
||||
|
||||
for (channelsIter=fDecayChannelsMap.begin(); channelsIter!=fDecayChannelsMap.end(); channelsIter++ )
|
||||
{
|
||||
|
||||
vector<const G4MolecularDecayChannel*>& decayVect = channelsIter->second;
|
||||
G4double sum=0;
|
||||
|
||||
G4double max = decayVect.size();
|
||||
|
||||
for (size_t i=0; i<max; i++)
|
||||
{
|
||||
const G4MolecularDecayChannel* decay = decayVect[i];
|
||||
const G4double prob = decay->GetProbability();
|
||||
sum += prob;
|
||||
}
|
||||
|
||||
if (sum != 1)
|
||||
{
|
||||
G4String errMsg = "Deexcitation Channels probabilities in " + channelsIter->first
|
||||
+ "excited state don't sum up to 1";
|
||||
G4Exception("G4MolecularDecayTable::CheckDataConsistency",
|
||||
"G4MolecularDecayTable005",FatalErrorInArgument, errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+396
@@ -0,0 +1,396 @@
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// History: first implementation, based on G4DynamicParticle
|
||||
// New dependency : G4VUserTrackInformation
|
||||
//
|
||||
// ---------------- G4Molecule ----------------
|
||||
// first design&implementation by Alfonso Mantero, 7 Apr 2009
|
||||
// New developments Alfonso Mantero & Mathieu Karamitros
|
||||
// Oct/Nov 2009 Class Name changed to G4Molecule
|
||||
// Removed dependency from G4DynamicParticle
|
||||
// New constructors :
|
||||
// copy constructor
|
||||
// direct ionized/excited molecule
|
||||
// New methods :
|
||||
// Get : name,atoms' number,nb electrons,decayChannel
|
||||
// PrintState //To get the electronic level and the
|
||||
// corresponding name of the excitation
|
||||
// Kinematic :
|
||||
// BuildTrack,GetKineticEnergy,GetDiffusionVelocity
|
||||
// Change the way dynCharge and eNb is calculated
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#include "G4Molecule.hh"
|
||||
#include "G4MolecularConfiguration.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
double G4Molecule::fgTemperature = 310*kelvin;
|
||||
// 37°C, used to shoot an energy
|
||||
|
||||
ITImp(G4Molecule)
|
||||
|
||||
G4Allocator<G4Molecule> aMoleculeAllocator;
|
||||
|
||||
G4Molecule* GetMolecule(const G4Track& track)
|
||||
{
|
||||
return (G4Molecule*)(GetIT(track));
|
||||
}
|
||||
|
||||
G4Molecule* GetMolecule(const G4Track* track)
|
||||
{
|
||||
return (G4Molecule*)(GetIT(track));
|
||||
}
|
||||
|
||||
void G4Molecule::Print() const
|
||||
{
|
||||
G4cout<<"The user track information is a molecule"<<G4endl;
|
||||
}
|
||||
|
||||
G4Molecule::G4Molecule(const G4Molecule& right) :
|
||||
G4VUserTrackInformation("G4Molecule"), G4IT(right)
|
||||
{
|
||||
Init();
|
||||
fMolecularConfiguration = right . fMolecularConfiguration;
|
||||
}
|
||||
|
||||
G4Molecule& G4Molecule::operator=(const G4Molecule& right)
|
||||
{
|
||||
if (&right==this) return *this;
|
||||
Init();
|
||||
fMolecularConfiguration = right . fMolecularConfiguration;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4bool G4Molecule::operator==(const G4Molecule& right) const
|
||||
{
|
||||
if(fMolecularConfiguration==right.fMolecularConfiguration)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
G4bool G4Molecule::operator!=(const G4Molecule& right) const
|
||||
{
|
||||
return !(*this == right);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// The two methods below are the most called of the simulation :
|
||||
/// compare molecules in the MoleculeStackManager or in
|
||||
/// the InteractionTable
|
||||
|
||||
G4bool G4Molecule::operator<(const G4Molecule& right) const
|
||||
{
|
||||
return fMolecularConfiguration < right.fMolecularConfiguration ;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
void G4Molecule::Init()
|
||||
{
|
||||
fMolecularConfiguration = 0 ;
|
||||
fDynamicParticle = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/** Default molecule builder
|
||||
*/
|
||||
//////////////////////////
|
||||
G4Molecule::G4Molecule() : G4VUserTrackInformation("G4Molecule"), G4IT()
|
||||
//////////////////////////
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
G4Molecule::~G4Molecule()
|
||||
//////////////////////////
|
||||
{
|
||||
if(fTrack!=NULL)
|
||||
{
|
||||
fTrack = 0;
|
||||
}
|
||||
fMolecularConfiguration = 0;
|
||||
fDynamicParticle = 0;
|
||||
// DEBUG
|
||||
// G4cout<<"Molecule killed"<<G4endl;
|
||||
}
|
||||
|
||||
/** Build a molecule at ground state according to a given
|
||||
* G4MoleculeDefinition that can be obtained from G4GenericMoleculeManager
|
||||
*/
|
||||
//////////////////////////
|
||||
G4Molecule::G4Molecule(G4MoleculeDefinition * moleculeDefinition) :
|
||||
G4VUserTrackInformation("G4Molecule"), G4IT()
|
||||
//////////////////////////
|
||||
{
|
||||
Init();
|
||||
fMolecularConfiguration = G4MolecularConfiguration::GetMolecularConfiguration(moleculeDefinition);
|
||||
}
|
||||
|
||||
/** Build a molecule at a specific excitation/ionisation state according
|
||||
* to a ground state that can be obtained from G4GenericMoleculeManager.
|
||||
* Put 0 in the second option if this is a ionisation.
|
||||
*/
|
||||
//////////////////////////
|
||||
G4Molecule::G4Molecule(G4MoleculeDefinition * moleculeDefinition, G4int OrbitalToFree, G4int OrbitalToFill):
|
||||
G4VUserTrackInformation("G4Molecule"), G4IT()
|
||||
//////////////////////////
|
||||
{
|
||||
Init();
|
||||
|
||||
G4ElectronOccupancy dynElectronOccupancy (*moleculeDefinition->GetGroundStateElectronOccupancy());
|
||||
|
||||
if (OrbitalToFill != 0)
|
||||
{
|
||||
dynElectronOccupancy.RemoveElectron(OrbitalToFree-1,1);
|
||||
dynElectronOccupancy.AddElectron(OrbitalToFill-1,1);
|
||||
// dynElectronOccupancy.DumpInfo(); // DEBUG
|
||||
}
|
||||
|
||||
if (OrbitalToFill == 0)
|
||||
{
|
||||
dynElectronOccupancy.RemoveElectron(OrbitalToFree-1,1);
|
||||
// dynElectronOccupancy.DumpInfo(); // DEBUG
|
||||
}
|
||||
|
||||
fMolecularConfiguration = G4MolecularConfiguration::GetMolecularConfiguration(moleculeDefinition, dynElectronOccupancy);
|
||||
}
|
||||
|
||||
/** Specific builder for water molecules to be used in Geant4-DNA,
|
||||
* the last option Excitation is true if the molecule is excited, is
|
||||
* false is the molecule is ionized.
|
||||
*/
|
||||
|
||||
G4Molecule::G4Molecule(G4MoleculeDefinition * moleculeDefinition, G4int Level, G4bool Excitation):
|
||||
G4VUserTrackInformation("G4Molecule"), G4IT()
|
||||
{
|
||||
Init();
|
||||
|
||||
G4ElectronOccupancy dynElectronOccupancy (*moleculeDefinition->GetGroundStateElectronOccupancy());
|
||||
|
||||
if (Excitation == true)
|
||||
{
|
||||
dynElectronOccupancy.RemoveElectron(Level,1);
|
||||
dynElectronOccupancy.AddElectron(5,1);
|
||||
// dynElectronOccupancy.DumpInfo(); // DEBUG
|
||||
}
|
||||
|
||||
if (Excitation == false)
|
||||
{
|
||||
dynElectronOccupancy.RemoveElectron(Level,1);
|
||||
// dynElectronOccupancy.DumpInfo(); // DEBUG
|
||||
}
|
||||
|
||||
fMolecularConfiguration = G4MolecularConfiguration::GetMolecularConfiguration(moleculeDefinition, dynElectronOccupancy);
|
||||
}
|
||||
|
||||
void G4Molecule::SetElectronOccupancy(const G4ElectronOccupancy* occ)
|
||||
{
|
||||
fMolecularConfiguration = G4MolecularConfiguration::GetMolecularConfiguration(fMolecularConfiguration->GetDefinition(), *occ);
|
||||
}
|
||||
|
||||
/** Method used in Geant4-DNA to excite water molecules
|
||||
*/
|
||||
void G4Molecule::ExciteMolecule(G4int ExcitedLevel)
|
||||
{
|
||||
fMolecularConfiguration = fMolecularConfiguration->ExciteMolecule(ExcitedLevel);
|
||||
}
|
||||
|
||||
/** Method used in Geant4-DNA to ionize water molecules
|
||||
*/
|
||||
void G4Molecule::IonizeMolecule(G4int IonizedLevel)
|
||||
{
|
||||
fMolecularConfiguration = fMolecularConfiguration->IonizeMolecule(IonizedLevel);
|
||||
}
|
||||
|
||||
void G4Molecule::AddElectron(G4int orbit, G4int number)
|
||||
{
|
||||
fMolecularConfiguration = fMolecularConfiguration->AddElectron(orbit,number);
|
||||
}
|
||||
|
||||
void G4Molecule::RemoveElectron(G4int orbit,G4int number)
|
||||
{
|
||||
fMolecularConfiguration = fMolecularConfiguration->RemoveElectron(orbit,number);
|
||||
}
|
||||
|
||||
void G4Molecule::MoveOneElectron(G4int orbitToFree,G4int orbitToFill)
|
||||
{
|
||||
fMolecularConfiguration = fMolecularConfiguration->MoveOneElectron(orbitToFree,orbitToFill);
|
||||
}
|
||||
|
||||
const G4String& G4Molecule::GetName() const
|
||||
{
|
||||
return fMolecularConfiguration->GetName();
|
||||
}
|
||||
|
||||
G4int G4Molecule::GetAtomsNumber() const
|
||||
{
|
||||
return fMolecularConfiguration->GetAtomsNumber();
|
||||
}
|
||||
|
||||
G4double G4Molecule::GetNbElectrons() const
|
||||
{
|
||||
return fMolecularConfiguration->GetNbElectrons();
|
||||
}
|
||||
|
||||
void G4Molecule::PrintState() const
|
||||
{
|
||||
fMolecularConfiguration->PrintState();
|
||||
}
|
||||
|
||||
G4Track * G4Molecule::BuildTrack(G4double globalTime, const G4ThreeVector& Position)
|
||||
{
|
||||
if(fTrack != 0)
|
||||
{
|
||||
G4Exception("G4Molecule::BuildTrack","Molecule001",
|
||||
FatalErrorInArgument,"A track was already assigned to this molecule");
|
||||
}
|
||||
|
||||
// Kinetic Values
|
||||
// Set a random direction to the molecule
|
||||
G4double costheta = (2*G4UniformRand()-1);
|
||||
G4double theta = acos (costheta);
|
||||
G4double phi = 2*pi*G4UniformRand();
|
||||
|
||||
G4double xMomentum = cos(phi)* sin(theta);
|
||||
G4double yMomentum = sin(theta)*sin(phi);
|
||||
G4double zMomentum = costheta;
|
||||
|
||||
G4ThreeVector MomentumDirection(xMomentum, yMomentum, zMomentum);
|
||||
G4double KineticEnergy = GetKineticEnergy();
|
||||
// G4cout << " **** KineticEnergy : " << KineticEnergy << G4endl;
|
||||
fDynamicParticle = new G4DynamicParticle(fMolecularConfiguration->GetDefinition(),
|
||||
MomentumDirection,
|
||||
KineticEnergy);
|
||||
|
||||
//Set the Track
|
||||
fTrack = new G4Track(fDynamicParticle, globalTime, Position);
|
||||
fTrack -> SetUserInformation (this);
|
||||
|
||||
return fTrack;
|
||||
}
|
||||
|
||||
G4double G4Molecule::GetKineticEnergy() const
|
||||
{
|
||||
////
|
||||
// Ideal Gaz case
|
||||
double v = GetDiffusionVelocity();
|
||||
double E = (fMolecularConfiguration->GetMass()/(c_squared))*(v*v)/2.;
|
||||
////
|
||||
return E;
|
||||
}
|
||||
|
||||
G4double G4Molecule::GetDiffusionVelocity() const
|
||||
{
|
||||
double m = fMolecularConfiguration->GetMass()/(c_squared);
|
||||
|
||||
////
|
||||
// Different possibilities
|
||||
////
|
||||
// Ideal Gaz case : Maxwell Boltzmann Distribution
|
||||
// double sigma = k_Boltzmann * fgTemperature / m;
|
||||
// return G4RandGauss::shoot( 0, sigma );
|
||||
////
|
||||
// Ideal Gaz case : mean velocity from equipartition theorem
|
||||
return sqrt(3*k_Boltzmann*fgTemperature/m);
|
||||
////
|
||||
// Using this approximation for liquid is wrong
|
||||
// However the brownian process avoid taking
|
||||
// care of energy consideration and plays only
|
||||
// with positions
|
||||
}
|
||||
|
||||
// added - to be transformed in a "Decay method"
|
||||
const vector <const G4MolecularDecayChannel*>* G4Molecule::GetDecayChannel() const
|
||||
{
|
||||
return fMolecularConfiguration->GetDecayChannel();
|
||||
}
|
||||
|
||||
G4int G4Molecule::GetMoleculeID() const
|
||||
{
|
||||
return fMolecularConfiguration->GetMoleculeID();
|
||||
}
|
||||
|
||||
void G4Molecule::SetDecayTime(G4double dynDecayTime)
|
||||
{
|
||||
fMolecularConfiguration->SetDecayTime(dynDecayTime);
|
||||
}
|
||||
|
||||
G4double G4Molecule::GetDecayTime() const
|
||||
{
|
||||
return fMolecularConfiguration->GetDecayTime();
|
||||
}
|
||||
|
||||
void G4Molecule::SetVanDerVaalsRadius(G4double dynVanDerVaalsRadius)
|
||||
{
|
||||
fMolecularConfiguration->SetVanDerVaalsRadius(dynVanDerVaalsRadius);
|
||||
}
|
||||
|
||||
G4double G4Molecule::GetVanDerVaalsRadius() const
|
||||
{
|
||||
return fMolecularConfiguration->GetVanDerVaalsRadius();
|
||||
}
|
||||
|
||||
G4int G4Molecule::GetCharge() const
|
||||
{
|
||||
return fMolecularConfiguration->GetCharge() ;
|
||||
}
|
||||
|
||||
void G4Molecule::SetMass(G4double aMass)
|
||||
{
|
||||
fMolecularConfiguration->SetMass(aMass);
|
||||
}
|
||||
|
||||
G4double G4Molecule::GetMass() const
|
||||
{
|
||||
return fMolecularConfiguration->GetMass();
|
||||
}
|
||||
|
||||
G4ElectronOccupancy G4Molecule::GetElectronOccupancy() const
|
||||
{
|
||||
return *(fMolecularConfiguration->GetElectronOccupancy());
|
||||
}
|
||||
|
||||
const G4MoleculeDefinition* G4Molecule::GetDefinition() const
|
||||
{
|
||||
return fMolecularConfiguration->GetDefinition();
|
||||
}
|
||||
|
||||
void G4Molecule::SetDiffusionCoefficient(G4double dynDiffusionCoefficient)
|
||||
{
|
||||
fMolecularConfiguration->SetDiffusionCoefficient(dynDiffusionCoefficient);
|
||||
}
|
||||
|
||||
G4double G4Molecule::GetDiffusionCoefficient() const
|
||||
{
|
||||
return fMolecularConfiguration->GetDiffusionCoefficient();
|
||||
}
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// 21 Oct 2009 first implementation by A. Mantero and M.Karamitros
|
||||
// Based on prototype of A.Mantero
|
||||
// **********************************************************************
|
||||
|
||||
|
||||
#include "G4MoleculeDefinition.hh"
|
||||
#include "G4MolecularConfiguration.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// ######################################################################
|
||||
// ### MoleculeDefinition ###
|
||||
// ######################################################################
|
||||
|
||||
G4MoleculeDefinition::G4MoleculeDefinition(const G4String& name,
|
||||
G4double mass,
|
||||
G4int electronsNumber,
|
||||
G4int electronicLevels,
|
||||
G4double diffCoeff,
|
||||
G4int atomsNumber,
|
||||
G4double radius,
|
||||
G4double lifetime,
|
||||
G4String aType ,
|
||||
G4MoleculeID ID
|
||||
):
|
||||
G4ParticleDefinition(name, mass, 0., 0., 0, 0, 0, 0, 0, 0, "Molecule",
|
||||
0, 0, ID, false, lifetime, NULL, false, aType, 0, 0.0),
|
||||
fMass(mass),
|
||||
fNbOfElectrons(electronsNumber), fNbOfMolecularShells(electronicLevels), fDiffusionCoefficient(diffCoeff),
|
||||
fAtomsNb(atomsNumber), fVanDerVaalsRadius(radius)
|
||||
|
||||
{
|
||||
fElectronOccupancy = new G4ElectronOccupancy(fNbOfMolecularShells);
|
||||
fDecayTable = NULL;
|
||||
}
|
||||
//___________________________________________________________________________
|
||||
G4MoleculeDefinition::~G4MoleculeDefinition()
|
||||
{
|
||||
if (fElectronOccupancy)
|
||||
{
|
||||
delete fElectronOccupancy;
|
||||
fElectronOccupancy = 0;
|
||||
}
|
||||
if (fDecayTable)
|
||||
{
|
||||
delete fDecayTable;
|
||||
fDecayTable = 0;
|
||||
}
|
||||
// fMolecularConfiguration = 0;
|
||||
}
|
||||
//___________________________________________________________________________
|
||||
void G4MoleculeDefinition::AddeConfToExcitedState(const G4String& exStId,
|
||||
const G4ElectronOccupancy& conf,
|
||||
double decayTime)
|
||||
{
|
||||
if (!fDecayTable)
|
||||
{
|
||||
fDecayTable = new G4MolecularDecayTable();
|
||||
}
|
||||
fDecayTable->AddeConfToExcitedState(exStId, conf);
|
||||
G4MolecularConfiguration::GetMolecularConfiguration(this,conf)->SetDecayTime(decayTime);
|
||||
}
|
||||
//___________________________________________________________________________
|
||||
void G4MoleculeDefinition::SetLevelOccupation(G4int shell, G4int eNb)
|
||||
{
|
||||
G4int levelOccupancy = fElectronOccupancy->GetOccupancy(shell);
|
||||
|
||||
if (levelOccupancy)
|
||||
{
|
||||
|
||||
fElectronOccupancy->RemoveElectron(shell, levelOccupancy);
|
||||
}
|
||||
|
||||
fElectronOccupancy->AddElectron(shell,eNb);
|
||||
|
||||
}
|
||||
//___________________________________________________________________________
|
||||
void G4MoleculeDefinition::AddExcitedState(const G4String& val)
|
||||
{
|
||||
if (!fDecayTable)
|
||||
{
|
||||
fDecayTable = new G4MolecularDecayTable();
|
||||
}
|
||||
|
||||
fDecayTable->AddExcitedState(val);
|
||||
|
||||
}
|
||||
//___________________________________________________________________________
|
||||
const G4String& G4MoleculeDefinition::GetExcitedState(const G4ElectronOccupancy* occ) const
|
||||
{
|
||||
if (fDecayTable)
|
||||
{
|
||||
return fDecayTable->GetExcitedState(occ);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
|
||||
G4Exception("G4MoleculeDefinition::GetExcitedState","",FatalErrorInArgument,errMsg);
|
||||
}
|
||||
return *(new G4String(""));
|
||||
}
|
||||
//___________________________________________________________________________
|
||||
void G4MoleculeDefinition::AddDecayChannel(const G4String& chanId,
|
||||
const G4MolecularDecayChannel* chan)
|
||||
{
|
||||
if (!fDecayTable)
|
||||
{
|
||||
fDecayTable = new G4MolecularDecayTable();
|
||||
}
|
||||
fDecayTable->AddDecayChannel(chanId, chan);
|
||||
}
|
||||
//___________________________________________________________________________
|
||||
const vector<const G4MolecularDecayChannel*>* G4MoleculeDefinition::GetDecayChannels(const G4String& ExState) const
|
||||
{
|
||||
if (fDecayTable)
|
||||
{
|
||||
const vector<const G4MolecularDecayChannel*>* output = fDecayTable->GetDecayChannels(ExState);
|
||||
return output;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
|
||||
G4Exception("G4MoleculeDefinition::GetDecayChannels","",FatalErrorInArgument,errMsg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//___________________________________________________________________________
|
||||
const vector<const G4MolecularDecayChannel*>* G4MoleculeDefinition::GetDecayChannels(const G4ElectronOccupancy* occ) const
|
||||
{
|
||||
if (fDecayTable)
|
||||
{
|
||||
const vector<const G4MolecularDecayChannel*>* output = fDecayTable->GetDecayChannels(occ);
|
||||
return output;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
|
||||
G4Exception("G4MoleculeDefinition::GetDecayChannels","",FatalErrorInArgument,errMsg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// Protected
|
||||
/////////////////////////////////////////
|
||||
|
||||
G4MoleculeDefinition::G4MoleculeDefinition(const G4MoleculeDefinition& right):
|
||||
G4ParticleDefinition((const G4ParticleDefinition &)right),
|
||||
fMass(right.fMass),
|
||||
fNbOfElectrons (right.fNbOfElectrons),
|
||||
fNbOfMolecularShells(right.fNbOfMolecularShells),
|
||||
fDiffusionCoefficient( right.fDiffusionCoefficient),
|
||||
fAtomsNb( right.fAtomsNb),
|
||||
fVanDerVaalsRadius (right.fVanDerVaalsRadius)
|
||||
{
|
||||
if(right.fElectronOccupancy!=0)
|
||||
{
|
||||
fElectronOccupancy= new G4ElectronOccupancy(*(right.fElectronOccupancy));
|
||||
}
|
||||
else fElectronOccupancy = 0;
|
||||
|
||||
if(right.fDecayTable!=0)
|
||||
{
|
||||
fDecayTable = new G4MolecularDecayTable(*(right.fDecayTable));
|
||||
}
|
||||
else fDecayTable =0;
|
||||
}
|
||||
|
||||
//___________________________________________________________________________
|
||||
|
||||
const G4MoleculeDefinition & G4MoleculeDefinition::operator=(const G4MoleculeDefinition &right)
|
||||
{
|
||||
if (this != &right) {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 "G4MoleculeHandleManager.hh"
|
||||
#include "G4Molecule.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
G4MoleculeHandleManager* G4MoleculeHandleManager::fInstance (0);
|
||||
|
||||
G4MoleculeHandleManager::G4MoleculeHandleManager()
|
||||
{
|
||||
// G4cout << "G4MoleculeHandleManager::G4MoleculeHandleManager()" << G4endl;
|
||||
}
|
||||
|
||||
G4bool G4MoleculeHandleManager::CompMoleculePointer::operator()(const G4Molecule* mol1, const G4Molecule* mol2) const
|
||||
{
|
||||
return (*mol1) < (*mol2);
|
||||
}
|
||||
|
||||
G4MoleculeHandleManager::~G4MoleculeHandleManager()
|
||||
{
|
||||
if(!fMoleculeHandle.empty())
|
||||
{
|
||||
MoleculeHandleMap::iterator it = fMoleculeHandle.begin();
|
||||
for( ; it != fMoleculeHandle.end() ; it++)
|
||||
{
|
||||
it->second.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4MoleculeHandleManager::DeleteInstance()
|
||||
{
|
||||
if(fInstance)
|
||||
{
|
||||
delete fInstance;
|
||||
fInstance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
G4MoleculeHandleManager* G4MoleculeHandleManager::Instance()
|
||||
{
|
||||
if(!fInstance)
|
||||
{
|
||||
fInstance = new G4MoleculeHandleManager;
|
||||
}
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
G4MoleculeHandle G4MoleculeHandleManager::GetMoleculeHandle(const G4Molecule* molecule)
|
||||
{
|
||||
MoleculeHandleMap::iterator it = fMoleculeHandle.find(molecule);
|
||||
G4MoleculeHandle molHandle;
|
||||
|
||||
if(it != fMoleculeHandle.end())
|
||||
{
|
||||
molHandle = G4MoleculeHandle(it->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
molHandle = G4MoleculeHandle(molecule);
|
||||
fMoleculeHandle.insert(make_pair(molecule, G4MoleculeHandle(molHandle)));
|
||||
}
|
||||
|
||||
return molHandle;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 10 Oct 2011 M.Karamitros created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
#include "G4MoleculeID.hh"
|
||||
|
||||
int G4MoleculeID::fLastValue(0);
|
||||
G4MoleculeID gStartCounter(G4MoleculeID::Initialize(999666999));
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 "G4VMolecularDecayDisplacer.hh"
|
||||
#include "G4Molecule.hh"
|
||||
|
||||
DisplacementType G4VMolecularDecayDisplacer::Last = 0;
|
||||
const DisplacementType G4VMolecularDecayDisplacer::NoDisplacement = G4VMolecularDecayDisplacer::AddDisplacement();
|
||||
|
||||
G4VMolecularDecayDisplacer::G4VMolecularDecayDisplacer()
|
||||
{
|
||||
fVerbose = 0;
|
||||
}
|
||||
|
||||
G4VMolecularDecayDisplacer::~G4VMolecularDecayDisplacer()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
DisplacementType G4VMolecularDecayDisplacer::AddDisplacement()
|
||||
{
|
||||
DisplacementType output = Last;
|
||||
Last++;
|
||||
return output;
|
||||
}
|
||||
Reference in New Issue
Block a user