Import Geant4 4.0.0 source tree
This commit is contained in:
@@ -0,0 +1,323 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoAnalysisManager.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 06 Dec 2001 A.Pfeiffer updated for singleton
|
||||
// 30 Nov 2001 Guy Barrand : migrate to AIDA-2.2.
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include <AIDA/IAnalysisFactory.h>
|
||||
#include <AIDA/ITreeFactory.h>
|
||||
#include <AIDA/ITree.h>
|
||||
#include <AIDA/IHistogramFactory.h>
|
||||
#include <AIDA/IHistogram1D.h>
|
||||
#include <AIDA/ITupleFactory.h>
|
||||
#include <AIDA/ITuple.h>
|
||||
#endif
|
||||
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
#include "XrayFluoAnalysisMessenger.hh"
|
||||
#include "G4Step.hh"
|
||||
|
||||
XrayFluoAnalysisManager* XrayFluoAnalysisManager::instance = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisManager::XrayFluoAnalysisManager()
|
||||
:analysisMessenger(0)
|
||||
,analysisFactory(0)
|
||||
,histo_1(0)
|
||||
,histo_2(0)
|
||||
,histo_3(0)
|
||||
,histo_4(0)
|
||||
,histo_5(0)
|
||||
,histo_6(0)
|
||||
,histo_7(0)
|
||||
,histo_8(0)
|
||||
,histo_9(0)
|
||||
,tuple(0)
|
||||
{
|
||||
analysisMessenger = new XrayFluoAnalysisMessenger(this);
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// Hooking an AIDA compliant analysis system.
|
||||
analysisFactory = AIDA_createAnalysisFactory();
|
||||
if(analysisFactory) {
|
||||
|
||||
ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
|
||||
if(treeFactory) {
|
||||
// tree = treeFactory->create(); // Tree in memory.
|
||||
tree = treeFactory->create("XrayFluo.root",false,false,"ROOT");
|
||||
|
||||
delete treeFactory; // Will not delete the ITree.
|
||||
}
|
||||
|
||||
/*
|
||||
// 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;
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisManager::~XrayFluoAnalysisManager()
|
||||
{
|
||||
|
||||
delete analysisMessenger;
|
||||
analysisMessenger = 0;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
delete analysisFactory;
|
||||
analysisFactory = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisManager* XrayFluoAnalysisManager::getInstance()
|
||||
{
|
||||
if (instance == 0) instance = new XrayFluoAnalysisManager;
|
||||
return instance;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::book()
|
||||
{
|
||||
IHistogramFactory* histogramFactory =
|
||||
analysisFactory->createHistogramFactory(*tree);
|
||||
|
||||
if(histogramFactory) {
|
||||
|
||||
// Book histograms
|
||||
histo_1 = histogramFactory->create1D
|
||||
("1","Energy Deposit", 100,0.,10.);
|
||||
histo_2 = histogramFactory->create1D
|
||||
("2","Gamma born in the sample", 100,0.,10.);
|
||||
histo_3 = histogramFactory->create1D
|
||||
("3","Electrons born in the sample", 100,0.,10.);
|
||||
histo_4 = histogramFactory->create1D
|
||||
("4","Gammas leaving the sample", 100,0.,10.);
|
||||
histo_5 = histogramFactory->create1D
|
||||
("5","Electrons leaving the sample ", 100,0.,10.);
|
||||
histo_6 = histogramFactory->create1D
|
||||
("6","Gammas reaching the detector", 100,0.,10.);
|
||||
histo_7 = histogramFactory->create1D
|
||||
("7","Spectrum of the incident particles", 100,0.,10.);
|
||||
histo_8 = histogramFactory->create1D
|
||||
("8","Protons reaching the detector", 100,0.,10.);
|
||||
histo_9 = histogramFactory->create1D
|
||||
("9","Protons leaving the sample", 100,0.,10.);
|
||||
|
||||
delete histogramFactory;
|
||||
}
|
||||
|
||||
|
||||
// Get a tuple factory :
|
||||
ITupleFactory* tupleFactory = analysisFactory->createTupleFactory(*tree);
|
||||
if(tupleFactory) {
|
||||
|
||||
// Create a tuple :
|
||||
tuple = tupleFactory->create
|
||||
("XrayFluo","XrayFluo","energy counts");
|
||||
|
||||
delete tupleFactory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::finish()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(tree) tree->commit(); // Write histos and tuple in file.
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::analyseStepping(const G4Step* aStep)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
G4double gammaAtTheDetPre=0;
|
||||
G4double protonsAtTheDetPre=0;
|
||||
G4double gammaLeavingSample=0;
|
||||
G4double eleLeavingSample=0;
|
||||
G4double protonsLeavSam=0;
|
||||
G4double gammaBornInSample=0;
|
||||
G4double eleBornInSample=0;
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Sample"){
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "World" )
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
{
|
||||
gammaLeavingSample =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_4) {
|
||||
histo_4->fill(gammaLeavingSample/keV);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Sample"){
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "World" )
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "e-" )
|
||||
{
|
||||
eleLeavingSample = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_5) {
|
||||
histo_5->fill(eleLeavingSample/keV);
|
||||
}
|
||||
}
|
||||
else if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "proton" )
|
||||
{
|
||||
protonsLeavSam = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_3) {
|
||||
histo_3->fill(protonsLeavSam/keV);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
|
||||
{if(1== (aStep->GetTrack()->GetCurrentStepNumber()))
|
||||
|
||||
{if(0 != aStep->GetTrack()->GetParentID())
|
||||
|
||||
{if(aStep->GetTrack()->GetVolume()->GetName() == "Sample")
|
||||
{
|
||||
gammaBornInSample = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_2) {
|
||||
histo_2->fill(gammaBornInSample);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "e-" )
|
||||
|
||||
{if(1== (aStep->GetTrack()->GetCurrentStepNumber()))
|
||||
|
||||
{if(0 != aStep->GetTrack()->GetParentID())
|
||||
|
||||
{if(aStep->GetTrack()->GetVolume()->GetName() == "Sample")
|
||||
{
|
||||
eleBornInSample = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_3) {
|
||||
histo_3->fill(eleBornInSample);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()){
|
||||
|
||||
if(aStep->GetTrack()->GetVolume()->GetName() == "World"){
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "HPGeDetector")
|
||||
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
{
|
||||
gammaAtTheDetPre =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_6) {
|
||||
histo_6->fill( gammaAtTheDetPre);
|
||||
}
|
||||
}
|
||||
else if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "proton" )
|
||||
{
|
||||
protonsAtTheDetPre =
|
||||
(aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
if(histo_8) {
|
||||
histo_8->fill( protonsAtTheDetPre);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::analyseEnergyDep(G4double energyDep)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(histo_1) {
|
||||
histo_1->fill(energyDep/keV);
|
||||
}
|
||||
if(tuple) {
|
||||
tuple->fill(0,energyDep);
|
||||
tuple->fill(1,1);
|
||||
tuple->addRow();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::analysePrimaryGenerator(G4double energy)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(histo_7) histo_7->fill(energy/keV);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoAnalysisManager.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
#include "XrayFluoAnalysisMessenger.hh"
|
||||
#include "G4Step.hh"
|
||||
|
||||
XrayFluoAnalysisManager* XrayFluoAnalysisManager::instance = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisManager::XrayFluoAnalysisManager()
|
||||
{
|
||||
analysisMessenger = new XrayFluoAnalysisMessenger(this);
|
||||
histoManager = createIHistoManager();
|
||||
factory = Lizard::createNTupleFactory();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisManager::~XrayFluoAnalysisManager()
|
||||
{
|
||||
|
||||
delete analysisMessenger;
|
||||
analysisMessenger = 0;
|
||||
delete histoManager;
|
||||
histoManager = 0;
|
||||
delete factory;
|
||||
factory = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisManager* XrayFluoAnalysisManager::getInstance()
|
||||
{
|
||||
if (instance == 0) instance = new XrayFluoAnalysisManager;
|
||||
return instance;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
void XrayFluoAnalysisManager::book()
|
||||
|
||||
{
|
||||
histoManager->selectStore("XrayFluo.his");
|
||||
|
||||
// Book histograms
|
||||
histoManager->create1D("1","Energy Deposit", 100,0.,10.);
|
||||
histoManager->create1D("2","Gamma born in the sample", 100,0.,10.);
|
||||
histoManager->create1D("3","Electrons born in the sample", 100,0.,10.);
|
||||
histoManager->create1D("4","Gammas leaving the sample", 100,0.,10.);
|
||||
histoManager->create1D("5","Electrons leaving the sample ", 100,0.,10.);
|
||||
histoManager->create1D("6","Gammas reaching the detector", 100,0.,10.);
|
||||
histoManager->create1D("7","Spectrum of the incident particles", 100,0.,10.);
|
||||
histoManager->create1D("8","Protons reaching the detector", 100,0.,10.);
|
||||
histoManager->create1D("9","Protons leaving the sample", 100,0.,10.);
|
||||
|
||||
// Book ntuples
|
||||
ntuple = factory->createC("XrayFluo.his::1");
|
||||
|
||||
// Add and bind the attributes to the ntuple
|
||||
if ( !( ntuple->addAndBind( "energy", eDep) &&
|
||||
ntuple->addAndBind( "counts" , counts ) ) )
|
||||
|
||||
{
|
||||
delete ntuple;
|
||||
G4Exception("XrayFluoAnalysisManager::book - Could not addAndBind ntuple");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::finish()
|
||||
{
|
||||
|
||||
histoManager->store("1");
|
||||
histoManager->store("3");
|
||||
histoManager->store("2");
|
||||
histoManager->store("4");
|
||||
histoManager->store("5");
|
||||
histoManager->store("6");
|
||||
histoManager->store("7");
|
||||
histoManager->store("8");
|
||||
histoManager->store("9");
|
||||
|
||||
|
||||
delete ntuple;
|
||||
ntuple = 0;
|
||||
G4cout << "Deleted ntuple" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::analyseStepping(const G4Step* aStep)
|
||||
{
|
||||
G4double gammaAtTheDetPre=0;
|
||||
G4double protonsAtTheDetPre=0;
|
||||
G4double gammaLeavingSample=0;
|
||||
G4double eleLeavingSample=0;
|
||||
G4double protonsLeavSam=0;
|
||||
G4double gammaBornInSample=0;
|
||||
G4double eleBornInSample=0;
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Sample"){
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "World" )
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
{
|
||||
gammaLeavingSample = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
IHistogram1D* h1 = histoManager->retrieveHisto1D("4");
|
||||
h1->fill(gammaLeavingSample/keV);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Sample"){
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "World" )
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "e-" )
|
||||
{
|
||||
eleLeavingSample = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
|
||||
IHistogram1D* h2 = histoManager->retrieveHisto1D("5");
|
||||
h2->fill(eleLeavingSample/keV);
|
||||
}
|
||||
else if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "proton" )
|
||||
{
|
||||
protonsLeavSam = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
IHistogram1D* h3 = histoManager->retrieveHisto1D("9");
|
||||
h3->fill(protonsLeavSam/keV);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
|
||||
{if(1== (aStep->GetTrack()->GetCurrentStepNumber()))
|
||||
|
||||
{if(0 != aStep->GetTrack()->GetParentID())
|
||||
|
||||
{if(aStep->GetTrack()->GetVolume()->GetName() == "Sample")
|
||||
{
|
||||
gammaBornInSample = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
IHistogram1D* h4 = histoManager->retrieveHisto1D("2");
|
||||
h4->fill(gammaBornInSample);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "e-" )
|
||||
|
||||
{if(1== (aStep->GetTrack()->GetCurrentStepNumber()))
|
||||
|
||||
{if(0 != aStep->GetTrack()->GetParentID())
|
||||
|
||||
{if(aStep->GetTrack()->GetVolume()->GetName() == "Sample")
|
||||
{
|
||||
eleBornInSample = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
IHistogram1D* h5 = histoManager->retrieveHisto1D("3");
|
||||
h5->fill(eleBornInSample);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()){
|
||||
|
||||
if(aStep->GetTrack()->GetVolume()->GetName() == "World"){
|
||||
|
||||
if(aStep->GetTrack()->GetNextVolume()->GetName() == "HPGeDetector")
|
||||
|
||||
{
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "gamma" )
|
||||
{
|
||||
gammaAtTheDetPre = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
IHistogram1D* h6 = histoManager->retrieveHisto1D("6");
|
||||
h6->fill( gammaAtTheDetPre);
|
||||
}
|
||||
else if ((aStep->GetTrack()->GetDynamicParticle()
|
||||
->GetDefinition()-> GetParticleName()) == "proton" )
|
||||
{
|
||||
protonsAtTheDetPre = (aStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
IHistogram1D* h7 = histoManager->retrieveHisto1D("8");
|
||||
h7->fill( protonsAtTheDetPre);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::analyseEnergyDep(G4double energyDep)
|
||||
{
|
||||
IHistogram1D* h8 = histoManager->retrieveHisto1D("1");
|
||||
h8->fill(energyDep/keV);
|
||||
counts = 1.;
|
||||
ntuple->addRow();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisManager::analysePrimaryGenerator(G4double energy)
|
||||
{
|
||||
IHistogram1D* h9 = histoManager->retrieveHisto1D("7");
|
||||
h9->fill(energy/keV);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoAnalysisMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#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("esperimento analysis control.");
|
||||
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoAnalysisMessenger::~XrayFluoAnalysisMessenger()
|
||||
{
|
||||
|
||||
delete XrayFluoAnalysisDir;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoAnalysisMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoDAtaSet.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoDataSet.hh"
|
||||
#include "g4std/fstream"
|
||||
#include "g4std/strstream"
|
||||
#include "G4VDataSetAlgorithm.hh"
|
||||
|
||||
XrayFluoDataSet::XrayFluoDataSet(G4int Z,
|
||||
G4DataVector* points,
|
||||
G4DataVector* values,
|
||||
const G4VDataSetAlgorithm* interpolation,
|
||||
G4double unitE, G4double unitData)
|
||||
:z(Z), energies(points), data(values), algorithm(interpolation)
|
||||
{
|
||||
numberOfBins = energies->size();
|
||||
unit1 = unitE;
|
||||
unit2 = unitData;
|
||||
}
|
||||
|
||||
XrayFluoDataSet:: XrayFluoDataSet(G4int Z,
|
||||
const G4String& dataFile,
|
||||
const G4VDataSetAlgorithm* interpolation,
|
||||
G4double unitE, G4double unitData)
|
||||
:z(Z), algorithm(interpolation)
|
||||
{
|
||||
energies = new G4DataVector;
|
||||
data = new G4DataVector;
|
||||
unit1 = unitE;
|
||||
unit2 = unitData;
|
||||
LoadData(dataFile);
|
||||
numberOfBins = energies->size();
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
XrayFluoDataSet::~XrayFluoDataSet()
|
||||
{
|
||||
delete energies;
|
||||
delete data;
|
||||
}
|
||||
|
||||
|
||||
G4double XrayFluoDataSet::FindValue(G4double e, G4int id) const
|
||||
{
|
||||
G4double value;
|
||||
G4double e0 = (*energies)[0];
|
||||
// Protections
|
||||
size_t bin = FindBinLocation(e);
|
||||
if (bin == numberOfBins)
|
||||
{
|
||||
|
||||
value = (*data)[bin];
|
||||
}
|
||||
else if (e <= e0)
|
||||
{
|
||||
|
||||
value = (*data)[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
value = algorithm->Calculate(e,bin,*energies,*data);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
G4int XrayFluoDataSet::FindBinLocation(G4double energy) const
|
||||
{
|
||||
// Protection against call outside allowed range
|
||||
G4double e0 = (*energies)[0];
|
||||
if (energy < e0)
|
||||
{
|
||||
|
||||
energy = e0;
|
||||
}
|
||||
|
||||
size_t lowerBound = 0;
|
||||
size_t upperBound = numberOfBins - 1;
|
||||
|
||||
// Binary search
|
||||
while (lowerBound <= upperBound)
|
||||
{
|
||||
size_t midBin = (lowerBound + upperBound)/2;
|
||||
if ( energy < (*energies)[midBin] ) upperBound = midBin-1;
|
||||
else lowerBound = midBin+1;
|
||||
}
|
||||
|
||||
return upperBound;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
ost << fileName <<".dat";
|
||||
|
||||
G4String name(nameChar);
|
||||
|
||||
char* path = getenv("G4INSTALL");
|
||||
|
||||
G4String pathString(path);
|
||||
G4String dirFile = pathString + "/" + name;
|
||||
G4std::ifstream file(dirFile);
|
||||
G4std::filebuf* lsdp = file.rdbuf();
|
||||
|
||||
if (! (lsdp->is_open()) )
|
||||
{
|
||||
G4String excep = "XrayFluoDataSet - data file: " + dirFile + " not found";
|
||||
G4Exception(excep);
|
||||
}
|
||||
G4double a = 0;
|
||||
G4int k = 1;
|
||||
|
||||
do
|
||||
{
|
||||
file >> a;
|
||||
G4int nColumns = 2;
|
||||
// The file is organized into two columns:
|
||||
// 1st column is the energy
|
||||
// 2nd column is the corresponding value
|
||||
// The file terminates with the pattern: -1 -1
|
||||
// -2 -2
|
||||
if (a == -1 || a == -2)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (k%nColumns != 0)
|
||||
{
|
||||
G4double e = a * unit1;
|
||||
energies->push_back(e);
|
||||
|
||||
k++;
|
||||
|
||||
}
|
||||
else if (k%nColumns == 0)
|
||||
{
|
||||
G4double value = a * unit2;
|
||||
data->push_back(value);
|
||||
|
||||
k = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} while (a != -2); // end of file
|
||||
|
||||
file.close();
|
||||
}
|
||||
void XrayFluoDataSet::PrintData() const
|
||||
{
|
||||
size_t size = numberOfBins;
|
||||
for (size_t i=0; i<size; i++)
|
||||
{
|
||||
G4double e = (*energies)[i] / unit1;
|
||||
G4double sigma = (*data)[i] / unit2 ;
|
||||
G4cout << "Point: "
|
||||
<< e
|
||||
<< " - Data value : "
|
||||
<< sigma
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,536 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoDetectorConstruction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
#include "XrayFluoDetectorMessenger.hh"
|
||||
#include "XrayFluoHPGeSD.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoDetectorConstruction::XrayFluoDetectorConstruction()
|
||||
: DeviceSizeX(0),DeviceSizeY(0),DeviceThickness(0),
|
||||
solidWorld(0),logicWorld(0),physiWorld(0),
|
||||
solidHPGe(0),logicHPGe(0),physiHPGe(0),
|
||||
solidSample (0),logicSample(0),physiSample (0),
|
||||
solidDia1(0),logicDia1(0),physiDia1(0),
|
||||
solidDia3(0),logicDia3(0),physiDia3(0),
|
||||
solidOhmicPos(0),logicOhmicPos(0), physiOhmicPos(0),
|
||||
solidOhmicNeg(0),logicOhmicNeg(0), physiOhmicNeg(0),
|
||||
solidPixel(0),logicPixel(0), physiPixel(0),
|
||||
OhmicPosMaterial(0), OhmicNegMaterial(0),
|
||||
pixelMaterial(0),sampleMaterial(0),
|
||||
Dia1Material(0),Dia3Material(0),
|
||||
defaultMaterial(0)
|
||||
,HPGeSD(0)
|
||||
|
||||
{
|
||||
NbOfPixelRows = 1;
|
||||
NbOfPixelColumns = 1;
|
||||
NbOfPixels = NbOfPixelRows*NbOfPixelColumns;
|
||||
PixelSizeXY = 0.7 * cm;
|
||||
PixelThickness = 1. * mm;
|
||||
ContactSizeXY = 0.005*mm;
|
||||
SampleThickness = 0.25 * mm;
|
||||
SampleSizeXY = 3. * cm;
|
||||
Dia1Thickness = 1. *mm;
|
||||
Dia3Thickness = 1. *mm;
|
||||
Dia1SizeXY = 3. *cm;
|
||||
Dia3SizeXY = 3. *cm;
|
||||
DiaInnerSize = 1.4 * mm;
|
||||
OhmicNegThickness = 0.005*mm;
|
||||
OhmicPosThickness = 0.005*mm;
|
||||
ThetaHPGe = 135. * deg;
|
||||
Dia3Dist = 66.5 * mm;
|
||||
Dia3InnerSize = 1. * mm;
|
||||
PhiHPGe = 225. * deg;
|
||||
ThetaDia1 = 135. * deg;
|
||||
ThetaDia3 = 180. * deg;
|
||||
PhiDia3 = 90. * deg;
|
||||
DistDia = 66.5 * mm;
|
||||
DistDe =DistDia+ (Dia1Thickness
|
||||
+PixelThickness)/2+OhmicPosThickness ;
|
||||
PhiDia1 = 90. * deg;
|
||||
AlphaDia1 = 225. * deg;
|
||||
AlphaDia3 = 180. * deg;
|
||||
PixelCopyNb=0;
|
||||
ComputeApparateParameters();
|
||||
|
||||
// create commands for interactive definition of the apparate
|
||||
|
||||
detectorMessenger = new XrayFluoDetectorMessenger(this);
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoDetectorConstruction::~XrayFluoDetectorConstruction()
|
||||
{ delete detectorMessenger;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* XrayFluoDetectorConstruction::Construct()
|
||||
{
|
||||
DefineMaterials();
|
||||
return ConstructApparate();
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoDetectorConstruction::DefineMaterials()
|
||||
{
|
||||
//define elements
|
||||
G4String name, symbol; //a=mass of a mole;
|
||||
G4double a, z, density; //z=mean number of protons;
|
||||
|
||||
|
||||
a = 74.9216 * g/mole;
|
||||
G4Element * As = new G4Element( name="arsenic",symbol="As",z= 33.,a);
|
||||
|
||||
a = 69.72* g/mole;
|
||||
G4Element * Ga = new G4Element(name="gallium",symbol="Ga",z= 31.,a);
|
||||
|
||||
a = 55.85*g/mole;
|
||||
G4Element* Fe = new G4Element(name="Iron" ,symbol="Fe", z=26., a);
|
||||
//define hydrogen
|
||||
|
||||
a = 1.01*g/mole;
|
||||
G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
|
||||
|
||||
//define germanium
|
||||
a = 72.61*g/mole;
|
||||
G4Element* Ge = new G4Element(name="Germanium",symbol="Ge", z= 32.,a);
|
||||
//define phosporus
|
||||
|
||||
a = 30.97*g/mole;
|
||||
G4Element* P = new G4Element(name="Phosporus",symbol="P", z= 15., a);
|
||||
|
||||
density = 7.86 * g/cm3;
|
||||
|
||||
G4int natoms,ncomponents;
|
||||
G4double temperature, pressure;
|
||||
|
||||
G4Material * FeMaterial = new G4Material(name="Iron",density,ncomponents=1);
|
||||
FeMaterial->AddElement(Fe,natoms=1);
|
||||
|
||||
density = 5.32 * g/cm3;
|
||||
G4Material * HPGe = new G4Material(name="HPGe",density,ncomponents=1);
|
||||
HPGe ->AddElement(Ge,natoms=1);
|
||||
//define gallium arsenide
|
||||
|
||||
density = 5.32 * g/cm3;
|
||||
G4Material * GaAs = new G4Material(name ="gallium arsenide",density,ncomponents=2);
|
||||
GaAs->AddElement(Ga,natoms=1);
|
||||
GaAs->AddElement(As,natoms=1);
|
||||
|
||||
//define silicon
|
||||
|
||||
density = 2.333*g/cm3;
|
||||
a = 28.09*g/mole;
|
||||
G4Material* Si = new G4Material(name="Silicon",z=14., a,density);
|
||||
|
||||
//define copper
|
||||
|
||||
density = 8.960*g/cm3;
|
||||
a = 63.55*g/mole;
|
||||
G4Material* Cu = new G4Material(name="Copper" , z=29., a, density);
|
||||
|
||||
|
||||
//define carbon
|
||||
|
||||
a = 12.01*g/mole;
|
||||
G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
|
||||
|
||||
|
||||
//define scintillator
|
||||
|
||||
density = 1.032*g/cm3;
|
||||
G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
|
||||
Sci->AddElement(C, natoms=9);
|
||||
Sci->AddElement(H, natoms=10);
|
||||
|
||||
//define aluminium
|
||||
|
||||
density = 2.700*g/cm3;
|
||||
a = 26.98*g/mole;
|
||||
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
|
||||
|
||||
//define titanium
|
||||
density = 4.54 *g/cm3;
|
||||
a = 47.867*g/mole;
|
||||
G4Material* Ti = new G4Material(name="Titanium",z=22.,a,density);
|
||||
|
||||
|
||||
|
||||
//define lead
|
||||
|
||||
density = 11.35*g/cm3;
|
||||
a=207.19*g/mole;
|
||||
G4Material* Pb = new G4Material(name="Lead",z=82.,a,density);
|
||||
|
||||
//define air
|
||||
|
||||
a = 14.01*g/mole;
|
||||
G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
|
||||
|
||||
a = 16.00*g/mole;
|
||||
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
|
||||
|
||||
G4double fractionmass;
|
||||
density = 1.290*mg/cm3;
|
||||
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
|
||||
Air->AddElement(N, fractionmass=0.7);
|
||||
Air->AddElement(O, fractionmass=0.3);
|
||||
|
||||
//define vacuum
|
||||
|
||||
density = universe_mean_density; //from PhysicalConstants.h
|
||||
pressure = 3.e-18*pascal;
|
||||
temperature = 2.73*kelvin;
|
||||
G4Material * Vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,
|
||||
kStateGas,temperature,pressure);
|
||||
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//default materials of the apparate
|
||||
|
||||
sampleMaterial = Ti;
|
||||
Dia1Material = Pb;
|
||||
Dia3Material = Pb;
|
||||
pixelMaterial = HPGe;
|
||||
OhmicPosMaterial = Cu;
|
||||
OhmicNegMaterial = Pb;
|
||||
defaultMaterial = Vacuum;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* XrayFluoDetectorConstruction::ConstructApparate()
|
||||
{
|
||||
// complete the apparate parameters definition
|
||||
|
||||
ComputeApparateParameters();
|
||||
|
||||
//world
|
||||
|
||||
solidWorld = new G4Box("World", //its name
|
||||
WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2); //its size
|
||||
|
||||
logicWorld = new G4LogicalVolume(solidWorld, //its solid
|
||||
defaultMaterial, //its material
|
||||
"World"); //its name
|
||||
physiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"World", //its name
|
||||
logicWorld, //its logical volume
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//HPGeDetector
|
||||
|
||||
solidHPGe = 0; physiHPGe = 0; logicHPGe=0;
|
||||
solidPixel=0; logicPixel=0; physiPixel=0;
|
||||
|
||||
if (DeviceThickness > 0.)
|
||||
{
|
||||
solidHPGe = new G4Box("HPGeDetector", //its name
|
||||
DeviceSizeX/2,DeviceSizeY/2,DeviceThickness/2);//size
|
||||
|
||||
|
||||
logicHPGe = new G4LogicalVolume(solidHPGe, //its solid
|
||||
defaultMaterial, //its material
|
||||
"HPGeDetector"); //its name
|
||||
|
||||
zRotPhiHPGe.rotateX(PhiHPGe);
|
||||
G4double x,y,z;
|
||||
z = DistDe * cos(ThetaHPGe);
|
||||
y =DistDe * sin(ThetaHPGe);
|
||||
x = 0.*cm;
|
||||
physiHPGe = new G4PVPlacement(G4Transform3D(zRotPhiHPGe,G4ThreeVector(x,y,z)), "HPGeDetector", //its name
|
||||
logicHPGe, //its logical volume
|
||||
physiWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
}
|
||||
// Pixel
|
||||
|
||||
for ( G4int j=0; j < NbOfPixelColumns ; j++ )
|
||||
{ for ( G4int i=0; i < NbOfPixelRows ; i++ )
|
||||
{
|
||||
solidPixel=0; logicPixel=0; physiPixel=0;
|
||||
if (PixelThickness > 0.)
|
||||
solidPixel = new G4Box("Pixel",
|
||||
PixelSizeXY/2,PixelSizeXY/2, PixelThickness/2);
|
||||
|
||||
logicPixel = new G4LogicalVolume(solidPixel,
|
||||
pixelMaterial, //its material
|
||||
"Pixel"); //its name
|
||||
zRotPhiHPGe.rotateX(PhiHPGe);
|
||||
G4double x,y,z;
|
||||
z = DistDe * cos(ThetaHPGe);
|
||||
y =DistDe * sin(ThetaHPGe);
|
||||
x = 0.*cm;
|
||||
|
||||
physiPixel = new G4PVPlacement(0,
|
||||
G4ThreeVector(0,
|
||||
i*PixelSizeXY,
|
||||
j*PixelSizeXY ),
|
||||
"Pixel",
|
||||
logicPixel, //its logical volume
|
||||
physiHPGe, //its mother volume
|
||||
false, //no boolean operation
|
||||
PixelCopyNb);//copy number
|
||||
|
||||
// OhmicNeg
|
||||
|
||||
solidOhmicNeg=0; logicOhmicNeg=0; physiOhmicNeg=0;
|
||||
|
||||
if (OhmicNegThickness > 0.)
|
||||
{ solidOhmicNeg = new G4Box("OhmicNeg", //its name
|
||||
PixelSizeXY/2,PixelSizeXY/2,OhmicNegThickness/2);
|
||||
|
||||
logicOhmicNeg = new G4LogicalVolume(solidOhmicNeg, //its solid
|
||||
OhmicNegMaterial, //its material
|
||||
"OhmicNeg"); //its name
|
||||
|
||||
physiOhmicNeg = new G4PVPlacement(0,
|
||||
G4ThreeVector
|
||||
(0.,
|
||||
0.,
|
||||
(PixelThickness+OhmicNegThickness)/2),
|
||||
"OhmicNeg", //its name
|
||||
logicOhmicNeg, //its logical volume
|
||||
physiHPGe, //its mother
|
||||
false, //no boulean operat
|
||||
PixelCopyNb); //copy number
|
||||
|
||||
}
|
||||
// OhmicPos
|
||||
solidOhmicPos=0; logicOhmicPos=0; physiOhmicPos=0;
|
||||
|
||||
if (OhmicPosThickness > 0.)
|
||||
{ solidOhmicPos = new G4Box("OhmicPos", //its name
|
||||
ContactSizeXY/2,ContactSizeXY/2,OhmicPosThickness/2);
|
||||
|
||||
logicOhmicPos = new G4LogicalVolume(solidOhmicPos, //its solid
|
||||
OhmicPosMaterial, //its material
|
||||
"OhmicPos"); //its name
|
||||
|
||||
physiOhmicPos = new G4PVPlacement(0,
|
||||
G4ThreeVector(0.,
|
||||
0.,
|
||||
(-PixelThickness-OhmicPosThickness)/2),
|
||||
"OhmicPos",
|
||||
logicOhmicPos,
|
||||
physiHPGe,
|
||||
false,
|
||||
PixelCopyNb);
|
||||
|
||||
}
|
||||
PixelCopyNb += PixelCopyNb;
|
||||
}
|
||||
}
|
||||
|
||||
//Sample
|
||||
|
||||
solidSample=0; logicSample=0; physiSample=0;
|
||||
|
||||
if (SampleThickness > 0.)
|
||||
{
|
||||
solidSample = new G4Box("Sample", //its name
|
||||
SampleSizeXY/2,SampleSizeXY/2,SampleThickness/2);//size
|
||||
|
||||
logicSample= new G4LogicalVolume(solidSample, //its solid
|
||||
sampleMaterial, //its material
|
||||
"Sample"); //its name
|
||||
|
||||
physiSample = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"Sample", //its name
|
||||
logicSample, //its logical volume
|
||||
physiWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
}
|
||||
|
||||
//Diaphragm1
|
||||
|
||||
solidDia1 = 0; physiDia1 = 0; logicDia1=0;
|
||||
|
||||
if (Dia1Thickness > 0.)
|
||||
{
|
||||
solidDia1 = new G4Tubs("Diaphragm1", //its name
|
||||
DiaInnerSize/2,
|
||||
Dia1SizeXY/2,
|
||||
Dia1Thickness/2,
|
||||
0,
|
||||
360);//size
|
||||
|
||||
|
||||
logicDia1 = new G4LogicalVolume(solidDia1, //its solid
|
||||
Dia1Material, //its material
|
||||
"Diaphragm1"); //its name
|
||||
|
||||
zRotPhiDia1.rotateX(AlphaDia1);
|
||||
G4double x,y,z;
|
||||
z = DistDia * cos(ThetaDia1);
|
||||
y =DistDia * sin(ThetaDia1);
|
||||
x = 0.*cm;
|
||||
physiDia1 = new G4PVPlacement(G4Transform3D(zRotPhiDia1,G4ThreeVector(x,y,z)), "Diaphragm1", //its name
|
||||
logicDia1, //its logical volume
|
||||
physiWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
}
|
||||
|
||||
//Diaphragm3
|
||||
|
||||
solidDia3 = 0; physiDia3 = 0; logicDia3 =0;
|
||||
|
||||
if (Dia3Thickness > 0.)
|
||||
{
|
||||
solidDia3 = new G4Tubs("Diaphragm3",
|
||||
Dia3InnerSize/2,
|
||||
Dia3SizeXY/2,
|
||||
Dia3Thickness/2,
|
||||
0,
|
||||
360);
|
||||
|
||||
|
||||
logicDia3 = new G4LogicalVolume(solidDia3, //its solid
|
||||
Dia3Material, //its material
|
||||
"Diaphragm3"); //its name
|
||||
|
||||
zRotPhiDia3.rotateX(AlphaDia3);
|
||||
G4double x,y,z;
|
||||
z = Dia3Dist * cos(ThetaDia3);
|
||||
y =Dia3Dist * sin(ThetaDia3);
|
||||
x = 0.*cm;
|
||||
physiDia3 = new G4PVPlacement(G4Transform3D(zRotPhiDia3,G4ThreeVector(x,y,z)), "Diaphragm3", //its name
|
||||
logicDia3, //its logical volume
|
||||
physiWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
}
|
||||
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
if(!HPGeSD)
|
||||
{
|
||||
HPGeSD = new XrayFluoHPGeSD ("HPGeSD",this);
|
||||
SDman->AddNewDetector(HPGeSD);
|
||||
}
|
||||
|
||||
|
||||
if (logicPixel)
|
||||
{
|
||||
logicPixel->SetSensitiveDetector(HPGeSD);
|
||||
}
|
||||
|
||||
// Visualization attributes
|
||||
|
||||
logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
G4VisAttributes * yellow= new G4VisAttributes( G4Colour(255/255. ,255/255. ,51/255. ));
|
||||
yellow->SetVisibility(true);
|
||||
yellow->SetForceSolid(true);
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
|
||||
logicPixel->SetVisAttributes(simpleBoxVisAtt);
|
||||
logicHPGe->SetVisAttributes(G4VisAttributes::Invisible );
|
||||
logicSample->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
logicDia1->SetVisAttributes(simpleBoxVisAtt);
|
||||
logicDia3->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
logicOhmicNeg->SetVisAttributes(yellow);
|
||||
logicOhmicPos->SetVisAttributes(yellow);
|
||||
//always return the physical World
|
||||
|
||||
|
||||
PrintApparateParameters();
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoDetectorConstruction::PrintApparateParameters()
|
||||
{
|
||||
G4cout << "-----------------------------------------------------------------------"
|
||||
<< G4endl
|
||||
<< "The sample is a box whose size is: "
|
||||
<< G4endl
|
||||
<< SampleThickness/cm
|
||||
<< " cm * "
|
||||
<< SampleSizeXY/cm
|
||||
<< " cm * "
|
||||
<< SampleSizeXY/cm
|
||||
<< " cm"
|
||||
<< G4endl
|
||||
<<" Material: " << sampleMaterial->GetName()
|
||||
<<G4endl
|
||||
<<"The HPGeDetector is a slice " << DeviceThickness/(1.e-6*m) << " micron thick"
|
||||
<<G4endl
|
||||
|
||||
|
||||
<<"-------------------------------------------------------------------------"
|
||||
<< G4endl;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoDetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructApparate());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoDetectorMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoDetectorMessenger.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoDetectorMessenger::XrayFluoDetectorMessenger(XrayFluoDetectorConstruction * Det)
|
||||
:Detector(Det)
|
||||
{
|
||||
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->AvailableForStates(Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoDetectorMessenger::~XrayFluoDetectorMessenger()
|
||||
{
|
||||
delete UpdateCmd;
|
||||
delete detDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == UpdateCmd )
|
||||
{ Detector->UpdateGeometry(); }
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoEventAction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoEventAction.hh"
|
||||
#include "XrayFluoSensorHit.hh"
|
||||
#include "XrayFluoEventActionMessenger.hh"
|
||||
#include "XrayFluoRunAction.hh"
|
||||
#include "XrayFluoDataSet.hh"
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoEventAction::XrayFluoEventAction()
|
||||
:drawFlag("all"),
|
||||
HPGeCollID(-1),
|
||||
eventMessenger(0),
|
||||
printModulo(1)
|
||||
|
||||
{
|
||||
eventMessenger = new XrayFluoEventActionMessenger(this);
|
||||
runManager = new XrayFluoRunAction();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
XrayFluoEventAction::~XrayFluoEventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
eventMessenger = 0;
|
||||
delete runManager;
|
||||
runManager = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoEventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
// 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.;
|
||||
|
||||
if (HCE) HPGeHC = (XrayFluoSensorHitsCollection*)(HCE->GetHC(HPGeCollID));
|
||||
if(HPGeHC)
|
||||
{
|
||||
n_hit = HPGeHC->entries();
|
||||
for (G4int i=0;i<n_hit;i++)
|
||||
{
|
||||
totEnergy += (*HPGeHC)[i]->GetEdepTot();
|
||||
|
||||
energyD = ResponseFunction(totEnergy);
|
||||
#ifdef G4ANALYSIS_USE
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->analyseEnergyDep(energyD);
|
||||
#endif
|
||||
totEnergyDetect += energyD;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// extract the trajectories and draw them
|
||||
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
|
||||
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
G4int n_trajectories = 0;
|
||||
if (trajectoryContainer) n_trajectories = trajectoryContainer->size();
|
||||
|
||||
for (G4int i=0; i<n_trajectories; i++)
|
||||
{ G4Trajectory* trj = (G4Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
|
||||
if (drawFlag == "all") trj->DrawTrajectory(50);
|
||||
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
|
||||
trj->DrawTrajectory(50);
|
||||
else if ((drawFlag == "neutral")&&(trj->GetCharge() == 0.))
|
||||
trj->DrawTrajectory(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
G4double XrayFluoEventAction::RandomCut(G4double energy)
|
||||
|
||||
{
|
||||
G4double efficiency = 1.;
|
||||
G4double F = 0.15;
|
||||
G4double epsilon = 2.96 * eV;
|
||||
G4double deltaE = 220 * eV;
|
||||
G4double EdepDetect = 0.;
|
||||
//const XrayFluoDataSet* dataSet = runManager->GetEfficiencySet();
|
||||
|
||||
//G4double id = 0;
|
||||
|
||||
//efficiency = dataSet->FindValue(energy,id);
|
||||
|
||||
G4double Random = G4UniformRand();
|
||||
|
||||
if ( Random<efficiency )
|
||||
{
|
||||
G4double sigma = sqrt(F*epsilon*energy+pow(deltaE/2355,2));
|
||||
|
||||
EdepDetect = G4RandGauss::shoot(energy, sigma );
|
||||
|
||||
}
|
||||
else {EdepDetect = 0.;}
|
||||
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();
|
||||
G4double 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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoEventActionMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoEventActionMessenger.hh"
|
||||
|
||||
#include "XrayFluoEventAction.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoEventActionMessenger::XrayFluoEventActionMessenger(XrayFluoEventAction* EvAct)
|
||||
:eventAction(EvAct)
|
||||
{
|
||||
DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
|
||||
DrawCmd->SetGuidance("Draw the tracks in the event");
|
||||
DrawCmd->SetGuidance(" Choice : none, charged(default),neutral, all");
|
||||
DrawCmd->SetParameterName("choice",true);
|
||||
DrawCmd->SetDefaultValue("all");
|
||||
DrawCmd->SetCandidates("none charged neutral all");
|
||||
DrawCmd->AvailableForStates(Idle);
|
||||
|
||||
PrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
|
||||
PrintCmd->SetGuidance("Print events modulo n");
|
||||
PrintCmd->SetParameterName("EventNb",false);
|
||||
PrintCmd->SetRange("EventNb>0");
|
||||
PrintCmd->AvailableForStates(Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoEventActionMessenger::~XrayFluoEventActionMessenger()
|
||||
{
|
||||
delete DrawCmd;
|
||||
delete PrintCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoEventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if(command == DrawCmd)
|
||||
{eventAction->SetDrawFlag(newValue);}
|
||||
|
||||
if(command == PrintCmd)
|
||||
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoHPGeSD.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoHPGeSD.hh"
|
||||
#include "XrayFluoSensorHit.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoHPGeSD::XrayFluoHPGeSD(G4String name,
|
||||
XrayFluoDetectorConstruction* det)
|
||||
:G4VSensitiveDetector(name),Detector(det)
|
||||
{
|
||||
collectionName.insert("HPGeCollection");
|
||||
HitHPGeID = new G4int[500];
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoHPGeSD::~XrayFluoHPGeSD()
|
||||
{
|
||||
delete [] HitHPGeID;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
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;};
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool XrayFluoHPGeSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if ((edep==0.)) return false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoHPGeSD::EndOfEvent(G4HCofThisEvent* HCE)
|
||||
{
|
||||
static G4int HCID = -1;
|
||||
if(HCID<0)
|
||||
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
|
||||
HCE->AddHitsCollection(HCID,HPGeCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoHPGeSD::clear()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoHPGeSD::DrawAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoHPGeSD::PrintAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoAnalysisMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoNormalization.hh"
|
||||
#include "G4VDataSetAlgorithm.hh"
|
||||
#include "G4LogLogInterpolation.hh"
|
||||
#include "XrayFluoDataSet.hh"
|
||||
|
||||
XrayFluoNormalization::XrayFluoNormalization()
|
||||
|
||||
{ }
|
||||
|
||||
XrayFluoNormalization::~XrayFluoNormalization()
|
||||
|
||||
{ }
|
||||
|
||||
const XrayFluoDataSet* XrayFluoNormalization::Normalize(G4double minIntExtreme, G4double maxIntExtreme, G4int nBins, G4String fileName)
|
||||
{
|
||||
|
||||
G4VDataSetAlgorithm* interpolation = new G4LogLogInterpolation();
|
||||
XrayFluoDataSet* dataSet =
|
||||
new XrayFluoDataSet(1,fileName,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));
|
||||
return finalDataSet;
|
||||
}
|
||||
|
||||
G4double XrayFluoNormalization::Integrate(G4double minIntExtreme, G4double maxIntExtreme, G4int nBins, XrayFluoDataSet* dataSet)
|
||||
{
|
||||
G4double partialHeight = 0;
|
||||
G4double id = 0;
|
||||
G4double lenghtOfBins = (maxIntExtreme - minIntExtreme)/nBins;
|
||||
|
||||
for (G4int i = 0; i<nBins; i++)
|
||||
{
|
||||
G4double midPoint = minIntExtreme + i*lenghtOfBins+lenghtOfBins/2;
|
||||
|
||||
G4double heightOfRectangle = dataSet->FindValue(midPoint,id);
|
||||
|
||||
partialHeight += heightOfRectangle;
|
||||
|
||||
}
|
||||
|
||||
G4double integral = lenghtOfBins * partialHeight;
|
||||
|
||||
delete dataSet;
|
||||
dataSet = 0;
|
||||
return integral;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoPhysicsList.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoPhysicsList.hh"
|
||||
#include "XrayFluoPhysicsListMessenger.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoDetectorConstruction* p)
|
||||
: G4VUserPhysicsList()
|
||||
{
|
||||
pDet = p;
|
||||
defaultCutValue = 0.00001*mm;
|
||||
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForProton = 0.00001*mm;
|
||||
SetVerboseLevel(1);
|
||||
physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPhysicsList::~XrayFluoPhysicsList()
|
||||
{
|
||||
delete physicsListMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPhysicsList::ConstructParticle()
|
||||
{
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
// This ensures that objects of these particle types will be
|
||||
// created in the program.
|
||||
|
||||
ConstructBosons();
|
||||
ConstructLeptons();
|
||||
ConstructBarions();
|
||||
ConstructIons();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPhysicsList::ConstructBosons()
|
||||
{
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPhysicsList::ConstructBarions()
|
||||
{
|
||||
G4Proton::ProtonDefinition();
|
||||
}
|
||||
void XrayFluoPhysicsList::ConstructIons()
|
||||
{
|
||||
// Ions
|
||||
G4Alpha::AlphaDefinition();
|
||||
}
|
||||
|
||||
void XrayFluoPhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4LowEnergyCompton.hh"
|
||||
#include "G4LowEnergyGammaConversion.hh"
|
||||
#include "G4LowEnergyPhotoElectric.hh"
|
||||
#include "G4LowEnergyRayleigh.hh"
|
||||
|
||||
// e+
|
||||
#include "G4MultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
#include "G4LowEnergyIonisation.hh"
|
||||
#include "G4LowEnergyBremsstrahlung.hh"
|
||||
#include "G4hLowEnergyIonisation.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
|
||||
// gamma
|
||||
pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
|
||||
|
||||
LePeprocess = new G4LowEnergyPhotoElectric();
|
||||
pmanager->AddDiscreteProcess(LePeprocess);
|
||||
|
||||
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
|
||||
LeIoprocess = new G4LowEnergyIonisation();
|
||||
pmanager->AddProcess(LeIoprocess, -1, 2, 2);
|
||||
|
||||
LeBrprocess = new G4LowEnergyBremsstrahlung();
|
||||
pmanager->AddProcess(LeBrprocess, -1, -1, 3);
|
||||
|
||||
} 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
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
|
||||
pmanager->AddProcess(new G4hLowEnergyIonisation,-1, 2,2);
|
||||
}
|
||||
else if ( particleName == "alpha" )
|
||||
{
|
||||
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
|
||||
G4hLowEnergyIonisation* iIon = new G4hLowEnergyIonisation() ;
|
||||
pmanager->AddProcess(iIon,-1,2,2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....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();
|
||||
cutForGamma = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPhysicsList::SetElectronCut(G4double val)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForElectron = val;
|
||||
}
|
||||
|
||||
void XrayFluoPhysicsList::SetCuts(){
|
||||
|
||||
SetCutValue(cutForGamma,"gamma");
|
||||
SetCutValue(cutForElectron,"e-");
|
||||
SetCutValue(cutForElectron,"e+");
|
||||
SetCutValue(cutForProton, "proton");
|
||||
SetCutValueForOthers(cutForProton);
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPhysicsList::SetLowEnSecPhotCut(G4double cut){
|
||||
|
||||
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);
|
||||
LeIoprocess->SetCutForLowEnSecPhotons(cut);
|
||||
}
|
||||
|
||||
void XrayFluoPhysicsList::SetLowEnSecElecCut(G4double cut){
|
||||
|
||||
G4cout<<"Low energy secondary electrons cut is now set to: "<<cut*MeV<<" (MeV)"<<G4endl;
|
||||
|
||||
G4cout<<"for processes LowEnergyIonisation"<<G4endl;
|
||||
|
||||
LeIoprocess->SetCutForLowEnSecElectrons(cut);
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPhysicsList::SetProtonCut(G4double val)
|
||||
{
|
||||
// ResetCuts();
|
||||
cutForProton = val;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
void XrayFluoPhysicsList::SetCutsByEnergy(G4double val)
|
||||
{
|
||||
G4ParticleTable* theXrayFluoParticleTable = G4ParticleTable::GetParticleTable();
|
||||
G4Material* currMat = pDet->GetSampleMaterial();
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoPhysicsListMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoPhysicsListMessenger.hh"
|
||||
#include "XrayFluoPhysicsList.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPhysicsListMessenger::XrayFluoPhysicsListMessenger(XrayFluoPhysicsList * List)
|
||||
:XrayFluoList(List)
|
||||
{
|
||||
|
||||
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(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(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(Idle);
|
||||
|
||||
cutSecPhotCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/secphotcut",this);
|
||||
cutSecPhotCmd->SetGuidance("Set production threshold for secondary Gamma.");
|
||||
cutSecPhotCmd->SetParameterName("energy",true);
|
||||
cutSecPhotCmd->SetDefaultValue(5e-5);
|
||||
cutSecPhotCmd->SetDefaultUnit("MeV");
|
||||
cutSecPhotCmd->AvailableForStates(Idle);
|
||||
|
||||
cutSecElecCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/seceleccut",this);
|
||||
cutSecElecCmd->SetGuidance("Set production threshold for secondary e-");
|
||||
cutSecElecCmd->SetParameterName("energy",true);
|
||||
cutSecElecCmd->SetDefaultValue(5e-5);
|
||||
cutSecElecCmd->SetDefaultUnit("MeV");
|
||||
cutSecElecCmd->AvailableForStates(Idle);
|
||||
|
||||
cutGCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/cutG",this);
|
||||
cutGCmd->SetGuidance("Set cut values by RANGE for Gamma.");
|
||||
cutGCmd->SetParameterName("range",true);
|
||||
cutGCmd->SetDefaultValue(1.);
|
||||
cutGCmd->SetDefaultUnit("mm");
|
||||
cutGCmd->AvailableForStates(Idle);
|
||||
|
||||
cutECmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/cutE",this);
|
||||
cutECmd->SetGuidance("Set cut values by RANGE for e-.");
|
||||
cutECmd->SetParameterName("range",true);
|
||||
cutECmd->SetDefaultValue(1.);
|
||||
cutECmd->SetDefaultUnit("mm");
|
||||
cutECmd->AvailableForStates(Idle);
|
||||
|
||||
cutPCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/cutP",this);
|
||||
cutPCmd->SetGuidance("Set cut values by RANGE for proton and others.");
|
||||
cutPCmd->SetParameterName("cutP",false);
|
||||
cutPCmd->SetRange("cutP>0.");
|
||||
cutPCmd->SetUnitCategory("Length");
|
||||
cutPCmd->AvailableForStates(Idle);
|
||||
|
||||
eCmd = new G4UIcmdWithADoubleAndUnit("/lowenergy/cutEnergy",this);
|
||||
eCmd->SetGuidance("Set cut values by ENERGY for charged particles.");
|
||||
eCmd->SetParameterName("cutenergy",false);
|
||||
eCmd->SetRange("cutenergy>0.");
|
||||
eCmd->SetUnitCategory("Energy");
|
||||
eCmd->AvailableForStates(Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPhysicsListMessenger::~XrayFluoPhysicsListMessenger()
|
||||
{
|
||||
|
||||
delete cutGLowLimCmd;
|
||||
delete cutELowLimCmd;
|
||||
delete cutGELowLimCmd;
|
||||
delete cutSecElecCmd;
|
||||
delete cutSecPhotCmd;
|
||||
delete cutGCmd;
|
||||
delete cutECmd;
|
||||
delete cutPCmd;
|
||||
delete eCmd;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
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));}
|
||||
|
||||
if(command == cutSecElecCmd)
|
||||
{ XrayFluoList->SetLowEnSecElecCut(cutSecElecCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if(command == cutGCmd)
|
||||
{ XrayFluoList->SetGammaCut(cutGCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if(command == cutECmd)
|
||||
{ XrayFluoList->SetElectronCut(cutECmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if(command == cutPCmd)
|
||||
{ XrayFluoList->SetProtonCut(cutPCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if(command == eCmd)
|
||||
{ XrayFluoList->SetCutsByEnergy(eCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoPrimaryGeneratorAction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoPrimaryGeneratorAction.hh"
|
||||
#include "G4DataVector.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
#include "XrayFluoPrimaryGeneratorMessenger.hh"
|
||||
#include "XrayFluoRunAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
#include "XrayFluoDataSet.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPrimaryGeneratorAction::XrayFluoPrimaryGeneratorAction(
|
||||
XrayFluoDetectorConstruction* XrayFluoDC)
|
||||
:XrayFluoDetector(XrayFluoDC),rndmFlag("off"),
|
||||
beam("off"),spectrum("off"),isoVert("off")
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
//create a messenger for this class
|
||||
gunMessenger = new XrayFluoPrimaryGeneratorMessenger(this);
|
||||
runManager = new XrayFluoRunAction();
|
||||
|
||||
// default particle kinematic
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="e-");
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
|
||||
particleGun->SetParticleEnergy(50.*MeV);
|
||||
G4double position = -0.5*(XrayFluoDetector->GetWorldSizeZ());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
|
||||
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPrimaryGeneratorAction::~XrayFluoPrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete gunMessenger;
|
||||
delete runManager;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
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);
|
||||
}
|
||||
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
|
||||
|
||||
//randomize starting point
|
||||
if (beam == "on")
|
||||
{
|
||||
G4double radius = 0.5 * mm;
|
||||
G4double rho = radius*sqrt(G4UniformRand());
|
||||
G4double theta = 2*pi*G4UniformRand()*rad;
|
||||
G4double position = -0.5*(XrayFluoDetector->GetWorldSizeZ());
|
||||
|
||||
G4double y = rho * sin(theta);
|
||||
G4double x = rho * cos(theta);
|
||||
|
||||
particleGun->SetParticlePosition(G4ThreeVector(x,y,position));
|
||||
}
|
||||
//shoot particles according to a certain spectrum
|
||||
if (spectrum =="on")
|
||||
{
|
||||
G4String particle = particleGun->GetParticleDefinition()
|
||||
->GetParticleName();
|
||||
if(particle == "proton"|| particle == "alpha")
|
||||
{
|
||||
G4DataVector* energies = runManager->GetEnergies();
|
||||
G4DataVector* data = runManager->GetData();
|
||||
|
||||
G4double sum = runManager->GetDataSum();
|
||||
G4double partSum = 0;
|
||||
G4int j = 0;
|
||||
G4double random= sum*G4UniformRand();
|
||||
while (partSum<random)
|
||||
{
|
||||
partSum += (*data)[j];
|
||||
j++;
|
||||
}
|
||||
|
||||
particleGun->SetParticleEnergy((*energies)[j]);
|
||||
|
||||
}
|
||||
else if (particle == "gamma")
|
||||
{
|
||||
const XrayFluoDataSet* dataSet = runManager->GetGammaSet();
|
||||
|
||||
G4int i = 0;
|
||||
G4int id = 0;
|
||||
G4double minEnergy = 0. * keV;
|
||||
G4double particleEnergy= 0.;
|
||||
G4double maxEnergy = 10. * keV;
|
||||
G4double energyRange = maxEnergy - minEnergy;
|
||||
|
||||
while ( i == 0)
|
||||
{
|
||||
G4double random = G4UniformRand();
|
||||
|
||||
G4double randomNum = G4UniformRand()*5.0E6;
|
||||
|
||||
particleEnergy = random * energyRange;
|
||||
|
||||
if ((dataSet->FindValue(particleEnergy,id)) > randomNum)
|
||||
{
|
||||
i = 1;
|
||||
|
||||
}
|
||||
}
|
||||
particleGun->SetParticleEnergy(particleEnergy);
|
||||
}
|
||||
}
|
||||
|
||||
if (isoVert == "on")
|
||||
{
|
||||
G4double rho = 1. *m;
|
||||
//theta in [0;pi/2]
|
||||
G4double theta = (pi/2)*G4UniformRand();
|
||||
//phi in [-pi;pi]
|
||||
G4double phi = (G4UniformRand()*2*pi)- pi;
|
||||
G4double x = rho*sin(theta)*sin(phi);
|
||||
G4double y = rho*sin(theta)*cos(phi);
|
||||
G4double z = -(rho*cos(theta));
|
||||
particleGun->SetParticlePosition(G4ThreeVector(x,y,z));
|
||||
|
||||
G4double Xdim = XrayFluoDetector->GetSampleSizeXY();
|
||||
G4double Ydim = XrayFluoDetector->GetSampleSizeXY();
|
||||
|
||||
G4double Dx = Xdim*(G4UniformRand()-0.5);
|
||||
|
||||
G4double Dy = Ydim*(G4UniformRand()-0.5);
|
||||
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(-x+Dx,-y+Dy,-z));
|
||||
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
G4double partEnergy = particleGun->GetParticleEnergy();
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->analysePrimaryGenerator(partEnergy/keV);
|
||||
|
||||
#endif
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoPrimarygeneratorMessenger.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoPrimaryGeneratorMessenger.hh"
|
||||
#include "XrayFluoPrimaryGeneratorAction.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPrimaryGeneratorMessenger::XrayFluoPrimaryGeneratorMessenger(XrayFluoPrimaryGeneratorAction* XrayFluoGun)
|
||||
:XrayFluoAction(XrayFluoGun)
|
||||
{
|
||||
RndmCmd = new G4UIcmdWithAString("/gun/random",this);
|
||||
RndmCmd->SetGuidance("Shoot randomly the incident particle.");
|
||||
RndmCmd->SetGuidance(" Choice : on(default), off");
|
||||
RndmCmd->SetParameterName("choice",true);
|
||||
RndmCmd->SetDefaultValue("on");
|
||||
RndmCmd->SetCandidates("on off");
|
||||
RndmCmd->AvailableForStates(PreInit,Idle);
|
||||
|
||||
RndmVert = new G4UIcmdWithAString("/gun/randomVert",this);
|
||||
RndmVert->SetGuidance("Shoot randomly the incident particle.");
|
||||
RndmVert->SetGuidance(" Choice : on(default), off");
|
||||
RndmVert->SetParameterName("choice",true);
|
||||
RndmVert->SetDefaultValue("on");
|
||||
RndmVert->SetCandidates("on off");
|
||||
RndmVert->AvailableForStates(PreInit,Idle);
|
||||
|
||||
spectrum = new G4UIcmdWithAString("/gun/spectrum",this);
|
||||
spectrum->SetGuidance("Shoot the incident particle with a certain energy spectrum.");
|
||||
spectrum->SetGuidance(" Choice : on(default), off");
|
||||
spectrum->SetParameterName("choice",true);
|
||||
spectrum->SetDefaultValue("on");
|
||||
spectrum->SetCandidates("on off");
|
||||
spectrum->AvailableForStates(PreInit,Idle);
|
||||
|
||||
isoVert = new G4UIcmdWithAString("/gun/isoVert",this);
|
||||
isoVert->SetGuidance("Shoot the incident particle from an isotrofic direction.");
|
||||
isoVert->SetGuidance(" Choice : on(default), off");
|
||||
isoVert->SetParameterName("choice",true);
|
||||
isoVert->SetDefaultValue("on");
|
||||
isoVert->SetCandidates("on off");
|
||||
isoVert->AvailableForStates(PreInit,Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoPrimaryGeneratorMessenger::~XrayFluoPrimaryGeneratorMessenger()
|
||||
{
|
||||
delete RndmCmd;
|
||||
delete RndmVert;
|
||||
delete spectrum;
|
||||
delete isoVert;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command == RndmCmd )
|
||||
{ XrayFluoAction->SetRndmFlag(newValue);}
|
||||
if( command == RndmVert )
|
||||
{ XrayFluoAction->SetRndmVert(newValue);}
|
||||
if( command == spectrum )
|
||||
{ XrayFluoAction->SetSpectrum(newValue);}
|
||||
if( command == isoVert )
|
||||
{ XrayFluoAction->SetIsoVert(newValue);}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,413 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoRunAction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoRunAction.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "XrayFluoDataSet.hh"
|
||||
#include "G4DataVector.hh"
|
||||
#include "G4LogLogInterpolation.hh"
|
||||
#include "g4std/fstream"
|
||||
#include "g4std/strstream"
|
||||
#include "XrayFluoNormalization.hh"
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
XrayFluoRunAction::XrayFluoRunAction()
|
||||
:dataSet(0),dataGammaSet(0),dataAlphaSet(0),efficiencySet(0)
|
||||
{
|
||||
XrayFluoNormalization* normalization = new XrayFluoNormalization();
|
||||
|
||||
energies = new G4DataVector;
|
||||
data = new G4DataVector;
|
||||
|
||||
|
||||
ReadData(MeV, "/examples/advanced/xray_fluorescence/mercury_flx_solmin");
|
||||
ReadResponse("/examples/advanced/xray_fluorescence/response");
|
||||
|
||||
G4double minGamma = 0.*keV;
|
||||
G4double maxGamma = 10. *keV;
|
||||
G4int nBinsGamma = 100;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
#else
|
||||
XrayFluoRunAction::XrayFluoRunAction()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
XrayFluoRunAction::~XrayFluoRunAction()
|
||||
{
|
||||
G4std::map<G4int,G4DataVector*,G4std::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;
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
XrayFluoRunAction::~XrayFluoRunAction()
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
|
||||
G4cout << "### Run " << aRun << " start." << G4endl;
|
||||
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
UI->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
// Book histograms and ntuples
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->book();
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoRunAction::EndOfRunAction(const G4Run* aRun )
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->finish();
|
||||
#endif
|
||||
// Run ended, update the visualization
|
||||
if (G4VVisManager::GetConcreteInstance()) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
const XrayFluoDataSet* XrayFluoRunAction::GetSet()
|
||||
{
|
||||
return dataSet;
|
||||
}
|
||||
const XrayFluoDataSet* XrayFluoRunAction::GetGammaSet()
|
||||
{
|
||||
return dataGammaSet;
|
||||
}
|
||||
const XrayFluoDataSet* XrayFluoRunAction::GetAlphaSet()
|
||||
{
|
||||
return dataAlphaSet;
|
||||
}
|
||||
const XrayFluoDataSet* XrayFluoRunAction::GetEfficiencySet()
|
||||
{
|
||||
return efficiencySet;
|
||||
}
|
||||
G4DataVector* XrayFluoRunAction::GetEnergies()
|
||||
{
|
||||
return energies;
|
||||
}
|
||||
G4DataVector* XrayFluoRunAction::GetData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
G4double XrayFluoRunAction::GetDataSum()
|
||||
{
|
||||
G4double sum = 0;
|
||||
size_t size = data->size();
|
||||
for (size_t i = 0; i <size; i++)
|
||||
{
|
||||
sum+=(*data)[i];
|
||||
}
|
||||
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)
|
||||
{
|
||||
G4std::map<G4int,G4DataVector*,G4std::less<G4int> >::const_iterator pos;
|
||||
pos = energyMap.find(Z);
|
||||
G4std::map<G4int,G4DataVector*,G4std::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)
|
||||
{
|
||||
G4std::map<G4int,G4DataVector*,G4std::less<G4int> >::const_iterator pos;
|
||||
pos = energyMap.find(Z);
|
||||
G4std::map<G4int,G4DataVector*,G4std::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)
|
||||
{
|
||||
char nameChar[100] = {""};
|
||||
G4std::ostrstream ost(nameChar, 100, G4std::ios::out);
|
||||
|
||||
ost << fileName <<".dat";
|
||||
|
||||
G4String name(nameChar);
|
||||
|
||||
char* path = getenv("G4INSTALL");
|
||||
|
||||
G4String pathString(path);
|
||||
G4String dirFile = pathString + "/" + name;
|
||||
G4std::ifstream file(dirFile);
|
||||
G4std::filebuf* lsdp = file.rdbuf();
|
||||
|
||||
if (! (lsdp->is_open()) )
|
||||
{
|
||||
G4String excep = "XrayFluoRunAction - data file: " + dirFile + " not found";
|
||||
G4Exception(excep);
|
||||
}
|
||||
G4double a = 0;
|
||||
G4int k = 1;
|
||||
|
||||
do
|
||||
{
|
||||
file >> a;
|
||||
G4int nColumns = 2;
|
||||
// The file is organized into two columns:
|
||||
// 1st column is the energy
|
||||
// 2nd column is the corresponding value
|
||||
// The file terminates with the pattern: -1 -1
|
||||
// -2 -2
|
||||
if (a == -1 || a == -2)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (k%nColumns != 0)
|
||||
{
|
||||
G4double e = a * unitE;
|
||||
|
||||
energies->push_back(e);
|
||||
|
||||
k++;
|
||||
|
||||
}
|
||||
else if (k%nColumns == 0)
|
||||
{
|
||||
G4double value = a;
|
||||
data->push_back(value);
|
||||
|
||||
k = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} while (a != -2); // end of file
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
void XrayFluoRunAction::ReadResponse(const G4String& fileName)
|
||||
{
|
||||
char nameChar[100] = {""};
|
||||
G4std::ostrstream ost(nameChar, 100, G4std::ios::out);
|
||||
|
||||
|
||||
ost << fileName<<".dat";
|
||||
|
||||
G4String name(nameChar);
|
||||
|
||||
char* path = getenv("G4INSTALL");
|
||||
|
||||
G4String pathString(path);
|
||||
G4String dirFile = pathString + "/" + name;
|
||||
G4std::ifstream file(dirFile);
|
||||
G4std::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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoSensorHit.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoSensorHit.hh"
|
||||
|
||||
G4Allocator<XrayFluoSensorHit> XrayFluoSensorHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSensorHit::XrayFluoSensorHit()
|
||||
{
|
||||
EdepTot = 0.;
|
||||
EdepDetect = 0.;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSensorHit::XrayFluoSensorHit(const XrayFluoSensorHit& right)
|
||||
{
|
||||
EdepTot = right.EdepTot ;
|
||||
EdepDetect = right.EdepDetect;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSensorHit::~XrayFluoSensorHit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const XrayFluoSensorHit& XrayFluoSensorHit::operator=(const XrayFluoSensorHit& right)
|
||||
{
|
||||
EdepTot = right.EdepTot ;
|
||||
EdepDetect = right.EdepDetect;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
int XrayFluoSensorHit::operator==(const XrayFluoSensorHit& right) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void XrayFluoSensorHit::Draw()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoSensorHit::Print()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoSteppingAction.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoSteppingAction.hh"
|
||||
#include "XrayFluoDetectorConstruction.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4TrackVector.hh"
|
||||
#include "G4ios.hh"
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "XrayFluoAnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSteppingAction::XrayFluoSteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoSteppingAction::~XrayFluoSteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
|
||||
analysis->analyseStepping(aStep);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,188 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoSteppingVerbose.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayFluoSteppingVerbose.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
////////////////////////////////////////////////
|
||||
XrayFluoSteppingVerbose::XrayFluoSteppingVerbose()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
XrayFluoSteppingVerbose::~XrayFluoSteppingVerbose()
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
void XrayFluoSteppingVerbose::StepInfo()
|
||||
/////////////////////////////////////////
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
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 << 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");
|
||||
|
||||
// if( fStepStatus != fWorldBoundary){
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
G4cout << G4std::setw(10) << fTrack->GetNextVolume()->GetName();
|
||||
} else {
|
||||
G4cout << G4std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
G4cout << G4std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
} else {
|
||||
G4cout << "User Limit";
|
||||
}
|
||||
|
||||
G4cout << G4endl;
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
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
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << G4std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " : "
|
||||
<< G4std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< G4std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< G4std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< G4std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< G4std::setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
void XrayFluoSteppingVerbose::TrackingStarted()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
CopyState();
|
||||
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 << 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");
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << G4std::setw(10) << fTrack->GetNextVolume()->GetName() << " ";
|
||||
} else {
|
||||
G4cout << G4std::setw(10) << "OutOfWorld" << " ";
|
||||
}
|
||||
G4cout << G4std::setw(10) << "initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayFluoVisManager.cc
|
||||
// GEANT4 tag $Name: xray_fluo-V03-02-00
|
||||
//
|
||||
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 28 Nov 2001 Elena Guardincerri Created
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
|
||||
#include "XrayFluoVisManager.hh"
|
||||
|
||||
// Supported drivers...
|
||||
|
||||
// Not needing external packages or libraries...
|
||||
#include "G4ASCIITree.hh"
|
||||
#include "G4DAWNFILE.hh"
|
||||
#include "G4GAGTree.hh"
|
||||
#include "G4HepRepFile.hh"
|
||||
#include "G4RayTracer.hh"
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
|
||||
// Needing external packages or libraries...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
#include "G4FukuiRenderer.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPACS
|
||||
#include "G4Wo.hh"
|
||||
#include "G4Xo.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLX
|
||||
#include "G4OpenGLImmediateX.hh"
|
||||
#include "G4OpenGLStoredX.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLWIN32
|
||||
#include "G4OpenGLImmediateWin32.hh"
|
||||
#include "G4OpenGLStoredWin32.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLXM
|
||||
#include "G4OpenGLImmediateXm.hh"
|
||||
#include "G4OpenGLStoredXm.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIX
|
||||
#include "G4OpenInventorX.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIWIN32
|
||||
#include "G4OpenInventorWin32.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
#include "G4VRML1.hh"
|
||||
#include "G4VRML2.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayFluoVisManager::XrayFluoVisManager () {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayFluoVisManager::RegisterGraphicsSystems () {
|
||||
|
||||
// Graphics Systems not needing external packages or libraries...
|
||||
RegisterGraphicsSystem (new G4ASCIITree);
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
RegisterGraphicsSystem (new G4GAGTree);
|
||||
RegisterGraphicsSystem (new G4HepRepFile);
|
||||
RegisterGraphicsSystem (new G4RayTracer);
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
|
||||
// Graphics systems needing external packages or libraries...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
RegisterGraphicsSystem (new G4FukuiRenderer);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPACS
|
||||
RegisterGraphicsSystem (new G4Wo);
|
||||
RegisterGraphicsSystem (new G4Xo);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLX
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateX);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLWIN32
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLXM
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredXm);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIX
|
||||
RegisterGraphicsSystem (new G4OpenInventorX);
|
||||
#endif
|
||||
|
||||
#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."
|
||||
<< G4endl;
|
||||
PrintAvailableGraphicsSystems ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user