Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4RootAnalysisReader Class Reference

#include <G4RootAnalysisReader.hh>

Inheritance diagram for G4RootAnalysisReader:
Collaboration diagram for G4RootAnalysisReader:

Public Member Functions

 G4RootAnalysisReader (G4bool isMaster=true)
 
virtual ~G4RootAnalysisReader ()
 
tools::rroot::ntuple * GetNtuple () const
 
tools::rroot::ntuple * GetNtuple (G4int ntupleId) const
 
- Public Member Functions inherited from G4ToolsAnalysisReader
 G4ToolsAnalysisReader (const G4String &type, G4bool isMaster=true)
 
virtual ~G4ToolsAnalysisReader ()
 
tools::histo::h1d * GetH1 (G4int id, G4bool warn=true) const
 
tools::histo::h2d * GetH2 (G4int id, G4bool warn=true) const
 
tools::histo::h3d * GetH3 (G4int id, G4bool warn=true) const
 
tools::histo::p1d * GetP1 (G4int id, G4bool warn=true) const
 
tools::histo::p2d * GetP2 (G4int id, G4bool warn=true) const
 
- Public Member Functions inherited from G4VAnalysisReader
 G4VAnalysisReader (const G4String &type, G4bool isMaster)
 
virtual ~G4VAnalysisReader ()
 
void SetFileName (const G4String &fileName)
 
G4String GetFileName () const
 
G4int ReadH1 (const G4String &h1Name, const G4String &fileName="")
 
G4int ReadH2 (const G4String &h2Name, const G4String &fileName="")
 
G4int ReadH3 (const G4String &h3Name, const G4String &fileName="")
 
G4int ReadP1 (const G4String &h1Name, const G4String &fileName="")
 
G4int ReadP2 (const G4String &h2Name, const G4String &fileName="")
 
G4bool SetFirstHistoId (G4int firstId)
 
G4bool SetFirstH1Id (G4int firstId)
 
G4bool SetFirstH2Id (G4int firstId)
 
G4bool SetFirstH3Id (G4int firstId)
 
G4bool SetFirstProfileId (G4int firstId)
 
G4bool SetFirstP1Id (G4int firstId)
 
G4bool SetFirstP2Id (G4int firstId)
 
G4bool SetFirstNtupleId (G4int firstId)
 
G4int GetNtuple (const G4String &ntupleName, const G4String &fileName="")
 
G4bool SetNtupleIColumn (const G4String &columnName, G4int &value)
 
G4bool SetNtupleFColumn (const G4String &columnName, G4float &value)
 
G4bool SetNtupleDColumn (const G4String &columnName, G4double &value)
 
G4bool SetNtupleSColumn (const G4String &columnName, G4String &value)
 
G4bool SetNtupleIColumn (const G4String &columnName, std::vector< int > &vector)
 
G4bool SetNtupleFColumn (const G4String &columnName, std::vector< float > &vector)
 
G4bool SetNtupleDColumn (const G4String &columnName, std::vector< double > &vector)
 
G4bool SetNtupleIColumn (G4int ntupleId, const G4String &columnName, G4int &value)
 
G4bool SetNtupleFColumn (G4int ntupleId, const G4String &columnName, G4float &value)
 
G4bool SetNtupleDColumn (G4int ntupleId, const G4String &columnName, G4double &value)
 
G4bool SetNtupleSColumn (G4int ntupleId, const G4String &columnName, G4String &value)
 
G4bool SetNtupleIColumn (G4int ntupleId, const G4String &columnName, std::vector< int > &vector)
 
G4bool SetNtupleFColumn (G4int ntupleId, const G4String &columnName, std::vector< float > &vector)
 
G4bool SetNtupleDColumn (G4int ntupleId, const G4String &columnName, std::vector< double > &vector)
 
G4bool GetNtupleRow ()
 
G4bool GetNtupleRow (G4int ntupleId)
 
G4bool IsAscii () const
 
G4int GetNofH1s () const
 
G4int GetNofH2s () const
 
G4int GetNofH3s () const
 
G4int GetNofP1s () const
 
G4int GetNofP2s () const
 
G4int GetNofNtuples () const
 
G4int GetH1Id (const G4String &name, G4bool warn=true) const
 
G4int GetH2Id (const G4String &name, G4bool warn=true) const
 
G4int GetH3Id (const G4String &name, G4bool warn=true) const
 
G4int GetP1Id (const G4String &name, G4bool warn=true) const
 
G4int GetP2Id (const G4String &name, G4bool warn=true) const
 
G4int GetH1Nbins (G4int id) const
 
G4double GetH1Xmin (G4int id) const
 
G4double GetH1Xmax (G4int id) const
 
G4double GetH1Width (G4int id) const
 
G4int GetH2Nxbins (G4int id) const
 
G4double GetH2Xmin (G4int id) const
 
G4double GetH2Xmax (G4int id) const
 
G4double GetH2XWidth (G4int id) const
 
G4int GetH2Nybins (G4int id) const
 
G4double GetH2Ymin (G4int id) const
 
G4double GetH2Ymax (G4int id) const
 
G4double GetH2YWidth (G4int id) const
 
G4int GetH3Nxbins (G4int id) const
 
G4double GetH3Xmin (G4int id) const
 
G4double GetH3Xmax (G4int id) const
 
G4double GetH3XWidth (G4int id) const
 
G4int GetH3Nybins (G4int id) const
 
G4double GetH3Ymin (G4int id) const
 
G4double GetH3Ymax (G4int id) const
 
G4double GetH3YWidth (G4int id) const
 
G4int GetH3Nzbins (G4int id) const
 
G4double GetH3Zmin (G4int id) const
 
G4double GetH3Zmax (G4int id) const
 
G4double GetH3ZWidth (G4int id) const
 
G4int GetP1Nbins (G4int id) const
 
G4double GetP1Xmin (G4int id) const
 
G4double GetP1Xmax (G4int id) const
 
G4double GetP1XWidth (G4int id) const
 
G4double GetP1Ymin (G4int id) const
 
G4double GetP1Ymax (G4int id) const
 
G4int GetP2Nxbins (G4int id) const
 
G4double GetP2Xmin (G4int id) const
 
G4double GetP2Xmax (G4int id) const
 
G4double GetP2XWidth (G4int id) const
 
G4int GetP2Nybins (G4int id) const
 
G4double GetP2Ymin (G4int id) const
 
G4double GetP2Ymax (G4int id) const
 
G4double GetP2YWidth (G4int id) const
 
G4double GetP2Zmin (G4int id) const
 
G4double GetP2Zmax (G4int id) const
 
G4String GetH1Title (G4int id) const
 
G4String GetH1XAxisTitle (G4int id) const
 
G4String GetH1YAxisTitle (G4int id) const
 
G4String GetH2Title (G4int id) const
 
G4String GetH2XAxisTitle (G4int id) const
 
G4String GetH2YAxisTitle (G4int id) const
 
G4String GetH2ZAxisTitle (G4int id) const
 
G4String GetH3Title (G4int id) const
 
G4String GetH3XAxisTitle (G4int id) const
 
G4String GetH3YAxisTitle (G4int id) const
 
G4String GetH3ZAxisTitle (G4int id) const
 
G4String GetP1Title (G4int id) const
 
G4String GetP1XAxisTitle (G4int id) const
 
G4String GetP1YAxisTitle (G4int id) const
 
G4String GetP1ZAxisTitle (G4int id) const
 
G4String GetP2Title (G4int id) const
 
G4String GetP2XAxisTitle (G4int id) const
 
G4String GetP2YAxisTitle (G4int id) const
 
G4String GetP2ZAxisTitle (G4int id) const
 
void SetVerboseLevel (G4int verboseLevel)
 
G4int GetVerboseLevel () const
 
G4String GetType () const
 
G4String GetFileType () const
 

Static Public Member Functions

static G4RootAnalysisReaderInstance ()
 

Protected Member Functions

virtual G4int ReadH1Impl (const G4String &h1Name, const G4String &fileName, G4bool isUserFileName) final
 
virtual G4int ReadH2Impl (const G4String &h2Name, const G4String &fileName, G4bool isUserFileName) final
 
virtual G4int ReadH3Impl (const G4String &h3Name, const G4String &fileName, G4bool isUserFileName) final
 
