Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -68,17 +68,17 @@ class G4CsvAnalysisReader : public G4ToolsAnalysisReader
|
||||
protected:
|
||||
// virtual methods from base class
|
||||
virtual G4int ReadH1Impl(const G4String& h1Name, const G4String& fileName,
|
||||
G4bool isUserFileName) final;
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
virtual G4int ReadH2Impl(const G4String& h2Name, const G4String& fileName,
|
||||
G4bool isUserFileName) final;
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
virtual G4int ReadH3Impl(const G4String& h3Name, const G4String& fileName,
|
||||
G4bool isUserFileName) final;
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
virtual G4int ReadP1Impl(const G4String& p1Name, const G4String& fileName,
|
||||
G4bool isUserFileName) final;
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
virtual G4int ReadP2Impl(const G4String& p2Name, const G4String& fileName,
|
||||
G4bool isUserFileName) final;
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
virtual G4int ReadNtupleImpl(const G4String& ntupleName, const G4String& fileName,
|
||||
G4bool isUserFileName) final;
|
||||
const G4String& dirName, G4bool isUserFileName) final;
|
||||
|
||||
private:
|
||||
// static data members
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
|
||||
// Structure containing the information related to rroot ntuple
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 09/04/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4CsvRNtupleDescription_h
|
||||
#define G4CsvRNtupleDescription_h 1
|
||||
|
||||
#include "tools/rcsv_ntuple"
|
||||
#include "tools/ntuple_binding"
|
||||
|
||||
namespace tools {
|
||||
class ntuple_binding;
|
||||
}
|
||||
|
||||
struct G4CsvRNtupleDescription
|
||||
{
|
||||
G4CsvRNtupleDescription(
|
||||
tools::rcsv::ntuple* rntuple)
|
||||
: fNtuple(rntuple),
|
||||
fNtupleBinding(new tools::ntuple_binding()),
|
||||
fIsInitialized(false) {}
|
||||
|
||||
~G4CsvRNtupleDescription()
|
||||
{
|
||||
delete fNtupleBinding;
|
||||
delete fNtuple; // CHECK
|
||||
}
|
||||
|
||||
// deleted copy constructor
|
||||
G4CsvRNtupleDescription(const G4CsvRNtupleDescription& rhs) = delete;
|
||||
// deleted assignement operator
|
||||
G4CsvRNtupleDescription& operator=(G4CsvRNtupleDescription& rhs) = delete;
|
||||
|
||||
tools::rcsv::ntuple* fNtuple;
|
||||
tools::ntuple_binding* fNtupleBinding;
|
||||
G4bool fIsInitialized;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -33,87 +33,24 @@
|
||||
#ifndef G4CsvRNtupleManager_h
|
||||
#define G4CsvRNtupleManager_h 1
|
||||
|
||||
#include "G4VRNtupleManager.hh"
|
||||
#include "G4TRNtupleManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/rcsv_ntuple"
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct G4CsvRNtupleDescription;
|
||||
|
||||
class G4CsvRNtupleManager : public G4VRNtupleManager
|
||||
class G4CsvRNtupleManager : public G4TRNtupleManager<tools::rcsv::ntuple>
|
||||
{
|
||||
friend class G4CsvAnalysisReader;
|
||||
|
||||
protected:
|
||||
explicit G4CsvRNtupleManager(const G4AnalysisManagerState& state);
|
||||
virtual ~G4CsvRNtupleManager();
|
||||
|
||||
// Methods to manipulate ntuples
|
||||
G4bool IsEmpty() const;
|
||||
G4bool Reset();
|
||||
|
||||
// Access methods
|
||||
tools::rcsv::ntuple* GetNtuple() const;
|
||||
tools::rcsv::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
|
||||
// Functions independent from the output type
|
||||
//
|
||||
// Methods to read ntuple from a file
|
||||
G4int SetNtuple(G4CsvRNtupleDescription* rntupleDescription);
|
||||
// Methods for ntuple with id = FirstNtupleId
|
||||
virtual G4bool SetNtupleIColumn(const G4String& columnName,
|
||||
G4int& value);
|
||||
virtual G4bool SetNtupleFColumn(const G4String& columnName,
|
||||
G4float& value);
|
||||
virtual G4bool SetNtupleDColumn(const G4String& columnName,
|
||||
G4double& value);
|
||||
virtual G4bool SetNtupleSColumn(const G4String& columnName,
|
||||
G4String& value);
|
||||
// Bind the ntuple columns of vector type
|
||||
virtual G4bool SetNtupleIColumn(const G4String& columnName,
|
||||
std::vector<G4int>& vector);
|
||||
virtual G4bool SetNtupleFColumn(const G4String& columnName,
|
||||
std::vector<G4float>& vector);
|
||||
virtual G4bool SetNtupleDColumn(const G4String& columnName,
|
||||
std::vector<G4double>& vector);
|
||||
// Methods for ntuple with id > FirstNtupleId
|
||||
virtual G4bool SetNtupleIColumn(G4int ntupleId,
|
||||
const G4String& columnName, G4int& value);
|
||||
virtual G4bool SetNtupleFColumn(G4int ntupleId,
|
||||
const G4String& columnName, G4float& value);
|
||||
virtual G4bool SetNtupleDColumn(G4int ntupleId,
|
||||
const G4String& columnName, G4double& value);
|
||||
virtual G4bool SetNtupleSColumn(G4int ntupleId,
|
||||
const G4String& columnName, G4String& value);
|
||||
// Bind the ntuple columns of vector type
|
||||
virtual G4bool SetNtupleIColumn(G4int ntupleId, const G4String& columnName,
|
||||
std::vector<G4int>& vector);
|
||||
virtual G4bool SetNtupleFColumn(G4int ntupleId, const G4String& columnName,
|
||||
std::vector<G4float>& vector);
|
||||
virtual G4bool SetNtupleDColumn(G4int ntupleId, const G4String& columnName,
|
||||
std::vector<G4double>& vector);
|
||||
virtual G4bool GetNtupleRow();
|
||||
virtual G4bool GetNtupleRow(G4int ntupleId) ;
|
||||
|
||||
// Access methods
|
||||
virtual G4int GetNofNtuples() const;
|
||||
|
||||
private:
|
||||
// methods
|
||||
G4CsvRNtupleDescription* GetNtupleInFunction(G4int id,
|
||||
G4String function,
|
||||
G4bool warn = true) const;
|
||||
|
||||
// data members
|
||||
std::vector<G4CsvRNtupleDescription*> fNtupleVector;
|
||||
// Methods from the templated base class
|
||||
//
|
||||
virtual G4bool GetTNtupleRow(G4TRNtupleDescription<tools::rcsv::ntuple>* ntupleDescription) final;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline G4int G4CsvRNtupleManager::GetNofNtuples() const
|
||||
{ return fNtupleVector.size(); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 15/07/2013
|
||||
#
|
||||
# $Id: sources.cmake 92688 2015-09-14 07:01:13Z gcosmo $
|
||||
# $Id: sources.cmake 105338 2017-07-21 09:14:27Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -38,7 +38,6 @@ GEANT4_DEFINE_MODULE(NAME G4csv
|
||||
G4CsvFileManager.hh
|
||||
G4CsvNtupleManager.hh
|
||||
G4CsvRFileManager.hh
|
||||
G4CsvRNtupleDescription.hh
|
||||
G4CsvRNtupleManager.hh
|
||||
g4csv_defs.hh
|
||||
g4csv.hh
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "G4CsvAnalysisReader.hh"
|
||||
#include "G4CsvRFileManager.hh"
|
||||
#include "G4CsvRNtupleManager.hh"
|
||||
#include "G4CsvRNtupleDescription.hh"
|
||||
#include "G4AnalysisVerbose.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "G4Threading.hh"
|
||||
@@ -177,6 +176,7 @@ G4bool G4CsvAnalysisReader::Reset()
|
||||
//_____________________________________________________________________________
|
||||
G4int G4CsvAnalysisReader::ReadH1Impl(const G4String& h1Name,
|
||||
const G4String& fileName,
|
||||
const G4String& /*dirName*/,
|
||||
G4bool isUserFileName)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
@@ -218,6 +218,7 @@ G4int G4CsvAnalysisReader::ReadH1Impl(const G4String& h1Name,
|
||||
//_____________________________________________________________________________
|
||||
G4int G4CsvAnalysisReader::ReadH2Impl(const G4String& h2Name,
|
||||
const G4String& fileName,
|
||||
const G4String& /*dirName*/,
|
||||
G4bool isUserFileName)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
@@ -259,6 +260,7 @@ G4int G4CsvAnalysisReader::ReadH2Impl(const G4String& h2Name,
|
||||
//_____________________________________________________________________________
|
||||
G4int G4CsvAnalysisReader::ReadH3Impl(const G4String& h3Name,
|
||||
const G4String& fileName,
|
||||
const G4String& /*dirName*/,
|
||||
G4bool isUserFileName)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
@@ -300,6 +302,7 @@ G4int G4CsvAnalysisReader::ReadH3Impl(const G4String& h3Name,
|
||||
//_____________________________________________________________________________
|
||||
G4int G4CsvAnalysisReader::ReadP1Impl(const G4String& p1Name,
|
||||
const G4String& fileName,
|
||||
const G4String& /*dirName*/,
|
||||
G4bool isUserFileName)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
@@ -341,6 +344,7 @@ G4int G4CsvAnalysisReader::ReadP1Impl(const G4String& p1Name,
|
||||
//_____________________________________________________________________________
|
||||
G4int G4CsvAnalysisReader::ReadP2Impl(const G4String& p2Name,
|
||||
const G4String& fileName,
|
||||
const G4String& /*dirName*/,
|
||||
G4bool isUserFileName)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
@@ -383,6 +387,7 @@ G4int G4CsvAnalysisReader::ReadP2Impl(const G4String& p2Name,
|
||||
//_____________________________________________________________________________
|
||||
G4int G4CsvAnalysisReader::ReadNtupleImpl(const G4String& ntupleName,
|
||||
const G4String& fileName,
|
||||
const G4String& /*dirName*/,
|
||||
G4bool isUserFileName)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
@@ -404,7 +409,7 @@ G4int G4CsvAnalysisReader::ReadNtupleImpl(const G4String& ntupleName,
|
||||
|
||||
// Create ntuple
|
||||
auto rntuple = new tools::rcsv::ntuple(*ntupleFile);
|
||||
auto id = fNtupleManager->SetNtuple(new G4CsvRNtupleDescription(rntuple));
|
||||
auto id = fNtupleManager->SetNtuple(new G4TRNtupleDescription<tools::rcsv::ntuple>(rntuple));
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() )
|
||||
|
||||
@@ -28,393 +28,30 @@
|
||||
// Author: Ivana Hrivnacova, 25/07/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4CsvRNtupleManager.hh"
|
||||
#include "G4CsvRNtupleDescription.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4CsvRNtupleManager::G4CsvRNtupleManager(const G4AnalysisManagerState& state)
|
||||
: G4VRNtupleManager(state),
|
||||
fNtupleVector()
|
||||
{
|
||||
}
|
||||
: G4TRNtupleManager<tools::rcsv::ntuple>(state)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4CsvRNtupleManager::~G4CsvRNtupleManager()
|
||||
{
|
||||
std::vector<G4CsvRNtupleDescription*>::iterator it;
|
||||
for (it = fNtupleVector.begin(); it != fNtupleVector.end(); it++ ) {
|
||||
delete (*it);
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4CsvRNtupleDescription* G4CsvRNtupleManager::GetNtupleInFunction(G4int id,
|
||||
G4String functionName, G4bool warn) const
|
||||
{
|
||||
G4int index = id - fFirstId;
|
||||
if ( index < 0 || index >= G4int(fNtupleVector.size()) ) {
|
||||
if ( warn) {
|
||||
G4String inFunction = "G4CsvRNtupleManager::";
|
||||
inFunction += functionName;
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntuple " << id << " does not exist.";
|
||||
G4Exception(inFunction, "Analysis_WR011", JustWarning, description);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return fNtupleVector[index];
|
||||
}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::IsEmpty() const
|
||||
G4bool G4CsvRNtupleManager::GetTNtupleRow(
|
||||
G4TRNtupleDescription<tools::rcsv::ntuple>* ntupleDescription)
|
||||
{
|
||||
return ! fNtupleVector.size();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::Reset()
|
||||
{
|
||||
// Reset ntuples
|
||||
auto ntuple = ntupleDescription->fNtuple;
|
||||
|
||||
std::vector<G4CsvRNtupleDescription*>::iterator it;
|
||||
for (it = fNtupleVector.begin(); it != fNtupleVector.end(); it++ ) {
|
||||
// ntuple is deleted automatically when file is closed
|
||||
// delete (*it)->fNtuple;
|
||||
(*it)->fNtuple=0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::rcsv::ntuple* G4CsvRNtupleManager::GetNtuple() const
|
||||
{
|
||||
return GetNtuple(fFirstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::rcsv::ntuple* G4CsvRNtupleManager::GetNtuple(G4int ntupleId) const
|
||||
{
|
||||
G4CsvRNtupleDescription* rntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "GetNtuple");
|
||||
|
||||
if ( ! rntupleDescription ) return nullptr;
|
||||
|
||||
return rntupleDescription->fNtuple;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4CsvRNtupleManager::SetNtuple(G4CsvRNtupleDescription* rntupleDescription)
|
||||
{
|
||||
G4int id = fNtupleVector.size() + fFirstId;
|
||||
|
||||
fNtupleVector.push_back(rntupleDescription);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleIColumn(const G4String& columnName,
|
||||
G4int& value)
|
||||
{
|
||||
return SetNtupleIColumn(fFirstId, columnName, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleFColumn(const G4String& columnName,
|
||||
G4float& value)
|
||||
{
|
||||
return SetNtupleFColumn(fFirstId, columnName, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleDColumn(const G4String& columnName,
|
||||
G4double& value)
|
||||
{
|
||||
return SetNtupleDColumn(fFirstId, columnName, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleIColumn(const G4String& columnName,
|
||||
std::vector<G4int>& vector)
|
||||
{
|
||||
return SetNtupleIColumn(fFirstId, columnName, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleFColumn(const G4String& columnName,
|
||||
std::vector<G4float>& vector)
|
||||
{
|
||||
return SetNtupleFColumn(fFirstId, columnName, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleDColumn(const G4String& columnName,
|
||||
std::vector<G4double>& vector)
|
||||
{
|
||||
return SetNtupleDColumn(fFirstId, columnName, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleSColumn(const G4String& columnName,
|
||||
G4String& value)
|
||||
{
|
||||
return SetNtupleSColumn(fFirstId, columnName, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleIColumn(G4int ntupleId,
|
||||
const G4String& columnName,
|
||||
G4int& value)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL4()->Message("set", "ntuple I column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4CsvRNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "SetNtupleIColumn");
|
||||
if ( ! ntupleDescription ) return false;
|
||||
|
||||
tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
ntupleBinding->add_column(columnName, value);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL2()->Message("set", "ntuple I colum", description, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleFColumn(G4int ntupleId,
|
||||
const G4String& columnName,
|
||||
G4float& value)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL4()->Message("set", "ntuple F column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4CsvRNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "SetNtupleFColumn");
|
||||
if ( ! ntupleDescription ) return false;
|
||||
|
||||
tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
ntupleBinding->add_column(columnName, value);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL2()->Message("set", "ntuple F colum", description, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleDColumn(G4int ntupleId,
|
||||
const G4String& columnName,
|
||||
G4double& value)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL4()->Message("set", "ntuple D column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4CsvRNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "SetNtupleDColumn");
|
||||
if ( ! ntupleDescription ) return false;
|
||||
|
||||
tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
ntupleBinding->add_column(columnName, value);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL2()->Message("set", "ntuple D colum", description, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleIColumn(G4int ntupleId,
|
||||
const G4String& columnName,
|
||||
std::vector<G4int>& vector)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL4()->Message("set", "ntuple I column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4CsvRNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "SetNtupleIColumn");
|
||||
if ( ! ntupleDescription ) return false;
|
||||
|
||||
tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
ntupleBinding->add_column(columnName, vector);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL2()->Message("set", "ntuple I colum", description, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleFColumn(G4int ntupleId,
|
||||
const G4String& columnName,
|
||||
std::vector<G4float>& vector)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL4()->Message("set", "ntuple F column of vector", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4CsvRNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "SetNtupleFColumn");
|
||||
if ( ! ntupleDescription ) return false;
|
||||
|
||||
tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
ntupleBinding->add_column(columnName, vector);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL2()->Message("set", "ntuple F colum", description, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleDColumn(G4int ntupleId,
|
||||
const G4String& columnName,
|
||||
std::vector<G4double>& vector)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL4()->Message("set", "ntuple D column of vector", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4CsvRNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "SetNtupleDColumn");
|
||||
if ( ! ntupleDescription ) return false;
|
||||
|
||||
tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
ntupleBinding->add_column(columnName, vector);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL2()->Message("set", "ntuple D colum", description, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::SetNtupleSColumn(G4int ntupleId,
|
||||
const G4String& columnName,
|
||||
G4String& value)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL4()->Message("set", "ntuple S column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4CsvRNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "SetNtupleSColumn");
|
||||
if ( ! ntupleDescription ) return false;
|
||||
|
||||
tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
ntupleBinding->add_column(columnName, value);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId << " " << columnName;
|
||||
fState.GetVerboseL2()->Message("set", "ntuple S colum", description, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::GetNtupleRow()
|
||||
{
|
||||
return GetNtupleRow(fFirstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4CsvRNtupleManager::GetNtupleRow(G4int ntupleId)
|
||||
{
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL4()->Message("get", "ntuple row", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4CsvRNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "GetNtupleRow");
|
||||
if ( ! ntupleDescription ) return false;
|
||||
|
||||
tools::rcsv::ntuple* ntuple = ntupleDescription->fNtuple;
|
||||
|
||||
G4bool isInitialized = ntupleDescription->fIsInitialized;
|
||||
auto isInitialized = ntupleDescription->fIsInitialized;
|
||||
if ( ! isInitialized ) {
|
||||
tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
auto ntupleBinding = ntupleDescription->fNtupleBinding;
|
||||
if ( ! ntuple->initialize(G4cout, *ntupleBinding) ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
@@ -428,26 +65,18 @@ G4bool G4CsvRNtupleManager::GetNtupleRow(G4int ntupleId)
|
||||
ntuple->start();
|
||||
}
|
||||
|
||||
G4bool next = ntuple->next();
|
||||
auto next = ntuple->next();
|
||||
if ( next ) {
|
||||
if ( ! ntuple->get_row() ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "Ntuple get_row() failed !!";
|
||||
G4Exception("G4CsvRNtuple::GetNtupleRow()",
|
||||
G4Exception("G4CsvRNtuple::GetTNtupleRow()",
|
||||
"Analysis_WR021", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL2()->Message("get", "ntuple row", description, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user