Fork me on GitHub

Changeset 407aeba in git for python/DelphesAnalysis


Ignore:
Timestamp:
Sep 18, 2018, 10:47:48 PM (6 years ago)
Author:
ksuruliz <ksuruliz@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
711f952
Parents:
b1e03e5
Message:

Fixing pythonisation of classes for recent ROOT versions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/DelphesAnalysis/Delphes.py

    rb1e03e5 r407aeba  
    1212  return theString
    1313
    14 _root.MakeRootClass( "Event" ).__str__    = _Event__str__
     14if hasattr(_root,"MakeRootClass"):
     15  _root.MakeRootClass( "Event" ).__str__    = _Event__str__
     16else:
     17  _root.CreateScopeProxy( "Event" ).__str__    = _Event__str__
    1518
    1619def _LHCOEvent__str__( self ):
     
    1821  return theString
    1922
    20 _root.MakeRootClass( "LHCOEvent" ).__str__    = _LHCOEvent__str__
     23if hasattr(_root,"MakeRootClass"):
     24  _root.MakeRootClass( "LHCOEvent" ).__str__    = _LHCOEvent__str__
     25else:
     26  _root.CreateScopeProxy( "LHCOEvent" ).__str__    = _LHCOEvent__str__
    2127
    2228def _LHEFEvent__str__( self ):
     
    2834  return hepmcstr
    2935
    30 _root.MakeRootClass( "LHEFEvent" ).__str__    = _LHEFEvent__str__
     36if hasattr(_root,"MakeRootClass"):
     37  _root.MakeRootClass( "LHEFEvent" ).__str__    = _LHEFEvent__str__
     38else:
     39  _root.CreateScopeProxy( "LHEFEvent" ).__str__    = _LHEFEvent__str__
    3140
    3241def _HepMCEvent__str__( self ):
     
    4352  return hepmcstr
    4453
    45 _root.MakeRootClass( "HepMCEvent" ).__str__    = _HepMCEvent__str__
     54if hasattr(_root,"MakeRootClass"):
     55  _root.MakeRootClass( "HepMCEvent" ).__str__    = _HepMCEvent__str__
     56else:
     57  _root.CreateScopeProxy( "HepMCEvent" ).__str__    = _HepMCEvent__str__
     58
    4659
    4760def _GenParticle__str__( self ):
     
    6174  return thestring
    6275
    63 _root.MakeRootClass( "GenParticle" ).__str__    = _GenParticle__str__
     76if hasattr(_root,"MakeRootClass"):
     77  _root.MakeRootClass( "GenParticle" ).__str__    = _GenParticle__str__
     78else:
     79  _root.CreateScopeProxy( "GenParticle" ).__str__    = _GenParticle__str__
    6480
    6581def _GenParticle_printDecay( self, db, particles, pre="" ):
     
    7187  return thestring
    7288
    73 _root.MakeRootClass( "GenParticle" ).printDecay = _GenParticle_printDecay
     89if hasattr(_root,"MakeRootClass"):
     90  _root.MakeRootClass( "GenParticle" ).printDecay = _GenParticle_printDecay
     91else:
     92  _root.CreateScopeProxy( "GenParticle" ).printDecay = _GenParticle_printDecay
    7493
    7594def _MissingET__str__( self ):
     
    7796  thestring += "Mising energy azimuthal angle: %f\n" % self.Phi
    7897  return thestring
    79  
    80 _root.MakeRootClass( "MissingET" ).__str__    = _MissingET__str__
     98
     99if hasattr(_root,"MakeRootClass"):
     100  _root.MakeRootClass( "MissingET" ).__str__    = _MissingET__str__
     101else:
     102  _root.CreateScopeProxy( "MissingET" ).__str__    = _MissingET__str__
    81103
    82104def _ScalarHT__str__( self ):
    83105  thestring = "Scalar sum of transverse momenta: %f\n" %self.HT
    84106
    85 _root.MakeRootClass( "ScalarHT" ).__str__    = _ScalarHT__str__
     107if hasattr(_root,"MakeRootClass"):
     108  _root.MakeRootClass( "ScalarHT" ).__str__    = _ScalarHT__str__
     109else:
     110  _root.CreateScopeProxy( "ScalarHT" ).__str__    = _ScalarHT__str__
    86111
    87112def _Photon__str__( self ):
     
    89114  return thestring
    90115
    91 _root.MakeRootClass( "Photon" ).__str__    = _Photon__str__
     116if hasattr(_root,"MakeRootClass"):
     117  _root.MakeRootClass( "Photon" ).__str__    = _Photon__str__
     118else:
     119  _root.CreateScopeProxy( "Photon" ).__str__    = _Photon__str__
    92120
    93121def _Electron__str__( self ):
     
    96124  return thestring
    97125
    98 _root.MakeRootClass( "Electron" ).__str__    = _Electron__str__
     126if hasattr(_root,"MakeRootClass"):
     127  _root.MakeRootClass( "Electron" ).__str__    = _Electron__str__
     128else:
     129  _root.CreateScopeProxy( "Electron" ).__str__    = _Electron__str__
    99130
    100131def _Muon__str__( self ):
     
    103134  return thestring
    104135
    105 _root.MakeRootClass( "Muon" ).__str__    = _Muon__str__
     136if hasattr(_root,"MakeRootClass"):
     137  _root.MakeRootClass( "Muon" ).__str__    = _Muon__str__
     138else:
     139  _root.CreateScopeProxy( "Muon" ).__str__    = _Muon__str__
     140
    106141
    107142def _Jet__str__( self ):
     
    126161  return thestring
    127162
    128 _root.MakeRootClass( "Jet" ).__str__    = _Jet__str__
     163if hasattr(_root,"MakeRootClass"):
     164  _root.MakeRootClass( "Jet" ).__str__    = _Jet__str__
     165else:
     166  _root.CreateScopeProxy( "Jet" ).__str__    = _Jet__str__
    129167
    130168def _Track__str__( self ):
     
    137175  return thestring
    138176
    139 _root.MakeRootClass( "Track" ).__str__    = _Track__str__
     177if hasattr(_root,"MakeRootClass"):
     178  _root.MakeRootClass( "Track" ).__str__    = _Track__str__
     179else:
     180  _root.CreateScopeProxy( "Track" ).__str__    = _Track__str__
    140181
    141182def _Tower__str__( self):
     
    145186  return thestring
    146187
    147 _root.MakeRootClass( "Tower" ).__str__    = _Tower__str__
     188if hasattr(_root,"MakeRootClass"):
     189  _root.MakeRootClass( "Tower" ).__str__    = _Tower__str__
     190else:
     191  _root.CreateScopeProxy( "Tower" ).__str__    = _Tower__str__
    148192
    149193#####################################################
     
    156200  return theString
    157201
    158 _root.MakeRootClass( "TLorentzVector" ).__str__    = _lorentzVector__str__
    159 
    160 
     202if hasattr(_root,"MakeRootClass"):
     203  _root.MakeRootClass( "TLorentzVector" ).__str__    = _lorentzVector__str__
     204else:
     205  _root.CreateScopeProxy( "TLorentzVector" ).__str__    = _lorentzVector__str__
     206
     207
Note: See TracChangeset for help on using the changeset viewer.