43 #include <tools/rroot/file>
44 #include <tools/rroot/streamers>
45 #include <tools/rroot/fac>
46 #include <tools/rroot/tree>
47 #include <tools/rroot/ntuple>
60 if ( fgInstance == 0 ) {
83 <<
"G4RootAnalysisReader already exists."
84 <<
"Cannot create another instance.";
85 G4Exception(
"G4RootAnalysisReader::G4RootAnalysisReader()",
133 G4bool isPerThread =
false;
136 tools::rroot::file* rfile
143 tools::rroot::key* key
144 = ( ! rfile ) ? 0 : rfile->dir().find_key(objectName);
149 char* charBuffer = 0;
150 if ( key ) charBuffer = key->get_object_buffer(size);
152 if ( ! charBuffer ) {
156 <<
"Cannot get " << objectName <<
" in file " << fileName;
163 key->key_length(), verbose);
171 G4bool finalResult =
true;
174 finalResult = finalResult && result;
177 finalResult = finalResult && result;
180 finalResult = finalResult && result;
183 finalResult = finalResult && result;
186 finalResult = finalResult && result;
189 finalResult = finalResult && result;
209 =
GetBuffer(fileName, h1Name,
"ReadH1Impl");
212 tools::histo::h1d* h1 = tools::rroot::TH1D_stream(*buffer);
219 <<
"Streaming " << h1Name <<
" in file " << fileName <<
" failed.";
253 tools::histo::h2d* h2 = tools::rroot::TH2D_stream(*buffer);
260 <<
"Streaming " << h2Name <<
" in file " << fileName <<
" failed.";
290 tools::histo::h3d* h3 = tools::rroot::TH3D_stream(*buffer);
297 <<
"Streaming " << h3Name <<
" in file " << fileName <<
" failed.";
330 tools::histo::p1d*
p1 = tools::rroot::TProfile_stream(*buffer);
337 <<
"Streaming " << p1Name <<
" in file " << fileName <<
" failed.";
367 tools::histo::p2d*
p2 = tools::rroot::TProfile2D_stream(*buffer);
374 <<
"Streaming " << p2Name <<
" in file " << fileName <<
" failed.";
402 G4bool isPerThread =
true;
403 if ( isUserFileName ) isPerThread =
false;
406 tools::rroot::file* rfile
413 tools::rroot::key* key = rfile->dir().find_key(ntupleName);
418 <<
"Key " << ntupleName <<
" for Ntuple not found in file " << fileName;
419 G4Exception(
"G4RootAnalysisReader::ReadNtupleImpl()",
425 char* charBuffer = key->get_object_buffer(size);
426 if ( ! charBuffer ) {
430 <<
"Cannot get data buffer for Ntuple " << ntupleName <<
" in file " << fileName;
431 G4Exception(
"G4RootAnalysisReader::ReadNtupleImpl()",
439 key->key_length(), verbose);
443 tools::rroot::tree* tree
444 =
new tools::rroot::tree(*rfile, *fac);
445 if ( ! tree->stream(*buffer) ) {
449 <<
"TTree streaming failed for Ntuple " << ntupleName <<
" in file " << fileName;
450 G4Exception(
"G4RootAnalysisReader::ReadNtupleImpl()",
458 tools::rroot::ntuple* rntuple
459 =
new tools::rroot::ntuple(*tree);
virtual G4int ReadH2Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName)
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4H2ToolsManager * fH2Manager
void SetP1Manager(G4VP1Manager *p1Manager)
void SetP2Manager(G4VP2Manager *p2Manager)
std::ostringstream G4ExceptionDescription
G4H1ToolsManager * fH1Manager
G4RootRFileManager * fFileManager
G4AnalysisManagerState fState
const G4AnalysisVerbose * GetVerboseL2() const
void SetH3Manager(G4VH3Manager *h3Manager)
G4RootRNtupleManager * fNtupleManager
G4int SetNtuple(G4RootRNtupleDescription *rntupleDescription)
virtual G4bool OpenRFile(const G4String &fileName, G4bool isPerThread)
G4GLOB_DLL std::ostream G4cout
const G4AnalysisVerbose * GetVerboseL4() const
static G4ThreadLocal G4RootAnalysisReader * fgInstance
tools::rroot::file * GetRFile(const G4String &fileName, G4bool isPerThread) const
void SetNtupleManager(G4VRNtupleManager *ntupleManager)
virtual ~G4RootAnalysisReader()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4int ReadP1Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName)
void SetH1Manager(G4VH1Manager *h1Manager)
static G4RootAnalysisReader * Instance()
tools::rroot::buffer * GetBuffer(const G4String &fileName, const G4String &name, const G4String &inFunction)
G4bool GetIsMaster() const
static const G4double fac
static G4RootAnalysisReader * fgMasterInstance
virtual G4int ReadH3Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName)
G4P2ToolsManager * fP2Manager
G4RootAnalysisReader(G4bool isMaster=true)
G4P1ToolsManager * fP1Manager
virtual G4int ReadNtupleImpl(const G4String &ntupleName, const G4String &fileName, G4bool isUserFileName)
virtual G4int ReadP2Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName)
void SetH2Manager(G4VH2Manager *h2Manager)
virtual G4int ReadH1Impl(const G4String &h1Name, const G4String &fileName, G4bool isUserFileName)
G4H3ToolsManager * fH3Manager
void SetFileManager(G4BaseFileManager *fileManager)