CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
parseEventContent Namespace Reference

Functions

def getTxtEventContentRules
 
def List_ECs_forProduct
 
def product_in_EventContent
 
def rule_passes
 
def rule_to_regexp
 

Variables

dictionary EventContents = {}
 
dictionary EventContents_def
 
tuple process = cms.Process("SIZE")
 
dictionary prod = {'module_name': 'hybridSuperClusters', 'module_label': 'hybridShapeAssoc', 'size_compressed': '65.4852', 'cpp_type': 'recoCaloClustersToOnerecoClusterShapesAssociation', 'size_uncompressed': '272.111'}
 
tuple rules_regexp = map(rule_to_regexp, rules_txt)
 
list rules_txt = [a for a in obj.outputCommands]
 

Function Documentation

def parseEventContent.getTxtEventContentRules ( )
returns a dictionary of lists with rules 

Definition at line 141 of file parseEventContent.py.

143  #TODO: We should where to assign products to Event-Content, on harvesting or on importing part
144  """ returns a dictionary of lists with rules """
145  txt_rules = {}
146  for (ec_name, ec) in EventContents.items():
147  txt_rules[ec_name] = ec["text_rules"]
148  return txt_rules
149 
#a test
def parseEventContent.List_ECs_forProduct (   product)
returns a list of EC titles the product belongs to 

Definition at line 133 of file parseEventContent.py.

References product_in_EventContent().

Referenced by cmsPerfSuiteHarvest._eventContent_DEBUG(), and cmsPerfSuiteHarvest.assign_event_content_for_product().

134 def List_ECs_forProduct(product):
135  """ returns a list of EC titles the product belongs to """
136  EC_list = []
137  for (ec_name, ec) in EventContents.items():
138  if product_in_EventContent(ec["rules_regexp"], product):
139  EC_list.append(ec_name)
140  return EC_list
def parseEventContent.product_in_EventContent (   rules,
  product 
)
products are in format {"cpp_type": cpp_type, "module_name": mod_name, "module_label": mod_label,
    "size_uncompressed": size_uncomp, "size_compressed": size_comp}  
--- Some simple doctests ---

>>> 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'})
True

>>> 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'})
False

Definition at line 91 of file parseEventContent.py.

References rule_passes().

Referenced by List_ECs_forProduct().

91 
92 def product_in_EventContent(rules, product):
93  """
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 ---
97 
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'})
99  True
100 
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'})
102  False
103 
104  """
105 
106 
107  product_repr = "%(cpp_type)s_%(module_name)s_%(module_label)s" % product
108  result = "keep"
109 
110  """ rule is in format:
111  > keep *_nuclearInteractionMaker_*_*
112  > keep *_horeco_*_*
113  > drop *
114  """
115  for (rule_name, rule_regexp) in rules:
116 
117  if rule_passes(rule_regexp, product_repr):
118  result = rule_name
119  return result == "keep"
120 
121 
#initialize
def parseEventContent.rule_passes (   rule_regexp,
  product_repr 
)
    rule: rule(keep, drop)_A_B_C_D
    product: A_B_C

Definition at line 61 of file parseEventContent.py.

Referenced by product_in_EventContent().

