Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Show more breadcrumbs
Computing
cbmroot
Commits
40963796
Commit
40963796
authored
4 years ago
by
Administrator
Browse files
Options
Downloads
Patches
Plain Diff
sts: Add gFile + gDirectory protection
parent
f1b4a1d4
No related branches found
No related tags found
1 merge request
!282
Sts fix tfile glob point
Pipeline
#8999
passed
4 years ago
Stage: documentation
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/detectors/sts/CbmStsSetup.cxx
+13
-0
13 additions, 0 deletions
core/detectors/sts/CbmStsSetup.cxx
with
13 additions
and
0 deletions
core/detectors/sts/CbmStsSetup.cxx
+
13
−
0
View file @
40963796
...
...
@@ -19,6 +19,7 @@
#include
<FairRun.h>
// for FairRun
#include
<TCollection.h>
// for TIter
#include
<TDirectory.h>
// for TDirectory, gDirectory
#include
<TFile.h>
// for TFile
#include
<TGeoManager.h>
// for TGeoManager, gGeoManager
#include
<TGeoMatrix.h>
// for TGeoHMatrix
...
...
@@ -33,6 +34,7 @@
#include
<cassert>
// for assert
#include
<iomanip>
// for setw, __iom_t6
#include
<iostream>
// for fstream, string, char_traits
#include
<string.h>
// for strcmp
using
namespace
std
;
...
...
@@ -375,10 +377,15 @@ Bool_t CbmStsSetup::ReadGeometry(const char* fileName) {
// Exit if a TGeoManager is already present
assert
(
!
gGeoManager
);
TFile
*
oldFile
=
gFile
;
TDirectory
*
oldDir
=
gDirectory
;
// --- Open geometry file
TFile
geoFile
(
fileName
);
if
(
!
geoFile
.
IsOpen
())
{
LOG
(
fatal
)
<<
GetName
()
<<
": Could not open geometry file "
<<
fileName
;
gFile
=
oldFile
;
gDirectory
=
oldDir
;
return
kFALSE
;
}
...
...
@@ -402,6 +409,8 @@ Bool_t CbmStsSetup::ReadGeometry(const char* fileName) {
}
if
(
!
topVolume
)
{
LOG
(
fatal
)
<<
GetName
()
<<
": No TOP volume in file!"
;
gFile
=
oldFile
;
gDirectory
=
oldDir
;
return
kFALSE
;
}
stsGeometry
->
SetTopVolume
(
topVolume
);
...
...
@@ -423,6 +432,8 @@ Bool_t CbmStsSetup::ReadGeometry(const char* fileName) {
}
if
(
!
sts
)
{
LOG
(
error
)
<<
fName
<<
": No top STS node found in geometry!"
;
gFile
=
oldFile
;
gDirectory
=
oldDir
;
return
kFALSE
;
}
...
...
@@ -446,6 +457,8 @@ Bool_t CbmStsSetup::ReadGeometry(const char* fileName) {
// --- Recursively initialise daughter elements
InitDaughters
();
gFile
=
oldFile
;
gDirectory
=
oldDir
;
return
kTRUE
;
}
// -------------------------------------------------------------------------
...
...
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