Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4RootAnalysisReader Class Reference

#include <G4RootAnalysisReader.hh>

+ Inheritance diagram for G4RootAnalysisReader:

Public Member Functions

 G4RootAnalysisReader (G4bool isMaster=true)
 
virtual ~G4RootAnalysisReader ()
 
tools::rroot::ntuple * GetNtuple () const
 
tools::rroot::ntuple * GetNtuple (G4int ntupleId) const
 
G4int GetNtuple (const G4String &ntupleName, const G4String &fileName="", const G4String &dirName="")
 
- 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="", const G4String &dirName="")
 
G4int ReadH2 (const G4String &h2Name, const G4String &fileName="", const G4String &dirName="")
 
G4int ReadH3 (const G4String &h3Name, const G4String &fileName="", const G4String &dirName="")
 
G4int ReadP1 (const G4String &h1Name, const G4String &fileName="", const G4String &dirName="")
 
G4int ReadP2 (const G4String &h2Name, const G4String &fileName="", const G4String &dirName="")
 
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="", const G4String &dirName="")
 
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, const G4String &dirName, G4bool isUserFileName) final
 
virtual G4int ReadH2Impl (const G4String &h2Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
 
virtual G4int ReadH3Impl (const G4String &h3Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
 
virtual G4int ReadP1Impl (const G4String &p1Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
 
virtual G4int ReadP2Impl (const G4String &p2Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
 
virtual G4int ReadNtupleImpl (const G4String &ntupleName, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
 
- Protected Member Functions inherited from G4ToolsAnalysisReader
G4bool Reset ()
 
- Protected Member Functions inherited from G4VAnalysisReader
virtual G4int ReadH1Impl (const G4String &h1Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName)=0
 
virtual G4int ReadH2Impl (const G4String &h2Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName)=0
 
virtual G4int ReadH3Impl (const G4String &h3Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName)=0
 
virtual G4int ReadP1Impl (const G4String &p1Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName)=0
 
virtual G4int ReadP2Impl (const G4String &p2Name, const G4String &fileName, const G4String &dirName, G4bool isUserFileName)=0
 
virtual G4int ReadNtupleImpl (const G4String &ntupleName, const G4String &fileName, const G4String &dirName, G4bool isUserFileName)=0
 
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 53 of file G4RootAnalysisReader.hh.

Constructor & Destructor Documentation

◆ G4RootAnalysisReader()

G4RootAnalysisReader::G4RootAnalysisReader ( G4bool  isMaster = true)
explicit

Definition at line 62 of file G4RootAnalysisReader.cc.

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

◆ ~G4RootAnalysisReader()

G4RootAnalysisReader::~G4RootAnalysisReader ( )
virtual

Definition at line 90 of file G4RootAnalysisReader.cc.

91{
92 if ( fState.GetIsMaster() ) fgMasterInstance = nullptr;
93 fgInstance = nullptr;
94}

Member Function Documentation

◆ GetNtuple() [1/3]

tools::rroot::ntuple * G4RootAnalysisReader::GetNtuple ( ) const

◆ GetNtuple() [2/3]

G4int G4VAnalysisReader::GetNtuple ( const G4String ntupleName,
const G4String fileName = "",
const G4String dirName = "" 
)

Definition at line 88 of file G4VAnalysisReader.cc.

298{
299 if ( fileName != "" ) {
300 return ReadNtupleImpl(ntupleName, fileName, dirName, true);
301 }
302 else {
303 // Check if fileName was set
304 if ( fFileManager->GetFileName() == "" ) {
305 G4ExceptionDescription description;
306 description
307 << "Cannot get Ntuple. File name has to be set first.";
308 G4Exception("G4VAnalysisReader::GetNtuple()",
309 "Analysis_WR011", JustWarning, description);
310 return kInvalidId;
311 }
312 return ReadNtupleImpl(ntupleName, fFileManager->GetFileName(), dirName, false);
313 }
314}
@ JustWarning
G4String GetFileName() const
virtual G4int ReadNtupleImpl(const G4String &ntupleName, const G4String &fileName, const G4String &dirName, G4bool isUserFileName) final
const G4int kInvalidId

◆ GetNtuple() [3/3]

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

◆ Instance()

G4RootAnalysisReader * G4RootAnalysisReader::Instance ( )
static

Definition at line 51 of file G4RootAnalysisReader.cc.

52{
53 if ( fgInstance == nullptr ) {
55 fgInstance = new G4RootAnalysisReader(isMaster);
56 }
57
58 return fgInstance;
59}
bool G4bool
Definition: G4Types.hh:86
G4bool IsWorkerThread()
Definition: G4Threading.cc:123

◆ ReadH1Impl()

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

Implements G4VAnalysisReader.

Definition at line 164 of file G4RootAnalysisReader.cc.

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

◆ ReadH2Impl()

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

Implements G4VAnalysisReader.

Definition at line 201 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}
G4int AddH2(const G4String &name, tools::histo::h2d *h2d)
G4H2ToolsManager * fH2Manager

◆ ReadH3Impl()

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

Implements G4VAnalysisReader.

Definition at line 243 of file G4RootAnalysisReader.cc.

247{
248
249#ifdef G4VERBOSE
250 if ( fState.GetVerboseL4() )
251 fState.GetVerboseL4()->Message("read", "h3", h3Name);
252#endif
253
254 auto buffer = GetBuffer(fileName, h3Name, "ReadH3Impl");
255 if ( ! buffer ) return kInvalidId;
256
257 auto h3 = tools::rroot::TH3D_stream(*buffer);
258 delete buffer;
259
260 if ( ! h3 ) {
261 G4ExceptionDescription description;
262 description
263 << " "
264 << "Streaming " << h3Name << " in file " << fileName << " failed.";
265 G4Exception("G4RootAnalysisReader::ReadH3Impl",
266 "Analysis_WR011", JustWarning, description);
267 return kInvalidId;
268 }
269
270 auto id = fH3Manager->AddH3(h3Name, h3);
271
272#ifdef G4VERBOSE
273 if ( fState.GetVerboseL2() )
274 fState.GetVerboseL2()->Message("read", "h3", h3Name, id > kInvalidId);
275#endif
276
277 return id;
278/*
279 // not yet available
280 return kInvalidId;
281*/
282}
G4int AddH3(const G4String &name, tools::histo::h3d *h3d)
G4H3ToolsManager * fH3Manager

◆ ReadNtupleImpl()

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

Implements G4VAnalysisReader.

Definition at line 360 of file G4RootAnalysisReader.cc.

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

◆ ReadP1Impl()

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

Implements G4VAnalysisReader.

Definition at line 285 of file G4RootAnalysisReader.cc.

289{
290#ifdef G4VERBOSE
291 if ( fState.GetVerboseL4() )
292 fState.GetVerboseL4()->Message("read", "p1", p1Name);
293#endif
294
295 auto buffer = GetBuffer(fileName, p1Name, "ReadP1Impl");
296 if ( ! buffer ) return kInvalidId;
297
298 auto p1 = tools::rroot::TProfile_stream(*buffer);
299 delete buffer;
300
301 if ( ! p1 ) {
302 G4ExceptionDescription description;
303 description
304 << " "
305 << "Streaming " << p1Name << " in file " << fileName << " failed.";
306 G4Exception("G4RootAnalysisReader::ReadP1Impl",
307 "Analysis_WR011", JustWarning, description);
308 return kInvalidId;
309 }
310
311 auto id = fP1Manager->AddP1(p1Name, p1);
312
313#ifdef G4VERBOSE
314 if ( fState.GetVerboseL2() )
315 fState.GetVerboseL2()->Message("read", "p1", p1Name, id > kInvalidId);
316#endif
317
318 return id;
319}
G4int AddP1(const G4String &name, tools::histo::p1d *p1d)
G4P1ToolsManager * fP1Manager

◆ ReadP2Impl()

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

Implements G4VAnalysisReader.

Definition at line 322 of file G4RootAnalysisReader.cc.

326{
327
328#ifdef G4VERBOSE
329 if ( fState.GetVerboseL4() )
330 fState.GetVerboseL4()->Message("read", "p2", p2Name);
331#endif
332
333 auto buffer = GetBuffer(fileName, p2Name, "ReadP2Impl");
334 if ( ! buffer ) return kInvalidId;
335
336 auto p2 = tools::rroot::TProfile2D_stream(*buffer);
337 delete buffer;
338
339 if ( ! p2 ) {
340 G4ExceptionDescription description;
341 description
342 << " "
343 << "Streaming " << p2Name << " in file " << fileName << " failed.";
344 G4Exception("G4RootAnalysisReader::ReadP2Impl",
345 "Analysis_WR011", JustWarning, description);
346 return kInvalidId;
347 }
348
349 auto id = fP2Manager->AddP2(p2Name, p2);
350
351#ifdef G4VERBOSE
352 if ( fState.GetVerboseL2() )
353 fState.GetVerboseL2()->Message("read", "p2", p2Name, id > kInvalidId);
354#endif
355
356 return id;
357}
G4int AddP2(const G4String &name, tools::histo::p2d *p2d)
G4P2ToolsManager * fP2Manager

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