CMS 3D CMS Logo

Functions | Variables
HltComparatorCreateWorkflow Namespace Reference

Functions

def CheckEnvironment ()
 
def ConvertHltOnlineToOffline (config, frontierString)
 
def CreateAnalysisConfig (analysis, hltInclude)
 
def FormatHltCff (cffPath)
 
def GetHltCompileCode (subsystem, package, hltConfig)
 
def GetHltConfiguration (hltKey, frontierString)
 
def GetHltKeyForRun (run)
 
def RemovePSet (config, pset)
 

Variables

 anaConfig
 
 args
 
 default
 
 dest
 
 help
 
 hltConfig
 
 hltKey
 
 jobHash
 
 metavar
 
 options
 
 parser
 
 usage
 

Function Documentation

◆ CheckEnvironment()

def HltComparatorCreateWorkflow.CheckEnvironment ( )

Definition at line 49 of file HltComparatorCreateWorkflow.py.

49 def CheckEnvironment():
50  cwd = os.getcwd()
51  t = cwd.split("/")
52  if t[-1] != "python":
53  raise SystemExit("Must run from a Module/Package/python directory")
54 
55 # Converts an online HLT configuration into offline suitable format

Referenced by CreateAnalysisConfig().

◆ ConvertHltOnlineToOffline()

def HltComparatorCreateWorkflow.ConvertHltOnlineToOffline (   config,
  frontierString 
)

Definition at line 56 of file HltComparatorCreateWorkflow.py.

56 def ConvertHltOnlineToOffline(config, frontierString):
57  # Replace the frontier string
58  onlineFrontier = re.search('"(frontier:.*)"', config)
59  if not onlineFrontier:
60  print("WARNING: Could not find Frontier string in HLT configuration. Will ignore.")
61  else:
62  config = config.replace(onlineFrontier.group(1), frontierString)
63 
64  # Replace the global tag
65  config = config.replace("H::All", "P::All")
66 
67  # print config -- debugging
68  # Remove unwanted PSets
69  config = RemovePSet(config, "MessageLogger")
70 # config = RemovePSet(config, "DQMStore")
71  config = RemovePSet(config, "DQM")
72  config = RemovePSet(config, "FUShmDQMOutputService")
73 
74  return config
75 

References print(), and RemovePSet().

Referenced by GetHltConfiguration().

◆ CreateAnalysisConfig()

def HltComparatorCreateWorkflow.CreateAnalysisConfig (   analysis,
  hltInclude 
)

Definition at line 146 of file HltComparatorCreateWorkflow.py.

146 def CreateAnalysisConfig(analysis, hltInclude):
147  anaName = "JobAnalysisConfig_%s_cfg.py" % jobHash
148  f = open(analysis)
149  g = open(anaName, "w")
150  g.write(f.read())
151  g.write("\n")
152  g.write(hltInclude)
153  g.close()
154  f.close()
155  return anaName
156 
157 # Quick sanity check of the environment
159 
160 # Get the required HLT config snippet

References CheckEnvironment().

◆ FormatHltCff()

def HltComparatorCreateWorkflow.FormatHltCff (   cffPath)

Definition at line 132 of file HltComparatorCreateWorkflow.py.

132 def FormatHltCff(cffPath):
133  pathParts = cffPath.split(".")
134  if not re.match("^[_A-Za-z0-9]*\.[_A-Za-z0-9]*\.[_A-Za-z0-9]*$", cffPath):
135  raise SystemExit("Expected cff in form Package.Module.configName_cff")
136  return 'process.load("%s")' % cffPath
137 
138 # Returns python code to compile an HLT configuration

◆ GetHltCompileCode()

def HltComparatorCreateWorkflow.GetHltCompileCode (   subsystem,
  package,
  hltConfig 
)

Definition at line 139 of file HltComparatorCreateWorkflow.py.

139 def GetHltCompileCode(subsystem, package, hltConfig):
140  tmpCode = compileCode.replace("SUBSYSTEM", subsystem)
141  tmpCode = tmpCode.replace("PACKAGE", package)
142  tmpCode = tmpCode.replace("CONFIG", hltConfig + "c")
143  return tmpCode
144 
145 # Prepares the analysis configuration

◆ GetHltConfiguration()

def HltComparatorCreateWorkflow.GetHltConfiguration (   hltKey,
  frontierString 
)

Definition at line 105 of file HltComparatorCreateWorkflow.py.

