Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
+11 -15
View File
@@ -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
View File
@@ -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
+7 -6
View File
@@ -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" };
+3 -3
View File
@@ -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>
+3 -3
View File
@@ -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;