Using AtlasStyle in pyroot

Please provide the following information:


ROOT Version (e.g. 6.12/02): 6.10.04-x86_64-slc6-gcc62-opt
Platform, compiler (e.g. CentOS 7.3, gcc6.2): gcc version 6.2.0 (GCC)

Hi all,

I’m new to use AtlasStyle for plotting pirposes and having some trouble using it. I tried to load it in my pyroot code as follows and I get the following error.

from ROOT import *
import AtlasStyle as ats
ats.SetAtlasStyle()

error:
Traceback (most recent call last):
File “t1.py”, line 2, in
import AtlasStyle as ats
File “/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.10.04-x86_64-slc6-gcc62-opt/lib/ROOT.py”, line 318, in _importhook
return _orig_ihook( name, *args, **kwds )
ImportError: No module named AtlasStyle

how can I get this fixed?

Thanks!


Hi,

Python cannot ind the module called AtlasStyle. The way to fix this is to add to the PYTHONPATH environment variable the path to the aforementioned module.

Best,
Danilo

1 Like

Hi dpiparo,

Thank you for the instructions. I added the path of the module to the PYTHONPATH environment in my .bashrc as,

export PYTHONPATH=“${PYTHONPATH}:~/Downloads” (since AtlasStyle.py is saved at Downloads)

and when I call it in the python terminal, i still get an error saying the following.

Python 2.6.6 (r266:84292, Aug 22 2016, 09:40:33)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import AtlasStyle
Error in TROOT::LoadMacro: macro AtlasStyle.C not found in path .:/usr/share/root/macros:

What am I doing wrong here?

Thank you!!!

Hi,

Is the AtlasStyle module loading that macro upon import?

Best,
D

Hi,

in addition, you can always instruct ROOT to find macros in default paths (if that’s the case). You can have a look to Macros path error.

Cheers,
D

1 Like

Also note we have recently introduced the ATLAS style as one of the build-in styles in ROOT. To select it it is enough to do:

 gROOT->SetStyle("ATLAS");

Hi,
thanks for pointing this out. Can I know which root version supports this?

My default version is :6.10.04-x86_64-slc6-gcc62-opt and except for ATLAS style, all the other styles given in the link you gave me are working.

I’m calling the style in my code as,

import ROOT as root
root.gROOT.SetStyle(‘ATLAS’)

and it says,

Error in TROOT::SetStyle: Unknown style:ATLAS

Thank you!

Ah yes that too old …6.13 is needed at leats

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.