61 
62 def rule_passes(rule_regexp, product_repr):
63  """
64  rule: rule(keep, drop)_A_B_C_D
65  product: A_B_C
66  """
67  #we have altered the rules to have "*" as the 4th parameter (if split by _)
68  # so all the D's will pass
69  return rule_regexp.match(product_repr+"_")
def parseEventContent.rule_to_regexp (   rule)
returns a tuple (rule_name, rule_regexp) e.g. ("keep", <regexp for matching product names>  

Definition at line 70 of file parseEventContent.py.

References join().

70 
71 def rule_to_regexp(rule):
72  """ returns a tuple (rule_name, rule_regexp) e.g. ("keep", <regexp for matching product names> """
73  #this part might be moved out and regular expression cached
74  (rule_name, rule_test) = rule.split()
75 
76  # we create a regexp out of rule
77 
78  #we ignore the 4th rule:
79  rule_parts =rule_test.split("_")
80  if len(rule_parts) == 4 :
81  # we replace the last one to asterix
82  rule_parts[3] = "*"
83  rule_test = "_".join(rule_parts)
84 
85  # make a regexp
86  rule_test = rule_test.replace("*", ".*")
87 
88  rule_regexp = re.compile("^"+rule_test+"$")
89 
90  return (rule_name, rule_regexp)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Variable Documentation

dictionary parseEventContent.EventContents = {}

Definition at line 122 of file parseEventContent.py.

dictionary parseEventContent.EventContents_def
Initial value:
1 = {
2  "RECO": eventContent.RECOEventContent,
3  "AOD": eventContent.AODEventContent,
4  "RECO_COSMICS": eventContent_cosmics.RECOEventContent,
5  "AOD_COSMICS": eventContent_cosmics.AODEventContent,
6  #new output commands
7  "RECOSIM": eventContent.RECOSIMEventContent,
8  "AODSIM": eventContent.AODSIMEventContent,
9  "RAW": eventContent.RAWEventContent,
10  "RAWSIM": eventContent.RAWSIMEventContent,
11  "FEVTDEBUG": eventContent.FEVTDEBUGEventContent,
12  "FEVTDEBUGHLT": eventContent.FEVTDEBUGHLTEventContent
13 }

Definition at line 17 of file parseEventContent.py.

tuple parseEventContent.process = cms.Process("SIZE")

Definition at line 8 of file parseEventContent.py.

dictionary parseEventContent.prod = {'module_name': 'hybridSuperClusters', 'module_label': 'hybridShapeAssoc', 'size_compressed': '65.4852', 'cpp_type': 'recoCaloClustersToOnerecoClusterShapesAssociation', 'size_uncompressed': '272.111'}

Definition at line 153 of file parseEventContent.py.

Referenced by asimovutils.asimovDatasetWithFit(), edm::RefVector< TrackingRecHitCollection >.at(), edm::PoolOutputModule.beginJob(), edm::Principal.checkUniquenessAndType(), BareRootProductGetter.createNewBuffer(), edm::RootFile.dropOnInput(), edm::RefVector< C, T, F >.erase(), utils.factorizeFunc(), utils.factorizePdf(), edm::PoolOutputModule.fillSelectedItemList(), toymcoptutils::SinglePdfGenInfo.generateCountingAsimov(), edm::Ptr< reco::Muon >.getData_(), BareRootProductGetter.getIt(), MaxLikelihoodFit.getNormalizations(), edm::refitem::GetPtrImpl< C, T, F, KEY >.getPtr_(), TrackProducer.getTransient(), TrackProducerWithSCAssociation.getTransient(), MLP_Epoch(), edm::RefVector< TrackingRecHitCollection >.operator[](), ImpactParameter.produce(), PathTimerInserter.produce(), CaloTowersReCreator.produce(), CaloTowersCreator.produce(), InvariantMass< T1, T2 >.produce(), ConeIsolation.produce(), HcalHistogramRawToDigi.produce(), HcalRawToDigi.produce(), CastorRawToDigi.produce(), ParticleTowerProducer.produce(), EcalElectronicsMappingBuilder.produce(), CaloTowerConstituentsMapBuilder.produce(), EcalTrigTowerConstituentsMapBuilder.produce(), EcalTrigPrimESProducer.produceBadStrip(), EcalTrigPrimESProducer.produceBadTT(), EcalTrigPrimESProducer.produceBadX(), EcalTrigPrimESProducer.produceFineGrainEB(), EcalTrigPrimESProducer.produceFineGrainEBGroup(), EcalTrigPrimESProducer.produceFineGrainEEstrip(), EcalTrigPrimESProducer.produceFineGrainEEtower(), EcalTrigPrimESProducer.produceLinearizationConst(), EcalTrigPrimESProducer.produceLUT(), EcalTrigPrimESProducer.produceLutGroup(), EcalTrigPrimESProducer.producePedestals(), EcalTrigPrimESProducer.producePhysicsConst(), EcalTrigPrimESProducer.produceSlidingWindow(), EcalTrigPrimSpikeESProducer.produceSpike(), EcalTrigPrimESProducer.produceSpike(), EcalTrigPrimESProducer.produceWeight(), EcalTrigPrimESProducer.produceWeightGroup(), edm::reftobase::RefVectorHolderDoFillView< REFV >.reallyFillView(), edm::RootFile.RootFile(), edm::StreamerOutputModuleBase.setHltMask(), TFWLiteSelectorBasic.setupNewFile(), IPTools.signedImpactParameter3D(), IPTools.signedTransverseImpactParameter(), and KinematicConstrainedVertexUpdatorT< nTrk, nConstraint >.update().

tuple parseEventContent.rules_regexp = map(rule_to_regexp, rules_txt)

Definition at line 128 of file parseEventContent.py.

list parseEventContent.rules_txt = [a for a in obj.outputCommands]

Definition at line 125 of file parseEventContent.py.