Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print function migration for RecoLocalCalo_HcalRecAlgos #23864

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 13 additions & 12 deletions RecoLocalCalo/HcalRecAlgos/python/RemoveAddSevLevel.py
@@ -1,3 +1,4 @@
from __future__ import print_function
import FWCore.ParameterSet.Config as cms


Expand Down Expand Up @@ -33,12 +34,12 @@ def RemoveFlag(sevLevelComputer,flag="HFLongShort"):


def PrintLevels(SLComp):
print "Severity Level Computer Levels and associated flags/Channel Status values:"
print("Severity Level Computer Levels and associated flags/Channel Status values:")
for i in SLComp.SeverityLevels:
print "\t Level = %i"%i.Level.value()
print "\t\t RecHit Flags = %s"%i.RecHitFlags.value()
print "\t\t Channel Status = %s"%i.ChannelStatus.value()
print
print("\t Level = %i"%i.Level.value())
print("\t\t RecHit Flags = %s"%i.RecHitFlags.value())
print("\t\t Channel Status = %s"%i.ChannelStatus.value())
print()
return


Expand All @@ -59,15 +60,15 @@ def AddFlag(sevLevelComputer,flag="UserDefinedBit0",severity=10,verbose=True):

#print "Allowed flags = ",allowedflags
if flag not in allowedflags and verbose:
print "\n\n"
print("\n\n")
for j in range(0,3):
print "###################################################"
print "\nWARNING!!!!!! You are adding a flag \n\t'%s' \nthat is not defined in the Severity Level Computer!"%flag
print "This can be EXCEPTIONALLY dangerous if you do not \nknow what you are doing!\n"
print "Proceed with EXTREME caution!\n"
print("###################################################")
print("\nWARNING!!!!!! You are adding a flag \n\t'%s' \nthat is not defined in the Severity Level Computer!"%flag)
print("This can be EXCEPTIONALLY dangerous if you do not \nknow what you are doing!\n")
print("Proceed with EXTREME caution!\n")
for j in range(0,3):
print "###################################################"
print "\n\n"
print("###################################################")
print("\n\n")

#Loop over severity Levels
for i in range(len(sevLevelComputer.SeverityLevels)):
Expand Down
15 changes: 8 additions & 7 deletions RecoLocalCalo/HcalRecAlgos/test/test_RecHitReflagger_cfg.py
@@ -1,3 +1,4 @@
from __future__ import print_function
import FWCore.ParameterSet.Config as cms

maxevents=10
Expand Down Expand Up @@ -69,9 +70,9 @@
# RecHitFlags = cms.vstring('HFPET','HFS9S1'),
# ChannelStatus = cms.vstring('')))

print "STARTING SL:"
print("STARTING SL:")
for i in process.hcalRecAlgos.SeverityLevels:
print i
print(i)



Expand All @@ -85,9 +86,9 @@
if "UserDefinedBit0" in flagvec and flaglevel!=10: # remove HFLongShort from its default position
flagvec.remove("UserDefinedBit0")
process.hcalRecAlgos.SeverityLevels[i].RecHitFlags=flagvec
print "Removed 'UserDefinedBit0' from severity level %i"%(process.hcalRecAlgos.SeverityLevels[i].Level.value())
print("Removed 'UserDefinedBit0' from severity level %i"%(process.hcalRecAlgos.SeverityLevels[i].Level.value()))
if (flaglevel==NewSevLevel): # Set UserDefinedBit0 severity to 10, which will exclude such rechits from CaloTower
print "FOUND LEVEL %i!"%NewSevLevel
print("FOUND LEVEL %i!"%NewSevLevel)
if "UserDefinedBit0" not in flagvec:
if (flagvec!=['']):
flagvec.append("UserDefinedBit0")
Expand All @@ -96,14 +97,14 @@
process.hcalRecAlgos.SeverityLevels[i].RecHitFlags=flagvec
AddedFlag=True
if (AddedFlag==False):
print "Found no Severity Level = %i; Adding it now"%NewSevLevel
print("Found no Severity Level = %i; Adding it now"%NewSevLevel)
process.hcalRecAlgos.SeverityLevels.append(cms.PSet(Level=cms.int32(NewSevLevel),
RecHitFlags=cms.vstring("UserDefinedBit0"),
ChannelStatus=cms.vstring("")))

print "New Severity Levels:"
print("New Severity Levels:")
for i in process.hcalRecAlgos.SeverityLevels:
print i
print(i)

#print process.hbhereco.firstSample, " FIRST"

Expand Down