from HIJetRec.HIJetRecFlags import HIJetFlags from HIGlobal.HIGlobalFlags import jobproperties from JetRec.JetRecFlags import jetFlags from HIJetRec.HIJetRecConfig import * jetFlags.useCells.set_Value(True) from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from CaloRec.CaloTowerCmbGetter import CaloTowerCmbGetter CaloTowerCmbGetter() #check for event shape #if hasattr(topSequence,"HIEventShapeAlgorithm") EventShapeKey = jobproperties.HIGlobalFlags.EventShapeKey() ClusterKey = HIJetFlags.HIClusterKey() #import utility functions from HIJetRec.HIJetRecUtils import * HIClusterGetter() #equip basic tools from HIJetRec.HIJetRecTools import jtm #------------------------------ #set flags, keys and configure new event shape algorithm #>check if is MC or overlay and configure calibration tool properly from JetRec.JetRecFlags import jetFlags is_mc_or_overlay = False is_pp_mc = False if not jetFlags.useTruth():
def configure(self): mlog = logging.getLogger('CaloClusterSWCmb.py::configure :') mlog.info('entering') # get handle to upstream object # combined calo tower try: from CaloRec.CaloTowerCmbGetter import CaloTowerCmbGetter theCaloTowerCmbGetter = CaloTowerCmbGetter() except: mlog.error("could not get handle to CaloTowerCmbGetter Quit") print traceback.format_exc() return False if not theCaloTowerCmbGetter.usable(): if not self.ignoreConfigError(): mlog.error("CaloTowerCmbGetter unusable. Quit.") return False else: mlog.error( "CaloTowerCmbGetter unusable. Continue nevertheless") # now configure the algorithm, part of this could be done in a separate class # cannot have same name try: from CaloRec.CaloRecConf import CaloClusterMaker except: mlog.error("could not import CaloRec.CaloClusterMaker") print traceback.format_exc() return False theCaloClusterMaker = CaloClusterMaker("CaloClusterMakerSWCmb") self._CaloClusterMakerHandle = theCaloClusterMaker # configure CaloClusterMaker here try: from CaloRec.CaloRecConf import CaloClusterBuilderSW theCaloClusterBuilderSW = CaloClusterBuilderSW( "CaloClusterBuilderSWCmb") except: mlog.error("could not get handle to CaloClusterBuilderSWCmb Quit") print traceback.format_exc() return False # add the tool to list of tool ( should use ToolHandle eventually) theCaloClusterMaker.ClusterMakerTools += [ theCaloClusterBuilderSW.getFullName() ] theCaloClusterBuilderSW.TowerContainer = theCaloTowerCmbGetter.outputKey( ) theCaloClusterBuilderSW.eta_size = 5 theCaloClusterBuilderSW.phi_size = 5 theCaloClusterBuilderSW.eta_sizep = 3 theCaloClusterBuilderSW.phi_sizep = 3 theCaloClusterBuilderSW.e_threshold = 15. * GeV theCaloClusterBuilderSW.FillClusterCells = True #fill cells in ClusterBuilderSW theCaloClusterBuilderSW.nextra = 0 theCaloClusterBuilderSW.eta_SeedGrid = 5 theCaloClusterBuilderSW.phi_SeedGrid = 5 theCaloClusterBuilderSW.eta_Duplicate = 5 theCaloClusterBuilderSW.phi_Duplicate = 5 # add tool to alg . From now on theCaloClusterBuilderSW will point # on a COPY of the tool, so property cannot be further modified ! theCaloClusterMaker += theCaloClusterBuilderSW # sets output key theCaloClusterMaker.ClustersOutputName = self.outputKey() # register output in objKeyStore from RecExConfig.ObjKeyStore import objKeyStore # write everything in ESD objKeyStore.addManyTypesStreamESD(self.output()) # only write cluster class in AOD objKeyStore.addStreamAOD(self.outputType(), self.outputKey()) # now add algorithm to topSequence # this should always come at the end mlog.info(" now adding to topSequence") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += theCaloClusterMaker return True
def configure(self): mlog = logging.getLogger('CaloTopoTowerGetter::configure :') mlog.info('scheduled to output %s', self.output()) # get handle to upstream CaloCells theCaloCellGetter = self.getInputGetter\ (jp.CaloRecFlags.clusterCellGetterName()) # ----- get handle to upstream tower objects try: from CaloRec.CaloTowerCmbGetter import CaloTowerCmbGetter theCaloTowerCmbGetter = CaloTowerCmbGetter() except Exception: mlog.error("could not get handle to CaloTowerCmbGetter Quit") print(traceback.format_exc()) return False if not theCaloTowerCmbGetter.usable(): if not self.ignoreConfigError(): mlog.error("CaloTowerCmbGetter unusable. Quit.") return False else: mlog.error( "CaloTowerCmbGetter unusable. Continue nevertheless") # ------ get handle to upstream topo cluster object try: from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter theCaloClusterTopoGetter = CaloClusterTopoGetter() except Exception: mlog.error("could not get handle to CaloClusterTopoGetter Quit") print(traceback.format_exc()) return False if not theCaloClusterTopoGetter.usable(): if not self.ignoreConfigError(): mlog.error("theCaloClusterTopoGetter unusable. Quit.") return False else: mlog.error( "theCaloClusterTopoGetter unusable. Continue nevertheless") # ------ get handle to upstream topo cluster object try: from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter CaloClusterTopoGetter() from CaloRec.CaloCell2ClusterMapperGetters import CaloCell2TopoClusterMapperGetter theCaloCell2TopoClusterMapperGetter = CaloCell2TopoClusterMapperGetter( ) except Exception: mlog.error( "could not get handle to CaloCell2TopoClusterMapperGetter Quit" ) print(traceback.format_exc()) return False if not theCaloCell2TopoClusterMapperGetter.usable(): if not self.ignoreConfigError(): mlog.error( "theCaloCell2TopoClusterMapperGetter unusable. Quit.") return False else: mlog.error( "theCaloCell2TopoClusterMapperGetter unusable. Continue nevertheless" ) # now configure the algorithm, part of this could be done in a separate class # cannot have same name try: from CaloRec.CaloRecConf import CaloTopoTowerAlgorithm theCaloTopoTowerAlgorithm = CaloTopoTowerAlgorithm("TopoTowerBldr") except Exception: mlog.error("could not import CaloRec.CaloTopoTowerAlgorithm") print(traceback.format_exc()) return False self._CaloTopoTowerAlgorithmHandle = theCaloTopoTowerAlgorithm # configure CaloTopoTowerAlgorithm here try: from CaloUtils.CaloUtilsConf import CaloTopoTowerBuilderTool theCaloTopoTowerBuilderTool = CaloTopoTowerBuilderTool( "TopoTowerTwrBldr") except Exception: mlog.error("could not get handle to CaloTopoTowerBuilderTool Quit") print(traceback.format_exc()) return False theCaloTopoTowerAlgorithm.TowerBuilderTools += [ theCaloTopoTowerBuilderTool.getFullName() ] ######################## # extra cuts which can be applied at the topo tower level # set input keys theCaloTopoTowerAlgorithm.InputTowerContainerName = theCaloTowerCmbGetter.outputKey( ) theCaloTopoTowerAlgorithm.ClusterContainerName = theCaloClusterTopoGetter.outputKey( ) theCaloTopoTowerAlgorithm.CellContainerName = theCaloCellGetter.outputKey( ) theCaloTopoTowerAlgorithm.Cell2ClusterMapName = theCaloCell2TopoClusterMapperGetter.outputKey( ) # sets output key theCaloTopoTowerAlgorithm.OutputTowerContainerName = self.outputKey() theCaloTopoTowerAlgorithm.MinimumCellEnergy = -1000000000.0 theCaloTopoTowerAlgorithm.MinimumClusterEnergy = -1000000000.0 theCaloTopoTowerAlgorithm.CellEnergySignificance = -1. # noise tool theCaloTopoTowerAlgorithm.UseCaloNoiseTool = False ######################## # add tool to alg . From now on theCaloClusterBuilderSW will point # on a COPY of the tool, so property cannot be further modified ! theCaloTopoTowerAlgorithm += theCaloTopoTowerBuilderTool # register output in objKeyStore from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addStreamESD(self.outputType(), self.outputKey()) # now add algorithm to topSequence # this should always come at the end mlog.info(" now adding to topSequence") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += theCaloTopoTowerAlgorithm return True