52 if ( fgInstance ==
nullptr ) {
63 fNtupleManager(nullptr),
66 if ( ( isMaster && fgMasterInstance ) || ( fgInstance ) ) {
70 <<
"G4XmlAnalysisReader already exists."
71 <<
"Cannot create another instance.";
72 G4Exception(
"G4XmlAnalysisReader::G4XmlAnalysisReader()",
75 if ( isMaster ) fgMasterInstance =
this;
100tools::raxml_out* G4XmlAnalysisReader::GetHandler(
112 auto rfile = fFileManager->
GetRFile(fileName);
114 if ( ! fFileManager->
OpenRFile(fileName) )
return nullptr;
115 rfile = fFileManager->
GetRFile(fileName);
118 tools::raxml_out* handler =
nullptr;
120 std::vector<tools::raxml_out>& objects = rfile->objects();
121 std::vector<tools::raxml_out>::iterator it;
122 for (it = objects.begin(); it!=objects.end(); ++it) {
123 tools::raxml_out&
object = *it;
124 if (
object.cls() == objectType &&
object.
name() == objectName ) {
135 <<
"Cannot get "<< objectName <<
" in file " << fileName;
136 G4String inFunctionFull =
"G4XmlAnalysisReader::";
137 inFunctionFull.
append(inFunction);
146G4bool G4XmlAnalysisReader::Reset()
150 auto finalResult =
true;
153 finalResult = finalResult && result;
155 result = fNtupleManager->
Reset();
156 finalResult = finalResult && result;
176 tools::raxml_out* handler
177 = GetHandler(fileName, h1Name, tools::histo::h1d::s_class(),
"ReadH1Impl");
180 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());
229 = GetHandler(fileName, h3Name, tools::histo::h3d::s_class(),
"ReadH3Impl");
232 auto h3 =
static_cast<tools::histo::h3d*
>(handler->object());
255 = GetHandler(fileName, p1Name, tools::histo::p1d::s_class(),
"ReadP1Impl");
258 auto p1 =
static_cast<tools::histo::p1d*
>(handler->object());
281 = GetHandler(fileName, p2Name, tools::histo::p2d::s_class(),
"ReadP2Impl");
284 auto p2 =
static_cast<tools::histo::p2d*
>(handler->object());
309 auto fullFileName = fileName;
310 if ( ! isUserFileName ) {
315 = GetHandler(fullFileName, ntupleName, tools::aida::ntuple::s_class(),
319 auto rntuple =
static_cast<tools::aida::ntuple*
>(handler->object());
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4AnalysisVerbose * GetVerboseL2() const
G4bool GetIsMaster() const
const G4AnalysisVerbose * GetVerboseL4() const
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4String GetNtupleFileName(const G4String &ntupleName) const
G4String & append(const G4String &)
G4int SetNtuple(G4TRNtupleDescription< TNTUPLE > *rntupleDescription)
void SetFileManager(G4BaseFileManager *fileManager)
void SetNtupleManager(G4VRNtupleManager *ntupleManager)
G4AnalysisManagerState fState
virtual ~G4XmlAnalysisReader()
virtual G4int ReadP1Impl(const G4String &h1Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
virtual G4int ReadP2Impl(const G4String &h1Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
G4XmlAnalysisReader(G4bool isMaster=true)
virtual G4int ReadNtupleImpl(const G4String &ntupleName, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
virtual G4int ReadH2Impl(const G4String &h1Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
static G4XmlAnalysisReader * Instance()
virtual G4int ReadH1Impl(const G4String &h1Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
virtual G4int ReadH3Impl(const G4String &h1Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
tools::raxml * GetRFile(const G4String &fileName) const
virtual G4bool OpenRFile(const G4String &fileName)
const char * name(G4int ptype)