// // ******************************************************************** // * 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. * // ******************************************************************** // // Structure templated containing the information related to an ntuple // for all output types. // // Author: Ivana Hrivnacova, 19/06/2015 (ivana@ipno.in2p3.fr) #ifndef G4TNtupleDescription_h #define G4TNtupleDescription_h 1 #include "G4NtupleBookingManager.hh" #include "globals.hh" #include template class G4TNtupleDescription { public: G4TNtupleDescription(G4NtupleBooking* g4NtupleBooking) : fG4NtupleBooking(g4NtupleBooking) {} G4TNtupleDescription() = delete; ~G4TNtupleDescription() { if ( fIsNtupleOwner ) delete fNtuple; } // Set methods void SetFile(std::shared_ptr file); void SetNtuple(NT* ntuple); void SetFileName(const G4String& fileName); void SetActivation(G4bool activation); void SetIsNtupleOwner(G4bool isNtupleOwner); void SetHasFill(G4bool hasFill); void Reset(); // Get methods std::shared_ptr GetFile() const; NT* GetNtuple() const; G4NtupleBooking* GetG4NtupleBooking() const; const tools::ntuple_booking& GetNtupleBooking() const; G4String GetFileName() const; G4bool GetActivation() const; G4bool GetIsNtupleOwner() const; G4bool GetHasFill() const; private: std::shared_ptr fFile { nullptr }; NT* fNtuple { nullptr }; G4NtupleBooking* fG4NtupleBooking { nullptr }; G4bool fIsNtupleOwner { true }; G4bool fHasFill { false }; }; // inline functions template void G4TNtupleDescription::SetFile(std::shared_ptr file) { fFile = std::move(file); } template void G4TNtupleDescription::SetNtuple(NT* ntuple) { fNtuple = ntuple; } template void G4TNtupleDescription::SetFileName(const G4String& fileName) { fG4NtupleBooking->fFileName = fileName; } template void G4TNtupleDescription::SetActivation(G4bool activation) { fG4NtupleBooking->fActivation = activation; } template void G4TNtupleDescription::SetIsNtupleOwner(G4bool isNtupleOwner) { fIsNtupleOwner = isNtupleOwner; } template void G4TNtupleDescription::SetHasFill(G4bool hasFill) { fHasFill = hasFill; } template void G4TNtupleDescription::Reset() { if (fIsNtupleOwner) delete fNtuple; fNtuple = nullptr; } template std::shared_ptr G4TNtupleDescription::GetFile() const { return fFile; } template NT* G4TNtupleDescription::GetNtuple() const { return fNtuple; } template G4NtupleBooking* G4TNtupleDescription::GetG4NtupleBooking() const { return fG4NtupleBooking; } template const tools::ntuple_booking& G4TNtupleDescription::GetNtupleBooking() const { return fG4NtupleBooking->fNtupleBooking; } template G4String G4TNtupleDescription::GetFileName() const { return fG4NtupleBooking->fFileName; } template G4bool G4TNtupleDescription::GetActivation() const { return fG4NtupleBooking->fActivation; } template G4bool G4TNtupleDescription::GetIsNtupleOwner() const { return fIsNtupleOwner; } template G4bool G4TNtupleDescription::GetHasFill() const { return fHasFill; } #endif