Back to home page

EIC code displayed by LXR

 
 

    


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

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 #include "G4AnalysisUtilities.hh"
0028 
0029 #include "G4THnToolsManager.hh"
0030 
0031 //_____________________________________________________________________________
0032 template <typename HT>
0033 inline
0034 G4int G4ToolsAnalysisReader::ReadTImpl(
0035         const G4String& htName, const G4String& fileName,
0036         const G4String& dirName, G4bool isUserFileName,
0037         G4THnManager<HT>* htManager)
0038 {
0039   Message(G4Analysis::kVL4, "read", G4Analysis::GetHnType<HT>(), htName);
0040 
0041   // Read hn
0042   auto ht = fVFileManager->GetHnRFileManager<HT>()->Read(
0043     htName, fileName, dirName, isUserFileName);
0044 
0045   if ( ! ht ) {
0046     G4Analysis::Warn(
0047       "Streaming " + htName + " from file " + fileName +
0048       " directory " + dirName + " failed.",
0049       fkClass, "ReadTImpl");
0050     return G4Analysis::kInvalidId;
0051   }
0052 
0053   auto id = htManager->RegisterT(htName, static_cast<HT*>(ht));
0054 
0055   Message(G4Analysis::kVL2, "read", G4Analysis::GetHnType<HT>(), htName,
0056           id > G4Analysis::kInvalidId);
0057 
0058   return id;
0059 
0060 }
0061 
0062 //_____________________________________________________________________________
0063 inline
0064 tools::histo::h1d*  G4ToolsAnalysisReader::GetH1(G4int id, G4bool warn) const
0065 {
0066   return fH1Manager->GetT(id, warn, false);
0067 }
0068 
0069 //_____________________________________________________________________________
0070 inline
0071 tools::histo::h2d*  G4ToolsAnalysisReader::GetH2(G4int id, G4bool warn) const
0072 {
0073   return fH2Manager->GetT(id, warn, false);
0074 }
0075 
0076 //_____________________________________________________________________________
0077 inline
0078 tools::histo::h3d*  G4ToolsAnalysisReader::GetH3(G4int id, G4bool warn) const
0079 {
0080   return fH3Manager->GetT(id, warn, false);
0081 }
0082 
0083 //_____________________________________________________________________________
0084 inline
0085 tools::histo::p1d*  G4ToolsAnalysisReader::GetP1(G4int id, G4bool warn) const
0086 {
0087   return fP1Manager->GetT(id, warn, false);
0088 }
0089 
0090 //_____________________________________________________________________________
0091 inline
0092 tools::histo::p2d*  G4ToolsAnalysisReader::GetP2(G4int id, G4bool warn) const
0093 {
0094   return fP2Manager->GetT(id, warn, false);
0095 }