ATLAS Offline Software
Loading...
Searching...
No Matches
ReweightUtils.py
Go to the documentation of this file.
1# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3# sanitize shell output
4try:
5 from os import environ
6 if environ.get('TERM','') == 'xterm':
7 environ['TERM'] = 'vt100'
8except ImportError:
9 pass
10except KeyError:
11 pass
12
13# filter out annoying warnings regarding missing converters
14import warnings
15warnings.filterwarnings( action='ignore', category=RuntimeWarning, message='creating converter.*' )
16
17# import basics
18from os import getenv
19from distutils.version import StrictVersion
20from platform import python_version
21
22try:
23 import ROOT
24 # check if the python version is compatible
25 if StrictVersion(python_version()) < StrictVersion('2.7.0'):
26 raise ImportError("\033[1;31mFATAL\033[0m: unsupported python version, please use at least version 2.7.0")
27
28 # we will need this library later
29 ROOT.gSystem.Load("libTreePlayer")
30
31 # retrieve the root core dir environment variable
32 RootCoreDir = getenv ("ROOTCOREDIR")
33 try:
34 t = ROOT.McEventWeight()
35 except Exception:
36 if RootCoreDir:
37 ROOT.gROOT.ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C")
38 else:
39 print ("Nothing foreseen in this case, complain to Olivier...")
40
41except ImportError as err:
42 print(err)
void print(char *figname, TCanvas *c1)