virtual G4int ReadP1Impl (const G4String &p1Name, const G4String &fileName, G4bool isUserFileName) final
 
virtual G4int ReadP2Impl (const G4String &p2Name, const G4String &fileName, G4bool isUserFileName) final
 
virtual G4int ReadNtupleImpl (const G4String &ntupleName, const G4String &fileName, G4bool isUserFileName) final
 
- Protected Member Functions inherited from G4ToolsAnalysisReader
G4bool Reset ()
 
- Protected Member Functions inherited from G4VAnalysisReader
void SetH1Manager (G4VH1Manager *h1Manager)
 
void SetH2Manager (G4VH2Manager *h2Manager)
 
void SetH3Manager (G4VH3Manager *h3Manager)
 
void SetP1Manager (G4VP1Manager *p1Manager)
 
void SetP2Manager (G4VP2Manager *p2Manager)
 
void SetNtupleManager (G4VRNtupleManager *ntupleManager)
 
void SetFileManager (G4BaseFileManager *fileManager)
 

Additional Inherited Members

- Protected Attributes inherited from G4ToolsAnalysisReader
G4H1ToolsManagerfH1Manager
 
G4H2ToolsManagerfH2Manager
 
G4H3ToolsManagerfH3Manager
 
G4P1ToolsManagerfP1Manager
 
G4P2ToolsManagerfP2Manager
 
- Protected Attributes inherited from G4VAnalysisReader
G4AnalysisManagerState fState
 

Detailed Description

Definition at line 54 of file G4RootAnalysisReader.hh.

Constructor & Destructor Documentation

G4RootAnalysisReader::G4RootAnalysisReader ( G4bool  isMaster = true)
explicit

Definition at line 64 of file G4RootAnalysisReader.cc.

