Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -51,9 +51,9 @@ G4BaseFileManager::~G4BaseFileManager()
|
||||
G4String G4BaseFileManager::TakeOffExtension(G4String& name) const
|
||||
{
|
||||
G4String extension;
|
||||
if ( name.find(".") != std::string::npos ) {
|
||||
extension = name.substr(name.find("."));
|
||||
name = name.substr(0, name.find("."));
|
||||
if ( name.rfind(".") != std::string::npos ) {
|
||||
extension = name.substr(name.rfind("."));
|
||||
name = name.substr(0, name.rfind("."));
|
||||
}
|
||||
else {
|
||||
extension = ".";
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 20/07/2017 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4BaseNtupleManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4BaseNtupleManager::G4BaseNtupleManager(const G4AnalysisManagerState& state)
|
||||
: G4VNtupleManager(state),
|
||||
fFirstNtupleColumnId(0),
|
||||
fLockFirstNtupleColumnId(false)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4BaseNtupleManager::~G4BaseNtupleManager()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4BaseNtupleManager::GetCurrentNtupleId() const
|
||||
{
|
||||
return GetNofNtupleBookings() + fFirstId - 1;
|
||||
}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4BaseNtupleManager::CreateNtupleIColumn(const G4String& name,
|
||||
std::vector<int>* vector)
|
||||
{
|
||||
return CreateNtupleIColumn(GetCurrentNtupleId(), name, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4BaseNtupleManager::CreateNtupleFColumn(const G4String& name,
|
||||
std::vector<float>* vector)
|
||||
{
|
||||
return CreateNtupleFColumn(GetCurrentNtupleId(), name, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4BaseNtupleManager::CreateNtupleDColumn(const G4String& name,
|
||||
std::vector<double>* vector)
|
||||
{
|
||||
return CreateNtupleDColumn(GetCurrentNtupleId(), name, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4BaseNtupleManager::CreateNtupleSColumn(const G4String& name)
|
||||
{
|
||||
return CreateNtupleSColumn(GetCurrentNtupleId(), name);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4BaseNtupleManager::FinishNtuple()
|
||||
{
|
||||
return FinishNtuple(GetCurrentNtupleId());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseNtupleManager::FillNtupleIColumn(G4int id, G4int value)
|
||||
{
|
||||
return FillNtupleIColumn(fFirstId, id, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseNtupleManager::FillNtupleFColumn(G4int id, G4float value)
|
||||
{
|
||||
return FillNtupleFColumn(fFirstId, id, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseNtupleManager::FillNtupleDColumn(G4int id, G4double value)
|
||||
{
|
||||
return FillNtupleDColumn(fFirstId, id, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseNtupleManager::FillNtupleSColumn(G4int id, const G4String& value)
|
||||
{
|
||||
return FillNtupleSColumn(fFirstId, id, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseNtupleManager::AddNtupleRow()
|
||||
{
|
||||
return AddNtupleRow(fFirstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseNtupleManager::SetFirstNtupleColumnId(G4int firstId)
|
||||
{
|
||||
if ( fLockFirstNtupleColumnId ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Cannot set FirstNtupleColumnId as its value was already used.";
|
||||
G4Exception("G4BaseNtupleManager::SetFirstNtupleColumnId()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
fFirstNtupleColumnId = firstId;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 20/07/2017 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4BaseRNtupleManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4BaseRNtupleManager::G4BaseRNtupleManager(const G4AnalysisManagerState& state)
|
||||
: G4VRNtupleManager(state)
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4BaseRNtupleManager::~G4BaseRNtupleManager()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
//_____________________________________________________________________________
|
||||
G4int G4BaseRNtupleManager::GetCurrentNtupleId() const
|
||||
{
|
||||
return GetNofNtuples() + fFirstId - 1;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseRNtupleManager::SetNtupleIColumn(const G4String& columnName,
|
||||
G4int& value)
|
||||
{
|
||||
return SetNtupleIColumn(GetCurrentNtupleId(), columnName, value);
|
||||
}
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseRNtupleManager::SetNtupleFColumn(const G4String& columnName,
|
||||
G4float& value)
|
||||
{
|
||||
return SetNtupleFColumn(GetCurrentNtupleId(), columnName, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseRNtupleManager::SetNtupleDColumn(const G4String& columnName,
|
||||
G4double& value)
|
||||
{
|
||||
return SetNtupleDColumn(GetCurrentNtupleId(), columnName, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseRNtupleManager::SetNtupleSColumn(const G4String& columnName,
|
||||
G4String& value)
|
||||
{
|
||||
return SetNtupleSColumn(GetCurrentNtupleId(), columnName, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseRNtupleManager::SetNtupleIColumn(const G4String& columnName,
|
||||
std::vector<G4int>& vector)
|
||||
{
|
||||
return SetNtupleIColumn(GetCurrentNtupleId(), columnName, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseRNtupleManager::SetNtupleFColumn(const G4String& columnName,
|
||||
std::vector<G4float>& vector)
|
||||
{
|
||||
return SetNtupleFColumn(GetCurrentNtupleId(), columnName, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseRNtupleManager::SetNtupleDColumn(const G4String& columnName,
|
||||
std::vector<G4double>& vector)
|
||||
{
|
||||
return SetNtupleDColumn(GetCurrentNtupleId(), columnName, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4BaseRNtupleManager::GetNtupleRow()
|
||||
{
|
||||
return GetNtupleRow(fFirstId);
|
||||
}
|
||||
@@ -122,10 +122,11 @@ G4String G4VAnalysisReader::GetFileName() const
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::ReadH1(const G4String& h1Name,
|
||||
const G4String& fileName)
|
||||
const G4String& fileName,
|
||||
const G4String& dirName)
|
||||
{
|
||||
if ( fileName != "" ) {
|
||||
return ReadH1Impl(h1Name, fileName, true);
|
||||
return ReadH1Impl(h1Name, fileName, dirName, true);
|
||||
}
|
||||
else {
|
||||
if ( fFileManager->GetFileName() == "" ) {
|
||||
@@ -136,16 +137,17 @@ G4int G4VAnalysisReader::ReadH1(const G4String& h1Name,
|
||||
"Analysis_WR011", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
return ReadH1Impl(h1Name, fFileManager->GetFileName(), false);
|
||||
return ReadH1Impl(h1Name, fFileManager->GetFileName(), dirName, false);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::ReadH2(const G4String& h2Name,
|
||||
const G4String& fileName)
|
||||
const G4String& fileName,
|
||||
const G4String& dirName)
|
||||
{
|
||||
if ( fileName != "" ) {
|
||||
return ReadH2Impl(h2Name, fileName, true);
|
||||
return ReadH2Impl(h2Name, fileName, dirName, true);
|
||||
}
|
||||
else {
|
||||
if ( fFileManager->GetFileName() == "" ) {
|
||||
@@ -156,16 +158,17 @@ G4int G4VAnalysisReader::ReadH2(const G4String& h2Name,
|
||||
"Analysis_WR011", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
return ReadH2Impl(h2Name, fFileManager->GetFileName(), false);
|
||||
return ReadH2Impl(h2Name, fFileManager->GetFileName(), dirName, false);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::ReadH3(const G4String& h3Name,
|
||||
const G4String& fileName)
|
||||
const G4String& fileName,
|
||||
const G4String& dirName)
|
||||
{
|
||||
if ( fileName != "" ) {
|
||||
return ReadH3Impl(h3Name, fileName, true);
|
||||
return ReadH3Impl(h3Name, fileName, dirName, true);
|
||||
}
|
||||
else {
|
||||
if ( fFileManager->GetFileName() == "" ) {
|
||||
@@ -176,16 +179,17 @@ G4int G4VAnalysisReader::ReadH3(const G4String& h3Name,
|
||||
"Analysis_WR011", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
return ReadH3Impl(h3Name, fFileManager->GetFileName(), false);
|
||||
return ReadH3Impl(h3Name, fFileManager->GetFileName(), dirName, false);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::ReadP1(const G4String& p1Name,
|
||||
const G4String& fileName)
|
||||
const G4String& fileName,
|
||||
const G4String& dirName)
|
||||
{
|
||||
if ( fileName != "" ) {
|
||||
return ReadP1Impl(p1Name, fileName, true);
|
||||
return ReadP1Impl(p1Name, fileName, dirName, true);
|
||||
}
|
||||
else {
|
||||
if ( fFileManager->GetFileName() == "" ) {
|
||||
@@ -196,16 +200,17 @@ G4int G4VAnalysisReader::ReadP1(const G4String& p1Name,
|
||||
"Analysis_WR011", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
return ReadP1Impl(p1Name, fFileManager->GetFileName(), false);
|
||||
return ReadP1Impl(p1Name, fFileManager->GetFileName(), dirName, false);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::ReadP2(const G4String& p2Name,
|
||||
const G4String& fileName)
|
||||
const G4String& fileName,
|
||||
const G4String& dirName)
|
||||
{
|
||||
if ( fileName != "" ) {
|
||||
return ReadP2Impl(p2Name, fileName, true);
|
||||
return ReadP2Impl(p2Name, fileName, dirName, true);
|
||||
}
|
||||
else {
|
||||
if ( fFileManager->GetFileName() == "" ) {
|
||||
@@ -216,7 +221,7 @@ G4int G4VAnalysisReader::ReadP2(const G4String& p2Name,
|
||||
"Analysis_WR011", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
return ReadP2Impl(p2Name, fFileManager->GetFileName(), false);
|
||||
return ReadP2Impl(p2Name, fFileManager->GetFileName(), dirName, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,12 +294,14 @@ G4bool G4VAnalysisReader::SetFirstNtupleId(G4int firstId)
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::GetNtuple(const G4String& ntupleName,
|
||||
const G4String& fileName)
|
||||
const G4String& fileName,
|
||||
const G4String& dirName)
|
||||
{
|
||||
if ( fileName != "" ) {
|
||||
return ReadNtupleImpl(ntupleName, fileName, true);
|
||||
return ReadNtupleImpl(ntupleName, fileName, dirName, true);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
// Check if fileName was set
|
||||
if ( fFileManager->GetFileName() == "" ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
@@ -303,7 +310,7 @@ G4int G4VAnalysisReader::GetNtuple(const G4String& ntupleName,
|
||||
"Analysis_WR011", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
return ReadNtupleImpl(ntupleName, fFileManager->GetFileName(), false);
|
||||
return ReadNtupleImpl(ntupleName, fFileManager->GetFileName(), dirName, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,60 +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: G4VNtupleManager.cc 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4VNtupleManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VNtupleManager::G4VNtupleManager(const G4AnalysisManagerState& state)
|
||||
: G4BaseAnalysisManager(state),
|
||||
fFirstNtupleColumnId(0),
|
||||
fLockFirstNtupleColumnId(false)
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VNtupleManager::~G4VNtupleManager()
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VNtupleManager::SetFirstNtupleColumnId(G4int firstId)
|
||||
{
|
||||
if ( fLockFirstNtupleColumnId ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Cannot set FirstNtupleColumnId as its value was already used.";
|
||||
G4Exception("G4VNtupleManager::SetFirstNtupleColumnId()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
fFirstNtupleColumnId = firstId;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user