Import Geant4 11.1.0.beta source tree
This commit is contained in:
+14
-12
@@ -1,14 +1,4 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# CMakeLists.txt
|
||||
# Module :
|
||||
# Package: Geant4.src.
|
||||
#
|
||||
# Intermediate level CMakeLists.txt - just process subdirectories
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# - Define toolkit source code modules and composed libraries
|
||||
|
||||
add_subdirectory(analysis)
|
||||
add_subdirectory(digits_hits)
|
||||
@@ -34,10 +24,22 @@ add_subdirectory(physics_lists)
|
||||
add_subdirectory(processes)
|
||||
add_subdirectory(readout)
|
||||
add_subdirectory(run)
|
||||
add_subdirectory(tasking)
|
||||
add_subdirectory(track)
|
||||
add_subdirectory(tracking)
|
||||
add_subdirectory(visualization)
|
||||
|
||||
# Optional reset of categories
|
||||
# This is *only for build testing purposes* as the resultant libraries are not
|
||||
# usable by tests, examples, or any other client application
|
||||
if(__GEANT4_LIBRARY_DEFINITION_FILE AND (EXISTS ${PROJECT_SOURCE_DIR}/tests))
|
||||
get_filename_component(__lib_def_file "${__GEANT4_LIBRARY_DEFINITION_FILE}" ABSOLUTE)
|
||||
if(NOT EXISTS "${__lib_def_file}")
|
||||
message(FATAL_ERROR "library definition file '${__lib_def_file}' does not exist")
|
||||
endif()
|
||||
|
||||
__geant4_category_reset()
|
||||
include("${__lib_def_file}")
|
||||
endif()
|
||||
|
||||
# - Compose libs
|
||||
geant4_compose_targets()
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
SUBDIR1 = externals global intercoms analysis graphics_reps materials
|
||||
SUBDIR2 = geometry particles track digits_hits processes parameterisations
|
||||
SUBDIR2 += tracking event run tasking error_propagation readout physics_lists
|
||||
SUBDIR2 += tracking event run error_propagation readout physics_lists
|
||||
SUBDIR3 = persistency interfaces visualization
|
||||
|
||||
SUBDIR4 = g3tog4
|
||||
@@ -167,7 +167,7 @@ endif
|
||||
|
||||
banner:
|
||||
@$(ECHO) "*************************************************************"
|
||||
@$(ECHO) " Installation Geant4 version geant4-11-00-patch-02 "
|
||||
@$(ECHO) " Installation Geant4 version geant4-11-01-beta-01 "
|
||||
@$(ECHO) " Copyright (C) 1994-2022 Geant4 Collaboration "
|
||||
@$(ECHO) "*************************************************************"
|
||||
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
# - G4analysis category build
|
||||
|
||||
if(GEANT4_USE_FREETYPE)
|
||||
add_definitions(-DTOOLS_USE_FREETYPE)
|
||||
endif()
|
||||
|
||||
set(G4analysis_COMPONENTS
|
||||
accumulables/sources.cmake
|
||||
csv/sources.cmake
|
||||
factory/sources.cmake
|
||||
hntools/sources.cmake
|
||||
management/sources.cmake
|
||||
root/sources.cmake
|
||||
xml/sources.cmake
|
||||
)
|
||||
include(accumulables/sources.cmake)
|
||||
include(csv/sources.cmake)
|
||||
include(factory/sources.cmake)
|
||||
include(hntools/sources.cmake)
|
||||
include(management/sources.cmake)
|
||||
include(root/sources.cmake)
|
||||
include(xml/sources.cmake)
|
||||
|
||||
geant4_add_category(G4analysis MODULES G4accumulables G4csv G4analysisfac G4hntools G4analysismng G4root G4xml)
|
||||
|
||||
if(GEANT4_USE_HDF5)
|
||||
add_definitions(-DTOOLS_USE_HDF5)
|
||||
list(APPEND G4analysis_COMPONENTS hdf5/sources.cmake)
|
||||
include(hdf5/sources.cmake)
|
||||
geant4_category_modules(G4analysis G4hdf5)
|
||||
endif()
|
||||
|
||||
|
||||
geant4_global_library_target(NAME G4analysis
|
||||
COMPONENTS ${G4analysis_COMPONENTS})
|
||||
|
||||
+27
-16
@@ -1,26 +1,37 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category analysis History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the SVN log-message one should put at every
|
||||
committal in the SVN repository !
|
||||
## 2022-05-18 Guy Barrand (analysis-V11-00-05)
|
||||
- have "toolx" namespace for g4tools classes related to "externals", then:
|
||||
- tools::[hdf5,zlib,xml::xml_style,raxml,sg::text_freetype] become toolx::[hdf5,zlib,xml::xml_style,raxml,sg::text_freetype].
|
||||
- corresponding includes #include <tools/...> become #include <toolx/...>
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2022-03-24 Ben Morgan (analysis-V11-00-04)
|
||||
- Use geant4_category_modules to optionaly add G4hdf5 module to category
|
||||
|
||||
March 2, 2022 I. Hrivnacova (analysis-V10-07-31)
|
||||
## 2022-03-02 I. Hrivnacova (analysis-V11-00-03)
|
||||
- Fix notifying about closing file in G4GenericAnalysisManager;
|
||||
this fixes saving scorers in analysis file in B3 example
|
||||
this fixes savinng scorers in analysis file in B3 example
|
||||
for the second and further runs.
|
||||
|
||||
## 2022-02-23 I. Hrivnacova (analysis-V11-00-02)
|
||||
- Added "getVector" commands (for visualization):
|
||||
/analysis/hn|pn/getVector
|
||||
|
||||
## 2022-01-28 Ben Morgan (analysis-V11-00-01)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
call to `geant4_add_category` to define library build from source modules.
|
||||
|
||||
## 2021-12-10 Ben Morgan (analysis-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
November 15, 2021 I. Hrivnacova (analysis-V10-07-30)
|
||||
- Fixed remaining Coverity issues
|
||||
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
# - G4analysisfac module build definition
|
||||
|
||||
# Optional additional links
|
||||
if(GEANT4_USE_HDF5)
|
||||
set(G4analysisfac_G4hdf5 G4hdf5)
|
||||
endif()
|
||||
|
||||
# Define the Geant4 Module.
|
||||
geant4_add_module(G4analysisfac
|
||||
PUBLIC_HEADERS
|
||||
@@ -19,4 +14,10 @@ geant4_add_module(G4analysisfac
|
||||
|
||||
geant4_module_link_libraries(G4analysisfac
|
||||
PUBLIC G4analysismng G4hntools G4globman
|
||||
PRIVATE G4csv G4root G4xml ${G4analysisfac_G4hdf5})
|
||||
PRIVATE G4csv G4root G4xml)
|
||||
|
||||
# HDF5, if enabled
|
||||
if(GEANT4_USE_HDF5)
|
||||
geant4_module_compile_definitions(G4analysisfac PUBLIC TOOLS_USE_HDF5)
|
||||
geant4_module_link_libraries(G4analysisfac PRIVATE G4hdf5)
|
||||
endif()
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "G4ToolsAnalysisManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/hdf5/ntuple"
|
||||
#include "toolx/hdf5/ntuple"
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
@@ -58,14 +58,14 @@ class G4Hdf5AnalysisManager : public G4ToolsAnalysisManager
|
||||
static G4bool IsInstance();
|
||||
|
||||
// Access methods
|
||||
tools::hdf5::ntuple* GetNtuple() const;
|
||||
tools::hdf5::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
toolx::hdf5::ntuple* GetNtuple() const;
|
||||
toolx::hdf5::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
|
||||
// Iterators
|
||||
std::vector<tools::hdf5::ntuple*>::iterator BeginNtuple();
|
||||
std::vector<tools::hdf5::ntuple*>::iterator EndNtuple();
|
||||
std::vector<tools::hdf5::ntuple*>::const_iterator BeginConstNtuple() const;
|
||||
std::vector<tools::hdf5::ntuple*>::const_iterator EndConstNtuple() const;
|
||||
std::vector<toolx::hdf5::ntuple*>::iterator BeginNtuple();
|
||||
std::vector<toolx::hdf5::ntuple*>::iterator EndNtuple();
|
||||
std::vector<toolx::hdf5::ntuple*>::const_iterator BeginConstNtuple() const;
|
||||
std::vector<toolx::hdf5::ntuple*>::const_iterator EndConstNtuple() const;
|
||||
|
||||
protected:
|
||||
// Virtual methods from base class
|
||||
|
||||
@@ -39,35 +39,35 @@ G4bool G4Hdf5AnalysisManager::IsOpenFileImpl() const
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::hdf5::ntuple* G4Hdf5AnalysisManager::GetNtuple() const
|
||||
toolx::hdf5::ntuple* G4Hdf5AnalysisManager::GetNtuple() const
|
||||
{
|
||||
return fNtupleFileManager->GetNtupleManager()->GetNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::hdf5::ntuple* G4Hdf5AnalysisManager::GetNtuple(G4int ntupleId) const
|
||||
toolx::hdf5::ntuple* G4Hdf5AnalysisManager::GetNtuple(G4int ntupleId) const
|
||||
{
|
||||
return fNtupleFileManager->GetNtupleManager()->GetNtuple(ntupleId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hdf5::ntuple*>::iterator G4Hdf5AnalysisManager::BeginNtuple()
|
||||
std::vector<toolx::hdf5::ntuple*>::iterator G4Hdf5AnalysisManager::BeginNtuple()
|
||||
{
|
||||
return fNtupleFileManager->GetNtupleManager()->BeginNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hdf5::ntuple*>::iterator G4Hdf5AnalysisManager::EndNtuple()
|
||||
std::vector<toolx::hdf5::ntuple*>::iterator G4Hdf5AnalysisManager::EndNtuple()
|
||||
{
|
||||
return fNtupleFileManager->GetNtupleManager()->EndNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hdf5::ntuple*>::const_iterator
|
||||
std::vector<toolx::hdf5::ntuple*>::const_iterator
|
||||
G4Hdf5AnalysisManager::BeginConstNtuple() const
|
||||
{
|
||||
return fNtupleFileManager->GetNtupleManager()->BeginConstNtuple();
|
||||
@@ -75,7 +75,7 @@ G4Hdf5AnalysisManager::BeginConstNtuple() const
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hdf5::ntuple*>::const_iterator
|
||||
std::vector<toolx::hdf5::ntuple*>::const_iterator
|
||||
G4Hdf5AnalysisManager::EndConstNtuple() const
|
||||
{
|
||||
return fNtupleFileManager->GetNtupleManager()->EndConstNtuple();
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "G4ToolsAnalysisReader.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/hdf5/ntuple"
|
||||
#include "toolx/hdf5/ntuple"
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
@@ -57,8 +57,8 @@ class G4Hdf5AnalysisReader : public G4ToolsAnalysisReader
|
||||
static G4Hdf5AnalysisReader* Instance();
|
||||
|
||||
// Access methods
|
||||
tools::hdf5::ntuple* GetNtuple() const;
|
||||
tools::hdf5::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
toolx::hdf5::ntuple* GetNtuple() const;
|
||||
toolx::hdf5::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
using G4VAnalysisReader::GetNtuple;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::hdf5::ntuple* G4Hdf5AnalysisReader::GetNtuple() const
|
||||
toolx::hdf5::ntuple* G4Hdf5AnalysisReader::GetNtuple() const
|
||||
{
|
||||
return fNtupleManager->GetNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::hdf5::ntuple* G4Hdf5AnalysisReader::GetNtuple(G4int ntupleId) const
|
||||
toolx::hdf5::ntuple* G4Hdf5AnalysisReader::GetNtuple(G4int ntupleId) const
|
||||
{
|
||||
return fNtupleManager->GetNtuple(ntupleId);
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/hdf5/ntuple" // for hid_t
|
||||
#include "toolx/hdf5/ntuple" // for hid_t
|
||||
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <string_view>
|
||||
|
||||
using G4Hdf5File = std::tuple<hid_t, hid_t, hid_t>;
|
||||
using Hdf5NtupleDescription = G4TNtupleDescription<tools::hdf5::ntuple, G4Hdf5File>;
|
||||
using Hdf5NtupleDescription = G4TNtupleDescription<toolx::hdf5::ntuple, G4Hdf5File>;
|
||||
|
||||
class G4Hdf5FileManager : public G4VTFileManager<G4Hdf5File>
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "G4VTHnFileManager.hh"
|
||||
|
||||
#include "tools/hdf5/ntuple" // for hid_t
|
||||
#include "toolx/hdf5/ntuple" // for hid_t
|
||||
|
||||
#include <string_view>
|
||||
|
||||
|
||||
@@ -28,15 +28,15 @@
|
||||
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "tools/hdf5/header"
|
||||
#include "tools/hdf5/h2file"
|
||||
#include "toolx/hdf5/header"
|
||||
#include "toolx/hdf5/h2file"
|
||||
#include "tools/histo/h1d"
|
||||
#include "tools/histo/h2d"
|
||||
#include "tools/histo/h3d"
|
||||
#include "tools/histo/p1d"
|
||||
#include "tools/histo/p2d"
|
||||
|
||||
#include "tools/hdf5/h2file"
|
||||
#include "toolx/hdf5/h2file"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <>
|
||||
@@ -44,7 +44,7 @@ inline
|
||||
G4bool G4Hdf5HnFileManager<tools::histo::p1d>::WriteImpl(
|
||||
hid_t hdirectory, tools::histo::p1d* ht, const G4String& htName)
|
||||
{
|
||||
return tools::hdf5::write_profile(G4cout, hdirectory, htName, *ht);
|
||||
return toolx::hdf5::write_profile(G4cout, hdirectory, htName, *ht);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -53,7 +53,7 @@ inline
|
||||
G4bool G4Hdf5HnFileManager<tools::histo::p2d>::WriteImpl(
|
||||
hid_t hdirectory, tools::histo::p2d* ht, const G4String& htName)
|
||||
{
|
||||
return tools::hdf5::write_profile(G4cout, hdirectory, htName, *ht);
|
||||
return toolx::hdf5::write_profile(G4cout, hdirectory, htName, *ht);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -62,7 +62,7 @@ inline
|
||||
G4bool G4Hdf5HnFileManager<HT>::WriteImpl(
|
||||
hid_t hdirectory, HT* ht, const G4String& htName)
|
||||
{
|
||||
return tools::hdf5::write_histo(G4cout, hdirectory, htName, *ht);
|
||||
return toolx::hdf5::write_histo(G4cout, hdirectory, htName, *ht);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -83,21 +83,21 @@ G4bool G4Hdf5HnFileManager<HT>::WriteExtra(
|
||||
}
|
||||
|
||||
// create a header with general infos :
|
||||
if(!tools::hdf5::write_header(hfile)) {
|
||||
G4cerr << "tools::hdf5::write_header() failed." << std::endl;
|
||||
if(!toolx::hdf5::write_header(hfile)) {
|
||||
G4cerr << "toolx::hdf5::write_header() failed." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create directories
|
||||
hid_t hdirectory = tools_H5Gcreate(hfile, "histograms", 0);
|
||||
hid_t hdirectory = toolx_H5Gcreate(hfile, "histograms", 0);
|
||||
if ( hdirectory < 0 ) {
|
||||
G4cerr << "tools_H5Gcreate failed " << G4endl;
|
||||
G4cerr << "toolx_H5Gcreate failed " << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto result = tools::hdf5::write_atb(hdirectory, "type", "directory");
|
||||
auto result = toolx::hdf5::write_atb(hdirectory, "type", "directory");
|
||||
if ( ! result) {
|
||||
G4cerr << "tools::hdf5::write_atb failed " << G4endl;
|
||||
G4cerr << "toolx::hdf5::write_atb failed " << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "G4VTHnRFileManager.hh"
|
||||
|
||||
#include "tools/hdf5/ntuple" // for hid_t
|
||||
#include "toolx/hdf5/ntuple" // for hid_t
|
||||
|
||||
#include <string_view>
|
||||
|
||||
|
||||
@@ -28,15 +28,15 @@
|
||||
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "tools/hdf5/header"
|
||||
#include "tools/hdf5/h2file"
|
||||
#include "toolx/hdf5/header"
|
||||
#include "toolx/hdf5/h2file"
|
||||
#include "tools/histo/h1d"
|
||||
#include "tools/histo/h2d"
|
||||
#include "tools/histo/h3d"
|
||||
#include "tools/histo/p1d"
|
||||
#include "tools/histo/p2d"
|
||||
|
||||
#include "tools/hdf5/h2file"
|
||||
#include "toolx/hdf5/h2file"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename HT>
|
||||
@@ -44,7 +44,7 @@ inline
|
||||
G4bool G4Hdf5HnRFileManager<HT>::ReadT(
|
||||
hid_t directory, const G4String& htName, HT*& ht)
|
||||
{
|
||||
return tools::hdf5::read_histo(G4cout, directory, htName, ht);
|
||||
return toolx::hdf5::read_histo(G4cout, directory, htName, ht);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -53,7 +53,7 @@ inline
|
||||
G4bool G4Hdf5HnRFileManager<tools::histo::p1d>::ReadT(
|
||||
hid_t directory, const G4String& htName, tools::histo::p1d*& ht)
|
||||
{
|
||||
return tools::hdf5::read_profile(G4cout, directory, htName, ht);
|
||||
return toolx::hdf5::read_profile(G4cout, directory, htName, ht);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -62,7 +62,7 @@ inline
|
||||
G4bool G4Hdf5HnRFileManager<tools::histo::p2d>::ReadT(
|
||||
hid_t directory, const G4String& htName, tools::histo::p2d*& ht)
|
||||
{
|
||||
return tools::hdf5::read_profile(G4cout, directory, htName, ht);
|
||||
return toolx::hdf5::read_profile(G4cout, directory, htName, ht);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/hdf5/ntuple"
|
||||
#include "toolx/hdf5/ntuple"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@@ -44,17 +44,17 @@ class G4Hdf5FileManager;
|
||||
|
||||
// Types alias
|
||||
using G4Hdf5File = std::tuple<hid_t, hid_t, hid_t>;
|
||||
using Hdf5NtupleDescription = G4TNtupleDescription<tools::hdf5::ntuple, G4Hdf5File>;
|
||||
using Hdf5NtupleDescription = G4TNtupleDescription<toolx::hdf5::ntuple, G4Hdf5File>;
|
||||
|
||||
// template specialization used by this class defined below
|
||||
|
||||
template <>
|
||||
template <>
|
||||
G4bool G4TNtupleManager<tools::hdf5::ntuple, G4Hdf5File>::FillNtupleTColumn(
|
||||
G4bool G4TNtupleManager<toolx::hdf5::ntuple, G4Hdf5File>::FillNtupleTColumn(
|
||||
G4int ntupleId, G4int columnId, const std::string& value);
|
||||
|
||||
|
||||
class G4Hdf5NtupleManager : public G4TNtupleManager<tools::hdf5::ntuple,
|
||||
class G4Hdf5NtupleManager : public G4TNtupleManager<toolx::hdf5::ntuple,
|
||||
G4Hdf5File>
|
||||
{
|
||||
friend class G4Hdf5AnalysisManager;
|
||||
@@ -105,7 +105,7 @@ G4Hdf5NtupleManager::GetNtupleDescriptionVector() const
|
||||
|
||||
template <>
|
||||
template <>
|
||||
inline G4bool G4TNtupleManager<tools::hdf5::ntuple, G4Hdf5File>::FillNtupleTColumn(
|
||||
inline G4bool G4TNtupleManager<toolx::hdf5::ntuple, G4Hdf5File>::FillNtupleTColumn(
|
||||
G4int ntupleId, G4int columnId, const std::string& value)
|
||||
{
|
||||
if ( fState.GetIsActivation() && ( ! GetActivation(ntupleId) ) ) {
|
||||
@@ -128,7 +128,7 @@ inline G4bool G4TNtupleManager<tools::hdf5::ntuple, G4Hdf5File>::FillNtupleTColu
|
||||
auto icolumn = ntuple->columns()[index];
|
||||
|
||||
// get column and check its type
|
||||
auto column = dynamic_cast<tools::hdf5::ntuple::column_string* >(icolumn);
|
||||
auto column = dynamic_cast<toolx::hdf5::ntuple::column_string* >(icolumn);
|
||||
if ( ! column ) {
|
||||
G4Analysis::Warn(
|
||||
"Column type does not match: ntupleId " + to_string(ntupleId) +
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "G4VRFileManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/hdf5/ntuple"
|
||||
#include "toolx/hdf5/ntuple"
|
||||
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
#include "G4TRNtupleManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/hdf5/ntuple"
|
||||
#include "toolx/hdf5/ntuple"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
class G4Hdf5RFileManager;
|
||||
|
||||
class G4Hdf5RNtupleManager : public G4TRNtupleManager<tools::hdf5::ntuple>
|
||||
class G4Hdf5RNtupleManager : public G4TRNtupleManager<toolx::hdf5::ntuple>
|
||||
{
|
||||
friend class G4Hdf5AnalysisReader;
|
||||
|
||||
@@ -57,7 +57,7 @@ class G4Hdf5RNtupleManager : public G4TRNtupleManager<tools::hdf5::ntuple>
|
||||
// Methods from the base class
|
||||
virtual G4int ReadNtupleImpl(const G4String& ntupleName, const G4String& fileName,
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
virtual G4bool GetTNtupleRow(G4TRNtupleDescription<tools::hdf5::ntuple>* ntupleDescription) final;
|
||||
virtual G4bool GetTNtupleRow(G4TRNtupleDescription<toolx::hdf5::ntuple>* ntupleDescription) final;
|
||||
|
||||
// Static data members
|
||||
static constexpr std::string_view fkClass { "G4Hdf5RNtupleManager" };
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
#ifndef g4hdf5_defs_h
|
||||
#define g4hdf5_defs_h
|
||||
|
||||
#include "tools/hdf5/ntuple"
|
||||
#include "toolx/hdf5/ntuple"
|
||||
#include "g4hntools_defs.hh"
|
||||
|
||||
// Hdf5 output specific types
|
||||
using G4Hdf5Ntuple = tools::hdf5::ntuple;
|
||||
using G4Hdf5RNtuple = tools::hdf5::ntuple;
|
||||
using G4Hdf5Ntuple = toolx::hdf5::ntuple;
|
||||
using G4Hdf5RNtuple = toolx::hdf5::ntuple;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
#include "tools/hdf5/h2file"
|
||||
#include "toolx/hdf5/h2file"
|
||||
|
||||
using namespace G4Analysis;
|
||||
using namespace tools;
|
||||
@@ -82,7 +82,7 @@ hid_t G4Hdf5FileManager::CreateDirectory(hid_t& file,
|
||||
auto success = true;
|
||||
|
||||
// create directory
|
||||
auto directory = tools_H5Gcreate(file, newDirectoryName, 0);
|
||||
auto directory = toolx_H5Gcreate(file, newDirectoryName, 0);
|
||||
// 0 seems to be an optional parameter. The web doc does not say what should
|
||||
// be the default value but 0 is what is found in examples, and in the code, if we pass 0, clearly some
|
||||
// default value is taken.
|
||||
@@ -93,7 +93,7 @@ hid_t G4Hdf5FileManager::CreateDirectory(hid_t& file,
|
||||
}
|
||||
else {
|
||||
// write atb (header?)
|
||||
auto result = hdf5::write_atb(directory, "type", "directory");
|
||||
auto result = toolx::hdf5::write_atb(directory, "type", "directory");
|
||||
if ( !result) {
|
||||
Warn("Write_atb class failed for " + directoryName,
|
||||
fkClass, "CreateDirectory");
|
||||
@@ -139,8 +139,8 @@ std::shared_ptr<G4Hdf5File> G4Hdf5FileManager::CreateFileImpl(const G4String& fi
|
||||
}
|
||||
|
||||
// create a header with general infos
|
||||
if(!tools::hdf5::write_header(file)) {
|
||||
Warn("tools::hdf5::write_header() failed for " + fileName,
|
||||
if(!toolx::hdf5::write_header(file)) {
|
||||
Warn("toolx::hdf5::write_header() failed for " + fileName,
|
||||
fkClass, "CreateFileImpl");
|
||||
return std::make_shared<G4Hdf5File>(-1, -1, -1);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4Hdf5NtupleManager::G4Hdf5NtupleManager(const G4AnalysisManagerState& state)
|
||||
: G4TNtupleManager<tools::hdf5::ntuple, G4Hdf5File>(state)
|
||||
: G4TNtupleManager<toolx::hdf5::ntuple, G4Hdf5File>(state)
|
||||
{}
|
||||
|
||||
//
|
||||
@@ -73,7 +73,7 @@ void G4Hdf5NtupleManager::CreateTNtuple(
|
||||
|
||||
// create ntuple
|
||||
ntupleDescription->fNtuple
|
||||
= new tools::hdf5::ntuple(
|
||||
= new toolx::hdf5::ntuple(
|
||||
G4cout, directory, ntupleDescription->fNtupleBooking,
|
||||
compressionLevel, basketSize);
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "tools/hdf5/h2file"
|
||||
#include "tools/hdf5/group_exists"
|
||||
#include "tools/zlib"
|
||||
#include "toolx/hdf5/h2file"
|
||||
#include "toolx/hdf5/group_exists"
|
||||
#include "toolx/zlib"
|
||||
|
||||
using namespace G4Analysis;
|
||||
using namespace tools;
|
||||
@@ -70,7 +70,7 @@ hid_t G4Hdf5RFileManager::OpenRFile(const G4String& fileName,
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
// newFile->add_unziper('Z',tools::decompress_buffer);
|
||||
// newFile->add_unziper('Z',toolx::decompress_buffer);
|
||||
|
||||
// add file in a map
|
||||
fRFiles[name] = G4Hdf5File(newFile, kInvalidId, kInvalidId);
|
||||
@@ -85,7 +85,7 @@ hid_t G4Hdf5RFileManager::OpenDirectory(hid_t file, const G4String& directoryNam
|
||||
{
|
||||
Message(kVL4, "open", "read directory", directoryName);
|
||||
|
||||
auto directory = tools_H5Gopen(file, directoryName);
|
||||
auto directory = toolx_H5Gopen(file, directoryName);
|
||||
if ( directory < 0 ) {
|
||||
Warn("Cannot open directory " + directoryName, fkClass, "OpenDirectory");
|
||||
return kInvalidId;
|
||||
|
||||
@@ -33,7 +33,7 @@ using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4Hdf5RNtupleManager::G4Hdf5RNtupleManager(const G4AnalysisManagerState& state)
|
||||
: G4TRNtupleManager<tools::hdf5::ntuple>(state)
|
||||
: G4TRNtupleManager<toolx::hdf5::ntuple>(state)
|
||||
{}
|
||||
|
||||
//
|
||||
@@ -60,8 +60,8 @@ G4int G4Hdf5RNtupleManager::ReadNtupleImpl(const G4String& ntupleName,
|
||||
if ( directory < 0 ) return kInvalidId;
|
||||
|
||||
// Create ntuple
|
||||
auto rntuple = new tools::hdf5::ntuple(G4cout, directory, ntupleName);
|
||||
auto rntupleDescription = new G4TRNtupleDescription<tools::hdf5::ntuple>(rntuple);
|
||||
auto rntuple = new toolx::hdf5::ntuple(G4cout, directory, ntupleName);
|
||||
auto rntupleDescription = new G4TRNtupleDescription<toolx::hdf5::ntuple>(rntuple);
|
||||
auto id = SetNtuple(rntupleDescription);
|
||||
|
||||
Message(kVL2, "read", "ntuple", ntupleName, id > kInvalidId);
|
||||
@@ -71,7 +71,7 @@ G4int G4Hdf5RNtupleManager::ReadNtupleImpl(const G4String& ntupleName,
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4Hdf5RNtupleManager::GetTNtupleRow(
|
||||
G4TRNtupleDescription<tools::hdf5::ntuple>* ntupleDescription)
|
||||
G4TRNtupleDescription<toolx::hdf5::ntuple>* ntupleDescription)
|
||||
{
|
||||
auto ntuple = ntupleDescription->fNtuple;
|
||||
|
||||
|
||||
@@ -54,9 +54,13 @@ class G4ToolsAnalysisMessenger : public G4UImessenger
|
||||
// Methods
|
||||
template <typename HT>
|
||||
G4String GetHnAddress(G4int id, G4THnManager<HT>* htManager) const;
|
||||
template <typename HT>
|
||||
G4String GetHnVectorAddress(G4THnManager<HT>* htManager) const;
|
||||
|
||||
// Data members
|
||||
G4ToolsAnalysisManager* fManager; ///< Associated class
|
||||
|
||||
// analysis/hn|pn/get command
|
||||
std::unique_ptr<G4UIcommand> fGetH1Cmd;
|
||||
std::unique_ptr<G4UIcommand> fGetH2Cmd;
|
||||
std::unique_ptr<G4UIcommand> fGetH3Cmd;
|
||||
@@ -67,6 +71,18 @@ class G4ToolsAnalysisMessenger : public G4UImessenger
|
||||
G4String fH3Value;
|
||||
G4String fP1Value;
|
||||
G4String fP2Value;
|
||||
|
||||
// analysis/hn|pn/getVector command
|
||||
std::unique_ptr<G4UIcommand> fGetH1VectorCmd;
|
||||
std::unique_ptr<G4UIcommand> fGetH2VectorCmd;
|
||||
std::unique_ptr<G4UIcommand> fGetH3VectorCmd;
|
||||
std::unique_ptr<G4UIcommand> fGetP1VectorCmd;
|
||||
std::unique_ptr<G4UIcommand> fGetP2VectorCmd;
|
||||
G4String fH1VectorValue;
|
||||
G4String fH2VectorValue;
|
||||
G4String fH3VectorValue;
|
||||
G4String fP1VectorValue;
|
||||
G4String fP2VectorValue;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
@@ -85,4 +101,18 @@ G4String G4ToolsAnalysisMessenger::GetHnAddress(
|
||||
return G4String();
|
||||
}
|
||||
|
||||
template <typename HT>
|
||||
inline
|
||||
G4String G4ToolsAnalysisMessenger::GetHnVectorAddress(
|
||||
G4THnManager<HT>* htManager) const
|
||||
{
|
||||
auto htVector = htManager->GetTVector();
|
||||
if ( htVector != nullptr ) {
|
||||
std::ostringstream os;
|
||||
os << static_cast<void*>(htVector);
|
||||
return os.str();
|
||||
}
|
||||
return G4String();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,18 +44,23 @@ G4ToolsAnalysisMessenger::G4ToolsAnalysisMessenger(G4ToolsAnalysisManager* manag
|
||||
// Create get commands
|
||||
G4AnalysisMessengerHelper helper("h1");
|
||||
fGetH1Cmd = helper.CreateGetCommand(this);
|
||||
fGetH1VectorCmd = helper.CreateGetVectorCommand(this);
|
||||
|
||||
helper.SetHnType("h2");
|
||||
fGetH2Cmd = helper.CreateGetCommand(this);
|
||||
fGetH2VectorCmd = helper.CreateGetVectorCommand(this);
|
||||
|
||||
helper.SetHnType("h3");
|
||||
fGetH3Cmd = helper.CreateGetCommand(this);
|
||||
fGetH3VectorCmd = helper.CreateGetVectorCommand(this);
|
||||
|
||||
helper.SetHnType("p1");
|
||||
fGetP1Cmd = helper.CreateGetCommand(this);
|
||||
fGetP1VectorCmd = helper.CreateGetVectorCommand(this);
|
||||
|
||||
helper.SetHnType("p2");
|
||||
fGetP2Cmd = helper.CreateGetCommand(this);
|
||||
fGetP2VectorCmd = helper.CreateGetVectorCommand(this);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -73,6 +78,13 @@ G4String G4ToolsAnalysisMessenger::GetCurrentValue (G4UIcommand* command)
|
||||
if ( command == fGetH3Cmd.get() ) return fH3Value;
|
||||
if ( command == fGetP1Cmd.get() ) return fP1Value;
|
||||
if ( command == fGetP2Cmd.get() ) return fP2Value;
|
||||
|
||||
if ( command == fGetH1VectorCmd.get() ) return fH1VectorValue;
|
||||
if ( command == fGetH2VectorCmd.get() ) return fH2VectorValue;
|
||||
if ( command == fGetH3VectorCmd.get() ) return fH3VectorValue;
|
||||
if ( command == fGetP1VectorCmd.get() ) return fP1VectorValue;
|
||||
if ( command == fGetP2VectorCmd.get() ) return fP2VectorValue;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -95,4 +107,19 @@ void G4ToolsAnalysisMessenger::SetNewValue(G4UIcommand* command, G4String value)
|
||||
else if ( command == fGetP2Cmd.get() ) {
|
||||
fP2Value = GetHnAddress(id, fManager->fP2Manager);
|
||||
}
|
||||
if ( command == fGetH1VectorCmd.get() ) {
|
||||
fH1VectorValue = GetHnVectorAddress(fManager->fH1Manager);
|
||||
}
|
||||
else if ( command == fGetH2VectorCmd.get() ) {
|
||||
fH2VectorValue = GetHnVectorAddress(fManager->fH2Manager);
|
||||
}
|
||||
else if ( command == fGetH3VectorCmd.get() ) {
|
||||
fH3VectorValue = GetHnVectorAddress(fManager->fH3Manager);
|
||||
}
|
||||
else if ( command == fGetP1VectorCmd.get() ) {
|
||||
fP1VectorValue = GetHnVectorAddress(fManager->fP1Manager);
|
||||
}
|
||||
else if ( command == fGetP2VectorCmd.get() ) {
|
||||
fP2VectorValue = GetHnVectorAddress(fManager->fP2Manager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ class G4AnalysisMessengerHelper
|
||||
|
||||
std::unique_ptr<G4UIcommand> CreateGetCommand(
|
||||
G4UImessenger* messenger) const;
|
||||
std::unique_ptr<G4UIcommand> CreateGetVectorCommand(
|
||||
G4UImessenger* messenger) const;
|
||||
|
||||
std::unique_ptr<G4UIcommand> CreateSetTitleCommand(
|
||||
G4UImessenger* messenger) const;
|
||||
|
||||
@@ -72,6 +72,7 @@ class G4THnManager
|
||||
|
||||
// Get method
|
||||
HT* GetT(G4int id) const;
|
||||
std::vector<HT*>* GetTVector();
|
||||
|
||||
protected:
|
||||
// Iterators
|
||||
|
||||
@@ -229,3 +229,10 @@ HT* G4THnManager<HT>::GetT(G4int id) const
|
||||
{
|
||||
return GetTInFunction(id, "GetT");
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename HT>
|
||||
std::vector<HT*>* G4THnManager<HT>::GetTVector()
|
||||
{
|
||||
return &fTVector;
|
||||
}
|
||||
|
||||
@@ -140,13 +140,27 @@ G4AnalysisMessengerHelper::CreateGetCommand(G4UImessenger* messenger) const
|
||||
|
||||
std::unique_ptr<G4UIcommand> command(
|
||||
new G4UIcommand(Update("/analysis/HNTYPE_/get"), messenger));
|
||||
command->SetGuidance(Update("Get the address of the NDIM_D LOBJECT of given id"));
|
||||
command->SetGuidance(Update("Get the address of the NDIM_D LOBJECT of given id.\n"
|
||||
"This command is only for Geant4 internal use."));
|
||||
command->SetParameter(parId);
|
||||
command->AvailableForStates(G4State_Idle, G4State_GeomClosed, G4State_EventProc);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
std::unique_ptr<G4UIcommand>
|
||||
G4AnalysisMessengerHelper::CreateGetVectorCommand(G4UImessenger* messenger) const
|
||||
{
|
||||
std::unique_ptr<G4UIcommand> command(
|
||||
new G4UIcommand(Update("/analysis/HNTYPE_/getVector"), messenger));
|
||||
command->SetGuidance(Update("Get the address of the NDIM_D LOBJECT vector.\n"
|
||||
"This command is only for Geant4 internal use."));
|
||||
command->AvailableForStates(G4State_Idle, G4State_GeomClosed, G4State_EventProc);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
std::unique_ptr<G4UIcommand>
|
||||
G4AnalysisMessengerHelper::CreateSetTitleCommand(G4UImessenger* messenger) const
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#include "G4ios.hh"
|
||||
|
||||
#if defined(TOOLS_USE_FREETYPE)
|
||||
#include "tools/sg/text_freetype"
|
||||
#include "tools/xml/xml_style"
|
||||
#include "toolx/sg/text_freetype"
|
||||
#include "toolx/xml/xml_style"
|
||||
#include "tools/xml/wrap_viewplot_fonts_google_style"
|
||||
//inlib/xml/viewplot.style file embeded in an inline function.
|
||||
#include "tools/font/lato_regular_ttf"
|
||||
@@ -137,7 +137,7 @@ bool load_embeded_styles(tools::xml::styles& a_styles) {
|
||||
tools::replace(s,"@@back_slash@@","\\");
|
||||
ss += s + "\n";
|
||||
}
|
||||
return tools::xml::load_style_string(a_styles,ss);
|
||||
return toolx::xml::load_style_string(a_styles,ss);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -162,7 +162,7 @@ G4PlotManager::G4PlotManager(const G4AnalysisManagerState& state)
|
||||
// unsigned int ww = 2000; //to have better antialising on freetype fonts.
|
||||
// float A4 = 29.7f/21.0f;
|
||||
// unsigned int wh = (unsigned int)(float(ww)*A4*0.80);
|
||||
static tools::sg::text_freetype ttf;
|
||||
static toolx::sg::text_freetype ttf;
|
||||
ttf.add_embedded_font(tools::sg::font_lato_regular_ttf(),tools::font::lato_regular_ttf);
|
||||
ttf.add_embedded_font(tools::sg::font_roboto_bold_ttf(),tools::font::roboto_bold_ttf);
|
||||
fViewer = std::make_unique<tools::viewplot>(G4cout, ttf,
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "tools/wroot/to"
|
||||
#include "tools/wroot/file"
|
||||
#include "tools/zlib"
|
||||
#include "toolx/zlib"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename HT>
|
||||
@@ -51,7 +51,7 @@ G4bool G4RootHnFileManager<HT>::WriteExtra(
|
||||
// // create a new file
|
||||
auto rfile = new tools::wroot::file(G4cout, fileName);
|
||||
// TO DO
|
||||
// rfile->add_ziper('Z', tools::compress_buffer);
|
||||
// rfile->add_ziper('Z', toolx::compress_buffer);
|
||||
// rfile->set_compression(fState.GetCompressionLevel());
|
||||
if ( ! rfile ) return false;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "tools/wroot/file"
|
||||
#include "tools/wroot/to"
|
||||
#include "tools/zlib"
|
||||
#include "toolx/zlib"
|
||||
|
||||
using namespace tools;
|
||||
using namespace G4Analysis;
|
||||
@@ -118,7 +118,7 @@ G4RootFileManager::CreateFileImpl(const G4String& fileName)
|
||||
{
|
||||
// create file
|
||||
std::shared_ptr<wroot::file> file = std::make_shared<wroot::file>(G4cout, fileName);
|
||||
file->add_ziper('Z',compress_buffer);
|
||||
file->add_ziper('Z',toolx::compress_buffer);
|
||||
file->set_compression(fState.GetCompressionLevel());
|
||||
|
||||
if ( ! file->is_open() ) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "tools/rroot/file"
|
||||
#include "tools/zlib"
|
||||
#include "toolx/zlib"
|
||||
|
||||
using namespace G4Analysis;
|
||||
using namespace tools;
|
||||
@@ -72,7 +72,7 @@ G4bool G4RootRFileManager::OpenRFile(const G4String& fileName,
|
||||
|
||||
// create new file
|
||||
auto newFile = new tools::rroot::file(G4cout, name);
|
||||
newFile->add_unziper('Z',tools::decompress_buffer);
|
||||
newFile->add_unziper('Z',toolx::decompress_buffer);
|
||||
|
||||
if ( ! newFile->is_open() ) {
|
||||
Warn("Cannot open file " + name, fkClass, "OpenRFile");
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "G4ToolsAnalysisReader.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/raxml"
|
||||
#include "toolx/raxml"
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 26/08/2021 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "tools/raxml"
|
||||
#include "toolx/raxml"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename HT>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "G4VRFileManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/raxml"
|
||||
#include "toolx/raxml"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
@@ -56,7 +56,7 @@ class G4XmlRFileManager : public G4VRFileManager
|
||||
virtual G4bool OpenRFile(const G4String& fileName);
|
||||
|
||||
// Specific methods for files per objects
|
||||
tools::raxml* GetRFile(const G4String& fileName) const;
|
||||
toolx::raxml* GetRFile(const G4String& fileName) const;
|
||||
|
||||
// Helper method
|
||||
template <typename HT>
|
||||
@@ -70,7 +70,7 @@ class G4XmlRFileManager : public G4VRFileManager
|
||||
|
||||
// Data members
|
||||
tools::xml::default_factory* fReadFactory { nullptr };
|
||||
std::map<G4String, tools::raxml*> fRFiles;
|
||||
std::map<G4String, toolx::raxml*> fRFiles;
|
||||
};
|
||||
|
||||
#include "G4XmlRFileManager.icc"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "G4TRNtupleManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/raxml"
|
||||
#include "toolx/raxml"
|
||||
|
||||
#include <vector>
|
||||
#include <string_view>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "tools/raxml"
|
||||
#include "toolx/raxml"
|
||||
|
||||
using namespace G4Analysis;
|
||||
using namespace tools;
|
||||
@@ -79,7 +79,7 @@ G4bool G4XmlRFileManager::OpenRFile(const G4String& fileName)
|
||||
}
|
||||
|
||||
// create new file
|
||||
auto newFile = new tools::raxml(*fReadFactory, G4cout, verbose);
|
||||
auto newFile = new toolx::raxml(*fReadFactory, G4cout, verbose);
|
||||
|
||||
// clear objects
|
||||
// (this should not be needed when starting a new raxml)
|
||||
@@ -109,7 +109,7 @@ G4bool G4XmlRFileManager::OpenRFile(const G4String& fileName)
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::raxml* G4XmlRFileManager::GetRFile(const G4String& fileName) const
|
||||
toolx::raxml* G4XmlRFileManager::GetRFile(const G4String& fileName) const
|
||||
{
|
||||
// Get full file name (add only extension)
|
||||
G4bool isPerThread = false;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
# - G4digits_hits category build
|
||||
|
||||
# Add (private) allocation export symbol
|
||||
add_definitions(-DG4DIGI_ALLOC_EXPORT)
|
||||
|
||||
geant4_global_library_target(NAME G4digits_hits
|
||||
COMPONENTS
|
||||
detector/sources.cmake
|
||||
digits/sources.cmake
|
||||
hits/sources.cmake
|
||||
scorer/sources.cmake
|
||||
utils/sources.cmake)
|
||||
include(detector/sources.cmake)
|
||||
include(digits/sources.cmake)
|
||||
include(hits/sources.cmake)
|
||||
include(scorer/sources.cmake)
|
||||
include(utils/sources.cmake)
|
||||
|
||||
geant4_add_category(G4digits_hits MODULES G4detector G4digits G4hits G4detscorer G4detutils)
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category digits_hits History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
## 2022-01-28 Ben Morgan (digits_hits-V11-00-02)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
call to `geant4_add_category` to define library build from source modules.
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2021-12-15 Ben Morgan (digits_hits-V11-00-01)
|
||||
- Canonicalize implementations of custom `new` and `delete` operators that use `G4Allocator`
|
||||
- Remove un-needed/duplicated checks on static allocator creation in member functions
|
||||
|
||||
## 2021-12-10 Ben Morgan (digits_hits-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
October 25th, 2021 B.Morgan (digits_hits-V10-07-03)
|
||||
- Use G4StrUtil functions replacing deprecated G4String member functions
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category det History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2021-12-10 Ben Morgan (det-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
August 9th, 2021 I. Hrivnacova (det-V10-07-01)
|
||||
- Updated G4TScoreHistFiller for changes in the analysis category:
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category detdigits History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2021-12-10 Ben Morgan (detdigits-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
October 4, 03 G.Cosmo
|
||||
- Imported from digits+hits directory.
|
||||
|
||||
@@ -92,22 +92,16 @@ extern G4DLLIMPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
|
||||
|
||||
inline void* G4DCofThisEvent::operator new(size_t)
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
if(anDCoTHAllocator_G4MT_TLS_() == nullptr)
|
||||
{
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
|
||||
*anDCoTHAllocator_G4MT_TLS_();
|
||||
void* anDCoTH;
|
||||
anDCoTH = (void*) anDCoTHAllocator.MallocSingle();
|
||||
return anDCoTH;
|
||||
}
|
||||
return (void*) anDCoTHAllocator_G4MT_TLS_()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4DCofThisEvent::operator delete(void* anDCoTH)
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
|
||||
*anDCoTHAllocator_G4MT_TLS_();
|
||||
anDCoTHAllocator.FreeSingle((G4DCofThisEvent*) anDCoTH);
|
||||
anDCoTHAllocator_G4MT_TLS_()->FreeSingle((G4DCofThisEvent*) anDCoTH);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -87,22 +87,16 @@ class G4TDigiCollection : public G4DigiCollection
|
||||
public: // with description
|
||||
inline T* operator[](size_t i) const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (*((std::vector<T*>*) theCollection))[i];
|
||||
}
|
||||
// Returns a pointer to a concrete digi object.
|
||||
inline std::vector<T*>* GetVector() const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (std::vector<T*>*) theCollection;
|
||||
}
|
||||
// Returns a collection vector.
|
||||
inline size_t insert(T* aHit)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
theDigiCollection->push_back(aHit);
|
||||
return theDigiCollection->size();
|
||||
@@ -111,8 +105,6 @@ class G4TDigiCollection : public G4DigiCollection
|
||||
// collection is returned.
|
||||
inline size_t entries() const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
return theDigiCollection->size();
|
||||
}
|
||||
@@ -121,14 +113,10 @@ class G4TDigiCollection : public G4DigiCollection
|
||||
public:
|
||||
virtual G4VDigi* GetDigi(size_t i) const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (*((std::vector<T*>*) theCollection))[i];
|
||||
}
|
||||
virtual size_t GetSize() const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return ((std::vector<T*>*) theCollection)->size();
|
||||
}
|
||||
};
|
||||
@@ -136,31 +124,22 @@ class G4TDigiCollection : public G4DigiCollection
|
||||
template <class T>
|
||||
inline void* G4TDigiCollection<T>::operator new(size_t)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
if(aDCAllocator_G4MT_TLS_() == nullptr)
|
||||
{
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
G4Allocator<G4DigiCollection>& aDCAllocator = *aDCAllocator_G4MT_TLS_();
|
||||
void* aDC;
|
||||
aDC = (void*) aDCAllocator.MallocSingle();
|
||||
return aDC;
|
||||
}
|
||||
return (void*) aDCAllocator_G4MT_TLS_()->MallocSingle();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void G4TDigiCollection<T>::operator delete(void* aDC)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
G4Allocator<G4DigiCollection>& aDCAllocator = *aDCAllocator_G4MT_TLS_();
|
||||
;
|
||||
;
|
||||
;
|
||||
aDCAllocator.FreeSingle((G4DigiCollection*) aDC);
|
||||
aDCAllocator_G4MT_TLS_()->FreeSingle((G4DigiCollection*) aDC);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
G4TDigiCollection<T>::G4TDigiCollection()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = new std::vector<T*>;
|
||||
theCollection = (void*) theDigiCollection;
|
||||
}
|
||||
@@ -169,9 +148,6 @@ template <class T>
|
||||
G4TDigiCollection<T>::G4TDigiCollection(G4String detName, G4String colNam)
|
||||
: G4DigiCollection(detName, colNam)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
|
||||
std::vector<T*>* theDigiCollection = new std::vector<T*>;
|
||||
theCollection = (void*) theDigiCollection;
|
||||
}
|
||||
@@ -179,10 +155,8 @@ G4TDigiCollection<T>::G4TDigiCollection(G4String detName, G4String colNam)
|
||||
template <class T>
|
||||
G4TDigiCollection<T>::~G4TDigiCollection()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
// theDigiCollection->clearAndDestroy();
|
||||
|
||||
for(size_t i = 0; i < theDigiCollection->size(); i++)
|
||||
{
|
||||
delete(*theDigiCollection)[i];
|
||||
@@ -194,16 +168,12 @@ G4TDigiCollection<T>::~G4TDigiCollection()
|
||||
template <class T>
|
||||
G4bool G4TDigiCollection<T>::operator==(const G4TDigiCollection<T>& right) const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (collectionName == right.collectionName);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void G4TDigiCollection<T>::DrawAllDigi()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
size_t n = theDigiCollection->size();
|
||||
for(size_t i = 0; i < n; i++)
|
||||
@@ -215,8 +185,6 @@ void G4TDigiCollection<T>::DrawAllDigi()
|
||||
template <class T>
|
||||
void G4TDigiCollection<T>::PrintAllDigi()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
size_t n = theDigiCollection->size();
|
||||
for(size_t i = 0; i < n; i++)
|
||||
|
||||
@@ -37,15 +37,11 @@ G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_()
|
||||
|
||||
G4DCofThisEvent::G4DCofThisEvent()
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
DC = new std::vector<G4VDigiCollection*>;
|
||||
}
|
||||
|
||||
G4DCofThisEvent::G4DCofThisEvent(G4int cap)
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
DC = new std::vector<G4VDigiCollection*>;
|
||||
for(G4int i = 0; i < cap; i++)
|
||||
{
|
||||
@@ -55,9 +51,6 @@ G4DCofThisEvent::G4DCofThisEvent(G4int cap)
|
||||
|
||||
G4DCofThisEvent::~G4DCofThisEvent()
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
// DC->clearAndDestroy();
|
||||
for(size_t i = 0; i < DC->size(); i++)
|
||||
{
|
||||
delete(*DC)[i];
|
||||
@@ -68,8 +61,6 @@ G4DCofThisEvent::~G4DCofThisEvent()
|
||||
|
||||
void G4DCofThisEvent::AddDigiCollection(G4int DCID, G4VDigiCollection* aDC)
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
if(DCID >= 0 && DCID < G4int(DC->size()))
|
||||
{
|
||||
(*DC)[DCID] = aDC;
|
||||
@@ -78,8 +69,6 @@ void G4DCofThisEvent::AddDigiCollection(G4int DCID, G4VDigiCollection* aDC)
|
||||
|
||||
G4DCofThisEvent::G4DCofThisEvent(const G4DCofThisEvent& rhs)
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
DC = new std::vector<G4VDigiCollection*>(rhs.DC->size());
|
||||
for(unsigned int i = 0; i < rhs.DC->size(); ++i)
|
||||
*(DC->at(i)) = *(rhs.DC->at(i));
|
||||
@@ -89,8 +78,7 @@ G4DCofThisEvent& G4DCofThisEvent::operator=(const G4DCofThisEvent& rhs)
|
||||
{
|
||||
if(this == &rhs)
|
||||
return *this;
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
|
||||
for(std::vector<G4VDigiCollection*>::const_iterator it = DC->begin();
|
||||
it != DC->end(); ++it)
|
||||
{
|
||||
|
||||
@@ -36,31 +36,17 @@ G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_()
|
||||
|
||||
G4DigiCollection::G4DigiCollection()
|
||||
: theCollection((void*) 0)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
;
|
||||
}
|
||||
{}
|
||||
|
||||
G4DigiCollection::G4DigiCollection(G4String detName, G4String colNam)
|
||||
: G4VDigiCollection(detName, colNam)
|
||||
, theCollection((void*) 0)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
;
|
||||
}
|
||||
{}
|
||||
|
||||
G4DigiCollection::~G4DigiCollection()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
;
|
||||
}
|
||||
{}
|
||||
|
||||
G4bool G4DigiCollection::operator==(const G4DigiCollection& right) const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (collectionName == right.collectionName);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category dethits History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2021-12-10 Ben Morgan (dethits-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
October 4, 03 G.Cosmo
|
||||
- Imported from digits+hits directory.
|
||||
|
||||
@@ -93,34 +93,16 @@ extern G4DLLIMPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
|
||||
|
||||
inline void* G4HCofThisEvent::operator new(size_t)
|
||||
{
|
||||
;
|
||||
;
|
||||
;
|
||||
if(!anHCoTHAllocator_G4MT_TLS_())
|
||||
if(anHCoTHAllocator_G4MT_TLS_() == nullptr)
|
||||
{
|
||||
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
|
||||
G4Allocator<G4HCofThisEvent>& anHCoTHAllocator =
|
||||
*anHCoTHAllocator_G4MT_TLS_();
|
||||
;
|
||||
;
|
||||
;
|
||||
void* anHCoTH;
|
||||
anHCoTH = (void*) anHCoTHAllocator.MallocSingle();
|
||||
return anHCoTH;
|
||||
}
|
||||
return (void*) anHCoTHAllocator_G4MT_TLS_()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4HCofThisEvent::operator delete(void* anHCoTH)
|
||||
{
|
||||
;
|
||||
;
|
||||
;
|
||||
if(!anHCoTHAllocator_G4MT_TLS_())
|
||||
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
|
||||
G4Allocator<G4HCofThisEvent>& anHCoTHAllocator =
|
||||
*anHCoTHAllocator_G4MT_TLS_();
|
||||
;
|
||||
;
|
||||
;
|
||||
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*) anHCoTH);
|
||||
anHCoTHAllocator_G4MT_TLS_()->FreeSingle((G4HCofThisEvent*) anHCoTH);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -88,22 +88,16 @@ class G4THitsCollection : public G4HitsCollection
|
||||
public: // with description
|
||||
inline T* operator[](size_t i) const
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
return (*((std::vector<T*>*) theCollection))[i];
|
||||
}
|
||||
// Returns a pointer to a concrete hit object.
|
||||
inline std::vector<T*>* GetVector() const
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
return (std::vector<T*>*) theCollection;
|
||||
}
|
||||
// Returns a collection vector.
|
||||
inline size_t insert(T* aHit)
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
|
||||
theHitsCollection->push_back(aHit);
|
||||
return theHitsCollection->size();
|
||||
@@ -112,8 +106,6 @@ class G4THitsCollection : public G4HitsCollection
|
||||
// collection is returned.
|
||||
inline size_t entries() const
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
|
||||
return theHitsCollection->size();
|
||||
}
|
||||
@@ -122,14 +114,10 @@ class G4THitsCollection : public G4HitsCollection
|
||||
public:
|
||||
virtual G4VHit* GetHit(size_t i) const
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
return (*((std::vector<T*>*) theCollection))[i];
|
||||
}
|
||||
virtual size_t GetSize() const
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
return ((std::vector<T*>*) theCollection)->size();
|
||||
}
|
||||
};
|
||||
@@ -137,34 +125,22 @@ class G4THitsCollection : public G4HitsCollection
|
||||
template <class T>
|
||||
inline void* G4THitsCollection<T>::operator new(size_t)
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
if(anHCAllocator_G4MT_TLS_() == nullptr)
|
||||
{
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
G4Allocator<G4HitsCollection>& anHCAllocator = *anHCAllocator_G4MT_TLS_();
|
||||
;
|
||||
;
|
||||
;
|
||||
void* anHC;
|
||||
anHC = (void*) anHCAllocator.MallocSingle();
|
||||
return anHC;
|
||||
}
|
||||
return (void*) anHCAllocator_G4MT_TLS_()->MallocSingle();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void G4THitsCollection<T>::operator delete(void* anHC)
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
G4Allocator<G4HitsCollection>& anHCAllocator = *anHCAllocator_G4MT_TLS_();
|
||||
;
|
||||
;
|
||||
;
|
||||
anHCAllocator.FreeSingle((G4HitsCollection*) anHC);
|
||||
anHCAllocator_G4MT_TLS_()->FreeSingle((G4HitsCollection*) anHC);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
G4THitsCollection<T>::G4THitsCollection()
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*>* theHitsCollection = new std::vector<T*>;
|
||||
theCollection = (void*) theHitsCollection;
|
||||
}
|
||||
@@ -173,8 +149,6 @@ template <class T>
|
||||
G4THitsCollection<T>::G4THitsCollection(G4String detName, G4String colNam)
|
||||
: G4HitsCollection(detName, colNam)
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*>* theHitsCollection = new std::vector<T*>;
|
||||
theCollection = (void*) theHitsCollection;
|
||||
}
|
||||
@@ -182,8 +156,6 @@ G4THitsCollection<T>::G4THitsCollection(G4String detName, G4String colNam)
|
||||
template <class T>
|
||||
G4THitsCollection<T>::~G4THitsCollection()
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
|
||||
// theHitsCollection->clearAndDestroy();
|
||||
for(size_t i = 0; i < theHitsCollection->size(); ++i)
|
||||
@@ -197,16 +169,12 @@ G4THitsCollection<T>::~G4THitsCollection()
|
||||
template <class T>
|
||||
G4bool G4THitsCollection<T>::operator==(const G4THitsCollection<T>& right) const
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
return (collectionName == right.collectionName);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void G4THitsCollection<T>::DrawAllHits()
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
|
||||
size_t n = theHitsCollection->size();
|
||||
for(size_t i = 0; i < n; ++i)
|
||||
@@ -218,8 +186,6 @@ void G4THitsCollection<T>::DrawAllHits()
|
||||
template <class T>
|
||||
void G4THitsCollection<T>::PrintAllHits()
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
|
||||
size_t n = theHitsCollection->size();
|
||||
for(size_t i = 0; i < n; ++i)
|
||||
|
||||
@@ -36,15 +36,11 @@ G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_()
|
||||
|
||||
G4HCofThisEvent::G4HCofThisEvent()
|
||||
{
|
||||
if(!anHCoTHAllocator_G4MT_TLS_())
|
||||
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
|
||||
HC = new std::vector<G4VHitsCollection*>;
|
||||
}
|
||||
|
||||
G4HCofThisEvent::G4HCofThisEvent(G4int cap)
|
||||
{
|
||||
if(!anHCoTHAllocator_G4MT_TLS_())
|
||||
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
|
||||
HC = new std::vector<G4VHitsCollection*>;
|
||||
for(G4int i = 0; i < cap; i++)
|
||||
{
|
||||
@@ -54,9 +50,6 @@ G4HCofThisEvent::G4HCofThisEvent(G4int cap)
|
||||
|
||||
G4HCofThisEvent::~G4HCofThisEvent()
|
||||
{
|
||||
if(!anHCoTHAllocator_G4MT_TLS_())
|
||||
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
|
||||
// HC->clearAndDestroy();
|
||||
for(size_t i = 0; i < HC->size(); i++)
|
||||
{
|
||||
delete(*HC)[i];
|
||||
@@ -67,8 +60,6 @@ G4HCofThisEvent::~G4HCofThisEvent()
|
||||
|
||||
void G4HCofThisEvent::AddHitsCollection(G4int HCID, G4VHitsCollection* aHC)
|
||||
{
|
||||
if(!anHCoTHAllocator_G4MT_TLS_())
|
||||
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
|
||||
if(HCID >= 0 && HCID < G4int(HC->size()))
|
||||
{
|
||||
aHC->SetColID(HCID);
|
||||
@@ -78,8 +69,6 @@ void G4HCofThisEvent::AddHitsCollection(G4int HCID, G4VHitsCollection* aHC)
|
||||
|
||||
G4HCofThisEvent::G4HCofThisEvent(const G4HCofThisEvent& rhs)
|
||||
{
|
||||
if(!anHCoTHAllocator_G4MT_TLS_())
|
||||
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
|
||||
HC = new std::vector<G4VHitsCollection*>(rhs.HC->size());
|
||||
for(unsigned int i = 0; i < rhs.HC->size(); ++i)
|
||||
*(HC->at(i)) = *(rhs.HC->at(i));
|
||||
@@ -89,8 +78,7 @@ G4HCofThisEvent& G4HCofThisEvent::operator=(const G4HCofThisEvent& rhs)
|
||||
{
|
||||
if(this == &rhs)
|
||||
return *this;
|
||||
if(!anHCoTHAllocator_G4MT_TLS_())
|
||||
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
|
||||
|
||||
for(std::vector<G4VHitsCollection*>::const_iterator it = HC->begin();
|
||||
it != HC->end(); ++it)
|
||||
{
|
||||
|
||||
@@ -36,31 +36,17 @@ G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_()
|
||||
|
||||
G4HitsCollection::G4HitsCollection()
|
||||
: theCollection((void*) 0)
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
;
|
||||
}
|
||||
{}
|
||||
|
||||
G4HitsCollection::G4HitsCollection(G4String detName, G4String colNam)
|
||||
: G4VHitsCollection(detName, colNam)
|
||||
, theCollection((void*) 0)
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
;
|
||||
}
|
||||
{}
|
||||
|
||||
G4HitsCollection::~G4HitsCollection()
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
;
|
||||
}
|
||||
{}
|
||||
|
||||
G4bool G4HitsCollection::operator==(const G4HitsCollection& right) const
|
||||
{
|
||||
if(!anHCAllocator_G4MT_TLS_())
|
||||
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
return (collectionName == right.collectionName);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category detscorer History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2021-12-10 Ben Morgan (detscorer-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
September 27th, 2021 M. Asai (detscorer-V10-07-01)
|
||||
- Fix indexing of cylindrical scoring mesh commands.
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
# Category detutil History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
October 17th, 2022 M. Asai (detutil-V10-07-07)
|
||||
## 2022-05-17 Makoto Asai (detutil-V11-00-01)
|
||||
- G4VScoringMesh.hh : Fixing virtual keyword.
|
||||
|
||||
## 2021-12-10 Ben Morgan (detutil-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
October 7th, 2021 I. Hrivnacova (detutil-V10-07-06)
|
||||
- Updated G4TScoreNtupleWriter for changes in the analysis category:
|
||||
added fDefaultFileType (with default value "root") and its setter
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# - G4error_propagation category build
|
||||
|
||||
geant4_global_library_target(COMPONENTS sources.cmake)
|
||||
include(sources.cmake)
|
||||
geant4_add_category(G4error_propagation MODULES G4error_propagation)
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category error-propagation History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
## 2022-01-28 Ben Morgan (error-propagation-V11-00-01)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
call to `geant4_add_category` to define library build from source modules.
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2021-12-10 Ben Morgan (error-propagation-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
21-April-2020 - J. Madsen (error-propagation-V10-07-01)
|
||||
- make G4error_propagation-format
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# - G4event category build
|
||||
|
||||
# Add (private) allocation export symbol
|
||||
add_definitions(-DG4EVENT_ALLOC_EXPORT)
|
||||
|
||||
geant4_global_library_target(COMPONENTS sources.cmake)
|
||||
include(sources.cmake)
|
||||
geant4_add_category(G4event MODULES G4event)
|
||||
|
||||
@@ -26,6 +26,7 @@ CPPFLAGS += \
|
||||
-I$(G4BASE)/tracking/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/utils/include \
|
||||
-I$(G4BASE)/processes/parameterisation/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/particles/leptons/include \
|
||||
-I$(G4BASE)/particles/leptons/include \
|
||||
@@ -35,6 +36,7 @@ CPPFLAGS += \
|
||||
-I$(G4BASE)/particles/hadrons/mesons/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/magneticfield/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/navigation/include \
|
||||
-I$(G4BASE)/geometry/biasing/include \
|
||||
|
||||
+32
-14
@@ -1,20 +1,38 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category event History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2022-04-04 Ben Morgan (event-V11-00-05)
|
||||
- Apply basic set of C++ modernization fixes suggested by clang-tidy
|
||||
|
||||
## 2022-01-28 Ben Morgan (event-V11-00-04)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
call to `geant4_add_category` to define library build from source modules.
|
||||
- Make DLL export symbol a CMake module-level compile definition to aid
|
||||
future modularization
|
||||
|
||||
## 2022-01-26 Gabriele Cosmo (event-V11-00-03)
|
||||
- Added dependency on geometry/magneticfield module in GNUmakefile and
|
||||
sources.cmake, required for granular builds after modification applied
|
||||
in previous tag/commit.
|
||||
|
||||
## 2022-01-24 Witek Pokorski (event-V11-00-02)
|
||||
- Adding the call to the G4GlobalFastSimulationManager::Flush() method in the
|
||||
event loop
|
||||
|
||||
## 2021-12-15 Ben Morgan (event-V11-00-01)
|
||||
- Canonicalize implementations of custom `new` and `delete` operators that use `G4Allocator`
|
||||
|
||||
## 2021-12-10 Ben Morgan (event-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
October 31st, 2021 J. Hahnfeld (event-V10-07-08)
|
||||
- G4EventManager: Make StackTracks public
|
||||
|
||||
@@ -93,9 +93,8 @@ class G4AdjointPosOnPhysVolGenerator
|
||||
//---------
|
||||
private: // private methods
|
||||
//---------
|
||||
|
||||
G4AdjointPosOnPhysVolGenerator();
|
||||
~G4AdjointPosOnPhysVolGenerator();
|
||||
G4AdjointPosOnPhysVolGenerator() = default;
|
||||
~G4AdjointPosOnPhysVolGenerator() = default;
|
||||
G4double ComputeAreaOfExtSurfaceStartingFromSphere(G4VSolid* aSolid,
|
||||
G4int NStat);
|
||||
G4double ComputeAreaOfExtSurfaceStartingFromBox(G4VSolid* aSolid,
|
||||
@@ -119,11 +118,11 @@ class G4AdjointPosOnPhysVolGenerator
|
||||
G4VSolid* theSolid = nullptr;
|
||||
G4VPhysicalVolume* thePhysicalVolume = nullptr;
|
||||
|
||||
G4bool UseSphere;
|
||||
G4String ModelOfSurfaceSource;
|
||||
G4bool UseSphere{true};
|
||||
G4String ModelOfSurfaceSource{"OnSolid"};
|
||||
G4AffineTransform theTransformationFromPhysVolToWorld;
|
||||
G4double AreaOfExtSurfaceOfThePhysicalVolume;
|
||||
G4double CosThDirComparedToNormal;
|
||||
G4double AreaOfExtSurfaceOfThePhysicalVolume{0.};
|
||||
G4double CosThDirComparedToNormal{0.};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -54,12 +54,12 @@ class G4AdjointStackingAction : public G4UserStackingAction
|
||||
{
|
||||
public:
|
||||
|
||||
G4AdjointStackingAction(G4AdjointTrackingAction* anAction);
|
||||
virtual ~G4AdjointStackingAction();
|
||||
explicit G4AdjointStackingAction(G4AdjointTrackingAction* anAction);
|
||||
~G4AdjointStackingAction() override = default;
|
||||
|
||||
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
|
||||
virtual void NewStage();
|
||||
virtual void PrepareNewEvent();
|
||||
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) override;
|
||||
void NewStage() override;
|
||||
void PrepareNewEvent() override;
|
||||
inline void SetUserFwdStackingAction(G4UserStackingAction* anAction)
|
||||
{ theFwdStackingAction = anAction; }
|
||||
inline void SetUserAdjointStackingAction(G4UserStackingAction* anAction)
|
||||
@@ -73,9 +73,10 @@ class G4AdjointStackingAction : public G4UserStackingAction
|
||||
|
||||
G4UserStackingAction* theFwdStackingAction = nullptr;
|
||||
G4UserStackingAction* theUserAdjointStackingAction = nullptr;
|
||||
G4bool reclassification_stage = false,
|
||||
first_reclassification_stage = false,
|
||||
kill_tracks = false, adjoint_mode = false;
|
||||
G4bool reclassification_stage = false;
|
||||
G4bool first_reclassification_stage = false;
|
||||
G4bool kill_tracks = false;
|
||||
G4bool adjoint_mode = false;
|
||||
G4AdjointTrackingAction* theAdjointTrackingAction = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ class G4EvManMessenger : public G4UImessenger
|
||||
{
|
||||
public:
|
||||
|
||||
G4EvManMessenger(G4EventManager* fEvMan);
|
||||
~G4EvManMessenger();
|
||||
void SetNewValue(G4UIcommand* command, G4String newValues);
|
||||
G4String GetCurrentValue(G4UIcommand* command);
|
||||
explicit G4EvManMessenger(G4EventManager* fEvMan);
|
||||
~G4EvManMessenger() override;
|
||||
void SetNewValue(G4UIcommand* command, G4String newValues) override;
|
||||
G4String GetCurrentValue(G4UIcommand* command) override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ class G4Event
|
||||
using ProfilerConfig = G4ProfilerConfig<G4ProfileType::Event>;
|
||||
|
||||
public:
|
||||
G4Event();
|
||||
G4Event(G4int evID);
|
||||
G4Event() = default;
|
||||
explicit G4Event(G4int evID);
|
||||
~G4Event();
|
||||
|
||||
G4Event(const G4Event &) = delete;
|
||||
@@ -138,18 +138,18 @@ class G4Event
|
||||
{
|
||||
if( i == 0 )
|
||||
{ return thePrimaryVertex; }
|
||||
else if( i > 0 && i < numberOfPrimaryVertex )
|
||||
if( i > 0 && i < numberOfPrimaryVertex )
|
||||
{
|
||||
G4PrimaryVertex* primaryVertex = thePrimaryVertex;
|
||||
for( G4int j=0; j<i; ++j )
|
||||
{
|
||||
if( !primaryVertex ) return nullptr;
|
||||
if( primaryVertex == nullptr ) return nullptr;
|
||||
primaryVertex = primaryVertex->GetNext();
|
||||
}
|
||||
return primaryVertex;
|
||||
}
|
||||
else
|
||||
{ return nullptr; }
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
// Returns i-th primary vertex of the event.
|
||||
|
||||
@@ -234,7 +234,10 @@ extern G4EVENT_DLL G4Allocator<G4Event>*& anEventAllocator();
|
||||
|
||||
inline void* G4Event::operator new(std::size_t)
|
||||
{
|
||||
if (!anEventAllocator()) anEventAllocator() = new G4Allocator<G4Event>;
|
||||
if (anEventAllocator() == nullptr)
|
||||
{
|
||||
anEventAllocator() = new G4Allocator<G4Event>;
|
||||
}
|
||||
return (void*)anEventAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,10 +63,10 @@ class G4GeneralParticleSource : public G4VPrimaryGenerator
|
||||
// Initialize variables and instantiates the messenger and
|
||||
// generator classes
|
||||
|
||||
~G4GeneralParticleSource();
|
||||
~G4GeneralParticleSource() override;
|
||||
// Delete messenger and others
|
||||
|
||||
void GeneratePrimaryVertex(G4Event*);
|
||||
void GeneratePrimaryVertex(G4Event*) override;
|
||||
|
||||
inline G4int GetNumberofSource() { return GPSData->GetSourceVectorSize(); }
|
||||
// Return the number of particle gun defined
|
||||
|
||||
@@ -78,13 +78,13 @@ class G4GeneralParticleSourceMessenger: public G4UImessenger
|
||||
void SetParticleGun(G4SingleParticleSource *fpg) { fParticleGun = fpg; } ;
|
||||
// Select the particle gun to be defined/modified
|
||||
|
||||
void SetNewValue(G4UIcommand* command, G4String newValues);
|
||||
void SetNewValue(G4UIcommand* command, G4String newValues) override;
|
||||
// Identifies the command which has been invoked by the user, extracts the
|
||||
// parameters associated with that command (held in newValues), and uses
|
||||
// these values with the appropriate member function of
|
||||
// G4GeneralParticleSource
|
||||
|
||||
G4String GetCurrentValue(G4UIcommand* command);
|
||||
G4String GetCurrentValue(G4UIcommand* command) override;
|
||||
// Allows the user to retrieve the current values of parameters.
|
||||
// NOT yet implemented!
|
||||
|
||||
@@ -93,9 +93,9 @@ class G4GeneralParticleSourceMessenger: public G4UImessenger
|
||||
|
||||
private:
|
||||
|
||||
G4GeneralParticleSourceMessenger(G4GeneralParticleSource*);
|
||||
explicit G4GeneralParticleSourceMessenger(G4GeneralParticleSource*);
|
||||
// Constructor: sets up commands
|
||||
~G4GeneralParticleSourceMessenger();
|
||||
~G4GeneralParticleSourceMessenger() override;
|
||||
// Destructor: deletes commands
|
||||
|
||||
void IonCommand(G4String newValues);
|
||||
|
||||
@@ -79,13 +79,13 @@ class G4HEPEvtInterface : public G4VPrimaryGenerator
|
||||
{
|
||||
public:
|
||||
|
||||
G4HEPEvtInterface(const char* evfile, G4int vl=0);
|
||||
explicit G4HEPEvtInterface(const char* evfile, G4int vl=0);
|
||||
// Constructor, "evfile" is the file name (with directory path).
|
||||
|
||||
~G4HEPEvtInterface();
|
||||
~G4HEPEvtInterface() override = default;
|
||||
// Destructor
|
||||
|
||||
void GeneratePrimaryVertex(G4Event* evt);
|
||||
void GeneratePrimaryVertex(G4Event* evt) override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ class G4HEPEvtParticle
|
||||
{
|
||||
public:
|
||||
|
||||
G4HEPEvtParticle();
|
||||
G4HEPEvtParticle() = default;
|
||||
G4HEPEvtParticle(G4PrimaryParticle* pp,
|
||||
G4int isthep, G4int jdahep1, G4int jdahep2);
|
||||
~G4HEPEvtParticle();
|
||||
~G4HEPEvtParticle() = default;
|
||||
|
||||
G4HEPEvtParticle & operator=(const G4HEPEvtParticle& right);
|
||||
G4bool operator==(const G4HEPEvtParticle &right) const;
|
||||
@@ -64,7 +64,7 @@ class G4HEPEvtParticle
|
||||
|
||||
private:
|
||||
|
||||
G4PrimaryParticle* theParticle = nullptr;
|
||||
G4PrimaryParticle* theParticle = nullptr; // not owned
|
||||
G4int ISTHEP = 1; // Status code of the entry
|
||||
// Set to be 0 after generating links of
|
||||
// G4PrimaryParticle object
|
||||
@@ -76,8 +76,10 @@ extern G4EVENT_DLL G4Allocator<G4HEPEvtParticle>*& aHEPEvtParticleAllocator();
|
||||
|
||||
inline void * G4HEPEvtParticle::operator new(std::size_t)
|
||||
{
|
||||
if (!aHEPEvtParticleAllocator())
|
||||
if (aHEPEvtParticleAllocator() == nullptr)
|
||||
{
|
||||
aHEPEvtParticleAllocator() = new G4Allocator<G4HEPEvtParticle>;
|
||||
}
|
||||
return (void *) aHEPEvtParticleAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,10 +59,10 @@ class G4MultiEventAction : public G4UserEventAction
|
||||
public:
|
||||
|
||||
G4MultiEventAction() = default;
|
||||
virtual ~G4MultiEventAction() override = default;
|
||||
virtual void SetEventManager(G4EventManager* ) override;
|
||||
virtual void BeginOfEventAction(const G4Event* ) override;
|
||||
virtual void EndOfEventAction(const G4Event* ) override;
|
||||
~G4MultiEventAction() override = default;
|
||||
void SetEventManager(G4EventManager* ) override;
|
||||
void BeginOfEventAction(const G4Event* ) override;
|
||||
void EndOfEventAction(const G4Event* ) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -66,21 +66,21 @@ class G4ParticleGun : public G4VPrimaryGenerator
|
||||
public:
|
||||
|
||||
G4ParticleGun();
|
||||
G4ParticleGun(G4int numberofparticles);
|
||||
G4ParticleGun(G4ParticleDefinition* particleDef,
|
||||
explicit G4ParticleGun(G4int numberofparticles);
|
||||
explicit G4ParticleGun(G4ParticleDefinition* particleDef,
|
||||
G4int numberofparticles = 1);
|
||||
// Costructors. "numberofparticles" is the number of particles to be
|
||||
// shot at one invokation of GeneratePrimaryVertex() method.
|
||||
// All particles are shot with the same physical quantities.
|
||||
|
||||
virtual ~G4ParticleGun();
|
||||
~G4ParticleGun() override;
|
||||
|
||||
G4ParticleGun(const G4ParticleGun&) = delete;
|
||||
const G4ParticleGun& operator=(const G4ParticleGun&) = delete;
|
||||
G4bool operator==(const G4ParticleGun&) const = delete;
|
||||
G4bool operator!=(const G4ParticleGun&) const = delete;
|
||||
|
||||
virtual void GeneratePrimaryVertex(G4Event* evt);
|
||||
void GeneratePrimaryVertex(G4Event* evt) override;
|
||||
// Creates a primary vertex at the given point
|
||||
// and put primary particles to it.
|
||||
|
||||
|
||||
@@ -53,11 +53,11 @@ class G4ParticleGunMessenger : public G4UImessenger
|
||||
{
|
||||
public:
|
||||
|
||||
G4ParticleGunMessenger(G4ParticleGun* fPtclGun);
|
||||
~G4ParticleGunMessenger();
|
||||
explicit G4ParticleGunMessenger(G4ParticleGun* fPtclGun);
|
||||
~G4ParticleGunMessenger() override;
|
||||
|
||||
void SetNewValue(G4UIcommand* command, G4String newValues);
|
||||
G4String GetCurrentValue(G4UIcommand* command);
|
||||
void SetNewValue(G4UIcommand* command, G4String newValues) override;
|
||||
G4String GetCurrentValue(G4UIcommand* command) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -66,7 +66,7 @@ class G4ParticleGunMessenger : public G4UImessenger
|
||||
|
||||
private:
|
||||
|
||||
G4ParticleGun* fParticleGun = nullptr;
|
||||
G4ParticleGun* fParticleGun = nullptr; // Not owned, cannot be null post construction
|
||||
G4ParticleTable* particleTable = nullptr;
|
||||
|
||||
// Commands
|
||||
|
||||
@@ -49,7 +49,7 @@ class G4PrimaryTransformer
|
||||
public:
|
||||
|
||||
G4PrimaryTransformer();
|
||||
virtual ~G4PrimaryTransformer();
|
||||
virtual ~G4PrimaryTransformer() = default;
|
||||
|
||||
G4TrackVector* GimmePrimaries(G4Event* anEvent, G4int trackIDCounter=0);
|
||||
void CheckUnknown();
|
||||
|
||||
@@ -48,8 +48,8 @@ class G4RayShooter
|
||||
{
|
||||
public:
|
||||
|
||||
G4RayShooter();
|
||||
virtual ~G4RayShooter();
|
||||
G4RayShooter() = default;
|
||||
virtual ~G4RayShooter() = default;
|
||||
|
||||
void Shoot(G4Event* evt, G4ThreeVector vtx, G4ThreeVector direc);
|
||||
// Generates a primary vertex and a primary particle at the given
|
||||
@@ -57,12 +57,9 @@ class G4RayShooter
|
||||
// by G4RayTracer and G4MaterialScanner.
|
||||
|
||||
private:
|
||||
|
||||
void SetInitialValues();
|
||||
|
||||
G4ParticleDefinition* particle_definition = nullptr;
|
||||
G4ParticleMomentum particle_momentum_direction;
|
||||
G4double particle_energy = 0.0;
|
||||
G4double particle_energy = 1.0*CLHEP::GeV;
|
||||
G4ThreeVector particle_position;
|
||||
G4double particle_time = 0.0;
|
||||
G4ThreeVector particle_polarization;
|
||||
|
||||
@@ -181,7 +181,7 @@ class G4SPSAngDistribution
|
||||
G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist
|
||||
G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi
|
||||
G4double DR,DX,DY ; // Standard deviations for beam divergence
|
||||
G4double Theta, Phi; // Store these for use with DEBUG
|
||||
G4double Theta{0.}, Phi{0.}; // Store these for use with DEBUG
|
||||
G4ThreeVector FocusPoint ; // the focusing point in mother coordinates
|
||||
G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist
|
||||
G4PhysicsFreeVector UDefThetaH; // Theta histo data
|
||||
|
||||
@@ -75,10 +75,10 @@ class G4SingleParticleSource : public G4VPrimaryGenerator
|
||||
// Constructor: initializes variables and instantiates the
|
||||
// messenger and navigator classes
|
||||
|
||||
~G4SingleParticleSource();
|
||||
~G4SingleParticleSource() override;
|
||||
// Destructor: deletes messenger and prints out run information
|
||||
|
||||
void GeneratePrimaryVertex(G4Event *evt);
|
||||
void GeneratePrimaryVertex(G4Event *evt) override;
|
||||
// Generate the particles initial parameters
|
||||
|
||||
inline G4SPSPosDistribution* GetPosDist() const { return posGenerator; }
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#ifndef G4SmartTrackStack_hh
|
||||
#define G4SmartTrackStack_hh 1
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "G4StackedTrack.hh"
|
||||
#include "G4TrackStack.hh"
|
||||
#include "globals.hh"
|
||||
@@ -62,29 +64,17 @@ class G4SmartTrackStack
|
||||
inline G4int GetMaxNTrack() const { return maxNTracks; }
|
||||
|
||||
private:
|
||||
|
||||
inline G4int n_stackedTrack() const
|
||||
{
|
||||
return G4int(stacks[0]->GetNTrack() +
|
||||
stacks[1]->GetNTrack() +
|
||||
stacks[2]->GetNTrack() +
|
||||
stacks[3]->GetNTrack() +
|
||||
stacks[4]->GetNTrack());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
G4int fTurn;
|
||||
G4int nTurn; // should be 5
|
||||
G4double energies[5];
|
||||
G4TrackStack* stacks[5];
|
||||
G4int fTurn = 0;
|
||||
static constexpr G4int nTurn{5};
|
||||
std::array<G4double,nTurn> energies;
|
||||
std::array<G4TrackStack*,nTurn> stacks;
|
||||
// = 0 : all primaries and secondaries except followings
|
||||
// = 1 : secondary neutrons
|
||||
// = 2 : secondary electrons
|
||||
// = 3 : secondary gammas
|
||||
// = 4 : secondary positrons
|
||||
G4int maxNTracks;
|
||||
G4int nTracks;
|
||||
G4int maxNTracks{0};
|
||||
G4int nTracks{0};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,17 +44,14 @@ class G4StackChecker : public G4UserStackingAction
|
||||
{
|
||||
public:
|
||||
|
||||
G4StackChecker();
|
||||
virtual ~G4StackChecker();
|
||||
G4StackChecker() = default;
|
||||
~G4StackChecker() override = default;
|
||||
|
||||
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* track);
|
||||
|
||||
virtual void NewStage();
|
||||
virtual void PrepareNewEvent();
|
||||
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* track) override;
|
||||
|
||||
private:
|
||||
|
||||
G4ThreeVector nullDirection;
|
||||
G4ThreeVector nullDirection{0.0,0.0,0.0};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,10 +40,10 @@ class G4StackedTrack
|
||||
{
|
||||
public:
|
||||
|
||||
G4StackedTrack() : track(nullptr), trajectory(nullptr) {}
|
||||
G4StackedTrack() = default;
|
||||
G4StackedTrack(G4Track* aTrack, G4VTrajectory* aTraj = nullptr)
|
||||
: track(aTrack), trajectory(aTraj) {}
|
||||
~G4StackedTrack() {}
|
||||
~G4StackedTrack() = default;
|
||||
|
||||
inline G4Track* GetTrack() const { return track; }
|
||||
inline G4VTrajectory* GetTrajectory() const { return trajectory; }
|
||||
|
||||
@@ -51,12 +51,12 @@ class G4StackingMessenger : public G4UImessenger
|
||||
public:
|
||||
|
||||
G4StackingMessenger(G4StackManager* fCont);
|
||||
~G4StackingMessenger();
|
||||
void SetNewValue(G4UIcommand* command, G4String newValues);
|
||||
~G4StackingMessenger() override;
|
||||
void SetNewValue(G4UIcommand* command, G4String newValues) override;
|
||||
|
||||
private:
|
||||
|
||||
G4StackManager* fContainer = nullptr;
|
||||
G4StackManager* fContainer = nullptr; // Cannot be null after construction
|
||||
G4UIdirectory* stackDir;
|
||||
G4UIcmdWithoutParameter* statusCmd;
|
||||
G4UIcmdWithAnInteger* clearCmd;
|
||||
|
||||
@@ -45,9 +45,8 @@ class G4TrackStack : public std::vector<G4StackedTrack>
|
||||
{
|
||||
public:
|
||||
|
||||
G4TrackStack()
|
||||
: safetyValue1(0), safetyValue2(0), nstick(0) {}
|
||||
G4TrackStack(std::size_t n)
|
||||
G4TrackStack() = default;
|
||||
explicit G4TrackStack(std::size_t n)
|
||||
: safetyValue1(G4int(4*n/5)),
|
||||
safetyValue2(G4int(4*n/5-100)), nstick(100) { reserve(n); }
|
||||
~G4TrackStack();
|
||||
@@ -71,14 +70,14 @@ class G4TrackStack : public std::vector<G4StackedTrack>
|
||||
inline G4int GetSafetyValue2() const { return safetyValue2; }
|
||||
inline G4int GetNStick() const { return nstick; }
|
||||
|
||||
G4double getTotalEnergy(void) const;
|
||||
G4double getTotalEnergy() const;
|
||||
inline void SetSafetyValue2(G4int x) { safetyValue2 = x < 0 ? 0 : x; }
|
||||
|
||||
private:
|
||||
|
||||
G4int safetyValue1;
|
||||
G4int safetyValue2;
|
||||
G4int nstick;
|
||||
G4int safetyValue1{0};
|
||||
G4int safetyValue2{0};
|
||||
G4int nstick{0};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4Allocator.hh"
|
||||
|
||||
typedef std::vector<G4VTrajectory*> TrajectoryVector;
|
||||
using TrajectoryVector = std::vector<G4VTrajectory*>;
|
||||
|
||||
class G4TrajectoryContainer
|
||||
{
|
||||
@@ -82,8 +82,10 @@ G4Allocator<G4TrajectoryContainer>*& aTrajectoryContainerAllocator();
|
||||
|
||||
inline void* G4TrajectoryContainer::operator new(std::size_t)
|
||||
{
|
||||
if (!aTrajectoryContainerAllocator())
|
||||
if (aTrajectoryContainerAllocator() == nullptr)
|
||||
{
|
||||
aTrajectoryContainerAllocator() = new G4Allocator<G4TrajectoryContainer>;
|
||||
}
|
||||
return (void*)aTrajectoryContainerAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class G4UserEventAction
|
||||
public:
|
||||
|
||||
G4UserEventAction();
|
||||
virtual ~G4UserEventAction();
|
||||
virtual ~G4UserEventAction() = default;
|
||||
virtual void SetEventManager(G4EventManager* value);
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event* anEvent);
|
||||
@@ -59,7 +59,7 @@ class G4UserEventAction
|
||||
|
||||
protected:
|
||||
|
||||
G4EventManager* fpEventManager = nullptr;
|
||||
G4EventManager* fpEventManager = nullptr; // not owned
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -46,7 +46,7 @@ class G4UserStackingAction
|
||||
public:
|
||||
|
||||
G4UserStackingAction();
|
||||
virtual ~G4UserStackingAction();
|
||||
virtual ~G4UserStackingAction() = default;
|
||||
|
||||
inline void SetStackManager(G4StackManager* value) { stackManager=value; }
|
||||
|
||||
@@ -112,7 +112,7 @@ class G4UserStackingAction
|
||||
|
||||
protected:
|
||||
|
||||
G4StackManager* stackManager = nullptr;
|
||||
G4StackManager* stackManager = nullptr; // Not owned
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,8 +45,8 @@ class G4VPrimaryGenerator
|
||||
{
|
||||
public:
|
||||
|
||||
G4VPrimaryGenerator();
|
||||
virtual ~G4VPrimaryGenerator();
|
||||
G4VPrimaryGenerator() = default;
|
||||
virtual ~G4VPrimaryGenerator() = default;
|
||||
// Constructor and destructor
|
||||
|
||||
static G4bool CheckVertexInsideWorld(const G4ThreeVector& pos);
|
||||
|
||||
@@ -52,8 +52,8 @@ class G4VUserEventInformation
|
||||
{
|
||||
public:
|
||||
|
||||
G4VUserEventInformation() {;}
|
||||
virtual ~G4VUserEventInformation() {;}
|
||||
G4VUserEventInformation() = default;
|
||||
virtual ~G4VUserEventInformation() = default;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -69,6 +69,8 @@ geant4_add_module(G4event
|
||||
G4UserStackingAction.cc
|
||||
G4VPrimaryGenerator.cc)
|
||||
|
||||
geant4_module_compile_definitions(G4event PRIVATE G4EVENT_ALLOC_EXPORT)
|
||||
|
||||
# Enable smart stack
|
||||
if(GEANT4_USE_SMARTSTACK)
|
||||
geant4_module_compile_definitions(G4event PUBLIC G4_USESMARTSTACK)
|
||||
@@ -93,4 +95,6 @@ geant4_module_link_libraries(G4event
|
||||
G4detector
|
||||
G4graphics_reps
|
||||
G4materials
|
||||
G4heprandom)
|
||||
G4heprandom
|
||||
G4magneticfield
|
||||
G4parameterisation)
|
||||
|
||||
@@ -53,20 +53,6 @@ G4AdjointPosOnPhysVolGenerator* G4AdjointPosOnPhysVolGenerator::GetInstance()
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
G4AdjointPosOnPhysVolGenerator::~G4AdjointPosOnPhysVolGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointPosOnPhysVolGenerator::G4AdjointPosOnPhysVolGenerator()
|
||||
: UseSphere(true), ModelOfSurfaceSource("OnSolid"),
|
||||
AreaOfExtSurfaceOfThePhysicalVolume(0.), CosThDirComparedToNormal(0.)
|
||||
{
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
G4VPhysicalVolume*
|
||||
@@ -78,7 +64,7 @@ G4AdjointPosOnPhysVolGenerator::DefinePhysicalVolume(const G4String& aName)
|
||||
for ( unsigned int i=0; i< thePhysVolStore->size(); ++i )
|
||||
{
|
||||
G4String vol_name =(*thePhysVolStore)[i]->GetName();
|
||||
if (vol_name == "")
|
||||
if (vol_name.empty())
|
||||
{
|
||||
vol_name = (*thePhysVolStore)[i]->GetLogicalVolume()->GetName();
|
||||
}
|
||||
@@ -152,20 +138,17 @@ G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSolid,
|
||||
{
|
||||
return ComputeAreaOfExtSurfaceStartingFromSphere(aSolid,NStats);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ComputeAreaOfExtSurfaceStartingFromBox(aSolid,NStats);
|
||||
}
|
||||
|
||||
return ComputeAreaOfExtSurfaceStartingFromBox(aSolid,NStats);
|
||||
}
|
||||
else
|
||||
|
||||
G4ThreeVector p, dir;
|
||||
if (ModelOfSurfaceSource == "ExternalSphere")
|
||||
{
|
||||
G4ThreeVector p, dir;
|
||||
if (ModelOfSurfaceSource == "ExternalSphere")
|
||||
{
|
||||
return GenerateAPositionOnASphereBoundary(aSolid, p,dir);
|
||||
}
|
||||
return GenerateAPositionOnABoxBoundary(aSolid, p,dir);
|
||||
return GenerateAPositionOnASphereBoundary(aSolid, p,dir);
|
||||
}
|
||||
|
||||
return GenerateAPositionOnABoxBoundary(aSolid, p,dir);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -174,7 +174,7 @@ ComputeAccumulatedDepthVectorAlongBackRay(G4ThreeVector glob_pos,
|
||||
fLinearNavigator->LocateGlobalPointAndSetup(position);
|
||||
G4double newStep = fLinearNavigator->ComputeStep(position,direction,1.e50,
|
||||
safety);
|
||||
if (theAccumulatedDepthVector != nullptr) {delete theAccumulatedDepthVector;}
|
||||
delete theAccumulatedDepthVector;
|
||||
theAccumulatedDepthVector = new G4PhysicsFreeVector();
|
||||
|
||||
G4double acc_depth=0.;
|
||||
|
||||
@@ -43,11 +43,6 @@ G4AdjointStackingAction(G4AdjointTrackingAction* anAction)
|
||||
theAdjointTrackingAction = anAction;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
G4AdjointStackingAction::~G4AdjointStackingAction()
|
||||
{;}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
G4ClassificationOfNewTrack
|
||||
@@ -66,7 +61,7 @@ G4AdjointStackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
{
|
||||
if (theAdjointTrackingAction->GetNbOfAdointTracksReachingTheExternalSurface()>0)
|
||||
{
|
||||
if (theFwdStackingAction)
|
||||
if (theFwdStackingAction != nullptr)
|
||||
{
|
||||
classification = theFwdStackingAction->ClassifyNewTrack(aTrack);
|
||||
}
|
||||
@@ -77,7 +72,7 @@ G4AdjointStackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (theUserAdjointStackingAction)
|
||||
else if (theUserAdjointStackingAction != nullptr)
|
||||
{
|
||||
classification = theUserAdjointStackingAction->ClassifyNewTrack(aTrack);
|
||||
}
|
||||
@@ -91,13 +86,13 @@ void G4AdjointStackingAction::NewStage()
|
||||
reclassification_stage = true;
|
||||
if (first_reclassification_stage)
|
||||
{
|
||||
if (theUserAdjointStackingAction)
|
||||
if (theUserAdjointStackingAction != nullptr)
|
||||
{
|
||||
theUserAdjointStackingAction->NewStage();
|
||||
}
|
||||
stackManager->ReClassify();
|
||||
}
|
||||
else if (theFwdStackingAction) theFwdStackingAction->NewStage();
|
||||
else if (theFwdStackingAction != nullptr) theFwdStackingAction->NewStage();
|
||||
{
|
||||
first_reclassification_stage = false;
|
||||
}
|
||||
@@ -109,7 +104,7 @@ void G4AdjointStackingAction::PrepareNewEvent()
|
||||
{
|
||||
reclassification_stage = false;
|
||||
first_reclassification_stage = true;
|
||||
if (theUserAdjointStackingAction)
|
||||
if (theUserAdjointStackingAction != nullptr)
|
||||
{
|
||||
theUserAdjointStackingAction->PrepareNewEvent();
|
||||
}
|
||||
|
||||
@@ -40,10 +40,6 @@ G4Allocator<G4Event>*& anEventAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4Event::G4Event()
|
||||
{
|
||||
}
|
||||
|
||||
G4Event::G4Event(G4int evID)
|
||||
: eventID(evID)
|
||||
{
|
||||
@@ -92,7 +88,7 @@ void G4Event::Draw() const
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager == nullptr) return;
|
||||
|
||||
if(trajectoryContainer)
|
||||
if(trajectoryContainer != nullptr)
|
||||
{
|
||||
G4int n_traj = trajectoryContainer->entries();
|
||||
for(G4int i=0; i<n_traj; ++i)
|
||||
@@ -115,7 +111,7 @@ void G4Event::Draw() const
|
||||
for(G4int j=0; j<n_DC; ++j)
|
||||
{
|
||||
G4VDigiCollection* VDC = DC->GetDC(j);
|
||||
if(VDC) VDC->DrawAllDigi();
|
||||
if(VDC != nullptr) VDC->DrawAllDigi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "Randomize.hh"
|
||||
#include "G4Profiler.hh"
|
||||
#include "G4TiMemory.hh"
|
||||
#include "G4GlobalFastSimulationManager.hh"
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
@@ -108,7 +109,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
G4ThreeVector center(0,0,0);
|
||||
G4Navigator* navigator = G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking();
|
||||
navigator->LocateGlobalPointAndSetup(center,0,false);
|
||||
navigator->LocateGlobalPointAndSetup(center,nullptr,false);
|
||||
|
||||
G4Track* track = nullptr;
|
||||
G4TrackStatus istop = fAlive;
|
||||
@@ -132,7 +133,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
if(sdManager != nullptr)
|
||||
{ currentEvent->SetHCofThisEvent(sdManager->PrepareNewEvent()); }
|
||||
|
||||
if(userEventAction) userEventAction->BeginOfEventAction(currentEvent);
|
||||
if(userEventAction != nullptr) userEventAction->BeginOfEventAction(currentEvent);
|
||||
|
||||
#if defined(GEANT4_USE_TIMEMORY)
|
||||
eventProfiler.reset(new ProfilerConfig(currentEvent));
|
||||
@@ -224,7 +225,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
delete aTrajectory;
|
||||
aTrajectory = previousTrajectory;
|
||||
}
|
||||
if(aTrajectory&&(istop!=fStopButAlive)&&(istop!=fSuspend))
|
||||
if((aTrajectory != nullptr)&&(istop!=fStopButAlive)&&(istop!=fSuspend))
|
||||
{
|
||||
if(trajectoryContainer == nullptr)
|
||||
{
|
||||
@@ -260,10 +261,10 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
" Continue with simulation.");
|
||||
break;
|
||||
case fKillTrackAndSecondaries:
|
||||
if( secondaries )
|
||||
if( secondaries != nullptr )
|
||||
{
|
||||
for(std::size_t i=0; i<secondaries->size(); ++i)
|
||||
{ delete (*secondaries)[i]; }
|
||||
for(auto & secondarie : *secondaries)
|
||||
{ delete secondarie; }
|
||||
secondaries->clear();
|
||||
}
|
||||
delete track;
|
||||
@@ -279,7 +280,11 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
}
|
||||
trackingManagersToFlush.clear();
|
||||
|
||||
// Check if flushing one of the tracking managers stacked new secondaries.
|
||||
// flush any fast simulation models
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->Flush();
|
||||
|
||||
// Check if flushing one of the tracking managers or a fast simulation model
|
||||
// stacked new secondaries.
|
||||
} while (trackContainer->GetNUrgentTrack() > 0);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
@@ -299,7 +304,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
eventProfiler.reset();
|
||||
#endif
|
||||
|
||||
if(userEventAction)
|
||||
if(userEventAction != nullptr)
|
||||
{
|
||||
userEventAction->EndOfEventAction(currentEvent);
|
||||
}
|
||||
@@ -314,16 +319,16 @@ void G4EventManager::StackTracks(G4TrackVector* trackVector,
|
||||
{
|
||||
if( trackVector != nullptr )
|
||||
{
|
||||
if( trackVector->size() == 0 ) return;
|
||||
if( trackVector->empty() ) return;
|
||||
for( auto newTrack : *trackVector )
|
||||
{
|
||||
++trackIDCounter;
|
||||
if(!IDhasAlreadySet)
|
||||
{
|
||||
newTrack->SetTrackID( trackIDCounter );
|
||||
if(newTrack->GetDynamicParticle()->GetPrimaryParticle())
|
||||
if(newTrack->GetDynamicParticle()->GetPrimaryParticle() != nullptr)
|
||||
{
|
||||
G4PrimaryParticle* pp
|
||||
auto* pp
|
||||
= (G4PrimaryParticle*)(newTrack->GetDynamicParticle()->GetPrimaryParticle());
|
||||
pp->SetTrackID(trackIDCounter);
|
||||
}
|
||||
@@ -405,7 +410,7 @@ void G4EventManager::ProcessOneEvent(G4TrackVector* trackVector,
|
||||
void G4EventManager::SetUserInformation(G4VUserEventInformation* anInfo)
|
||||
{
|
||||
G4ApplicationState currentState = stateManager->GetCurrentState();
|
||||
if(currentState != G4State_EventProc || currentEvent == 0)
|
||||
if(currentState != G4State_EventProc || currentEvent == nullptr)
|
||||
{
|
||||
G4Exception("G4EventManager::SetUserInformation",
|
||||
"Event0003", JustWarning,
|
||||
@@ -420,7 +425,7 @@ void G4EventManager::SetUserInformation(G4VUserEventInformation* anInfo)
|
||||
G4VUserEventInformation* G4EventManager::GetUserInformation()
|
||||
{
|
||||
G4ApplicationState currentState = stateManager->GetCurrentState();
|
||||
if(currentState != G4State_EventProc || currentEvent == 0)
|
||||
if(currentState != G4State_EventProc || currentEvent == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ G4GeneralParticleSourceData::G4GeneralParticleSourceData()
|
||||
G4GeneralParticleSourceData::~G4GeneralParticleSourceData()
|
||||
{
|
||||
G4MUTEXDESTROY(mutex);
|
||||
for ( auto it = sourceVector.cbegin(); it != sourceVector.cend(); ++it )
|
||||
for (const auto it : sourceVector)
|
||||
{
|
||||
delete *it;
|
||||
delete it;
|
||||
}
|
||||
sourceVector.clear();
|
||||
}
|
||||
@@ -146,9 +146,9 @@ void G4GeneralParticleSourceData::ClearSources()
|
||||
{
|
||||
currentSourceIdx = -1;
|
||||
currentSource = nullptr;
|
||||
for ( auto it = sourceVector.cbegin(); it != sourceVector.cend(); ++it )
|
||||
for (const auto it : sourceVector)
|
||||
{
|
||||
delete *it;
|
||||
delete it;
|
||||
}
|
||||
sourceVector.clear();
|
||||
sourceIntensity.clear();
|
||||
@@ -157,9 +157,9 @@ void G4GeneralParticleSourceData::ClearSources()
|
||||
|
||||
void G4GeneralParticleSourceData::SetVerbosityAllSources(G4int vl)
|
||||
{
|
||||
for ( auto it = sourceVector.cbegin(); it != sourceVector.cend(); ++it )
|
||||
for (const auto it : sourceVector)
|
||||
{
|
||||
(*it)->SetVerbosity(vl);
|
||||
it->SetVerbosity(vl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,10 +59,6 @@ G4HEPEvtInterface::G4HEPEvtInterface(const char* evfile, G4int vl)
|
||||
particle_time = 0.0;
|
||||
}
|
||||
|
||||
G4HEPEvtInterface::~G4HEPEvtInterface()
|
||||
{
|
||||
}
|
||||
|
||||
void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
|
||||
{
|
||||
G4int NHEP = 0; // number of entries
|
||||
@@ -116,13 +112,13 @@ void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
|
||||
|
||||
// Create G4PrimaryParticle object
|
||||
//
|
||||
G4PrimaryParticle* particle = new G4PrimaryParticle( IDHEP );
|
||||
auto* particle = new G4PrimaryParticle( IDHEP );
|
||||
particle->SetMass( PHEP5*GeV );
|
||||
particle->SetMomentum(PHEP1*GeV, PHEP2*GeV, PHEP3*GeV );
|
||||
|
||||
// Create G4HEPEvtParticle object
|
||||
//
|
||||
G4HEPEvtParticle* hepParticle
|
||||
auto* hepParticle
|
||||
= new G4HEPEvtParticle( particle, ISTHEP, JDAHEP1, JDAHEP2 );
|
||||
|
||||
// Store
|
||||
@@ -132,17 +128,17 @@ void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
|
||||
|
||||
// Check if there is at least one particle
|
||||
//
|
||||
if( HPlist.size() == 0 ) return;
|
||||
if( HPlist.empty() ) return;
|
||||
|
||||
// Make connection between daughter particles decayed from the same mother
|
||||
//
|
||||
for( std::size_t i=0; i<HPlist.size(); ++i )
|
||||
for(auto & i : HPlist)
|
||||
{
|
||||
if( HPlist[i]->GetJDAHEP1() > 0 ) // it has daughters
|
||||
if( i->GetJDAHEP1() > 0 ) // it has daughters
|
||||
{
|
||||
G4int jda1 = HPlist[i]->GetJDAHEP1()-1; // FORTRAN index starts from 1
|
||||
G4int jda2 = HPlist[i]->GetJDAHEP2()-1; // but C++ starts from 0.
|
||||
G4PrimaryParticle* mother = HPlist[i]->GetTheParticle();
|
||||
G4int jda1 = i->GetJDAHEP1()-1; // FORTRAN index starts from 1
|
||||
G4int jda2 = i->GetJDAHEP2()-1; // but C++ starts from 0.
|
||||
G4PrimaryParticle* mother = i->GetTheParticle();
|
||||
for( G4int j=jda1; j<=jda2; ++j )
|
||||
{
|
||||
G4PrimaryParticle* daughter = HPlist[j]->GetTheParticle();
|
||||
@@ -157,25 +153,25 @@ void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
|
||||
|
||||
// Create G4PrimaryVertex object
|
||||
//
|
||||
G4PrimaryVertex* vertex = new G4PrimaryVertex(particle_position,particle_time);
|
||||
auto* vertex = new G4PrimaryVertex(particle_position,particle_time);
|
||||
|
||||
// Put initial particles to the vertex
|
||||
//
|
||||
for( std::size_t ii=0; ii<HPlist.size(); ++ii )
|
||||
for(auto & ii : HPlist)
|
||||
{
|
||||
if( HPlist[ii]->GetISTHEP() > 0 ) // ISTHEP of daughters had been
|
||||
if( ii->GetISTHEP() > 0 ) // ISTHEP of daughters had been
|
||||
// set to negative
|
||||
{
|
||||
G4PrimaryParticle* initialParticle = HPlist[ii]->GetTheParticle();
|
||||
G4PrimaryParticle* initialParticle = ii->GetTheParticle();
|
||||
vertex->SetPrimary( initialParticle );
|
||||
}
|
||||
}
|
||||
|
||||
// Clear G4HEPEvtParticles
|
||||
//
|
||||
for(std::size_t iii=0; iii<HPlist.size(); ++iii)
|
||||
for(auto & iii : HPlist)
|
||||
{
|
||||
delete HPlist[iii];
|
||||
delete iii;
|
||||
}
|
||||
HPlist.clear();
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@ G4Allocator<G4HEPEvtParticle>*& aHEPEvtParticleAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4HEPEvtParticle::G4HEPEvtParticle()
|
||||
{
|
||||
}
|
||||
|
||||
G4HEPEvtParticle::
|
||||
G4HEPEvtParticle(G4PrimaryParticle* pp,
|
||||
G4int isthep, G4int jdahep1, G4int jdahep2)
|
||||
@@ -47,10 +43,6 @@ G4HEPEvtParticle(G4PrimaryParticle* pp,
|
||||
{
|
||||
}
|
||||
|
||||
G4HEPEvtParticle::~G4HEPEvtParticle()
|
||||
{
|
||||
}
|
||||
|
||||
G4HEPEvtParticle& G4HEPEvtParticle::operator=(const G4HEPEvtParticle &)
|
||||
{
|
||||
return *this;
|
||||
|
||||
@@ -215,7 +215,7 @@ void G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)
|
||||
|
||||
// Create a new vertex
|
||||
//
|
||||
G4PrimaryVertex* vertex =
|
||||
auto* vertex =
|
||||
new G4PrimaryVertex(particle_position,particle_time);
|
||||
|
||||
// Create new primaries and set them to the vertex
|
||||
@@ -223,7 +223,7 @@ void G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)
|
||||
G4double mass = particle_definition->GetPDGMass();
|
||||
for( G4int i=0; i<NumberOfParticlesToBeGenerated; ++i )
|
||||
{
|
||||
G4PrimaryParticle* particle =
|
||||
auto* particle =
|
||||
new G4PrimaryParticle(particle_definition);
|
||||
particle->SetKineticEnergy( particle_energy );
|
||||
particle->SetMass( mass );
|
||||
|
||||
@@ -47,22 +47,12 @@ G4PrimaryTransformer::G4PrimaryTransformer()
|
||||
CheckUnknown();
|
||||
}
|
||||
|
||||
G4PrimaryTransformer::~G4PrimaryTransformer()
|
||||
{
|
||||
}
|
||||
|
||||
void G4PrimaryTransformer::CheckUnknown()
|
||||
{
|
||||
unknown = particleTable->FindParticle("unknown");
|
||||
if(unknown != nullptr)
|
||||
{ unknownParticleDefined = true; }
|
||||
else
|
||||
{ unknownParticleDefined = false; }
|
||||
unknownParticleDefined = unknown != nullptr;
|
||||
opticalphoton = particleTable->FindParticle("opticalphoton");
|
||||
if(opticalphoton != nullptr)
|
||||
{ opticalphotonDefined = true; }
|
||||
else
|
||||
{ opticalphotonDefined = false; }
|
||||
opticalphotonDefined = opticalphoton != nullptr;
|
||||
}
|
||||
|
||||
G4TrackVector*
|
||||
@@ -149,7 +139,7 @@ GenerateSingleTrack( G4PrimaryParticle* primaryParticle,
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
G4DynamicParticle* DP =
|
||||
auto* DP =
|
||||
new G4DynamicParticle(partDef,
|
||||
primaryParticle->GetMomentumDirection(),
|
||||
primaryParticle->GetKineticEnergy());
|
||||
@@ -264,7 +254,7 @@ SetDecayProducts(G4PrimaryParticle* mother, G4DynamicParticle* motherDP)
|
||||
{
|
||||
G4PrimaryParticle* daughter = mother->GetDaughter();
|
||||
if(daughter == nullptr) return;
|
||||
G4DecayProducts* decayProducts
|
||||
auto* decayProducts
|
||||
= (G4DecayProducts*)(motherDP->GetPreAssignedDecayProducts() );
|
||||
if(decayProducts == nullptr)
|
||||
{
|
||||
@@ -295,7 +285,7 @@ SetDecayProducts(G4PrimaryParticle* mother, G4DynamicParticle* motherDP)
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
G4DynamicParticle* DP
|
||||
auto* DP
|
||||
= new G4DynamicParticle(partDef,daughter->GetMomentum());
|
||||
DP->SetPrimaryParticle(daughter);
|
||||
|
||||
@@ -341,7 +331,7 @@ SetDecayProducts(G4PrimaryParticle* mother, G4DynamicParticle* motherDP)
|
||||
void G4PrimaryTransformer::SetUnknnownParticleDefined(G4bool vl)
|
||||
{
|
||||
unknownParticleDefined = vl;
|
||||
if(unknownParticleDefined && !unknown)
|
||||
if(unknownParticleDefined && (unknown == nullptr))
|
||||
{
|
||||
G4cerr << "unknownParticleDefined cannot be set true because" << G4endl
|
||||
<< "G4UnknownParticle is not defined in the physics list." << G4endl
|
||||
@@ -353,7 +343,7 @@ void G4PrimaryTransformer::SetUnknnownParticleDefined(G4bool vl)
|
||||
G4bool G4PrimaryTransformer::CheckDynamicParticle(G4DynamicParticle* DP)
|
||||
{
|
||||
if(IsGoodForTrack(DP->GetDefinition())) return true;
|
||||
G4DecayProducts* decayProducts
|
||||
auto* decayProducts
|
||||
= (G4DecayProducts*)(DP->GetPreAssignedDecayProducts());
|
||||
if(decayProducts != nullptr && decayProducts->entries()>0) return true;
|
||||
G4cerr << G4endl
|
||||
@@ -374,7 +364,7 @@ G4PrimaryTransformer::GetDefinition(G4PrimaryParticle* pp)
|
||||
{
|
||||
partDef = particleTable->FindParticle(pp->GetPDGcode());
|
||||
}
|
||||
if(unknownParticleDefined && ((!partDef)||partDef->IsShortLived()))
|
||||
if(unknownParticleDefined && ((partDef == nullptr)||partDef->IsShortLived()))
|
||||
{
|
||||
partDef = unknown;
|
||||
}
|
||||
@@ -385,14 +375,14 @@ G4bool G4PrimaryTransformer::IsGoodForTrack(G4ParticleDefinition* pd)
|
||||
{
|
||||
if(pd == nullptr)
|
||||
{ return false; }
|
||||
else if(!(pd->IsShortLived()))
|
||||
if(!(pd->IsShortLived()))
|
||||
{ return true; }
|
||||
//
|
||||
// Following two lines should be removed if the user does not want to make
|
||||
// shortlived primary particle with proper decay table to be converted into
|
||||
// a track.
|
||||
//
|
||||
else if(pd->GetDecayTable() != nullptr)
|
||||
if(pd->GetDecayTable() != nullptr)
|
||||
{ return true; }
|
||||
|
||||
return false;
|
||||
|
||||
@@ -36,25 +36,7 @@
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
G4RayShooter::G4RayShooter()
|
||||
{
|
||||
SetInitialValues();
|
||||
}
|
||||
|
||||
void G4RayShooter::SetInitialValues()
|
||||
{
|
||||
G4ThreeVector zero;
|
||||
particle_momentum_direction = (G4ParticleMomentum)zero;
|
||||
particle_energy = 1.0*GeV;
|
||||
particle_position = zero;
|
||||
particle_polarization = zero;
|
||||
}
|
||||
|
||||
G4RayShooter::~G4RayShooter()
|
||||
{
|
||||
}
|
||||
|
||||
void G4RayShooter::Shoot(G4Event* evt,G4ThreeVector vtx, G4ThreeVector direc)
|
||||
void G4RayShooter::Shoot(G4Event* evt, G4ThreeVector vtx, G4ThreeVector direc)
|
||||
{
|
||||
if(particle_definition == nullptr)
|
||||
{
|
||||
@@ -72,12 +54,12 @@ void G4RayShooter::Shoot(G4Event* evt,G4ThreeVector vtx, G4ThreeVector direc)
|
||||
|
||||
// Create a new vertex
|
||||
//
|
||||
G4PrimaryVertex* vertex = new G4PrimaryVertex(vtx,particle_time);
|
||||
auto* vertex = new G4PrimaryVertex(vtx,particle_time);
|
||||
|
||||
// Create new primaries and set them to the vertex
|
||||
//
|
||||
G4double mass = particle_definition->GetPDGMass();
|
||||
G4PrimaryParticle* particle = new G4PrimaryParticle(particle_definition);
|
||||
auto* particle = new G4PrimaryParticle(particle_definition);
|
||||
particle->SetKineticEnergy( particle_energy );
|
||||
particle->SetMass( mass );
|
||||
particle->SetMomentumDirection( direc );
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
#include "Randomize.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
|
||||
G4SPSAngDistribution::G4SPSAngDistribution()
|
||||
: Theta(0.), Phi(0.)
|
||||
G4SPSAngDistribution::G4SPSAngDistribution()
|
||||
{
|
||||
// Angular distribution Variables
|
||||
G4ThreeVector zero;
|
||||
@@ -657,41 +656,39 @@ G4double G4SPSAngDistribution::GenerateUserDefTheta()
|
||||
G4cout << "UserDistType = " << UserDistType << G4endl;
|
||||
return (0.);
|
||||
}
|
||||
else
|
||||
|
||||
// UserDistType = theta or both and so a theta distribution
|
||||
// is defined. This should be integrated if not already done.
|
||||
G4AutoLock l(&mutex);
|
||||
if(!IPDFThetaExist)
|
||||
{
|
||||
// UserDistType = theta or both and so a theta distribution
|
||||
// is defined. This should be integrated if not already done.
|
||||
G4AutoLock l(&mutex);
|
||||
if(IPDFThetaExist == false)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
G4double bins[1024],vals[1024], sum;
|
||||
G4int ii;
|
||||
G4int maxbin = G4int(UDefThetaH.GetVectorLength());
|
||||
bins[0] = UDefThetaH.GetLowEdgeEnergy(std::size_t(0));
|
||||
vals[0] = UDefThetaH(std::size_t(0));
|
||||
sum = vals[0];
|
||||
for(ii=1; ii<maxbin; ++ii)
|
||||
{
|
||||
bins[ii] = UDefThetaH.GetLowEdgeEnergy(std::size_t(ii));
|
||||
vals[ii] = UDefThetaH(std::size_t(ii)) + vals[ii-1];
|
||||
sum = sum + UDefThetaH(std::size_t(ii));
|
||||
}
|
||||
for(ii=0; ii<maxbin; ++ii)
|
||||
{
|
||||
vals[ii] = vals[ii]/sum;
|
||||
IPDFThetaH.InsertValues(bins[ii], vals[ii]);
|
||||
}
|
||||
IPDFThetaExist = true;
|
||||
}
|
||||
l.unlock();
|
||||
|
||||
// IPDF has been created so carry on
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
G4double rndm = G4UniformRand();
|
||||
return(IPDFThetaH.GetEnergy(rndm));
|
||||
G4double bins[1024],vals[1024], sum;
|
||||
G4int ii;
|
||||
G4int maxbin = G4int(UDefThetaH.GetVectorLength());
|
||||
bins[0] = UDefThetaH.GetLowEdgeEnergy(std::size_t(0));
|
||||
vals[0] = UDefThetaH(std::size_t(0));
|
||||
sum = vals[0];
|
||||
for(ii=1; ii<maxbin; ++ii)
|
||||
{
|
||||
bins[ii] = UDefThetaH.GetLowEdgeEnergy(std::size_t(ii));
|
||||
vals[ii] = UDefThetaH(std::size_t(ii)) + vals[ii-1];
|
||||
sum = sum + UDefThetaH(std::size_t(ii));
|
||||
}
|
||||
for(ii=0; ii<maxbin; ++ii)
|
||||
{
|
||||
vals[ii] = vals[ii]/sum;
|
||||
IPDFThetaH.InsertValues(bins[ii], vals[ii]);
|
||||
}
|
||||
IPDFThetaExist = true;
|
||||
}
|
||||
l.unlock();
|
||||
|
||||
// IPDF has been created so carry on
|
||||
//
|
||||
G4double rndm = G4UniformRand();
|
||||
return IPDFThetaH.GetEnergy(rndm);
|
||||
}
|
||||
|
||||
G4double G4SPSAngDistribution::GenerateUserDefPhi()
|
||||
@@ -706,42 +703,39 @@ G4double G4SPSAngDistribution::GenerateUserDefPhi()
|
||||
G4cout << "UserDistType = " << UserDistType << G4endl;
|
||||
return(0.);
|
||||
}
|
||||
else
|
||||
|
||||
// UserDistType = phi or both and so a phi distribution
|
||||
// is defined. This should be integrated if not already done.
|
||||
G4AutoLock l(&mutex);
|
||||
if(!IPDFPhiExist)
|
||||
{
|
||||
// UserDistType = phi or both and so a phi distribution
|
||||
// is defined. This should be integrated if not already done.
|
||||
G4AutoLock l(&mutex);
|
||||
if(IPDFPhiExist == false)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
G4double bins[1024],vals[1024], sum;
|
||||
G4int ii;
|
||||
G4int maxbin = G4int(UDefPhiH.GetVectorLength());
|
||||
bins[0] = UDefPhiH.GetLowEdgeEnergy(std::size_t(0));
|
||||
vals[0] = UDefPhiH(std::size_t(0));
|
||||
sum = vals[0];
|
||||
for(ii=1; ii<maxbin; ++ii)
|
||||
{
|
||||
bins[ii] = UDefPhiH.GetLowEdgeEnergy(std::size_t(ii));
|
||||
vals[ii] = UDefPhiH(std::size_t(ii)) + vals[ii-1];
|
||||
sum = sum + UDefPhiH(std::size_t(ii));
|
||||
}
|
||||
for(ii=0; ii<maxbin; ++ii)
|
||||
{
|
||||
vals[ii] = vals[ii]/sum;
|
||||
IPDFPhiH.InsertValues(bins[ii], vals[ii]);
|
||||
}
|
||||
IPDFPhiExist = true;
|
||||
}
|
||||
l.unlock();
|
||||
|
||||
// IPDF has been create so carry on
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
G4double rndm = G4UniformRand();
|
||||
|
||||
return(IPDFPhiH.GetEnergy(rndm));
|
||||
G4double bins[1024],vals[1024], sum;
|
||||
G4int ii;
|
||||
G4int maxbin = G4int(UDefPhiH.GetVectorLength());
|
||||
bins[0] = UDefPhiH.GetLowEdgeEnergy(std::size_t(0));
|
||||
vals[0] = UDefPhiH(std::size_t(0));
|
||||
sum = vals[0];
|
||||
for(ii=1; ii<maxbin; ++ii)
|
||||
{
|
||||
bins[ii] = UDefPhiH.GetLowEdgeEnergy(std::size_t(ii));
|
||||
vals[ii] = UDefPhiH(std::size_t(ii)) + vals[ii-1];
|
||||
sum = sum + UDefPhiH(std::size_t(ii));
|
||||
}
|
||||
for(ii=0; ii<maxbin; ++ii)
|
||||
{
|
||||
vals[ii] = vals[ii]/sum;
|
||||
IPDFPhiH.InsertValues(bins[ii], vals[ii]);
|
||||
}
|
||||
IPDFPhiExist = true;
|
||||
}
|
||||
l.unlock();
|
||||
|
||||
// IPDF has been create so carry on
|
||||
//
|
||||
G4double rndm = G4UniformRand();
|
||||
return IPDFPhiH.GetEnergy(rndm);
|
||||
}
|
||||
|
||||
void G4SPSAngDistribution::ReSetHist(const G4String& atype)
|
||||
|
||||
@@ -100,10 +100,10 @@ G4SPSEneDistribution::~G4SPSEneDistribution()
|
||||
delete BBHist;
|
||||
delete CP_x;
|
||||
delete CPHist;
|
||||
for ( auto it=SplineInt.begin() ; it!=SplineInt.end() ; ++it )
|
||||
for (auto & it : SplineInt)
|
||||
{
|
||||
delete *it;
|
||||
*it = nullptr;
|
||||
delete it;
|
||||
it = nullptr;
|
||||
}
|
||||
SplineInt.clear();
|
||||
}
|
||||
@@ -594,7 +594,7 @@ void G4SPSEneDistribution::LinearInterpolation() // MT: Lock in caller
|
||||
// Points are now in x,y arrays. If the spectrum is integral it has to be
|
||||
// made differential and if momentum it has to be made energy
|
||||
|
||||
if (DiffSpec == false)
|
||||
if (!DiffSpec)
|
||||
{
|
||||
// Converts integral point-wise spectra to Differential
|
||||
//
|
||||
@@ -606,7 +606,7 @@ void G4SPSEneDistribution::LinearInterpolation() // MT: Lock in caller
|
||||
--maxi;
|
||||
}
|
||||
|
||||
if (EnergySpec == false)
|
||||
if (!EnergySpec)
|
||||
{
|
||||
// change currently stored values (emin etc) which are actually momenta
|
||||
// to energies
|
||||
@@ -737,7 +737,7 @@ void G4SPSEneDistribution::LogInterpolation() // MT: Lock in caller
|
||||
// Points are now in x,y arrays. If the spectrum is integral it has to be
|
||||
// made differential and if momentum it has to be made energy
|
||||
|
||||
if (DiffSpec == false)
|
||||
if (!DiffSpec)
|
||||
{
|
||||
// Converts integral point-wise spectra to Differential
|
||||
//
|
||||
@@ -749,7 +749,7 @@ void G4SPSEneDistribution::LogInterpolation() // MT: Lock in caller
|
||||
--maxi;
|
||||
}
|
||||
|
||||
if (EnergySpec == false)
|
||||
if (!EnergySpec)
|
||||
{
|
||||
// Change currently stored values (emin etc) which are actually momenta
|
||||
// to energies
|
||||
@@ -783,8 +783,8 @@ void G4SPSEneDistribution::LogInterpolation() // MT: Lock in caller
|
||||
|
||||
i = 1;
|
||||
|
||||
if ( Arb_ezero ) { delete [] Arb_ezero; Arb_ezero = 0; }
|
||||
if ( Arb_Const ) { delete [] Arb_Const; Arb_Const = 0; }
|
||||
if ( Arb_ezero != nullptr ) { delete [] Arb_ezero; Arb_ezero = nullptr; }
|
||||
if ( Arb_Const != nullptr ) { delete [] Arb_Const; Arb_Const = nullptr; }
|
||||
Arb_alpha = new G4double [1024];
|
||||
Arb_Const = new G4double [1024];
|
||||
Arb_alpha_Const_flag = true;
|
||||
@@ -892,7 +892,7 @@ void G4SPSEneDistribution::ExpInterpolation() // MT: Lock in caller
|
||||
// Points are now in x,y arrays. If the spectrum is integral it has to be
|
||||
// made differential and if momentum it has to be made energy
|
||||
|
||||
if (DiffSpec == false)
|
||||
if (!DiffSpec)
|
||||
{
|
||||
// Converts integral point-wise spectra to Differential
|
||||
//
|
||||
@@ -904,7 +904,7 @@ void G4SPSEneDistribution::ExpInterpolation() // MT: Lock in caller
|
||||
--maxi;
|
||||
}
|
||||
|
||||
if (EnergySpec == false)
|
||||
if (!EnergySpec)
|
||||
{
|
||||
// Change currently stored values (emin etc) which are actually momenta
|
||||
// to energies
|
||||
@@ -938,8 +938,8 @@ void G4SPSEneDistribution::ExpInterpolation() // MT: Lock in caller
|
||||
|
||||
i = 1;
|
||||
|
||||
if ( Arb_ezero ) { delete[] Arb_ezero; Arb_ezero = 0; }
|
||||
if ( Arb_Const ) { delete[] Arb_Const; Arb_Const = 0; }
|
||||
if ( Arb_ezero != nullptr ) { delete[] Arb_ezero; Arb_ezero = nullptr; }
|
||||
if ( Arb_Const != nullptr ) { delete[] Arb_Const; Arb_Const = nullptr; }
|
||||
Arb_ezero = new G4double [1024];
|
||||
Arb_Const = new G4double [1024];
|
||||
Arb_ezero_flag = true;
|
||||
@@ -1018,7 +1018,7 @@ void G4SPSEneDistribution::SplineInterpolation() // MT: Lock in caller
|
||||
// Points are now in x,y arrays. If the spectrum is integral it has to be
|
||||
// made differential and if momentum it has to be made energy
|
||||
|
||||
if (DiffSpec == false)
|
||||
if (!DiffSpec)
|
||||
{
|
||||
// Converts integral point-wise spectra to Differential
|
||||
//
|
||||
@@ -1030,7 +1030,7 @@ void G4SPSEneDistribution::SplineInterpolation() // MT: Lock in caller
|
||||
--maxi;
|
||||
}
|
||||
|
||||
if (EnergySpec == false)
|
||||
if (!EnergySpec)
|
||||
{
|
||||
// Change currently stored values (emin etc) which are actually momenta
|
||||
// to energies
|
||||
@@ -1067,10 +1067,10 @@ void G4SPSEneDistribution::SplineInterpolation() // MT: Lock in caller
|
||||
sum = 0.;
|
||||
Splinetemp = new G4DataInterpolation(Arb_x, Arb_y, maxi, 0., 0.);
|
||||
G4double ei[101], prob[101];
|
||||
for ( auto it = SplineInt.begin(); it!=SplineInt.end() ; ++it)
|
||||
for (auto & it : SplineInt)
|
||||
{
|
||||
delete *it;
|
||||
*it = 0;
|
||||
delete it;
|
||||
it = 0;
|
||||
}
|
||||
SplineInt.clear();
|
||||
SplineInt.resize(1024,nullptr);
|
||||
@@ -1582,7 +1582,7 @@ void G4SPSEneDistribution::GenUserHistEnergies()
|
||||
|
||||
G4AutoLock l(&mutex);
|
||||
|
||||
if (IPDFEnergyExist == false)
|
||||
if (!IPDFEnergyExist)
|
||||
{
|
||||
G4int ii;
|
||||
G4int maxbin = G4int(UDefEnergyH.GetVectorLength());
|
||||
@@ -1590,7 +1590,7 @@ void G4SPSEneDistribution::GenUserHistEnergies()
|
||||
for ( ii = 0 ; ii<1024 ; ++ii ) { bins[ii]=0; vals[ii]=0; }
|
||||
sum = 0.;
|
||||
|
||||
if ( (EnergySpec == false)
|
||||
if ( (!EnergySpec)
|
||||
&& (threadLocalData.Get().particle_definition == nullptr))
|
||||
{
|
||||
G4Exception("G4SPSEneDistribution::GenUserHistEnergies",
|
||||
@@ -1606,7 +1606,7 @@ void G4SPSEneDistribution::GenUserHistEnergies()
|
||||
maxbin = 1024;
|
||||
}
|
||||
|
||||
if (DiffSpec == false)
|
||||
if (!DiffSpec)
|
||||
{
|
||||
G4cout << "Histograms are Differential!!! " << G4endl;
|
||||
}
|
||||
@@ -1623,7 +1623,7 @@ void G4SPSEneDistribution::GenUserHistEnergies()
|
||||
}
|
||||
}
|
||||
|
||||
if (EnergySpec == false)
|
||||
if (!EnergySpec)
|
||||
{
|
||||
G4double mass = threadLocalData.Get().particle_definition->GetPDGMass();
|
||||
|
||||
@@ -1793,13 +1793,13 @@ void G4SPSEneDistribution::GenEpnHistEnergies()
|
||||
|
||||
G4AutoLock l(&mutex);
|
||||
|
||||
if (Epnflag == true) // true means spectrum is epn, false means e
|
||||
if (Epnflag) // true means spectrum is epn, false means e
|
||||
{
|
||||
// Convert to energy by multiplying by A number
|
||||
//
|
||||
ConvertEPNToEnergy();
|
||||
}
|
||||
if (IPDFEnergyExist == false)
|
||||
if (!IPDFEnergyExist)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
|
||||
@@ -1213,7 +1213,7 @@ G4bool G4SPSPosDistribution::IsSourceConfined(G4ThreeVector& pos)
|
||||
{
|
||||
// Method to check point is within the volume specified
|
||||
|
||||
if(Confine == false)
|
||||
if(!Confine)
|
||||
{
|
||||
G4cout << "Error: Confine is false" << G4endl;
|
||||
}
|
||||
@@ -1237,10 +1237,9 @@ G4bool G4SPSPosDistribution::IsSourceConfined(G4ThreeVector& pos)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
G4ThreeVector G4SPSPosDistribution::GenerateOne()
|
||||
@@ -1248,7 +1247,7 @@ G4ThreeVector G4SPSPosDistribution::GenerateOne()
|
||||
G4ThreeVector localP;
|
||||
G4bool srcconf = false;
|
||||
G4int LoopCount = 0;
|
||||
while(srcconf == false)
|
||||
while(!srcconf)
|
||||
{
|
||||
if(SourcePosType == "Point")
|
||||
GeneratePointSource(localP);
|
||||
@@ -1269,13 +1268,13 @@ G4ThreeVector G4SPSPosDistribution::GenerateOne()
|
||||
"G4GPS001", JustWarning, msg);
|
||||
GeneratePointSource(localP);
|
||||
}
|
||||
if(Confine == true)
|
||||
if(Confine)
|
||||
{
|
||||
srcconf = IsSourceConfined(localP);
|
||||
// if source in confined srcconf = true terminating the loop
|
||||
// if source isnt confined srcconf = false and loop continues
|
||||
}
|
||||
else if(Confine == false)
|
||||
else if(!Confine)
|
||||
{
|
||||
srcconf = true; // terminate loop
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
G4SPSRandomGenerator::bweights_t::bweights_t()
|
||||
{
|
||||
for ( G4int i=0 ; i<9 ; ++i ) { w[i] = 1; }
|
||||
for (double & i : w) { i = 1; }
|
||||
}
|
||||
|
||||
G4double& G4SPSRandomGenerator::bweights_t::operator [](const G4int i)
|
||||
@@ -246,93 +246,92 @@ G4double G4SPSRandomGenerator::GenRandX()
|
||||
{
|
||||
if (verbosityLevel >= 1)
|
||||
G4cout << "In GenRandX" << G4endl;
|
||||
if (XBias == false)
|
||||
if (!XBias)
|
||||
{
|
||||
// X is not biased
|
||||
G4double rndm = G4UniformRand();
|
||||
return (rndm);
|
||||
}
|
||||
else
|
||||
|
||||
// X is biased
|
||||
// This is shared among threads, and we need to initialize
|
||||
// only once. Multiple instances of this class can exists
|
||||
// so we rely on a class-private, thread-private variable
|
||||
// to check if we need an initialiation. We do not use a lock here
|
||||
// because the Boolean on which we check is thread private
|
||||
//
|
||||
if ( !local_IPDFXBias.Get().val )
|
||||
{
|
||||
// X is biased
|
||||
// This is shared among threads, and we need to initialize
|
||||
// only once. Multiple instances of this class can exists
|
||||
// so we rely on a class-private, thread-private variable
|
||||
// to check if we need an initialiation. We do not use a lock here
|
||||
// because the Boolean on which we check is thread private
|
||||
// For time that this thread arrived, here
|
||||
// Now two cases are possible: it is the first time
|
||||
// ANY thread has ever initialized this.
|
||||
// Now we need a lock. In any case, the thread local
|
||||
// variable can now be set to true
|
||||
//
|
||||
if ( local_IPDFXBias.Get().val == false )
|
||||
local_IPDFXBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (!IPDFXBias)
|
||||
{
|
||||
// For time that this thread arrived, here
|
||||
// Now two cases are possible: it is the first time
|
||||
// ANY thread has ever initialized this.
|
||||
// Now we need a lock. In any case, the thread local
|
||||
// variable can now be set to true
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
local_IPDFXBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (IPDFXBias == false)
|
||||
G4double bins[1024], vals[1024], sum;
|
||||
G4int ii;
|
||||
G4int maxbin = G4int(XBiasH.GetVectorLength());
|
||||
bins[0] = XBiasH.GetLowEdgeEnergy(std::size_t(0));
|
||||
vals[0] = XBiasH(std::size_t(0));
|
||||
sum = vals[0];
|
||||
for (ii=1; ii<maxbin; ++ii)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
G4double bins[1024], vals[1024], sum;
|
||||
G4int ii;
|
||||
G4int maxbin = G4int(XBiasH.GetVectorLength());
|
||||
bins[0] = XBiasH.GetLowEdgeEnergy(std::size_t(0));
|
||||
vals[0] = XBiasH(std::size_t(0));
|
||||
sum = vals[0];
|
||||
for (ii=1; ii<maxbin; ++ii)
|
||||
{
|
||||
bins[ii] = XBiasH.GetLowEdgeEnergy(std::size_t(ii));
|
||||
vals[ii] = XBiasH(std::size_t(ii)) + vals[ii - 1];
|
||||
sum = sum + XBiasH(std::size_t(ii));
|
||||
}
|
||||
|
||||
for (ii=0; ii<maxbin; ++ii)
|
||||
{
|
||||
vals[ii] = vals[ii] / sum;
|
||||
IPDFXBiasH.InsertValues(bins[ii], vals[ii]);
|
||||
}
|
||||
IPDFXBias = true;
|
||||
bins[ii] = XBiasH.GetLowEdgeEnergy(std::size_t(ii));
|
||||
vals[ii] = XBiasH(std::size_t(ii)) + vals[ii - 1];
|
||||
sum = sum + XBiasH(std::size_t(ii));
|
||||
}
|
||||
}
|
||||
|
||||
// IPDF has been create so carry on
|
||||
|
||||
G4double rndm = G4UniformRand();
|
||||
|
||||
// Calculate the weighting: Find the bin that the determined
|
||||
// rndm is in and the weigthing will be the difference in the
|
||||
// natural probability (from the x-axis) divided by the
|
||||
// difference in the biased probability (the area)
|
||||
//
|
||||
std::size_t numberOfBin = IPDFXBiasH.GetVectorLength();
|
||||
G4int biasn1 = 0;
|
||||
G4int biasn2 = numberOfBin / 2;
|
||||
G4int biasn3 = numberOfBin - 1;
|
||||
while (biasn1 != biasn3 - 1)
|
||||
{
|
||||
if (rndm > IPDFXBiasH(biasn2))
|
||||
{ biasn1 = biasn2; }
|
||||
else
|
||||
{ biasn3 = biasn2; }
|
||||
biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
|
||||
for (ii=0; ii<maxbin; ++ii)
|
||||
{
|
||||
vals[ii] = vals[ii] / sum;
|
||||
IPDFXBiasH.InsertValues(bins[ii], vals[ii]);
|
||||
}
|
||||
IPDFXBias = true;
|
||||
}
|
||||
|
||||
// Retrieve the areas and then the x-axis values
|
||||
//
|
||||
bweights_t& w = bweights.Get();
|
||||
w[0] = IPDFXBiasH(biasn2) - IPDFXBiasH(biasn2 - 1);
|
||||
G4double xaxisl = IPDFXBiasH.GetLowEdgeEnergy(std::size_t(biasn2 - 1));
|
||||
G4double xaxisu = IPDFXBiasH.GetLowEdgeEnergy(std::size_t(biasn2));
|
||||
G4double NatProb = xaxisu - xaxisl;
|
||||
w[0] = NatProb / w[0];
|
||||
if (verbosityLevel >= 1)
|
||||
{
|
||||
G4cout << "X bin weight " << w[0] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFXBiasH.GetEnergy(rndm));
|
||||
}
|
||||
|
||||
// IPDF has been create so carry on
|
||||
|
||||
G4double rndm = G4UniformRand();
|
||||
|
||||
// Calculate the weighting: Find the bin that the determined
|
||||
// rndm is in and the weigthing will be the difference in the
|
||||
// natural probability (from the x-axis) divided by the
|
||||
// difference in the biased probability (the area)
|
||||
//
|
||||
std::size_t numberOfBin = IPDFXBiasH.GetVectorLength();
|
||||
G4int biasn1 = 0;
|
||||
G4int biasn2 = numberOfBin / 2;
|
||||
G4int biasn3 = numberOfBin - 1;
|
||||
while (biasn1 != biasn3 - 1)
|
||||
{
|
||||
if (rndm > IPDFXBiasH(biasn2))
|
||||
{ biasn1 = biasn2; }
|
||||
else
|
||||
{ biasn3 = biasn2; }
|
||||
biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
|
||||
}
|
||||
|
||||
// Retrieve the areas and then the x-axis values
|
||||
//
|
||||
bweights_t& w = bweights.Get();
|
||||
w[0] = IPDFXBiasH(biasn2) - IPDFXBiasH(biasn2 - 1);
|
||||
G4double xaxisl = IPDFXBiasH.GetLowEdgeEnergy(std::size_t(biasn2 - 1));
|
||||
G4double xaxisu = IPDFXBiasH.GetLowEdgeEnergy(std::size_t(biasn2));
|
||||
G4double NatProb = xaxisu - xaxisl;
|
||||
w[0] = NatProb / w[0];
|
||||
if (verbosityLevel >= 1)
|
||||
{
|
||||
G4cout << "X bin weight " << w[0] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFXBiasH.GetEnergy(rndm));
|
||||
|
||||
}
|
||||
|
||||
G4double G4SPSRandomGenerator::GenRandY()
|
||||
@@ -342,18 +341,17 @@ G4double G4SPSRandomGenerator::GenRandY()
|
||||
G4cout << "In GenRandY" << G4endl;
|
||||
}
|
||||
|
||||
if (YBias == false) // Y is not biased
|
||||
if (!YBias) // Y is not biased
|
||||
{
|
||||
G4double rndm = G4UniformRand();
|
||||
return (rndm);
|
||||
}
|
||||
else // Y is biased
|
||||
{
|
||||
if ( local_IPDFYBias.Get().val == false )
|
||||
// Y is biased
|
||||
if ( !local_IPDFYBias.Get().val )
|
||||
{
|
||||
local_IPDFYBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (IPDFYBias == false)
|
||||
if (!IPDFYBias)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
@@ -405,7 +403,7 @@ G4double G4SPSRandomGenerator::GenRandY()
|
||||
G4cout << "Y bin weight " << w[1] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFYBiasH.GetEnergy(rndm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4double G4SPSRandomGenerator::GenRandZ()
|
||||
@@ -415,18 +413,17 @@ G4double G4SPSRandomGenerator::GenRandZ()
|
||||
G4cout << "In GenRandZ" << G4endl;
|
||||
}
|
||||
|
||||
if (ZBias == false) // Z is not biased
|
||||
if (!ZBias) // Z is not biased
|
||||
{
|
||||
G4double rndm = G4UniformRand();
|
||||
return (rndm);
|
||||
}
|
||||
else // Z is biased
|
||||
{
|
||||
if ( local_IPDFZBias.Get().val == false )
|
||||
// Z is biased
|
||||
if ( !local_IPDFZBias.Get().val )
|
||||
{
|
||||
local_IPDFZBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (IPDFZBias == false)
|
||||
if (!IPDFZBias)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
@@ -478,7 +475,7 @@ G4double G4SPSRandomGenerator::GenRandZ()
|
||||
G4cout << "Z bin weight " << w[2] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFZBiasH.GetEnergy(rndm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4double G4SPSRandomGenerator::GenRandTheta()
|
||||
@@ -489,18 +486,17 @@ G4double G4SPSRandomGenerator::GenRandTheta()
|
||||
G4cout << "Verbosity " << verbosityLevel << G4endl;
|
||||
}
|
||||
|
||||
if (ThetaBias == false) // Theta is not biased
|
||||
if (!ThetaBias) // Theta is not biased
|
||||
{
|
||||
G4double rndm = G4UniformRand();
|
||||
return (rndm);
|
||||
}
|
||||
else // Theta is biased
|
||||
{
|
||||
if ( local_IPDFThetaBias.Get().val == false )
|
||||
// Theta is biased
|
||||
if ( !local_IPDFThetaBias.Get().val )
|
||||
{
|
||||
local_IPDFThetaBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (IPDFThetaBias == false)
|
||||
if (!IPDFThetaBias)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
@@ -552,7 +548,7 @@ G4double G4SPSRandomGenerator::GenRandTheta()
|
||||
G4cout << "Theta bin weight " << w[3] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFThetaBiasH.GetEnergy(rndm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4double G4SPSRandomGenerator::GenRandPhi()
|
||||
@@ -562,18 +558,17 @@ G4double G4SPSRandomGenerator::GenRandPhi()
|
||||
G4cout << "In GenRandPhi" << G4endl;
|
||||
}
|
||||
|
||||
if (PhiBias == false) // Phi is not biased
|
||||
if (!PhiBias) // Phi is not biased
|
||||
{
|
||||
G4double rndm = G4UniformRand();
|
||||
return (rndm);
|
||||
}
|
||||
else // Phi is biased
|
||||
{
|
||||
if ( local_IPDFPhiBias.Get().val == false )
|
||||
// Phi is biased
|
||||
if ( !local_IPDFPhiBias.Get().val )
|
||||
{
|
||||
local_IPDFPhiBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (IPDFPhiBias == false)
|
||||
if (!IPDFPhiBias)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
@@ -625,7 +620,7 @@ G4double G4SPSRandomGenerator::GenRandPhi()
|
||||
G4cout << "Phi bin weight " << w[4] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFPhiBiasH.GetEnergy(rndm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4double G4SPSRandomGenerator::GenRandEnergy()
|
||||
@@ -635,18 +630,17 @@ G4double G4SPSRandomGenerator::GenRandEnergy()
|
||||
G4cout << "In GenRandEnergy" << G4endl;
|
||||
}
|
||||
|
||||
if (EnergyBias == false) // Energy is not biased
|
||||
if (!EnergyBias) // Energy is not biased
|
||||
{
|
||||
G4double rndm = G4UniformRand();
|
||||
return (rndm);
|
||||
}
|
||||
else // Energy is biased
|
||||
{
|
||||
if ( local_IPDFEnergyBias.Get().val == false )
|
||||
// Energy is biased
|
||||
if ( !local_IPDFEnergyBias.Get().val )
|
||||
{
|
||||
local_IPDFEnergyBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (IPDFEnergyBias == false)
|
||||
if (!IPDFEnergyBias)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
@@ -698,7 +692,7 @@ G4double G4SPSRandomGenerator::GenRandEnergy()
|
||||
G4cout << "Energy bin weight " << w[5] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFEnergyBiasH.GetEnergy(rndm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4double G4SPSRandomGenerator::GenRandPosTheta()
|
||||
@@ -709,18 +703,17 @@ G4double G4SPSRandomGenerator::GenRandPosTheta()
|
||||
G4cout << "Verbosity " << verbosityLevel << G4endl;
|
||||
}
|
||||
|
||||
if (PosThetaBias == false) // Theta is not biased
|
||||
if (!PosThetaBias) // Theta is not biased
|
||||
{
|
||||
G4double rndm = G4UniformRand();
|
||||
return (rndm);
|
||||
}
|
||||
else // Theta is biased
|
||||
{
|
||||
if ( local_IPDFPosThetaBias.Get().val == false )
|
||||
// Theta is biased
|
||||
if ( !local_IPDFPosThetaBias.Get().val )
|
||||
{
|
||||
local_IPDFPosThetaBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (IPDFPosThetaBias == false)
|
||||
if (!IPDFPosThetaBias)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
@@ -772,7 +765,7 @@ G4double G4SPSRandomGenerator::GenRandPosTheta()
|
||||
G4cout << "PosTheta bin weight " << w[6] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFPosThetaBiasH.GetEnergy(rndm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4double G4SPSRandomGenerator::GenRandPosPhi()
|
||||
@@ -782,18 +775,17 @@ G4double G4SPSRandomGenerator::GenRandPosPhi()
|
||||
G4cout << "In GenRandPosPhi" << G4endl;
|
||||
}
|
||||
|
||||
if (PosPhiBias == false) // PosPhi is not biased
|
||||
if (!PosPhiBias) // PosPhi is not biased
|
||||
{
|
||||
G4double rndm = G4UniformRand();
|
||||
return (rndm);
|
||||
}
|
||||
else // PosPhi is biased
|
||||
{
|
||||
if (local_IPDFPosPhiBias.Get().val == false )
|
||||
// PosPhi is biased
|
||||
if (!local_IPDFPosPhiBias.Get().val )
|
||||
{
|
||||
local_IPDFPosPhiBias.Get().val = true;
|
||||
G4AutoLock l(&mutex);
|
||||
if (IPDFPosPhiBias == false)
|
||||
if (!IPDFPosPhiBias)
|
||||
{
|
||||
// IPDF has not been created, so create it
|
||||
//
|
||||
@@ -845,5 +837,5 @@ G4double G4SPSRandomGenerator::GenRandPosPhi()
|
||||
G4cout << "PosPhi bin weight " << w[7] << " " << rndm << G4endl;
|
||||
}
|
||||
return (IPDFPosPhiBiasH.GetEnergy(rndm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ void G4SingleParticleSource::GeneratePrimaryVertex(G4Event* evt)
|
||||
pp.position = posGenerator->GenerateOne();
|
||||
|
||||
// Create a new vertex
|
||||
G4PrimaryVertex* vertex = new G4PrimaryVertex(pp.position,time);
|
||||
auto* vertex = new G4PrimaryVertex(pp.position,time);
|
||||
|
||||
for (G4int i=0; i<NumberOfParticlesToBeGenerated; ++i)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ void G4SingleParticleSource::GeneratePrimaryVertex(G4Event* evt)
|
||||
// Create new primaries and set them to the vertex
|
||||
//
|
||||
G4double mass = definition->GetPDGMass();
|
||||
G4PrimaryParticle* particle = new G4PrimaryParticle(definition);
|
||||
auto* particle = new G4PrimaryParticle(definition);
|
||||
particle->SetKineticEnergy(pp.energy );
|
||||
particle->SetMass( mass );
|
||||
particle->SetMomentumDirection( pp.momentum_direction );
|
||||
|
||||
@@ -44,8 +44,7 @@ void G4SmartTrackStack::dumpStatistics()
|
||||
G4cerr << G4endl;
|
||||
}
|
||||
|
||||
G4SmartTrackStack::G4SmartTrackStack()
|
||||
: fTurn(0), nTurn(5), maxNTracks(0), nTracks(0)
|
||||
G4SmartTrackStack::G4SmartTrackStack()
|
||||
{
|
||||
for(G4int i=0; i<nTurn; ++i)
|
||||
{
|
||||
@@ -56,17 +55,17 @@ G4SmartTrackStack::G4SmartTrackStack()
|
||||
|
||||
G4SmartTrackStack::~G4SmartTrackStack()
|
||||
{
|
||||
for (G4int i=0; i<nTurn; ++i)
|
||||
for (auto* sp : stacks)
|
||||
{
|
||||
delete stacks[i];
|
||||
delete sp;
|
||||
}
|
||||
}
|
||||
|
||||
void G4SmartTrackStack::TransferTo(G4TrackStack* aStack)
|
||||
{
|
||||
for (G4int i=0; i<nTurn; ++i)
|
||||
for (auto* sp : stacks)
|
||||
{
|
||||
stacks[i]->TransferTo(aStack);
|
||||
sp->TransferTo(aStack);
|
||||
}
|
||||
nTracks = 0;
|
||||
}
|
||||
@@ -75,21 +74,19 @@ G4StackedTrack G4SmartTrackStack::PopFromStack()
|
||||
{
|
||||
G4StackedTrack aStackedTrack;
|
||||
|
||||
if (nTracks)
|
||||
if (nTracks != 0)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (stacks[fTurn]->GetNTrack())
|
||||
if (stacks[fTurn]->GetNTrack() != 0u)
|
||||
{
|
||||
aStackedTrack = stacks[fTurn]->PopFromStack();
|
||||
energies[fTurn] -= aStackedTrack.GetTrack()->GetDynamicParticle()->GetTotalEnergy();
|
||||
--nTracks;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
fTurn = (fTurn+1) % nTurn;
|
||||
}
|
||||
|
||||
fTurn = (fTurn+1) % nTurn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +102,7 @@ void G4SmartTrackStack::PushToStack( const G4StackedTrack& aStackedTrack )
|
||||
{
|
||||
|
||||
G4int iDest = 0;
|
||||
if (aStackedTrack.GetTrack()->GetParentID())
|
||||
if (aStackedTrack.GetTrack()->GetParentID() != 0)
|
||||
{
|
||||
G4int code = aStackedTrack.GetTrack()->GetDynamicParticle()->GetPDGcode();
|
||||
if (code == electronCode)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user