105 def GetHltConfiguration(hltKey, frontierString):
106  # Format the config path for include
107  cwd = os.getcwd()
108  t = cwd.split("/")
109  module = t[-3]
110  package = t[-2]
111 
112  # Get the HLT config
113  config = os.popen2('wget "http://cms-project-confdb-hltdev.web.cern.ch/cms-project-confdb-hltdev/get.jsp?dbName=ORCOFF&configName=%s&cff=&nooutput=&format=Python" -O- -o /dev/null' % hltKey)[1].read()
114  #config = os.popen2("edmConfigFromDB --debug --configName %s --orcoff --format Python --nooutput --cff" % hltKey)[1].read()
115  configName = "JobHLTConfig_%s_cff.py" % jobHash
116 
117  # Perform online --> offline conversion
118  config = ConvertHltOnlineToOffline(config, frontierString)
119 
120  # Write the config
121  f = open(configName, "w")
122  f.write(config)
123  f.close()
124 
125  return 'process.load("%s.%s.%s")' % (module, package, configName.split(".")[0])
126 
127 # Fetches the HLT key from ConfDB - turned off in options for now

References ConvertHltOnlineToOffline(), and readEcalDQMStatus.read.

◆ GetHltKeyForRun()

def HltComparatorCreateWorkflow.GetHltKeyForRun (   run)

Definition at line 128 of file HltComparatorCreateWorkflow.py.

128 def GetHltKeyForRun(run):
129  raise SystemExit("Not implemented yet")
130 
131 # Formats an HLT CFF path into a suitable python include statement

◆ RemovePSet()

def HltComparatorCreateWorkflow.RemovePSet (   config,
  pset 
)

Definition at line 76 of file HltComparatorCreateWorkflow.py.

76 def RemovePSet(config, pset):
77  startLoc = config.find(pset)
78  started = False
79  count = 0
80  curLoc = startLoc
81  endLoc = 0
82 
83  # Find starting parenthesis
84  while not started:
85  if config[curLoc] == "(":
86  started = True
87  count = 1
88  curLoc += 1
89 
90  # Find end parenthesis
91  while endLoc == 0:
92  if config[curLoc] == "(":
93  count += 1
94  elif config[curLoc] == ")":
95  count -= 1
96  if count == 0:
97  endLoc = curLoc
98  curLoc += 1
99 
100  config = config.replace(config[startLoc:endLoc + 1], "")
101 
102  return config
103 
104 # Fetches the HLT configuration from ConfDB

Referenced by ConvertHltOnlineToOffline().

Variable Documentation

◆ anaConfig

HltComparatorCreateWorkflow.anaConfig

Definition at line 171 of file HltComparatorCreateWorkflow.py.

◆ args

HltComparatorCreateWorkflow.args

Definition at line 32 of file HltComparatorCreateWorkflow.py.

◆ default

HltComparatorCreateWorkflow.default

Definition at line 29 of file HltComparatorCreateWorkflow.py.

◆ dest

HltComparatorCreateWorkflow.dest

Definition at line 16 of file HltComparatorCreateWorkflow.py.

◆ help

HltComparatorCreateWorkflow.help

Definition at line 17 of file HltComparatorCreateWorkflow.py.

◆ hltConfig

HltComparatorCreateWorkflow.hltConfig

◆ hltKey

HltComparatorCreateWorkflow.hltKey

Definition at line 167 of file HltComparatorCreateWorkflow.py.

◆ jobHash

HltComparatorCreateWorkflow.jobHash

Definition at line 12 of file HltComparatorCreateWorkflow.py.

◆ metavar

HltComparatorCreateWorkflow.metavar

Definition at line 23 of file HltComparatorCreateWorkflow.py.

◆ options

HltComparatorCreateWorkflow.options

Definition at line 32 of file HltComparatorCreateWorkflow.py.

◆ parser

HltComparatorCreateWorkflow.parser

Definition at line 15 of file HltComparatorCreateWorkflow.py.

◆ usage

HltComparatorCreateWorkflow.usage

Definition at line 14 of file HltComparatorCreateWorkflow.py.

HltComparatorCreateWorkflow.CheckEnvironment
def CheckEnvironment()
Definition: HltComparatorCreateWorkflow.py:49
HltComparatorCreateWorkflow.GetHltConfiguration
def GetHltConfiguration(hltKey, frontierString)
Definition: HltComparatorCreateWorkflow.py:105
HltComparatorCreateWorkflow.GetHltCompileCode
def GetHltCompileCode(subsystem, package, hltConfig)
Definition: HltComparatorCreateWorkflow.py:139
HltComparatorCreateWorkflow.FormatHltCff
def FormatHltCff(cffPath)
Definition: HltComparatorCreateWorkflow.py:132
HltComparatorCreateWorkflow.ConvertHltOnlineToOffline
def ConvertHltOnlineToOffline(config, frontierString)
Definition: HltComparatorCreateWorkflow.py:56
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
readEcalDQMStatus.read
read
Definition: readEcalDQMStatus.py:38
HltComparatorCreateWorkflow.RemovePSet
def RemovePSet(config, pset)
Definition: HltComparatorCreateWorkflow.py:76
HltComparatorCreateWorkflow.GetHltKeyForRun
def GetHltKeyForRun(run)
Definition: HltComparatorCreateWorkflow.py:128
HltComparatorCreateWorkflow.CreateAnalysisConfig
def CreateAnalysisConfig(analysis, hltInclude)
Definition: HltComparatorCreateWorkflow.py:146