Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: G4CsvAnalysisReader.hh 74257 2013-10-02 14:24:55Z gcosmo $ 26 27 27 // The main manager for Csv analysis reader. 28 // The main manager for Csv analysis reader. 28 // It delegates most of functions to the objec << 29 // It delegates most of functions to the object specific managers. 29 30 30 // Author: Ivana Hrivnacova, 05/09/2014 (ivana 31 // Author: Ivana Hrivnacova, 05/09/2014 (ivana@ipno.in2p3.fr) 31 32 32 #ifndef G4CsvAnalysisReader_h 33 #ifndef G4CsvAnalysisReader_h 33 #define G4CsvAnalysisReader_h 1 34 #define G4CsvAnalysisReader_h 1 34 35 35 #include "G4ToolsAnalysisReader.hh" << 36 #include "G4VAnalysisReader.hh" 36 #include "globals.hh" 37 #include "globals.hh" 37 38 >> 39 #include "tools/histo/h1d" >> 40 #include "tools/histo/h2d" >> 41 #include "tools/histo/h3d" >> 42 #include "tools/histo/p1d" >> 43 #include "tools/histo/p2d" 38 #include "tools/rcsv_ntuple" 44 #include "tools/rcsv_ntuple" 39 45 40 #include <memory> << 46 class G4H1ToolsManager; 41 #include <string_view> << 47 class G4H2ToolsManager; 42 << 48 class G4H3ToolsManager; 43 class G4CsvAnalysisReader; << 49 class G4P1ToolsManager; >> 50 class G4P2ToolsManager; 44 class G4CsvRNtupleManager; 51 class G4CsvRNtupleManager; 45 class G4CsvRFileManager; 52 class G4CsvRFileManager; 46 template <class T> << 53 47 class G4ThreadLocalSingleton; << 54 class G4CsvAnalysisReader : public G4VAnalysisReader 48 << 49 class G4CsvAnalysisReader : public G4ToolsAnal << 50 { 55 { 51 friend class G4ThreadLocalSingleton<G4CsvAna << 52 << 53 public: 56 public: 54 ~G4CsvAnalysisReader() override; << 57 G4CsvAnalysisReader(G4bool isMaster = true); 55 << 58 virtual ~G4CsvAnalysisReader(); 56 // Static methods << 59 >> 60 // static methods 57 static G4CsvAnalysisReader* Instance(); 61 static G4CsvAnalysisReader* Instance(); 58 62 59 // Access methods 63 // Access methods >> 64 tools::histo::h1d* GetH1(G4int id, G4bool warn = true) const; >> 65 tools::histo::h2d* GetH2(G4int id, G4bool warn = true) const; >> 66 tools::histo::h3d* GetH3(G4int id, G4bool warn = true) const; >> 67 tools::histo::p1d* GetP1(G4int id, G4bool warn = true) const; >> 68 tools::histo::p2d* GetP2(G4int id, G4bool warn = true) const; 60 tools::rcsv::ntuple* GetNtuple() const; 69 tools::rcsv::ntuple* GetNtuple() const; 61 tools::rcsv::ntuple* GetNtuple(G4int ntupl 70 tools::rcsv::ntuple* GetNtuple(G4int ntupleId) const; 62 using G4VAnalysisReader::GetNtuple; 71 using G4VAnalysisReader::GetNtuple; 63 << 72 64 protected: 73 protected: 65 // Virtual methods from base class << 74 // virtual methods from base class 66 G4bool CloseFilesImpl(G4bool reset) final; << 75 virtual G4int ReadH1Impl(const G4String& h1Name, >> 76 const G4String& fileName, >> 77 G4bool isUserFileName); >> 78 virtual G4int ReadH2Impl(const G4String& h1Name, >> 79 const G4String& fileName, >> 80 G4bool isUserFileName); >> 81 virtual G4int ReadH3Impl(const G4String& h1Name, >> 82 const G4String& fileName, >> 83 G4bool isUserFileName); >> 84 virtual G4int ReadP1Impl(const G4String& h1Name, >> 85 const G4String& fileName, >> 86 G4bool isUserFileName); >> 87 virtual G4int ReadP2Impl(const G4String& h1Name, >> 88 const G4String& fileName, >> 89 G4bool isUserFileName); >> 90 virtual G4int ReadNtupleImpl(const G4String& ntupleName, >> 91 const G4String& fileName, >> 92 G4bool isUserFileName); 67 93 68 private: 94 private: 69 G4CsvAnalysisReader(); << 95 // static data members 70 << 96 static G4CsvAnalysisReader* fgMasterInstance; 71 // Static data members << 97 static G4ThreadLocal G4CsvAnalysisReader* fgInstance; 72 inline static G4CsvAnalysisReader* fgMaste << 98 73 << 99 // methods 74 // Methods << 100 G4String GetHnFileName(const G4String& hnType, >> 101 const G4String& hnName, >> 102 const G4String& baseFileName, >> 103 G4bool isUserFileName) const; >> 104 75 G4bool Reset(); 105 G4bool Reset(); 76 106 77 // Static data members << 107 // data members 78 static constexpr std::string_view fkClass << 108 G4H1ToolsManager* fH1Manager; 79 << 109 G4H2ToolsManager* fH2Manager; 80 // Data members << 110 G4H3ToolsManager* fH3Manager; 81 std::shared_ptr<G4CsvRNtupleManager> fNtup << 111 G4P1ToolsManager* fP1Manager; 82 std::shared_ptr<G4CsvRFileManager> fFile << 112 G4P2ToolsManager* fP2Manager; >> 113 G4CsvRNtupleManager* fNtupleManager; >> 114 G4CsvRFileManager* fFileManager; 83 }; 115 }; 84 116 85 #include "G4CsvAnalysisReader.icc" 117 #include "G4CsvAnalysisReader.icc" 86 118 87 #endif 119 #endif 88 120 89 121