Skip to content

Commit

Permalink
[wip] Fix all print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Sep 25, 2024
1 parent 3bf8c3d commit 99ada57
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 37 deletions.
6 changes: 3 additions & 3 deletions ILD/compact/ILD_common_v02/writeAllILDCompactDescriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def writeTopCompactXml( outfile, version, name, Large, Option, SolenoidMap, Anti
ecal_sl1=3
ecal_sl2=11
elif Option>1:
print 'ERROR: do not know about Option', Option
print( 'ERROR: do not know about Option', Option)
return

if FwdFields!=250 and FwdFields!=500 and FwdFields!=1000 and FwdFields!=0:
print 'ERROR: do not know about FwdFields at energy', FwdFields
print( 'ERROR: do not know about FwdFields at energy', FwdFields)
return

outfile.write('<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0"\n')
Expand Down Expand Up @@ -151,7 +151,7 @@ def getVersionParameters(version):
vparams['AntiDID']=True
vparams['FwdFields']=1000
else:
print 'ERROR: unknown version requested:',version,'!!'
print( 'ERROR: unknown version requested:',version,'!!')
return vparams

if version<10:
Expand Down
20 changes: 10 additions & 10 deletions ILD/doc/latex/documentEnvelopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@
dictFile = sys.argv[1]

except IndexError:
print " usage: python documentEnvelopes.py pyDict.py "
print " pyDict.py : python file with a data dictionary (created with extractParameters)"
print
print( " usage: python documentEnvelopes.py pyDict.py ")
print( " pyDict.py : python file with a data dictionary (created with extractParameters)")
print()
sys.exit(1)


Expand Down Expand Up @@ -230,7 +230,7 @@ def writeILDEnvTable( file ):
cmds.extend( getDocFooterCmds() )

for cmd in cmds:
print >>of, cmd
print(cmd , file=of)

of.close()
#-----------------------------------------------
Expand Down Expand Up @@ -353,7 +353,7 @@ def getEnvPoints(det,scale):
env = envRZDict[det]
for ep in env:
p = (scale * values[ ep[0] ], scale * values[ ep[1] ] )
print det, ' point: ' , p
print( det, ' point: ' , p)
points.append( p )
return points

Expand All @@ -373,7 +373,7 @@ def writeTexFile( det, fileExt, method, width ):
cmds.extend( getDocFooterCmds() )

for cmd in cmds:
print >>of, cmd
print(cmd , file=of)

of.close()

Expand All @@ -383,15 +383,15 @@ def lineStr( tl, opt="" ):

o = cStringIO.StringIO()

print >>o, '\draw ', opt,
print('\draw ', opt, file=o)

i=0
for t in tl:
if( i>0 ):
print >>o, ' -- ',
print >>o, '(', t[0] ,',', t[1],') ',
print(' -- ',, file=o)
print('(', t[0] ,',', t[1],') ', file=o)
i += 1
print >>o,';'
print(';', file=o)
str = o.getvalue()
o.close()
return str
Expand Down
12 changes: 6 additions & 6 deletions ILD/doc/latex/extractParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
paramFile = sys.argv[2]
dictFile = sys.argv[3]
except IndexError:
print " usage: python extractParameters.py compact.xml param_names.txt pyDict.py"
print
print( " usage: python extractParameters.py compact.xml param_names.txt pyDict.py")
print()
sys.exit(1)

#-----------------------------------------------
Expand All @@ -40,8 +40,8 @@ def run():
install_dir = os.environ['DD4hepINSTALL']

except (KeyError):
print " please set the environment variable DD4hepINSTALL "
print " to your DD4hep installation path ! "
print( " please set the environment variable DD4hepINSTALL ")
print( " to your DD4hep installation path ! ")
exit(1)

kernel.loadGeometry("file:"+ compactFile )
Expand Down Expand Up @@ -94,9 +94,9 @@ def writeDictionary( names, of ):

def printEnvelopeParameters( det ):

print " ========== ", det , " ================== "
print( " ========== ", det , " ================== ")
for p in dict[ det ]:
print " ", p , getattr( DDG4, p )
print( " ", p , getattr( DDG4, p ))


#-----------------------------------------------
Expand Down
19 changes: 9 additions & 10 deletions ILD/scripts/dumpModelParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#---------------------------------------

if len( sys.argv ) != 2:
print " usage: python dumpModelParameters.py MODEL_NAME "
print( " usage: python dumpModelParameters.py MODEL_NAME ")
sys.exit(0)

model = sys.argv[1]
Expand Down Expand Up @@ -67,22 +67,21 @@

#dump params to xml file

print >>file, "<!-- "
print >>file, " global model parameters for model: " + model
print >>file, " extracted from Mokka DB at " + host + " - db: " + dbName
print >>file, " on " + time.strftime("%d/%m/%Y")
print >>file, " at " + time.strftime("%H:%M:%S")
print("<!-- ", file=file)
print(" global model parameters for model: " + model, file=file)
print(" extracted from Mokka DB at " + host + " - db: " + dbName , file=file)
print(" on " + time.strftime("%d/%m/%Y"), file=file)
print(" at " + time.strftime("%H:%M:%S"), file=file)

print >>file, " -->"
print(" -->", file=file)


for k in sorted( params ):
v = params[ k ]
if v:
print >>file, "<constant name=\"" + k + "\" value=\"" + str(v) + "\"/>"
print("<constant name=\"" + k + "\" value=\"" + str(v) + "\"/>", file=file)
else:
cur.execute("select name, default_value from parameters where name=\"" + k + "\";")
for row in cur.fetchall() :
v = row[1]
print >>file, "<constant name=\"" + k + "\" value=\"" + str(v) + "\"/>"

print("<constant name=\"" + k + "\" value=\"" + str(v) + "\"/>", file=file)
14 changes: 7 additions & 7 deletions example/ddsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
try:
compactFile = sys.argv[1]
except IndexError:
print " usage: python ddsim.py compact.xml"
print
print( " usage: python ddsim.py compact.xml")
print()
sys.exit(1)

#-----------------------------------------------
Expand Down Expand Up @@ -95,7 +95,7 @@ def getDetectorLists( lcdd ):
type = sd.type()
# if len(detectorList) and not(name in detectorList):
# continue
print 'getDetectorLists - found active detctor ' , name , ' type: ' , type
print( 'getDetectorLists - found active detctor ' , name , ' type: ' , type)
if type == "tracker":
t.append( det.name() )
if type == "calorimeter":
Expand All @@ -113,8 +113,8 @@ def run():
install_dir = os.environ['DD4hepINSTALL']
# lcgeo_dir = os.environ['LCGEO']
except (KeyError):
print " please set the environment variable DD4hepINSTALL "
print " to your DD4hep installation path ! "
print(" please set the environment variable DD4hepINSTALL ")
print( " to your DD4hep installation path ! ")
exit(1)

# example_dir = lcgeo_dir+'/example';
Expand Down Expand Up @@ -210,7 +210,7 @@ def run():
# fixme: this assumes the same filters for all trackers ...

for t in trk:
print 'simple.setupTracker( ' , t , ')'
print( 'simple.setupTracker( ' , t , ')')
if( 'tpc' in t.lower() ):
seq,act = simple.setupTracker( t ,type='TPCSDAction')
else:
Expand All @@ -221,7 +221,7 @@ def run():
# ---- add the calorimeters:

for c in cal:
print 'simple.setupCalorimeter( ' , c , ')'
print( 'simple.setupCalorimeter( ' , c , ')')
if( 'ecal' in c.lower() ):
seq,act = simple.setupCalorimeter( c ,type='CaloPreShowerSDAction')
act.FirstLayerNumber = 1
Expand Down
2 changes: 1 addition & 1 deletion example/guineapig_to_lcio.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#================================================
if len( sys.argv ) < 2:
print " usage: python guineapig_to_lcio.py eepair_guineapig.pair "
print(" usage: python guineapig_to_lcio.py eepair_guineapig.pair ")
sys.exit(0)

#=================================================
Expand Down

0 comments on commit 99ada57

Please sign in to comment.