Import Geant4 11.3.0.beta source tree
This commit is contained in:
+10
-10
@@ -37,33 +37,33 @@
|
||||
|
||||
class G4RootMpiNtupleFileManager;
|
||||
|
||||
namespace tools {
|
||||
class impi;
|
||||
}
|
||||
namespace tools
|
||||
{
|
||||
class impi;
|
||||
}
|
||||
|
||||
class G4RootMpiAnalysisManager : public G4RootAnalysisManager
|
||||
class G4RootMpiAnalysisManager : public G4RootAnalysisManager
|
||||
{
|
||||
public:
|
||||
explicit G4RootMpiAnalysisManager(G4bool isMaster = true);
|
||||
virtual ~G4RootMpiAnalysisManager();
|
||||
|
||||
|
||||
// Static methods
|
||||
static G4RootMpiAnalysisManager* Instance();
|
||||
|
||||
// MPI
|
||||
void SetMpiNtupleMerging(tools::impi* impi,
|
||||
G4int mpiRank, G4int mpiSize,
|
||||
void SetMpiNtupleMerging(tools::impi* impi, G4int mpiRank, G4int mpiSize,
|
||||
G4int nofReducedNtupleFiles = 0);
|
||||
|
||||
protected:
|
||||
// virtual methods from base class
|
||||
virtual G4bool OpenFileImpl(const G4String& fileName) final;
|
||||
virtual G4bool WriteImpl() final;
|
||||
virtual G4bool CloseFileImpl(G4bool reset) final;
|
||||
virtual G4bool WriteImpl() final;
|
||||
virtual G4bool CloseFileImpl(G4bool reset) final;
|
||||
|
||||
private:
|
||||
// Static data members
|
||||
inline static G4RootMpiAnalysisManager* fgInstance { nullptr };
|
||||
inline static G4RootMpiAnalysisManager* fgInstance{nullptr};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+11
-11
@@ -38,25 +38,25 @@
|
||||
class G4RootMpiNtupleManager;
|
||||
class G4RootMpiPNtupleManager;
|
||||
|
||||
namespace tools {
|
||||
class impi;
|
||||
}
|
||||
namespace tools
|
||||
{
|
||||
class impi;
|
||||
}
|
||||
|
||||
class G4RootMpiNtupleFileManager : public G4RootNtupleFileManager
|
||||
class G4RootMpiNtupleFileManager : public G4RootNtupleFileManager
|
||||
{
|
||||
public:
|
||||
explicit G4RootMpiNtupleFileManager(const G4AnalysisManagerState& state);
|
||||
virtual ~G4RootMpiNtupleFileManager();
|
||||
|
||||
|
||||
// MPI
|
||||
void SetMpiNtupleMerging(tools::impi* impi,
|
||||
G4int mpiRank, G4int mpiSize,
|
||||
void SetMpiNtupleMerging(tools::impi* impi, G4int mpiRank, G4int mpiSize,
|
||||
G4int nofReducedNtupleFiles = 0);
|
||||
|
||||
// virtual methods from base class
|
||||
virtual G4bool ActionAtOpenFile(const G4String& fileName) final;
|
||||
virtual G4bool ActionAtWrite() final;
|
||||
virtual G4bool ActionAtCloseFile() final;
|
||||
virtual G4bool ActionAtCloseFile() final;
|
||||
virtual G4bool Reset() final;
|
||||
|
||||
virtual std::shared_ptr<G4VNtupleManager> CreateNtupleManager() override;
|
||||
@@ -68,12 +68,12 @@ class G4RootMpiNtupleFileManager : public G4RootNtupleFileManager
|
||||
void SetMpiNtupleMergingMode(G4int nofNtupleFiles);
|
||||
void CreateMpiNtupleManagers(tools::impi* impi, G4int mpiRank, G4int mpiSize);
|
||||
|
||||
// data members
|
||||
// data members
|
||||
tools::impi* fImpi;
|
||||
G4int fMpiRank;
|
||||
G4int fMpiSize;
|
||||
// std::shared_ptr<G4RootMpiNtupleManager> fMpiNtupleManager;
|
||||
std::shared_ptr<G4RootMpiPNtupleManager> fMpiSlaveNtupleManager;
|
||||
// std::shared_ptr<G4RootMpiNtupleManager> fMpiNtupleManager;
|
||||
std::shared_ptr<G4RootMpiPNtupleManager> fMpiSlaveNtupleManager;
|
||||
G4bool fNtupleBooked;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,37 +36,35 @@
|
||||
|
||||
#include "G4RootNtupleManager.hh"
|
||||
|
||||
namespace tools {
|
||||
class impi;
|
||||
namespace tools
|
||||
{
|
||||
class impi;
|
||||
}
|
||||
|
||||
class G4RootMpiNtupleManager : public G4RootNtupleManager
|
||||
{
|
||||
public:
|
||||
G4RootMpiNtupleManager(const G4AnalysisManagerState& state,
|
||||
std::shared_ptr<G4NtupleBookingManager> bookingManger,
|
||||
G4bool rowWise, G4bool rowMode,
|
||||
tools::impi* impi, G4int mpiSize);
|
||||
std::shared_ptr<G4NtupleBookingManager> bookingManger, G4bool rowWise,
|
||||
G4bool rowMode, tools::impi* impi, G4int mpiSize);
|
||||
virtual ~G4RootMpiNtupleManager();
|
||||
|
||||
virtual void CreateNtuplesFromBooking(
|
||||
const std::vector<G4NtupleBooking*>& ntupleBookings) final;
|
||||
virtual void
|
||||
CreateNtuplesFromBooking(const std::vector<G4NtupleBooking*>& ntupleBookings) final;
|
||||
|
||||
// Methods from the templated base class
|
||||
virtual G4bool Merge() final;
|
||||
|
||||
private:
|
||||
private:
|
||||
// MPI
|
||||
G4RootFile* GetNtupleFile(G4int id);
|
||||
G4RootFile* GetNtupleFile(G4int id);
|
||||
G4bool Send(G4int id, RootNtupleDescription* ntupleDescription);
|
||||
G4bool InitializeRanks();
|
||||
G4bool WaitBuffer();
|
||||
|
||||
tools::impi* fImpi;
|
||||
std::vector<G4int> fSlaveRanks;
|
||||
tools::impi* fImpi;
|
||||
std::vector<G4int> fSlaveRanks;
|
||||
G4int fMainRank;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+55
-44
@@ -33,35 +33,35 @@
|
||||
#ifndef G4RootMpiPNtupleDescription_h
|
||||
#define G4RootMpiPNtupleDescription_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4TNtupleDescription.hh"
|
||||
#include "G4RootFileDef.hh"
|
||||
|
||||
#include "tools/ntuple_booking"
|
||||
#include "tools/impi"
|
||||
#include "tools/ntuple_booking"
|
||||
#include "tools/wroot/impi_ntuple"
|
||||
#include "tools/wroot/ntuple"
|
||||
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
#include "G4RootFileDef.hh"
|
||||
#include "G4TNtupleDescription.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
namespace tools
|
||||
{
|
||||
namespace wroot
|
||||
{
|
||||
class branch;
|
||||
class base_pntuple;
|
||||
}
|
||||
}
|
||||
} // namespace wroot
|
||||
} // namespace tools
|
||||
|
||||
using RootNtupleDescription = G4TNtupleDescription<tools::wroot::ntuple, G4RootFile>;
|
||||
|
||||
class G4RootMpiPNtupleDescription
|
||||
{
|
||||
public:
|
||||
G4RootMpiPNtupleDescription(G4NtupleBooking* g4NtupleBooking)
|
||||
: fDescription(g4NtupleBooking) {}
|
||||
G4RootMpiPNtupleDescription(G4NtupleBooking* g4NtupleBooking) : fDescription(g4NtupleBooking) {}
|
||||
|
||||
~G4RootMpiPNtupleDescription()
|
||||
{
|
||||
if ( fDescription.GetIsNtupleOwner() ) delete fNtuple;
|
||||
}
|
||||
{
|
||||
if (fDescription.GetIsNtupleOwner()) delete fNtuple;
|
||||
}
|
||||
|
||||
// Set methods
|
||||
void SetNtuple(tools::wroot::impi_ntuple* intuple);
|
||||
@@ -79,53 +79,64 @@ class G4RootMpiPNtupleDescription
|
||||
|
||||
private:
|
||||
RootNtupleDescription fDescription;
|
||||
tools::wroot::impi_ntuple* fNtuple { nullptr };
|
||||
tools::wroot::base_pntuple* fBasePNtuple { nullptr };
|
||||
tools::wroot::impi_ntuple* fNtuple{nullptr};
|
||||
tools::wroot::base_pntuple* fBasePNtuple{nullptr};
|
||||
std::vector<tools::wroot::branch*> fMainBranches;
|
||||
G4int fMainNtupleRank { 0 };
|
||||
tools::impi* fImpi { nullptr };
|
||||
G4int fMainNtupleRank{0};
|
||||
tools::impi* fImpi{nullptr};
|
||||
};
|
||||
|
||||
// inline function
|
||||
|
||||
inline void G4RootMpiPNtupleDescription::SetNtuple(
|
||||
tools::wroot::impi_ntuple* intuple)
|
||||
{ fNtuple = intuple; }
|
||||
inline void G4RootMpiPNtupleDescription::SetNtuple(tools::wroot::impi_ntuple* intuple)
|
||||
{
|
||||
fNtuple = intuple;
|
||||
}
|
||||
|
||||
inline void G4RootMpiPNtupleDescription::SetBasePNtuple(
|
||||
tools::wroot::base_pntuple* basePNtuple)
|
||||
{ fBasePNtuple = basePNtuple; }
|
||||
inline void G4RootMpiPNtupleDescription::SetBasePNtuple(tools::wroot::base_pntuple* basePNtuple)
|
||||
{
|
||||
fBasePNtuple = basePNtuple;
|
||||
}
|
||||
|
||||
inline void G4RootMpiPNtupleDescription::SetMainNtupleRank(G4int value)
|
||||
{ fMainNtupleRank = value; }
|
||||
{
|
||||
fMainNtupleRank = value;
|
||||
}
|
||||
|
||||
inline void G4RootMpiPNtupleDescription::SetImpi(tools::impi* value)
|
||||
{ fImpi = value; }
|
||||
{
|
||||
fImpi = value;
|
||||
}
|
||||
|
||||
inline void G4RootMpiPNtupleDescription::Reset()
|
||||
{
|
||||
if ( fDescription.GetIsNtupleOwner() ) delete fNtuple;
|
||||
if (fDescription.GetIsNtupleOwner()) delete fNtuple;
|
||||
fNtuple = nullptr;
|
||||
}
|
||||
|
||||
inline RootNtupleDescription&
|
||||
G4RootMpiPNtupleDescription::GetDescription()
|
||||
{ return fDescription; }
|
||||
inline RootNtupleDescription& G4RootMpiPNtupleDescription::GetDescription()
|
||||
{
|
||||
return fDescription;
|
||||
}
|
||||
|
||||
inline tools::wroot::impi_ntuple*
|
||||
G4RootMpiPNtupleDescription::GetNtuple() const
|
||||
{ return fNtuple; }
|
||||
inline tools::wroot::impi_ntuple* G4RootMpiPNtupleDescription::GetNtuple() const
|
||||
{
|
||||
return fNtuple;
|
||||
}
|
||||
|
||||
inline tools::wroot::base_pntuple*
|
||||
G4RootMpiPNtupleDescription::GetBasePNtuple() const
|
||||
{ return fBasePNtuple; }
|
||||
inline tools::wroot::base_pntuple* G4RootMpiPNtupleDescription::GetBasePNtuple() const
|
||||
{
|
||||
return fBasePNtuple;
|
||||
}
|
||||
|
||||
inline std::vector<tools::wroot::branch*>&
|
||||
G4RootMpiPNtupleDescription::GetMainBranches()
|
||||
{ return fMainBranches; }
|
||||
inline std::vector<tools::wroot::branch*>& G4RootMpiPNtupleDescription::GetMainBranches()
|
||||
{
|
||||
return fMainBranches;
|
||||
}
|
||||
|
||||
inline G4int
|
||||
G4RootMpiPNtupleDescription::GetMainNtupleRank() const
|
||||
{ return fMainNtupleRank; }
|
||||
inline G4int G4RootMpiPNtupleDescription::GetMainNtupleRank() const
|
||||
{
|
||||
return fMainNtupleRank;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+114
-121
@@ -25,7 +25,7 @@
|
||||
//
|
||||
|
||||
// Class for Root MPI pntuple management.
|
||||
// The class handles ntuples on the processing MPI ranks when MPI ntuple merging
|
||||
// The class handles ntuples on the processing MPI ranks when MPI ntuple merging
|
||||
// is activated.
|
||||
// This class is temporarily provided with g4mpi,
|
||||
// it will be integrated in Geant4 analysis category in future.
|
||||
@@ -35,36 +35,38 @@
|
||||
#ifndef G4RootMpiPNtupleManager_h
|
||||
#define G4RootMpiPNtupleManager_h 1
|
||||
|
||||
#include "G4BaseNtupleManager.hh"
|
||||
#include "G4RootMpiPNtupleDescription.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/wroot/base_pntuple"
|
||||
|
||||
#include <vector>
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "G4BaseNtupleManager.hh"
|
||||
#include "G4RootMpiPNtupleDescription.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
using std::to_string;
|
||||
|
||||
class G4RootFileManager;
|
||||
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
namespace tools
|
||||
{
|
||||
namespace wroot
|
||||
{
|
||||
class file;
|
||||
class directory;
|
||||
class impi_ntuple;
|
||||
}
|
||||
}
|
||||
} // namespace wroot
|
||||
} // namespace tools
|
||||
|
||||
class G4RootMpiPNtupleManager : public G4BaseNtupleManager
|
||||
class G4RootMpiPNtupleManager : public G4BaseNtupleManager
|
||||
{
|
||||
friend class G4RootMpiNtupleFileManager;
|
||||
friend class G4RootMpiNtupleFileManager;
|
||||
|
||||
public:
|
||||
G4RootMpiPNtupleManager(const G4AnalysisManagerState& state,
|
||||
tools::impi* impi, G4int mpiRank, G4int destinationRank);
|
||||
G4RootMpiPNtupleManager(const G4AnalysisManagerState& state, tools::impi* impi, G4int mpiRank,
|
||||
G4int destinationRank);
|
||||
~G4RootMpiPNtupleManager();
|
||||
|
||||
private:
|
||||
@@ -81,18 +83,17 @@ class G4RootMpiPNtupleManager : public G4BaseNtupleManager
|
||||
virtual G4int CreateNtuple(G4NtupleBooking* booking) final;
|
||||
|
||||
// Methods to fill ntuples
|
||||
// Methods for ntuple with id = FirstNtupleId (from base class)
|
||||
using G4BaseNtupleManager::FillNtupleIColumn;
|
||||
using G4BaseNtupleManager::FillNtupleFColumn;
|
||||
using G4BaseNtupleManager::FillNtupleDColumn;
|
||||
using G4BaseNtupleManager::FillNtupleSColumn;
|
||||
// Methods for ntuple with id = FirstNtupleId (from base class)
|
||||
using G4BaseNtupleManager::AddNtupleRow;
|
||||
// Methods for ntuple with id > FirstNtupleId (when more ntuples exist)
|
||||
using G4BaseNtupleManager::FillNtupleDColumn;
|
||||
using G4BaseNtupleManager::FillNtupleFColumn;
|
||||
using G4BaseNtupleManager::FillNtupleIColumn;
|
||||
using G4BaseNtupleManager::FillNtupleSColumn;
|
||||
// Methods for ntuple with id > FirstNtupleId (when more ntuples exist)
|
||||
virtual G4bool FillNtupleIColumn(G4int ntupleId, G4int columnId, G4int value) final;
|
||||
virtual G4bool FillNtupleFColumn(G4int ntupleId, G4int columnId, G4float value) final;
|
||||
virtual G4bool FillNtupleDColumn(G4int ntupleId, G4int columnId, G4double value) final;
|
||||
virtual G4bool FillNtupleSColumn(G4int ntupleId, G4int columnId,
|
||||
const G4String& value) final;
|
||||
virtual G4bool FillNtupleSColumn(G4int ntupleId, G4int columnId, const G4String& value) final;
|
||||
virtual G4bool AddNtupleRow(G4int ntupleId) final;
|
||||
virtual G4bool Merge() final;
|
||||
|
||||
@@ -105,9 +106,9 @@ class G4RootMpiPNtupleManager : public G4BaseNtupleManager
|
||||
|
||||
// Activation option
|
||||
//
|
||||
virtual void SetActivation(G4bool activation) final;
|
||||
virtual void SetActivation(G4int ntupleId, G4bool activation) final;
|
||||
virtual G4bool GetActivation(G4int ntupleId) const final;
|
||||
virtual void SetActivation(G4bool activation) final;
|
||||
virtual void SetActivation(G4int ntupleId, G4bool activation) final;
|
||||
virtual G4bool GetActivation(G4int ntupleId) const final;
|
||||
|
||||
// New cycle option
|
||||
void SetNewCycle(G4bool value) final;
|
||||
@@ -117,142 +118,134 @@ class G4RootMpiPNtupleManager : public G4BaseNtupleManager
|
||||
virtual G4int GetNofNtuples() const final;
|
||||
|
||||
private:
|
||||
G4RootMpiPNtupleDescription*
|
||||
GetNtupleDescriptionInFunction(G4int id, G4String function, G4bool warn = true) const;
|
||||
tools::wroot::base_pntuple*
|
||||
GetNtupleInFunction(G4int id, G4String function, G4bool warn = true) const;
|
||||
G4RootMpiPNtupleDescription* GetNtupleDescriptionInFunction(G4int id, G4String function,
|
||||
G4bool warn = true) const;
|
||||
tools::wroot::base_pntuple* GetNtupleInFunction(G4int id, G4String function,
|
||||
G4bool warn = true) const;
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
G4bool FillNtupleTColumn(G4int ntupleId, G4int columnId, const T& value);
|
||||
|
||||
// Static data members
|
||||
static constexpr std::string_view fkClass { "G4RootMpiPNtupleManager" };
|
||||
static constexpr std::string_view fkClass{"G4RootMpiPNtupleManager"};
|
||||
|
||||
// Data members
|
||||
// G4RootMpiMainNtupleManager* fMpiMainNtupleManager;
|
||||
std::shared_ptr<G4RootFileManager> fFileManager;
|
||||
std::vector<G4RootMpiPNtupleDescription*> fNtupleDescriptionVector;
|
||||
std::vector<tools::wroot::impi_ntuple*> fNtupleVector;
|
||||
tools::impi* fImpi;
|
||||
G4int fMpiRank;
|
||||
G4int fDestinationRank;
|
||||
G4bool fNewCycle { false };
|
||||
tools::impi* fImpi;
|
||||
G4int fMpiRank;
|
||||
G4int fDestinationRank;
|
||||
G4bool fNewCycle{false};
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void
|
||||
G4RootMpiPNtupleManager::SetFileManager(std::shared_ptr<G4RootFileManager> fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <>
|
||||
inline G4bool G4RootMpiPNtupleManager::FillNtupleTColumn(
|
||||
G4int ntupleId, G4int columnId, const std::string& value)
|
||||
inline void G4RootMpiPNtupleManager::SetFileManager(std::shared_ptr<G4RootFileManager> fileManager)
|
||||
{
|
||||
if ( fState.GetIsActivation() && ( ! GetActivation(ntupleId) ) ) {
|
||||
G4cout << "Skipping FillNtupleIColumn for " << ntupleId << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( IsVerbose(G4Analysis::kVL4) ) {
|
||||
Message(G4Analysis::kVL4, "fill", "pntuple T column",
|
||||
" ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) +
|
||||
" value " + G4Analysis::ToString(value));
|
||||
}
|
||||
|
||||
auto ntuple = GetNtupleInFunction(ntupleId, "FillNtupleTColumn");
|
||||
if ( ! ntuple ) return false;
|
||||
|
||||
auto index = columnId - fFirstNtupleColumnId;
|
||||
if ( index < 0 || index >= G4int(ntuple->columns().size()) ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntupleId " << ntupleId
|
||||
<< " columnId " << columnId << " does not exist.";
|
||||
G4Exception("G4RootNtupleManager::FillNtupleTColumn()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto icolumn = ntuple->columns()[index];
|
||||
auto column = dynamic_cast<tools::wroot::base_pntuple::column_string* >(icolumn);
|
||||
if ( ! column ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " Column type does not match: "
|
||||
<< " ntupleId " << ntupleId
|
||||
<< " columnId " << columnId << " value " << value;
|
||||
G4Exception("G4RootNtupleManager:FillNtupleColumn",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
column->fill(value);
|
||||
|
||||
if ( IsVerbose(G4Analysis::kVL4) ) {
|
||||
Message(G4Analysis::kVL4, "done fill", "pntuple T column",
|
||||
" ntupleId " + to_string(ntupleId) +
|
||||
" columnId " + to_string(columnId) +
|
||||
" value " + value);
|
||||
}
|
||||
|
||||
return true;
|
||||
fFileManager = fileManager;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4bool G4RootMpiPNtupleManager::FillNtupleTColumn(
|
||||
G4int ntupleId, G4int columnId, const T& value)
|
||||
template<>
|
||||
inline G4bool G4RootMpiPNtupleManager::FillNtupleTColumn(G4int ntupleId, G4int columnId,
|
||||
const std::string& value)
|
||||
{
|
||||
if ( fState.GetIsActivation() && ( ! GetActivation(ntupleId) ) ) {
|
||||
G4cout << "Skipping FillNtupleIColumn for " << ntupleId << G4endl;
|
||||
return false;
|
||||
}
|
||||
if (fState.GetIsActivation() && (!GetActivation(ntupleId))) {
|
||||
G4cout << "Skipping FillNtupleIColumn for " << ntupleId << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( IsVerbose(G4Analysis::kVL4) ) {
|
||||
if (IsVerbose(G4Analysis::kVL4)) {
|
||||
Message(G4Analysis::kVL4, "fill", "pntuple T column",
|
||||
" ntupleId " + to_string(ntupleId) +
|
||||
" columnId " + to_string(columnId) +
|
||||
" value " + G4Analysis::ToString(value));
|
||||
" ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) + " value "
|
||||
+ G4Analysis::ToString(value));
|
||||
}
|
||||
|
||||
auto ntuple = GetNtupleInFunction(ntupleId, "FillNtupleTColumn");
|
||||
if (!ntuple) return false;
|
||||
|
||||
auto index = columnId - fFirstNtupleColumnId;
|
||||
if (index < 0 || index >= G4int(ntuple->columns().size())) {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "ntupleId " << ntupleId << " columnId " << columnId << " does not exist.";
|
||||
G4Exception("G4RootNtupleManager::FillNtupleTColumn()", "Analysis_W011", JustWarning,
|
||||
description);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto icolumn = ntuple->columns()[index];
|
||||
auto column = dynamic_cast<tools::wroot::base_pntuple::column_string*>(icolumn);
|
||||
if (!column) {
|
||||
G4ExceptionDescription description;
|
||||
description << " Column type does not match: "
|
||||
<< " ntupleId " << ntupleId << " columnId " << columnId << " value " << value;
|
||||
G4Exception("G4RootNtupleManager:FillNtupleColumn", "Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
column->fill(value);
|
||||
|
||||
if (IsVerbose(G4Analysis::kVL4)) {
|
||||
Message(G4Analysis::kVL4, "done fill", "pntuple T column",
|
||||
" ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) + " value "
|
||||
+ value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template<typename T>
|
||||
G4bool G4RootMpiPNtupleManager::FillNtupleTColumn(G4int ntupleId, G4int columnId, const T& value)
|
||||
{
|
||||
if (fState.GetIsActivation() && (!GetActivation(ntupleId))) {
|
||||
G4cout << "Skipping FillNtupleIColumn for " << ntupleId << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsVerbose(G4Analysis::kVL4)) {
|
||||
Message(G4Analysis::kVL4, "fill", "pntuple T column",
|
||||
" ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) + " value "
|
||||
+ G4Analysis::ToString(value));
|
||||
}
|
||||
|
||||
// get ntuple
|
||||
auto ntuple = GetNtupleInFunction(ntupleId, "FillNtupleTColumn");
|
||||
if ( ! ntuple ) return false;
|
||||
if (!ntuple) return false;
|
||||
|
||||
// get generic column
|
||||
auto index = columnId - fFirstNtupleColumnId;
|
||||
if ( index < 0 || index >= G4int(ntuple->columns().size()) ) {
|
||||
if (index < 0 || index >= G4int(ntuple->columns().size())) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntupleId " << ntupleId
|
||||
<< " columnId " << columnId << " does not exist.";
|
||||
G4Exception("G4TNtupleManager::FillNtupleTColumn()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
description << " "
|
||||
<< "ntupleId " << ntupleId << " columnId " << columnId << " does not exist.";
|
||||
G4Exception("G4TNtupleManager::FillNtupleTColumn()", "Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
auto icolumn = ntuple->columns()[index];
|
||||
auto icolumn = ntuple->columns()[index];
|
||||
|
||||
// get column and check its type
|
||||
auto column = dynamic_cast<tools::wroot::base_pntuple::column<T>* >(icolumn);
|
||||
if ( ! column ) {
|
||||
auto column = dynamic_cast<tools::wroot::base_pntuple::column<T>*>(icolumn);
|
||||
if (!column) {
|
||||
G4ExceptionDescription description;
|
||||
description << " Column type does not match: "
|
||||
<< " ntupleId " << ntupleId
|
||||
<< " columnId " << columnId << " value " << value;
|
||||
G4Exception("G4TNtupleManager:FillNtupleTColumn",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
<< " ntupleId " << ntupleId << " columnId " << columnId << " value " << value;
|
||||
G4Exception("G4TNtupleManager:FillNtupleTColumn", "Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
column->fill(value);
|
||||
|
||||
if ( IsVerbose(G4Analysis::kVL4) ) {
|
||||
if (IsVerbose(G4Analysis::kVL4)) {
|
||||
Message(G4Analysis::kVL4, "done fill", "pntuple T column",
|
||||
" ntupleId " + to_string(ntupleId) +
|
||||
" columnId " + to_string(columnId) +
|
||||
" value " + G4Analysis::ToString(value));
|
||||
" ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) + " value "
|
||||
+ G4Analysis::ToString(value));
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user