Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RootAnalysisManager.cc 102848 2017-02-27 13:09:25Z gcosmo $
// $Id: G4RootAnalysisManager.cc 103532 2017-04-13 14:00:35Z gcosmo $
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
@@ -513,7 +513,7 @@ G4bool G4RootAnalysisManager::OpenFileImpl(const G4String& fileName)
#ifdef G4VERBOSE
if ( fState.GetVerboseL1() )
fState.GetVerboseL1()->Message("open", "analysis file", name);
fState.GetVerboseL1()->Message("open", "analysis file", name, finalResult);
#endif
}
@@ -534,7 +534,7 @@ G4bool G4RootAnalysisManager::OpenFileImpl(const G4String& fileName)
#ifdef G4VERBOSE
if ( fState.GetVerboseL1() )
fState.GetVerboseL1()->Message("open", "main analysis file", name);
fState.GetVerboseL1()->Message("open", "main analysis file", name, finalResult);
#endif
}
@@ -609,6 +609,10 @@ G4bool G4RootAnalysisManager::CloseFileImpl()
{
auto finalResult = true;
G4bool isNtupleManagerEmpty = fNtupleManager->IsEmpty();
// the ntuple decription vector is cleared on Reset()
// in kNoMergeAfterOpen ntuple manager mode
// reset data
auto result = Reset();
if ( ! result ) {
@@ -626,12 +630,12 @@ G4bool G4RootAnalysisManager::CloseFileImpl()
// No files clean-up in sequential mode
if ( ! G4Threading::IsMultithreadedApplication() ) return finalResult;
// Delete files if empty in MT mode
if ( ( fState.GetIsMaster() &&
fH1Manager->IsEmpty() && fH2Manager->IsEmpty() && fH3Manager->IsEmpty() &&
fP1Manager->IsEmpty() && fP2Manager->IsEmpty() && fNtupleManager->IsEmpty() ) ||
( ( ! fState.GetIsMaster() ) && fNtupleManager->IsEmpty() &&
fP1Manager->IsEmpty() && fP2Manager->IsEmpty() && isNtupleManagerEmpty ) ||
( ( ! fState.GetIsMaster() ) && isNtupleManagerEmpty &&
fNtupleMergeMode == G4NtupleMergeMode::kNone ) ) {
result = ! std::remove(fFileManager->GetFullFileName());
// std::remove returns 0 when success
@@ -125,6 +125,9 @@ G4bool G4RootFileManager::WriteFile(std::shared_ptr<tools::wroot::file> rfile,
const G4String& /*fileName*/)
#endif
{
// Do nothing if there is no file
if ( ! fIsOpenFile ) return true;
#ifdef G4VERBOSE
if ( fState.GetVerboseL4() )
fState.GetVerboseL4()->Message("write", "file", fileName);
@@ -149,6 +152,9 @@ G4bool G4RootFileManager::CloseFile(std::shared_ptr<tools::wroot::file> rfile,
const G4String& /*fileName*/)
#endif
{
// Do nothing if there is no file
if ( ! fIsOpenFile ) return true;
#ifdef G4VERBOSE
if ( fState.GetVerboseL4() )
fState.GetVerboseL4()->Message("close", "file", fileName);
@@ -183,6 +189,7 @@ G4bool G4RootFileManager::OpenFile(const G4String& fileName)
fFile->set_compression(fState.GetCompressionLevel());
if ( ! fFile->is_open() ) {
fFile = nullptr;
G4ExceptionDescription description;
description << " " << "Cannot open file " << fileName;
G4Exception("G4RootAnalysisManager::OpenFile()",
@@ -109,6 +109,15 @@ void G4RootNtupleManager::CreateTNtuple(
SetCreateMode();
if ( fCreateMode == G4NtupleCreateMode::kNoMergeAfterOpen ) {
if ( ! fNtupleDirectory ) {
G4String inFunction = "G4RootNtupleManager::::CreateTNtuple";
G4ExceptionDescription description;
description << " "
<< "Cannot create ntuple. Ntuple directory does not exist." << G4endl;
G4Exception(inFunction, "Analysis_W002", JustWarning, description);
return;
}
ntupleDescription->fNtuple
= new tools::wroot::ntuple(*fNtupleDirectory, name, title);
ntupleDescription->fIsNtupleOwner = false;
@@ -122,6 +131,16 @@ void G4RootNtupleManager::CreateTNtupleFromBooking(
G4TNtupleDescription<tools::wroot::ntuple>* ntupleDescription)
{
if ( fCreateMode == G4NtupleCreateMode::kNoMergeBeforeOpen ) {
if ( ! fNtupleDirectory ) {
G4String inFunction = "G4RootNtupleManager::::CreateTNtuple";
G4ExceptionDescription description;
description << " "
<< "Cannot create ntuple. Ntuple directory does not exist." << G4endl;
G4Exception(inFunction, "Analysis_W002", JustWarning, description);
return;
}
ntupleDescription->fNtuple
= new tools::wroot::ntuple(
*fNtupleDirectory, ntupleDescription->fNtupleBooking);