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

#include <G4CsvAnalysisManager.hh>

+ Inheritance diagram for G4CsvAnalysisManager:

Public Member Functions

 G4CsvAnalysisManager ()
 
 ~G4CsvAnalysisManager ()
 
virtual G4bool OpenFile (const G4String &fileName)
 
virtual G4bool Write ()
 
virtual G4bool CloseFile ()
 
virtual G4int CreateH1 (const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none")
 
virtual G4int CreateH2 (const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none")
 
virtual G4bool SetH1 (G4int id, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none")
 
virtual G4bool SetH2 (G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none")
 
virtual G4bool ScaleH1 (G4int id, G4double factor)
 
virtual G4bool ScaleH2 (G4int id, G4double factor)
 
virtual void CreateNtuple (const G4String &name, const G4String &title)
 
virtual G4int CreateNtupleIColumn (const G4String &name)
 
virtual G4int CreateNtupleFColumn (const G4String &name)
 
virtual G4int CreateNtupleDColumn (const G4String &name)
 
virtual void FinishNtuple ()
 
virtual G4bool FillH1 (G4int id, G4double value, G4double weight=1.0)
 
virtual G4bool FillH2 (G4int id, G4double xvalue, G4double yvalue, G4double weight=1.0)
 
virtual G4bool FillNtupleIColumn (G4int id, G4int value)
 
virtual G4bool FillNtupleFColumn (G4int id, G4float value)
 
virtual G4bool FillNtupleDColumn (G4int id, G4double value)
 
virtual G4bool AddNtupleRow ()
 
virtual G4int GetH1Nbins (G4int id) const
 
virtual G4double GetH1Xmin (G4int id) const
 
virtual G4double GetH1Xmax (G4int id) const
 
virtual G4double GetH1Width (G4int id) const
 
virtual G4int GetH2Nxbins (G4int id) const
 
virtual G4double GetH2Xmin (G4int id) const
 
virtual G4double GetH2Xmax (G4int id) const
 
virtual G4double GetH2XWidth (G4int id) const
 
virtual G4int GetH2Nybins (G4int id) const
 
virtual G4double GetH2Ymin (G4int id) const
 
virtual G4double GetH2Ymax (G4int id) const
 
virtual G4double GetH2YWidth (G4int id) const
 
virtual G4bool SetH1Title (G4int id, const G4String &title)
 
virtual G4bool SetH1XAxisTitle (G4int id, const G4String &title)
 
virtual G4bool SetH1YAxisTitle (G4int id, const G4String &title)
 
virtual G4bool SetH2Title (G4int id, const G4String &title)
 
virtual G4bool SetH2XAxisTitle (G4int id, const G4String &title)
 
virtual G4bool SetH2YAxisTitle (G4int id, const G4String &title)
 
virtual G4bool SetH2ZAxisTitle (G4int id, const G4String &title)
 
virtual G4String GetH1Title (G4int id) const
 
virtual G4String GetH1XAxisTitle (G4int id) const
 
virtual G4String GetH1YAxisTitle (G4int id) const
 
virtual G4String GetH2Title (G4int id) const
 
virtual G4String GetH2XAxisTitle (G4int id) const
 
virtual G4String GetH2YAxisTitle (G4int id) const
 
virtual G4String GetH2ZAxisTitle (G4int id) const
 
virtual tools::wcsv::ntuple * GetNtuple () const
 
virtual G4bool OpenFile ()
 
virtual G4bool OpenFile (const G4String &fileName)=0
 
- Public Member Functions inherited from G4VAnalysisManager
 G4VAnalysisManager (const G4String &type="")
 
virtual ~G4VAnalysisManager ()
 
virtual G4bool OpenFile ()
 
virtual G4bool OpenFile (const G4String &fileName)=0
 
virtual G4bool Write ()=0
 
virtual G4bool CloseFile ()=0
 
virtual G4bool SetFileName (const G4String &fileName)
 
virtual G4bool SetHistoDirectoryName (const G4String &dirName)
 
virtual G4bool SetNtupleDirectoryName (const G4String &dirName)
 
virtual G4String GetFileName () const
 
virtual G4String GetFullFileName () const
 
virtual G4String GetHistoDirectoryName () const
 
virtual G4String GetNtupleDirectoryName () const
 
virtual G4int CreateH1 (const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none")=0
 
virtual G4int CreateH2 (const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none")=0
 
virtual G4bool SetH1 (G4int id, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none")=0
 
virtual G4bool SetH2 (G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none")=0
 
virtual G4bool ScaleH1 (G4int id, G4double factor)=0
 
virtual G4bool ScaleH2 (G4int id, G4double factor)=0
 
virtual void CreateNtuple (const G4String &name, const G4String &title)=0
 
virtual G4int CreateNtupleIColumn (const G4String &name)=0
 
virtual G4int CreateNtupleFColumn (const G4String &name)=0
 
virtual G4int CreateNtupleDColumn (const G4String &name)=0
 
virtual void FinishNtuple ()=0
 
virtual G4bool SetFirstHistoId (G4int firstId)
 
virtual G4bool SetFirstNtupleColumnId (G4int firstId)
 
virtual G4bool FillH1 (G4int id, G4double value, G4double weight=1.0)=0
 
virtual G4bool FillH2 (G4int id, G4double xvalue, G4double yvalue, G4double weight=1.0)=0
 
virtual G4bool FillNtupleIColumn (G4int id, G4int value)=0
 
virtual G4bool FillNtupleFColumn (G4int id, G4float value)=0
 
virtual G4bool FillNtupleDColumn (G4int id, G4double value)=0
 
virtual G4bool AddNtupleRow ()=0
 
void SetActivation (G4bool activation)
 
G4bool GetActivation () const
 
G4bool IsActive () const
 
G4bool IsAscii () const
 
virtual G4int GetNofH1s () const
 
virtual G4int GetNofH2s () const
 
void SetActivation (ObjectType type, G4bool activation)
 
void SetActivation (ObjectType type, G4int id, G4bool activation)
 
void SetAscii (ObjectType type, G4int id, G4bool ascii)
 
virtual G4int GetH1Nbins (G4int id) const =0
 
virtual G4double GetH1Xmin (G4int id) const =0
 
virtual G4double GetH1Xmax (G4int id) const =0
 
virtual G4double GetH1Width (G4int id) const =0
 
virtual G4int GetH2Nxbins (G4int id) const =0
 
virtual G4double GetH2Xmin (G4int id) const =0
 
virtual G4double GetH2Xmax (G4int id) const =0
 
virtual G4double GetH2XWidth (G4int id) const =0
 
virtual G4int GetH2Nybins (G4int id) const =0
 
virtual G4double GetH2Ymin (G4int id) const =0
 
virtual G4double GetH2Ymax (G4int id) const =0
 
virtual G4double GetH2YWidth (G4int id) const =0
 
G4String GetH1Name (G4int id) const
 
G4double GetH1Unit (G4int id) const
 
G4bool GetH1Activation (G4int id) const
 
G4bool GetH1Ascii (G4int id) const
 
G4String GetH2Name (G4int id) const
 
G4double GetH2XUnit (G4int id) const
 
G4double GetH2YUnit (G4int id) const
 
G4bool GetH2Activation (G4int id) const
 
G4bool GetH2Ascii (G4int id) const
 
virtual G4bool SetH1Title (G4int id, const G4String &title)=0
 
virtual G4bool SetH1XAxisTitle (G4int id, const G4String &title)=0
 
virtual G4bool SetH1YAxisTitle (G4int id, const G4String &title)=0
 
virtual G4bool SetH2Title (G4int id, const G4String &title)=0
 
virtual G4bool SetH2XAxisTitle (G4int id, const G4String &title)=0
 
virtual G4bool SetH2YAxisTitle (G4int id, const G4String &title)=0
 
virtual G4bool SetH2ZAxisTitle (G4int id, const G4String &title)=0
 
virtual G4String GetH1Title (G4int id) const =0
 
virtual G4String GetH1XAxisTitle (G4int id) const =0
 
virtual G4String GetH1YAxisTitle (G4int id) const =0
 
virtual G4String GetH2Title (G4int id) const =0
 
virtual G4String GetH2XAxisTitle (G4int id) const =0
 
virtual G4String GetH2YAxisTitle (G4int id) const =0
 
virtual G4String GetH2ZAxisTitle (G4int id) const =0
 
virtual G4int GetVerboseLevel () const
 
virtual void SetVerboseLevel (G4int verboseLevel)
 
G4String GetType () const
 
G4String GetFileType () const
 

Static Public Member Functions

static G4CsvAnalysisManagerInstance ()
 

Protected Member Functions

virtual G4bool WriteOnAscii (std::ofstream &output)
 
- Protected Member Functions inherited from G4VAnalysisManager
void AddH1Information (const G4String &name, const G4String &unitName, const G4String &fcnName, G4double unit, G4Fcn fx)
 
void AddH2Information (const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4double xunit, G4double yunit, G4Fcn fx, G4Fcn fy)
 
G4HnInformationGetH1Information (G4int id) const
 
G4HnInformationGetH2Information (G4int id) const
 
G4HnInformationGetInformation (ObjectType type, G4int id) const
 
G4String GetName (ObjectType type, G4int id) const
 
G4double GetXUnit (ObjectType type, G4int id) const
 
G4double GetYUnit (ObjectType type, G4int id) const
 
G4bool GetActivation (ObjectType type, G4int id) const
 
G4bool GetAscii (ObjectType type, G4int id) const
 
G4bool WriteAscii ()
 
virtual G4bool WriteOnAscii (std::ofstream &output)=0
 
G4double GetUnitValue (const G4String &unit) const
 
G4Fcn GetFunction (const G4String &fcnName) const
 

Additional Inherited Members

- Public Types inherited from G4VAnalysisManager
enum  ObjectType { kH1 , kH2 , kNtuple }
 
- Protected Attributes inherited from G4VAnalysisManager
G4int fVerboseLevel
 
G4bool fActivation
 
G4int fFirstHistoId
 
G4int fFirstNtupleColumnId
 
G4String fFileName
 
G4String fHistoDirectoryName
 
G4String fNtupleDirectoryName
 
G4bool fLockFirstHistoId
 
G4bool fLockFirstNtupleColumnId
 
G4bool fLockFileName
 
G4bool fLockHistoDirectoryName
 
G4bool fLockNtupleDirectoryName
 
G4AnalysisVerbose fVerboseL1
 
G4AnalysisVerbose fVerboseL2
 
G4AnalysisVerbose fVerboseL3
 
G4AnalysisVerbose fVerboseL4
 
G4AnalysisVerbosefpVerboseL1
 
G4AnalysisVerbosefpVerboseL2
 
G4AnalysisVerbosefpVerboseL3
 
G4AnalysisVerbosefpVerboseL4
 

Detailed Description

Definition at line 43 of file G4CsvAnalysisManager.hh.

Constructor & Destructor Documentation

◆ G4CsvAnalysisManager()

G4CsvAnalysisManager::G4CsvAnalysisManager ( )

Definition at line 51 of file G4CsvAnalysisManager.cc.

52 : G4VAnalysisManager("Csv"),
53 fFile(0),
54 fNtuple(0),
55 fNtupleBooking(0),
56 fNtupleIColumnMap(),
57 fNtupleFColumnMap(),
58 fNtupleDColumnMap()
59{
60 if ( fgInstance ) {
61 G4ExceptionDescription description;
62 description << " "
63 << "G4CsvAnalysisManager already exists."
64 << "Cannot create another instance.";
65 G4Exception("G4CsvAnalysisManager::G4CsvAnalysisManager()",
66 "Analysis_F001", FatalException, description);
67 }
68
69 fgInstance = this;
70}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

Referenced by Instance().

◆ ~G4CsvAnalysisManager()

G4CsvAnalysisManager::~G4CsvAnalysisManager ( )

Definition at line 73 of file G4CsvAnalysisManager.cc.

74{
75 delete fNtuple;
76 delete fNtupleBooking;
77 delete fFile;
78
79 fgInstance = 0;
80}

Member Function Documentation

◆ AddNtupleRow()

G4bool G4CsvAnalysisManager::AddNtupleRow ( )
virtual

Implements G4VAnalysisManager.

Definition at line 617 of file G4CsvAnalysisManager.cc.

618{
619#ifdef G4VERBOSE
620 if ( fpVerboseL4 )
621 fpVerboseL4->Message("add", "ntuple row", "");
622#endif
623
624 if ( ! fNtuple ) {
625 G4ExceptionDescription description;
626 description << " " << "ntuple does not exist. ";
627 G4Exception("G4CsvAnalysisManager::AddNtupleRow()",
628 "Analysis_W008", JustWarning, description);
629 return false;
630 }
631
632 fNtuple->add_row();
633#ifdef G4VERBOSE
634 if ( fpVerboseL4 )
635 fpVerboseL4->Message("add", "ntuple row", "");
636#endif
637
638 return true;
639}
@ JustWarning
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true)
G4AnalysisVerbose * fpVerboseL4

◆ CloseFile()

G4bool G4CsvAnalysisManager::CloseFile ( )
virtual

Implements G4VAnalysisManager.

Definition at line 266 of file G4CsvAnalysisManager.cc.

267{
268 G4bool result = true;
269
270#ifdef G4VERBOSE
271 if ( fpVerboseL4 )
272 fpVerboseL4->Message("close", "file", GetFullFileName());
273#endif
274
275 // reset data
276 result = Reset();
277 if ( ! result ) {
278 G4ExceptionDescription description;
279 description << " " << "Resetting data failed";
280 G4Exception("G4CsvAnalysisManager::CloseFile()",
281 "Analysis_W002", JustWarning, description);
282 result = false;
283 }
284
285 // close file
286 fFile->close();
287 fLockFileName = false;
288
289#ifdef G4VERBOSE
290 if ( fpVerboseL1 )
291 fpVerboseL1->Message("close", "file", GetFullFileName());
292#endif
293
294 return true;
295}
bool G4bool
Definition: G4Types.hh:67
G4AnalysisVerbose * fpVerboseL1
virtual G4String GetFullFileName() const

◆ CreateH1()

G4int G4CsvAnalysisManager::CreateH1 ( const G4String name,
const G4String title,
G4int  nbins,
G4double  xmin,
G4double  xmax,
const G4String unitName = "none",
const G4String fcnName = "none" 
)
virtual

Implements G4VAnalysisManager.

Definition at line 298 of file G4CsvAnalysisManager.cc.

304{
305 ExceptionForHistograms("CreateH1");
306 return 0;
307}

◆ CreateH2()

G4int G4CsvAnalysisManager::CreateH2 ( const G4String name,
const G4String title,
G4int  nxbins,
G4double  xmin,
G4double  xmax,
G4int  nybins,
G4double  ymin,
G4double  ymax,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none" 
)
virtual

Implements G4VAnalysisManager.

Definition at line 310 of file G4CsvAnalysisManager.cc.

320{
321 ExceptionForHistograms("CreateH2");
322 return 0;
323}

◆ CreateNtuple()

void G4CsvAnalysisManager::CreateNtuple ( const G4String name,
const G4String title 
)
virtual

Implements G4VAnalysisManager.

Definition at line 366 of file G4CsvAnalysisManager.cc.

368{
369 if ( fNtupleBooking ) {
370 G4ExceptionDescription description;
371 description << " "
372 << "Ntuple already exists. "
373 << "(Only one ntuple is currently supported.)";
374 G4Exception("G4CsvAnalysisManager::CreateNtuple()",
375 "Analysis_W006", JustWarning, description);
376 return;
377 }
378
379#ifdef G4VERBOSE
380 if ( fpVerboseL4 )
381 fpVerboseL4->Message("create", "ntuple", name);
382#endif
383
384 // Create ntuple booking
385 fNtupleBooking = new tools::ntuple_booking();
386 fNtupleBooking->m_name = name;
387 fNtupleBooking->m_title = title;
388 // ntuple booking object is deleted in destructor
389
390 // Create ntuple if the file is open
391 if ( fFile ) {
392 fNtuple = new tools::wcsv::ntuple(*fFile);
393 // ntuple object is deleted when closing a file
394 }
395
396#ifdef G4VERBOSE
397 if ( fpVerboseL2 )
398 fpVerboseL2->Message("create", "ntuple", name);
399#endif
400}
G4AnalysisVerbose * fpVerboseL2

◆ CreateNtupleDColumn()

G4int G4CsvAnalysisManager::CreateNtupleDColumn ( const G4String name)
virtual

Implements G4VAnalysisManager.

Definition at line 479 of file G4CsvAnalysisManager.cc.

480{
481#ifdef G4VERBOSE
482 if ( fpVerboseL4 )
483 fpVerboseL4->Message("create", "ntuple D column", name);
484#endif
485
486 if ( ! fNtupleBooking ) {
487 G4ExceptionDescription description;
488 description << " "
489 << "Ntuple has to be created first. ";
490 G4Exception("G4CsvAnalysisManager::CreateNtupleDColumn()",
491 "Analysis_W005", JustWarning, description);
492 return -1;
493 }
494
495 // Save column info in booking
496 G4int index = fNtupleBooking->m_columns.size();
497 fNtupleBooking->add_column<double>(name);
498
499 // Create column if ntuple already exists
500 if ( fNtuple ) {
501 tools::wcsv::ntuple::column<double>* column
502 = fNtuple->create_column<double>(name);
503 fNtupleDColumnMap[index] = column;
504 }
505
507
508#ifdef G4VERBOSE
509 if ( fpVerboseL2 )
510 fpVerboseL2->Message("create", "ntuple D column", name);
511#endif
512
513 return index + fFirstNtupleColumnId;
514}
int G4int
Definition: G4Types.hh:66

◆ CreateNtupleFColumn()

G4int G4CsvAnalysisManager::CreateNtupleFColumn ( const G4String name)
virtual

Implements G4VAnalysisManager.

Definition at line 441 of file G4CsvAnalysisManager.cc.

442{
443#ifdef G4VERBOSE
444 if ( fpVerboseL4 )
445 fpVerboseL4->Message("create", "ntuple F column", name);
446#endif
447
448 if ( ! fNtupleBooking ) {
449 G4ExceptionDescription description;
450 description << " "
451 << "Ntuple has to be created first. ";
452 G4Exception("G4CsvAnalysisManager::CreateNtupleFColumn()",
453 "Analysis_W005", JustWarning, description);
454 return -1;
455 }
456
457 // Save column info in booking
458 G4int index = fNtupleBooking->m_columns.size();
459 fNtupleBooking->add_column<float>(name);
460
461 // Create column if ntuple already exists
462 if ( fNtuple ) {
463 tools::wcsv::ntuple::column<float>* column
464 = fNtuple->create_column<float>(name);
465 fNtupleFColumnMap[index] = column;
466 }
467
469
470#ifdef G4VERBOSE
471 if ( fpVerboseL2 )
472 fpVerboseL2->Message("create", "ntuple F column", name);
473#endif
474
475 return index + fFirstNtupleColumnId;
476}

◆ CreateNtupleIColumn()

G4int G4CsvAnalysisManager::CreateNtupleIColumn ( const G4String name)
virtual

Implements G4VAnalysisManager.

Definition at line 403 of file G4CsvAnalysisManager.cc.

404{
405#ifdef G4VERBOSE
406 if ( fpVerboseL4 )
407 fpVerboseL4->Message("create", "ntuple I column", name);
408#endif
409
410 if ( ! fNtupleBooking ) {
411 G4ExceptionDescription description;
412 description << " "
413 << "Ntuple has to be created first. ";
414 G4Exception("G4CsvAnalysisManager::CreateNtupleIColumn()",
415 "Analysis_W005", JustWarning, description);
416 return -1;
417 }
418
419 // Save column info in booking
420 G4int index = fNtupleBooking->m_columns.size();
421 fNtupleBooking->add_column<int>(name);
422
423 // Create column if ntuple already exists
424 if ( fNtuple ) {
425 tools::wcsv::ntuple::column<int>* column
426 = fNtuple->create_column<int>(name);
427 fNtupleIColumnMap[index] = column;
428 }
429
431
432#ifdef G4VERBOSE
433 if ( fpVerboseL2 )
434 fpVerboseL2->Message("create", "ntuple I column", name);
435#endif
436
437 return index + fFirstNtupleColumnId;
438}

◆ FillH1()

G4bool G4CsvAnalysisManager::FillH1 ( G4int  id,
G4double  value,
G4double  weight = 1.0 
)
virtual

Implements G4VAnalysisManager.

Definition at line 524 of file G4CsvAnalysisManager.cc.

526{
527 G4ExceptionDescription description;
528 description << " "
529 << "Histograms are not supported." ;
530 G4Exception("G4CsvAnalysisManager::FillH1()",
531 "Analysis_W007", JustWarning, description);
532 return false;
533}

◆ FillH2()

G4bool G4CsvAnalysisManager::FillH2 ( G4int  id,
G4double  xvalue,
G4double  yvalue,
G4double  weight = 1.0 
)
virtual

Implements G4VAnalysisManager.

Definition at line 536 of file G4CsvAnalysisManager.cc.

539{
540 G4ExceptionDescription description;
541 description << " "
542 << "Histograms are not supported." ;
543 G4Exception("G4CsvAnalysisManager::FillH2()",
544 "Analysis_W007", JustWarning, description);
545 return false;
546}

◆ FillNtupleDColumn()

G4bool G4CsvAnalysisManager::FillNtupleDColumn ( G4int  id,
G4double  value 
)
virtual

Implements G4VAnalysisManager.

Definition at line 594 of file G4CsvAnalysisManager.cc.

595{
596 tools::wcsv::ntuple::column<double>* column = GetNtupleDColumn(id);
597 if ( ! column ) {
598 G4ExceptionDescription description;
599 description << " " << "column " << id << " does not exist.";
600 G4Exception("G4CsvAnalysisManager::FillNtupleDColumn()",
601 "Analysis_W009", JustWarning, description);
602 return false;
603 }
604
605 column->fill(value);
606#ifdef G4VERBOSE
607 if ( fpVerboseL4 ) {
608 G4ExceptionDescription description;
609 description << " id " << id << " value " << value;
610 fpVerboseL4->Message("fill", "ntuple D column", description);
611 }
612#endif
613 return true;
614}

◆ FillNtupleFColumn()

G4bool G4CsvAnalysisManager::FillNtupleFColumn ( G4int  id,
G4float  value 
)
virtual

Implements G4VAnalysisManager.

Definition at line 571 of file G4CsvAnalysisManager.cc.

572{
573 tools::wcsv::ntuple::column<float>* column = GetNtupleFColumn(id);
574 if ( ! column ) {
575 G4ExceptionDescription description;
576 description << " " << "column " << id << " does not exist.";
577 G4Exception("G4CsvAnalysisManager::FillNtupleFColumn()",
578 "Analysis_W009", JustWarning, description);
579 return false;
580 }
581
582 column->fill(value);
583#ifdef G4VERBOSE
584 if ( fpVerboseL4 ) {
585 G4ExceptionDescription description;
586 description << " id " << id << " value " << value;
587 fpVerboseL4->Message("fill", "ntuple F column", description);
588 }
589#endif
590 return true;
591}

◆ FillNtupleIColumn()

G4bool G4CsvAnalysisManager::FillNtupleIColumn ( G4int  id,
G4int  value 
)
virtual

Implements G4VAnalysisManager.

Definition at line 549 of file G4CsvAnalysisManager.cc.

550{
551 tools::wcsv::ntuple::column<int>* column = GetNtupleIColumn(id);
552 if ( ! column ) {
553 G4ExceptionDescription description;
554 description << " " << "column " << id << " does not exist.";
555 G4Exception("G4CsvAnalysisManager::FillNtupleIColumn()",
556 "Analysis_W009", JustWarning, description);
557 return false;
558 }
559
560 column->fill(value);
561#ifdef G4VERBOSE
562 if ( fpVerboseL4 ) {
563 G4ExceptionDescription description;
564 description << " id " << id << " value " << value;
565 fpVerboseL4->Message("fill", "ntuple I column", description);
566 }
567#endif
568 return true;
569}

◆ FinishNtuple()

void G4CsvAnalysisManager::FinishNtuple ( )
virtual

Implements G4VAnalysisManager.

Definition at line 517 of file G4CsvAnalysisManager.cc.

518{
519 // nothing to be done here
520}

◆ GetH1Nbins()

G4int G4CsvAnalysisManager::GetH1Nbins ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 649 of file G4CsvAnalysisManager.cc.

650{
651 ExceptionForHistograms("GetH1Nbins");
652 return 0;
653}

◆ GetH1Title()

G4String G4CsvAnalysisManager::GetH1Title ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 796 of file G4CsvAnalysisManager.cc.

797{
798 ExceptionForHistograms("GetH1Title");
799 return "";
800}

◆ GetH1Width()

G4double G4CsvAnalysisManager::GetH1Width ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 670 of file G4CsvAnalysisManager.cc.

671{
672 ExceptionForHistograms("GetH1Xwidth");
673 return 0;
674}

◆ GetH1XAxisTitle()

G4String G4CsvAnalysisManager::GetH1XAxisTitle ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 789 of file G4CsvAnalysisManager.cc.

790{
791 ExceptionForHistograms("GetH1XAxisTitle");
792 return "";
793}

◆ GetH1Xmax()

G4double G4CsvAnalysisManager::GetH1Xmax ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 663 of file G4CsvAnalysisManager.cc.

664{
665 ExceptionForHistograms("GetH1Xmax");
666 return 0;
667}

◆ GetH1Xmin()

G4double G4CsvAnalysisManager::GetH1Xmin ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 656 of file G4CsvAnalysisManager.cc.

657{
658 ExceptionForHistograms("GetH1Xmin");
659 return 0;
660}

◆ GetH1YAxisTitle()

G4String G4CsvAnalysisManager::GetH1YAxisTitle ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 803 of file G4CsvAnalysisManager.cc.

804{
805 ExceptionForHistograms("GetH1YAxisTitle");
806 return "";
807}

◆ GetH2Nxbins()

G4int G4CsvAnalysisManager::GetH2Nxbins ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 677 of file G4CsvAnalysisManager.cc.

678{
679 ExceptionForHistograms("GetH2NXbins");
680 return 0;
681}

◆ GetH2Nybins()

G4int G4CsvAnalysisManager::GetH2Nybins ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 705 of file G4CsvAnalysisManager.cc.

706{
707 ExceptionForHistograms("GetH2NYbins");
708 return 0;
709}

◆ GetH2Title()

G4String G4CsvAnalysisManager::GetH2Title ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 811 of file G4CsvAnalysisManager.cc.

812{
813 ExceptionForHistograms("GetH2Title");
814 return "";
815}

◆ GetH2XAxisTitle()

G4String G4CsvAnalysisManager::GetH2XAxisTitle ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 818 of file G4CsvAnalysisManager.cc.

819{
820 ExceptionForHistograms("GetH2XAxisTitle");
821 return "";
822}

◆ GetH2Xmax()

G4double G4CsvAnalysisManager::GetH2Xmax ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 691 of file G4CsvAnalysisManager.cc.

692{
693 ExceptionForHistograms("GetH2Xmin");
694 return 0;
695}

◆ GetH2Xmin()

G4double G4CsvAnalysisManager::GetH2Xmin ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 684 of file G4CsvAnalysisManager.cc.

685{
686 ExceptionForHistograms("GetH2Xmin");
687 return 0;
688}

◆ GetH2XWidth()

G4double G4CsvAnalysisManager::GetH2XWidth ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 698 of file G4CsvAnalysisManager.cc.

699{
700 ExceptionForHistograms("GetH2XWidth");
701 return 0;
702}

◆ GetH2YAxisTitle()

G4String G4CsvAnalysisManager::GetH2YAxisTitle ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 825 of file G4CsvAnalysisManager.cc.

826{
827 ExceptionForHistograms("GetH2YAxisTitle");
828 return "";
829}

◆ GetH2Ymax()

G4double G4CsvAnalysisManager::GetH2Ymax ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 719 of file G4CsvAnalysisManager.cc.

720{
721 ExceptionForHistograms("GetH2Ymax");
722 return 0;
723}

◆ GetH2Ymin()

G4double G4CsvAnalysisManager::GetH2Ymin ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 712 of file G4CsvAnalysisManager.cc.

713{
714 ExceptionForHistograms("GetH2Ymin");
715 return 0;
716}

◆ GetH2YWidth()

G4double G4CsvAnalysisManager::GetH2YWidth ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 726 of file G4CsvAnalysisManager.cc.

727{
728 ExceptionForHistograms("GetH2YWidth");
729 return 0;
730}

◆ GetH2ZAxisTitle()

G4String G4CsvAnalysisManager::GetH2ZAxisTitle ( G4int  id) const
virtual

Implements G4VAnalysisManager.

Definition at line 832 of file G4CsvAnalysisManager.cc.

833{
834 ExceptionForHistograms("GetH2ZAxisTitle");
835 return "";
836}

◆ GetNtuple()

tools::wcsv::ntuple * G4CsvAnalysisManager::GetNtuple ( ) const
virtual

Definition at line 642 of file G4CsvAnalysisManager.cc.

643{
644 return fNtuple;
645}

◆ Instance()

G4CsvAnalysisManager * G4CsvAnalysisManager::Instance ( )
static

Definition at line 41 of file G4CsvAnalysisManager.cc.

42{
43 if ( fgInstance == 0 ) {
44 fgInstance = new G4CsvAnalysisManager();
45 }
46
47 return fgInstance;
48}

◆ OpenFile() [1/3]

G4bool G4VAnalysisManager::OpenFile ( )
virtual

Reimplemented from G4VAnalysisManager.

Definition at line 53 of file G4VAnalysisManager.cc.

267{
268 if ( fFileName == "" ) {
269 G4ExceptionDescription description;
270 description
271 << "Cannot open file. File name is not defined.";
272 G4Exception("G4VAnalysisManager::OpenFile()",
273 "Analysis_W009", JustWarning, description);
274 return false;
275 }
276
277 return OpenFile(fFileName);
278}
virtual G4bool OpenFile()

◆ OpenFile() [2/3]

G4bool G4CsvAnalysisManager::OpenFile ( const G4String fileName)
virtual

Implements G4VAnalysisManager.

Definition at line 177 of file G4CsvAnalysisManager.cc.

178{
179 // Keep file name
180 fFileName = fileName;
181
182 // Add file extension .csv if no extension is given
183 G4String name(fileName);
184 if ( name.find(".") == std::string::npos ) {
185 name.append(".");
186 name.append(GetFileType());
187 }
188
189#ifdef G4VERBOSE
190 if ( fpVerboseL4 )
191 fpVerboseL4->Message("open", "analysis file", name);
192#endif
193
194 // delete a previous file if it exists
195 if ( fFile ) delete fFile;
196
197 fFile = new std::ofstream(name);
198 if ( fFile->fail() ) {
199 G4ExceptionDescription description;
200 description << " " << "Cannot open file " << fileName;
201 G4Exception("G4CsvAnalysisManager::OpenFile()",
202 "Analysis_W001", JustWarning, description);
203 return false;
204 }
205
206 // Create ntuple if it was already booked
207 if ( fNtupleBooking && ( ! fNtuple ) ) {
208#ifdef G4VERBOSE
209 if ( fpVerboseL4 )
210 fpVerboseL4->Message("create from booking", "ntuple", name);
211#endif
212 fNtuple = new tools::wcsv::ntuple(*fFile, G4cerr, *fNtupleBooking);
213 if ( fNtupleBooking->m_columns.size() ) {
214 // store ntuple columns in local maps
215 const std::vector<tools::ntuple_booking::col_t>& columns
216 = fNtupleBooking->m_columns;
217 std::vector<tools::ntuple_booking::col_t>::const_iterator it;
218 G4int index = 0;
219 for ( it = columns.begin(); it!=columns.end(); ++it) {
220 if ( (*it).second == tools::_cid(int(0) ) ) {
221 G4cout << "adding int " << fNtuple->find_column<int>((*it).first) << G4endl;
222 fNtupleIColumnMap[index++] = fNtuple->find_column<int>((*it).first);
223 }
224 else if( (*it).second == tools::_cid(float(0) ) ) {
225 fNtupleFColumnMap[index++] = fNtuple->find_column<float>((*it).first);
226 }
227 else if((*it).second== tools::_cid(double(0))) {
228 fNtupleDColumnMap[index++] = fNtuple->find_column<double>((*it).first);
229 }
230 else {
231 G4ExceptionDescription description;
232 description << " "
233 << "Unsupported column type " << (*it).first;
234 G4Exception("G4CsvAnalysisManager::OpenFile()",
235 "Analysis_W004", JustWarning, description);
236 }
237 }
238 }
239 }
240
241 fLockFileName = true;
242
243#ifdef G4VERBOSE
244 if ( fpVerboseL1 )
245 fpVerboseL1->Message("open", "analysis file", name);
246#endif
247
248 return true;
249}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
G4String GetFileType() const

◆ OpenFile() [3/3]

virtual G4bool G4VAnalysisManager::OpenFile ( const G4String fileName)
virtual

Implements G4VAnalysisManager.

◆ ScaleH1()

G4bool G4CsvAnalysisManager::ScaleH1 ( G4int  id,
G4double  factor 
)
virtual

Implements G4VAnalysisManager.

Definition at line 352 of file G4CsvAnalysisManager.cc.

353{
354 ExceptionForHistograms("ScaleH1");
355 return false;
356}

◆ ScaleH2()

G4bool G4CsvAnalysisManager::ScaleH2 ( G4int  id,
G4double  factor 
)
virtual

Implements G4VAnalysisManager.

Definition at line 359 of file G4CsvAnalysisManager.cc.

360{
361 ExceptionForHistograms("ScaleH2");
362 return false;
363}

◆ SetH1()

G4bool G4CsvAnalysisManager::SetH1 ( G4int  id,
G4int  nbins,
G4double  xmin,
G4double  xmax,
const G4String unitName = "none",
const G4String fcnName = "none" 
)
virtual

Implements G4VAnalysisManager.

Definition at line 326 of file G4CsvAnalysisManager.cc.

331{
332 ExceptionForHistograms("SetH1");
333 return false;
334}

◆ SetH1Title()

G4bool G4CsvAnalysisManager::SetH1Title ( G4int  id,
const G4String title 
)
virtual

Implements G4VAnalysisManager.

Definition at line 733 of file G4CsvAnalysisManager.cc.

735{
736 ExceptionForHistograms("SetH1Title");
737 return false;
738}

◆ SetH1XAxisTitle()

G4bool G4CsvAnalysisManager::SetH1XAxisTitle ( G4int  id,
const G4String title 
)
virtual

Implements G4VAnalysisManager.

Definition at line 741 of file G4CsvAnalysisManager.cc.

743{
744 ExceptionForHistograms("SetH1XAxisTitle");
745 return false;
746}

◆ SetH1YAxisTitle()

G4bool G4CsvAnalysisManager::SetH1YAxisTitle ( G4int  id,
const G4String title 
)
virtual

Implements G4VAnalysisManager.

Definition at line 749 of file G4CsvAnalysisManager.cc.

751{
752 ExceptionForHistograms("SetH1YAxisTitle");
753 return false;
754}

◆ SetH2()

G4bool G4CsvAnalysisManager::SetH2 ( G4int  id,
G4int  nxbins,
G4double  xmin,
G4double  xmax,
G4int  nybins,
G4double  ymin,
G4double  ymax,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none" 
)
virtual

Implements G4VAnalysisManager.

Definition at line 337 of file G4CsvAnalysisManager.cc.

346{
347 ExceptionForHistograms("SetH2");
348 return false;
349}

◆ SetH2Title()

G4bool G4CsvAnalysisManager::SetH2Title ( G4int  id,
const G4String title 
)
virtual

Implements G4VAnalysisManager.

Definition at line 757 of file G4CsvAnalysisManager.cc.

759{
760 ExceptionForHistograms("SetH2Title");
761 return false;
762}

◆ SetH2XAxisTitle()

G4bool G4CsvAnalysisManager::SetH2XAxisTitle ( G4int  id,
const G4String title 
)
virtual

Implements G4VAnalysisManager.

Definition at line 765 of file G4CsvAnalysisManager.cc.

767{
768 ExceptionForHistograms("SetH2XAxisTitle");
769 return false;
770}

◆ SetH2YAxisTitle()

G4bool G4CsvAnalysisManager::SetH2YAxisTitle ( G4int  id,
const G4String title 
)
virtual

Implements G4VAnalysisManager.

Definition at line 773 of file G4CsvAnalysisManager.cc.

775{
776 ExceptionForHistograms("SetH2YAxisTitle");
777 return false;
778}

◆ SetH2ZAxisTitle()

G4bool G4CsvAnalysisManager::SetH2ZAxisTitle ( G4int  id,
const G4String title 
)
virtual

Implements G4VAnalysisManager.

Definition at line 781 of file G4CsvAnalysisManager.cc.

783{
784 ExceptionForHistograms("SetH2ZAxisTitle");
785 return false;
786}

◆ Write()

G4bool G4CsvAnalysisManager::Write ( )
virtual

Implements G4VAnalysisManager.

Definition at line 252 of file G4CsvAnalysisManager.cc.

253{
254 // nothing to be done for Csv file
255 G4bool result = true;
256
257 // Write ASCII if activated
258 if ( IsAscii() ) {
259 result = WriteAscii();
260 }
261
262 return result;
263}

◆ WriteOnAscii()

G4bool G4CsvAnalysisManager::WriteOnAscii ( std::ofstream &  output)
protectedvirtual

Implements G4VAnalysisManager.

Definition at line 164 of file G4CsvAnalysisManager.cc.

165{
166// Write selected objects on ASCII file
167// To be added: ntuple
168
169 return true;
170}

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