Skip to content

Commit a98822a

Browse files
authored
Merge pull request #46167 from iarspider/iarspider-patches-20240930-10
[SIMULATION] Fix syntax in python scripts
2 parents 512dcde + 9fd387d commit a98822a

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest_cfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
input = cms.untracked.int32(1)
1818
)
1919

20-
process.hcalDigitizerTest = cms.EDAnalyzer("HcalDigitizerTest".,
20+
process.hcalDigitizerTest = cms.EDAnalyzer("HcalDigitizerTest",
2121
useHBUpgrade = ref_hardcode.useHBUpgrade,
2222
useHEUpgrade = ref_hardcode.useHEUpgrade,
2323
useHFUpgrade = ref_hardcode.useHFUpgrade,

SimG4CMS/Calo/test/python/minbias2026_cfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
elif (options.type == "V17Shift"):
3232
geomFile = "Geometry.HGCalCommonData.testHGCal" + options.type + "Reco_cff"
3333
elif (options.type == "V17"):
34-
geomFile = "Configuration.Geometry.GeometryExtended2026D110Reco_cffelse:
34+
geomFile = "Configuration.Geometry.GeometryExtended2026D110Reco_cff"
3535
else:
3636
geomFile = "Configuration.Geometry.GeometryExtended2026D100Reco_cff"
3737

SimG4CMS/HcalTestBeam/test/python/run_tb06_all_cfg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
VERSION = os.environ.get('CMSSW_VERSION')
99
if VERSION is None:
1010
print('''No environment CMSSW_VERSION''')
11-
sys.exit()
11+
sys.exit()
1212

1313
if len(sys.argv) < 5:
1414
print('Usage: python run.py PhysList Particle Fhcal VAR')
1515
print('Example: python run.py FTFP_BERT pi- 106.5 RR')
1616
sys.exit()
17-
else:
17+
else:
1818
phys = sys.argv[1]
1919
part = sys.argv[2]
2020
hcal = sys.argv[3]

SimGeneral/HepPDTESSource/test/ParticleCheck.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ def WriteOutHtml(myfile,mylist):
121121
decaytable=False
122122
ParticleInfoDict.update({'G4 Decay Table':decaytable})
123123
elif record[0:5]=='%MSG ': #Notice the space
124-
#print 'G4 message ended'
124+
#print('G4 message ended')
125125
G4cout=False
126126
if record[0:13]=='%MSG-i G4cout':
127-
#print 'G4 message started'
127+
#print('G4 message started')
128128
G4cout=True
129129
import os
130130
import math
@@ -135,7 +135,7 @@ def WriteOutHtml(myfile,mylist):
135135
pass
136136
else:
137137
tokens = record.split()
138-
#print tokens
138+
#print(tokens)
139139
if len(tokens)==6: #There is an empty line at the end of the file
140140
#Note the different conventions (Particle names are different, charge is reported in units of 1/3e originally in HepPDT, lifetime expressed in ctau in cm)
141141
HepPdtTable.update({tokens[1]:{'Particle Name':tokens[1],'PDG ID':int(tokens[0]),'Charge [e]': float(tokens[2])/3, 'Mass [GeV/c2]':float(tokens[3]), 'ctau [mm]':float(tokens[5])}})
@@ -144,31 +144,31 @@ def WriteOutHtml(myfile,mylist):
144144
#A few consistency checks on the dictionaries
145145
#G4ParticleTables
146146
#Quick and dirty removal of empty first element of G4ParticleTable ('':{}) should really fix the code, but for now it's OK...
147-
print 'Popping the first empty element of G4ParticleTable: %s '%G4ParticleTable.pop('')
148-
print 'G4ParticleTable contains ',len(G4ParticleTable),'elements'
149-
print 'G4ParticleTablePDG contains ',len(G4ParticleTablePDG),'elements'
147+
print('Popping the first empty element of G4ParticleTable: %s '%G4ParticleTable.pop(''))
148+
print('G4ParticleTable contains ',len(G4ParticleTable),'elements')
149+
print('G4ParticleTablePDG contains ',len(G4ParticleTablePDG),'elements')
150150
if len(G4ParticleTable)>len(G4ParticleTablePDG):
151-
print "The following values were in the G4ParticleTable dictionary but not in the G4ParticleTablePDG one (multiple entries with different names but the same PDG code):"
151+
print("The following values were in the G4ParticleTable dictionary but not in the G4ParticleTablePDG one (multiple entries with different names but the same PDG code):")
152152
for value in G4ParticleTable.values():
153153
if value not in G4ParticleTablePDG.values():
154-
print value
154+
print(value)
155155
elif len(G4ParticleTablePDG)>len(G4ParticleTable):
156-
print "The following values were in the G4ParticleTablePDG dictionary but not in the G4ParticleTable one (multiple entries with different PDG codes but the same Particle Name):"
156+
print("The following values were in the G4ParticleTablePDG dictionary but not in the G4ParticleTable one (multiple entries with different PDG codes but the same Particle Name):")
157157
for value in G4ParticleTablePDG.values():
158158
if value not in G4ParticleTable.values():
159-
print value
160-
print 'HepPdtTable contains ',len(HepPdtTable),'elements'
161-
print 'HepPdtTablePDG contains ',len(HepPdtTablePDG),'elements'
159+
print(value)
160+
print('HepPdtTable contains ',len(HepPdtTable),'elements')
161+
print('HepPdtTablePDG contains ',len(HepPdtTablePDG),'elements')
162162
if len(HepPdtTable)>len(HepPdtTablePDG):
163-
print "The following values were in the HepPdtTable dictionary but not in the HepPdtTablePDG one (multiple entries with different names but the same PDG code):"
163+
print("The following values were in the HepPdtTable dictionary but not in the HepPdtTablePDG one (multiple entries with different names but the same PDG code):")
164164
for value in HepPdtTable.values():
165165
if value not in HepPdtTablePDG.values():
166-
print value
166+
print(value)
167167
elif len(HepPdtTablePDG)>len(HepPdtTable):
168-
print "The following values were in the HepPdtTablePDG dictionary but not in the HepPdtTable one (multiple entries with different PDG codes but the same Particle Name):"
168+
print("The following values were in the HepPdtTablePDG dictionary but not in the HepPdtTable one (multiple entries with different PDG codes but the same Particle Name):")
169169
for value in HepPdtTablePDG.values():
170170
if value not in HepPdtTable.values():
171-
print value
171+
print(value)
172172

173173
#Comparison via dictionaries!
174174

@@ -209,7 +209,7 @@ def WriteOutHtml(myfile,mylist):
209209
#Check that G4 has decay tables for particles with ctau>10 mm:
210210
if G4ParticleTablePDG[pdgcode]['ctau [mm]']>10.0 or HepPdtTablePDG[pdgcode]['ctau [mm]']>10.0:
211211
if not G4ParticleTablePDG[pdgcode]['G4 Decay Table']:
212-
print "****Uh Oh No G4 Decay Table for ", G4ParticleTablePDG[pdgcode]['Particle Name']
212+
print("****Uh Oh No G4 Decay Table for ", G4ParticleTablePDG[pdgcode]['Particle Name'])
213213
else:
214214
WriteOutHtml(MatchingPDGDecayFileHtml,[pdgcode,HepPdtTablePDG[pdgcode]['Particle Name'],G4ParticleTablePDG[pdgcode]['Particle Name'],HepPdtTablePDG[pdgcode]['ctau [mm]'],G4ParticleTablePDG[pdgcode]['ctau [mm]'],HepPdtTablePDG[pdgcode]['Mass [GeV/c2]'],G4ParticleTablePDG[pdgcode]['Mass [GeV/c2]'],G4ParticleTablePDG[pdgcode]['G4 Decay Table']])
215215
#Since we are here also compare ctaus
@@ -234,14 +234,14 @@ def WriteOutHtml(myfile,mylist):
234234
MassDiff=HepPdtTablePDG[pdgcode]['Mass [GeV/c2]']-G4ParticleTablePDG[pdgcode]['Mass [GeV/c2]']
235235
MassDiffPercent=math.fabs(MassDiff/HepPdtTablePDG[pdgcode]['Mass [GeV/c2]']*100)
236236
MassDiffPercentList+=[(abs(MassDiffPercent),pdgcode,MassDiff,MassDiffPercent)]
237-
print pdgcode,HepPdtTablePDG[pdgcode]['Particle Name'],G4ParticleTablePDG[pdgcode]['Particle Name'],' Mass:',HepPdtTablePDG[pdgcode]['Mass [GeV/c2]'],' Mass:',G4ParticleTablePDG[pdgcode]['Mass [GeV/c2]'],MassDiff,MassDiffPercent
237+
print(pdgcode,HepPdtTablePDG[pdgcode]['Particle Name'],G4ParticleTablePDG[pdgcode]['Particle Name'],' Mass:',HepPdtTablePDG[pdgcode]['Mass [GeV/c2]'],' Mass:',G4ParticleTablePDG[pdgcode]['Mass [GeV/c2]'],MassDiff,MassDiffPercent)
238238
#WriteOutHtml(MatchingPDGMassFileHtml,[pdgcode,HepPdtTablePDG[pdgcode]['Particle Name'],G4ParticleTablePDG[pdgcode]['Particle Name'],HepPdtTablePDG[pdgcode]['Mass [GeV/c2]'],G4ParticleTablePDG[pdgcode]['Mass [GeV/c2]'],MassDiff,MassDiffPercent])
239239
else:
240240
#Save the PDG code and Mass matching particles Particle Name in MatchingPDGMass list
241241
MatchingPDGMass+=[HepPdtTablePDG[pdgcode]['Particle Name']]
242242
#Check Charge
243243
if HepPdtTablePDG[pdgcode]['Charge [e]']!=G4ParticleTablePDG[pdgcode]['Charge [e]']:
244-
print pdgcode,HepPdtTablePDG[pdgcode]['Particle Name'],G4ParticleTablePDG[pdgcode]['Particle Name'],' Charge [e]:',HepPdtTablePDG[pdgcode]['Charge [e]'],' Charge [e]:',G4ParticleTablePDG[pdgcode]['Charge [e]']
244+
print(pdgcode,HepPdtTablePDG[pdgcode]['Particle Name'],G4ParticleTablePDG[pdgcode]['Particle Name'],' Charge [e]:',HepPdtTablePDG[pdgcode]['Charge [e]'],' Charge [e]:',G4ParticleTablePDG[pdgcode]['Charge [e]'])
245245
WriteOutHtml(MatchingPDGChargeFileHtml,[pdgcode,HepPdtTablePDG[pdgcode]['Particle Name'],G4ParticleTablePDG[pdgcode]['Particle Name'],HepPdtTablePDG[pdgcode]['Charge [e]'],G4ParticleTablePDG[pdgcode]['Charge [e]']])
246246
else:
247247
#########################################################################################
@@ -261,7 +261,7 @@ def WriteOutHtml(myfile,mylist):
261261
MassDiff=element[2]
262262
MassDiffPercent=element[3]
263263
WriteOutHtml(MatchingPDGMassSortedFileHtml,[pdgcode,HepPdtTablePDG[pdgcode]['Particle Name'],G4ParticleTablePDG[pdgcode]['Particle Name'],HepPdtTablePDG[pdgcode]['Mass [GeV/c2]'],G4ParticleTablePDG[pdgcode]['Mass [GeV/c2]'],MassDiff,MassDiffPercent,G4ParticleTablePDG[pdgcode]['ctau [mm]']])
264-
# print element[0],element[1]
264+
# print(element[0],element[1])
265265

266266
MatchingPDGctauSortedFileHtml=open('MatchingPDGctauSorted.html','w')
267267
MatchingPDGctauSortedFileHtml.writelines(['<html>\n','<body>\n','<table align="center", border=2>\n'])

0 commit comments

Comments
 (0)