Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:29

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 
0027 // Manager class for Xml ntuples
0028 //
0029 // Author: Ivana Hrivnacova, 18/06/2013  (ivana@ipno.in2p3.fr)
0030 
0031 #ifndef G4XmlNtupleManager_h
0032 #define G4XmlNtupleManager_h 1
0033 
0034 #include "G4TNtupleManager.hh"
0035 #include "globals.hh"
0036 
0037 #include "tools/waxml/ntuple"
0038 
0039 #include <memory>
0040 #include <string_view>
0041 #include <utility>
0042 #include <vector>
0043 
0044 // Types alias
0045 using XmlNtupleDescription = G4TNtupleDescription<tools::waxml::ntuple, std::ofstream>;
0046 
0047 class G4XmlFileManager;
0048 
0049 class G4XmlNtupleManager : public G4TNtupleManager<tools::waxml::ntuple,
0050                                                    std::ofstream>
0051 {
0052   friend class G4XmlAnalysisManager;
0053   friend class G4XmlNtupleFileManager;
0054 
0055   public:
0056     explicit G4XmlNtupleManager(const G4AnalysisManagerState& state);
0057     G4XmlNtupleManager() = delete;
0058     ~G4XmlNtupleManager() override = default;
0059 
0060   private:
0061     // Functions specific to the output type
0062     //
0063 
0064     // Set methods
0065     void SetFileManager(std::shared_ptr<G4XmlFileManager> fileManager);
0066 
0067     // Access to ntuple vector (needed for Write())
0068     const std::vector<XmlNtupleDescription*>& GetNtupleDescriptionVector() const;
0069 
0070     // Methods from the templated base class
0071     //
0072     void CreateTNtupleFromBooking(XmlNtupleDescription* ntupleDescription) final;
0073 
0074     void FinishTNtuple(XmlNtupleDescription* ntupleDescription, G4bool fromBooking) final;
0075 
0076     // Static data members
0077     static constexpr std::string_view fkClass { "G4XmNtupleManager" };
0078 
0079     // Data members
0080     std::shared_ptr<G4XmlFileManager>  fFileManager { nullptr };
0081 };
0082 
0083 // inline functions
0084 
0085 inline void
0086 G4XmlNtupleManager::SetFileManager(std::shared_ptr<G4XmlFileManager> fileManager)
0087 {
0088   fFileManager = std::move(fileManager);
0089 }
0090 
0091 inline const std::vector<G4TNtupleDescription<tools::waxml::ntuple, std::ofstream>*>&
0092 G4XmlNtupleManager::GetNtupleDescriptionVector() const
0093 { return fNtupleDescriptionVector; }
0094 
0095 
0096 #endif
0097