65  : G4ToolsAnalysisReader("Root", isMaster),
66  fNtupleManager(nullptr),
67  fFileManager(nullptr)
68 {
69  if ( ( isMaster && fgMasterInstance ) || ( fgInstance ) ) {
70  G4ExceptionDescription description;
71  description
72  << " "
73  << "G4RootAnalysisReader already exists."
74  << "Cannot create another instance.";
75  G4Exception("G4RootAnalysisReader::G4RootAnalysisReader()",
76  "Analysis_F001", FatalException, description);
77  }
78  if ( isMaster ) fgMasterInstance = this;
79  fgInstance = this;
80 
81  // Create managers
82  fNtupleManager = new G4RootRNtupleManager(fState);
83  fFileManager = new G4RootRFileManager(fState);
84  // The managers will be deleted by the base class
85 
86  // Set managers to base class
87  SetNtupleManager(fNtupleManager);
88  SetFileManager(fFileManager);
89 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4AnalysisManagerState fState
void SetNtupleManager(G4VRNtupleManager *ntupleManager)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4ToolsAnalysisReader(const G4String &type, G4bool isMaster=true)
void SetFileManager(G4BaseFileManager *fileManager)

Here is the call graph for this function:

G4RootAnalysisReader::~G4RootAnalysisReader ( )
virtual

Definition at line 92 of file G4RootAnalysisReader.cc.

93 {
94  if ( fState.GetIsMaster() ) fgMasterInstance = nullptr;
95  fgInstance = nullptr;
96 }
G4AnalysisManagerState fState

Here is the call graph for this function:

Member Function Documentation

tools::rroot::ntuple* G4RootAnalysisReader::GetNtuple ( ) const
tools::rroot::ntuple* G4RootAnalysisReader::GetNtuple ( G4int  ntupleId) const
G4RootAnalysisReader * G4RootAnalysisReader::Instance ( )
static

Definition at line 53 of file G4RootAnalysisReader.cc.

54 {
55  if ( fgInstance == nullptr ) {
56  G4bool isMaster = ! G4Threading::IsWorkerThread();
57  fgInstance = new G4RootAnalysisReader(isMaster);
58  }
59 
60  return fgInstance;
61 }
bool G4bool
Definition: G4Types.hh:79
G4bool IsWorkerThread()
Definition: G4Threading.cc:145
G4RootAnalysisReader(G4bool isMaster=true)

Here is the call graph for this function:

G4int G4RootAnalysisReader::ReadH1Impl ( const G4String h1Name,
const G4String fileName,
G4bool  isUserFileName 
)
finalprotectedvirtual

Implements G4VAnalysisReader.

Definition at line 166 of file G4RootAnalysisReader.cc.

169 {
170 #ifdef G4VERBOSE
171  if ( fState.GetVerboseL4() )
172  fState.GetVerboseL4()->Message("read", "h1", h1Name);
173 #endif
174 
175  auto buffer = GetBuffer(fileName, h1Name, "ReadH1Impl");
176  if ( ! buffer ) return kInvalidId;
177 
178  auto h1 = tools::rroot::TH1D_stream(*buffer);
179  delete buffer;
180 
181  if ( ! h1 ) {
182  G4ExceptionDescription description;
183  description
184  << " "
185  << "Streaming " << h1Name << " in file " << fileName << " failed.";
186  G4Exception("G4RootAnalysisReader::ReadH1Impl",
187  "Analysis_WR011", JustWarning, description);
188  return kInvalidId;
189  }
190 
191  auto id = fH1Manager->AddH1(h1Name, h1);
192 
193 #ifdef G4VERBOSE
194  if ( fState.GetVerboseL2() )
195  fState.GetVerboseL2()->Message("read", "h1", h1Name, id > kInvalidId);
196 #endif
197 
198  return id;
199 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4H1ToolsManager * fH1Manager
#define buffer
Definition: xmlparse.cc:628
G4AnalysisManagerState fState
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4int AddH1(const G4String &name, tools::histo::h1d *h1d)
const G4int kInvalidId

Here is the call graph for this function:

G4int G4RootAnalysisReader::ReadH2Impl ( const G4String h2Name,
const G4String fileName,
G4bool  isUserFileName 
)
finalprotectedvirtual

Implements G4VAnalysisReader.

Definition at line 202 of file G4RootAnalysisReader.cc.

205 {
206 #ifdef G4VERBOSE
207  if ( fState.GetVerboseL4() )
208  fState.GetVerboseL4()->Message("read", "h2", h2Name);
209 #endif
210 
211  auto buffer = GetBuffer(fileName, h2Name, "ReadH2Impl");
212  if ( ! buffer ) return kInvalidId;
213 
214  // if h2Name represents H1, then we get !!
215  // tools::rroot::buffer::check_byte_count : object of class "TNamed" read too few bytes (603979762 missing).
216  // tools::rroot::buffer::check_byte_count : "TNamed" streamer not in sync with data on file, fix streamer.
217  // Segmentation fault (core dumped)
218 
219  auto h2 = tools::rroot::TH2D_stream(*buffer);
220  delete buffer;
221 
222  if ( ! h2 ) {
223  G4ExceptionDescription description;
224  description
225  << " "
226  << "Streaming " << h2Name << " in file " << fileName << " failed.";
227  G4Exception("G4RootAnalysisReader::ReadH2Impl",
228  "Analysis_WR011", JustWarning, description);
229  return kInvalidId;
230  }
231 
232  auto id = fH2Manager->AddH2(h2Name, h2);
233 
234 #ifdef G4VERBOSE
235  if ( fState.GetVerboseL2() )
236  fState.GetVerboseL2()->Message("read", "h2", h2Name, id > kInvalidId);
237 #endif
238 
239  return id;
240 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
#define buffer
Definition: xmlparse.cc:628
G4AnalysisManagerState fState
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
G4H2ToolsManager * fH2Manager
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4int AddH2(const G4String &name, tools::histo::h2d *h2d)
const G4int kInvalidId

Here is the call graph for this function:

G4int G4RootAnalysisReader::ReadH3Impl ( const G4String h3Name,
const G4String fileName,
G4bool  isUserFileName 
)
finalprotectedvirtual

Implements G4VAnalysisReader.

Definition at line 243 of file G4RootAnalysisReader.cc.

246 {
247 
248 #ifdef G4VERBOSE
249  if ( fState.GetVerboseL4() )
250  fState.GetVerboseL4()->Message("read", "h3", h3Name);
251 #endif
252 
253  auto buffer = GetBuffer(fileName, h3Name, "ReadH3Impl");
254  if ( ! buffer ) return kInvalidId;
255 
256  auto h3 = tools::rroot::TH3D_stream(*buffer);
257  delete buffer;
258 
259  if ( ! h3 ) {
260  G4ExceptionDescription description;
261  description
262  << " "
263  << "Streaming " << h3Name << " in file " << fileName << " failed.";
264  G4Exception("G4RootAnalysisReader::ReadH3Impl",
265  "Analysis_WR011", JustWarning, description);
266  return kInvalidId;
267  }
268 
269  auto id = fH3Manager->AddH3(h3Name, h3);
270 
271 #ifdef G4VERBOSE
272  if ( fState.GetVerboseL2() )
273  fState.GetVerboseL2()->Message("read", "h3", h3Name, id > kInvalidId);
274 #endif
275 
276  return id;
277 /*
278  // not yet available
279  return kInvalidId;
280 */
281 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4int AddH3(const G4String &name, tools::histo::h3d *h3d)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
#define buffer
Definition: xmlparse.cc:628
G4AnalysisManagerState fState
G4H3ToolsManager * fH3Manager
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4int kInvalidId

Here is the call graph for this function:

G4int G4RootAnalysisReader::ReadNtupleImpl ( const G4String ntupleName,
const G4String fileName,
G4bool  isUserFileName 
)
finalprotectedvirtual

Implements G4VAnalysisReader.

Definition at line 357 of file G4RootAnalysisReader.cc.

360 {
361 #ifdef G4VERBOSE
362  if ( fState.GetVerboseL4() )
363  fState.GetVerboseL4()->Message("read", "ntuple", ntupleName);
364 #endif
365 
366  // Ntuples are saved per thread
367  // but do not apply the thread suffix if fileName is provided explicitly
368  auto isPerThread = true;
369  if ( isUserFileName ) isPerThread = false;
370 
371  // Get or open a file
372  auto rfile = fFileManager->GetRFile(fileName, isPerThread);
373  if ( ! rfile ) {
374  if ( ! fFileManager->OpenRFile(fileName, isPerThread) ) return kInvalidId;
375  rfile = fFileManager->GetRFile(fileName, isPerThread);
376  }
377 
378  auto key = rfile->dir().find_key(ntupleName);
379  if ( ! key ) {
380  G4ExceptionDescription description;
381  description
382  << " "
383  << "Key " << ntupleName << " for Ntuple not found in file " << fileName;
384  G4Exception("G4RootAnalysisReader::ReadNtupleImpl()",
385  "Analysis_WR011", JustWarning, description);
386  return kInvalidId;
387  }
388 
389  unsigned int size;
390  char* charBuffer = key->get_object_buffer(*rfile, size);
391  if ( ! charBuffer ) {
392  G4ExceptionDescription description;
393  description
394  << " "
395  << "Cannot get data buffer for Ntuple " << ntupleName << " in file " << fileName;
396  G4Exception("G4RootAnalysisReader::ReadNtupleImpl()",
397  "Analysis_WR021", JustWarning, description);
398  return kInvalidId;
399  }
400 
401  auto verbose = false;
402  auto buffer
403  = new tools::rroot::buffer(G4cout, rfile->byte_swap(), size, charBuffer,
404  key->key_length(), verbose);
405  auto fac = new tools::rroot::fac(G4cout);
406 
407  auto tree = new tools::rroot::tree(*rfile, *fac);
408  if ( ! tree->stream(*buffer) ) {
409  G4ExceptionDescription description;
410  description
411  << " "
412  << "TTree streaming failed for Ntuple " << ntupleName << " in file " << fileName;
413  G4Exception("G4RootAnalysisReader::ReadNtupleImpl()",
414  "Analysis_WR021", JustWarning, description);
415 
416  delete buffer;
417  delete tree;
418  return kInvalidId;
419  }
420 
421  auto rntuple
422  = new tools::rroot::ntuple(*tree); //use the flat ntuple API.
423  auto rntupleDescription
424  = new G4RootRNtupleDescription(rntuple, buffer, fac, tree);
425 
426  auto id = fNtupleManager->SetNtuple(rntupleDescription);
427 
428 #ifdef G4VERBOSE
429  if ( fState.GetVerboseL2() )
430  fState.GetVerboseL2()->Message("read", "ntuple", ntupleName, id > kInvalidId);
431 #endif
432 
433  return id;
434 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
#define buffer
Definition: xmlparse.cc:628
G4AnalysisManagerState fState
const G4AnalysisVerbose * GetVerboseL2() const
G4int SetNtuple(G4RootRNtupleDescription *rntupleDescription)
virtual G4bool OpenRFile(const G4String &fileName, G4bool isPerThread)
G4GLOB_DLL std::ostream G4cout
const G4AnalysisVerbose * GetVerboseL4() const
tools::rroot::file * GetRFile(const G4String &fileName, G4bool isPerThread) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static const G4double fac
const G4int kInvalidId

Here is the call graph for this function:

G4int G4RootAnalysisReader::ReadP1Impl ( const G4String p1Name,
const G4String fileName,
G4bool  isUserFileName 
)
finalprotectedvirtual

Implements G4VAnalysisReader.

Definition at line 284 of file G4RootAnalysisReader.cc.

287 {
288 #ifdef G4VERBOSE
289  if ( fState.GetVerboseL4() )
290  fState.GetVerboseL4()->Message("read", "p1", p1Name);
291 #endif
292 
293  auto buffer = GetBuffer(fileName, p1Name, "ReadP1Impl");
294  if ( ! buffer ) return kInvalidId;
295 
296  auto p1 = tools::rroot::TProfile_stream(*buffer);
297  delete buffer;
298 
299  if ( ! p1 ) {
300  G4ExceptionDescription description;
301  description
302  << " "
303  << "Streaming " << p1Name << " in file " << fileName << " failed.";
304  G4Exception("G4RootAnalysisReader::ReadP1Impl",
305  "Analysis_WR011", JustWarning, description);
306  return kInvalidId;
307  }
308 
309  auto id = fP1Manager->AddP1(p1Name, p1);
310 
311 #ifdef G4VERBOSE
312  if ( fState.GetVerboseL2() )
313  fState.GetVerboseL2()->Message("read", "p1", p1Name, id > kInvalidId);
314 #endif
315 
316  return id;
317 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4P1ToolsManager * fP1Manager
#define buffer
Definition: xmlparse.cc:628
G4AnalysisManagerState fState
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4int AddP1(const G4String &name, tools::histo::p1d *p1d)
const G4int kInvalidId

Here is the call graph for this function:

G4int G4RootAnalysisReader::ReadP2Impl ( const G4String p2Name,
const G4String fileName,
G4bool  isUserFileName 
)
finalprotectedvirtual

Implements G4VAnalysisReader.

Definition at line 320 of file G4RootAnalysisReader.cc.

323 {
324 
325 #ifdef G4VERBOSE
326  if ( fState.GetVerboseL4() )
327  fState.GetVerboseL4()->Message("read", "p2", p2Name);
328 #endif
329 
330  auto buffer = GetBuffer(fileName, p2Name, "ReadP2Impl");
331  if ( ! buffer ) return kInvalidId;
332 
333  auto p2 = tools::rroot::TProfile2D_stream(*buffer);
334  delete buffer;
335 
336  if ( ! p2 ) {
337  G4ExceptionDescription description;
338  description
339  << " "
340  << "Streaming " << p2Name << " in file " << fileName << " failed.";
341  G4Exception("G4RootAnalysisReader::ReadP2Impl",
342  "Analysis_WR011", JustWarning, description);
343  return kInvalidId;
344  }
345 
346  auto id = fP2Manager->AddP2(p2Name, p2);
347 
348 #ifdef G4VERBOSE
349  if ( fState.GetVerboseL2() )
350  fState.GetVerboseL2()->Message("read", "p2", p2Name, id > kInvalidId);
351 #endif
352 
353  return id;
354 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
#define buffer
Definition: xmlparse.cc:628
G4AnalysisManagerState fState
G4int AddP2(const G4String &name, tools::histo::p2d *p2d)
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4P2ToolsManager * fP2Manager
const G4int kInvalidId

Here is the call graph for this function:


The documentation for this class was generated from the following files: