46 using namespace G4Analysis;
54 if ( fgInstance ==
nullptr ) {
65 fNtupleManager(nullptr),
68 if ( ( isMaster && fgMasterInstance ) || ( fgInstance ) ) {
72 <<
"G4XmlAnalysisReader already exists."
73 <<
"Cannot create another instance.";
74 G4Exception(
"G4XmlAnalysisReader::G4XmlAnalysisReader()",
77 if ( isMaster ) fgMasterInstance =
this;
102 tools::raxml_out* G4XmlAnalysisReader::GetHandler(
114 auto rfile = fFileManager->
GetRFile(fileName);
116 if ( ! fFileManager->
OpenRFile(fileName) )
return nullptr;
117 rfile = fFileManager->
GetRFile(fileName);
120 tools::raxml_out* handler =
nullptr;
122 std::vector<tools::raxml_out>& objects = rfile->objects();
123 std::vector<tools::raxml_out>::iterator it;
124 for (it = objects.begin(); it!=objects.end(); ++it) {
125 tools::raxml_out&
object = *it;
126 if (
object.cls() == objectType &&
object.name() == objectName ) {
137 <<
"Cannot get "<< objectName <<
" in file " << fileName;
138 G4String inFunctionFull =
"G4XmlAnalysisReader::";
139 inFunctionFull.
append(inFunction);
148 G4bool G4XmlAnalysisReader::Reset()
152 auto finalResult =
true;
155 finalResult = finalResult &&
result;
157 result = fNtupleManager->
Reset();
158 finalResult = finalResult &&
result;
177 tools::raxml_out* handler
178 = GetHandler(fileName, h1Name, tools::histo::h1d::s_class(),
"ReadH1Impl");
181 auto h1 =
static_cast<tools::histo::h1d*
>(handler->object());
203 = GetHandler(fileName, h2Name, tools::histo::h2d::s_class(),
"ReadH2Impl");
206 auto h2 =
static_cast<tools::histo::h2d*
>(handler->object());
228 = GetHandler(fileName, h3Name, tools::histo::h3d::s_class(),
"ReadH3Impl");
231 auto h3 =
static_cast<tools::histo::h3d*
>(handler->object());
253 = GetHandler(fileName, p1Name, tools::histo::p1d::s_class(),
"ReadP1Impl");
256 auto p1 =
static_cast<tools::histo::p1d*
>(handler->object());
278 = GetHandler(fileName, p2Name, tools::histo::p2d::s_class(),
"ReadP2Impl");
281 auto p2 =
static_cast<tools::histo::p2d*
>(handler->object());
305 auto fullFileName = fileName;
306 if ( ! isUserFileName ) {
311 = GetHandler(fullFileName, ntupleName, tools::aida::ntuple::s_class(),
315 auto rntuple =
static_cast<tools::aida::ntuple*
>(handler->object());
G4double G4ParticleHPJENDLHEData::G4double result
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
G4String GetNtupleFileName(const G4String &ntupleName) const
G4AnalysisManagerState fState
const G4AnalysisVerbose * GetVerboseL2() const
virtual G4int ReadP2Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName) final
const G4AnalysisVerbose * GetVerboseL4() const
void SetNtupleManager(G4VRNtupleManager *ntupleManager)
tools::raxml * GetRFile(const G4String &fileName) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4int ReadH3Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName) final
virtual G4int ReadH1Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName) final
virtual G4int ReadH2Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName) final
G4String & append(const G4String &)
G4bool GetIsMaster() const
G4XmlAnalysisReader(G4bool isMaster=true)
virtual G4int ReadNtupleImpl(const G4String &ntupleName, const G4String &fileName, G4bool isUserFileName) final
G4int SetNtuple(G4XmlRNtupleDescription *rntupleDescription)
virtual ~G4XmlAnalysisReader()
virtual G4bool OpenRFile(const G4String &fileName)
static G4XmlAnalysisReader * Instance()
virtual G4int ReadP1Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName) final
void SetFileManager(G4BaseFileManager *fileManager)