Import Geant4 5.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:28:22 +02:00
parent fbd4999cf7
commit 4aea781e80
5454 changed files with 223141 additions and 67347 deletions
@@ -36,7 +36,7 @@
// -------------------------------------------------------------------
#include <stdlib.h>
#include "G4VProcess.hh"
#include "g4std/fstream"
#include <fstream>
#include "G4ios.hh"
#include "AIDA/IManagedObject.h"
#include "AIDA/IAnalysisFactory.h"
@@ -33,8 +33,8 @@
// -------------------------------------------------------------------
#include "XrayFluoDataSet.hh"
#include "g4std/fstream"
#include "g4std/strstream"
#include <fstream>
#include <strstream>
#include "G4VDataSetAlgorithm.hh"
XrayFluoDataSet::XrayFluoDataSet(G4int Z,
@@ -75,6 +75,7 @@ XrayFluoDataSet::~XrayFluoDataSet()
G4double XrayFluoDataSet::FindValue(G4double e, G4int id) const
{
id = id;
G4double value;
G4double e0 = (*energies)[0];
// Protections
@@ -127,7 +128,7 @@ void XrayFluoDataSet::LoadData(const G4String& fileName)
// Build the complete string identifying the file with the data set
char nameChar[100] = {""};
G4std::ostrstream ost(nameChar, 100, G4std::ios::out);
std::ostrstream ost(nameChar, 100, std::ios::out);
ost << fileName <<".dat";
@@ -137,8 +138,8 @@ void XrayFluoDataSet::LoadData(const G4String& fileName)
G4String pathString(path);
G4String dirFile = pathString + "/" + name;
G4std::ifstream file(dirFile);
G4std::filebuf* lsdp = file.rdbuf();
std::ifstream file(dirFile);
std::filebuf* lsdp = file.rdbuf();
if (! (lsdp->is_open()) )
{
@@ -82,8 +82,8 @@ XrayFluoEventAction::~XrayFluoEventAction()
void XrayFluoEventAction::BeginOfEventAction(const G4Event* evt)
{
if (HPGeCollID==-1)
if (HPGeCollID==-1 && evt)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
HPGeCollID = SDman->GetCollectionID("HPGeCollection");
@@ -180,7 +180,7 @@ G4double XrayFluoEventAction::ResponseFunction(G4double energy)
G4double efficiency = 1.;
const XrayFluoDataSet* dataSet = runManager->GetEfficiencySet();
G4double id = 0;
G4int id = 0;
G4double random = G4UniformRand();
@@ -74,65 +74,71 @@ void XrayFluoHPGeSD::Initialize(G4HCofThisEvent*HCE)
//initializes HCE with the hits collection(s) created by this
//sensitive detector
{
HPGeCollection = new XrayFluoSensorHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int j=0;j<Detector->GetNbOfPixels();j++)
{HitHPGeID [j]= -1;};
if (HCE){
HPGeCollection = new XrayFluoSensorHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int j=0;j<Detector->GetNbOfPixels();j++)
{HitHPGeID [j]= -1;};
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool XrayFluoHPGeSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
{
G4double edep = aStep->GetTotalEnergyDeposit();
// G4String particleName = aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName();
// G4String processName = aStep->GetTrack()->GetCreatorProcess()->GetProcessName();
// G4double partEnergy = aStep->GetPreStepPoint()->GetKineticEnergy();
G4double secondEnergy = aStep->GetPostStepPoint()->GetKineticEnergy();
// G4cout << " la particella che deposita e': " << particleName << " ha una energia di keV "
// << partEnergy << " e deposita "<< edep << G4endl;
// G4cout << " la particella creata deposita: " << secondEnergy << G4endl;
// if (processName){
// G4cout << " la particella viene da: " << processName << G4endl;
// }
// else {G4cout << " il deposito proviene da: Rayleugh" << G4endl;}
if ((edep==0.)) return false;
// added, vediamo se funziona
edep = edep + secondEnergy;
// G4cout << " edep = " << edep << G4endl;
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
if (ROhist){
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
theTouchable->MoveUpHistory();
G4int PixelNumber = 0;
if (Detector->GetNbOfPixels()>1) PixelNumber= physVol->GetCopyNo() ;
if ( HitHPGeID[PixelNumber]==-1)
{
XrayFluoSensorHit* HPGeHit = new XrayFluoSensorHit();
HPGeHit->AddEnergy(edep);
HitHPGeID[PixelNumber] = HPGeCollection->insert(HPGeHit) - 1;
if (verboseLevel>0){
G4cout << " New Hit on pixel: " << PixelNumber << G4endl;
}
}
else
{
(*HPGeCollection)[HitHPGeID[PixelNumber]]->AddEnergy(edep);
//G4double ED =(*HPGeCollection)[HitHPGeID[PixelNumber]]->GetEdepTot();
if (verboseLevel>0)
G4cout << " Energy added to Pixel: " << PixelNumber << G4endl;
}
return true;
G4double edep = aStep->GetTotalEnergyDeposit();
// G4String particleName = aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName();
// G4String processName = aStep->GetTrack()->GetCreatorProcess()->GetProcessName();
// G4double partEnergy = aStep->GetPreStepPoint()->GetKineticEnergy();
// G4double secondEnergy = aStep->GetPostStepPoint()->GetKineticEnergy();
// G4cout << " la particella che deposita e': " << particleName << " ha una energia di keV "
// << partEnergy << " e deposita "<< edep << G4endl;
// G4cout << " la particella creata deposita: " << secondEnergy << G4endl;
// if (processName){
// G4cout << " la particella viene da: " << processName << G4endl;
// }
// else {G4cout << " il deposito proviene da: Rayleugh" << G4endl;}
if ((edep==0.)) return false;
// G4cout << " edep = " << edep << G4endl;
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
// theTouchable->MoveUpHistory();
G4int PixelNumber = 0;
if (Detector->GetNbOfPixels()>1) PixelNumber= physVol->GetCopyNo() ;
if ( HitHPGeID[PixelNumber]==-1)
{
XrayFluoSensorHit* HPGeHit = new XrayFluoSensorHit();
HPGeHit->AddEnergy(edep);
HitHPGeID[PixelNumber] = HPGeCollection->insert(HPGeHit) - 1;
if (verboseLevel>0){
G4cout << " New Hit on pixel: " << PixelNumber << G4endl;
}
}
else
{
(*HPGeCollection)[HitHPGeID[PixelNumber]]->AddEnergy(edep);
//G4double ED =(*HPGeCollection)[HitHPGeID[PixelNumber]]->GetEdepTot();
if (verboseLevel>0)
G4cout << " Energy added to Pixel: " << PixelNumber << G4endl;
}
return true;
}
else {return false;}
}
@@ -63,7 +63,7 @@ const XrayFluoDataSet* XrayFluoNormalization::Normalize(G4double minIntExtreme,
G4double XrayFluoNormalization::Integrate(G4double minIntExtreme, G4double maxIntExtreme, G4int nBins, XrayFluoDataSet* dataSet)
{
G4double partialHeight = 0;
G4double id = 0;
G4int id = 0;
G4double lenghtOfBins = (maxIntExtreme - minIntExtreme)/nBins;
for (G4int i = 0; i<nBins; i++)
@@ -40,8 +40,8 @@
#include "XrayFluoDataSet.hh"
#include "G4DataVector.hh"
#include "G4LogLogInterpolation.hh"
#include "g4std/fstream"
#include "g4std/strstream"
#include <fstream>
#include <strstream>
#include "XrayFluoNormalization.hh"
#include "XrayFluoAnalysisManager.hh"
@@ -85,7 +85,7 @@ XrayFluoRunAction::XrayFluoRunAction()
XrayFluoRunAction::~XrayFluoRunAction()
{
G4std::map<G4int,G4DataVector*,G4std::less<G4int> >::iterator pos;
std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos;
for (pos = energyMap.begin(); pos != energyMap.end(); pos++)
{
@@ -136,15 +136,17 @@ void XrayFluoRunAction::BeginOfRunAction(const G4Run* aRun)
void XrayFluoRunAction::EndOfRunAction(const G4Run* aRun )
{
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
// Run ended, update the visualization
if (G4VVisManager::GetConcreteInstance()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
if (aRun){
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
// Run ended, update the visualization
if (G4VVisManager::GetConcreteInstance()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
analysis->finish();
}
analysis->finish();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -197,9 +199,9 @@ G4double XrayFluoRunAction::GetInfData(G4double energy, G4double random)
if (Z >= zMin && Z <= zMax)
{
G4std::map<G4int,G4DataVector*,G4std::less<G4int> >::const_iterator pos;
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
pos = energyMap.find(Z);
G4std::map<G4int,G4DataVector*,G4std::less<G4int> >::const_iterator posData;
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posData;
posData = dataMap.find(Z);
if (pos!= energyMap.end())
{
@@ -239,9 +241,9 @@ G4double XrayFluoRunAction::GetSupData(G4double energy, G4double random)
if (Z>zMax) {Z=zMax;}
if (Z >= zMin && Z <= zMax)
{
G4std::map<G4int,G4DataVector*,G4std::less<G4int> >::const_iterator pos;
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
pos = energyMap.find(Z);
G4std::map<G4int,G4DataVector*,G4std::less<G4int> >::const_iterator posData;
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posData;
posData = dataMap.find(Z);
if (pos!= energyMap.end())
{
@@ -272,7 +274,7 @@ G4double XrayFluoRunAction::GetSupData(G4double energy, G4double random)
void XrayFluoRunAction::ReadData(G4double unitE, G4String fileName)
{
char nameChar[100] = {""};
G4std::ostrstream ost(nameChar, 100, G4std::ios::out);
std::ostrstream ost(nameChar, 100, std::ios::out);
ost << fileName <<".dat";
@@ -282,8 +284,8 @@ void XrayFluoRunAction::ReadData(G4double unitE, G4String fileName)
G4String pathString(path);
G4String dirFile = pathString + "/" + name;
G4std::ifstream file(dirFile);
G4std::filebuf* lsdp = file.rdbuf();
std::ifstream file(dirFile);
std::filebuf* lsdp = file.rdbuf();
if (! (lsdp->is_open()) )
{
@@ -334,7 +336,7 @@ void XrayFluoRunAction::ReadData(G4double unitE, G4String fileName)
void XrayFluoRunAction::ReadResponse(const G4String& fileName)
{
char nameChar[100] = {""};
G4std::ostrstream ost(nameChar, 100, G4std::ios::out);
std::ostrstream ost(nameChar, 100, std::ios::out);
ost << fileName<<".dat";
@@ -345,8 +347,8 @@ void XrayFluoRunAction::ReadResponse(const G4String& fileName)
G4String pathString(path);
G4String dirFile = pathString + "/" + name;
G4std::ifstream file(dirFile);
G4std::filebuf* lsdp = file.rdbuf();
std::ifstream file(dirFile);
std::filebuf* lsdp = file.rdbuf();
if (! (lsdp->is_open()) )
{
@@ -49,10 +49,12 @@ XrayFluoSensorHit::XrayFluoSensorHit()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayFluoSensorHit::XrayFluoSensorHit(const XrayFluoSensorHit& right)
:G4VHit(right)
{
EdepTot = right.EdepTot ;
EdepTot = right.EdepTot ;
EdepDetect = right.EdepDetect;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -77,6 +79,8 @@ const XrayFluoSensorHit& XrayFluoSensorHit::operator=(const XrayFluoSensorHit& r
int XrayFluoSensorHit::operator==(const XrayFluoSensorHit& right) const
{
if(EdepTot == right.EdepTot && EdepDetect == right.EdepDetect)
{return 1;}
return 0;
}
@@ -61,36 +61,36 @@ void XrayFluoSteppingVerbose::StepInfo()
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << G4std::setw( 5) << "#Step#" << " "
<< G4std::setw( 6) << "X" << " "
<< G4std::setw( 6) << "Y" << " "
<< G4std::setw( 6) << "Z" << " "
<< G4std::setw( 9) << "KineE" << " "
<< G4std::setw( 9) << "dEStep" << " "
<< G4std::setw(10) << "StepLeng"
<< G4std::setw(10) << "TrakLeng"
<< G4std::setw(10) << "NextVolu"
<< G4std::setw(10) << "Process" << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << G4endl;
}
G4cout << G4std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< G4std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< G4std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << G4std::setw(10) << fTrack->GetNextVolume()->GetName();
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName();
} else {
G4cout << G4std::setw(10) << "OutOfWorld";
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << G4std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
G4cout << std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << "User Limit";
@@ -104,27 +104,27 @@ void XrayFluoSteppingVerbose::StepInfo()
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << G4std::setw(3) << tN2ndariesTot
<< "(Rest=" << G4std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << G4std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << G4std::setw(2) << fN2ndariesPostStepDoIt
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << G4std::setw(3) << (*fSecondary).size()
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " : "
<< G4std::setw(6)
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
<< G4std::setw(6)
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
<< G4std::setw(6)
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
<< G4std::setw(6)
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< G4std::setw(10)
<< std::setw(10)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
@@ -149,32 +149,32 @@ void XrayFluoSteppingVerbose::TrackingStarted()
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << G4std::setw( 5) << "Step#" << " "
<< G4std::setw( 6) << "X" << " "
<< G4std::setw( 6) << "Y" << " "
<< G4std::setw( 6) << "Z" << " "
<< G4std::setw( 9) << "KineE" << " "
<< G4std::setw( 9) << "dEStep" << " "
<< G4std::setw(10) << "StepLeng"
<< G4std::setw(10) << "TrakLeng"
<< G4std::setw(10) << "NextVolu"
<< G4std::setw(10) << "Process" << G4endl;
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << G4endl;
G4cout << G4std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< G4std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< G4std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if(fTrack->GetNextVolume()){
G4cout << G4std::setw(10) << fTrack->GetNextVolume()->GetName() << " ";
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName() << " ";
} else {
G4cout << G4std::setw(10) << "OutOfWorld" << " ";
G4cout << std::setw(10) << "OutOfWorld" << " ";
}
G4cout << G4std::setw(10) << "initStep" << G4endl;
G4cout << std::setw(10) << "initStep" << G4endl;
}
G4cout.precision(prec);
}