Skip to content

Commit cce313e

Browse files
committed
Check loaded environment
1 parent eb014f6 commit cce313e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Common/Constants/include/CommonConstants/make_pdg_header.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
from ctypes import c_bool
2323
from enum import Enum
2424

25-
import ROOT # pylint: disable=import-error
25+
try:
26+
import ROOT # pylint: disable=import-error
27+
from ROOT import o2
28+
except (ModuleNotFoundError, ImportError) as exc:
29+
raise Exception("O2 environment is not loaded.") from exc
2630

2731

2832
# Enum of PDG_t particles
@@ -150,7 +154,7 @@ class Pdg(Enum):
150154
kLambda1520_Py = 102134 # PYTHIA code different from PDG
151155

152156

153-
dbPdg = ROOT.o2.O2DatabasePDG
157+
dbPdg = o2.O2DatabasePDG
154158

155159

156160
def mass(code):

0 commit comments

Comments
 (0)