Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHGeomTGeo.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHGeomTGeo.cc
1
// $Id: $
2
11
#include "
PHGeomTGeo.h
"
12
13
#include "TGeoManager.h"
14
15
#include <cassert>
16
#include <cstdlib>
17
#include <iostream>
18
19
using namespace
std;
20
21
PHGeomTGeo::PHGeomTGeo
()
22
: _fGeom(nullptr)
23
{
24
}
25
26
PHGeomTGeo::~PHGeomTGeo
()
27
{
28
ConsistencyCheck
();
29
if
(
_fGeom
)
30
{
31
_fGeom
->UnlockGeometry();
32
}
33
delete
_fGeom
;
34
}
35
36
void
PHGeomTGeo::SetGeometry
(TGeoManager*
g
)
37
{
38
ConsistencyCheck
();
39
assert
(
_fGeom
==
nullptr
);
40
41
if
(!g)
42
{
43
cout << __PRETTY_FUNCTION__ <<
" - Error - Invalid input"
<< endl;
44
return
;
45
}
46
47
_fGeom
=
g
;
48
_fGeom
->LockGeometry();
49
50
ConsistencyCheck
();
51
}
52
53
TGeoManager*
54
PHGeomTGeo::GetGeometry
()
55
{
56
if
(
_fGeom
==
nullptr
)
57
return
nullptr
;
58
59
ConsistencyCheck
();
60
61
if
(
_fGeom
== gGeoManager)
62
return
_fGeom
;
63
else
64
{
65
return
nullptr
;
66
}
67
}
68
72
void
PHGeomTGeo::identify
(std::ostream&
os
)
const
73
{
74
os <<
"PHGeomTGeo - "
;
75
if
(
_fGeom
)
76
os <<
" with geometry data "
<<
_fGeom
->GetName() <<
": "
77
<<
_fGeom
->GetTitle();
78
else
79
os <<
"Empty"
;
80
os << endl;
81
ConsistencyCheck
();
82
}
83
85
void
PHGeomTGeo::Reset
()
86
{
87
ConsistencyCheck
();
88
89
if
(
_fGeom
)
90
{
91
_fGeom
->UnlockGeometry();
92
delete
_fGeom
;
93
}
94
_fGeom
=
nullptr
;
95
}
96
98
int
PHGeomTGeo::isValid
()
const
99
{
100
ConsistencyCheck
();
101
102
if
(
_fGeom
==
nullptr
)
103
return
0;
104
if
(
_fGeom
->IsZombie())
105
return
0;
106
return
1;
107
}
108
109
bool
PHGeomTGeo::ConsistencyCheck
()
const
110
{
111
if
(
_fGeom
==
nullptr
)
112
return
true
;
// uninitialized
113
114
if
(
_fGeom
== gGeoManager)
115
return
true
;
116
else
117
{
118
cout << __PRETTY_FUNCTION__
119
<<
" - ERROR - gGeoManager is overridden by another TGeoManager. "
120
<<
"Please avoid using multiple TGeoManager in processing. Stop the process."
121
<< endl;
122
exit(1);
123
return
false
;
124
}
125
}
coresoftware
blob
master
offline
packages
PHGeometry
PHGeomTGeo.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:08
using
1.8.2 with
sPHENIX GitHub integration