Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
194bf882
Commit
194bf882
authored
8 years ago
by
Oliver Freyermuth
Committed by
Philippe Canal
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix initialization order for TDatabasePDG global static
parent
77dd5fad
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
montecarlo/eg/inc/TDatabasePDG.h
+1
-3
1 addition, 3 deletions
montecarlo/eg/inc/TDatabasePDG.h
montecarlo/eg/src/TDatabasePDG.cxx
+20
-6
20 additions, 6 deletions
montecarlo/eg/src/TDatabasePDG.cxx
with
21 additions
and
9 deletions
montecarlo/eg/inc/TDatabasePDG.h
+
1
−
3
View file @
194bf882
...
...
@@ -25,7 +25,6 @@ class TExMap;
class
TDatabasePDG
:
public
TNamed
{
protected:
static
TDatabasePDG
*
fgInstance
;
// protect against multiple instances
THashList
*
fParticleList
;
// list of PDG particles
TObjArray
*
fListOfClasses
;
// list of classes (leptons etc.)
mutable
TExMap
*
fPdgMap
;
//!hash-map from pdg-code to particle
...
...
@@ -84,8 +83,7 @@ public:
virtual
void
ReadPDGTable
(
const
char
*
filename
=
""
);
virtual
Int_t
WritePDGTable
(
const
char
*
filename
);
ClassDef
(
TDatabasePDG
,
2
)
// PDG particle database
ClassDef
(
TDatabasePDG
,
3
);
// PDG particle database
};
#endif
This diff is collapsed.
Click to expand it.
montecarlo/eg/src/TDatabasePDG.cxx
+
20
−
6
View file @
194bf882
...
...
@@ -49,7 +49,14 @@ See TParticle for the description of a dynamic particle particle.
ClassImp
(
TDatabasePDG
)
TDatabasePDG
*
TDatabasePDG
::
fgInstance
=
0
;
////////////////////////////////////////////////////////////////////////////////
/// Static function holding the instance.
TDatabasePDG
**
GetInstancePtr
()
{
static
TDatabasePDG
*
fgInstance
=
nullptr
;
return
&
fgInstance
;
}
////////////////////////////////////////////////////////////////////////////////
/// Create PDG database. Initialization of the DB has to be done via explicit
...
...
@@ -60,10 +67,11 @@ TDatabasePDG::TDatabasePDG(): TNamed("PDGDB","The PDG particle data base")
fParticleList
=
0
;
fPdgMap
=
0
;
fListOfClasses
=
0
;
if
(
fgInstance
)
{
auto
fgInstance
=
GetInstancePtr
();
if
(
*
fgInstance
!=
nullptr
)
{
Warning
(
"TDatabasePDG"
,
"object already instantiated"
);
}
else
{
fgInstance
=
this
;
*
fgInstance
=
this
;
gROOT
->
GetListOfSpecials
()
->
Add
(
this
);
}
}
...
...
@@ -84,15 +92,21 @@ TDatabasePDG::~TDatabasePDG()
delete
fListOfClasses
;
}
gROOT
->
GetListOfSpecials
()
->
Remove
(
this
);
fgInstance
=
0
;
auto
fgInstance
=
GetInstancePtr
();
*
fgInstance
=
nullptr
;
}
////////////////////////////////////////////////////////////////////////////////
///static function
TDatabasePDG
*
TDatabasePDG
::
Instance
()
TDatabasePDG
*
TDatabasePDG
::
Instance
()
{
return
(
fgInstance
)
?
(
TDatabasePDG
*
)
fgInstance
:
new
TDatabasePDG
();
auto
fgInstance
=
GetInstancePtr
();
if
(
*
fgInstance
==
nullptr
)
{
// Constructor creates a new instance, inits fgInstance.
new
TDatabasePDG
();
}
return
*
fgInstance
;
}
////////////////////////////////////////////////////////////////////////////////
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment