88 lines
3.4 KiB
Plaintext
88 lines
3.4 KiB
Plaintext
//
|
|
// ********************************************************************
|
|
// * 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. *
|
|
// ********************************************************************
|
|
//
|
|
//
|
|
// Author: Ivana Hrivnacova, 26/08/2021 (ivana@ipno.in2p3.fr)
|
|
|
|
#include "G4AnalysisUtilities.hh"
|
|
|
|
#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"
|
|
|
|
//_____________________________________________________________________________
|
|
template <typename HT>
|
|
inline
|
|
G4bool G4Hdf5HnRFileManager<HT>::ReadT(
|
|
hid_t directory, const G4String& htName, HT*& ht)
|
|
{
|
|
return toolx::hdf5::read_histo(G4cout, directory, htName, ht);
|
|
}
|
|
|
|
//_____________________________________________________________________________
|
|
template <>
|
|
inline
|
|
G4bool G4Hdf5HnRFileManager<tools::histo::p1d>::ReadT(
|
|
hid_t directory, const G4String& htName, tools::histo::p1d*& ht)
|
|
{
|
|
return toolx::hdf5::read_profile(G4cout, directory, htName, ht);
|
|
}
|
|
|
|
//_____________________________________________________________________________
|
|
template <>
|
|
inline
|
|
G4bool G4Hdf5HnRFileManager<tools::histo::p2d>::ReadT(
|
|
hid_t directory, const G4String& htName, tools::histo::p2d*& ht)
|
|
{
|
|
return toolx::hdf5::read_profile(G4cout, directory, htName, ht);
|
|
}
|
|
|
|
//_____________________________________________________________________________
|
|
template <typename HT>
|
|
inline
|
|
HT* G4Hdf5HnRFileManager<HT>::Read(
|
|
const G4String& htName, const G4String& fileName, const G4String& dirName,
|
|
G4bool /*isUserFileName*/)
|
|
{
|
|
// Get directory
|
|
auto directory = fRFileManager->GetHistoRDirectory(fileName, dirName, false);
|
|
if ( directory < 0 ) return nullptr;
|
|
|
|
// Read hn
|
|
HT* ht = nullptr;
|
|
if ( ! ReadT(directory, htName, ht) ) {
|
|
G4Analysis::Warn(
|
|
"Streaming " + htName + " from file " + fileName + " failed.",
|
|
fkClass, "ReadTImpl");
|
|
return nullptr;
|
|
}
|
|
|
|
return ht;
|
|
}
|