Commit cc39cfc5 authored by Marcin Jerzy Nowak's avatar Marcin Jerzy Nowak Committed by Graeme Stewart
Browse files

fixed dictwrite.py for ROOT5 and updated bs-streamerinfos.root (TrigSerializeResult-00-01-55)

	* python\dictwrite.py: disabled ROOT6 for now till this is
	implemented
	* fixed type traversal for ROOT5
	* added protection against writing existing streamers again to
	file
	* updated list of types to write streamers for to have explicit
	version number (generic typedefs are not in dictionaries so they don't work)
	* share/bs-streamerinfos.root: using the fixed dictwrite.py added all
	streamers missed for xAOD containers before (from 20.1.6)
	* Tagging TrigSerializeResult-00-01-55

2015-12-01  Marcin Nowak  <Marcin.Nowak@cern.ch>
	* python\dictwrite.py: fix for subtypes and fix for ROOT6 (but
	without subtypes)
	* Added streamerinfos from 20.1.5 for:
	  DataVector<xAOD::TrigVertexCounts_v1>     checksum=0xbdf26909
	  DataVector<xAOD::TrigSpacePointCounts_v1>   checksum=0xe9b90005
	* Tagging TrigSerializeResult-00-01-54
parent 462ecb91
......@@ -13,6 +13,8 @@ class StreamerInfoGenerator:
cppyy.loadDict('libSTLAddRflx')
cppyy.loadDict('libAtlasSTLAddReflexDict')
self.type = cppyy.makeClass("Reflex::Type")
#MN: switch off auto dict generation - god knows what that can mess up
cppyy.gbl.gROOT.ProcessLine(".autodict")
def inspect(self, typename):
......@@ -25,12 +27,10 @@ class StreamerInfoGenerator:
if self.debug: print 'blacklisted ', typename
dontAdd = True
print self.classlist
for o in self.classlist:
if o==typename:
if self.debug: print 'seen before ', typename
dontAdd = True
# print self.classlist
if typename in self.classlist:
if self.debug: print 'seen before ', typename
dontAdd = True
try:
t = self.type.ByName(typename)
......@@ -38,6 +38,8 @@ class StreamerInfoGenerator:
if t.IsFundamental():
if self.debug: print typename, ' is fundamental'
return
if t.IsAbstract():
dontAdd = True
except:
pass
......@@ -60,7 +62,7 @@ class StreamerInfoGenerator:
if self.debug: print typename, ' is typedef'
underlying = t.ToType()
if (underlying):
inspect(underlying)
self.inspect(underlying.Name(7))
elif t.IsArray():
print typename,' is an array'
elif t.IsTemplateInstance():
......@@ -75,8 +77,7 @@ class StreamerInfoGenerator:
tt = t.TemplateArgumentAt(i)
ttname = tt.Name(7)
if tt.IsPointer() or tt.IsArray() or tt.IsTypedef():
ttt = tt.ToType()
ttname = ttt.Name(7)
ttname = tt.ToType().Name(7)
self.inspect(ttname)
elif t.IsClass():
if self.debug: print typename, ' is a class'
......@@ -90,8 +91,9 @@ class StreamerInfoGenerator:
dname = d.Name()
dtype = d.TypeOf().Name(7)
if self.debug:
print 'DataMember: ', dname, ' ', dtype
self.inspect(dtype)
print 'DataMember: ', dname, ' ', dtype, ' transient=', d.IsTransient()
if not d.IsTransient():
self.inspect(dtype)
else:
print 'what to do about ', typename,'?'
......
......@@ -2,22 +2,33 @@
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
import sys
import StreamerInfoGenerator
doEDM=False
#doEDM=True
doxAODonly=False
bs_filename = 'bs-streamerinfos.root'
import ROOT
from ROOT import TClass, TFile
import cppyy
cppyy.Cintex.Enable()
#Cintex.SetDebug(7)
try:
cppyy.Cintex
has_cintex = True
print "Cintex detected, assuming ROOT 5"
except:
has_cintex = False
print "Aassuming ROOT 6 or newer"
print "ROOT 6 NOT SUPPORTED YET!!! contact Marcin.Nowak"
sys.exit(-1)
if has_cintex:
cppyy.Cintex.Enable()
#Cintex.SetDebug(7)
import StreamerInfoGenerator
from TriggerJobOpts.TriggerEDM import EDMDetails
file = TFile('bs-streamerinfos.root','UPDATE')
objects = ['ElementLink_p1<unsigned int>',
'TauRecDetails_p1',
......@@ -51,117 +62,128 @@ objects += ['ElementLinkVector_p1<std::string>::ElementRef']
objects += ['MuonFeature_p3']
objects = []
objects = ['xAOD::TrigTrackCountsAuxContainer']
objects = ['xAOD::TrigTrackCountsContainer']
objects = [
'xAOD::TrigEMCluster',
'xAOD::TrigEMClusterContainer',
'xAOD::TrigEMClusterAuxContainer',
'xAOD::TrigRingerRings',
'xAOD::TrigRingerRingsContainer',
'xAOD::TrigRingerRingsAuxContainer',
'xAOD::TrigRNNOutput',
'xAOD::TrigRNNOutputContainer',
'xAOD::TrigRNNOutputAuxContainer',
'xAOD::CaloClusterContainer',
'xAOD::CaloClusterAuxContainer',
'xAOD::L2StandAloneMuonContainer',
'xAOD::L2StandAloneMuonAuxContainer',
'xAOD::L2CombinedMuonContainer',
'xAOD::L2CombinedMuonAuxContainer',
'xAOD::L2IsoMuonContainer',
'xAOD::L2IsoMuonAuxContainer',
'xAOD::MuonContainer',
'xAOD::MuonAuxContainer',
'xAOD::TrackParticleContainer',
'xAOD::TrackParticleAuxContainer',
'xAOD::TauJetContainer',
'xAOD::TauJetAuxContainer',
'xAOD::TrackParticleContainer',
'xAOD::TrackParticleAuxContainer',
'xAOD::VertexContainer',
'xAOD::VertexAuxContainer',
'xAOD::TrigCompositeContainer',
'xAOD::TrigCompositeAuxContainer',
'xAOD::MuonRoIContainer',
'xAOD::MuonRoIAuxContainer',
'xAOD::EmTauRoIContainer',
'xAOD::EmTauRoIAuxContainer',
'xAOD::JetRoIContainer',
'xAOD::JetRoIAuxContainer',
'xAOD::JetEtRoI',
'xAOD::JetEtRoIAuxInfo',
'xAOD::EnergySumRoI',
'xAOD::EnergySumRoIAuxInfo',
'xAOD::TriggerTowerContainer',
'xAOD::TriggerTowerAuxContainer',
'xAOD::ElectronContainer',
'xAOD::ElectronAuxContainer',
'xAOD::PhotonContainer',
'xAOD::PhotonAuxContainer',
'xAOD::TrigBphysContainer',
'xAOD::TrigBphysAuxContainer',
'xAOD::TrigT2MbtsBits',
'xAOD::TrigT2MbtsBitsAuxContainer',
'xAOD::TrigSpacePointCounts',
'xAOD::TrigSpacePointCountsAuxContainer',
'xAOD::TrigVertexCounts',
'xAOD::TrigVertexCountsAuxContainer',
'xAOD::TrigTrackCounts',
'xAOD::TrigTrackCountsAuxContainer',
'xAOD::TrigMissingETContainer',
'xAOD::TrigMissingETAuxContainer',
'xAOD::TrigPhotonContainer',
'xAOD::TrigPhotonAuxContainer',
'xAOD::TrigElectronContainer',
'xAOD::TrigElectronAuxContainer',
'xAOD::JetContainer',
'xAOD::JetTrigAuxContainer',
'xAOD::TrigDecision',
'xAOD::TrigDecisionAuxInfo',
'xAOD::TrigConfKeys',
'xAOD::TrigNavigation',
'xAOD::TrigNavigationAuxInfo',
'xAOD::BTaggingContainer',
'xAOD::BTaggingAuxContainer',
'xAOD::BTagVertexContainer',
'xAOD::BTagVertexAuxContainer'
'xAOD::TrigEMCluster_v1',
'xAOD::TrigEMClusterContainer_v1',
'xAOD::TrigEMClusterAuxContainer_v1',
'xAOD::TrigRingerRings_v1',
'xAOD::TrigRingerRingsContainer_v1',
'xAOD::TrigRingerRingsAuxContainer_v1',
'xAOD::TrigRNNOutput_v1',
'xAOD::TrigRNNOutputContainer_v1',
'xAOD::TrigRNNOutputAuxContainer_v1',
'xAOD::CaloClusterContainer_v1',
'xAOD::CaloClusterAuxContainer_v2',
'xAOD::L2StandAloneMuonContainer_v1',
'xAOD::L2StandAloneMuonAuxContainer_v1',
'xAOD::L2CombinedMuonContainer_v1',
'xAOD::L2CombinedMuonAuxContainer_v1',
'xAOD::L2IsoMuonContainer_v1',
'xAOD::L2IsoMuonAuxContainer_v1',
'xAOD::MuonContainer_v1',
'xAOD::MuonAuxContainer_v2',
'xAOD::TrackParticleContainer_v1',
'xAOD::TrackParticleAuxContainer_v2',
'xAOD::TauJetContainer_v2',
'xAOD::TauJetAuxContainer_v2',
'xAOD::TrackParticleContainer_v1',
'xAOD::TrackParticleAuxContainer_v1',
'xAOD::VertexContainer_v1',
'xAOD::VertexAuxContainer_v1',
'xAOD::TrigCompositeContainer_v1',
'xAOD::TrigCompositeAuxContainer_v1',
'xAOD::MuonRoIContainer_v1',
'xAOD::MuonRoIAuxContainer_v1',
'xAOD::EmTauRoIContainer_v2',
'xAOD::EmTauRoIAuxContainer_v2',
'xAOD::JetRoIContainer_v2',
'xAOD::JetRoIAuxContainer_v2',
'xAOD::JetEtRoI_v1',
'xAOD::JetEtRoIAuxInfo_v1',
'xAOD::EnergySumRoI_v1',
'xAOD::EnergySumRoIAuxInfo_v1',
'xAOD::TriggerTowerContainer_v2',
'xAOD::TriggerTowerAuxContainer_v2',
'xAOD::ElectronContainer_v1',
'xAOD::ElectronAuxContainer_v1',
'xAOD::PhotonContainer_v1',
'xAOD::PhotonAuxContainer_v1',
'xAOD::TrigBphysContainer_v1',
'xAOD::TrigBphysAuxContainer_v1',
'xAOD::TrigT2MbtsBits_v1',
'xAOD::TrigT2MbtsBitsAuxContainer_v1',
'xAOD::TrigSpacePointCountsContainer_v1',
'xAOD::TrigSpacePointCountsAuxContainer_v1',
'xAOD::TrigVertexCountsContainer_v1',
'xAOD::TrigVertexCountsAuxContainer_v1',
'xAOD::TrigTrackCounts_v1',
'xAOD::TrigTrackCountsAuxContainer_v1',
'xAOD::TrigMissingETContainer_v1',
'xAOD::TrigMissingETAuxContainer_v1',
'xAOD::TrigPhotonContainer_v1',
'xAOD::TrigPhotonAuxContainer_v1',
'xAOD::TrigElectronContainer_v1',
'xAOD::TrigElectronAuxContainer_v1',
'xAOD::JetContainer_v1',
'xAOD::JetTrigAuxContainer_v1',
'xAOD::TrigDecision_v1',
'xAOD::TrigDecisionAuxInfo_v1',
'xAOD::TrigConfKeys_v1',
'xAOD::TrigNavigation_v1',
'xAOD::TrigNavigationAuxInfo_v1',
'xAOD::BTaggingContainer_v1',
'xAOD::BTaggingAuxContainer_v1',
'xAOD::BTagVertexContainer_v1',
'xAOD::BTagVertexAuxContainer_v1'
]
from collections import defaultdict
streamerChecksums = defaultdict(set)
print "Reading streamerinfos from", bs_filename
file = TFile(bs_filename, 'UPDATE')
streamer_n = 0
for i in file.GetStreamerInfoList():
if i.GetName() != 'listOfRules':
# print i.GetName(), "%x" % i.GetCheckSum()
streamerChecksums[i.GetName()].add( i.GetCheckSum() )
streamer_n += 1
print "Read", streamer_n, 'streamers for', len(streamerChecksums), 'types'
print
if doEDM:
for item in EDMDetails.keys():
pers = EDMDetails[item]['persistent']
objects.append(pers)
a = StreamerInfoGenerator.StreamerInfoGenerator()
for item in objects:
pers = item
print pers
a.inspect(pers)
for pers in objects:
a.inspect(pers)
print
fulllist = a.classlist
print fulllist
print '*******************************'
from CLIDComps.clidGenerator import clidGenerator
cgen = clidGenerator("")
fulllist = a.classlist + objects
types_new = 0
types_exist = 0
types_bad = 0
fulllist = list(set(fulllist))
#for item in a.classlist:
for item in fulllist:
for item in fulllist:
if doxAODonly and not 'xAOD' in item: continue # current issues seen because of missing xAOD libs not being loaded
print "Trying to fill item",item,"to root file"
c_clid=cgen.genClidFromName(item)
c_typeinfo=cgen.getTidFromClid(c_clid)
print "Trying to fill item", item, "to root file"
c_clid = cgen.genClidFromName(item)
c_typeinfo = cgen.getTidFromClid(c_clid)
print "CLID", c_clid
print "TypeInfo",cgen.getTidFromClid(c_clid)
print "TypeInfo", c_typeinfo
try:
cls = ROOT.gROOT.GetClass(item)
except:
cls = ROOT.gROOT.GetClass(c_typeinfo)
cls = ROOT.gROOT.GetClass(c_typeinfo)
cls = ROOT.gROOT.GetClass(c_typeinfo)
print cls
if cls!=None:
......@@ -169,21 +191,28 @@ for item in fulllist:
if streamerinfo.GetCheckSum() == 0:
# try to patch missing checksum in DataVectors
print 'Warning: no checksum in streamerinfo for type: ', cls.GetName()
print 'Attempting to fix with %x' % cls.GetCheckSum()
print 'Attempting to fix with 0x%x' % cls.GetCheckSum()
streamerinfo.SetCheckSum( cls.GetCheckSum() )
print 'jmasik: ', cls.GetName(), streamerinfo.Sizeof(), streamerinfo.GetCheckSum()
obj = cls.New()
file.WriteObjectAny(obj, cls, cls.GetName())
#aa=cls.GetListOfRealData()
#for mem in aa:
# memtype = mem.GetDataType()
chksum = streamerinfo.GetCheckSum()
if chksum not in streamerChecksums[cls.GetName()]:
print 'Writing: %s streamer size=%d, checksum=0x%x' %(cls.GetName(), streamerinfo.Sizeof(), chksum)
obj = cls.New()
file.WriteObjectAny(obj, cls, cls.GetName())
types_new += 1
else:
print 'Skipping', cls.GetName(), 'streamer checksum', chksum, ' - already in the file'
types_exist += 1
else:
print 'skipping ', item
types_bad += 1
#sys.exit()
print '----'
print 'Wrote', types_new, 'types'
print 'Skipped', types_exist, ' existing types'
print 'Errors with', types_bad, ' types'
#print 'experimental'
#rclass = ROOT.gROOT.GetClass('TrigTauCluster_p2')
#ROOT.gROOT.RemoveClass(rclass)
......
import ROOT
import cppyy
cppyy.Cintex.Enable()
for i in ROOT.TFile.Open('bs-streamerinfos.root').GetStreamerInfoList():
if i.GetName() != 'listOfRules':
print i.GetName(), "%x" % i.GetCheckSum()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment