Geant4  10.02.p03
CCalGeometryConfiguration Class Reference

#include <CCalGeometryConfiguration.hh>

Collaboration diagram for CCalGeometryConfiguration:

Classes

struct  GCInfo
 

Public Member Functions

 ~CCalGeometryConfiguration ()
 
int getConstructFlag (const G4String &n)
 
G4String getFileName (const G4String &n)
 
CCalGeometryConfTablegetConfTable ()
 

Static Public Member Functions

static CCalGeometryConfigurationgetInstance ()
 

Private Types

typedef std::map< G4String, GCInfo, std::less< G4String > > CCalGeometryConfTable
 
typedef std::map< G4String, GCInfo, std::less< G4String > >::iterator CCalGeometryConfIterator
 

Private Member Functions

 CCalGeometryConfiguration ()
 

Private Attributes

CCalGeometryConfTable theConfiguration
 

Static Private Attributes

static CCalGeometryConfigurationinstance = 0
 

Detailed Description

Definition at line 37 of file CCalGeometryConfiguration.hh.

Member Typedef Documentation

◆ CCalGeometryConfIterator

typedef std::map<G4String, GCInfo, std::less<G4String> >::iterator CCalGeometryConfiguration::CCalGeometryConfIterator
private

Definition at line 45 of file CCalGeometryConfiguration.hh.

◆ CCalGeometryConfTable

Definition at line 44 of file CCalGeometryConfiguration.hh.

Constructor & Destructor Documentation

◆ ~CCalGeometryConfiguration()

CCalGeometryConfiguration::~CCalGeometryConfiguration ( )
inline

Definition at line 49 of file CCalGeometryConfiguration.hh.

49 {}
Here is the call graph for this function:

◆ CCalGeometryConfiguration()

CCalGeometryConfiguration::CCalGeometryConfiguration ( )
private

Definition at line 78 of file CCalGeometryConfiguration.cc.

78  :
80 
82  // Open the file
83  G4String pathName = getenv("CCAL_CONFPATH");
84  G4String fileenv = getenv("CCAL_GEOMETRYCONF");
85  if (!pathName || !fileenv) {
87  ed << "ERROR: CCAL_GEOMETRYCONF and/or CCAL_CONFPATH not set" << G4endl
88  << " Set them to the geometry configuration file/path" << G4endl;
89  G4Exception("CCalGeometryConfiguration::CCalGeometryConfiguration()",
90  "ccal003",
91  FatalException,ed);
92  }
93 
94  G4cout << " ==> Opening file " << fileenv << "..." << G4endl;
95  std::ifstream is;
96  bool ok = openGeomFile(is, pathName, fileenv);
97  if (!ok)
98  {
99  G4Exception("CCalGeometryConfiguration::CCalGeometryConfiguration()",
100  "ccal004",
101  FatalException,"Unable to open input data file");
102  }
103 
104 
105  G4String name;
106  GCInfo gcinfo;
107 
108  while (is) {
109  readName(is, name);
110  readName(is, gcinfo.FileName);
111  is >> gcinfo.ConstructFlag >> jump;
112 #ifdef debug
113  G4cout << "CCalGeometryConfiguration constructor: Read \"" << name
114  << "\" \"" << gcinfo.FileName << "\"" << tab << gcinfo.ConstructFlag
115  << G4endl;
116 #endif
117  theConfiguration[name] = gcinfo;
118  }
119 
120 
121 
123  // Close the file
124  is.close();
125  G4cout << " <== Closed file " << fileenv << G4endl;
126 }
CCalGeometryConfTable theConfiguration
bool openGeomFile(std::ifstream &is, const G4String &pathname, const G4String &filename)
Definition: CCalutils.cc:116
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4String name
Definition: TRTMaterials.hh:40
std::istream & jump(std::istream &)
Definition: CCalutils.cc:95
std::ifstream & readName(std::ifstream &, G4String &)
Definition: CCalutils.cc:53
G4GLOB_DLL std::ostream G4cout
std::ostream & tab(std::ostream &)
Definition: CCalutils.cc:89
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ getConfTable()

CCalGeometryConfTable& CCalGeometryConfiguration::getConfTable ( )
inline

Definition at line 56 of file CCalGeometryConfiguration.hh.

56  {
57  return theConfiguration;
58  }
CCalGeometryConfTable theConfiguration
Here is the call graph for this function:

◆ getConstructFlag()

int CCalGeometryConfiguration::getConstructFlag ( const G4String n)

Definition at line 48 of file CCalGeometryConfiguration.cc.

48  {
49  int flag = -1;
51 
52  if (it != theConfiguration.end())
53  flag = (*it).second.ConstructFlag;
54  else {
55  G4cerr << "ERROR: In CCalGeometryConfiguration::getConstructFlag(const G4String& n)"
56  << G4endl
57  << " " << n << " not found in configuration file" << G4endl;
58  }
59 
60  return flag;
61 }
CCalGeometryConfTable theConfiguration
std::map< G4String, GCInfo, std::less< G4String > >::iterator CCalGeometryConfIterator
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
Here is the caller graph for this function:

◆ getFileName()

G4String CCalGeometryConfiguration::getFileName ( const G4String n)

Definition at line 63 of file CCalGeometryConfiguration.cc.

63  {
64  G4String fn;
66 
67  if (it != theConfiguration.end())
68  fn = (*it).second.FileName;
69  else {
70  G4cerr << "ERROR: In CCalGeometryConfiguration::getConstructFlag(const G4String& n)"
71  << G4endl
72  << " " << n << " not found in configuration file" << G4endl;
73  }
74 
75  return fn;
76 }
CCalGeometryConfTable theConfiguration
std::map< G4String, GCInfo, std::less< G4String > >::iterator CCalGeometryConfIterator
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
Here is the caller graph for this function:

◆ getInstance()

CCalGeometryConfiguration * CCalGeometryConfiguration::getInstance ( )
static

Definition at line 41 of file CCalGeometryConfiguration.cc.

41  {
42  if (!instance)
44  return instance;
45 }
static CCalGeometryConfiguration * instance
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ instance

CCalGeometryConfiguration * CCalGeometryConfiguration::instance = 0
staticprivate

Definition at line 64 of file CCalGeometryConfiguration.hh.

◆ theConfiguration

CCalGeometryConfTable CCalGeometryConfiguration::theConfiguration
private

Definition at line 65 of file CCalGeometryConfiguration.hh.


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