Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
// $Id$
// $Id: DetectorConstruction.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -53,7 +53,8 @@
DetectorConstruction::DetectorConstruction()
:fMaterial_World(0), fMaterial_Frame(0),
fMaterial_ExitWindow(0), fMaterial_ScatterFoil(0), fMaterial_MonitorChbr(0),
fMaterial_Bag(0), fMaterial_Gas(0), fMaterial_Ring(0)
fMaterial_Bag(0), fMaterial_Gas(0), fMaterial_Ring(0),
fPvol_World(0), fPvol_Frame(0), fDetectorMessenger(0)
{
// materials
DefineMaterials();
@@ -281,7 +282,7 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
"Frame", //its name
lvol_World, //its mother volume
false, //no boolean operation
0); //copy number
0); //copy number
// ExitWindow
@@ -352,7 +353,7 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
"Bag", //name
lvol_Frame, //mother volume
false, //no boolean operation
0); //copy number
0); //copy number
// Gas
@@ -375,7 +376,7 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
"Gas", //name
lvol_Bag, //mother volume
false, //no boolean operation
0); //copy number
0); //copy number
// Rings
@@ -407,7 +408,7 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
"Ring", //name
lvol_Gas, //mother volume
false, //no boolean operation
2); //copy number
2); //copy number
// ScatterFoil (only if it is not Air)
@@ -427,13 +428,13 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
zpos = fZfront_ScatterFoil + 0.5*fThickness_ScatterFoil - 0.5*fThickness_Frame;
new G4PVPlacement(0, //no rotation
G4ThreeVector(0,0,zpos), //translation
lvol_ScatterFoil, //logical volume
"ScatterFoil", //name
lvol_Frame, //mother volume
false, //no boolean operation
0); //copy number
new G4PVPlacement(0, //no rotation
G4ThreeVector(0,0,zpos), //translation
lvol_ScatterFoil, //logical volume
"ScatterFoil", //name
lvol_Frame, //mother volume
false, //no boolean operation
0); //copy number
}
PrintGeometry();
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/DetectorMessenger.cc
/// \brief Implementation of the DetectorMessenger class
//
// $Id$
// $Id: DetectorMessenger.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -42,8 +42,9 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:fDetector(Det)
DetectorMessenger::DetectorMessenger(DetectorConstruction * det)
:fDetector(det),
fTestemDir(0), fDetDir(0), fMaterCmd(0), fThickCmd(0), fUpdateCmd(0)
{
fTestemDir = new G4UIdirectory("/testem/");
fTestemDir->SetGuidance("UI commands specific to this example.");
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/EventAction.cc
/// \brief Implementation of the EventAction class
//
// $Id$
// $Id: EventAction.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -41,7 +41,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction()
:fDrawFlag("none"),fPrintModulo(10000)
:fDrawFlag("none"), fPrintModulo(10000), fEventMessenger(0)
{
fEventMessenger = new EventMessenger(this);
}
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/EventMessenger.cc
/// \brief Implementation of the EventMessenger class
//
// $Id$
// $Id: EventMessenger.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -41,7 +41,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventMessenger::EventMessenger(EventAction* EvAct)
:fEventAction(EvAct)
:fEventAction(EvAct), fEventDir(0), fDrawCmd(0), fPrintCmd(0)
{
fEventDir = new G4UIdirectory("/testem/event/");
fEventDir->SetGuidance("event control");
@@ -23,219 +23,69 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file medical/electronScattering/src/HistoManager.cc
/// \file electromagnetic/TestEm5/src/HistoManager.cc
/// \brief Implementation of the HistoManager class
//
//
// $Id$
// $Id: HistoManager.cc 72246 2013-07-12 08:52:53Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "HistoManager.hh"
#include "HistoMessenger.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::HistoManager()
: fFileName("nrccBenchmark")
{
fileName[0] = "nrccBenchmark";
factoryOn = false;
fNbHist = 0;
// histograms
for (G4int k=0; k<MaxHisto; k++) {
fHistId[k] = 0;
fHistPt[k] = 0;
fExist[k] = false;
fUnit[k] = 1.0;
fWidth[k] = 1.0;
fAscii[k] = false;
}
fHistoMessenger = new HistoMessenger(this);
Book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::~HistoManager()
{
delete fHistoMessenger;
delete G4AnalysisManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::book()
void HistoManager::Book()
{
// if no histos, do nothing
if (fNbHist == 0) return;
// Create or get analysis manager
// The choice of analysis technology is done via selection of a namespace
// in HistoManager.hh
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetFileName(fFileName);
analysisManager->SetVerboseLevel(1);
G4String extension = analysisManager->GetFileType();
fileName[1] = fileName[0] + "." + extension;
// Open an output file
//
G4bool fileOpen = analysisManager->OpenFile(fileName[0]);
if (!fileOpen) {
G4cout << "\n---> HistoManager::book(): cannot open " << fileName[1]
<< G4endl;
return;
}
analysisManager->SetActivation(true); // enable inactivation of histograms
// create selected histograms
//
analysisManager->SetFirstHistoId(1);
for (G4int k=0; k<MaxHisto; k++) {
if (fExist[k]) {
fHistId[k] = analysisManager->CreateH1( fLabel[k], fTitle[k],
fNbins[k], fVmin[k], fVmax[k]);
fHistPt[k] = analysisManager->GetH1(fHistId[k]);
factoryOn = true;
}
}
if (factoryOn)
G4cout << "\n----> Histogram file is opened in " << fileName[1] << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::save()
{
if (factoryOn) {
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
analysisManager->CloseFile();
saveAscii(); // Write fAscii file, if any
G4cout << "\n----> Histograms are saved in " << fileName[1] << G4endl;
delete G4AnalysisManager::Instance();
factoryOn = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::FillHisto(G4int ih, G4double e, G4double weight)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::FillHisto() : histo " << ih
<< "does not fExist; e= " << e << " w= " << weight << G4endl;
return;
}
if (fHistPt[ih]) fHistPt[ih]->fill(e/fUnit[ih], weight);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SetHisto(G4int ih,
G4int nbins, G4double vmin, G4double vmax, const G4String& unit)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::SetHisto() : histo " << ih
<< "does not fExist" << G4endl;
return;
}
const G4String id[] = { "0", "1", "2", "3", "4" };
// Define histograms start values
const G4int kMaxHisto = 7;
const G4String id[] = { "0", "1", "2", "3", "4", "5", "6" };
const G4String title[] =
{ "dummy", //0
"projected angle at exit", //1
"dN/dS = f(r) at exit", //2
"d(N/cost)/dS = f(r) at exit", //3
"normalized d(N/cost)/dS = f(r) at exit" //4
"normalized d(N/cost)/dS = f(r) at exit", //4
"scattering angle theta at exit", //5
"measured scattering angle theta at exit" //6
};
G4String titl = title[ih];
fUnit[ih] = 1.;
if (unit != "none") {
titl = title[ih] + " (" + unit + ")";
fUnit[ih] = G4UnitDefinition::GetValueOf(unit);
// Default values (to be reset via /analysis/h1/set command)
G4int nbins = 100;
G4double vmin = 0.;
G4double vmax = 100.;
// Create all histograms as inactivated
// as we have not yet set nbins, vmin, vmax
for (G4int k=0; k<kMaxHisto; k++) {
G4int ih = analysisManager->CreateH1(id[k], title[k], nbins, vmin, vmax);
analysisManager->SetH1Activation(ih, false);
}
fExist[ih] = true;
fLabel[ih] = id[ih];
fTitle[ih] = titl;
fNbins[ih] = nbins;
fVmin[ih] = vmin;
fVmax[ih] = vmax;
fWidth[ih] = fUnit[ih]*(vmax-vmin)/nbins;
fNbHist++;
G4cout << "----> SetHisto " << ih << ": " << titl << "; "
<< nbins << " bins from "
<< vmin << " " << unit << " to " << vmax << " " << unit << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::Normalize(G4int ih, G4double fac)
{
if (ih >= MaxHisto) {
G4cout << "---> warning from HistoManager::Normalize() : histo " << ih
<< " fac= " << fac << G4endl;
return;
}
if (fHistPt[ih]) fHistPt[ih]->scale(fac);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::PrintHisto(G4int ih)
{
if (ih < MaxHisto) { fAscii[ih] = true; fAscii[0] = true; }
else
G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
<< "does not exist" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include <fstream>
void HistoManager::saveAscii()
{
if (!fAscii[0]) return;
G4String name = fileName[0] + ".ascii";
std::ofstream File(name, std::ios::out);
if (!File) {
G4cout
<< "\n---> HistoManager::saveAscii(): cannot open " << name << G4endl;
return;
}
File.setf( std::ios::scientific, std::ios::floatfield );
//write selected histograms
for (G4int ih=0; ih<MaxHisto; ih++) {
if (fHistPt[ih] && fAscii[ih]) {
File << "\n 1D histogram " << ih << ": " << fTitle[ih]
<< "\n \n \t X \t\t Y" << G4endl;
for (G4int iBin=0; iBin<fNbins[ih]; iBin++) {
File << " " << iBin << "\t"
<< fHistPt[ih]->axis().bin_center(iBin) << "\t"
<< fHistPt[ih]->bin_height(iBin)
<< G4endl;
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,120 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file medical/electronScattering/src/HistoMessenger.cc
/// \brief Implementation of the HistoMessenger class
//
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "HistoMessenger.hh"
#include <sstream>
#include "HistoManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::HistoMessenger(HistoManager* manager)
:fHistoManager (manager)
{
fHistoDir = new G4UIdirectory("/testem/histo/");
fHistoDir->SetGuidance("histograms control");
fFileNameCmd = new G4UIcmdWithAString("/testem/histo/setFileName",this);
fFileNameCmd->SetGuidance("set name for the histograms file");
fHistoCmd = new G4UIcommand("/testem/histo/setHisto",this);
fHistoCmd->SetGuidance("Set bining of the histo number ih :");
fHistoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
//
G4UIparameter* ih = new G4UIparameter("ih",'i',false);
ih->SetGuidance("histo number : from 1 to MaxHisto");
ih->SetParameterRange("ih>0");
fHistoCmd->SetParameter(ih);
//
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
nbBins->SetGuidance("number of bins");
nbBins->SetParameterRange("nbBins>0");
fHistoCmd->SetParameter(nbBins);
//
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
valMin->SetGuidance("valMin, expressed in unit");
fHistoCmd->SetParameter(valMin);
//
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
valMax->SetGuidance("valMax, expressed in unit");
fHistoCmd->SetParameter(valMax);
//
G4UIparameter* unit = new G4UIparameter("unit",'s',true);
unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
unit->SetDefaultValue("none");
fHistoCmd->SetParameter(unit);
fPrtHistoCmd = new G4UIcmdWithAnInteger("/testem/histo/printHisto",this);
fPrtHistoCmd->SetGuidance("print histo #id on ascii file");
fPrtHistoCmd->SetParameterName("id",false);
fPrtHistoCmd->SetRange("id>0");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete fPrtHistoCmd;
delete fHistoCmd;
delete fFileNameCmd;
delete fHistoDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if (command == fFileNameCmd)
fHistoManager->SetFileName(newValues);
if (command == fHistoCmd)
{ G4int ih,nbBins; G4double vmin,vmax; G4String unit;
const char* t = newValues;
std::istringstream is(t);
is >> ih >> nbBins >> vmin >> vmax >> unit;
fHistoManager->SetHisto (ih,nbBins,vmin,vmax,unit);
}
if (command == fPrtHistoCmd)
fHistoManager->PrintHisto(fPrtHistoCmd->GetNewIntValue(newValues));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/PhysListEmStandard.cc
/// \brief Implementation of the PhysListEmStandard class
//
// $Id$
// $Id: PhysListEmStandard.cc 68608 2013-04-02 00:23:25Z adotti $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -88,9 +88,9 @@ void PhysListEmStandard::ConstructProcess()
// Add standard EM Processes
//
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
aParticleIterator->reset();
while( (*aParticleIterator)() ){
G4ParticleDefinition* particle = aParticleIterator->value();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
@@ -98,7 +98,7 @@ void PhysListEmStandard::ConstructProcess()
////ph->RegisterProcess(new G4RayleighScattering, particle);
ph->RegisterProcess(new G4PhotoElectricEffect, particle);
G4ComptonScattering* cs = new G4ComptonScattering;
cs->SetModel(new G4KleinNishinaModel());
cs->SetEmModel(new G4KleinNishinaModel());
ph->RegisterProcess(cs, particle);
ph->RegisterProcess(new G4GammaConversion, particle);
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/PhysListEmStandardGS.cc
/// \brief Implementation of the PhysListEmStandardGS class
//
// $Id$
// $Id: PhysListEmStandardGS.cc 68608 2013-04-02 00:23:25Z adotti $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -77,9 +77,9 @@ void PhysListEmStandardGS::ConstructProcess()
// Add standard EM Processes
//
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
aParticleIterator->reset();
while( (*aParticleIterator)() ){
G4ParticleDefinition* particle = aParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/PhysListEmStandardSS.cc
/// \brief Implementation of the PhysListEmStandardSS class
//
// $Id$
// $Id: PhysListEmStandardSS.cc 68608 2013-04-02 00:23:25Z adotti $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -71,9 +71,9 @@ void PhysListEmStandardSS::ConstructProcess()
{
// Add standard EM Processes
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
aParticleIterator->reset();
while( (*aParticleIterator)() ){
G4ParticleDefinition* particle = aParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/PhysListEmStandardWVI.cc
/// \brief Implementation of the PhysListEmStandardWVI class
//
// $Id$
// $Id: PhysListEmStandardWVI.cc 68608 2013-04-02 00:23:25Z adotti $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -81,9 +81,9 @@ void PhysListEmStandardWVI::ConstructProcess()
// Add standard EM Processes
//
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
aParticleIterator->reset();
while( (*aParticleIterator)() ){
G4ParticleDefinition* particle = aParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/PhysicsList.cc
/// \brief Implementation of the PhysicsList class
//
// $Id$
// $Id: PhysicsList.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -75,7 +75,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList() : G4VModularPhysicsList()
PhysicsList::PhysicsList() : G4VModularPhysicsList(),
fMessenger(0), fEmName("local"), fEmPhysicsList(0)
{
fMessenger = new PhysicsListMessenger(this);
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/PhysicsListMessenger.cc
/// \brief Implementation of the PhysicsListMessenger class
//
// $Id$
// $Id: PhysicsListMessenger.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -41,7 +41,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
:fPhysicsList(pPhys)
:fPhysicsList(pPhys), fPhysDir(0), fListCmd(0), fGammaCutCmd(0),
fElectCutCmd(0), fProtoCutCmd(0), fAllCutCmd(0)
{
fPhysDir = new G4UIdirectory("/testem/phys/");
fPhysDir->SetGuidance("physics list commands");
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
// $Id$
// $Id: PrimaryGeneratorAction.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -45,7 +45,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
:fDetector(DC)
:fParticleGun(0), fDetector(DC), fGunMessenger(0)
{
fParticleGun = new G4ParticleGun(1);
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/PrimaryGeneratorMessenger.cc
/// \brief Implementation of the PrimaryGeneratorMessenger class
//
// $Id$
// $Id: PrimaryGeneratorMessenger.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -41,7 +41,7 @@
PrimaryGeneratorMessenger::PrimaryGeneratorMessenger(
PrimaryGeneratorAction* Gun)
:fAction(Gun)
:fAction(Gun), fGunDir(0), fRndmCmd(0)
{
fGunDir = new G4UIdirectory("/testem/gun/");
fGunDir->SetGuidance("gun control");
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// $Id$
// $Id: RunAction.cc 69009 2013-04-15 09:33:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -47,29 +47,37 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin,
HistoManager* histo)
:fDetector(det), fPrimary(kin), fHistoManager(histo)
{ }
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin)
:fDetector(det), fPrimary(kin), fHistoManager(0)
{
fHistoManager = new HistoManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
{ }
{
delete fHistoManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
fHistoManager->book();
InitFluence();
// save Rndm status
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
CLHEP::HepRandom::showEngineStatus();
//histograms
//
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->IsActive() ) {
analysisManager->OpenFile();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -104,16 +112,22 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
// normalize histograms
//
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4double fac = 1./(double(TotNbofEvents));
fHistoManager->Normalize(1,fac);
fHistoManager->Normalize(2,fac);
fHistoManager->Normalize(3,fac);
analysisManager->ScaleH1(1,fac);
analysisManager->ScaleH1(2,fac);
analysisManager->ScaleH1(3,fac);
analysisManager->ScaleH1(5,fac);
analysisManager->ScaleH1(6,fac);
ComputeFluenceError();
PrintFluence(TotNbofEvents);
// save histograms
fHistoManager->save();
if ( analysisManager->IsActive() ) {
analysisManager->Write();
analysisManager->CloseFile();
}
// show Rndm status
CLHEP::HepRandom::showEngineStatus();
@@ -125,14 +139,14 @@ void RunAction::InitFluence()
{
// create Fluence histo in any case
//
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4int ih = 4;
if (!fHistoManager->HistoExist(ih))
fHistoManager->SetHisto(ih, 120, 0*mm, 240*mm, "mm");
analysisManager->SetH1(ih, 120, 0*mm, 240*mm, "mm");
//construct vectors for fluence distribution
//
fNbBins = fHistoManager->GetNbins(ih);
fDr = fHistoManager->GetBinWidth(ih);
fNbBins = analysisManager->GetH1Nbins(ih);
fDr = analysisManager->GetH1Width(ih);
fluence.resize(fNbBins, 0.);
fluence1.resize(fNbBins, 0.);
fluence2.resize(fNbBins, 0.);
@@ -198,7 +212,8 @@ void RunAction::ComputeFluenceError()
fluence1[bin] = ratio;
fluence2[bin] = error;
rmean += fDr;
fHistoManager->FillHisto(4,rmean,ratio);
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH1(4,rmean,ratio);
}
}
@@ -208,7 +223,8 @@ void RunAction::ComputeFluenceError()
void RunAction::PrintFluence(G4int TotEvents)
{
G4String name = fHistoManager->GetFileName();
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4String name = analysisManager->GetFileName();
G4String fileName = name + ".ascii";
std::ofstream File(fileName, std::ios::out);
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/StepMax.cc
/// \brief Implementation of the StepMax class
//
// $Id$
// $Id: StepMax.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -37,7 +37,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMax::StepMax(const G4String& processName)
: G4VDiscreteProcess(processName),fMaxChargedStep(DBL_MAX)
: G4VDiscreteProcess(processName),fMaxChargedStep(DBL_MAX), fMess(0)
{
fMess = new StepMaxMessenger(this);
}
@@ -26,7 +26,7 @@
/// \file medical/electronScattering/src/StepMaxMessenger.cc
/// \brief Implementation of the StepMaxMessenger class
//
// $Id$
// $Id: StepMaxMessenger.cc 68393 2013-03-25 14:22:21Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -39,7 +39,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMaxMessenger::StepMaxMessenger(StepMax* stepM)
:fStepMax(stepM)
:fStepMax(stepM), fStepMaxCmd(0)
{
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
fStepMaxCmd->SetGuidance("Set max allowed step length");
@@ -23,24 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file medical/electronScattering/src/SteppingVerbose.cc
/// \file radioactivedecay/rdecay01/src/SteppingVerbose.cc
/// \brief Implementation of the SteppingVerbose class
//
//
// $Id$
// $Id: SteppingVerbose.cc 71033 2013-06-10 09:14:10Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4ParticleTypes.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingVerbose::SteppingVerbose()
{}
: G4SteppingVerbose()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,10 +51,46 @@ SteppingVerbose::~SteppingVerbose()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::StepInfo()
{
void SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
//Step zero
//
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< std::setw(10) << fTrack->GetVolume()->GetName()
<< " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
@@ -101,13 +139,13 @@ void SteppingVerbose::StepInfo()
lp1<(*fSecondary).size(); lp1++){
G4cout << " "
<< std::setw(13)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName()
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName()
<< ": energy ="
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< " time ="
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time");
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time");
G4cout << G4endl;
}
@@ -121,37 +159,3 @@ void SteppingVerbose::StepInfo()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< std::setw(10) << fTrack->GetVolume()->GetName()
<< " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,7 @@
/// \brief Implementation of the TrackingAction class
//
//
// $Id$
// $Id: TrackingAction.cc 69009 2013-04-15 09:33:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -44,9 +44,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::TrackingAction(DetectorConstruction* DET,RunAction* RA,
HistoManager* HM)
:fDetector(DET), fRunAction(RA), fHistoManager(HM)
TrackingAction::TrackingAction(DetectorConstruction* DET,RunAction* RA)
:fDetector(DET), fRunAction(RA)
{
fZend = 0.5*(fDetector->GetThicknessWorld());
}
@@ -60,6 +59,8 @@ void TrackingAction::PreUserTrackingAction(const G4Track*)
void TrackingAction::PostUserTrackingAction(const G4Track* track)
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4double charge = track->GetDefinition()->GetPDGCharge();
G4ThreeVector position = track->GetPosition();
G4ThreeVector direction = track->GetMomentumDirection();
@@ -74,38 +75,60 @@ void TrackingAction::PostUserTrackingAction(const G4Track* track)
//projected angle at exit
//
G4double ux = direction.x(), uy = direction.y(), uz = direction.z();
if (fHistoManager->HistoExist(ih)) {
G4double thetax = std::atan(ux/uz);
G4double thetay = std::atan(uy/uz);
fHistoManager->FillHisto(ih, thetax);
fHistoManager->FillHisto(ih, thetay);
}
G4double thetax = std::atan(ux/uz);
G4double thetay = std::atan(uy/uz);
analysisManager->FillH1(ih, thetax);
analysisManager->FillH1(ih, thetay);
//dN/dS at exit
//
G4double x = position.x(), y = position.y();
G4double r = std::sqrt(x*x + y*y);
ih = 2;
if (fHistoManager->HistoExist(ih)) {
dr = fHistoManager->GetBinWidth(ih);
rmin = ((int)(r/dr))*dr;
ds = twopi*(rmin + 0.5*dr)*dr;
fHistoManager->FillHisto(ih, r, 1/ds);
}
dr = analysisManager->GetH1Width(ih);
rmin = ((int)(r/dr))*dr;
ds = twopi*(rmin + 0.5*dr)*dr;
analysisManager->FillH1(ih, r, 1/ds);
//d(N/cost)/dS at exit
//
ih = 3;
if (fHistoManager->HistoExist(ih)) {
dr = fHistoManager->GetBinWidth(ih);
rmin = ((int)(r/dr))*dr;
ds = twopi*(rmin + 0.5*dr)*dr;
fHistoManager->FillHisto(ih, r, 1/(uz*ds));
}
dr = analysisManager->GetH1Width(ih);
rmin = ((int)(r/dr))*dr;
ds = twopi*(rmin + 0.5*dr)*dr;
analysisManager->FillH1(ih, r, 1/(uz*ds));
//vector of d(N/cost)/dS at exit
//
fRunAction->SumFluence(r, 1/uz);
//space angle at exit : dN/dOmega
//
ih = 5;
G4double theta = std::acos(uz);
if (theta > 0.) {
G4double dtheta = analysisManager->GetH1Width(ih);
G4double unit = analysisManager->GetH1Unit(ih);
if (dtheta > 0.) {
G4double weight = unit*unit/(twopi*std::sin(theta)*dtheta);
analysisManager->FillH1(ih, theta, weight);
}
}
//measured space angle at exit : dN/dOmega_meas
//
ih = 6;
const G4double dist = fDetector->GetThicknessFrame();
G4double thetam = std::atan(r/dist);
if (thetam > 0.) {
G4double dtheta = analysisManager->GetH1Width(ih);
G4double unit = analysisManager->GetH1Unit(ih);
if (dtheta > 0.) {
G4double weight = unit*unit/(twopi*std::sin(thetam)*dtheta);
analysisManager->FillH1(ih, thetam, weight);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......