1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
6 ''' Removes the specified flag from the Severity Level Computer, 7 and returns the revised Computer.''' 14 for i
in range(len(sevLevelComputer.SeverityLevels)):
15 Flags=sevLevelComputer.SeverityLevels[i].RecHitFlags.value()
20 ChanStat=sevLevelComputer.SeverityLevels[i].ChannelStatus.value()
22 if len(Flags)==0
and ChanStat==[
'']:
26 sevLevelComputer.SeverityLevels[i].RecHitFlags=Flags
30 if (removeSeverity>-1):
31 sevLevelComputer.SeverityLevels.remove(sevLevelComputer.SeverityLevels[removeSeverity])
33 return sevLevelComputer
37 print(
"Severity Level Computer Levels and associated flags/Channel Status values:")
38 for i
in SLComp.SeverityLevels:
39 print(
"\t Level = %i"%i.Level.value())
40 print(
"\t\t RecHit Flags = %s"%i.RecHitFlags.value())
41 print(
"\t\t Channel Status = %s"%i.ChannelStatus.value())
46 def AddFlag(sevLevelComputer,flag="UserDefinedBit0",severity=10,verbose=True):
47 ''' Adds specified flag to severity level computer using specified severity level. 48 If flag already exists at another severity level, it is removed from that level. 55 for i
in sevLevelComputer.SeverityLevels:
56 for j
in i.RecHitFlags.value():
59 allowedflags.append(j)
62 if flag
not in allowedflags
and verbose:
65 print(
"###################################################")
66 print(
"\nWARNING!!!!!! You are adding a flag \n\t'%s' \nthat is not defined in the Severity Level Computer!"%flag)
67 print(
"This can be EXCEPTIONALLY dangerous if you do not \nknow what you are doing!\n")
68 print(
"Proceed with EXTREME caution!\n")
70 print(
"###################################################")
74 for i
in range(len(sevLevelComputer.SeverityLevels)):
75 Level=sevLevelComputer.SeverityLevels[i].Level.value()
76 Flags=sevLevelComputer.SeverityLevels[i].RecHitFlags.value()
83 sevLevelComputer.SeverityLevels[i].RecHitFlags=Flags
91 if len(Flags)==0
and ChanStat==[
'']:
94 sevLevelComputer.SeverityLevels[i].RecHitFlags=Flags
97 if (removeSeverity>-1):
98 sevLevelComputer.SeverityLevels.remove(sevLevelComputer.SeverityLevels[removeSeverity])
102 if (AddedSeverity==
False):
103 sevLevelComputer.SeverityLevels.append(cms.PSet(Level=cms.int32(severity),
104 RecHitFlags=cms.vstring(flag),
105 ChannelStatus=cms.vstring(
"")))
106 return sevLevelComputer
112 if __name__==
"__main__":
113 import hcalRecAlgoESProd_cfi
as ES
115 ES.hcalRecAlgos=
AddFlag(ES.hcalRecAlgos,flag=
"HOBit",severity=5)
def RemoveFlag(sevLevelComputer, flag="HFLongShort")
S & print(S &os, JobReport::InputFile const &f)
def AddFlag(sevLevelComputer, flag="UserDefinedBit0", severity=10, verbose=True)