Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -22,35 +22,25 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoAnalysisManager.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 11 Jul 2003 A.Mantero, code cleaning / Plotter-XML addiction
|
||||
// Sep 2002 A.Mantero, AIDA3.0 Migration
|
||||
// 06 Dec 2001 A.Pfeiffer updated for singleton
|
||||
// 30 Nov 2001 Guy Barrand : migrate to AIDA-2.2.
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
// 29 Nov 2002 Muigration to AIDA 3.0 (Alfonso.mantero@ge.infn.it)
|
||||
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
#include <stdlib.h>
|
||||
#include "G4VProcess.hh"
|
||||
#include <fstream>
|
||||
#include <strstream>
|
||||
#include "G4ios.hh"
|
||||
#include "AIDA/IManagedObject.h"
|
||||
#include "AIDA/IAnalysisFactory.h"
|
||||
#include "AIDA/ITreeFactory.h"
|
||||
#include "AIDA/ITree.h"
|
||||
#include "AIDA/IHistogramFactory.h"
|
||||
#include "AIDA/IHistogram1D.h"
|
||||
#include "AIDA/IHistogram2D.h"
|
||||
#include "AIDA/ITupleFactory.h"
|
||||
#include "AIDA/ITuple.h"
|
||||
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
|
||||
|
||||
#include "G4Step.hh"
|
||||
|
||||
XrayFluoAnalysisManager* XrayFluoAnalysisManager::instance = 0;
|
||||
@@ -58,48 +48,30 @@ XrayFluoAnalysisManager* XrayFluoAnalysisManager::instance = 0;
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisManager::XrayFluoAnalysisManager()
|
||||
:outputFileName("xrayfluo.hbk"),analysisFactory(0), tree(0),histogramFactory(0)
|
||||
:outputFileName("xrayfluo"), /*visPlotter(false),*/ persistencyType("xml"),
|
||||
deletePersistencyFile(true), analysisFactory(0), tree(0),histogramFactory(0)//, plotter(0)
|
||||
{
|
||||
// pEvent=new XrayFluoEventAction();
|
||||
|
||||
//creating the messenger
|
||||
analisysMessenger = new XrayFluoAnalysisMessenger(this);
|
||||
|
||||
// Hooking an AIDA compliant analysis system.
|
||||
// creating Analysis factroy, necessary to create/manage analysis
|
||||
analysisFactory = AIDA_createAnalysisFactory();
|
||||
if(analysisFactory) {
|
||||
|
||||
AIDA::ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
|
||||
if(treeFactory) {
|
||||
// tree = treeFactory->create(); // Tree in memory.
|
||||
//porebbe essere qua il memory leak//
|
||||
// creating persistency
|
||||
|
||||
tree = treeFactory->create(outputFileName,"hbook",false,true);
|
||||
CreatePersistency(outputFileName,persistencyType);
|
||||
|
||||
delete treeFactory; // Will not delete the ITree.
|
||||
histogramFactory = analysisFactory->createHistogramFactory(*tree);
|
||||
// tupleFactory = analysisFactory->createTupleFactory(*tree);
|
||||
}
|
||||
// if(analysisFactory) {
|
||||
|
||||
|
||||
|
||||
// // Creating the plotter factory
|
||||
// plotterFactory = analysisFactory->createPlotterFactory();
|
||||
// }
|
||||
|
||||
/*
|
||||
// Create and a the plotter :
|
||||
IPlotterFactory* plotterFactory =
|
||||
analysisFactory->createPlotterFactory(argc,argv);
|
||||
if(plotterFactory) {
|
||||
plotter = plotterFactory->create();
|
||||
if(plotter) {
|
||||
// Map the plotter on screen :
|
||||
plotter->show();
|
||||
// Set the page title :
|
||||
plotter->setParameter("pageTitle","XrayFluo");
|
||||
// Have two plotting regions (one column, two rows).
|
||||
}
|
||||
delete plotterFactory;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
G4cout << "XrayFluoAnalysisManager created" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -112,8 +84,10 @@ XrayFluoAnalysisManager::~XrayFluoAnalysisManager()
|
||||
delete analysisFactory;
|
||||
analysisFactory = 0;
|
||||
|
||||
// delete tupleFactory;
|
||||
// tupleFactory=0;
|
||||
// delete plotterFactory;
|
||||
// plotterFactory=0;
|
||||
|
||||
delete tree;
|
||||
|
||||
delete instance;
|
||||
|
||||
@@ -132,11 +106,39 @@ XrayFluoAnalysisManager* XrayFluoAnalysisManager::getInstance()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::CreatePersistency(G4String fileName,G4String persistencyType,
|
||||
G4bool readOnly, G4bool createNew)
|
||||
{
|
||||
|
||||
if (tree) delete tree;
|
||||
if (histogramFactory) delete histogramFactory;
|
||||
|
||||
AIDA::ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
|
||||
if(treeFactory) {
|
||||
if (persistencyType == "hbook") {
|
||||
fileName = fileName + ".hbk";
|
||||
}
|
||||
else if (persistencyType == "xml"){
|
||||
fileName = fileName + ".xml";
|
||||
}
|
||||
tree = treeFactory->create(fileName,persistencyType,readOnly,createNew); // output file
|
||||
|
||||
delete treeFactory; // Will not delete the ITree.
|
||||
}
|
||||
if(analysisFactory) {
|
||||
|
||||
|
||||
histogramFactory = analysisFactory->createHistogramFactory(*tree);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XrayFluoAnalysisManager::book()
|
||||
{
|
||||
// Book histograms
|
||||
|
||||
histo_1 = histogramFactory->createHistogram1D("1","Energy Deposit", 100000,0.,10.); //1eV def.
|
||||
histo_1 = histogramFactory->createHistogram1D("1","Energy Deposit", 500,0.,10.); //20eV def.
|
||||
histo_2 = histogramFactory->createHistogram1D("2","Gamma born in the sample", 100,0.,10.);
|
||||
histo_3 = histogramFactory->createHistogram1D("3","Electrons born in the sample", 100,0.,10.);
|
||||
histo_4 = histogramFactory->createHistogram1D("4","Gammas leaving the sample", 300,0.,10.);
|
||||
@@ -145,15 +147,16 @@ void XrayFluoAnalysisManager::book()
|
||||
histo_7 = histogramFactory->createHistogram1D("7","Spectrum of the incident particles", 100,0.,10.);
|
||||
histo_8 = histogramFactory->createHistogram1D("8","Protons reaching the detector", 100,0.,10.);
|
||||
histo_9 = histogramFactory->createHistogram1D("9","Protons leaving the sample", 100,0.,10.);
|
||||
histo_10 = histogramFactory->createHistogram1D("10","Photon Origin", 4,0.,3.);
|
||||
histo_11 = histogramFactory->createHistogram1D("11","Spectrum from LowEnPhotoELectric", 300,0.,10.);
|
||||
histo_12 = histogramFactory->createHistogram1D("12","Spectrum From the other processes (unknown)", 300,0.,10.);
|
||||
|
||||
// Debugging-purpose Histos
|
||||
|
||||
//histo_10 = histogramFactory->createHistogram1D("10","Photon Origin", 4,0.,3.);
|
||||
//histo_11 = histogramFactory->createHistogram1D("11","Spectrum from LowEnPhotoELectric", 300,0.,10.);
|
||||
//histo_12 = histogramFactory->createHistogram1D("12","Spectrum From the other processes (unknown)", 300,0.,10.);
|
||||
|
||||
// IHistogram2D* histo_20 = histogramFactory->
|
||||
//create2D("20","Phi, Theta",80 ,-3.14,3.14,80,0.,3.14);
|
||||
|
||||
// Create a tuple :
|
||||
// tuple = tupleFactory->create("XrayFluo","XrayFluo","energy counts");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -161,31 +164,65 @@ void XrayFluoAnalysisManager::book()
|
||||
void XrayFluoAnalysisManager::finish()
|
||||
{
|
||||
|
||||
// if(plotter) {
|
||||
// // Wait for the keyboard return to avoid destroying the plotter window too quickly.
|
||||
// G4cout << "Press <ENTER> to exit" << G4endl;
|
||||
// G4cin.get();
|
||||
// plotter->hide(); //hide plotter windows, but doesn't delete plotter
|
||||
// }
|
||||
|
||||
if(tree) {
|
||||
tree->commit(); // Write histos and tuple in file.
|
||||
tree->commit(); // Write histos in file.
|
||||
tree->close();
|
||||
}
|
||||
|
||||
deletePersistencyFile = false;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// void XrayFluoAnalysisManager::InitializePlotter()
|
||||
// {
|
||||
|
||||
// // If speciefied (visPlotter=true),
|
||||
// // a window for the visulizaton of partial results is created
|
||||
// if(plotterFactory && visPlotter && deletePersistencyFile)
|
||||
// {
|
||||
// plotter = plotterFactory->create();
|
||||
// // Set the page title :
|
||||
// plotter->setParameter("pageTitle","XrayFluo");
|
||||
// }
|
||||
|
||||
// if(plotter && visPlotter) {
|
||||
// plotter->show(); // shows plotter window
|
||||
// }
|
||||
|
||||
// }
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// void XrayFluoAnalysisManager::PlotCurrentResults()
|
||||
// {
|
||||
// if(plotter) {
|
||||
// // Plotting the Detector Energy Deposit - histo_1
|
||||
// AIDA::IHistogram1D& histo1p = *histo_1;
|
||||
// plotter->currentRegion().plot( histo1p, "Detector Energy Deposition" );
|
||||
// plotter->refresh();
|
||||
// }
|
||||
// }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
G4bool XrayFluoAnalysisManager::GetDeletePersistencyFileFlag()
|
||||
{
|
||||
return deletePersistencyFile;
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::analyseStepping(const G4Step* aStep)
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
IHistogram1D* histo_2 =dynamic_cast<IHistogram1D *> ( tree->find("2") );
|
||||
IHistogram1D* histo_3 =dynamic_cast<IHistogram1D *> ( tree->find("3") );
|
||||
IHistogram1D* histo_4 =dynamic_cast<IHistogram1D *> ( tree->find("4") );
|
||||
IHistogram1D* histo_5 =dynamic_cast<IHistogram1D *> ( tree->find("5") );
|
||||
IHistogram1D* histo_6 =dynamic_cast<IHistogram1D *> ( tree->find("6") );
|
||||
IHistogram1D* histo_8 =dynamic_cast<IHistogram1D *> ( tree->find("8") );
|
||||
IHistogram1D* histo_10 =dynamic_cast<IHistogram1D *> ( tree->find("10") );
|
||||
IHistogram1D* histo_11 =dynamic_cast<IHistogram1D *> ( tree->find("11") );
|
||||
IHistogram1D* histo_12 =dynamic_cast<IHistogram1D *> ( tree->find("12") );
|
||||
//IHistogram2D* histo_20=dynamic_cast<IHistogram2D *> ( tree->find("20") );
|
||||
*/
|
||||
|
||||
G4double gammaAtTheDetPre=0;
|
||||
G4double protonsAtTheDetPre=0;
|
||||
@@ -197,69 +234,81 @@ void XrayFluoAnalysisManager::analyseStepping(const G4Step* aStep)
|
||||
G4double protonsLeavSam=0;
|
||||
G4double gammaBornInSample=0;
|
||||
G4double eleBornInSample=0;
|
||||
|
||||
// Filling the histograms with data, passing thru stepping.
|
||||
|
||||
|
||||
// Select volume from wich the step starts
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Sample"){
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "World" )
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
|
||||
{
|
||||
// Select volume from wich the step ends
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "World" ) {
|
||||
// Select the particle type
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
|
||||
{
|
||||
|
||||
|
||||
if(aStep->GetTrack()->GetCreatorProcess()){
|
||||
G4String process = aStep->GetTrack()->GetCreatorProcess()->GetProcessName();
|
||||
// G4cout << "Il processo di origine e' " << process << G4endl;
|
||||
if(histo_10) {
|
||||
histo_10->fill(1.);
|
||||
gammaLeavingSample =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_11) {
|
||||
histo_11->fill(gammaLeavingSample/keV);
|
||||
// Control histos, used for debugging purpose.
|
||||
|
||||
// if(aStep->GetTrack()->GetCreatorProcess()){
|
||||
// G4String process = aStep->GetTrack()->GetCreatorProcess()->GetProcessName();
|
||||
// G4cout << "Il processo di origine e' " << process << G4endl;
|
||||
// if(histo_10) {
|
||||
// histo_10->fill(1.);
|
||||
// gammaLeavingSample =
|
||||
// (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
// if(histo_11) {
|
||||
// histo_11->fill(gammaLeavingSample/keV);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//G4cout << "Sembra che non ci sia un processo d'origine" << G4endl;
|
||||
if(histo_10) {
|
||||
histo_10->fill(2.);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// //G4cout << "Sembra che non ci sia un processo d'origine" << G4endl;
|
||||
// if(histo_10) {
|
||||
// histo_10->fill(2.);
|
||||
|
||||
gammaLeavingSample =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_12) {
|
||||
histo_12->fill(gammaLeavingSample/keV);
|
||||
// gammaLeavingSample =
|
||||
// (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
// if(histo_12) {
|
||||
// histo_12->fill(gammaLeavingSample/keV);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// //
|
||||
// Filling Histos //
|
||||
// //
|
||||
|
||||
gammaLeavingSample =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_4) {
|
||||
histo_4->fill(gammaLeavingSample/keV);
|
||||
|
||||
}
|
||||
|
||||
/* gammaLeavingSamplePhi =
|
||||
(aStep->GetPreStepPoint()->GetMomentumDirection().phi());
|
||||
G4cout << "questo e' Phi: " << gammaLeavingSamplePhi << G4endl;
|
||||
gammaLeavingSampleTheta =
|
||||
(aStep->GetPreStepPoint()->GetMomentumDirection().theta());
|
||||
G4cout << "questo e' Theta: " << gammaLeavingSampleTheta << G4endl;
|
||||
if(histo_20) {
|
||||
// G4cout << "histo_20 esiste" << G4endl;
|
||||
histo_20->fill(gammaLeavingSamplePhi,gammaLeavingSampleTheta,1.);
|
||||
} */
|
||||
|
||||
gammaLeavingSample =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_4) {
|
||||
histo_4->fill(gammaLeavingSample/keV);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Other debugging purpose histos
|
||||
/* gammaLeavingSamplePhi =
|
||||
(aStep->GetPreStepPoint()->GetMomentumDirection().phi());
|
||||
G4cout << "questo e' Phi: " << gammaLeavingSamplePhi << G4endl;
|
||||
gammaLeavingSampleTheta =
|
||||
(aStep->GetPreStepPoint()->GetMomentumDirection().theta());
|
||||
G4cout << "questo e' Theta: " << gammaLeavingSampleTheta << G4endl;
|
||||
if(histo_20) {
|
||||
// G4cout << "histo_20 esiste" << G4endl;
|
||||
histo_20->fill(gammaLeavingSamplePhi,gammaLeavingSampleTheta,1.);
|
||||
} */
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Sample"){
|
||||
@@ -278,15 +327,62 @@ void XrayFluoAnalysisManager::analyseStepping(const G4Step* aStep)
|
||||
->GetDefinition()-> GetParticleName()) == "proton" )
|
||||
{
|
||||
protonsLeavSam = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_3) {
|
||||
histo_3->fill(protonsLeavSam/keV);
|
||||
if(histo_9) {
|
||||
histo_9->fill(protonsLeavSam/keV);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// electrons from the detector -- Debugging
|
||||
|
||||
|
||||
// if((aStep->GetTrack()->GetDynamicParticle()
|
||||
// ->GetDefinition()-> GetParticleName()) == "e-" ){
|
||||
|
||||
// if(1== (aStep->GetTrack()->GetCurrentStepNumber())){
|
||||
|
||||
// if(0 != aStep->GetTrack()->GetParentID()){
|
||||
// if(aStep->GetTrack()->GetVolume()->GetName() == "HPGeDetector")
|
||||
|
||||
// if(aStep->GetTrack()->GetNextVolume()->GetName() == "World" ){
|
||||
|
||||
// if(aStep->GetTrack()->GetCreatorProcess()){
|
||||
// G4String process = aStep->GetTrack()->GetCreatorProcess()->GetProcessName();
|
||||
// G4cout << "Origin Porcess Name: " << process << G4endl;
|
||||
// if(histo_10) {
|
||||
// histo_10->fill(1.);
|
||||
// gammaLeavingSample =
|
||||
// (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
// if(histo_11) {
|
||||
// histo_11->fill(gammaLeavingSample/keV);
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// G4cout << "No Origin Process Name" << G4endl;
|
||||
// if(histo_10) {
|
||||
// histo_10->fill(2.);
|
||||
|
||||
// gammaLeavingSample =
|
||||
// (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
// if(histo_12) {
|
||||
// histo_12->fill(gammaLeavingSample/keV);
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
if((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
|
||||
@@ -324,50 +420,45 @@ void XrayFluoAnalysisManager::analyseStepping(const G4Step* aStep)
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()){
|
||||
|
||||
if(aStep->GetTrack()->GetVolume()->GetName() == "World"){
|
||||
//if(aStep->GetTrack()->GetVolume()->GetName() == "World"){
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "HPGeDetector")
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "HPGeDetector")
|
||||
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
{
|
||||
gammaAtTheDetPre =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_6) {
|
||||
histo_6->fill( gammaAtTheDetPre/keV);
|
||||
}
|
||||
}
|
||||
else if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "proton" )
|
||||
{
|
||||
protonsAtTheDetPre =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_8) {
|
||||
histo_8->fill( protonsAtTheDetPre/keV);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
{
|
||||
|
||||
gammaAtTheDetPre =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_6) {
|
||||
histo_6->fill( gammaAtTheDetPre/keV);
|
||||
}
|
||||
}
|
||||
else if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "proton" )
|
||||
{
|
||||
protonsAtTheDetPre =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_8) {
|
||||
histo_8->fill( protonsAtTheDetPre/keV);
|
||||
}
|
||||
}
|
||||
}
|
||||
//} close of if(aStep->GetTrack()->GetVolume()->GetName() == "World"){
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::analyseEnergyDep(G4double energyDep)
|
||||
{
|
||||
//histo_1 =dynamic_cast<IHistogram1D *> ( tree->find("1") );
|
||||
|
||||
// Filling of Energy Deposition, called by XrayFluoEventAction
|
||||
|
||||
histo_1->fill(energyDep/keV);
|
||||
|
||||
/*
|
||||
if(tuple) {
|
||||
tuple->fill(0,energyDep);
|
||||
tuple->fill(1,1);
|
||||
tuple->addRow();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -375,16 +466,24 @@ void XrayFluoAnalysisManager::analyseEnergyDep(G4double energyDep)
|
||||
void XrayFluoAnalysisManager::analysePrimaryGenerator(G4double energy)
|
||||
{
|
||||
|
||||
// qua si fa uso spropositato di memoria -- attenzione!!//
|
||||
//histo_7 =dynamic_cast<IHistogram1D *> ( tree->find("7") );
|
||||
// Filling of energy spectrum histogram of the primary generator
|
||||
|
||||
histo_7->fill(energy/keV);
|
||||
}
|
||||
|
||||
|
||||
// not used -- Created for future development
|
||||
|
||||
void XrayFluoAnalysisManager::SetOutputFileName(G4String newName)
|
||||
{
|
||||
|
||||
outputFileName = newName;
|
||||
}
|
||||
|
||||
void XrayFluoAnalysisManager::SetOutputFileType(G4String newType)
|
||||
{
|
||||
|
||||
persistencyType = newType;
|
||||
}
|
||||
|
||||
|
||||
@@ -396,5 +495,3 @@ void XrayFluoAnalysisManager::SetOutputFileName(G4String newName)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,41 +22,51 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoAnalysisMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
// 29 Nov 2002 minor upgrade (Alfonso.mantero@ge.infn.it)
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "XrayFluoAnalysisMessenger.hh"
|
||||
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisMessenger::XrayFluoAnalysisMessenger(XrayFluoAnalysisManager* analysisManager)
|
||||
:xrayFluoAnalysis(analysisManager)
|
||||
|
||||
|
||||
{
|
||||
XrayFluoAnalysisDir = new G4UIdirectory("/analysis/");
|
||||
XrayFluoAnalysisDir->SetGuidance("analysis control.");
|
||||
|
||||
ouputFileCommand = new G4UIcmdWithAString("/analysis/outputFile",this);
|
||||
ouputFileCommand->SetGuidance("specify the name of the output file (lowercase for Hbook)");
|
||||
ouputFileCommand->SetGuidance("default: xrayfluo.hbk");
|
||||
ouputFileCommand->SetParameterName("choice",true);
|
||||
ouputFileCommand->SetDefaultValue("xrayfluo.hbk");
|
||||
//DrawCmd->SetCandidates("none charged neutral all");
|
||||
ouputFileCommand->AvailableForStates(G4State_Idle);
|
||||
|
||||
outputFileCommand = new G4UIcmdWithAString("/analysis/outputFile",this);
|
||||
outputFileCommand->SetGuidance("specify the name of the output file (lowercase if paw will be used)");
|
||||
outputFileCommand->SetGuidance("command /analysis/update MUST be used after this command");
|
||||
outputFileCommand->SetParameterName("choice",true);
|
||||
outputFileCommand->SetDefaultValue("xrayfluo.hbk");
|
||||
outputFileCommand->AvailableForStates(G4State_Idle);
|
||||
|
||||
outputFileType = new G4UIcmdWithAString("/analysis/fileType",this);
|
||||
outputFileType->SetGuidance("specify the type of the output file");
|
||||
outputFileType->SetGuidance("command /analysis/update MUST be used after this command");
|
||||
outputFileType->SetParameterName("choice",true);
|
||||
outputFileType->SetDefaultValue("hbook");
|
||||
outputFileType->SetCandidates("hbook xml");
|
||||
outputFileType->AvailableForStates(G4State_Idle);
|
||||
|
||||
persistencyUpdateCommand = new G4UIcmdWithoutParameter("/analysis/update",this);
|
||||
outputFileCommand->SetGuidance("Update persistency file");
|
||||
outputFileCommand->SetGuidance("This command MUST be used after outputFile or outputFileType commands");
|
||||
outputFileCommand->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -72,10 +82,21 @@ XrayFluoAnalysisMessenger::~XrayFluoAnalysisMessenger()
|
||||
void XrayFluoAnalysisMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
|
||||
if(command == ouputFileCommand)
|
||||
{xrayFluoAnalysis->SetOutputFileName(newValue);}
|
||||
if(command == outputFileCommand)
|
||||
{
|
||||
if ((xrayFluoAnalysis->GetDeletePersistencyFileFlag())) remove("xrayfluo.hbk");
|
||||
xrayFluoAnalysis->SetOutputFileName(newValue);
|
||||
}
|
||||
|
||||
else if (command == persistencyUpdateCommand)
|
||||
{xrayFluoAnalysis->CreatePersistency();}
|
||||
|
||||
else if(command == outputFileType)
|
||||
{
|
||||
if (xrayFluoAnalysis->GetDeletePersistencyFileFlag()) remove("xrayfluo.hbk");
|
||||
xrayFluoAnalysis->SetOutputFileType(newValue);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoDAtaSet.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -47,6 +47,8 @@ XrayFluoDataSet::XrayFluoDataSet(G4int Z,
|
||||
numberOfBins = energies->size();
|
||||
unit1 = unitE;
|
||||
unit2 = unitData;
|
||||
|
||||
G4cout << "XrayFluo FluoDataSet created" << G4endl;
|
||||
}
|
||||
|
||||
XrayFluoDataSet:: XrayFluoDataSet(G4int Z,
|
||||
@@ -61,6 +63,9 @@ XrayFluoDataSet:: XrayFluoDataSet(G4int Z,
|
||||
unit2 = unitData;
|
||||
LoadData(dataFile);
|
||||
numberOfBins = energies->size();
|
||||
|
||||
G4cout << "XrayFluo FluoDataSet created" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -70,12 +75,12 @@ XrayFluoDataSet::~XrayFluoDataSet()
|
||||
{
|
||||
delete energies;
|
||||
delete data;
|
||||
G4cout << "XrayFluo FluoDataSet deleted" << G4endl;
|
||||
}
|
||||
|
||||
|
||||
G4double XrayFluoDataSet::FindValue(G4double e, G4int id) const
|
||||
G4double XrayFluoDataSet::FindValue(G4double e, G4int) const
|
||||
{
|
||||
id = id;
|
||||
G4double value;
|
||||
G4double e0 = (*energies)[0];
|
||||
// Protections
|
||||
@@ -133,11 +138,17 @@ void XrayFluoDataSet::LoadData(const G4String& fileName)
|
||||
ost << fileName <<".dat";
|
||||
|
||||
G4String name(nameChar);
|
||||
|
||||
char* path = getenv("G4INSTALL");
|
||||
|
||||
G4String pathString(path);
|
||||
G4String dirFile = pathString + "/" + name;
|
||||
|
||||
G4String dirFile = name;
|
||||
|
||||
if (!(getenv("XRAYDATA"))) {
|
||||
|
||||
char* path = getenv("PWD");
|
||||
|
||||
G4String pathString(path);
|
||||
dirFile = pathString + "/" + name;
|
||||
}
|
||||
|
||||
std::ifstream file(dirFile);
|
||||
std::filebuf* lsdp = file.rdbuf();
|
||||
|
||||
@@ -204,3 +215,13 @@ void XrayFluoDataSet::PrintData() const
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,14 +22,13 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoDetectorMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
// 29 Nov 2002 change material command added(Alfonso.mantero@ge.infn.it)
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@@ -39,29 +38,53 @@
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoDetectorMessenger::XrayFluoDetectorMessenger(XrayFluoDetectorConstruction * Det)
|
||||
:Detector(Det)
|
||||
{
|
||||
detDir = new G4UIdirectory("/apparate/");
|
||||
detDir = new G4UIdirectory("/apparate/");
|
||||
detDir->SetGuidance("detector control.");
|
||||
|
||||
UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
|
||||
UpdateCmd->SetGuidance("Update apparate geometry.");
|
||||
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
|
||||
|
||||
UpdateCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
sampleCmd = new G4UIcmdWithAString("/apparate/sample",this);
|
||||
sampleCmd = new G4UIcmdWithAString("/apparate/sampleMaterial",this);
|
||||
sampleCmd->SetGuidance("select a diferent material for the sample");
|
||||
sampleCmd->SetGuidance("The command /apparate/update command MUST be applied after this one");
|
||||
sampleCmd->SetParameterName("choice",true);
|
||||
sampleCmd->SetDefaultValue("dolorite");
|
||||
sampleCmd->SetCandidates("dolorite iron silicon aluminium titanium tin neodimium magnesium germanium copper mars1");
|
||||
sampleCmd->SetParameterName("material",true);
|
||||
sampleCmd->SetDefaultValue("mars1");
|
||||
sampleCmd->SetCandidates("Dolorite Iron Silicon Aluinium Oxigen Titanium Tin Lead Neodimium Magnesium Copper Anorthosite Mars1");
|
||||
sampleCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
|
||||
detectorCmd->SetGuidance("select a diferent detectorType");
|
||||
detectorCmd->SetParameterName("detector",true);
|
||||
detectorCmd->SetDefaultValue("sili");
|
||||
detectorCmd->SetCandidates("sili hpge");
|
||||
detectorCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
|
||||
grainDiaCmd->SetGuidance( "Set diameter of grains" );
|
||||
grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
|
||||
grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
|
||||
grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
|
||||
grainDiaCmd->SetDefaultUnit( "mm" );
|
||||
grainDiaCmd->SetUnitCategory( "Length" );
|
||||
grainDiaCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
|
||||
granularityFlagCmd->SetGuidance("Set if sample granularity is present");
|
||||
granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
|
||||
granularityFlagCmd->SetParameterName("Granularity Flag",true);
|
||||
granularityFlagCmd->SetDefaultValue(false);
|
||||
granularityFlagCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -81,7 +104,25 @@ void XrayFluoDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newVal
|
||||
|
||||
else if ( command == sampleCmd )
|
||||
{ Detector->SetSampleMaterial(newValue);}
|
||||
}
|
||||
|
||||
else if ( command == detectorCmd )
|
||||
{ Detector->SetDetectorType(newValue);}
|
||||
|
||||
else if ( command == grainDiaCmd )
|
||||
{
|
||||
G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);
|
||||
Detector->SetGrainDia(newSize);
|
||||
}
|
||||
|
||||
else if ( command == granularityFlagCmd )
|
||||
{
|
||||
Detector->DeleteGrainObjects();
|
||||
G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
|
||||
Detector->SetSampleGranularity(newGranFlag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -22,20 +22,23 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoEventAction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
// 15 Jul 2003 Alfonso Mantero "DetectorType" use integration
|
||||
// 23 Sep 2003 Alfonso Mantero differnt geometries integration
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoEventAction.hh"
|
||||
#include "XrayFluoSensorHit.hh"
|
||||
#include "XrayFluoEventActionMessenger.hh"
|
||||
#include "XrayFluoRunAction.hh"
|
||||
|
||||
//#include "XrayFluoRunAction.hh"
|
||||
#include "XrayFluoDataSet.hh"
|
||||
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
@@ -52,45 +55,97 @@
|
||||
#include "G4ios.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include <fstream>
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoEventAction::XrayFluoEventAction()
|
||||
XrayFluoEventAction::XrayFluoEventAction(XrayFluoDetectorConstruction* det)
|
||||
:drawFlag("all"),
|
||||
HPGeCollID(-1),
|
||||
eventMessenger(0),
|
||||
printModulo(1)
|
||||
|
||||
printModulo(1),
|
||||
detectorType(0)
|
||||
{
|
||||
eventMessenger = new XrayFluoEventActionMessenger(this);
|
||||
runManager = new XrayFluoRunAction();
|
||||
|
||||
detectorType = det->GetDetectorType();
|
||||
|
||||
//runManager = new XrayFluoRunAction();
|
||||
G4cout << "XrayFluoEventAction created" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoEventAction::XrayFluoEventAction(XrayFluoPlaneDetectorConstruction* det)
|
||||
:drawFlag("all"),
|
||||
HPGeCollID(-1),
|
||||
eventMessenger(0),
|
||||
printModulo(1),
|
||||
detectorType(0)
|
||||
{
|
||||
eventMessenger = new XrayFluoEventActionMessenger(this);
|
||||
detectorType = det->GetDetectorType();
|
||||
|
||||
//runManager = new XrayFluoRunAction();
|
||||
G4cout << "XrayFluoEventAction created" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoEventAction::XrayFluoEventAction(XrayFluoMercuryDetectorConstruction* det)
|
||||
:drawFlag("all"),
|
||||
HPGeCollID(-1),
|
||||
eventMessenger(0),
|
||||
printModulo(1),
|
||||
detectorType(0)
|
||||
{
|
||||
eventMessenger = new XrayFluoEventActionMessenger(this);
|
||||
detectorType = det->GetDetectorType();
|
||||
|
||||
//runManager = new XrayFluoRunAction();
|
||||
G4cout << "XrayFluoEventAction created" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoEventAction::~XrayFluoEventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
eventMessenger = 0;
|
||||
delete runManager;
|
||||
runManager = 0;
|
||||
//delete runManager;
|
||||
//runManager = 0;
|
||||
G4cout << "XrayFluoEventAction deleted" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoEventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
|
||||
if (HPGeCollID==-1 && evt)
|
||||
|
||||
G4int eventNumber = (evt->GetEventID())+1;
|
||||
if ( eventNumber == 1){
|
||||
|
||||
G4cout << "# = 100000 events" << G4endl;
|
||||
G4cout << "1--------+---------+---------+---------+---------5e6"<<G4endl;
|
||||
}
|
||||
|
||||
if ( ((eventNumber) % 100000) == 0 ) {
|
||||
|
||||
if ( eventNumber % (G4int)5e6 != 0 ) G4cout << "#" << std::flush;
|
||||
else G4cout << "#"<< G4endl;
|
||||
// if ( eventNumber % 5e6 == 0 ) G4cout << "#"<< G4endl;
|
||||
|
||||
// XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
// analysis->PlotCurrentResults();
|
||||
}
|
||||
|
||||
if (HPGeCollID==-1)
|
||||
|
||||
{
|
||||
G4SDManager * SDman = G4SDManager::GetSDMpointer();
|
||||
HPGeCollID = SDman->GetCollectionID("HPGeCollection");
|
||||
//the pointer points to the ID number of the sensitive detector
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoEventAction::EndOfEventAction(const G4Event* evt)
|
||||
@@ -98,26 +153,39 @@ void XrayFluoEventAction::EndOfEventAction(const G4Event* evt)
|
||||
// extracted from hits, compute the total energy deposit (and total charged
|
||||
// track length)
|
||||
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
||||
|
||||
|
||||
|
||||
XrayFluoSensorHitsCollection* HPGeHC = 0;
|
||||
G4int n_hit = 0;
|
||||
G4double totEnergyDetect=0., totEnergy=0, energyD=0.;
|
||||
G4double totEnergyDetect=0., totEnergy=0., energyD=0.;
|
||||
|
||||
if (HCE) HPGeHC = (XrayFluoSensorHitsCollection*)(HCE->GetHC(HPGeCollID));
|
||||
if(HPGeHC)
|
||||
|
||||
|
||||
{
|
||||
n_hit = HPGeHC->entries();
|
||||
|
||||
// if (n_hit) {G4cout << "Ecco quante hit ho nel detector "<< n_hit << G4endl;}
|
||||
|
||||
for (G4int i=0;i<n_hit;i++)
|
||||
{
|
||||
|
||||
totEnergy += (*HPGeHC)[i]->GetEdepTot();
|
||||
|
||||
energyD = ResponseFunction(totEnergy);
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->analyseEnergyDep(energyD);
|
||||
|
||||
totEnergyDetect += energyD;
|
||||
|
||||
|
||||
|
||||
|
||||
energyD = detectorType->ResponseFunction(totEnergy);
|
||||
// energyD = totEnergy;
|
||||
// G4cout << "energy deposit: "<< totEnergy << G4endl;
|
||||
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->analyseEnergyDep(energyD);
|
||||
|
||||
totEnergyDetect += energyD;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,77 +240,5 @@ G4double XrayFluoEventAction::RandomCut(G4double energy)
|
||||
return EdepDetect;
|
||||
|
||||
};
|
||||
G4double XrayFluoEventAction::ResponseFunction(G4double energy)
|
||||
{
|
||||
G4double eMin = 1* keV;
|
||||
G4double eMax = 10*keV;
|
||||
G4double value = 0.;
|
||||
G4double efficiency = 1.;
|
||||
|
||||
const XrayFluoDataSet* dataSet = runManager->GetEfficiencySet();
|
||||
G4int id = 0;
|
||||
|
||||
G4double random = G4UniformRand();
|
||||
|
||||
if (energy>=eMin && energy <=eMax)
|
||||
{
|
||||
G4double infEnergy = (G4int)(energy/keV)* keV;
|
||||
|
||||
G4double supEnergy = ((G4int)(energy/keV) + 1)*keV;
|
||||
|
||||
|
||||
|
||||
G4double infData = runManager->GetInfData(energy, random);
|
||||
|
||||
G4double supData = runManager->GetSupData(energy,random);
|
||||
|
||||
value = (log10(infData)*log10(supEnergy/energy) +
|
||||
log10(supData)*log10(energy/infEnergy)) /
|
||||
log10(supEnergy/infEnergy);
|
||||
value = pow(10,value);
|
||||
}
|
||||
else if (energy<eMin)
|
||||
{
|
||||
G4double infEnergy = eMin;
|
||||
G4double supEnergy = eMin/keV +1*keV;
|
||||
|
||||
G4double infData = runManager->GetInfData(eMin, random);
|
||||
G4double supData = runManager->GetSupData(eMin,random);
|
||||
value = (log10(infData)*log10(supEnergy/eMin) +
|
||||
log10(supData)*log10(eMin/infEnergy)) /
|
||||
log10(supEnergy/infEnergy);
|
||||
value = pow(10,value);
|
||||
value = value-eMin+ energy;
|
||||
|
||||
|
||||
}
|
||||
else if (energy>eMax)
|
||||
{
|
||||
G4double infEnergy = eMax/keV - 1. *keV;
|
||||
G4double supEnergy = eMax;
|
||||
|
||||
G4double infData = runManager->GetInfData(eMax, random);
|
||||
G4double supData = runManager->GetSupData(eMax,random);
|
||||
value = (log10(infData)*log10(supEnergy/eMax) +
|
||||
log10(supData)*log10(eMax/infEnergy)) /
|
||||
log10(supEnergy/infEnergy);
|
||||
value = pow(10,value);
|
||||
value = value+energy- eMax;
|
||||
}
|
||||
G4double RandomNum = G4UniformRand();
|
||||
|
||||
efficiency = dataSet->FindValue(value,id);
|
||||
if ( RandomNum>efficiency )
|
||||
{
|
||||
value = 0.;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoEventActionMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoAnalysisMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -49,14 +49,22 @@ const XrayFluoDataSet* XrayFluoNormalization::Normalize(G4double minIntExtreme,
|
||||
{
|
||||
|
||||
G4VDataSetAlgorithm* interpolation = new G4LogLogInterpolation();
|
||||
XrayFluoDataSet* dataSet =
|
||||
new XrayFluoDataSet(1,fileName,interpolation,keV,1);
|
||||
|
||||
char* path = getenv("XRAYDATA");
|
||||
G4String dirFile;
|
||||
if (path) {
|
||||
G4String pathString(path);
|
||||
dirFile = pathString + "/" + fileName;
|
||||
}
|
||||
else{ dirFile = fileName;}
|
||||
XrayFluoDataSet* dataSet =
|
||||
new XrayFluoDataSet(1,dirFile,interpolation,keV,1);
|
||||
|
||||
G4double integral = Integrate(minIntExtreme, maxIntExtreme, nBins, dataSet);
|
||||
|
||||
G4VDataSetAlgorithm* interpolation2 = new G4LogLogInterpolation();
|
||||
|
||||
XrayFluoDataSet* finalDataSet = new XrayFluoDataSet(1,fileName,interpolation2,keV,1/(integral/keV));
|
||||
XrayFluoDataSet* finalDataSet = new XrayFluoDataSet(1,dirFile,interpolation2,keV,1/(integral/keV));
|
||||
return finalDataSet;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,40 +22,93 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoPhysicsList.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
// 29 Nov 2002 Auger Effect Added (Alfonso.mantero@ge.infn.it)
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoPhysicsList.hh"
|
||||
#include "XrayFluoPhysicsListMessenger.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
|
||||
#include "XrayFluoPlaneDetectorConstruction.hh"
|
||||
#include "XrayFluoMercuryDetectorConstruction.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoDetectorConstruction* p)
|
||||
: G4VUserPhysicsList()
|
||||
: G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
|
||||
|
||||
{
|
||||
pDet = p;
|
||||
defaultCutValue = 0.00001*mm;
|
||||
|
||||
// SetGELowLimit(250*eV);
|
||||
|
||||
defaultCutValue = 0.1*mm;
|
||||
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForProton = 0.00001*mm;
|
||||
cutForProton = 0.001*mm;
|
||||
SetVerboseLevel(1);
|
||||
physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
|
||||
|
||||
G4String regName = "SampleRegion";
|
||||
G4double cutValue = 0.000001 * mm;
|
||||
G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName);
|
||||
G4ProductionCuts* cuts = new G4ProductionCuts;
|
||||
cuts->SetProductionCut(cutValue);
|
||||
reg->SetProductionCuts(cuts);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoPlaneDetectorConstruction* p)
|
||||
: G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
|
||||
{
|
||||
planeDet = p;
|
||||
|
||||
// SetGELowLimit(250*eV);
|
||||
|
||||
defaultCutValue = 0.000001*mm;
|
||||
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForProton = 0.001*mm;
|
||||
SetVerboseLevel(1);
|
||||
physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoMercuryDetectorConstruction* p)
|
||||
: G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
|
||||
{
|
||||
mercuryDet = p;
|
||||
|
||||
// SetGELowLimit(250*eV);
|
||||
|
||||
defaultCutValue = 0.000001*mm;
|
||||
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForProton = 0.001*mm;
|
||||
SetVerboseLevel(1);
|
||||
physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
|
||||
}
|
||||
@@ -150,38 +203,43 @@ void XrayFluoPhysicsList::ConstructEM()
|
||||
pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
|
||||
|
||||
LePeprocess = new G4LowEnergyPhotoElectric();
|
||||
//LePeprocess->ActivateAuger(false);
|
||||
//LePeprocess->SetCutForLowEnSecPhotons(10000 * keV);
|
||||
//LePeprocess->SetCutForLowEnSecElectrons(10000 * keV);
|
||||
|
||||
LePeprocess->ActivateAuger(true);
|
||||
LePeprocess->SetCutForLowEnSecPhotons(0.250 * keV);
|
||||
LePeprocess->SetCutForLowEnSecElectrons(0.250 * keV);
|
||||
|
||||
pmanager->AddDiscreteProcess(LePeprocess);
|
||||
|
||||
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
|
||||
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh("Rayleigh"));
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
|
||||
LeIoprocess = new G4LowEnergyIonisation();
|
||||
//LeIoprocess->ActivateAuger(false);
|
||||
//LeIoprocess->SetCutForLowEnSecPhotons(10000 keV);
|
||||
//LeIoprocess->SetCutForLowEnSecElectrons(10000 keV);
|
||||
pmanager->AddProcess(LeIoprocess, -1, 2, 2);
|
||||
|
||||
LeIoprocess = new G4LowEnergyIonisation("IONI");
|
||||
LeIoprocess->ActivateAuger(true);
|
||||
//eIoProcess = new G4eIonisation("stdIONI");
|
||||
LeIoprocess->SetCutForLowEnSecPhotons(0.1*keV);
|
||||
LeIoprocess->SetCutForLowEnSecElectrons(0.1*keV);
|
||||
pmanager->AddProcess(LeIoprocess, -1, 2, 2);
|
||||
|
||||
LeBrprocess = new G4LowEnergyBremsstrahlung();
|
||||
pmanager->AddProcess(LeBrprocess, -1, -1, 3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
|
||||
|
||||
}
|
||||
}
|
||||
else if (particleName == "proton") {
|
||||
//proton
|
||||
G4hLowEnergyIonisation* hIoni = new G4hLowEnergyIonisation;
|
||||
hIoni->SetFluorescence(true);
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
|
||||
pmanager->AddProcess(new G4hLowEnergyIonisation,-1, 2,2);
|
||||
pmanager->AddProcess(hIoni,-1, 2,2);
|
||||
}
|
||||
else if ( particleName == "alpha" )
|
||||
{
|
||||
@@ -195,6 +253,47 @@ void XrayFluoPhysicsList::ConstructEM()
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// void XrayFluoPhysicsList::SetGELowLimit(G4double lowcut)
|
||||
// {
|
||||
// if (verboseLevel >0){
|
||||
// G4cout << "XrayFluoPhysicsList::SetCuts:";
|
||||
// G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
// }
|
||||
|
||||
// G4Gamma::SetEnergyRange(lowcut,1e5);
|
||||
// G4Electron::SetEnergyRange(lowcut,1e5);
|
||||
// G4Positron::SetEnergyRange(lowcut,1e5);
|
||||
|
||||
// }
|
||||
|
||||
// void XrayFluoPhysicsList::SetGammaLowLimit(G4double lowcut)
|
||||
// {
|
||||
// if (verboseLevel >0){
|
||||
// G4cout << "XrayFluoPhysicsList::SetCuts:";
|
||||
// G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
// }
|
||||
|
||||
// G4Gamma::SetEnergyRange(lowcut,1e5);
|
||||
|
||||
// }
|
||||
|
||||
// void XrayFluoPhysicsList::SetElectronLowLimit(G4double lowcut)
|
||||
// {
|
||||
// if (verboseLevel >0){
|
||||
|
||||
// G4cout << "XrayFluoPhysicsList::SetCuts:";
|
||||
// G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
|
||||
// }
|
||||
|
||||
// G4Electron::SetEnergyRange(lowcut,1e5);
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
void XrayFluoPhysicsList::SetGammaCut(G4double val)
|
||||
{
|
||||
ResetCuts();
|
||||
@@ -203,6 +302,8 @@ void XrayFluoPhysicsList::SetGammaCut(G4double val)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
void XrayFluoPhysicsList::SetElectronCut(G4double val)
|
||||
{
|
||||
ResetCuts();
|
||||
@@ -215,7 +316,7 @@ void XrayFluoPhysicsList::SetCuts(){
|
||||
SetCutValue(cutForElectron,"e-");
|
||||
SetCutValue(cutForElectron,"e+");
|
||||
SetCutValue(cutForProton, "proton");
|
||||
SetCutValue(cutForProton, "alpha");
|
||||
//SetCutValueForOthers(cutForProton);
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
@@ -223,7 +324,7 @@ void XrayFluoPhysicsList::SetCuts(){
|
||||
|
||||
void XrayFluoPhysicsList::SetLowEnSecPhotCut(G4double cut){
|
||||
|
||||
G4cout<<"Low energy secondary photons cut is now set to: "<<cut*MeV<<" (MeV)"<<G4endl;
|
||||
G4cout<<"Low energy secondary photons cut is now set to: "<<cut/MeV<<" (MeV)"<<G4endl;
|
||||
G4cout<<"for processes LowEnergyBremsstrahlung, LowEnergyPhotoElectric, LowEnergyIonisation"<<G4endl;
|
||||
LeBrprocess->SetCutForLowEnSecPhotons(cut);
|
||||
LePeprocess->SetCutForLowEnSecPhotons(cut);
|
||||
@@ -232,7 +333,7 @@ void XrayFluoPhysicsList::SetLowEnSecPhotCut(G4double cut){
|
||||
|
||||
void XrayFluoPhysicsList::SetLowEnSecElecCut(G4double cut){
|
||||
|
||||
G4cout<<"Low energy secondary electrons cut is now set to: "<<cut*MeV<<" (MeV)"<<G4endl;
|
||||
G4cout<<"Low energy secondary electrons cut is now set to: "<<cut/MeV<<" (MeV)"<<G4endl;
|
||||
|
||||
G4cout<<"for processes LowEnergyIonisation"<<G4endl;
|
||||
|
||||
@@ -251,18 +352,35 @@ void XrayFluoPhysicsList::SetProtonCut(G4double val)
|
||||
void XrayFluoPhysicsList::SetCutsByEnergy(G4double val)
|
||||
{
|
||||
G4ParticleTable* theXrayFluoParticleTable = G4ParticleTable::GetParticleTable();
|
||||
G4Material* currMat = pDet->GetSampleMaterial();
|
||||
|
||||
G4Material* currMat;
|
||||
|
||||
if(pDet){
|
||||
currMat = pDet->XrayFluoDetectorConstruction::GetSampleMaterial();
|
||||
}
|
||||
else if(planeDet){
|
||||
currMat = planeDet->XrayFluoPlaneDetectorConstruction::GetPlaneMaterial();
|
||||
}
|
||||
|
||||
else if(mercuryDet){
|
||||
currMat = mercuryDet->GetMercuryMaterial();
|
||||
}
|
||||
|
||||
G4ParticleDefinition* part;
|
||||
G4double cut;
|
||||
|
||||
|
||||
part = theXrayFluoParticleTable->FindParticle("e-");
|
||||
cut = G4EnergyLossTables::GetRange(part,val,currMat);
|
||||
SetCutValue(cut, "e-");
|
||||
|
||||
|
||||
part = theXrayFluoParticleTable->FindParticle("proton");
|
||||
cut = G4EnergyLossTables::GetRange(part,val,currMat);
|
||||
SetCutValue(cut, "proton");
|
||||
|
||||
// part = theXrayFluoParticleTable->FindParticle("gamma");
|
||||
// cut = G4EnergyLossTables::GetRange(part,val,currMat);
|
||||
// SetCutValue(cut, "gamma");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -280,18 +398,6 @@ void XrayFluoPhysicsList::SetCutsByEnergy(G4double val)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoPhysicsListMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -49,6 +49,27 @@ XrayFluoPhysicsListMessenger::XrayFluoPhysicsListMessenger(XrayFluoPhysicsList *
|
||||
lowEnDir = new G4UIdirectory("/lowenergy/");
|
||||
lowEnDir->SetGuidance("LowEnergy commands");
|
||||
|
||||
// cutGLowLimCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/lowlimG",this);
|
||||
// cutGLowLimCmd->SetGuidance("Set ENERGY low limit for Gamma.");
|
||||
// cutGLowLimCmd->SetParameterName("energy",true);
|
||||
// cutGLowLimCmd->SetDefaultValue(1e-3);
|
||||
// cutGLowLimCmd->SetDefaultUnit("MeV");
|
||||
// cutGLowLimCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
// cutELowLimCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/lowlimE",this);
|
||||
// cutELowLimCmd->SetGuidance("Set ENERGY low limit for e-.");
|
||||
// cutELowLimCmd->SetParameterName("energy",true);
|
||||
// cutELowLimCmd->SetDefaultValue(1e-3);
|
||||
// cutELowLimCmd->SetDefaultUnit("MeV");
|
||||
// cutELowLimCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
// cutGELowLimCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/lowlimGE",this);
|
||||
// cutGELowLimCmd->SetGuidance("Set ENERGY low limit for e- and Gamma.");
|
||||
// cutGELowLimCmd->SetParameterName("energy",true);
|
||||
// cutGELowLimCmd->SetDefaultValue(1e-3);
|
||||
// cutGELowLimCmd->SetDefaultUnit("MeV");
|
||||
// cutGELowLimCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
cutSecPhotCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/secphotcut",this);
|
||||
cutSecPhotCmd->SetGuidance("Set production threshold for secondary Gamma.");
|
||||
cutSecPhotCmd->SetParameterName("energy",true);
|
||||
@@ -85,7 +106,7 @@ XrayFluoPhysicsListMessenger::XrayFluoPhysicsListMessenger(XrayFluoPhysicsList *
|
||||
cutPCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
eCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/cutEnergy",this);
|
||||
eCmd->SetGuidance("Set cut values by ENERGY for charged particles.");
|
||||
eCmd->SetGuidance("Set cut values by ENERGY for all particles.");
|
||||
eCmd->SetParameterName("cutenergy",false);
|
||||
eCmd->SetRange("cutenergy>0.");
|
||||
eCmd->SetUnitCategory("Energy");
|
||||
@@ -97,6 +118,10 @@ XrayFluoPhysicsListMessenger::XrayFluoPhysicsListMessenger(XrayFluoPhysicsList *
|
||||
|
||||
XrayFluoPhysicsListMessenger::~XrayFluoPhysicsListMessenger()
|
||||
{
|
||||
|
||||
// delete cutGLowLimCmd;
|
||||
// delete cutELowLimCmd;
|
||||
// delete cutGELowLimCmd;
|
||||
delete cutSecElecCmd;
|
||||
delete cutSecPhotCmd;
|
||||
delete cutGCmd;
|
||||
@@ -110,6 +135,15 @@ XrayFluoPhysicsListMessenger::~XrayFluoPhysicsListMessenger()
|
||||
|
||||
void XrayFluoPhysicsListMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
// if(command == cutGLowLimCmd)
|
||||
// { XrayFluoList->SetGammaLowLimit(cutGLowLimCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
// if(command == cutELowLimCmd)
|
||||
// { XrayFluoList->SetElectronLowLimit(cutELowLimCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
// if(command == cutGELowLimCmd)
|
||||
// { XrayFluoList->SetGELowLimit(cutGELowLimCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if(command == cutSecPhotCmd)
|
||||
{ XrayFluoList->SetLowEnSecPhotCut(cutSecPhotCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
@@ -122,10 +156,10 @@ void XrayFluoPhysicsListMessenger::SetNewValue(G4UIcommand* command,G4String new
|
||||
if(command == cutECmd)
|
||||
{ XrayFluoList->SetElectronCut(cutECmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if(command == cutPCmd)
|
||||
if(command == cutPCmd)
|
||||
{ XrayFluoList->SetProtonCut(cutPCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if(command == eCmd)
|
||||
if(command == eCmd)
|
||||
{ XrayFluoList->SetCutsByEnergy(eCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoPrimaryGeneratorAction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -47,11 +47,12 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPrimaryGeneratorAction::XrayFluoPrimaryGeneratorAction(
|
||||
XrayFluoDetectorConstruction* XrayFluoDC)
|
||||
:XrayFluoDetector(XrayFluoDC),rndmFlag("off"),
|
||||
beam("off"),spectrum("off"),isoVert("off")
|
||||
XrayFluoPrimaryGeneratorAction::XrayFluoPrimaryGeneratorAction(XrayFluoDetectorConstruction* XrayFluoDC)
|
||||
:rndmFlag("off"),beam("off"),spectrum("off"),isoVert("off")
|
||||
{
|
||||
|
||||
XrayFluoDetector = XrayFluoDC;
|
||||
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
@@ -68,9 +69,12 @@ XrayFluoPrimaryGeneratorAction::XrayFluoPrimaryGeneratorAction(
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
|
||||
particleGun->SetParticleEnergy(6.*keV);
|
||||
|
||||
particleGun->SetParticleEnergy(10.*keV);
|
||||
G4double position = -0.5*(XrayFluoDetector->GetWorldSizeZ());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
|
||||
|
||||
G4cout << "XrayFluoPrimaryGeneratorAction created" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
@@ -82,6 +86,9 @@ XrayFluoPrimaryGeneratorAction::~XrayFluoPrimaryGeneratorAction()
|
||||
delete particleGun;
|
||||
delete gunMessenger;
|
||||
delete runManager;
|
||||
|
||||
G4cout << "XrayFluoPrimaryGeneratorAction deleted" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -93,8 +100,8 @@ void XrayFluoPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
G4double z0 = -0.5*(XrayFluoDetector->GetWorldSizeZ());
|
||||
G4double y0 = 0.*cm, x0 = 0.*cm;
|
||||
if (rndmFlag == "on")
|
||||
{y0 = (XrayFluoDetector->GetSampleSizeXY())*(G4UniformRand()-0.5);
|
||||
x0 = (XrayFluoDetector->GetSampleSizeXY())*(G4UniformRand()-0.5);
|
||||
{y0 = (XrayFluoDetector->GetDia3SizeXY())/sqrt(2.)*(G4UniformRand()-0.5); // it was GetSampleSizeXY(),
|
||||
x0 = (XrayFluoDetector->GetDia3SizeXY())/sqrt(2.)*(G4UniformRand()-0.5); // not divided by sqrt(2.)
|
||||
}
|
||||
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
|
||||
|
||||
@@ -149,9 +156,9 @@ void XrayFluoPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4double random = G4UniformRand();
|
||||
|
||||
G4double randomNum = G4UniformRand()*5.0E6;
|
||||
G4double randomNum = G4UniformRand(); //*5.0E6;
|
||||
|
||||
particleEnergy = random * energyRange;
|
||||
particleEnergy = (random*energyRange) + minEnergy;
|
||||
|
||||
if ((dataSet->FindValue(particleEnergy,id)) > randomNum)
|
||||
{
|
||||
@@ -198,3 +205,11 @@ void XrayFluoPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoPrimarygeneratorMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -73,6 +73,8 @@ XrayFluoPrimaryGeneratorMessenger::XrayFluoPrimaryGeneratorMessenger(XrayFluoPri
|
||||
isoVert->SetCandidates("on off");
|
||||
isoVert->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
G4cout << "XrayFluoPrimaryGeneratorMessenger created" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -83,6 +85,9 @@ XrayFluoPrimaryGeneratorMessenger::~XrayFluoPrimaryGeneratorMessenger()
|
||||
delete RndmVert;
|
||||
delete spectrum;
|
||||
delete isoVert;
|
||||
|
||||
G4cout << "XrayFluoPrimaryGeneratorMessenger deleted" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoRunAction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -50,7 +50,7 @@
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
XrayFluoRunAction::XrayFluoRunAction()
|
||||
:dataSet(0),dataGammaSet(0),dataAlphaSet(0),efficiencySet(0)
|
||||
:dataSet(0),dataGammaSet(0),dataAlphaSet(0)
|
||||
{
|
||||
XrayFluoNormalization normalization;
|
||||
|
||||
@@ -58,25 +58,28 @@ XrayFluoRunAction::XrayFluoRunAction()
|
||||
data = new G4DataVector;
|
||||
|
||||
|
||||
ReadData(MeV, "/examples/advanced/xray_fluorescence/mercury_flx_solmin");
|
||||
ReadResponse("/examples/advanced/xray_fluorescence/response");
|
||||
ReadData(MeV,"mercury_flx_solmin");
|
||||
//ReadResponse("SILIresponse");
|
||||
|
||||
G4double minGamma = 0.*keV;
|
||||
G4double maxGamma = 10. *keV;
|
||||
G4int nBinsGamma = 100;
|
||||
G4int nBinsGamma = 5;
|
||||
|
||||
|
||||
dataGammaSet = normalization.Normalize(minGamma, maxGamma, nBinsGamma,
|
||||
"/examples/advanced/xray_fluorescence/B_flare");
|
||||
|
||||
G4String fileName = "/examples/advanced/xray_fluorescence/efficienza";
|
||||
G4VDataSetAlgorithm* interpolation4 = new G4LogLogInterpolation();
|
||||
efficiencySet = new XrayFluoDataSet(1,fileName,interpolation4,keV,1);
|
||||
delete interpolation4;
|
||||
"FlatSpectrum");
|
||||
|
||||
|
||||
//G4String fileName = "SILIefficiency";
|
||||
//G4VDataSetAlgorithm* interpolation4 = new G4LogLogInterpolation();
|
||||
//efficiencySet = new XrayFluoDataSet(1,fileName,interpolation4,keV,1);
|
||||
//delete interpolation4;
|
||||
G4cout << "XrayFluoRunAction created" << G4endl;
|
||||
}
|
||||
#else
|
||||
XrayFluoRunAction::XrayFluoRunAction()
|
||||
{
|
||||
G4cout << "XrayFluoRunAction created" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -85,29 +88,35 @@ XrayFluoRunAction::XrayFluoRunAction()
|
||||
|
||||
XrayFluoRunAction::~XrayFluoRunAction()
|
||||
{
|
||||
std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos;
|
||||
|
||||
//std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos;
|
||||
|
||||
for (pos = energyMap.begin(); pos != energyMap.end(); pos++)
|
||||
{
|
||||
G4DataVector* dataSet = (*pos).second;
|
||||
delete dataSet;
|
||||
dataSet = 0;
|
||||
}
|
||||
for (pos = dataMap.begin(); pos != dataMap.end(); pos++)
|
||||
{
|
||||
G4DataVector* dataSet = (*pos).second;
|
||||
delete dataSet;
|
||||
dataSet = 0;
|
||||
}
|
||||
// delete energies;
|
||||
// delete data;
|
||||
// G4cout << "energies and data deleted " << G4endl;
|
||||
|
||||
//for (pos = energyMap.begin(); pos != energyMap.end(); pos++)
|
||||
//{
|
||||
// G4DataVector* dataSet = (*pos).second;
|
||||
// delete dataSet;
|
||||
// dataSet = 0;
|
||||
// }
|
||||
//for (pos = dataMap.begin(); pos != dataMap.end(); pos++)
|
||||
// {
|
||||
// G4DataVector* dataSet = (*pos).second;
|
||||
// delete dataSet;
|
||||
// dataSet = 0;
|
||||
// }
|
||||
|
||||
|
||||
G4cout << "XrayFluoRunAction deleted" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
XrayFluoRunAction::~XrayFluoRunAction()
|
||||
{
|
||||
|
||||
G4cout << "XrayFluoRunAction deleted" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -117,7 +126,6 @@ void XrayFluoRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
|
||||
G4cout << "### Run " << aRun << " start." << G4endl;
|
||||
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
@@ -128,25 +136,24 @@ void XrayFluoRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
// Book histograms and ntuples
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->book();
|
||||
// analysis->InitializePlotter();
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoRunAction::EndOfRunAction(const G4Run* aRun )
|
||||
void XrayFluoRunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
|
||||
if (aRun){
|
||||
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
|
||||
|
||||
// Run ended, update the visualization
|
||||
if (G4VVisManager::GetConcreteInstance()) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
analysis->finish();
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
|
||||
// Run ended, update the visualization
|
||||
if (G4VVisManager::GetConcreteInstance()) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
analysis->finish();
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -164,10 +171,10 @@ const XrayFluoDataSet* XrayFluoRunAction::GetAlphaSet()
|
||||
{
|
||||
return dataAlphaSet;
|
||||
}
|
||||
const XrayFluoDataSet* XrayFluoRunAction::GetEfficiencySet()
|
||||
{
|
||||
return efficiencySet;
|
||||
}
|
||||
//const XrayFluoDataSet* XrayFluoRunAction::GetEfficiencySet()
|
||||
//{
|
||||
// return efficiencySet;
|
||||
//}
|
||||
G4DataVector* XrayFluoRunAction::GetEnergies()
|
||||
{
|
||||
return energies;
|
||||
@@ -186,89 +193,6 @@ G4double XrayFluoRunAction::GetDataSum()
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
G4double XrayFluoRunAction::GetInfData(G4double energy, G4double random)
|
||||
{
|
||||
G4double value = 0.;
|
||||
G4int zMin = 1;
|
||||
G4int zMax = 10;
|
||||
|
||||
G4int Z = ((G4int)(energy/keV));
|
||||
|
||||
if (Z<zMin) {Z=zMin;}
|
||||
if (Z>zMax) {Z=zMax;}
|
||||
|
||||
if (Z >= zMin && Z <= zMax)
|
||||
{
|
||||
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
|
||||
pos = energyMap.find(Z);
|
||||
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posData;
|
||||
posData = dataMap.find(Z);
|
||||
if (pos!= energyMap.end())
|
||||
{
|
||||
G4DataVector energySet = *((*pos).second);
|
||||
G4DataVector dataSet = *((*posData).second);
|
||||
G4int nData = energySet.size();
|
||||
|
||||
G4double partSum = 0;
|
||||
G4int index = 0;
|
||||
|
||||
while (random> partSum)
|
||||
{
|
||||
partSum += dataSet[index];
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
if (index >= 0 && index < nData)
|
||||
{
|
||||
value = energySet[index];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
G4double XrayFluoRunAction::GetSupData(G4double energy, G4double random)
|
||||
{
|
||||
G4double value = 0.;
|
||||
G4int zMin = 1;
|
||||
G4int zMax = 10;
|
||||
G4int Z = ((G4int)(energy/keV)+1);
|
||||
|
||||
if (Z<zMin) {Z=zMin;}
|
||||
if (Z>zMax) {Z=zMax;}
|
||||
if (Z >= zMin && Z <= zMax)
|
||||
{
|
||||
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
|
||||
pos = energyMap.find(Z);
|
||||
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posData;
|
||||
posData = dataMap.find(Z);
|
||||
if (pos!= energyMap.end())
|
||||
{
|
||||
G4DataVector energySet = *((*pos).second);
|
||||
G4DataVector dataSet = *((*posData).second);
|
||||
G4int nData = energySet.size();
|
||||
G4double partSum = 0;
|
||||
G4int index = 0;
|
||||
|
||||
while (random> partSum)
|
||||
{
|
||||
partSum += dataSet[index];
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
if (index >= 0 && index < nData)
|
||||
{
|
||||
value = energySet[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void XrayFluoRunAction::ReadData(G4double unitE, G4String fileName)
|
||||
@@ -280,7 +204,7 @@ void XrayFluoRunAction::ReadData(G4double unitE, G4String fileName)
|
||||
|
||||
G4String name(nameChar);
|
||||
|
||||
char* path = getenv("G4INSTALL");
|
||||
char* path = getenv("XRAYDATA");
|
||||
|
||||
G4String pathString(path);
|
||||
G4String dirFile = pathString + "/" + name;
|
||||
@@ -333,86 +257,15 @@ void XrayFluoRunAction::ReadData(G4double unitE, G4String fileName)
|
||||
file.close();
|
||||
}
|
||||
|
||||
void XrayFluoRunAction::ReadResponse(const G4String& fileName)
|
||||
{
|
||||
char nameChar[100] = {""};
|
||||
std::ostrstream ost(nameChar, 100, std::ios::out);
|
||||
|
||||
|
||||
ost << fileName<<".dat";
|
||||
|
||||
G4String name(nameChar);
|
||||
|
||||
char* path = getenv("G4INSTALL");
|
||||
|
||||
G4String pathString(path);
|
||||
G4String dirFile = pathString + "/" + name;
|
||||
std::ifstream file(dirFile);
|
||||
std::filebuf* lsdp = file.rdbuf();
|
||||
|
||||
if (! (lsdp->is_open()) )
|
||||
{
|
||||
G4String excep = "XrayFluoRunAction - data file: " + dirFile + " not found";
|
||||
G4Exception(excep);
|
||||
}
|
||||
G4double a = 0;
|
||||
G4int k = 1;
|
||||
G4int s = 0;
|
||||
|
||||
G4int Z = 1;
|
||||
G4DataVector* energies = new G4DataVector;
|
||||
G4DataVector* data = new G4DataVector;
|
||||
|
||||
do
|
||||
{
|
||||
file >> a;
|
||||
G4int nColumns = 2;
|
||||
if (a == -1)
|
||||
{
|
||||
if (s == 0)
|
||||
{
|
||||
// End of a data set
|
||||
energyMap[Z] = energies;
|
||||
dataMap[Z] = data;
|
||||
// Start of new shell data set
|
||||
energies = new G4DataVector;
|
||||
data = new G4DataVector;
|
||||
Z++;
|
||||
}
|
||||
s++;
|
||||
if (s == nColumns)
|
||||
{
|
||||
s = 0;
|
||||
}
|
||||
}
|
||||
else if (a == -2)
|
||||
{
|
||||
// End of file; delete the empty vectors
|
||||
//created when encountering the last -1 -1 row
|
||||
delete energies;
|
||||
delete data;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 1st column is energy
|
||||
if(k%nColumns != 0)
|
||||
{
|
||||
G4double e = a * keV;
|
||||
energies->push_back(e);
|
||||
k++;
|
||||
}
|
||||
else if (k%nColumns == 0)
|
||||
{
|
||||
// 2nd column is data
|
||||
|
||||
data->push_back(a);
|
||||
k = 1;
|
||||
}
|
||||
}
|
||||
} while (a != -2); // end of file
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoSensorHit.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// 29 Nov 2002 Alfonso Mantero minor modifications (Alfonso.mantero@ge.infn.it)
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoSensorHit.hh"
|
||||
@@ -40,28 +40,30 @@ G4Allocator<XrayFluoSensorHit> XrayFluoSensorHitAllocator;
|
||||
|
||||
XrayFluoSensorHit::XrayFluoSensorHit()
|
||||
{
|
||||
EdepTot = 0.;
|
||||
EdepDetect = 0.;
|
||||
|
||||
|
||||
}
|
||||
EdepTot = 0.;
|
||||
EdepDetect = 0.;
|
||||
|
||||
|
||||
// G4cout << "XrayFluoSensorHit created" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSensorHit::XrayFluoSensorHit(const XrayFluoSensorHit& right)
|
||||
:G4VHit(right)
|
||||
XrayFluoSensorHit::XrayFluoSensorHit(const XrayFluoSensorHit& right):
|
||||
G4VHit(right)
|
||||
{
|
||||
|
||||
EdepTot = right.EdepTot ;
|
||||
|
||||
EdepDetect = right.EdepDetect;
|
||||
|
||||
|
||||
//G4cout << "XrayFluoSensorHit created" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSensorHit::~XrayFluoSensorHit()
|
||||
{
|
||||
|
||||
//G4cout << "XrayFluo SensorHit deleted" << G4endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,10 +79,8 @@ const XrayFluoSensorHit& XrayFluoSensorHit::operator=(const XrayFluoSensorHit& r
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
int XrayFluoSensorHit::operator==(const XrayFluoSensorHit& right) const
|
||||
int XrayFluoSensorHit::operator==(const XrayFluoSensorHit&) const
|
||||
{
|
||||
if(EdepTot == right.EdepTot && EdepDetect == right.EdepDetect)
|
||||
{return 1;}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -103,3 +103,4 @@ void XrayFluoSensorHit::Print()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoSteppingAction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -32,24 +32,31 @@
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "XrayFluoSteppingAction.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4TrackVector.hh"
|
||||
#include "G4ios.hh"
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
#include "G4ios.hh"
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSteppingAction::XrayFluoSteppingAction()
|
||||
{ }
|
||||
XrayFluoSteppingAction::XrayFluoSteppingAction()
|
||||
:mercuryFlag(false)
|
||||
{
|
||||
G4cout << "XrayFluoSteppingAction created" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSteppingAction::~XrayFluoSteppingAction()
|
||||
{ }
|
||||
{
|
||||
G4cout << "XrayFluoSteppingAction deleted" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -59,7 +66,21 @@ void XrayFluoSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->analyseStepping(aStep);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (mercuryFlag){
|
||||
XrayFluoMercuryDetectorConstruction* detector = XrayFluoMercuryDetectorConstruction::GetInstance();
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()) {
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "DetectorOptic") {
|
||||
G4ThreeVector particlePosition = aStep->GetPostStepPoint()->GetPosition();
|
||||
G4ThreeVector detectorPosition = detector->GetOptic()->GetObjectTranslation();
|
||||
G4ThreeVector newDirection = detectorPosition - particlePosition;
|
||||
aStep->GetPostStepPoint()->SetMomentumDirection(newDirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoSteppingVerbose.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -41,12 +41,18 @@
|
||||
XrayFluoSteppingVerbose::XrayFluoSteppingVerbose()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
G4cout << "XrayFluoSteppingVerbose created" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
XrayFluoSteppingVerbose::~XrayFluoSteppingVerbose()
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
G4cout << "XrayFluoSteppingVerbose deleted" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoVisManager.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V04-01-03
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "G4DAWNFILE.hh"
|
||||
#include "G4GAGTree.hh"
|
||||
#include "G4HepRepFile.hh"
|
||||
#include "G4HepRep.hh"
|
||||
#include "G4RayTracer.hh"
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
@@ -100,10 +99,9 @@ void XrayFluoVisManager::RegisterGraphicsSystems () {
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
RegisterGraphicsSystem (new G4GAGTree);
|
||||
RegisterGraphicsSystem (new G4HepRepFile);
|
||||
RegisterGraphicsSystem (new G4HepRep);
|
||||
RegisterGraphicsSystem (new G4RayTracer);
|
||||
// RegisterGraphicsSystem (new G4VRML1File);
|
||||
//RegisterGraphicsSystem (new G4VRML2File);
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
|
||||
// Graphics systems needing external packages or libraries...
|
||||
|
||||
@@ -138,13 +136,13 @@ void XrayFluoVisManager::RegisterGraphicsSystems () {
|
||||
#ifdef G4VIS_USE_OIWIN32
|
||||
RegisterGraphicsSystem (new G4OpenInventorWin32);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
#ifdef G4VIS_USE_VRML
|
||||
RegisterGraphicsSystem (new G4VRML1);
|
||||
RegisterGraphicsSystem (new G4VRML2);
|
||||
#endif
|
||||
|
||||
*/
|
||||
if (fVerbose > 0) {
|
||||
G4cout <<
|
||||
"\nYou have successfully chosen to use the following graphics systems."
|
||||
|
||||
Reference in New Issue
Block a user