2 from __future__
import print_function
3 import FWCore.ParameterSet.Config
as cms
9 process = cms.Process(
"SIZE");
15 import Configuration.EventContent.EventContentCosmics_cff
as eventContent_cosmics
19 "RECO": eventContent.RECOEventContent,
20 "AOD": eventContent.AODEventContent,
21 "RECO_COSMICS": eventContent_cosmics.RECOEventContent,
22 "AOD_COSMICS": eventContent_cosmics.AODEventContent,
24 "RECOSIM": eventContent.RECOSIMEventContent,
25 "AODSIM": eventContent.AODSIMEventContent,
26 "RAW": eventContent.RAWEventContent,
27 "RAWSIM": eventContent.RAWSIMEventContent,
28 "FEVTDEBUG": eventContent.FEVTDEBUGEventContent,
29 "FEVTDEBUGHLT": eventContent.FEVTDEBUGHLTEventContent
35 process = cms.Process("SIZE"); 36 process.load("Configuration.EventContent.EventContent_cff") 37 ## define event conent to be used 38 if options.event_content == "RECO" : 39 local_outputCommands = process.RECOEventContent.outputCommands; + 40 elif options.event_content == "RECOSIM" : 41 local_outputCommands = process.RECOSIMEventContent.outputCommands; + 42 elif options.event_content == "AOD" : 43 local_outputCommands = process.AODEventContent.outputCommands; + 44 elif options.event_content == "AODSIM" : 45 local_outputCommands = process.AODSIMEventContent.outputCommands; + 46 elif options.event_content == "RAW" : 47 local_outputCommands = process.RAWEventContent.outputCommands; + 48 elif options.event_content == "RAWSIM" : 49 local_outputCommands = process.RAWSIMEventContent.outputCommands; 50 elif options.event_content == "FEVTDEBUG" : 51 local_outputCommands = process.FEVTDEBUGEventContent.outputCommands; 52 elif options.event_content == "FEVTDEBUGHLT" : 53 local_outputCommands = process.FEVTDEBUGHLTEventContent.outputCommands; 54 elif options.event_content == "ALL" : 55 local_outputCommands = cms.untracked.vstring('keep *_*_*_*'); 64 rule: rule(keep, drop)_A_B_C_D 69 return rule_regexp.match(product_repr+
"_")
72 """ returns a tuple (rule_name, rule_regexp) e.g. ("keep", <regexp for matching product names> """ 74 (rule_name, rule_test) = rule.split()
79 rule_parts =rule_test.split(
"_")
80 if len(rule_parts) == 4 :
83 rule_test =
"_".
join(rule_parts)
86 rule_test = rule_test.replace(
"*",
".*")
88 rule_regexp = re.compile(
"^"+rule_test+
"$")
90 return (rule_name, rule_regexp)
94 products are in format {"cpp_type": cpp_type, "module_name": mod_name, "module_label": mod_label, 95 "size_uncompressed": size_uncomp, "size_compressed": size_comp} 96 --- Some simple doctests --- 98 >>> product_in_EventContent(rules = rule_to_regexp(['drop *', 'keep *_logErrorHarvester_*_*', 'keep *_hybridSuperClusters_*_*', 'keep recoSuperClusters_correctedHybridSuperClusters_*_*']), product = {'module_name': 'hybridSuperClusters', 'module_label': 'hybridShapeAssoc', 'size_compressed': '65.4852', 'cpp_type': 'recoCaloClustersToOnerecoClusterShapesAssociation', 'size_uncompressed': '272.111'}) 101 >>> product_in_EventContent(rules = rule_to_regexp(['drop *', 'keep *_logErrorHarvester_*_*', 'keep DetIdedmEDCollection_siStripDigis_*_*', 'keep *_siPixelClusters_*_*', 'keep *_siStripClusters_*_*']), product = {'module_name': 'hybridSuperClusters', 'module_label': 'hybridShapeAssoc', 'size_compressed': '65.4852', 'cpp_type': 'recoCaloClustersToOnerecoClusterShapesAssociation', 'size_uncompressed': '272.111'}) 107 product_repr =
"%(cpp_type)s_%(module_name)s_%(module_label)s" % product
110 """ rule is in format: 111 > keep *_nuclearInteractionMaker_*_* 115 for (rule_name, rule_regexp)
in rules:
119 return result ==
"keep" 124 for (ec_name, obj)
in EventContents_def.items():
126 rules_txt = [a
for a
in obj.outputCommands]
129 rules_regexp =
map(rule_to_regexp, rules_txt)
131 EventContents[ec_name] = {
"text_rules": rules_txt,
"rules_regexp": rules_regexp}
135 """ returns a list of EC titles the product belongs to """ 137 for (ec_name, ec)
in EventContents.items():
139 EC_list.append(ec_name)
144 """ returns a dictionary of lists with rules """ 146 for (ec_name, ec)
in EventContents.items():
147 txt_rules[ec_name] = ec[
"text_rules"]
151 if __name__ ==
"__main__":
152 print(
"==== The event contents data is: === ")
154 prod = {
'module_name':
'hybridSuperClusters',
'module_label':
'hybridShapeAssoc',
'size_compressed':
'65.4852',
'cpp_type':
'recoCaloClustersToOnerecoClusterShapesAssociation',
'size_uncompressed':
'272.111'}
S & print(S &os, JobReport::InputFile const &f)
def product_in_EventContent(rules, product)
def getTxtEventContentRules()
def List_ECs_forProduct(product)
def rule_passes(rule_regexp, product_repr)
static std::string join(char **cmd)