Re: PyROOT and Athena: Cannot read LVL1NameMap

From: Alexander Mann <amann_at_uni-goettingen.de>
Date: Tue, 30 Nov 2010 10:56:31 +0100

Hi Sebastien,

thanks for the suggestion, it has the same result though: works in Python, fails in Athena, see output attached below.

cu,
Alexander

   IN ATHENA


[10:52-mann_at_pcatlas11]$ athena -i
Tue Nov 30 10:52:24 CET 2010
Preloading tcmalloc_minimal.so
Py:Athena INFO including file "AthenaCommon/Preparation.py" Py:ConfigurableDb INFO Read module info for 5034 configurables from 10 genConfDb files
Py:ConfigurableDb INFO No duplicates have been found: that's good ! Py:Athena INFO using release [AtlasOffline-15.8.0] [15.X.0-VAL/rel_5] -- built on [2010 06/10 22:08]

Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
Py:Athena            INFO including file 
"AthenaCommon/Atlas.UnixStandardJob.py"
Warning in <TEnvRec::ChangeValue>: duplicate entry 

<Library.vector<bool>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry

<Library.vector<char>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<short>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry 

<Library.vector<long>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<unsigned-char>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<unsigned-short>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<unsigned-int>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<unsigned-long>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<float>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<double>=vector.dll> for level 0; ignored
Py:Athena            INFO including file "AthenaCommon/Execution.py"
Py:Athena            INFO entered interactive mode - have fun!
Py:Athena            INFO you can call theApp.run() to execute and use 
ctrl-d to exit
athena> try:
.   ...   print "Using PyAthena"
.   ...   import AthenaPython.PyAthena as ROOT
.   ... except ImportError:
.   ...   print "No, using ROOT"
.   ...   import ROOT
.   ...

Using PyAthena
athena> f = ROOT.TFile("NTUP.root")
Warning in <TEnvRec::ChangeValue>: duplicate entry 

<Library.vector<bool>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry

<Library.vector<char>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<short>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry 

<Library.vector<long>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<unsigned-char>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<unsigned-short>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<unsigned-int>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<unsigned-long>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<float>=vector.dll> for level 0; ignored
Warning in <TEnvRec::ChangeValue>: duplicate entry
<Library.vector<double>=vector.dll> for level 0; ignored
TClass::TClass:0: RuntimeWarning: no dictionary for class AttributeListLayout is available
athena> x = f.FindObjectAny("TrigConfTree") athena> x.GetEntry(0)
28
athena> for t in [a.first for a in x.LVL1NameMap]: . ... print t
. ...
Traceback (most recent call last):

   File "<stdin>", line 1, in <module>
TypeError: int& map<string,int>::operator[](const string& __k) =>

     could not convert argument 1
athena>

   IN PYTHON


[10:50-mann_at_pcatlas11]$ python
Python 2.4.3 (#1, Sep 3 2009, 15:37:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type "help", "copyright", "credits" or "license" for more information.  >>> try:

...  import AthenaPython.PyAthena as ROOT
... except ImportError:
...  print "Using ROOT"
...  import ROOT
...

Using ROOT
 >>>
Display all 167 possibilities? (y or n)
 >>> f = ROOT.TFile("NTUP.root")
TClass::TClass:0: RuntimeWarning: no dictionary for class AttributeListLayout is available
TClass::TClass:0: RuntimeWarning: no dictionary for class pair<string,string> is available
 >>> x = f.FindObjectAny("TrigConfTree")  >>> x.GetEntry(0)
28
 >>> for t in [a.first for a in x.LVL1NameMap]: ... print t
...
L1_2EM2
L1_2EM3
L1_2EM4
L1_2EM5
L1_2FJ15
  .

  .
  .

On 11/30/2010 10:46 AM, Sebastien Binet wrote:

> On Tue, 30 Nov 2010 10:31:55 +0100, Alexander Mann<amann_at_uni-goettingen.de>  wrote:
>> The reason for this is maybe a different dictionary? (or a different
>> Python version used by Athena?)
>
> probably.
> Athena is using the LCG official way to create and use dictionaries: the
> Reflex ones.
>
> what happens if you do:
> try:
>   import AthenaPython.PyAthena as ROOT
> except ImportError:
>   import ROOT
>
> PyAthena is trying to load by hook or by crook the correct reflex
> dictionary (through the same nice getattr method than ROOT.foo)
>
> hth,
> sebastien.
>
Received on Tue Nov 30 2010 - 10:56:37 CET

This archive was generated by hypermail 2.2.0 : Tue Nov 30 2010 - 11:50:01 CET