Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
+114
View File
@@ -0,0 +1,114 @@
//$Id$
///\file "hadronic/Hadr00/.README"
///\brief Example Hadr00 README page
/*! \page ExampleHadr00 Example Hadr00
\author V.Ivanchenko \n
CERN, Geneva, Switzerland
This example demonstrates a usage of G4PhysListFactory to build
Physics List and G4HadronicProcessStore to access cross sections.
\section Hadr00_s1 GEOMETRY
The Target volume is a cylinder placed inside the World volume. Following
UI commands are available to modify the geometry:
\verbatim
/testhadr/TargetMat G4_Pb
/testhadr/WorldMat G4_AIR
/testhadr/TargetRadius 10 mm
/testhadr/TargetLength 20 cm
\endverbatim
If geometry was changed between two runs, then the following command need to
be executed:
\verbatim
/testhadr/update
\endverbatim
By default beam direction coincides with the target axis and is Z axis
in the global coordinate system. The beam starts in the middle of the target.
G4ParticleGun is used as a primary generator. The energy and the type of
the beam can be defined via standard UI commands
\verbatim
/gun/energy 15 GeV
/gun/particle proton
\endverbatim
\section Hadr00_s2 PHYSICS
Physics List is defined by its name given in the 3d argument of the of the
run command.
\verbatim
Hadr00 my.macro QGSP_BERT
\endverbatim
If 3d argument is not set then by the PHYSLIST environment variable.
By default FTFP_BERT Physics List will be instantiated.
\section Hadr00_s3 CROSS SECTION
At the end of any run the set of cross sections is built and can be printed
out for a given projectile particle and a target element, which can be
defined via UI commands:
\verbatim
/testhadr/particle pi+
/testhadr/targetElm Pb
/testhadr/verbose 1
\endverbatim
The level verbosity above zero provides printout of the cross section table.
The energy/momentum limits and number of bins can be set via UI commands:
\verbatim
/testhadr/nBinsE 900
/testhadr/nBinsP 700
/testhadr/minEnergy 1 keV
/testhadr/maxEnergy 1 TeV
/testhadr/minMomentum 1 MeV
/testhadr/maxMOmentum 10 TeV
\endverbatim
\section Hadr00_s4 VISUALIZATION
For interactive mode G4 visualization options and variables should be
defined, then the example should be recompiled:
\verbatim
gmake visclean
gmake
\endverbatim
The vis.mac file can be used an example of visualization. The following
command can be used:
\verbatim
/testhadr/DrawTracks charged
/testhadr/DrawTracks neutral
/testhadr/DrawTracks all
\endverbatim
\section Hadr00_s5 HISTOGRAMS
All histograms are provided in decimal logarithmic scale (log10(E/MeV)
and log10(p/GeV)) for one projectile particle and one target element.
The element is taken from the Geant4 NIST database, natural isotope
composition is assumed.
It is possible to change scale and output file name using UI commands:
\verbatim
/testhadr/histo/fileName name
/testhadr/histo/setHisto idx nbins vmin vmax unit
\endverbatim
Only ROOT histograms are available.
*/
@@ -1,12 +1,58 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(Hadr00)
set(name hadr00)
project(${name})
find_package(Geant4 REQUIRED)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
find_package(Geant4 REQUIRED ui_all vis_all)
else()
find_package(Geant4 REQUIRED)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR})
file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(Hadr00 Hadr00.cc ${sources} ${headers})
target_link_libraries(Hadr00 ${Geant4_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build Hadr00. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(Hadr00_SCRIPTS
hadr00_all_hp.in hadr00_all.in hadr00.in hadr00.out n.mac pi.mac pn.mac vis.mac
)
foreach(_script ${Hadr00_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS Hadr00 DESTINATION bin)
add_executable(${name} EXCLUDE_FROM_ALL ${name}.cc ${sources})
target_link_libraries(${name} ${Geant4_LIBRARIES})
@@ -4,7 +4,7 @@
# GNUmakefile for examples module
# --------------------------------------------------------------
name := hadr00
name := Hadr00
G4TARGET := $(name)
G4EXLIB := true
+28 -1
View File
@@ -5,7 +5,7 @@ $Id: History,v 1.10 2010-10-11 11:03:56 vnivanch Exp $
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
hadr00 History file
Hadr00 History file
--------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
@@ -15,6 +15,33 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
15-11-12 I. Hrivnacova (exhadr00-V09-05-07)
- Synchronized .README with changes in README
13-07-12 V.Ivant (exhadr00-V09-05-06)
- upgraded README
21-09-12 I.Hrivnacova (exhadr00-V09-05-05)
- Cleanup CMakeLists.txt
- Adding explicit includes of G4SystemOfUnits.hh and G4PhysicalConstants.hh
- Replaced tabulators with space characters
12-07-12 V.Ivant (exhadr00-V09-05-04)
- use FTFP_BERT as a default
23-05-12 V.Ivant (exhadr00-V09-05-03)
- Histo - fixed n-tuples
30-04-12 V.Ivant (exhadr00-V09-05-02)
- Fixed compillation problem of previous tag
26-04-12 V.Ivant (exhadr00-V09-05-01)
- Migration to built-in Geant4 analysis and apply code convention
20-03-12 V.Ivant (exhadr00-V09-05-00)
- HistoManager - use material pointer in the interface to cross
sections (avoid crash for Physics Lists with HP)
11-10-10 V.Ivant (exhadr00-V09-03-04)
- Cleanup AIDA interface
+11 -36
View File
@@ -37,8 +37,13 @@ the beam can be defined via standard UI commands
PHYSICS
Physics List is defined by the PHYSLIST environment variable. By default
QGSP_BERT Physics List will be instantiated.
Physics List is defined by its name given in the 3d argument of the of the
run command.
Hadr00 my.macro QGSP_BERT
If 3d argument is not set then by the PHYSLIST environment variable.
By default FTFP_BERT Physics List will be instantiated.
CROSS SECTION
@@ -83,39 +88,9 @@ and log10(p/GeV)) for one projectile particle and one target element.
The element is taken from the Geant4 NIST database, natural isotope
composition is assumed.
To use histograms any of implementations of AIDA interfaces should
be available (see http://aida.freehep.org).
It is possible to change scale and output file name using UI commands:
For example, if iAIDA is installed and compiled at SLC4 Linux
/testhadr/histo/fileName name
/testhadr/histo/setHisto idx nbins vmin vmax unit
setenv AIDA_DIR $MYPACKAGES/analysis/iAIDA/install/slc4_amd64_gcc34_root
setenv PATH ${PATH}:${AIDA_DIR}/bin
Before compilation of the example it is optimal to clean up old
object files:
gmake histclean
setenv G4ANALYSIS_USE 1
gmake
It is possible to choose the format of the output file with
histograms using UI command:
/testhadr/HistoName name
/testhadr/HistoType type
/testhadr/HistoOption "uncompress"
The following types are available: hbook, root, aida. They will be
stored in the file "name.hbook", "name.root", or "name.aida".
To show the content of a histogram ID=i the commands may be applied:
/testhadr/HistoPrint i
!!!
Please put '/run/initialize' after '/testhadr/' commands and before
'/run/beamOn ' command:
/testhadr/..
/run/initialize
/run/beamOn 0
Only ROOT histograms are available.
+21 -10
View File
@@ -23,12 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr00/Hadr00.cc
/// \brief Main program of the hadronic/Hadr00 example
//
// $Id: hadr00.cc,v 1.4 2010-05-27 18:09:56 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
// -------------------------------------------------------------
// GEANT4 hadr00
// GEANT4 Hadr00
//
// Application demonstrating Geant4 hadronic cross sections
//
@@ -77,16 +79,25 @@ int main(int argc,char** argv) {
G4PhysListFactory factory;
G4VModularPhysicsList* phys = 0;
G4String physName = "";
// Physics List name defined via 2nd argument
if (argc==3) {
G4String physName = argv[2];
if(factory.IsReferencePhysList(physName))
phys = factory.GetReferencePhysList(physName);
}
// Physics List name defined via 3nd argument
if (argc==3) { physName = argv[2]; }
// Physics List is defined via environment variable PHYSLIST
if(!phys) phys = factory.ReferencePhysList();
if("" == physName) {
char* path = getenv("PHYSLIST");
if (path) { physName = G4String(path); }
}
// if name is not known to the factory use FTFP_BERT
if("" == physName || !factory.IsReferencePhysList(physName)) {
physName = "FTFP_BERT";
}
// reference PhysicsList via its name
phys = factory.GetReferencePhysList(physName);
runManager->SetUserInitialization(phys);
runManager->SetUserAction(new PrimaryGeneratorAction());
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
#================================================
# Macro file for hadr00
# Macro file for Hadr00
# 26.06.2009 V.Ivanchneko
#================================================
/control/verbose 1
@@ -1,5 +1,5 @@
#================================================
# Macro file for hadr00
# Macro file for Hadr00
# 26.06.2009 V.Ivanchneko
#================================================
/control/verbose 1
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: DetectorConstruction.hh,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/include/DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
//
@@ -71,16 +73,16 @@ private:
DetectorConstruction & operator=(const DetectorConstruction &right);
DetectorConstruction(const DetectorConstruction&);
G4double radius;
G4double length;
G4double fRadius;
G4double fLength;
G4Material* targetMaterial;
G4Material* worldMaterial;
G4Material* fTargetMaterial;
G4Material* fWorldMaterial;
G4LogicalVolume* logicTarget;
G4LogicalVolume* logicWorld;
G4LogicalVolume* fLogicTarget;
G4LogicalVolume* fLogicWorld;
DetectorMessenger* detectorMessenger;
DetectorMessenger* fDetectorMessenger;
};
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr00/include/DetectorMessenger.hh
/// \brief Definition of the DetectorMessenger class
//
// $Id: DetectorMessenger.hh,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
/////////////////////////////////////////////////////////////////////////
@@ -66,23 +67,23 @@ public:
private:
DetectorConstruction* Detector;
DetectorConstruction* fDetector;
G4UIdirectory* testDir;
G4UIcmdWithAString* matCmd;
G4UIcmdWithAString* mat1Cmd;
G4UIcmdWithADoubleAndUnit* rCmd;
G4UIcmdWithADoubleAndUnit* lCmd;
G4UIcmdWithAnInteger* binCmd;
G4UIcmdWithAnInteger* nOfAbsCmd;
G4UIcmdWithAnInteger* verbCmd;
G4UIcmdWithAString* csCmd;
G4UIcmdWithAString* partCmd;
G4UIcmdWithADoubleAndUnit* e1Cmd;
G4UIcmdWithADoubleAndUnit* e2Cmd;
G4UIcmdWithADoubleAndUnit* p1Cmd;
G4UIcmdWithADoubleAndUnit* p2Cmd;
G4UIcmdWithoutParameter* updateCmd;
G4UIdirectory* ftestDir;
G4UIcmdWithAString* fmatCmd;
G4UIcmdWithAString* fmat1Cmd;
G4UIcmdWithADoubleAndUnit* frCmd;
G4UIcmdWithADoubleAndUnit* flCmd;
G4UIcmdWithAnInteger* fbinCmd;
G4UIcmdWithAnInteger* fnOfAbsCmd;
G4UIcmdWithAnInteger* fverbCmd;
G4UIcmdWithAString* fcsCmd;
G4UIcmdWithAString* fpartCmd;
G4UIcmdWithADoubleAndUnit* fe1Cmd;
G4UIcmdWithADoubleAndUnit* fe2Cmd;
G4UIcmdWithADoubleAndUnit* fp1Cmd;
G4UIcmdWithADoubleAndUnit* fp2Cmd;
G4UIcmdWithoutParameter* fupdateCmd;
};
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: EventAction.hh,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/include/EventAction.hh
/// \brief Definition of the EventAction class
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
//
@@ -60,29 +62,36 @@ public: // Without description
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
void SetPrintModulo(G4int val) {printModulo = val;};
void SetDrawFlag(G4String val) {drawFlag = val;};
void AddEventToDebug(G4int val) {selectedEvents.push_back(val);
nSelected++;};
inline void SetPrintModulo(G4int val);
inline void AddEventToDebug(G4int val);
private:
EventAction & operator=(const EventAction &right);
EventAction(const EventAction&);
EventActionMessenger* eventMessenger;
EventActionMessenger* fEventMessenger;
G4UImanager* UI;
std::vector<G4int> selectedEvents;
std::vector<G4int> fSelectedEvents;
G4int printModulo;
G4int nSelected;
G4int fPrintModulo;
G4int fSelected;
// drawFlags = all, charged, neutral, charged+n
G4String drawFlag;
G4bool debugStarted;
G4bool fDebugStarted;
};
inline void EventAction::SetPrintModulo(G4int val)
{
fPrintModulo = val;
}
inline void EventAction::AddEventToDebug(G4int val)
{
fSelectedEvents.push_back(val);
++fSelected;
}
#endif
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: EventActionMessenger.hh,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/include/EventActionMessenger.hh
/// \brief Definition of the EventActionMessenger class
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
//
@@ -57,14 +59,13 @@ public:
EventActionMessenger(EventAction*);
virtual ~EventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
virtual void SetNewValue(G4UIcommand*, G4String);
private:
EventAction* eventAction;
G4UIcmdWithAString* drawCmd;
G4UIcmdWithAnInteger* printCmd;
G4UIcmdWithAnInteger* dCmd;
EventAction* fEventAction;
G4UIcmdWithAnInteger* fPrintCmd;
G4UIcmdWithAnInteger* fCmd;
};
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: Histo.hh,v 1.2 2010-10-11 11:02:36 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/include/Histo.hh
/// \brief Definition of the Histo class
//
// $Id$
#ifndef Histo_h
#define Histo_h 1
@@ -43,81 +45,98 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "globals.hh"
#include <vector>
#include "G4DynamicParticle.hh"
#include "G4VPhysicalVolume.hh"
#include "G4DataVector.hh"
#include "G4Track.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4RootAnalysisManager;
class HistoMessenger;
namespace AIDA {
class ITree;
class IHistogram1D;
class IAnalysisFactory;
}
class Histo
{
public:
Histo(G4int ver);
Histo();
~Histo();
void book();
// Book predefined histogramms
void Book();
void save();
// Save histogramms to file
void Save();
void add1D(const G4String&, const G4String&, G4int nb=100, G4double x1=0.,
G4double x2=1., G4double u=1.);
// In this method histogramms are predefined
// In this method 1-D histogramms are predefined
void Add1D(const G4String&, const G4String&, G4int nb, G4double x1,
G4double x2, G4double u=1.);
void setHisto1D(G4int, G4int, G4double, G4double, G4double w=1.0);
// It change bins and boundaries
void SetHisto1D(G4int, G4int, G4double, G4double, G4double);
// Histogram activation/deactivation
void Activate(G4int, G4bool);
void fill(G4int, G4double, G4double);
// Histogramms are filled
void Fill(G4int, G4double, G4double);
void scale(G4int, G4double);
// Histogramms are scaled
void ScaleH1(G4int, G4double);
void setFileName(const G4String& nam) {histName = nam;};
// In this method nTuple is booked
void AddTuple(const G4String&);
void setFileOption(const G4String& nam) {option = nam;};
// In this method nTuple is booked
void AddTupleI(const G4String&);
void AddTupleF(const G4String&);
void AddTupleD(const G4String&);
void setFileType(const G4String& nam);
// Fill nTuple parameter
void FillTupleI(G4int, G4int);
void FillTupleF(G4int, G4float);
void FillTupleD(G4int, G4double);
void print(G4int i);
// Save tuple event
void AddRow();
void setVerbose(G4int val) {verbose = val;};
// Set output file
void SetFileName(const G4String&);
void SetFileType(const G4String&);
inline void SetVerbose(G4int val) { fVerbose = val; };
inline G4bool IsActive() const { return fHistoActive; };
private:
G4String histName;
G4String histType;
G4String option;
G4String tupleName;
G4String tupleId;
G4String tupleList;
G4int nHisto;
G4int verbose;
G4int defaultAct;
G4RootAnalysisManager* fManager;
HistoMessenger* fMessenger;
G4String fHistName;
G4String fHistType;
G4String fTupleName;
G4String fTupleTitle;
G4int fNHisto;
G4int fVerbose;
G4bool fDefaultAct;
G4bool fHistoActive;
G4bool fNtupleActive;
std::vector<G4int> fHisto;
std::vector<G4int> fTupleI;
std::vector<G4int> fTupleF;
std::vector<G4int> fTupleD;
std::vector<G4int> fBins;
std::vector<G4bool> fActive;
std::vector<G4double> fXmin;
std::vector<G4double> fXmax;
std::vector<G4double> fUnit;
std::vector<G4String> fIds;
std::vector<G4String> fTitles;
std::vector<G4String> fNtupleI;
std::vector<G4String> fNtupleF;
std::vector<G4String> fNtupleD;
std::vector<AIDA::IHistogram1D*> histo;
AIDA::IAnalysisFactory* af;
AIDA::ITree* tree;
HistoMessenger* messenger;
std::vector<G4int> active;
std::vector<G4int> bins;
std::vector<G4double> xmin;
std::vector<G4double> xmax;
std::vector<G4double> unit;
std::vector<G4String> ids;
std::vector<G4String> tittles;
};
#endif
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HistoManager.hh,v 1.2 2010-10-11 11:02:36 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/include/HistoManager.hh
/// \brief Definition of the HistoManager class
//
// $Id$
//
//---------------------------------------------------------------------------
//
@@ -92,68 +94,68 @@ private:
static HistoManager* fManager;
Histo* histo;
Histo* fHisto;
const G4ParticleDefinition* neutron;
const G4ParticleDefinition* fNeutron;
G4String particleName;
G4String elementName;
G4String fParticleName;
G4String fElementName;
G4double minKinEnergy;
G4double maxKinEnergy;
G4double minMomentum;
G4double maxMomentum;
G4double fMinKinEnergy;
G4double fMaxKinEnergy;
G4double fMinMomentum;
G4double fMaxMomentum;
G4int verbose;
G4int nBinsE;
G4int nBinsP;
G4int fVerbose;
G4int fBinsE;
G4int fBinsP;
G4bool isInitialised;
G4bool fIsInitialised;
};
inline void HistoManager::SetParticleName(const G4String& name)
{
particleName = name;
fParticleName = name;
}
inline void HistoManager::SetElementName(const G4String& name)
{
elementName = name;
fElementName = name;
}
inline void HistoManager::SetNumberOfBinsE(G4int val)
{
if(val>0) { nBinsE = val; }
if(val>0) { fBinsE = val; }
}
inline void HistoManager::SetNumberOfBinsP(G4int val)
{
if(val>0) { nBinsP = val; }
if(val>0) { fBinsP = val; }
}
inline void HistoManager::SetMinKinEnergy(G4double val)
{
if(val>0 && val<maxKinEnergy) { minKinEnergy = val; }
if(val>0 && val<fMaxKinEnergy) { fMinKinEnergy = val; }
}
inline void HistoManager::SetMaxKinEnergy(G4double val)
{
if(val>minKinEnergy) { maxKinEnergy = val; }
if(val>fMinKinEnergy) { fMaxKinEnergy = val; }
}
inline void HistoManager::SetMinMomentum(G4double val)
{
if(val>0 && val<maxMomentum) { minMomentum = val; }
if(val>0 && val<fMaxMomentum) { fMinMomentum = val; }
}
inline void HistoManager::SetMaxMomentum(G4double val)
{
if(val>minMomentum) { maxMomentum = val; }
if(val>fMinMomentum) { fMaxMomentum = val; }
}
inline G4int HistoManager::GetVerbose() const
{
return verbose;
return fVerbose;
}
#endif
@@ -23,23 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr00/include/HistoMessenger.hh
/// \brief Definition of the HistoMessenger class
//
// $Id: HistoMessenger.hh,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
/////////////////////////////////////////////////////////////////////////
//
// HistoMessenger
//
// Created: 31.01.2003 V.Ivanchenko
//
// Modified:
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
//
////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HistoMessenger_h
#define HistoMessenger_h 1
@@ -49,9 +42,9 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class Histo;
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -62,18 +55,17 @@ public:
HistoMessenger(Histo* );
virtual ~HistoMessenger();
void SetNewValue(G4UIcommand* ,G4String );
virtual void SetNewValue(G4UIcommand* ,G4String );
private:
Histo* histo;
Histo* fHisto;
G4UIcmdWithAString* factoryCmd;
G4UIcmdWithAString* fileCmd;
G4UIcmdWithAString* optCmd;
G4UIcmdWithAnInteger* printCmd;
G4UIcommand* histoCmd;
G4UIdirectory* fHistoDir;
G4UIcmdWithAString* fFactoryCmd;
G4UIcmdWithAString* fFileCmd;
G4UIcommand* fHistoCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr00/include/PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.hh,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
/////////////////////////////////////////////////////////////////////////
@@ -62,7 +63,7 @@ private:
PrimaryGeneratorAction & operator=(const PrimaryGeneratorAction &right);
PrimaryGeneratorAction(const PrimaryGeneratorAction&);
G4ParticleGun* particleGun;
G4ParticleGun* fParticleGun;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,29 +23,32 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr00/include/RunAction.hh
/// \brief Definition of the RunAction class
//
// $Id$
//
#ifndef RunAction_h
#define RunAction_h 1
/////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------
//
// EventAction
// GEANT4 Header file
// RunAction
//
// Created: 21.06.2008 V.Ivanchenko
//
// Modified:
//
////////////////////////////////////////////////////////////////////////
//
// -------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4UserRunAction.hh"
#include "G4Run.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Run;
class RunAction : public G4UserRunAction
{
public: // Without description
@@ -53,16 +56,14 @@ public: // Without description
RunAction();
virtual ~RunAction();
public: // With description
virtual void BeginOfRunAction(const G4Run*);
// In this method histogramms are booked
virtual void EndOfRunAction(const G4Run*);
// In this method bookHisto method is called in which histogramms are filled
private:
RunAction & operator=(const RunAction &right);
RunAction(const RunAction&);
};
#endif
+2 -2
View File
@@ -1,5 +1,5 @@
#================================================
# Macro file for hadr00
# Macro file for Hadr00
# 14.04.2009 Ivanchneko
#================================================
/control/verbose 1
@@ -15,7 +15,7 @@
#
/gun/particle neutron
/gun/energy 100. MeV
/testhadr/HistoName nC
/testhadr/histo/fileName nC
/testhadr/particle neutron
/testhadr/verbose 1
/process/eLoss/verbose 0
+10 -11
View File
@@ -16,39 +16,38 @@
#
/gun/particle pi+
/gun/energy 100. MeV
/testhadr/HistoType root
/testhadr/HistoName pi+al
/testhadr/histo/fileName pi+al
/testhadr/particle pi+
/testhadr/verbose 0
/process/eLoss/verbose 0
/run/beamOn 0
#
/testhadr/targetElm Pb
/testhadr/HistoName pi+pb
/testhadr/histo/fileName pi+pb
/run/beamOn 0
/testhadr/targetElm Fe
/testhadr/HistoName pi+fe
/testhadr/histo/fileName pi+fe
/run/beamOn 0
/testhadr/targetElm C
/testhadr/HistoName pi+c
/testhadr/histo/fileName pi+c
/run/beamOn 0
/testhadr/targetElm H
/testhadr/HistoName pi+h
/testhadr/histo/fileName pi+h
/run/beamOn 0
#
/testhadr/particle pi-
/testhadr/HistoName pi-h
/testhadr/histo/fileName pi-h
/run/beamOn 0
/testhadr/targetElm Pb
/testhadr/HistoName pi-pb
/testhadr/histo/fileName pi-pb
/run/beamOn 0
/testhadr/targetElm Fe
/testhadr/HistoName pi-fe
/testhadr/histo/fileName pi-fe
/run/beamOn 0
/testhadr/targetElm C
/testhadr/HistoName pi-c
/testhadr/histo/fileName pi-c
/run/beamOn 0
/testhadr/targetElm Al
/testhadr/HistoName pi-al
/testhadr/histo/fileName pi-al
/run/beamOn 0
#
+10 -11
View File
@@ -16,39 +16,38 @@
#
/gun/particle proton
/gun/energy 100. MeV
/testhadr/HistoType root
/testhadr/HistoName p_al
/testhadr/histo/fileName p_al
/testhadr/verbose 0
/process/eLoss/verbose 0
/run/beamOn 0
#
/testhadr/targetElm Pb
/testhadr/HistoName p_pb
/testhadr/histo/fileName p_pb
/run/beamOn 0
/testhadr/targetElm Fe
/testhadr/HistoName p_fe
/testhadr/histo/fileName p_fe
/run/beamOn 0
/testhadr/targetElm C
/testhadr/HistoName p_c
/testhadr/histo/fileName p_c
/run/beamOn 0
/testhadr/targetElm H
/testhadr/HistoName p_h
/testhadr/histo/fileName p_h
/run/beamOn 0
#
/testhadr/particle neutron
/testhadr/HistoName n_h
/testhadr/histo/fileName n_h
/run/beamOn 0
/testhadr/targetElm Pb
/testhadr/HistoName n_pb
/testhadr/histo/fileName n_pb
/run/beamOn 0
/testhadr/targetElm Fe
/testhadr/HistoName n_fe
/testhadr/histo/fileName n_fe
/run/beamOn 0
/testhadr/targetElm C
/testhadr/HistoName n_c
/testhadr/histo/fileName n_c
/run/beamOn 0
/testhadr/verbose 0
/testhadr/targetElm Al
/testhadr/HistoName n_al
/testhadr/histo/fileName n_al
/run/beamOn 0
#
+1 -1
View File
@@ -1,6 +1,6 @@
#/bin/csh
#================================================
# Macro file for hadr00 run over all Physics Lists
# Macro file for Hadr00 run over all Physics Lists
# 26.06.2009 V.Ivanchneko
#================================================
@@ -1,10 +1,10 @@
#/bin/csh
#================================================
# Macro file for hadr00 run over all Physics Lists
# Macro file for Hadr00 run over all Physics Lists
# 26.06.2009 V.Ivanchneko
#================================================
rm -f $1.out
$G4BIN/$G4SYSTEM/hadr00 $2.in $1 >& $1.out
$G4BIN/$G4SYSTEM/Hadr00 $2.in $1 >& $1.out
#
@@ -1,6 +1,6 @@
#/bin/csh
#================================================
# Macro file for hadr00 run over all Physics Lists
# Macro file for Hadr00 run over all Physics Lists
# 26.06.2009 V.Ivanchneko
#================================================
@@ -1,6 +1,6 @@
#/bin/csh
#================================================
# Macro file for hadr00 run over all Physics Lists
# Macro file for Hadr00 run over all Physics Lists
# 26.06.2009 V.Ivanchneko
#================================================
@@ -8,8 +8,8 @@ mkdir -p $1
cd $1
rm -f *.*
setenv PHYSLIST $1
$G4BIN/$G4SYSTEM/hadr00 $G4INSTALL/examples/extended/hadronic/Hadr00/pn.mac >& pn.out
$G4BIN/$G4SYSTEM/hadr00 $G4INSTALL/examples/extended/hadronic/Hadr00/pi.mac >& pi.out
$G4BIN/$G4SYSTEM/Hadr00 $G4INSTALL/examples/extended/hadronic/Hadr00/pn.mac >& pn.out
$G4BIN/$G4SYSTEM/Hadr00 $G4INSTALL/examples/extended/hadronic/Hadr00/pi.mac >& pi.out
root -b -q $G4INSTALL/examples/extended/hadronic/Hadr00/scripts/Plot.C
cd ../
#
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: DetectorConstruction.cc,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/src/DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
//
@@ -59,26 +61,29 @@
#include "G4NistManager.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
{
logicTarget = 0;
logicWorld = 0;
detectorMessenger = new DetectorMessenger(this);
fLogicTarget = 0;
fLogicWorld = 0;
fDetectorMessenger = new DetectorMessenger(this);
radius = 5.*cm;
length = 10.*cm;
fRadius = 5.*cm;
fLength = 10.*cm;
targetMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
worldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
fTargetMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
fWorldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{
delete detectorMessenger;
delete fDetectorMessenger;
}
G4VPhysicalVolume* DetectorConstruction::Construct()
@@ -91,35 +96,37 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
G4SolidStore::GetInstance()->Clean();
// Sizes
G4double worldR = radius + cm;
G4double worldZ = length + cm;
G4double worldR = fRadius + cm;
G4double worldZ = fLength + cm;
//
// World
//
G4Tubs* solidW = new G4Tubs("World",0.,worldR,worldZ/2.0,0.,twopi);
logicWorld = new G4LogicalVolume( solidW,worldMaterial,"World");
G4VPhysicalVolume* world = new G4PVPlacement(0,G4ThreeVector(),
logicWorld,"World",0,false,0);
G4Tubs* solidW = new G4Tubs("World", 0., worldR, 0.5*worldZ, 0., twopi);
fLogicWorld = new G4LogicalVolume(solidW, fWorldMaterial,"World");
G4VPhysicalVolume* world = new G4PVPlacement(0, G4ThreeVector(),
fLogicWorld, "World",
0, false, 0);
//
// Target volume
//
G4Tubs* solidA = new G4Tubs("Target",0.,radius,length/2.0,0.,twopi);
logicTarget = new G4LogicalVolume( solidA,targetMaterial,"Target");
new G4PVPlacement(0,G4ThreeVector(),logicTarget,"Target",logicWorld,false,0);
G4Tubs* solidA = new G4Tubs("Target", 0., fRadius, 0.5*fLength, 0.,twopi);
fLogicTarget = new G4LogicalVolume( solidA, fTargetMaterial, "Target");
new G4PVPlacement(0, G4ThreeVector(), fLogicTarget, "Target",
fLogicWorld, false, 0);
G4cout << "### Target consist of "
<< targetMaterial->GetName()
<< " disks with R(mm)= " << radius/mm
<< " Length(mm)= " << length/mm
<< fTargetMaterial->GetName()
<< " disks with R(mm)= " << fRadius/mm
<< " fLength(mm)= " << fLength/mm
<< " ###" << G4endl;
// colors
logicWorld->SetVisAttributes(G4VisAttributes::Invisible);
fLogicWorld->SetVisAttributes(G4VisAttributes::Invisible);
G4VisAttributes* regCcolor = new G4VisAttributes(G4Colour(0., 0.3, 0.7));
logicTarget->SetVisAttributes(regCcolor);
fLogicTarget->SetVisAttributes(regCcolor);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
@@ -133,9 +140,9 @@ void DetectorConstruction::SetTargetMaterial(const G4String& mat)
// search the material by its name
G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(mat);
if (material && material != targetMaterial) {
targetMaterial = material;
if(logicTarget) logicTarget->SetMaterial(targetMaterial);
if (material && material != fTargetMaterial) {
fTargetMaterial = material;
if(fLogicTarget) fLogicTarget->SetMaterial(fTargetMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
@@ -147,9 +154,9 @@ void DetectorConstruction::SetWorldMaterial(const G4String& mat)
// search the material by its name
G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(mat);
if (material && material != worldMaterial) {
worldMaterial = material;
if(logicWorld) logicWorld->SetMaterial(worldMaterial);
if (material && material != fWorldMaterial) {
fWorldMaterial = material;
if(fLogicWorld) fLogicWorld->SetMaterial(fWorldMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
@@ -165,8 +172,8 @@ void DetectorConstruction::UpdateGeometry()
void DetectorConstruction::SetTargetRadius(G4double val)
{
if(val > 0.0 && val != radius) {
radius = val;
if(val > 0.0 && val != fRadius) {
fRadius = val;
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
}
@@ -175,8 +182,8 @@ void DetectorConstruction::SetTargetRadius(G4double val)
void DetectorConstruction::SetTargetLength(G4double val)
{
if(val > 0.0 && val != length) {
length = val;
if(val > 0.0 && val != fLength) {
fLength = val;
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
}
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr00/src/DetectorMessenger.cc
/// \brief Implementation of the DetectorMessenger class
//
// $Id: DetectorMessenger.cc,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
/////////////////////////////////////////////////////////////////////////
@@ -54,109 +56,109 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:Detector(Det)
:fDetector(Det)
{
testDir = new G4UIdirectory("/testhadr/");
testDir->SetGuidance(" Hadronic Extended Example.");
ftestDir = new G4UIdirectory("/testhadr/");
ftestDir->SetGuidance(" Hadronic Extended Example.");
matCmd = new G4UIcmdWithAString("/testhadr/TargetMat",this);
matCmd->SetGuidance("Select Material for the target");
matCmd->SetParameterName("tMaterial",false);
matCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fmatCmd = new G4UIcmdWithAString("/testhadr/TargetMat",this);
fmatCmd->SetGuidance("Select Material for the target");
fmatCmd->SetParameterName("tMaterial",false);
fmatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mat1Cmd = new G4UIcmdWithAString("/testhadr/WorldMat",this);
mat1Cmd->SetGuidance("Select Material for world");
mat1Cmd->SetParameterName("wMaterial",false);
mat1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fmat1Cmd = new G4UIcmdWithAString("/testhadr/WorldMat",this);
fmat1Cmd->SetGuidance("Select Material for world");
fmat1Cmd->SetParameterName("wMaterial",false);
fmat1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
rCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetRadius",this);
rCmd->SetGuidance("Set radius of the target");
rCmd->SetParameterName("radius",false);
rCmd->SetUnitCategory("Length");
rCmd->SetRange("radius>0");
rCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
frCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetRadius",this);
frCmd->SetGuidance("Set radius of the target");
frCmd->SetParameterName("radius",false);
frCmd->SetUnitCategory("Length");
frCmd->SetRange("radius>0");
frCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetLength",this);
lCmd->SetGuidance("Set length of the target");
lCmd->SetParameterName("length",false);
lCmd->SetUnitCategory("Length");
lCmd->SetRange("length>0");
lCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
flCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetLength",this);
flCmd->SetGuidance("Set length of the target");
flCmd->SetParameterName("length",false);
flCmd->SetUnitCategory("Length");
flCmd->SetRange("length>0");
flCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
binCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsE",this);
binCmd->SetGuidance("Set number of bins for energy");
binCmd->SetParameterName("NEbins",false);
binCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fbinCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsE",this);
fbinCmd->SetGuidance("Set number of bins for energy");
fbinCmd->SetParameterName("NEbins",false);
fbinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
nOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsP",this);
nOfAbsCmd->SetGuidance("Set number of bins for momentum");
nOfAbsCmd->SetParameterName("NPbins",false);
nOfAbsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fnOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsP",this);
fnOfAbsCmd->SetGuidance("Set number of bins for momentum");
fnOfAbsCmd->SetParameterName("NPbins",false);
fnOfAbsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
updateCmd = new G4UIcmdWithoutParameter("/testhadr/update",this);
updateCmd->SetGuidance("Update geometry.");
updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
updateCmd->SetGuidance("if you changed geometrical value(s)");
updateCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fupdateCmd = new G4UIcmdWithoutParameter("/testhadr/update",this);
fupdateCmd->SetGuidance("Update geometry.");
fupdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
fupdateCmd->SetGuidance("if you changed geometrical value(s)");
fupdateCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
partCmd = new G4UIcmdWithAString("/testhadr/particle",this);
partCmd->SetGuidance("Set particle name");
partCmd->SetParameterName("Particle",false);
partCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fpartCmd = new G4UIcmdWithAString("/testhadr/particle",this);
fpartCmd->SetGuidance("Set particle name");
fpartCmd->SetParameterName("Particle",false);
fpartCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
csCmd = new G4UIcmdWithAString("/testhadr/targetElm",this);
csCmd->SetGuidance("Set element name");
csCmd->SetParameterName("Elm",false);
csCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fcsCmd = new G4UIcmdWithAString("/testhadr/targetElm",this);
fcsCmd->SetGuidance("Set element name");
fcsCmd->SetParameterName("Elm",false);
fcsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
e1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minEnergy",this);
e1Cmd->SetGuidance("Set min kinetic energy");
e1Cmd->SetParameterName("eMin",false);
e1Cmd->SetUnitCategory("Energy");
e1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fe1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minEnergy",this);
fe1Cmd->SetGuidance("Set min kinetic energy");
fe1Cmd->SetParameterName("eMin",false);
fe1Cmd->SetUnitCategory("Energy");
fe1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
e2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxEnergy",this);
e2Cmd->SetGuidance("Set max kinetic energy");
e2Cmd->SetParameterName("eMax",false);
e2Cmd->SetUnitCategory("Energy");
e2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fe2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxEnergy",this);
fe2Cmd->SetGuidance("Set max kinetic energy");
fe2Cmd->SetParameterName("eMax",false);
fe2Cmd->SetUnitCategory("Energy");
fe2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
p1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minMomentum",this);
p1Cmd->SetGuidance("Set min momentum");
p1Cmd->SetParameterName("pMin",false);
p1Cmd->SetUnitCategory("Energy");
p1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fp1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minMomentum",this);
fp1Cmd->SetGuidance("Set min momentum");
fp1Cmd->SetParameterName("pMin",false);
fp1Cmd->SetUnitCategory("Energy");
fp1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
p2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxMomentum",this);
p2Cmd->SetGuidance("Set max momentum");
p2Cmd->SetParameterName("pMax",false);
p2Cmd->SetUnitCategory("Energy");
p2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fp2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxMomentum",this);
fp2Cmd->SetGuidance("Set max momentum");
fp2Cmd->SetParameterName("pMax",false);
fp2Cmd->SetUnitCategory("Energy");
fp2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
verbCmd = new G4UIcmdWithAnInteger("/testhadr/verbose",this);
verbCmd->SetGuidance("Set verbose for ");
verbCmd->SetParameterName("verb",false);
verbCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fverbCmd = new G4UIcmdWithAnInteger("/testhadr/verbose",this);
fverbCmd->SetGuidance("Set verbose for ");
fverbCmd->SetParameterName("verb",false);
fverbCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
{
delete matCmd;
delete mat1Cmd;
delete rCmd;
delete lCmd;
delete nOfAbsCmd;
delete updateCmd;
delete testDir;
delete partCmd;
delete csCmd;
delete e1Cmd;
delete e2Cmd;
delete p1Cmd;
delete p2Cmd;
delete verbCmd;
delete fmatCmd;
delete fmat1Cmd;
delete frCmd;
delete flCmd;
delete fnOfAbsCmd;
delete fupdateCmd;
delete ftestDir;
delete fpartCmd;
delete fcsCmd;
delete fe1Cmd;
delete fe2Cmd;
delete fp1Cmd;
delete fp2Cmd;
delete fverbCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -164,34 +166,34 @@ DetectorMessenger::~DetectorMessenger()
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
HistoManager* histo = HistoManager::GetPointer();
if( command == matCmd ) {
Detector->SetTargetMaterial(newValue);
} else if( command == mat1Cmd ) {
Detector->SetWorldMaterial(newValue);
} else if( command == rCmd ) {
Detector->SetTargetRadius(rCmd->GetNewDoubleValue(newValue));
} else if( command == lCmd ) {
Detector->SetTargetLength(lCmd->GetNewDoubleValue(newValue));
} else if( command == updateCmd ) {
Detector->UpdateGeometry();
} else if( command == binCmd ) {
histo->SetNumberOfBinsE(binCmd->GetNewIntValue(newValue));
} else if( command == nOfAbsCmd ) {
histo->SetNumberOfBinsP(nOfAbsCmd->GetNewIntValue(newValue));
} else if( command == verbCmd ) {
histo->SetVerbose(verbCmd->GetNewIntValue(newValue));
} else if( command == partCmd ) {
if( command == fmatCmd ) {
fDetector->SetTargetMaterial(newValue);
} else if( command == fmat1Cmd ) {
fDetector->SetWorldMaterial(newValue);
} else if( command == frCmd ) {
fDetector->SetTargetRadius(frCmd->GetNewDoubleValue(newValue));
} else if( command == flCmd ) {
fDetector->SetTargetLength(flCmd->GetNewDoubleValue(newValue));
} else if( command == fupdateCmd ) {
fDetector->UpdateGeometry();
} else if( command == fbinCmd ) {
histo->SetNumberOfBinsE(fbinCmd->GetNewIntValue(newValue));
} else if( command == fnOfAbsCmd ) {
histo->SetNumberOfBinsP(fnOfAbsCmd->GetNewIntValue(newValue));
} else if( command == fverbCmd ) {
histo->SetVerbose(fverbCmd->GetNewIntValue(newValue));
} else if( command == fpartCmd ) {
histo->SetParticleName(newValue);
} else if( command == csCmd ) {
} else if( command == fcsCmd ) {
histo->SetElementName(newValue);
} else if( command == e1Cmd ) {
histo->SetMinKinEnergy(e1Cmd->GetNewDoubleValue(newValue));
} else if( command == e2Cmd ) {
histo->SetMaxKinEnergy(e2Cmd->GetNewDoubleValue(newValue));
} else if( command == p1Cmd ) {
histo->SetMinMomentum(p1Cmd->GetNewDoubleValue(newValue));
} else if( command == p2Cmd ) {
histo->SetMaxMomentum(p2Cmd->GetNewDoubleValue(newValue));
} else if( command == fe1Cmd ) {
histo->SetMinKinEnergy(fe1Cmd->GetNewDoubleValue(newValue));
} else if( command == fe2Cmd ) {
histo->SetMaxKinEnergy(fe2Cmd->GetNewDoubleValue(newValue));
} else if( command == fp1Cmd ) {
histo->SetMinMomentum(fp1Cmd->GetNewDoubleValue(newValue));
} else if( command == fp2Cmd ) {
histo->SetMaxMomentum(fp2Cmd->GetNewDoubleValue(newValue));
}
}
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: EventAction.cc,v 1.3 2010-06-07 05:40:46 perl Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/src/EventAction.cc
/// \brief Implementation of the EventAction class
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
//
@@ -47,21 +49,20 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
EventAction::EventAction():
printModulo(100),
nSelected(0),
drawFlag("all"),
debugStarted(false)
fPrintModulo(100),
fSelected(0),
fDebugStarted(false)
{
eventMessenger = new EventActionMessenger(this);
fEventMessenger = new EventActionMessenger(this);
UI = G4UImanager::GetUIpointer();
selectedEvents.clear();
fSelectedEvents.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
EventAction::~EventAction()
{
delete eventMessenger;
delete fEventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -71,19 +72,19 @@ void EventAction::BeginOfEventAction(const G4Event* evt)
// New event
G4int nEvt = evt->GetEventID();
if(nSelected>0) {
for(G4int i=0; i<nSelected; i++) {
if(nEvt == selectedEvents[i]) {
if(fSelected>0) {
for(G4int i=0; i<fSelected; ++i) {
if(nEvt == fSelectedEvents[i]) {
UI->ApplyCommand("/random/saveThisEvent");
UI->ApplyCommand("/tracking/verbose 2");
debugStarted = true;
fDebugStarted = true;
break;
}
}
}
// Initialize user actions
if(G4int(nEvt/printModulo)*printModulo == nEvt) {
if(G4int(nEvt/fPrintModulo)*fPrintModulo == nEvt) {
G4cout << "EventAction: Event # "
<< nEvt << " started" << G4endl;
}
@@ -93,9 +94,9 @@ void EventAction::BeginOfEventAction(const G4Event* evt)
void EventAction::EndOfEventAction(const G4Event*)
{
if(debugStarted) {
if(fDebugStarted) {
UI->ApplyCommand("/tracking/verbose 0");
debugStarted = false;
fDebugStarted = false;
G4cout << "EventAction: Event ended" << G4endl;
}
}
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: EventActionMessenger.cc,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/src/EventActionMessenger.cc
/// \brief Implementation of the EventActionMessenger class
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
//
@@ -46,28 +48,20 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::EventActionMessenger(EventAction* EvAct)
:eventAction(EvAct)
{
drawCmd = new G4UIcmdWithAString("/testhadr/DrawTracks", this);
drawCmd->SetGuidance("Draw the tracks in the event");
drawCmd->SetGuidance(" Choice : neutral, charged, all");
drawCmd->SetParameterName("choice",true);
drawCmd->SetDefaultValue("all");
drawCmd->SetCandidates("none charged all");
drawCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
printCmd = new G4UIcmdWithAnInteger("/testhadr/PrintModulo",this);
printCmd->SetGuidance("Print events modulo n");
printCmd->SetParameterName("EventNb",false);
printCmd->SetRange("EventNb>0");
printCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
EventActionMessenger::EventActionMessenger(EventAction* evAct)
: fEventAction(evAct)
{
fPrintCmd = new G4UIcmdWithAnInteger("/testhadr/PrintModulo",this);
fPrintCmd->SetGuidance("Print events modulo n");
fPrintCmd->SetParameterName("EventNb",false);
fPrintCmd->SetRange("EventNb>0");
fPrintCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dCmd = new G4UIcmdWithAnInteger("/testhadr/DebugEvent",this);
dCmd->SetGuidance("D event to debug");
dCmd->SetParameterName("fNb",false);
dCmd->SetRange("fNb>0");
dCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fCmd = new G4UIcmdWithAnInteger("/testhadr/DebugEvent",this);
fCmd->SetGuidance("D event to debug");
fCmd->SetParameterName("fNb",false);
fCmd->SetRange("fNb>0");
fCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
@@ -75,25 +69,19 @@ EventActionMessenger::EventActionMessenger(EventAction* EvAct)
EventActionMessenger::~EventActionMessenger()
{
delete drawCmd;
delete printCmd;
delete dCmd;
delete fPrintCmd;
delete fCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventActionMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
G4String newValue)
{
if(command == drawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == printCmd)
{eventAction->SetPrintModulo(printCmd->GetNewIntValue(newValue));}
if(command == dCmd)
{eventAction->AddEventToDebug(dCmd->GetNewIntValue(newValue));}
if(command == fPrintCmd)
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
if(command == fCmd)
{fEventAction->AddEventToDebug(fCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+241 -127
View File
@@ -23,6 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr00/src/Histo.cc
/// \brief Implementation of the Histo class
//
// $Id$
//
//---------------------------------------------------------------------------
//
// ClassName: Histo - Generic histogram/ntuple manager class
@@ -38,202 +43,311 @@
#include "Histo.hh"
#include "HistoMessenger.hh"
#include "G4RootAnalysisManager.hh"
#ifdef G4ANALYSIS_USE
#include <AIDA/AIDA.h>
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Histo::Histo(G4int ver)
Histo::Histo()
{
verbose = ver;
histName = "histo";
histType = "root";
option = "";
nHisto = 0;
defaultAct = 1;
messenger = new HistoMessenger(this);
#ifdef G4ANALYSIS_USE
tree = 0;
af = 0;
#endif
fManager = 0;
fMessenger = new HistoMessenger(this);
fHistName = "test";
fHistType = "root";
fTupleName = "tuple";
fTupleTitle = "test";
fNHisto = 0;
fVerbose = 0;
fDefaultAct = true;
fHistoActive= false;
fNtupleActive= false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Histo::~Histo()
{
delete messenger;
#ifdef G4ANALYSIS_USE
delete af;
#endif
delete fMessenger;
delete fManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::book()
void Histo::Book()
{
#ifdef G4ANALYSIS_USE
G4cout << "### Histo books " << nHisto << " histograms " << G4endl;
// Creating the analysis factory
AIDA::IAnalysisFactory* af = AIDA_createAnalysisFactory();
if(verbose>0) {
G4cout<<"Histo books analysis factory"<<G4endl;
}
// Creating the tree factory
AIDA::ITreeFactory* tf = af->createTreeFactory();
if(verbose>0)
G4cout<<"Histo books tree factory ......... "<<G4endl;
if(!(fHistoActive || fNtupleActive)) { return; }
// Always creating analysis manager
fManager = G4RootAnalysisManager::Instance();
// Creating a tree mapped to a new hbook file.
G4String name = histName + "." + histType;
tree = tf->create(name, histType, false, true, option);
G4cout << "Histo: tree store : " << tree->storeName() << G4endl;
G4String nam = fHistName + "." + fHistType;
// Creating a histogram factory, whose histograms will be handled by the tree
AIDA::IHistogramFactory* hf = af->createHistogramFactory( *tree );
// Open file histogram file
if(!fManager->OpenFile(nam)) {
G4cout << "Histo::Book: ERROR open file <" << nam << ">" << G4endl;
fHistoActive = false;
fNtupleActive = false;
return;
}
G4cout << "### Histo::Save: Opended file <" << nam << "> for "
<< fNHisto << " histograms " << G4endl;
// Creating an 1-dimensional histograms in the root directory of the tree
for(G4int i=0; i<nHisto; i++) {
if(active[i]) {
if(verbose>0) {
G4cout<<"Histo::book: histogram "<< i << " id= " << ids[i] <<G4endl;
for(G4int i=0; i<fNHisto; ++i) {
if(fActive[i]) {
G4String ss = "h" + fIds[i];
fHisto[i] = fManager->CreateH1(ss, fTitles[i], fBins[i], fXmin[i], fXmax[i]);
if(fVerbose > 0) {
G4cout << "Created histogram #" << i << " id= " << fHisto[i]
<< " " << ss << " " << fTitles[i] << G4endl;
}
histo[i] = hf->createHistogram1D(ids[i], tittles[i], bins[i], xmin[i], xmax[i]);
}
}
delete hf;
delete tf;
#endif
// Creating a tuple factory, whose tuples will be handled by the tree
if(fNtupleActive) {
fManager->CreateNtuple(fTupleName,fTupleTitle);
G4int i;
G4int n = fNtupleI.size();
for(i=0; i<n; ++i) {
if(fTupleI[i] == -1) { fTupleI[i] = fManager->CreateNtupleIColumn(fNtupleI[i]); }
}
n = fNtupleF.size();
for(i=0; i<n; ++i) {
if(fTupleF[i] == -1) { fTupleF[i] = fManager->CreateNtupleFColumn(fNtupleF[i]); }
}
n = fNtupleD.size();
for(i=0; i<n; ++i) {
if(fTupleD[i] == -1) { fTupleD[i] = fManager->CreateNtupleDColumn(fNtupleD[i]); }
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::save()
void Histo::Save()
{
#ifdef G4ANALYSIS_USE
if(!(fHistoActive || fNtupleActive)) { return; }
// Creating a tree mapped to a new hbook file.
G4String nam = fHistName + "." + fHistType;
// Write histogram file
tree->commit();
G4cout << "Closing the tree..." << G4endl;
tree->close();
G4cout << "Histograms and Ntuples are saved" << G4endl;
delete tree;
tree = 0;
#endif
}
if(!fManager->Write()) {
G4cout << "Histo::Save: FATAL ERROR writing ROOT file" << G4endl;
exit(1);
}
if(fVerbose > 0) {
G4cout << "### Histo::Save: Histograms and Ntuples are saved" << G4endl;
}
if(fManager->CloseFile() && fVerbose > 0) {
G4cout << " File is closed" << G4endl;
}
delete G4RootAnalysisManager::Instance();
fManager = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::setFileType(const G4String& nam)
{
if(nam == "hbook" || nam == "root" || nam == "aida") { histType = nam; }
else if(nam == "XML" || nam == "xml") { histType = "aida"; }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::add1D(const G4String& id, const G4String& name, G4int nb,
void Histo::Add1D(const G4String& id, const G4String& name, G4int nb,
G4double x1, G4double x2, G4double u)
{
if(nHisto > 0) {
for(G4int i=0; i<nHisto; ++i) {
if(ids[i] == id) return;
}
}
if(verbose > 0) {
G4cout << "New histogram will be booked: #" << id << " <" << name
<< " " << nb << " " << x1 << " " << x2 << " " << u
if(fVerbose > 0) {
G4cout << "Histo::Add1D: New histogram will be booked: #" << id << " <" << name
<< " " << nb << " " << x1 << " " << x2 << " " << u
<< G4endl;
}
++nHisto;
++fNHisto;
x1 /= u;
x2 /= u;
active.push_back(defaultAct);
bins.push_back(nb);
xmin.push_back(x1);
xmax.push_back(x2);
unit.push_back(u);
ids.push_back(id);
tittles.push_back(name);
histo.push_back(0);
fActive.push_back(fDefaultAct);
fBins.push_back(nb);
fXmin.push_back(x1);
fXmax.push_back(x2);
fUnit.push_back(u);
fIds.push_back(id);
fTitles.push_back(name);
fHisto.push_back(-1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::setHisto1D(G4int i, G4int nb, G4double x1, G4double x2, G4double u)
void Histo::SetHisto1D(G4int i, G4int nb, G4double x1, G4double x2, G4double u)
{
if(i>=0 && i<nHisto) {
if(verbose > 0) {
G4cout << "Update histogram: #" << i
if(i>=0 && i<fNHisto) {
if(fVerbose > 0) {
G4cout << "Histo::SetHisto1D: #" << i
<< " " << nb << " " << x1 << " " << x2 << " " << u
<< G4endl;
}
bins[i] = nb;
xmin[i] = x1;
xmax[i] = x2;
unit[i] = u;
fBins[i] = nb;
fXmin[i] = x1;
fXmax[i] = x2;
fUnit[i] = u;
fActive[i] = true;
fHistoActive = true;
} else {
G4cout << "Histo::setHisto1D: WARNING! wrong histogram index " << i << G4endl;
G4cout << "nHisto = " << nHisto << G4endl;
G4cout << "Histo::SetHisto1D: WARNING! wrong histogram index " << i << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::fill(G4int i, G4double x, G4double w)
void Histo::Activate(G4int i, G4bool val)
{
if(verbose > 1) {
G4cout << "fill histogram: #" << i << " at x= " << x
<< " weight= " << w << " unit= " << unit[i]
<< G4endl;
}
#ifdef G4ANALYSIS_USE
if(i>=0 && i<nHisto) {
histo[i]->fill(x/unit[i], w);
//histo[i]->fill((float)(x/unit[i]), (float)w);
} else {
G4cout << "Histo::fill: WARNING! wrong histogram index " << i << G4endl;
if(fVerbose > 1) {
G4cout << "Histo::Activate: Histogram: #" << i << " "
<< val << G4endl;
}
if(i>=0 && i<fNHisto) {
fActive[i] = val;
if(val) { fHistoActive = true; }
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::scale(G4int i, G4double x)
void Histo::Fill(G4int i, G4double x, G4double w)
{
if(verbose > 0) {
G4cout << "Scale histogram: #" << i << " by factor " << x << G4endl;
if(!fHistoActive) { return; }
if(fVerbose > 1) {
G4cout << "Histo::Fill: Histogram: #" << i << " at x= " << x
<< " weight= " << w
<< G4endl;
}
#ifdef G4ANALYSIS_USE
if(i>=0 && i<nHisto) {
histo[i]->scale(x);
if(i>=0 && i<fNHisto) {
if(fActive[i]) { fManager->FillH1(fHisto[i], x/fUnit[i], w); }
} else {
G4cout << "Histo::scale: WARNING! wrong histogram index " << i << G4endl;
G4cout << "Histo::Fill: WARNING! wrong histogram index " << i << G4endl;
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::print(G4int i)
void Histo::ScaleH1(G4int i, G4double x)
{
G4cout<<"### Histogram "<<i<<" ###"<<G4endl;
#ifdef G4ANALYSIS_USE
if(i>=0 && i<nHisto) {
G4double step = (xmax[i] - xmin[i])/G4double( bins[i]);
G4double x = xmin[i] - step*0.5;
G4double y, maxX=0, maxY=0;
G4int maxJ=0;
if(!fHistoActive) { return; }
if(fVerbose > 0) {
G4cout << "Histo::Scale: Histogram: #" << i << " by factor " << x << G4endl;
}
if(i>=0 && i<fNHisto) {
if(fActive[i]) { fManager->GetH1(fHisto[i])->scale(x); }
} else {
G4cout << "Histo::Scale: WARNING! wrong histogram index " << i << G4endl;
}
}
for(G4int j=0; j<bins[i]; j++) {
x += step;
y = histo[i]->binHeight(j);
if(maxY < y) {maxY = y; maxX = x; maxJ = j;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4cout<<x<<" "<<y<<G4endl;
void Histo::AddTuple(const G4String& w1)
{
fTupleTitle = w1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::AddTupleI(const G4String& w1)
{
fNtupleActive = true;
fNtupleI.push_back(w1);
fTupleI.push_back(-1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::AddTupleF(const G4String& w1)
{
fNtupleActive = true;
fNtupleF.push_back(w1);
fTupleF.push_back(-1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::AddTupleD(const G4String& w1)
{
fNtupleActive = true;
fNtupleD.push_back(w1);
fTupleD.push_back(-1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::FillTupleI(G4int i, G4int x)
{
if(!fNtupleActive) { return; }
G4int n = fNtupleI.size();
if(i >= 0 && i < n) {
if(fVerbose > 1) {
G4cout << "Histo::FillTupleI: i= " << i << " id= " << fTupleI[i]
<< " <" << fNtupleI[i] << "> = " << x << G4endl;
}
G4cout<<" maxJ "<<maxJ<<" maxX "<<maxX<<" maxY "<<maxY<<G4endl;
fManager->FillNtupleIColumn(fTupleI[i], x);
} else {
G4cout << "Histo::FillTupleI: WARNING! wrong ntuple index " << i << G4endl;
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::FillTupleF(G4int i, G4float x)
{
if(!fNtupleActive) { return; }
G4int n = fNtupleF.size();
if(i >= 0 && i < n) {
if(fVerbose > 1) {
G4cout << "Histo::FillTupleF: i= " << i << " id= " << fTupleF[i]
<< " <" << fNtupleF[i] << "> = " << x << G4endl;
}
fManager->FillNtupleFColumn(fTupleF[i], x);
} else {
G4cout << "Histo::FillTupleF: WARNING! wrong ntuple index " << i << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::FillTupleD(G4int i, G4double x)
{
if(!fNtupleActive) { return; }
G4int n = fNtupleD.size();
if(i >= 0 && i < n) {
if(fVerbose > 1) {
G4cout << "Histo::FillTupleD: i= " << i << " id= " << fTupleD[i]
<< " <" << fNtupleD[i] << "> = " << x << G4endl;
}
fManager->FillNtupleDColumn(fTupleD[i], x);
} else {
G4cout << "Histo::FillTupleD: WARNING! wrong ntuple index " << i << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::AddRow()
{
if(!fNtupleActive) { return; }
fManager->AddNtupleRow();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::SetFileName(const G4String& nam)
{
fHistName = nam;
fHistoActive = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::SetFileType(const G4String& nam)
{
if(nam == "root" || nam == "ROOT" ) { fHistType = "root"; }
else if(nam == "xml" || nam == "XML") { fHistType = "xml"; }
else if(nam == "ascii" || nam == "ASCII" ||
nam == "Csv" || nam == "csv" || nam == "CSV") { fHistType = "ascii"; }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HistoManager.cc,v 1.7 2010-10-11 11:02:36 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/src/HistoManager.cc
/// \brief Implementation of the HistoManager class
//
// $Id$
//
//---------------------------------------------------------------------------
//
@@ -55,6 +57,7 @@
#include "G4NucleiProperties.hh"
#include "G4NistManager.hh"
#include "G4StableIsotopes.hh"
#include "G4SystemOfUnits.hh"
#include "Histo.hh"
@@ -77,99 +80,103 @@ HistoManager* HistoManager::GetPointer()
HistoManager::HistoManager()
{
histo = new Histo(verbose);
neutron = G4Neutron::Neutron();
verbose = 1;
fHisto = new Histo();
fNeutron = G4Neutron::Neutron();
fVerbose = 1;
particleName = "proton";
elementName = "Al";
fParticleName = "proton";
fElementName = "Al";
minKinEnergy = 0.1*MeV;
maxKinEnergy = 10*TeV;
minMomentum = 1*MeV;
maxMomentum = 10*TeV;
fMinKinEnergy = 0.1*MeV;
fMaxKinEnergy = 10*TeV;
fMinMomentum = 1*MeV;
fMaxMomentum = 10*TeV;
nBinsE = 800;
nBinsP = 700;
fBinsE = 800;
fBinsP = 700;
isInitialised = false;
fHisto->SetVerbose(fVerbose);
fIsInitialised = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
HistoManager::~HistoManager()
{
delete histo;
delete fHisto;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void HistoManager::BeginOfRun()
{
G4double p1 = std::log10(minMomentum/GeV);
G4double p2 = std::log10(maxMomentum/GeV);
G4double e1 = std::log10(minKinEnergy/MeV);
G4double e2 = std::log10(maxKinEnergy/MeV);
G4double p1 = std::log10(fMinMomentum/GeV);
G4double p2 = std::log10(fMaxMomentum/GeV);
G4double e1 = std::log10(fMinKinEnergy/MeV);
G4double e2 = std::log10(fMaxKinEnergy/MeV);
//G4cout<<"e1= "<<e1<<" e2= "<<e2<<" p1= "<<p1<<" p2= "<<p2<<G4endl;
if(isInitialised) {
histo->setHisto1D(0,nBinsP,p1,p2);
histo->setHisto1D(1,nBinsE,e1,e2);
histo->setHisto1D(2,nBinsP,p1,p2);
histo->setHisto1D(3,nBinsE,e1,e2);
histo->setHisto1D(4,nBinsE,e1,e2);
histo->setHisto1D(5,nBinsE,e1,e2);
histo->setHisto1D(6,nBinsE,e1,e2);
histo->setHisto1D(7,nBinsE,e1,e2);
if(fIsInitialised) {
fHisto->SetHisto1D(0,fBinsP,p1,p2,1.0);
fHisto->SetHisto1D(1,fBinsE,e1,e2,1.0);
fHisto->SetHisto1D(2,fBinsP,p1,p2,1.0);
fHisto->SetHisto1D(3,fBinsE,e1,e2,1.0);
fHisto->SetHisto1D(4,fBinsE,e1,e2,1.0);
fHisto->SetHisto1D(5,fBinsE,e1,e2,1.0);
fHisto->SetHisto1D(6,fBinsE,e1,e2,1.0);
fHisto->SetHisto1D(7,fBinsE,e1,e2,1.0);
} else {
histo->add1D("h1","Elastic cross section (barn) as a functions of log10(p/GeV)",
nBinsP,p1,p2);
histo->add1D("h2","Elastic cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h3","Inelastic cross section (barn) as a functions of log10(p/GeV)",
nBinsP,p1,p2);
histo->add1D("h4","Inelastic cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h5","Capture cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h6","Fission cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h7","Charge exchange cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h8","Total cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
fHisto->Add1D("h1","Elastic cross section (barn,1.0) as a functions of log10(p/GeV)",
fBinsP,p1,p2,1.0);
fHisto->Add1D("h2","Elastic cross section (barn) as a functions of log10(E/MeV)",
fBinsE,e1,e2,1.0);
fHisto->Add1D("h3","Inelastic cross section (barn) as a functions of log10(p/GeV)",
fBinsP,p1,p2,1.0);
fHisto->Add1D("h4","Inelastic cross section (barn) as a functions of log10(E/MeV)",
fBinsE,e1,e2,1.0);
fHisto->Add1D("h5","Capture cross section (barn) as a functions of log10(E/MeV)",
fBinsE,e1,e2,1.0);
fHisto->Add1D("h6","Fission cross section (barn) as a functions of log10(E/MeV)",
fBinsE,e1,e2,1.0);
fHisto->Add1D("h7","Charge exchange cross section (barn) as a functions of log10(E/MeV)",
fBinsE,e1,e2,1.0);
fHisto->Add1D("h8","Total cross section (barn) as a functions of log10(E/MeV)",
fBinsE,e1,e2,1.0);
}
isInitialised = true;
histo->book();
fIsInitialised = true;
fHisto->Book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void HistoManager::EndOfRun()
{
if(verbose > 0) {
if(fVerbose > 0) {
G4cout << "HistoManager: End of run actions are started" << G4endl;
}
const G4Element* elm =
G4NistManager::Instance()->FindOrBuildElement(elementName);
G4NistManager::Instance()->FindOrBuildElement(fElementName);
const G4Material* mat =
G4NistManager::Instance()->FindOrBuildMaterial("G4_"+fElementName);
const G4ParticleDefinition* particle =
G4ParticleTable::GetParticleTable()->FindParticle(particleName);
G4ParticleTable::GetParticleTable()->FindParticle(fParticleName);
G4cout << "### Fill Cross Sections for " << particleName
<< " off " << elementName
<< G4endl;
if(verbose > 0) {
G4cout << "### Fill Cross Sections for " << fParticleName
<< " off " << fElementName
<< G4endl;
if(fVerbose > 0) {
G4cout << "------------------------------------------------------------------------"
<< G4endl;
<< G4endl;
G4cout << " N E(MeV) Elastic(b) Inelastic(b)";
if(particle == neutron) { G4cout << " Capture(b) Fission(b)"; }
if(particle == fNeutron) { G4cout << " Capture(b) Fission(b)"; }
G4cout << " Total(b)" << G4endl;
G4cout << "------------------------------------------------------------------------"
<< G4endl;
<< G4endl;
}
if(!particle || !elm) {
G4cout << "HistoManager WARNING Particle or element undefined" << G4endl;
@@ -184,69 +191,68 @@ void HistoManager::EndOfRun()
// Build histograms
G4double p1 = std::log10(minMomentum/GeV);
G4double p2 = std::log10(maxMomentum/GeV);
G4double e1 = std::log10(minKinEnergy/MeV);
G4double e2 = std::log10(maxKinEnergy/MeV);
G4double de = (e2 - e1)/G4double(nBinsE);
G4double dp = (p2 - p1)/G4double(nBinsP);
G4double p1 = std::log10(fMinMomentum/GeV);
G4double p2 = std::log10(fMaxMomentum/GeV);
G4double e1 = std::log10(fMinKinEnergy/MeV);
G4double e2 = std::log10(fMaxKinEnergy/MeV);
G4double de = (e2 - e1)/G4double(fBinsE);
G4double dp = (p2 - p1)/G4double(fBinsP);
G4double x = e1 - de*0.5;
G4double e, p, xs, xtot;
G4int i;
for(i=0; i<nBinsE; i++) {
for(i=0; i<fBinsE; i++) {
x += de;
e = std::pow(10.,x)*MeV;
if(verbose>0) G4cout << std::setw(5) << i << std::setw(12) << e;
xs = store->GetElasticCrossSectionPerAtom(particle,e,elm);
if(fVerbose>0) G4cout << std::setw(5) << i << std::setw(12) << e;
xs = store->GetElasticCrossSectionPerAtom(particle,e,elm,mat);
xtot = xs;
if(verbose>0) G4cout << std::setw(12) << xs/barn;
histo->fill(1, x, xs/barn);
xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm);
if(fVerbose>0) G4cout << std::setw(12) << xs/barn;
fHisto->Fill(1, x, xs/barn);
xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm,mat);
xtot += xs;
if(verbose>0) G4cout << " " << std::setw(12) << xs/barn;
histo->fill(3, x, xs/barn);
if(particle == neutron) {
xs = store->GetCaptureCrossSectionPerAtom(particle,e,elm);
if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
fHisto->Fill(3, x, xs/barn);
if(particle == fNeutron) {
xs = store->GetCaptureCrossSectionPerAtom(particle,e,elm,mat);
xtot += xs;
if(verbose>0) G4cout << " " << std::setw(12) << xs/barn;
histo->fill(4, x, xs/barn);
xs = store->GetFissionCrossSectionPerAtom(particle,e,elm);
if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
fHisto->Fill(4, x, xs/barn);
xs = store->GetFissionCrossSectionPerAtom(particle,e,elm,mat);
xtot += xs;
if(verbose>0) G4cout << " " << std::setw(12) << xs/barn;
histo->fill(5, x, xs/barn);
if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
fHisto->Fill(5, x, xs/barn);
}
xs = store->GetChargeExchangeCrossSectionPerAtom(particle,e,elm);
if(verbose>0) G4cout << " " << std::setw(12) << xtot/barn << G4endl;
histo->fill(6, x, xs/barn);
histo->fill(7, x, xtot/barn);
xs = store->GetChargeExchangeCrossSectionPerAtom(particle,e,elm,mat);
if(fVerbose>0) G4cout << " " << std::setw(12) << xtot/barn << G4endl;
fHisto->Fill(6, x, xs/barn);
fHisto->Fill(7, x, xtot/barn);
}
x = p1 - dp*0.5;
for(i=0; i<nBinsP; i++) {
for(i=0; i<fBinsP; i++) {
x += dp;
p = std::pow(10.,x)*GeV;
e = std::sqrt(p*p + mass*mass) - mass;
xs = store->GetElasticCrossSectionPerAtom(particle,e,elm);
histo->fill(0, x, xs/barn);
xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm);
histo->fill(2, x, xs/barn);
xs = store->GetElasticCrossSectionPerAtom(particle,e,elm,mat);
fHisto->Fill(0, x, xs/barn);
xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm,mat);
fHisto->Fill(2, x, xs/barn);
}
if(verbose > 0) {
if(fVerbose > 0) {
G4cout << "-----------------------------------------------------------------"
<< G4endl;
<< G4endl;
}
G4cout.precision(prec);
if(verbose > 1) { histo->print(0); }
histo->save();
fHisto->Save();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void HistoManager::SetVerbose(G4int val)
{
verbose = val;
histo->setVerbose(val);
fVerbose = val;
fHisto->SetVerbose(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,117 +23,97 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr00/src/HistoMessenger.cc
/// \brief Implementation of the HistoMessenger class
//
// $Id: HistoMessenger.cc,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
/////////////////////////////////////////////////////////////////////////
// $Id$
//
// HistoMessenger
//
// Created: 31.01.2003 V.Ivanchenko
//
// Modified:
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
//
////////////////////////////////////////////////////////////////////////
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "HistoMessenger.hh"
#include <sstream>
#include "Histo.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::HistoMessenger(Histo* man) : histo (man)
HistoMessenger::HistoMessenger(Histo* hist)
:fHisto(hist)
{
fHistoDir = new G4UIdirectory("/testhadr/histo/");
fHistoDir->SetGuidance("histograms control");
factoryCmd = new G4UIcmdWithAString("/testhadr/HistoName",this);
factoryCmd->SetGuidance("set name for the histograms file");
fFactoryCmd = new G4UIcmdWithAString("/testhadr/histo/fileName",this);
fFactoryCmd->SetGuidance("set name for the histograms file");
fileCmd = new G4UIcmdWithAString("/testhadr/HistoType",this);
fileCmd->SetGuidance("set type (hbook, root, aida) for the histograms file");
fileCmd->SetCandidates("hbook root aida");
fFileCmd = new G4UIcmdWithAString("/testhadr/histo/fileType",this);
fFileCmd->SetGuidance("set type (hbook, XML) for the histograms file");
optCmd = new G4UIcmdWithAString("/testhadr/HistoOption",this);
optCmd->SetGuidance("set AIDA option for the histograms file");
printCmd = new G4UIcmdWithAnInteger("/testhadr/HistoPrint",this);
printCmd->SetGuidance("Print histogram by ID, if ID=0 - all.");
printCmd->SetParameterName("pr",false);
printCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
histoCmd = new G4UIcommand("/testhadr/SetHisto",this);
histoCmd->SetGuidance("Set bining of the histo number ih :");
histoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
fHistoCmd = new G4UIcommand("/testhadr/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");
histoCmd->SetParameter(ih);
ih->SetGuidance("histo number : from 0 to MaxHisto-1");
fHistoCmd->SetParameter(ih);
//
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
nbBins->SetGuidance("number of bins");
nbBins->SetParameterRange("nbBins>0");
histoCmd->SetParameter(nbBins);
//
fHistoCmd->SetParameter(nbBins);
//
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
valMin->SetGuidance("valMin, expressed in unit");
histoCmd->SetParameter(valMin);
//
fHistoCmd->SetParameter(valMin);
//
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
valMax->SetGuidance("valMax, expressed in unit");
histoCmd->SetParameter(valMax);
//
fHistoCmd->SetParameter(valMax);
//
G4UIparameter* unit = new G4UIparameter("unit",'s',true);
unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
unit->SetDefaultValue("none");
histoCmd->SetParameter(unit);
fHistoCmd->SetParameter(unit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete fileCmd;
delete histoCmd;
delete factoryCmd;
delete optCmd;
delete printCmd;
delete fFileCmd;
delete fHistoCmd;
delete fFactoryCmd;
delete fHistoDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if (command == factoryCmd)
histo->setFileName(newValues);
if (command == fFactoryCmd) { fHisto->SetFileName(newValues); }
if (command == fileCmd)
histo->setFileType(newValues);
if (command == optCmd)
histo->setFileOption(newValues);
if (command == printCmd)
histo->print(printCmd->GetNewIntValue(newValues));
if (command == fFileCmd) { fHisto->SetFileType(newValues); }
if (command == histoCmd) {
G4int ih, nbBins;
G4double vmin,vmax;
G4String unit;
if (command == fHistoCmd) {
G4int ih,nbBins;
G4double vmin,vmax;
std::istringstream is(newValues);
is >> ih >> nbBins >> vmin >> vmax >> unit;
G4String unts;
is >> ih >> nbBins >> vmin >> vmax >> unts;
G4String unit = unts;
G4double vUnit = 1. ;
if (unit != "none" && unit != "") vUnit = G4UIcommand::ValueOf(unit);
histo->setHisto1D(ih,nbBins,vmin,vmax,vUnit);
}
if(unit != "none") { vUnit = G4UIcommand::ValueOf(unit); }
if(vUnit <= 0.0) { vUnit = 1.; }
fHisto->SetHisto1D(ih,nbBins,vmin,vmax,vUnit);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PrimaryGeneratorAction.cc,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file hadronic/Hadr00/src/PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
//
@@ -39,28 +41,32 @@
#include "PrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "G4Proton.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
particleGun = new G4ParticleGun(1);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
fParticleGun = new G4ParticleGun(1);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
fParticleGun->SetParticleEnergy(1.*GeV);
fParticleGun->SetParticleDefinition(G4Proton::Proton());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,16 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////
/// \file hadronic/Hadr00/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// RunAction
// $Id: RunAction.hh,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Created: 21.06.2008 V.Ivanchenko
// -------------------------------------------------------------
//
// GEANT4 class file
// RunAction
//
// Modified:
//
////////////////////////////////////////////////////////////////////////
//
// -------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -41,8 +43,7 @@
#include "HistoManager.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4Run.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -58,12 +59,9 @@ RunAction::~RunAction()
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
HistoManager* manager = HistoManager::GetPointer();
G4int id = aRun->GetRunID();
if(manager->GetVerbose()>0) {
G4cout << "### Run " << id << " start" << G4endl;
}
manager->BeginOfRun();
G4cout << "### Run " << id << " start" << G4endl;
(HistoManager::GetPointer())->BeginOfRun();
#ifdef G4VIS_USE
G4UImanager* UI = G4UImanager::GetUIpointer();
@@ -82,16 +80,15 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
void RunAction::EndOfRunAction(const G4Run*)
{
HistoManager* manager = HistoManager::GetPointer();
if(manager->GetVerbose()>0) {
G4cout << "RunAction: End of run actions are started" << G4endl;
}
manager->EndOfRun();
G4cout << "RunAction: End of run actions are started" << G4endl;
(HistoManager::GetPointer())->EndOfRun();
#ifdef G4VIS_USE
if (G4VVisManager::GetConcreteInstance())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+2 -3
View File
@@ -5,7 +5,6 @@
/testhadr/TargetRadius 1 cm
/testhadr/TargetLength 10 cm
#/testhadr/NumberDivZ 100
/testhadr/DrawTracks all
#/testhadr/CutsAll 1 mm
#/testhadr/Physics QBBC
#
@@ -50,8 +49,8 @@
# as markers 2 pixels wide:
/vis/scene/add/trajectories smooth
/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
#/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
#/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
#
# Draw hits at end of event: