Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -23,6 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAChemistryManager.hh 64057 2012-10-30 15:04:49Z gcosmo $
//
// Author: Mathieu Karamitros (kara@cenbg.in2p3.fr)
//
@@ -44,13 +45,15 @@
#include <memory>
class G4Track;
class G4WaterExcitationStructure;
class G4WaterIonisationStructure;
class G4DNAWaterExcitationStructure;
class G4DNAWaterIonisationStructure;
class G4Molecule;
enum ElectronicModification
{
fIonizedMolecule,
fExcitedMolecule
eIonizedMolecule,
eExcitedMolecule,
eDissociativeAttachment
};
/**
@@ -58,12 +61,18 @@ enum ElectronicModification
* It creates the water molecules and the solvated electrons and
* and send them to G4ITStepManager to be treated in the chemistry stage.
* For this, the fActiveChemistry flag needs to be on.
* It is also possible to give already molecule's pointers already built.
* G4DNAChemistryManager will then be in charge of creating the track and loading
* it to the IT system.
* The user can also ask to create a file containing a information about the
* creation of water molecules and solvated electrons.
*/
class G4DNAChemistryManager
{
friend class std::auto_ptr<G4DNAChemistryManager>;
~G4DNAChemistryManager();
public:
static G4DNAChemistryManager* Instance();
@@ -72,8 +81,6 @@ public:
*/
static void DeleteInstance();
~G4DNAChemistryManager();
/**
* Tells the chemMan to write into a file
* the position and electronic state of the water molecule
@@ -106,9 +113,31 @@ public:
void CreateSolvatedElectron(const G4Track* /*theIncomingTrack*/,
G4ThreeVector* finalPosition = 0);
/**
* WARNING : In case chemistry is not activated, PushMolecule will take care
* of deleting the transfered molecule.
* Before calling this method, it is also possible to check if the chemistry is activated
* through IsChemistryActived().
* This method will create the track corresponding to the transfered molecule and will be in charge
* of loading the new track to the system.
*/
void PushMolecule(G4Molecule*& molecule,
double time, const G4ThreeVector& position, int parentID);
/**
* WARNING : In case chemistry is not activated, PushMoleculeAtParentTimeAndPlace
* will take care of deleting the transfered molecule.
* Before calling this method, it is also possible to check if the chemistry is activated
* through IsChemistryActived().
* This method will create the track corresponding to the transfered molecule and will be in charge
* of loading the new track to the system.
*/
void PushMoleculeAtParentTimeAndPlace(G4Molecule*& molecule,
const G4Track* /*theIncomingTrack*/);
protected :
G4WaterExcitationStructure* GetExcitationLevel();
G4WaterIonisationStructure* GetIonisationLevel();
G4DNAWaterExcitationStructure* GetExcitationLevel();
G4DNAWaterIonisationStructure* GetIonisationLevel();
private:
G4DNAChemistryManager();
@@ -118,8 +147,8 @@ private:
std::ofstream fOutput;
G4bool fWriteFile;
G4WaterExcitationStructure* fExcitationLevel;
G4WaterIonisationStructure* fIonisationLevel;
G4DNAWaterExcitationStructure* fExcitationLevel;
G4DNAWaterIonisationStructure* fIonisationLevel;
};
inline G4bool G4DNAChemistryManager::IsChemistryActived()
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DNACrossSectionDataSet.hh,v 1.7 2009-09-25 07:41:34 sincerti Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Author: Riccardo Capra <capra@ge.infn.it>
//
@@ -49,6 +48,8 @@
#ifndef G4DNACROSSSECTIONDATASET_HH
#define G4DNACROSSSECTIONDATASET_HH 1
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4ShellEMDataSet.hh"
class G4DNACrossSectionDataSet : public G4VEMDataSet
@@ -56,8 +57,8 @@ class G4DNACrossSectionDataSet : public G4VEMDataSet
public:
G4DNACrossSectionDataSet(G4VDataSetAlgorithm* algo,
G4double xUnit=MeV,
G4double dataUnit=barn);
G4double xUnit=CLHEP::MeV,
G4double dataUnit=CLHEP::barn);
virtual ~G4DNACrossSectionDataSet();
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * 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: G4DNADamages.hh 65022 2012-11-12 16:43:12Z gcosmo $
//
#ifndef G4DNADAMAGES_HH
#define G4DNADAMAGES_HH 1
#include "G4Molecule.hh"
class G4VDNAHit
{
public :
G4VDNAHit(){;}
virtual ~G4VDNAHit(){;}
};
class G4DNAIndirectHit : public G4VDNAHit
{
public :
G4DNAIndirectHit(const G4String& baseName, const G4Molecule* molecule,
const G4ThreeVector& position, G4double time);
virtual ~G4DNAIndirectHit();
inline const G4Molecule* GetMolecule() {return fpMolecule;}
inline const G4ThreeVector& GetPosition() {return fPosition;}
inline const G4String& GetBaseName() {return fBaseName;}
inline double GetTime() {return fTime;}
void Print();
protected :
const G4Molecule* fpMolecule;
G4ThreeVector fPosition;
G4double fTime;
G4String fBaseName;
};
class G4DNADamages
{
public:
static G4DNADamages* Instance();
static void DeleteInstance();
virtual void Reset();
//void AddDirectDamage();
virtual void AddIndirectDamage(const G4String& baseName,const G4Molecule* molecule,
const G4ThreeVector& position, double time);
inline const std::vector<G4DNAIndirectHit*>* GetIndirectHits();
inline virtual int GetNIndirectHits() const
{
if(fJustCountDamage)
return fNIndirectDamages;
return fIndirectHits.size();
}
inline virtual void SetOnlyCountDamages(bool flag = true)
{
fJustCountDamage = flag;
}
inline virtual bool OnlyCountDamages() const
{
return fJustCountDamage;
}
protected :
G4DNADamages();
static G4DNADamages* fpInstance;
virtual ~G4DNADamages();
G4bool fJustCountDamage;
G4int fNIndirectDamages;
std::vector<G4DNAIndirectHit*> fIndirectHits;
std::map<G4Molecule, const G4Molecule*> fMolMap;
};
inline const std::vector<G4DNAIndirectHit*>* G4DNADamages::GetIndirectHits()
{
return &fIndirectHits;
}
#endif // G4DNADAMAGES_HH
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DNAGenericIonsManager.hh,v 1.4 2009-06-10 13:32:58 mantero Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
#ifndef G4DNAGENERICIONSMANAGER_HH
#define G4DNAGENERICIONSMANAGER_HH 1
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * 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: G4DNAMolecularMaterial.hh 64057 2012-10-30 15:04:49Z gcosmo $
//
#ifndef G4DNAMolecularMaterial_HH
#define G4DNAMolecularMaterial_HH
#include "globals.hh"
#include "G4ios.hh"
#include <map>
#include <vector>
#include "G4VStateDependent.hh"
class G4Material;
struct CompareMaterial
{
// If the materials derives from a base material,
// it should be able to find the derived material using the base material.
bool operator() (const G4Material* mat1, const G4Material* mat2) const;
};
typedef std::map<const G4Material*, double,CompareMaterial> ComponentMap;
// G4DNAMolecularMaterial is initialized when G4ApplicationState == G4State_Idle
class G4DNAMolecularMaterial : public G4VStateDependent
{
public:
static G4DNAMolecularMaterial* Instance();
void DeleteInstance();
void Initialize();
virtual G4bool Notify(G4ApplicationState requestedState) ;
inline const std::vector<ComponentMap>* GetMassFractionTable() const;
inline const std::vector<ComponentMap>* GetDensityTable() const;
// const std::vector<double>* GetMassFractionTableFor(const G4Material*) const;
const std::vector<double>* GetDensityTableFor(const G4Material*) const;
const std::vector<double>* GetNumMolPerVolTableFor(const G4Material*) const;
protected :
static G4DNAMolecularMaterial* fInstance;
G4DNAMolecularMaterial();
G4DNAMolecularMaterial(const G4DNAMolecularMaterial& right);
G4DNAMolecularMaterial& operator=(const G4DNAMolecularMaterial&);
virtual ~G4DNAMolecularMaterial();
void Create();
void InitializeNumMolPerVol();
void InitializeDensity();
void RecordMolecularMaterial(G4Material* parentMaterial, G4Material* molecularMaterial, G4double fraction);
void SearchMolecularMaterial(G4Material* parentMaterial, G4Material* material, double currentFraction);
void AddMaterial(const G4Material*, double fraction);
void PrintNotAMolecularMaterial(const char* methodName, const G4Material* lookForMaterial) const;
std::vector<ComponentMap>* fpCompFractionTable;
std::vector<ComponentMap>* fpCompDensityTable;
std::vector<ComponentMap>* fpCompNumMolPerVolTable;
mutable std::map<const G4Material*,std::vector<double>*,CompareMaterial> fAskedDensityTable;
mutable std::map<const G4Material*,std::vector<double>*,CompareMaterial> fAskedNumPerVolTable;
mutable std::map<const G4Material*,bool,CompareMaterial> fWarningPrinted;
G4bool fIsInitialized;
};
inline const std::vector<ComponentMap> *G4DNAMolecularMaterial::GetMassFractionTable() const
{
return fpCompFractionTable;
}
inline const std::vector<ComponentMap>* G4DNAMolecularMaterial::GetDensityTable() const
{
return fpCompDensityTable;
}
#endif // G4DNAMolecularMaterial_HH
@@ -23,6 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMolecularReactionTable.hh 64057 2012-10-30 15:04:49Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -23,20 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
#ifndef G4WATEREXCITATIONSTRUCTURE_HH
#define G4WATEREXCITATIONSTRUCTURE_HH 1
#ifndef G4DNAWATEREXCITATIONSTRUCTURE_HH
#define G4DNAWATEREXCITATIONSTRUCTURE_HH 1
#include "globals.hh"
#include <vector>
class G4WaterExcitationStructure
class G4DNAWaterExcitationStructure
{
public:
G4WaterExcitationStructure();
G4DNAWaterExcitationStructure();
virtual ~G4WaterExcitationStructure();
virtual ~G4DNAWaterExcitationStructure();
G4double ExcitationEnergy(G4int level);
@@ -23,20 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
#ifndef G4WATERIONISATIONSTRUCTURE_HH
#define G4WATERIONISATIONSTRUCTURE_HH 1
#ifndef G4DNAWATERIONISATIONSTRUCTURE_HH
#define G4DNAWATERIONISATIONSTRUCTURE_HH 1
#include "globals.hh"
#include <vector>
class G4WaterIonisationStructure
class G4DNAWaterIonisationStructure
{
public:
G4WaterIonisationStructure();
G4DNAWaterIonisationStructure();
virtual ~G4WaterIonisationStructure();
virtual ~G4DNAWaterIonisationStructure();
G4double IonisationEnergy(G4int level);
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VDNAReactionModel.hh 64057 2012-10-30 15:04:49Z gcosmo $
//
#ifndef G4VReactionModel_
#define G4VReactionModel_
@@ -50,19 +50,23 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-utils
HEADERS
G4DNAChemistryManager.hh
G4DNACrossSectionDataSet.hh
G4DNADamages.hh
G4DNAGenericIonsManager.hh
G4DNAMolecularReactionTable.hh
G4DNAWaterExcitationStructure.hh
G4DNAWaterIonisationStructure.hh
G4VDNAReactionModel.hh
G4WaterExcitationStructure.hh
G4WaterIonisationStructure.hh
G4DNAMolecularMaterial.hh
SOURCES
G4DNAChemistryManager.cc
G4DNACrossSectionDataSet.cc
G4DNADamages.cc
G4DNAGenericIonsManager.cc
G4DNAMolecularReactionTable.cc
G4DNAWaterExcitationStructure.cc
G4DNAWaterIonisationStructure.cc
G4VDNAReactionModel.cc
G4WaterExcitationStructure.cc
G4WaterIonisationStructure.cc
G4DNAMolecularMaterial.cc
GRANULAR_DEPENDENCIES
G4baryons
G4bosons
@@ -23,6 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAChemistryManager.cc 64057 2012-10-30 15:04:49Z gcosmo $
//
// Author: Mathieu Karamitros (kara@cenbg.in2p3.fr)
//
@@ -36,15 +37,17 @@
// -------------------------------------------------------------------
#include "G4DNAChemistryManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4Molecule.hh"
#include "G4ITStepManager.hh"
#include "G4ITTrackHolder.hh"
#include "G4H2O.hh"
#include "G4DNAMolecularReactionTable.hh"
#include "G4WaterExcitationStructure.hh"
#include "G4WaterIonisationStructure.hh"
#include "G4DNAWaterExcitationStructure.hh"
#include "G4DNAWaterIonisationStructure.hh"
#include "G4Electron_aq.hh"
#include "G4ITManager.hh"
#include "G4MolecularConfiguration.hh"
#include "G4MoleculeCounter.hh"
using namespace std;
@@ -76,6 +79,7 @@ G4DNAChemistryManager::~G4DNAChemistryManager()
G4MoleculeHandleManager::DeleteInstance();
G4MolecularConfiguration::DeleteManager();
fInstance.release();
G4MoleculeCounter::DeleteInstance();
}
void G4DNAChemistryManager::DeleteInstance()
@@ -119,20 +123,20 @@ void G4DNAChemistryManager::CloseFile()
fWriteFile = false;
}
G4WaterExcitationStructure* G4DNAChemistryManager::GetExcitationLevel()
G4DNAWaterExcitationStructure* G4DNAChemistryManager::GetExcitationLevel()
{
if(!fExcitationLevel)
{
fExcitationLevel = new G4WaterExcitationStructure;
fExcitationLevel = new G4DNAWaterExcitationStructure;
}
return fExcitationLevel;
}
G4WaterIonisationStructure* G4DNAChemistryManager::GetIonisationLevel()
G4DNAWaterIonisationStructure* G4DNAChemistryManager::GetIonisationLevel()
{
if(!fIonisationLevel)
{
fIonisationLevel = new G4WaterIonisationStructure;
fIonisationLevel = new G4DNAWaterIonisationStructure;
}
return fIonisationLevel;
}
@@ -147,10 +151,13 @@ void G4DNAChemistryManager::CreateWaterMolecule(ElectronicModification modificat
switch (modification)
{
case fExcitedMolecule :
case eDissociativeAttachment:
energy = -1;
break;
case eExcitedMolecule :
energy = GetExcitationLevel()->ExcitationEnergy(electronicLevel);
break;
case fIonizedMolecule :
case eIonizedMolecule :
energy = GetIonisationLevel()->IonisationEnergy(electronicLevel);
break;
}
@@ -177,10 +184,13 @@ void G4DNAChemistryManager::CreateWaterMolecule(ElectronicModification modificat
switch (modification)
{
case fExcitedMolecule :
case eDissociativeAttachment:
H2O -> AddElectron(5,1);
break;
case eExcitedMolecule :
H2O -> ExciteMolecule(electronicLevel);
break;
case fIonizedMolecule :
case eIonizedMolecule :
H2O -> IonizeMolecule(electronicLevel);
break;
}
@@ -192,12 +202,13 @@ void G4DNAChemistryManager::CreateWaterMolecule(ElectronicModification modificat
H2OTrack -> SetTrackStatus(fStopButAlive);
H2OTrack -> SetKineticEnergy(0.);
G4ITStepManager::Instance()->PushTrack(H2OTrack);
G4ITTrackHolder::Instance()->PushTrack(H2OTrack);
}
}
void G4DNAChemistryManager::CreateSolvatedElectron(const G4Track* theIncomingTrack,
G4ThreeVector* finalPosition)
// finalPosition is a pointer because this argument is optional
{
if(fWriteFile)
{
@@ -224,10 +235,83 @@ void G4DNAChemistryManager::CreateSolvatedElectron(const G4Track* theIncomingTra
if(fActiveChemistry)
{
G4Molecule* e_aq = new G4Molecule(G4Electron_aq::Definition());
G4Track * e_aqTrack = e_aq->BuildTrack(picosecond,theIncomingTrack->GetPosition());
G4Track * e_aqTrack(0);
if(finalPosition)
{
e_aqTrack = e_aq->BuildTrack(picosecond,*finalPosition);
}
else
{
e_aqTrack = e_aq->BuildTrack(picosecond,theIncomingTrack->GetPosition());
}
e_aqTrack -> SetTrackStatus(fAlive);
e_aqTrack -> SetParentID(theIncomingTrack->GetTrackID());
G4ITStepManager::Instance()->PushTrack(e_aqTrack);
G4ITTrackHolder::Instance()->PushTrack(e_aqTrack);
G4ITManager<G4Molecule>::Instance()->Push(e_aqTrack);
}
}
void G4DNAChemistryManager::PushMolecule(G4Molecule*& molecule, double time,
const G4ThreeVector& position, int parentID)
{
if(fWriteFile)
{
fOutput << setw(11)<< parentID
<< setw(10)<< molecule->GetName()
<< setw(14)<< -1
<< std::setprecision(2) << std::fixed
<< setw(13)<< -1
<< std::setprecision(6) << std::scientific
<< setw(22)<< (position.x())/nanometer
<< setw(22)<< (position.y())/nanometer
<< setw(22)<< (position.z())/nanometer;
fOutput << G4endl;
}
if(fActiveChemistry)
{
G4Track* track = molecule->BuildTrack(time,position);
track -> SetTrackStatus(fAlive);
track -> SetParentID(parentID);
G4ITTrackHolder::Instance()->PushTrack(track);
G4ITManager<G4Molecule>::Instance()->Push(track);
}
else
{
delete molecule;
molecule = 0;
}
}
void G4DNAChemistryManager::PushMoleculeAtParentTimeAndPlace(G4Molecule*& molecule,
const G4Track* theIncomingTrack)
{
if(fWriteFile)
{
fOutput << setw(11)<< theIncomingTrack->GetTrackID()
<< setw(10)<< molecule->GetName()
<< setw(14)<< -1
<< std::setprecision(2) << std::fixed
<< setw(13)<< theIncomingTrack->GetKineticEnergy()/eV
<< std::setprecision(6) << std::scientific
<< setw(22)<< (theIncomingTrack->GetPosition().x())/nanometer
<< setw(22)<< (theIncomingTrack->GetPosition().y())/nanometer
<< setw(22)<< (theIncomingTrack->GetPosition().z())/nanometer ;
fOutput << G4endl;
}
if(fActiveChemistry)
{
G4Track* track = molecule->BuildTrack(theIncomingTrack->GetGlobalTime(),theIncomingTrack->GetPosition());
track -> SetTrackStatus(fAlive);
track -> SetParentID(theIncomingTrack->GetTrackID());
G4ITTrackHolder::Instance()->PushTrack(track);
G4ITManager<G4Molecule>::Instance()->Push(track);
}
else
{
delete molecule;
molecule = 0;
}
}
@@ -25,8 +25,7 @@
//
//
// $Id: G4DNACrossSectionDataSet.cc,v 1.11 2009-11-12 10:05:30 sincerti Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Author: Riccardo Capra <capra@ge.infn.it>
// Code review by MGP October 2007: removed inheritance from concrete class
@@ -0,0 +1,125 @@
//
// ********************************************************************
// * 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: G4DNADamages.cc 65022 2012-11-12 16:43:12Z gcosmo $
//
#include "G4DNADamages.hh"
#include "G4UnitsTable.hh"
G4DNADamages* G4DNADamages::fpInstance(0);
G4DNAIndirectHit::G4DNAIndirectHit(const G4String& baseName,
const G4Molecule* molecule,
const G4ThreeVector& position,
G4double time) : G4VDNAHit(),
fpMolecule(molecule)
{
fBaseName = baseName;
fPosition = position;
fTime = time;
}
G4DNAIndirectHit::~G4DNAIndirectHit()
{
if(fpMolecule) delete fpMolecule;
fpMolecule = 0;
}
void G4DNAIndirectHit::Print()
{
G4cout << "Reaction : " << fpMolecule->GetName() << " + " << fBaseName
<< " at position : " << G4BestUnit(fPosition,"Length")
<< " and time : " << G4BestUnit(fTime,"Time") << G4endl;
}
G4DNADamages* G4DNADamages::Instance()
{
if(!fpInstance) new G4DNADamages();
return fpInstance;
}
G4DNADamages::G4DNADamages()
{
fJustCountDamage = false;
fNIndirectDamages = 0;
fpInstance = this;
}
G4DNADamages::~G4DNADamages()
{
for(int i = 0 ; i <(int) fIndirectHits.size() ; i++)
{
if(fIndirectHits[i])
delete fIndirectHits[i];
}
fIndirectHits.clear();
}
void G4DNADamages::DeleteInstance()
{
if(fpInstance) delete fpInstance;
fpInstance = 0;
}
void G4DNADamages::Reset()
{
fNIndirectDamages = 0;
for(int i = 0 ; i <(int) fIndirectHits.size() ; i++)
{
if(fIndirectHits[i])
delete fIndirectHits[i];
}
fIndirectHits.clear();
}
void G4DNADamages::AddIndirectDamage(const G4String& baseName,
const G4Molecule* molecule,
const G4ThreeVector& position,
G4double time)
{
if(fJustCountDamage)
{
fNIndirectDamages++;
return;
}
G4DNAIndirectHit* indirectHit = 0;
std::map<G4Molecule, const G4Molecule*>::iterator it = fMolMap.find(*molecule);
if(it == fMolMap.end())
{
G4Molecule* mol(0);
fMolMap[*molecule] = (mol = new G4Molecule(*molecule));
indirectHit = new G4DNAIndirectHit(baseName, mol, position, time);
}
else
{
indirectHit = new G4DNAIndirectHit(baseName, it->second, position, time);
}
fIndirectHits.push_back(indirectHit);
}
@@ -23,10 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAGenericIonsManager.cc,v 1.7 2010-11-03 10:44:26 sincerti Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
#include "G4DNAGenericIonsManager.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Alpha.hh"
#include "G4Ions.hh"
@@ -0,0 +1,455 @@
//
// ********************************************************************
// * 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: G4DNAMolecularMaterial.cc 65022 2012-11-12 16:43:12Z gcosmo $
//
#include "G4DNAMolecularMaterial.hh"
#include "G4Material.hh"
#include <utility>
#include "G4StateManager.hh"
using namespace std;
bool CompareMaterial::operator() (const G4Material* mat1, const G4Material* mat2) const
{
if(mat1==0 && mat2==0) return false; //(mat1 == mat2)
if(mat1==0) return true; // mat1 < mat2
if(mat2==0) return false; //mat2 < mat1
const G4Material* baseMat1 = mat1->GetBaseMaterial();
const G4Material* baseMat2 = mat2->GetBaseMaterial();
if((baseMat1 || baseMat2) == 0) // None of the materials derives from a base material
{
return mat1 < mat2;
}
else if(baseMat1 && baseMat2) // Both materials derive from a base material
{
return baseMat1 < baseMat2;
}
else if(baseMat1 && (baseMat2 == 0)) // Only the material 1 derives from a base material
{
return baseMat1 < mat2;
}
// only case baseMat1==0 && baseMat2 remains
return mat1 < baseMat2;
}
G4DNAMolecularMaterial* G4DNAMolecularMaterial::fInstance(0);
G4DNAMolecularMaterial* G4DNAMolecularMaterial::Instance()
{
if(! fInstance) new G4DNAMolecularMaterial();
return fInstance;
}
void G4DNAMolecularMaterial::DeleteInstance()
{
delete fInstance;
fInstance = 0;
}
void G4DNAMolecularMaterial::Create()
{
fpCompFractionTable = 0;
fpCompDensityTable = 0;
fpCompNumMolPerVolTable = 0;
fIsInitialized = false;
fInstance = this;
}
G4DNAMolecularMaterial::G4DNAMolecularMaterial() :G4VStateDependent()
{
Create();
fInstance = this;
}
G4bool G4DNAMolecularMaterial::Notify(G4ApplicationState requestedState)
{
if(requestedState == G4State_Idle) Initialize();
return true;
}
G4DNAMolecularMaterial::G4DNAMolecularMaterial(const G4DNAMolecularMaterial& /*rhs*/) : G4VStateDependent()
{
Create();
}
G4DNAMolecularMaterial& G4DNAMolecularMaterial::operator=(const G4DNAMolecularMaterial& rhs)
{
if(this == &rhs) return *this;
Create();
return *this;
}
G4DNAMolecularMaterial::~G4DNAMolecularMaterial()
{
if(fpCompFractionTable)
{
fpCompFractionTable->clear();
delete fpCompFractionTable;
fpCompFractionTable = 0;
}
if(fpCompDensityTable)
{
fpCompDensityTable->clear();
delete fpCompDensityTable;
fpCompDensityTable = 0;
}
if(fpCompNumMolPerVolTable)
{
fpCompNumMolPerVolTable->clear();
delete fpCompNumMolPerVolTable;
fpCompNumMolPerVolTable = 0;
}
std::map<const G4Material*,std::vector<double>*,CompareMaterial>::iterator it;
for(it= fAskedDensityTable.begin() ; it != fAskedDensityTable.end() ;it++)
{
if(it->second)
{
delete it->second;
it->second = 0;
}
}
for(it= fAskedNumPerVolTable.begin() ; it != fAskedNumPerVolTable.end() ;it++)
{
if(it->second)
{
delete it->second;
it->second = 0;
}
}
}
void G4DNAMolecularMaterial::RecordMolecularMaterial(G4Material* parentMaterial, G4Material* molecularMaterial, G4double fraction)
{
ComponentMap& matComponent = (*fpCompFractionTable)[parentMaterial->GetIndex()];
if(matComponent.empty())
{
matComponent[molecularMaterial] = fraction;
return;
}
ComponentMap::iterator it = matComponent.find(molecularMaterial);
if(it == matComponent.end())
{
matComponent[molecularMaterial] = fraction;
}
else
{
matComponent[molecularMaterial] = it->second + fraction;
}
}
void G4DNAMolecularMaterial::SearchMolecularMaterial(G4Material* parentMaterial, G4Material* material, double currentFraction)
{
if(material->GetMassOfMolecule() != 0.0)
{
RecordMolecularMaterial(parentMaterial,material,currentFraction);
return;
}
G4Material* compMat(0);
G4double fraction = -1;
std::map<G4Material*,G4double> matComponent = material->GetMatComponents();
std::map<G4Material*,G4double>::iterator it = matComponent.begin();
for( ; it!=matComponent.end() ; it++)
{
compMat = it->first;
fraction = it->second;
if(compMat->GetMassOfMolecule() == 0.0)
{
SearchMolecularMaterial(parentMaterial,compMat,currentFraction*fraction);
}
else
{
RecordMolecularMaterial(parentMaterial,compMat,currentFraction*fraction);
}
compMat = 0;
fraction = -1;
}
}
void G4DNAMolecularMaterial::InitializeDensity()
{
if(fpCompFractionTable)
{
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
fpCompDensityTable = new vector<ComponentMap>(G4Material::GetMaterialTable()->size());
G4Material* parentMat;
const G4Material* compMat(0);
double massFraction = -1;
double parentDensity = -1;
for(int i = 0 ; i < int(materialTable->size()) ; i++)
{
parentMat = materialTable->at(i);
ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
ComponentMap& densityComp = (*fpCompDensityTable)[i];
parentDensity = parentMat->GetDensity();
for(ComponentMap::iterator it = massFractionComp.begin() ; it!=massFractionComp.end() ; it++)
{
compMat = it->first;
massFraction = it->second;
densityComp[compMat] = massFraction*parentDensity;
compMat = 0;
massFraction = -1;
}
}
}
else
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "The pointer fpCompFractionTable is not initialized" << G4endl;
G4Exception("G4DNAMolecularMaterial::InitializeDensity","G4DNAMolecularMaterial001",
FatalException,exceptionDescription);
}
}
void G4DNAMolecularMaterial::InitializeNumMolPerVol()
{
if(fpCompDensityTable)
{
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
fpCompNumMolPerVolTable = new vector<ComponentMap>(G4Material::GetMaterialTable()->size());
const G4Material* compMat(0);
for(int i = 0 ; i < int(materialTable->size()) ; i++)
{
ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
ComponentMap& densityComp = (*fpCompDensityTable)[i];
ComponentMap& numMolPerVol = (*fpCompNumMolPerVolTable)[i];
for(ComponentMap::iterator it = massFractionComp.begin() ; it!=massFractionComp.end() ; it++)
{
compMat = it->first;
numMolPerVol[compMat] = densityComp[compMat]/ compMat->GetMassOfMolecule();
compMat = 0;
}
}
}
else
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "The pointer fpCompDensityTable is not initialized" << G4endl;
G4Exception("G4DNAMolecularMaterial::InitializeNumMolPerVol","G4DNAMolecularMaterial002",
FatalException,exceptionDescription);
}
}
void G4DNAMolecularMaterial::Initialize()
{
if(fIsInitialized) return;
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
if(fpCompFractionTable==0)
{
fpCompFractionTable = new vector<ComponentMap>(materialTable->size());
}
G4Material* mat(0);
for(int i = 0 ; i < int(materialTable->size()) ; i++)
{
mat = materialTable->at(i);
SearchMolecularMaterial(mat,mat,1);
mat = 0;
}
InitializeDensity();
InitializeNumMolPerVol();
fIsInitialized = true;
}
const std::vector<double>* G4DNAMolecularMaterial::GetDensityTableFor(const G4Material* lookForMaterial) const
{
if(!fpCompDensityTable)
{
if(fIsInitialized)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "The pointer fpCompDensityTable is not initialized will the singleton of G4DNAMolecularMaterial "
<< "has already been initialized."<< G4endl;
G4Exception("G4DNAMolecularMaterial::GetDensityTableFor","G4DNAMolecularMaterial003",
FatalException,exceptionDescription);
}
if(G4StateManager::GetStateManager()->GetCurrentState() == G4State_Idle)
const_cast<G4DNAMolecularMaterial*>(this)->Initialize();
else
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "The geant4 application is at the wrong state. State must be: G4State_Idle."<< G4endl;
G4Exception("G4DNAMolecularMaterial::GetDensityTableFor",
"G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",FatalException,exceptionDescription);
}
}
std::map<const G4Material*,std::vector<double>*,CompareMaterial>::const_iterator it_askedDensityTable = fAskedDensityTable.find(lookForMaterial);
if(it_askedDensityTable != fAskedDensityTable.end())
{
return it_askedDensityTable->second;
}
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
std::vector<double>* output = new std::vector<double>(materialTable->size());
ComponentMap::const_iterator it;
G4bool materialWasNotFound = true;
for(int i = 0 ; i < int(materialTable->size()) ; i++)
{
ComponentMap& densityTable = (*fpCompDensityTable)[i];
it = densityTable.find(lookForMaterial);
if(it==densityTable.end())
{
(*output)[i] = 0.0;
}
else
{
materialWasNotFound = false;
(*output)[i] = it->second;
}
}
if(materialWasNotFound)
{
PrintNotAMolecularMaterial("G4DNAMolecularMaterial::GetDensityTableFor",lookForMaterial);
}
fAskedDensityTable.insert(make_pair(lookForMaterial, output));
return output;
}
const std::vector<double>* G4DNAMolecularMaterial::GetNumMolPerVolTableFor(const G4Material* lookForMaterial) const
{
if(!fpCompNumMolPerVolTable)
{
if(fIsInitialized)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "The pointer fpCompNumMolPerVolTable is not initialized will the singleton of G4DNAMolecularMaterial "
<< "has already been initialized."<< G4endl;
G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolTableFor","G4DNAMolecularMaterial005",
FatalException,exceptionDescription);
}
if(G4StateManager::GetStateManager()->GetCurrentState() == G4State_Idle)
{
const_cast<G4DNAMolecularMaterial*>(this)->Initialize();
}
else
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "The geant4 application is at the wrong state. State must be : G4State_Idle."<< G4endl;
G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
"G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",FatalException,exceptionDescription);
}
}
std::map<const G4Material*,std::vector<double>*,CompareMaterial>::const_iterator it_askedNumMolPerVolTable = fAskedNumPerVolTable.find(lookForMaterial);
if(it_askedNumMolPerVolTable != fAskedNumPerVolTable.end())
{
return it_askedNumMolPerVolTable->second;
}
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
std::vector<double>* output = new std::vector<double>(materialTable->size());
ComponentMap::const_iterator it;
G4bool materialWasNotFound = true;
for(int i = 0 ; i < int(materialTable->size()) ; i++)
{
ComponentMap& densityTable = (*fpCompNumMolPerVolTable)[i];
it = densityTable.find(lookForMaterial);
if(it==densityTable.end())
{
(*output)[i] = 0.0;
}
else
{
materialWasNotFound = false;
(*output)[i] = it->second;
}
}
if(materialWasNotFound)
{
PrintNotAMolecularMaterial("G4DNAMolecularMaterial::GetNumMolPerVolTableFor",lookForMaterial);
}
fAskedNumPerVolTable.insert(make_pair(lookForMaterial, output));
return output;
}
void G4DNAMolecularMaterial::PrintNotAMolecularMaterial(const char* methodName, const G4Material* lookForMaterial) const
{
std::map<const G4Material*,bool,CompareMaterial>::iterator it = fWarningPrinted.find(lookForMaterial);
if(it == fWarningPrinted.end())
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "The material " << lookForMaterial->GetName()
<< " is not defined as a molecular material."<< G4endl
<< "Meaning: The elements should be added to the material using atom count rather than mass fraction (cf. G4Material)"
<< G4endl
<< "If you want to use DNA processes on liquid water, you should better use the NistManager to create the water material."
<< G4endl
<< "Since this message is displayed, it means that the DNA models will not be called."
<< "Please note that this message will only appear once even if you are using other methods of G4DNAMolecularMaterial."
<< G4endl;
G4Exception(methodName,"MATERIAL_NOT_DEFINE_USING_ATOM_COUNT",JustWarning,exceptionDescription);
fWarningPrinted[lookForMaterial] = true;
}
}
@@ -23,6 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMolecularReactionTable.cc 65022 2012-11-12 16:43:12Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -35,10 +36,13 @@
//
// -------------------------------------------------------------------
#include <iomanip>
#include "G4DNAMolecularReactionTable.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4UIcommand.hh"
#include "G4VDNAReactionModel.hh"
#include <iomanip>
#include "G4MoleculeHandleManager.hh"
using namespace std;
@@ -361,7 +365,6 @@ G4DNAMolecularReactionTable::GetReactionData(const G4Molecule* reactive1,
G4String errMsg = "No reaction table was implemented for this molecule Definition : "
+ reactive1 -> GetName();
G4Exception("G4MolecularInteractionTable::CanReactWith","",FatalErrorInArgument, errMsg);
exit(-1);
}
std::map<const G4Molecule*,
@@ -374,7 +377,6 @@ G4DNAMolecularReactionTable::GetReactionData(const G4Molecule* reactive1,
G4String errMsg = "No reaction table was implemented for this molecule Definition : "
+ reactive2 -> GetName();
G4Exception("G4MolecularInteractionTable::CanReactWith","",FatalErrorInArgument, errMsg);
exit(-1);
}
return (it2->second);
@@ -398,6 +400,7 @@ G4DNAMolecularReactionTable::CanReactWith(const G4Molecule * aMolecule) const
G4String errMsg = "No reaction table was implemented for this molecule Definition : "
+ aMolecule -> GetName();
G4Exception("G4MolecularInteractionTable::CanReactWith","",FatalErrorInArgument, errMsg);
return 0;
}
else
{
@@ -482,6 +485,7 @@ G4DNAMolecularReactionTable::GetReactionData(const G4Molecule* molecule) const
G4String errMsg = "No reaction table was implemented for this molecule Definition : "
+ molecule -> GetName();
G4Exception("G4MolecularInteractionTable::GetReactionData","",FatalErrorInArgument, errMsg);
return 0; // coverity
}
return &(it->second);
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
#include "G4WaterExcitationStructure.hh"
#include "G4DNAWaterExcitationStructure.hh"
#include "G4SystemOfUnits.hh"
G4WaterExcitationStructure::G4WaterExcitationStructure(): nLevels(5)
G4DNAWaterExcitationStructure::G4DNAWaterExcitationStructure(): nLevels(5)
{
energyConstant.push_back(8.22*eV);
energyConstant.push_back(10.00*eV);
@@ -37,11 +38,11 @@ G4WaterExcitationStructure::G4WaterExcitationStructure(): nLevels(5)
}
G4WaterExcitationStructure::~G4WaterExcitationStructure()
G4DNAWaterExcitationStructure::~G4DNAWaterExcitationStructure()
{ }
G4double G4WaterExcitationStructure::ExcitationEnergy(G4int level)
G4double G4DNAWaterExcitationStructure::ExcitationEnergy(G4int level)
{
G4double excitation = 0.;
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
#include "G4WaterIonisationStructure.hh"
#include "G4DNAWaterIonisationStructure.hh"
#include "G4SystemOfUnits.hh"
G4WaterIonisationStructure::G4WaterIonisationStructure(): nLevels(5)
G4DNAWaterIonisationStructure::G4DNAWaterIonisationStructure(): nLevels(5)
{
energyConstant.push_back(10.79*eV);
energyConstant.push_back(13.39*eV);
@@ -37,11 +38,11 @@ G4WaterIonisationStructure::G4WaterIonisationStructure(): nLevels(5)
}
G4WaterIonisationStructure::~G4WaterIonisationStructure()
G4DNAWaterIonisationStructure::~G4DNAWaterIonisationStructure()
{ }
G4double G4WaterIonisationStructure::IonisationEnergy(G4int level)
G4double G4DNAWaterIonisationStructure::IonisationEnergy(G4int level)
{
G4double ionisation = 0.;
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VDNAReactionModel.cc 64057 2012-10-30 15:04:49Z gcosmo $
//
#include "G4VDNAReactionModel.hh"
G4VDNAReactionModel::G4VDNAReactionModel()