CMS 3D CMS Logo

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.

00142                              :
00143         #TODO: We should where to assign products to Event-Content, on harvesting or on importing part
00144         """ returns a dictionary of lists with rules """
00145         txt_rules = {}
00146         for (ec_name, ec) in EventContents.items():
00147                 txt_rules[ec_name] = ec["text_rules"]
00148         return txt_rules
00149         
#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.

00134                                 :
00135         """ returns a list of EC titles the product belongs to """
00136         EC_list = []
00137         for (ec_name, ec) in EventContents.items():
00138                 if product_in_EventContent(ec["rules_regexp"], product):
00139                         EC_list.append(ec_name)
00140         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.

00092                                            :
00093         """
00094         products are in format {"cpp_type": cpp_type, "module_name": mod_name, "module_label": mod_label,
00095                 "size_uncompressed": size_uncomp, "size_compressed": size_comp}  
00096         --- Some simple doctests ---
00097 
00098         >>> 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'})
00099         True
00100         
00101         >>> 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'})
00102         False
00103         
00104         """
00105 
00106 
00107         product_repr = "%(cpp_type)s_%(module_name)s_%(module_label)s" % product
00108         result = "keep"
00109         
00110         """ rule is in format: 
00111                 > keep  *_nuclearInteractionMaker_*_*
00112                 > keep *_horeco_*_*
00113                 > drop *
00114         """
00115         for (rule_name, rule_regexp) in rules:
00116 
00117                 if rule_passes(rule_regexp, product_repr):
00118                         result = rule_name
00119         return result == "keep"
00120 
00121 
#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.

00062                                           :
00063         """ 
00064                 rule: rule(keep, drop)_A_B_C_D
00065                 product: A_B_C
00066         """     
00067         #we have altered the rules to have "*" as the 4th parameter (if split by _) 
00068         # so all the D's will pass
00069         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.

00071                         :
00072         """ returns a tuple (rule_name, rule_regexp) e.g. ("keep", <regexp for matching product names>  """
00073         #this part might be moved out and regular expression cached
00074         (rule_name, rule_test) = rule.split()
00075         
00076         # we create a regexp out of rule
00077         
00078         #we ignore the 4th rule:
00079         rule_parts =rule_test.split("_")
00080         if len(rule_parts) == 4 :
00081                 # we replace the last one to asterix
00082                 rule_parts[3] = "*" 
00083         rule_test = "_".join(rule_parts) 
00084         
00085         # make a regexp
00086         rule_test = rule_test.replace("*", ".*")
00087 
00088         rule_regexp = re.compile("^"+rule_test+"$")
00089         
00090         return (rule_name, rule_regexp)


Variable Documentation

Definition at line 122 of file parseEventContent.py.

Initial value:
00001 {
00002         "RECO":                 eventContent.RECOEventContent, 
00003         "AOD":                  eventContent.AODEventContent,
00004         "RECO_COSMICS":         eventContent_cosmics.RECOEventContent, 
00005         "AOD_COSMICS":          eventContent_cosmics.AODEventContent,
00006         #new output commands
00007         "RECOSIM":              eventContent.RECOSIMEventContent,
00008         "AODSIM":               eventContent.AODSIMEventContent,
00009         "RAW":                  eventContent.RAWEventContent,
00010         "RAWSIM":               eventContent.RAWSIMEventContent,
00011         "FEVTDEBUG":            eventContent.FEVTDEBUGEventContent,
00012         "FEVTDEBUGHLT":         eventContent.FEVTDEBUGHLTEventContent
00013 }

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 edm::RefVector< TrackingRecHitCollection >::at(), edm::PoolOutputModule::beginJob(), edm::Principal::checkUniquenessAndType(), BareRootProductGetter::createNewBuffer(), edm::RootFile::dropOnInput(), edm::RefVector< C, T, F >::erase(), edm::PoolOutputModule::fillSelectedItemList(), edm::Ptr< pat::MET >::getData_(), BareRootProductGetter::getIt(), edm::refitem::GetPtrImpl< C, T, F, KEY >::getPtr_(), TrackProducerWithSCAssociation::getTransient(), TrackProducer::getTransient(), MLP_Epoch(), edm::RefVector< TrackingRecHitCollection >::operator[](), HcalRawToDigi::produce(), CaloTowersReCreator::produce(), InvariantMass< T1, T2 >::produce(), HcalHistogramRawToDigi::produce(), EcalElectronicsMappingBuilder::produce(), CaloTowersCreator::produce(), ParticleTowerProducer::produce(), PathTimerInserter::produce(), ConeIsolation::produce(), CastorRawToDigi::produce(), CaloTowerConstituentsMapBuilder::produce(), EcalTrigTowerConstituentsMapBuilder::produce(), ImpactParameter::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(), EcalTrigPrimESProducer::produceSpike(), EcalTrigPrimSpikeESProducer::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.