From add25c84dc5183af17bd322040c6a1d7e3b59e56 Mon Sep 17 00:00:00 2001 From: TJ Khoo <khoo@cern.ch> Date: Thu, 10 Jan 2019 10:58:24 +0100 Subject: [PATCH] Implementing a ComponentAccumulator-based PFlow reconstruction config with an eye to HLT implementation Allow disabling of some dependencies Filling in missing parts of TopoCluster config Make public LArHV tools private Config module for LArHVScaleCorr Expanding topocluster config with HV scale config Attempt to extend PF config in directions usable at HLT Readd calocluster building Fix topocluster flag names Slimming down PFHLTConfig.TrackingGeoCfg Ugly fix for tile conditions pending better one from Walter Fix import bugs for LArHVScaleConfig on MC, without actually making it work fully Permit switching off most PFO moments Remove inexplicably duplicated code in CaloCalTopoClusterConfig and fix for running on MC Add ID and muon geo needed to get this running Changes to make this run on MC, and produce new/old PFOs one space indent Remove redundant property declaration Correction to CaloNoiseTool usage Updating copyright years Switching from CaloNoiseTool to CaloNoiseCondAlg Adapting to CA changes Update PF usage of B-field, extrapolators, other conditions Make sure CondInputLoader runs before LArCabling alg Supply class name for PileUpNoiseLumi --- .../CaloRec/python/CaloTopoClusterConfig.py | 332 +++--------------- .../python/CaloNoiseCondAlgConfig.py | 24 +- .../LArCabling/python/LArCablingConfig.py | 4 +- .../LArCalibUtils/python/LArHVScaleConfig.py | 13 +- .../LArRecUtils/src/LArHVCorrTool.cxx | 6 +- .../eflowRec/PFONeutralCreatorAlgorithm.h | 8 +- Reconstruction/eflowRec/python/PFHLTConfig.py | 294 ++++++++++++++++ .../src/PFCellLevelSubtractionTool.cxx | 6 +- .../eflowRec/src/PFClusterSelectorTool.cxx | 16 +- .../src/PFONeutralCreatorAlgorithm.cxx | 251 ++++++------- .../eflowRec/src/PFTrackSelector.cxx | 14 +- .../python/TileConditionsConfig.py | 89 ++--- 12 files changed, 582 insertions(+), 475 deletions(-) create mode 100644 Reconstruction/eflowRec/python/PFHLTConfig.py diff --git a/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py b/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py index dcbaa23121a..7f7ba9fc886 100644 --- a/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py +++ b/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaCommon.SystemOfUnits import MeV @@ -26,7 +26,7 @@ def caloTopoCoolFolderCfg(configFlags): return result -def getTopoClusterLocalCalibTools(configFlags, theCaloNoiseTool): +def getTopoClusterLocalCalibTools(configFlags): from CaloUtils.CaloUtilsConf import CaloLCClassificationTool, CaloLCWeightTool, CaloLCOutOfClusterTool, CaloLCDeadMaterialTool from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib # Local cell weights @@ -42,241 +42,6 @@ def getTopoClusterLocalCalibTools(configFlags, theCaloNoiseTool): LCWeight.CorrectionKey = "H1ClusterCellWeights" LCWeight.SignalOverNoiseCut = 2.0 # ***** - # Needs calo noise tool config - LCWeight.CaloNoiseTool = theCaloNoiseTool - # ***** - LCWeight.UseHadProbability = True - - LocalCalib = CaloClusterLocalCalib ("LocalCalib") - LocalCalib.ClusterClassificationTool = [LCClassify] - LocalCalib.ClusterRecoStatus = [1,2] - LocalCalib.LocalCalibTools = [LCWeight] - LocalCalib.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - - # Out-of-cluster corrections - LCOut = CaloLCOutOfClusterTool("LCOut") - LCOut.CorrectionKey = "OOCCorrection" - LCOut.UseEmProbability = False - LCOut.UseHadProbability = True - - OOCCalib = CaloClusterLocalCalib ("OOCCalib") - OOCCalib.ClusterRecoStatus = [1,2] - OOCCalib.LocalCalibTools = [LCOut] - OOCCalib.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - - LCOutPi0 = CaloLCOutOfClusterTool("LCOutPi0") - LCOutPi0.CorrectionKey = "OOCPi0Correction" - LCOutPi0.UseEmProbability = True - LCOutPi0.UseHadProbability = False - - OOCPi0Calib = CaloClusterLocalCalib ("OOCPi0Calib") - OOCPi0Calib.ClusterRecoStatus = [1,2] - OOCPi0Calib.LocalCalibTools = [LCOutPi0] - - OOCPi0Calib.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - - # Dead material corrections - LCDeadMaterial = CaloLCDeadMaterialTool("LCDeadMaterial") - LCDeadMaterial.HadDMCoeffKey = "HadDMCoeff2" - LCDeadMaterial.ClusterRecoStatus = 0 - LCDeadMaterial.WeightModeDM = 2 - LCDeadMaterial.UseHadProbability = True - LCDeadMaterial.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - - DMCalib = CaloClusterLocalCalib ("DMCalib") - DMCalib.ClusterRecoStatus = [1,2] - DMCalib.LocalCalibTools = [LCDeadMaterial] - - DMCalib.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - - lccalibtools = [ - LocalCalib, - OOCCalib, - OOCPi0Calib, - DMCalib] - return lccalibtools - -def getTopoMoments(configFlags,theCaloNoiseTool): - from CaloRec.CaloRecConf import CaloClusterMomentsMaker - TopoMoments = CaloClusterMomentsMaker ("TopoMoments") - TopoMoments.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - from AthenaCommon.SystemOfUnits import deg - TopoMoments.MaxAxisAngle = 20*deg - TopoMoments.CaloNoiseTool = theCaloNoiseTool - TopoMoments.UsePileUpNoise = True - TopoMoments.TwoGaussianNoise = configFlags.Calo.TopoCluster.doTwoGaussianNoise - TopoMoments.MinBadLArQuality = 4000 - TopoMoments.MomentsNames = ["FIRST_PHI" - ,"FIRST_ETA" - ,"SECOND_R" - ,"SECOND_LAMBDA" - ,"DELTA_PHI" - ,"DELTA_THETA" - ,"DELTA_ALPHA" - ,"CENTER_X" - ,"CENTER_Y" - ,"CENTER_Z" - ,"CENTER_MAG" - ,"CENTER_LAMBDA" - ,"LATERAL" - ,"LONGITUDINAL" - ,"FIRST_ENG_DENS" - ,"ENG_FRAC_EM" - ,"ENG_FRAC_MAX" - ,"ENG_FRAC_CORE" - ,"FIRST_ENG_DENS" - ,"SECOND_ENG_DENS" - ,"ISOLATION" - ,"ENG_BAD_CELLS" - ,"N_BAD_CELLS" - ,"N_BAD_CELLS_CORR" - ,"BAD_CELLS_CORR_E" - ,"BADLARQ_FRAC" - ,"ENG_POS" - ,"SIGNIFICANCE" - ,"CELL_SIGNIFICANCE" - ,"CELL_SIG_SAMPLING" - ,"AVG_LAR_Q" - ,"AVG_TILE_Q" - ,"PTD" - ,"MASS" - ] - - # ***** - # Is this still right? - # only add HV related moments if it is offline. - # from IOVDbSvc.CondDB import conddb - # if not conddb.isOnline: - from LArCellRec.LArCellRecConf import LArHVFraction - if configFlags.Input.isMC: - TopoMoments.LArHVFraction=LArHVFraction(HVScaleCorrKey="LArHVScaleCorr") - else: - TopoMoments.LArHVFraction=LArHVFraction(HVScaleCorrKey="LArHVScaleCorrRecomputed") - TopoMoments.MomentsNames += ["ENG_BAD_HV_CELLS" - ,"N_BAD_HV_CELLS" - ] - - return TopoMoments - -# a.k.a. DigiTruth -def getTopoTruthMoments(configFlags,theCaloNoiseTool): - from CaloRec.CaloRecConf import CaloClusterMomentsMaker - TopoMoments_Truth = CaloClusterMomentsMaker_DigiHSTruth ("TopoMoments_Truth") - from LArCellRec.LArCellRecConf import LArHVFraction - TopoMoments_Truth.LArHVFraction=LArHVFraction(HVScaleCorrKey="LArHVScaleCorr") - TopoMoments_Truth.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - from AthenaCommon.SystemOfUnits import deg - TopoMoments_Truth.MaxAxisAngle = 20*deg - TopoMoments_Truth.CaloNoiseTool = theCaloNoiseTool - TopoMoments_Truth.UsePileUpNoise = True - TopoMoments_Truth.TwoGaussianNoise = configFlags.Calo,TopoCluster.doTwoGaussianNoise - TopoMoments_Truth.MinBadLArQuality = 4000 - TopoMoments_Truth.MomentsNames = ["FIRST_PHI_DigiHSTruth" - ,"FIRST_ETA_DigiHSTruth" - ,"SECOND_R_DigiHSTruth" - ,"SECOND_LAMBDA_DigiHSTruth" - ,"DELTA_PHI_DigiHSTruth" - ,"DELTA_THETA_DigiHSTruth" - ,"DELTA_ALPHA_DigiHSTruth" - ,"CENTER_X_DigiHSTruth" - ,"CENTER_Y_DigiHSTruth" - ,"CENTER_Z_DigiHSTruth" - ,"CENTER_MAG_DigiHSTruth" - ,"CENTER_LAMBDA_DigiHSTruth" - ,"LATERAL_DigiHSTruth" - ,"LONGITUDINAL_DigiHSTruth" - ,"ENG_FRAC_CORE_DigiHSTruth" - ,"FIRST_ENG_DENS_DigiHSTruth" - ,"SECOND_ENG_DENS_DigiHSTruth" - ,"ISOLATION_DigiHSTruth" - ,"BAD_CELLS_CORR_E_DigiHSTruth" - ,"ENG_POS_DigiHSTruth" - ,"SIGNIFICANCE_DigiHSTruth" - ,"CELL_SIGNIFICANCE_DigiHSTruth" - ,"CELL_SIG_SAMPLING_DigiHSTruth" - ,"AVG_LAR_Q_DigiHSTruth" - ,"AVG_TILE_Q_DigiHSTruth" - ,"ENERGY_DigiHSTruth" - ,"PHI_DigiHSTruth" - ,"ETA_DigiHSTruth" - ] - return TopoMoments_Truth - -def getTopoCalibMoments(configFlags): - from CaloCalibHitRec.CaloCalibHitRecConf import CaloCalibClusterMomentsMaker2 - TopoCalibMoments = CaloCalibClusterMomentsMaker2 ("TopoCalibMoments") - TopoCalibMoments.MomentsNames = ["ENG_CALIB_TOT" - ,"ENG_CALIB_OUT_L" - #,"ENG_CALIB_OUT_M" - # ,"ENG_CALIB_OUT_T" - # ,"ENG_CALIB_DEAD_L" - # ,"ENG_CALIB_DEAD_M" - # ,"ENG_CALIB_DEAD_T" - ,"ENG_CALIB_EMB0" - ,"ENG_CALIB_EME0" - ,"ENG_CALIB_TILEG3" - ,"ENG_CALIB_DEAD_TOT" - ,"ENG_CALIB_DEAD_EMB0" - ,"ENG_CALIB_DEAD_TILE0" - ,"ENG_CALIB_DEAD_TILEG3" - ,"ENG_CALIB_DEAD_EME0" - ,"ENG_CALIB_DEAD_HEC0" - ,"ENG_CALIB_DEAD_FCAL" - ,"ENG_CALIB_DEAD_LEAKAGE" - ,"ENG_CALIB_DEAD_UNCLASS" - ,"ENG_CALIB_FRAC_EM" - ,"ENG_CALIB_FRAC_HAD" - ,"ENG_CALIB_FRAC_REST"] - - TopoCalibMoments.CalibrationHitContainerNames = ["LArCalibrationHitInactive" - ,"LArCalibrationHitActive" - ,"TileCalibHitActiveCell" - ,"TileCalibHitInactiveCell"] - TopoCalibMoments.DMCalibrationHitContainerNames = ["LArCalibrationHitDeadMaterial" - ,"TileCalibHitDeadMaterial"] - return TopoCalibMOments - -def caloTopoCoolFolderCfg(configFlags): - result=ComponentAccumulator() - from IOVDbSvc.IOVDbSvcConfig import addFolders - # rely on global tag for both MC and data; do not specify folder tags - # use CALO_OFL only for GEO>=18 - hadCalibFolders = [ - "HadCalibration2/CaloEMFrac", - "HadCalibration2/H1ClusterCellWeights", - "HadCalibration2/CaloOutOfCluster", - "HadCalibration2/CaloOutOfClusterPi0", - "HadCalibration2/CaloDMCorr2" - ] - hadCalibPrefix = "/CALO/" - hadCalibDB = "CALO_ONL" - if configFlags.Input.isMC: - hadCalibPrefix = "/CALO/Ofl/" - hadCalibDB = "CALO_OFL" - hadCalibFolders = [ hadCalibPrefix + foldername for foldername in hadCalibFolders ] - result.merge(addFolders(configFlags, hadCalibFolders, hadCalibDB, className="CaloLocalHadCoeff")) - - return result - -def getTopoClusterLocalCalibTools(configFlags, theCaloNoiseTool): - from CaloUtils.CaloUtilsConf import CaloLCClassificationTool, CaloLCWeightTool, CaloLCOutOfClusterTool, CaloLCDeadMaterialTool - from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib - # Local cell weights - LCClassify = CaloLCClassificationTool("LCClassify") - LCClassify.ClassificationKey = "EMFracClassify" - LCClassify.UseSpread = False - LCClassify.MaxProbability = 0.5 - # add the moments EM_PROBABILITY, HAD_WEIGHT, OOC_WEIGHT, DM_WEIGHT to the AOD: - LCClassify.StoreClassificationProbabilityInAOD = True - LCClassify.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - - LCWeight = CaloLCWeightTool("LCWeight") - LCWeight.CorrectionKey = "H1ClusterCellWeights" - LCWeight.SignalOverNoiseCut = 2.0 - # ***** - # Needs calo noise tool config - LCWeight.CaloNoiseTool = theCaloNoiseTool - # ***** LCWeight.UseHadProbability = True LocalCalib = CaloClusterLocalCalib ("LocalCalib") @@ -328,14 +93,12 @@ def getTopoClusterLocalCalibTools(configFlags, theCaloNoiseTool): DMCalib] return lccalibtools -def getTopoMoments(configFlags,theCaloNoiseTool): +def getTopoMoments(configFlags): from CaloRec.CaloRecConf import CaloClusterMomentsMaker TopoMoments = CaloClusterMomentsMaker ("TopoMoments") TopoMoments.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute from AthenaCommon.SystemOfUnits import deg TopoMoments.MaxAxisAngle = 20*deg - TopoMoments.CaloNoiseTool = theCaloNoiseTool - TopoMoments.UsePileUpNoise = True TopoMoments.TwoGaussianNoise = configFlags.Calo.TopoCluster.doTwoGaussianNoise TopoMoments.MinBadLArQuality = 4000 TopoMoments.MomentsNames = ["FIRST_PHI" @@ -374,24 +137,26 @@ def getTopoMoments(configFlags,theCaloNoiseTool): ,"MASS" ] - # ***** - # Is this still right? - # only add HV related moments if it is offline. - # from IOVDbSvc.CondDB import conddb - # if not conddb.isOnline: - from LArCellRec.LArCellRecConf import LArHVFraction - if configFlags.Input.isMC: - TopoMoments.LArHVFraction=LArHVFraction(HVScaleCorrKey="LArHVScaleCorr") - else: - TopoMoments.LArHVFraction=LArHVFraction(HVScaleCorrKey="LArHVScaleCorrRecomputed") - TopoMoments.MomentsNames += ["ENG_BAD_HV_CELLS" - ,"N_BAD_HV_CELLS" - ] + # Disable for now, as broken on MC + if False: + # ***** + # Is this still right? + # only add HV related moments if it is offline. + # from IOVDbSvc.CondDB import conddb + # if not conddb.isOnline: + from LArCellRec.LArCellRecConf import LArHVFraction + if configFlags.Input.isMC: + TopoMoments.LArHVFraction=LArHVFraction(HVScaleCorrKey="LArHVScaleCorr") + else: + TopoMoments.LArHVFraction=LArHVFraction(HVScaleCorrKey="LArHVScaleCorrRecomputed") + TopoMoments.MomentsNames += ["ENG_BAD_HV_CELLS" + ,"N_BAD_HV_CELLS" + ] return TopoMoments # a.k.a. DigiTruth -def getTopoTruthMoments(configFlags,theCaloNoiseTool): +def getTopoTruthMoments(configFlags): from CaloRec.CaloRecConf import CaloClusterMomentsMaker TopoMoments_Truth = CaloClusterMomentsMaker_DigiHSTruth ("TopoMoments_Truth") from LArCellRec.LArCellRecConf import LArHVFraction @@ -399,8 +164,6 @@ def getTopoTruthMoments(configFlags,theCaloNoiseTool): TopoMoments_Truth.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute from AthenaCommon.SystemOfUnits import deg TopoMoments_Truth.MaxAxisAngle = 20*deg - TopoMoments_Truth.CaloNoiseTool = theCaloNoiseTool - TopoMoments_Truth.UsePileUpNoise = True TopoMoments_Truth.TwoGaussianNoise = configFlags.Calo,TopoCluster.doTwoGaussianNoise TopoMoments_Truth.MinBadLArQuality = 4000 TopoMoments_Truth.MomentsNames = ["FIRST_PHI_DigiHSTruth" @@ -466,14 +229,18 @@ def getTopoCalibMoments(configFlags): ,"TileCalibHitInactiveCell"] TopoCalibMoments.DMCalibrationHitContainerNames = ["LArCalibrationHitDeadMaterial" ,"TileCalibHitDeadMaterial"] - return TopoCalibMOments + return TopoCalibMoments def CaloTopoClusterCfg(configFlags): result=ComponentAccumulator() from LArGeoAlgsNV.LArGMConfig import LArGMCfg from TileGeoModel.TileGMConfig import TileGMCfg - from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg + from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg + # Schedule total noise cond alg + result.merge(CaloNoiseCondAlgCfg(configFlags,"totalNoise")) + # Schedule electronic noise cond alg (needed for LC weights) + result.merge(CaloNoiseCondAlgCfg(configFlags,"electronicNoise")) #from CaloUtils.CaloUtilsConf import CaloLCClassificationTool, CaloLCWeightTool, CaloLCOutOfClusterTool, CaloLCDeadMaterialTool @@ -492,12 +259,7 @@ def CaloTopoClusterCfg(configFlags): from TileConditions.TileConditionsConfig import tileCondCfg result.merge(tileCondCfg(configFlags)) - #Get CaloNoiseTool - acc=CaloNoiseToolCfg(configFlags) - theCaloNoiseTool=acc.getPublicTool("CaloNoiseTool") - result.merge(acc) - - theCaloClusterSnapshot=CaloClusterSnapshot(OutputName="CaloTopoCluster",SetCrossLinks=True) + theCaloClusterSnapshot=CaloClusterSnapshot(OutputName="CaloTopoClusters",SetCrossLinks=True) # maker tools TopoMaker = CaloTopoClusterMaker("TopoMaker") @@ -516,9 +278,6 @@ def CaloTopoClusterCfg(configFlags): "TileExt0", "TileExt1", "TileExt2", "TileGap1", "TileGap2", "TileGap3", "FCAL0", "FCAL1", "FCAL2"] - TopoMaker.CaloNoiseTool=theCaloNoiseTool - TopoMaker.UseCaloNoiseTool=True - TopoMaker.UsePileUpNoise=True TopoMaker.NeighborOption = "super3D" TopoMaker.RestrictHECIWandFCalNeighbors = False TopoMaker.RestrictPSNeighbors = True @@ -567,9 +326,7 @@ def CaloTopoClusterCfg(configFlags): CaloTopoCluster=CaloClusterMaker("CaloTopoCluster") - CaloTopoCluster.ClustersOutputName="CaloTopoClusters" - if configFlags.Calo.TopoCluster.doTopoClusterLocalCalib: - CaloTopoCluster.ClustersOutputName="CaloCalTopoClusters" + CaloTopoCluster.ClustersOutputName="CaloTopoCluster" CaloTopoCluster.ClusterMakerTools = [TopoMaker, TopoSplitter] @@ -577,17 +334,20 @@ def CaloTopoClusterCfg(configFlags): BadChannelListCorr = CaloClusterBadChannelListCorr() CaloTopoCluster.ClusterCorrectionTools += [BadChannelListCorr] - CaloTopoCluster.ClusterCorrectionTools += [getTopoMoments(configFlags,theCaloNoiseTool)] + CaloTopoCluster.ClusterCorrectionTools += [getTopoMoments(configFlags)] CaloTopoCluster.ClusterCorrectionTools += [theCaloClusterSnapshot] if configFlags.Calo.TopoCluster.doTopoClusterLocalCalib: CaloTopoCluster.ClustersOutputName="CaloCalTopoClusters" - CaloTopoCluster.ClusterCorrectionTools += getTopoClusterLocalCalibTools(configFlags,theCaloNoiseTool) + CaloTopoCluster.ClusterCorrectionTools += getTopoClusterLocalCalibTools(configFlags) - result.merge(caloTopoCoolFolderCfg(configFlags)) + # Needed? + from CaloRec import CaloClusterTopoCoolFolder - return result,CaloTopoCluster + result.addEventAlgo(CaloTopoCluster,primary=True) + + return result @@ -602,17 +362,9 @@ if __name__=="__main__": #log.setLevel(DEBUG) - nThreads=1 - ConfigFlags.Concurrency.NumThreads = nThreads - if nThreads>0: - ConfigFlags.Scheduler.ShowDataDeps = True - ConfigFlags.Scheduler.ShowDataFlow = True - ConfigFlags.Scheduler.ShowControlFlow = True - ConfigFlags.Concurrency.NumConcurrentEvents = nThreads - - #ConfigFlags.Input.isMC = False - ConfigFlags.Input.Files = ConfigFlags.Input.Files = defaultTestFiles.ESD - ConfigFlags.Output.ESDFileName= "esdOut.pool.root" + ConfigFlags.Input.Files = ["myESD-data.pool.root"] + ConfigFlags.Output.ESDFileName="esdOut.pool.root" + ConfigFlags.lock() from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg @@ -620,19 +372,21 @@ if __name__=="__main__": cfg=MainServicesThreadedCfg(ConfigFlags) cfg.merge(PoolReadCfg(ConfigFlags)) + # from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg + # cfg.mergeAll(IOVDbSvcCfg(ConfigFlags)) theKey="CaloCalTopoClustersNew" - topoAcc,topoAlg=CaloTopoClusterCfg(ConfigFlags) + topoAcc=CaloTopoClusterCfg(ConfigFlags) + topoAlg = topoAcc.getPrimary() topoAlg.ClustersOutputName=theKey cfg.merge(topoAcc) - cfg.addEventAlgo(topoAlg,sequenceName="AthAlgSeq") from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg cfg.merge(OutputStreamCfg(ConfigFlags,"xAOD", ItemList=["xAOD::CaloClusterContainer#CaloCalTopoClusters*",#+theKey, - "xAOD::CaloClusterAuxContainer#*CaloCalTopoClusters*Aux.",#+theKey+"Aux.", - # "CaloClusterCellLinkContainer#"+theKey+"_links" + "xAOD::CaloClusterAuxContainer#*CaloCalTopoClusters*Aux.",#+theKey+"Aux.", + # "CaloClusterCellLinkContainer#"+theKey+"_links" ])) cfg.getEventAlgo("OutputStreamxAOD").ForceRead=True diff --git a/Calorimeter/CaloTools/python/CaloNoiseCondAlgConfig.py b/Calorimeter/CaloTools/python/CaloNoiseCondAlgConfig.py index 269ebc24ced..36d5d625d66 100644 --- a/Calorimeter/CaloTools/python/CaloNoiseCondAlgConfig.py +++ b/Calorimeter/CaloTools/python/CaloNoiseCondAlgConfig.py @@ -22,7 +22,7 @@ def CaloNoiseCondAlgCfg(configFlags,noisetype="totalNoise"): #CaloNoiseCondAlg needs Identifiers ... from AtlasGeoModel.GeoModelConfig import GeoModelCfg gms=GeoModelCfg(configFlags) - result.merge(gms[0]) + result.merge(gms) #... and cabling: from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg @@ -43,7 +43,7 @@ def CaloNoiseCondAlgCfg(configFlags,noisetype="totalNoise"): else: if useCaloLumi: lumiFolder='/CALO/Noise/PileUpNoiseLumi' - result.merge(addFolders(configFlags,lumiFolder,'CALO')) + result.merge(addFolders(configFlags,lumiFolder,'CALO',className="CondAttrListCollection")) theCaloNoiseAlg.LumiFolder = lumiFolder theCaloNoiseAlg.Luminosity = -1. log.info("online mode: use luminosity from /CALO/Noise/PileUpNoiseLumi to scale pileup noise") @@ -63,7 +63,7 @@ def CaloNoiseCondAlgCfg(configFlags,noisetype="totalNoise"): else: if useCaloLumi: lumiFolder='/CALO/Ofl/Noise/PileUpNoiseLumi' - result.merge(addFolders(configFlags,lumiFolder,'CALO_OFL')) + result.merge(addFolders(configFlags,lumiFolder,'CALO_OFL',className="CondAttrListCollection")) log.info("offline mode: use luminosity from /CALO/Ofl/Noise/PileuUpNoiseLumi to scale pileup noise") theCaloNoiseAlg.LumiFolder = lumiFolder theCaloNoiseAlg.Luminosity=-1. @@ -89,11 +89,11 @@ def CaloNoiseCondAlgCfg(configFlags,noisetype="totalNoise"): theCaloNoiseAlg.Luminosity = -1 if useCaloLumi: lumiFolder='/CALO/Ofl/Noise/PileUpNoiseLumi' - result.merge(addFolders(configFlags,lumiFolder,'CALO_OFL')) + result.merge(addFolders(configFlags,lumiFolder,'CALO_OFL',className="CondAttrListCollection")) log.info("offline mode: use luminosity from /CALO/Ofl/Noise/PileUpNoiseLumi to scale pileup noise") else: lumiFolder = '/TRIGGER/LUMI/LBLESTONL' - result.merge(addFolders(configFlags,lumiFolder,'TRIGGER_ONL')) + result.merge(addFolders(configFlags,lumiFolder,'TRIGGER_ONL',className="CondAttrListCollection")) log.info("offline mode: use luminosity = f(Lumiblock) to scale pileup noise") theCaloNoiseAlg.LumiFolder = lumiFolder @@ -138,12 +138,16 @@ if __name__ == "__main__": ConfigFlags.Input.Files = defaultTestFiles.ESD ConfigFlags.lock() - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg + acc=MainServicesThreadedCfg(ConfigFlags) +# from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - acc=PoolReadCfg(ConfigFlags) + acc.merge(PoolReadCfg(ConfigFlags)) acc.merge(CaloNoiseCondAlgCfg(ConfigFlags)) - f=open('test.pkl','w') - acc.store(f) - f.close() + acc.run(10) + + #f=open('test.pkl','w') + #acc.store(f) + #f.close() diff --git a/LArCalorimeter/LArCabling/python/LArCablingConfig.py b/LArCalorimeter/LArCabling/python/LArCablingConfig.py index da0009b95ea..62cbaf19497 100644 --- a/LArCalorimeter/LArCabling/python/LArCablingConfig.py +++ b/LArCalorimeter/LArCabling/python/LArCablingConfig.py @@ -1,12 +1,14 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from IOVDbSvc.IOVDbSvcConfig import addFolders +from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg,addFolders from LArRecUtils.LArRecUtilsConf import LArOnOffMappingAlg, LArFebRodMappingAlg, LArCalibLineMappingAlg def _larCablingCfg(configFlags,algo,folder): result=ComponentAccumulator() + result.merge(IOVDbSvcCfg(configFlags)) + #MC folder-tag hack (See also ATCONDDB-49) tagsperFolder={"/LAR/Identifier/OnOffIdMap":"LARIdentifierOnOffIdMap-012", "/LAR/Identifier/FebRodMap":"LARIdentifierFebRodMap-005", diff --git a/LArCalorimeter/LArCalibUtils/python/LArHVScaleConfig.py b/LArCalorimeter/LArCalibUtils/python/LArHVScaleConfig.py index 8dbcce76d5a..5b5387a7779 100644 --- a/LArCalorimeter/LArCalibUtils/python/LArHVScaleConfig.py +++ b/LArCalorimeter/LArCalibUtils/python/LArHVScaleConfig.py @@ -1,13 +1,22 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from IOVDbSvc.IOVDbSvcConfig import addFolders def LArHVScaleCfg(configFlags): result=ComponentAccumulator() + from IOVDbSvc.IOVDbSvcConfig import addFolders, IOVDbSvcCfg + result.merge(IOVDbSvcCfg(configFlags)) + if configFlags.Input.isMC: - result.merge(addFolders(configFlags,["/LAR/IdentifierOfl/HVLineToElectrodeMap<tag>LARHVLineToElectrodeMap-001</tag>"], "LAR_OFL", className="AthenaAttributeList")) + result.merge(addFolders(configFlags,["/LAR/Identifier/HVLineToElectrodeMap<tag>LARHVLineToElectrodeMap-001</tag>"], "LAR_OFL", className="AthenaAttributeList")) + + from LArRecUtils.LArRecUtilsConf import LArHVIdMappingAlg + hvmapalg = LArHVIdMappingAlg(ReadKey="/LAR/Identifier/HVLineToElectrodeMap",WriteKey="LArHVIdMap") + result.addCondAlgo(hvmapalg) + + # result.merge(addFolders(configFlags,["/LAR/ElecCalibMC/HVScaleCorr"],"LAR_OFL", className="AthenaAttributeList")) + elif not configFlags.Common.isOnline: result.merge(addFolders(configFlags,["/LAR/DCS/HV/BARREl/I16"], "DCS_OFL", className="CondAttrListCollection")) diff --git a/LArCalorimeter/LArRecUtils/src/LArHVCorrTool.cxx b/LArCalorimeter/LArRecUtils/src/LArHVCorrTool.cxx index 7e7a8c48d5f..3f6fcca977c 100644 --- a/LArCalorimeter/LArRecUtils/src/LArHVCorrTool.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArHVCorrTool.cxx @@ -28,11 +28,11 @@ LArHVCorrTool::LArHVCorrTool(const std::string& type, const IInterface* parent) : AthAlgTool(type, name, parent), - m_lar_on_id(nullptr), - m_calocell_id(nullptr), + m_lar_on_id(nullptr), + m_calocell_id(nullptr), m_larem_id(nullptr), m_larhec_id(nullptr), - m_larfcal_id(nullptr), + m_larfcal_id(nullptr), m_electrodeID(nullptr), m_cablingService("LArCablingLegacyService"), m_hvtool("LArHVToolMC",this) diff --git a/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h b/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h index d5787f3318a..3abb57c0e74 100644 --- a/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h +++ b/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PFONEUTRALCREATORALGORITHM_H #define PFONEUTRALCREATORALGORITHM_H @@ -29,8 +29,9 @@ public: StatusCode finalize(); private: + /** Create the chargedneutral PFO */ - void createNeutralPFO(const eflowCaloObject& energyFlowCaloObject,SG::WriteHandle<xAOD::PFOContainer>& neutralPFOContainerWriteHandle, SG::WriteHandle<xAOD::PFOContainer>& neutralPFOContainerWriteHandle_nonModified); + void createNeutralPFO(const eflowCaloObject& energyFlowCaloObject,SG::WriteHandle<xAOD::PFOContainer>& neutralPFOContainerWriteHandle, SG::WriteHandle<xAOD::PFOContainer>* neutralPFOContainerWriteHandle_nonModified); /** Function to add cluster moments onto PFO */ void addMoment(const xAOD::CaloCluster::MomentType& momentType, const xAOD::PFODetails::PFOAttributes& pfoAttribute, const xAOD::CaloCluster& theCluster, xAOD::PFO& thePFO); @@ -41,6 +42,9 @@ private: /** Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input */ Gaudi::Property<bool> m_LCMode{this,"LCMode",false,"Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input"}; + /** Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input */ + Gaudi::Property<bool> m_doClusterMoments{this,"DoClusterMoments",true,"Bool to toggle whether cluster moments are added to the PFOs"}; + /** Toggle usage of calibration hit truth - false by default */ Gaudi::Property<bool> m_useCalibHitTruth{this,"UseCalibHitTruth",false,"Toggle usage of calibration hit truth - false by default"}; diff --git a/Reconstruction/eflowRec/python/PFHLTConfig.py b/Reconstruction/eflowRec/python/PFHLTConfig.py new file mode 100644 index 00000000000..2abdde62976 --- /dev/null +++ b/Reconstruction/eflowRec/python/PFHLTConfig.py @@ -0,0 +1,294 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + + +#---------------------------------------------------------------------------------# +# Tracking geometry & conditions +def TrackingGeoCfg(inputFlags): + result = ComponentAccumulator() + + from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg + result.merge(InDetGeometryCfg(inputFlags)) + + # Something builds muon stations -- extrapolator? + from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg + result.merge(MuonGeoModelCfg(inputFlags)) + + from TrkDetDescrSvc.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg + acc, geom_svc = TrackingGeometrySvcCfg(inputFlags) + result.merge(acc) + + from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg + result.merge(MagneticFieldSvcCfg(inputFlags)) + + return result + +#---------------------------------------------------------------------------------# +# Calo geometry & conditions +def CaloGeoAndNoiseCfg(inputFlags): + result = ComponentAccumulator() + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + from TileGeoModel.TileGMConfig import TileGMCfg + + result.merge(LArGMCfg(inputFlags)) + result.merge(TileGMCfg(inputFlags)) + + from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg + # Schedule total noise cond alg + result.merge(CaloNoiseCondAlgCfg(inputFlags,"totalNoise")) + + return result + +#---------------------------------------------------------------------------------# +# PFlow track selection +def getPFTrackSelector(inputFlags,tracksin,verticesin): + + from TrkExTools.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg + extrapcfg = AtlasExtrapolatorCfg(inputFlags) + extrapolator = extrapcfg.popPrivateTools() + + from TrackToCalo.TrackToCaloConf import Trk__ParticleCaloExtensionTool + pcExtensionTool = Trk__ParticleCaloExtensionTool(Extrapolator=extrapolator) + + from eflowRec.eflowRecConf import eflowTrackCaloExtensionTool + TrackCaloExtensionTool=eflowTrackCaloExtensionTool(TrackCaloExtensionTool=pcExtensionTool) + + from eflowRec.eflowRecConf import PFTrackSelector + PFTrackSelector=PFTrackSelector("PFTrackSelector_HLT") + PFTrackSelector.electronsName = "" + PFTrackSelector.muonsName = "" + PFTrackSelector.tracksName = tracksin + PFTrackSelector.VertexContainer = verticesin + PFTrackSelector.trackExtrapolatorTool = TrackCaloExtensionTool + + from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool + TrackSelectionTool = InDet__InDetTrackSelectionTool("PFTrackSelectionTool") + + TrackSelectionTool.CutLevel = "TightPrimary" + TrackSelectionTool.minPt = 500.0 + + PFTrackSelector.trackSelectionTool = TrackSelectionTool + + return PFTrackSelector + +def getPFClusterSelectorTool(clustersin,calclustersin): + + from eflowRec.eflowRecConf import PFClusterSelectorTool + PFClusterSelectorTool = PFClusterSelectorTool("PFClusterSelectorTool") + PFClusterSelectorTool.clustersName = clustersin + PFClusterSelectorTool.calClustersName = calclustersin + + return PFClusterSelectorTool + +def getPFCellLevelSelectionTool(): + + from eflowRec.eflowRecConf import PFCellLevelSubtractionTool + PFCellLevelSubtractionTool = PFCellLevelSubtractionTool("PFCellLevelSubtractionTool") + + from eflowRec.eflowRecConf import eflowCellEOverPTool_mc12_JetETMiss + + PFCellLevelSubtractionTool.eflowCellEOverPTool = eflowCellEOverPTool_mc12_JetETMiss() + PFCellLevelSubtractionTool.nMatchesInCellLevelSubtraction = 1 + + from eflowRec.eflowRecConf import PFTrackClusterMatchingTool + MatchingTool = PFTrackClusterMatchingTool("CalObjBldMatchingTool") + MatchingTool.OutputLevel=1 + MatchingTool_Pull_02 = PFTrackClusterMatchingTool("MatchingTool_Pull_02") + MatchingTool_Pull_02.OutputLevel=1 + MatchingTool_Pull_015 = PFTrackClusterMatchingTool("MatchingTool_Pull_015") + MatchingTool_Pull_015.OutputLevel=1 + + MatchingTool_Pull_015.TrackPositionType = 'EM2EtaPhi' # str + MatchingTool_Pull_015.ClusterPositionType = 'PlainEtaPhi' # str + MatchingTool_Pull_015.DistanceType = 'EtaPhiSquareDistance' # str + MatchingTool_Pull_015.MatchCut = 0.15*0.15 # float + PFCellLevelSubtractionTool.PFTrackClusterMatchingTool_015 = MatchingTool_Pull_015 + + MatchingTool_Pull_02.TrackPositionType = 'EM2EtaPhi' # str + MatchingTool_Pull_02.ClusterPositionType = 'PlainEtaPhi' # str + MatchingTool_Pull_02.DistanceType = 'EtaPhiSquareDistance' # str + MatchingTool_Pull_02.MatchCut = 0.2*0.2 # float + PFCellLevelSubtractionTool.PFTrackClusterMatchingTool_02 = MatchingTool_Pull_02 + + PFCellLevelSubtractionTool.PFTrackClusterMatchingTool = MatchingTool + + return PFCellLevelSubtractionTool + +def getPFRecoverSplitShowersTool(): + from eflowRec.eflowRecConf import PFRecoverSplitShowersTool + PFRecoverSplitShowersTool = PFRecoverSplitShowersTool("PFRecoverSplitShowersTool") + + from eflowRec.eflowRecConf import eflowCellEOverPTool_mc12_JetETMiss + PFRecoverSplitShowersTool.eflowCellEOverPTool = eflowCellEOverPTool_mc12_JetETMiss("eflowCellEOverPTool_mc12_JetETMiss_Recover") + PFRecoverSplitShowersTool.useUpdated2015ChargedShowerSubtraction = False + + from eflowRec.eflowRecConf import PFTrackClusterMatchingTool + MatchingTool_Recover = PFTrackClusterMatchingTool() + MatchingTool_Recover.TrackPositionType = 'EM2EtaPhi' # str + MatchingTool_Recover.ClusterPositionType = 'PlainEtaPhi' # str + MatchingTool_Recover.DistanceType = 'EtaPhiSquareDistance' # str + MatchingTool_Recover.MatchCut = 0.2*0.2 # float + PFRecoverSplitShowersTool.PFTrackClusterMatchingTool = MatchingTool_Recover + + return PFRecoverSplitShowersTool + +def getPFMomentCalculatorTool(): + + from eflowRec.eflowRecConf import PFMomentCalculatorTool + PFMomentCalculatorTool = PFMomentCalculatorTool("PFMomentCalculatorTool") + + from CaloRec.CaloRecConf import CaloClusterMomentsMaker + PFClusterMomentsMaker = CaloClusterMomentsMaker("PFClusterMomentsMaker") + + from AthenaCommon.SystemOfUnits import deg + PFClusterMomentsMaker.MaxAxisAngle = 20*deg + PFClusterMomentsMaker.WeightingOfNegClusters = False + PFClusterMomentsMaker.MinBadLArQuality = 4000 + PFClusterMomentsMaker.TwoGaussianNoise = True + PFClusterMomentsMaker.MomentsNames = [ + "FIRST_PHI" + ,"FIRST_ETA" + ,"SECOND_R" + ,"SECOND_LAMBDA" + ,"DELTA_PHI" + ,"DELTA_THETA" + ,"DELTA_ALPHA" + ,"CENTER_X" + ,"CENTER_Y" + ,"CENTER_Z" + ,"CENTER_MAG" + ,"CENTER_LAMBDA" + ,"LATERAL" + ,"LONGITUDINAL" + ,"FIRST_ENG_DENS" + ,"ENG_FRAC_EM" + ,"ENG_FRAC_MAX" + ,"ENG_FRAC_CORE" + ,"FIRST_ENG_DENS" + ,"SECOND_ENG_DENS" + ,"ISOLATION" + ,"EM_PROBABILITY" + ,"ENG_POS" + ,"ENG_BAD_CELLS" + ,"N_BAD_CELLS" + ,"BADLARQ_FRAC" + ,"AVG_LAR_Q" + ,"AVG_TILE_Q" + ,"SIGNIFICANCE" + ] + + PFMomentCalculatorTool.CaloClusterMomentsMaker = PFClusterMomentsMaker + + from eflowRec.eflowRecConf import PFClusterCollectionTool + PFClusterCollectionTool_default = PFClusterCollectionTool("PFClusterCollectionTool") + + PFMomentCalculatorTool.PFClusterCollectionTool = PFClusterCollectionTool_default + + return PFMomentCalculatorTool + +def PFCfg(inputFlags): + + result=ComponentAccumulator() + + result.merge(TrackingGeoCfg(inputFlags)) + calogeocfg = CaloGeoAndNoiseCfg(inputFlags) + result.merge(calogeocfg) + + result.addEventAlgo( getPFTrackSelector(inputFlags, + inputFlags.eflowRec.TrackColl, + inputFlags.eflowRec.VertexColl) ) + + #---------------------------------------------------------------------------------# + # PFlowAlgorithm -- subtraction steps + + from eflowRec.eflowRecConf import PFAlgorithm + PFAlgorithm = PFAlgorithm("PFAlgorithm_HLT") + PFAlgorithm.PFClusterSelectorTool = getPFClusterSelectorTool(inputFlags.eflowRec.RawClusterColl, + inputFlags.eflowRec.CalClusterColl) + + PFAlgorithm.SubtractionToolList = [ + getPFCellLevelSelectionTool(), + getPFRecoverSplitShowersTool(), + ] + + pfmoments = getPFMomentCalculatorTool() + if not inputFlags.eflowRec.DoClusterMoments: + pfmoments.CaloClusterMomentsMaker.MomentsNames = ["CENTER_MAG"] + PFAlgorithm.BaseToolList = [pfmoments] + + result.addEventAlgo(PFAlgorithm) + + #---------------------------------------------------------------------------------# + # PFO creators here + + from eflowRec.eflowRecConf import PFOChargedCreatorAlgorithm + PFOChargedCreatorAlgorithm = PFOChargedCreatorAlgorithm("PFOChargedCreatorAlgorithm") + PFOChargedCreatorAlgorithm.PFOOutputName="HLTChargedParticleFlowObjects" + + result.addEventAlgo( PFOChargedCreatorAlgorithm ) + + from eflowRec.eflowRecConf import PFONeutralCreatorAlgorithm + PFONeutralCreatorAlgorithm = PFONeutralCreatorAlgorithm("PFONeutralCreatorAlgorithm") + PFONeutralCreatorAlgorithm.PFOOutputName="HLTNeutralParticleFlowObjects" + PFONeutralCreatorAlgorithm.DoClusterMoments=inputFlags.eflowRec.DoClusterMoments + + result.addEventAlgo( PFONeutralCreatorAlgorithm ) + + return result + +if __name__=="__main__": + + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = True + + from AthenaConfiguration.AllConfigFlags import ConfigFlags as cfgFlags + + #cfgFlags.Input.Files=["myESD.pool.root"] + cfgFlags.Input.Files=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc16_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.recon.ESD.e3668_s3170_r10572_homeMade.pool.root"] + # + cfgFlags.Calo.TopoCluster.doTopoClusterLocalCalib = False + # + cfgFlags.addFlag("eflowRec.TrackColl","InDetTrackParticles") + cfgFlags.addFlag("eflowRec.VertexColl","PrimaryVertices") + cfgFlags.addFlag("eflowRec.RawClusterColl","CaloTopoClusters") + cfgFlags.addFlag("eflowRec.CalClusterColl","CaloCalTopoClustersNew") + cfgFlags.addFlag("eflowRec.DoClusterMoments",False) + # + # Try to get around TRT alignment folder problem in MC + cfgFlags.GeoModel.Align.Dynamic = False + # + cfgFlags.lock() + + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg + cfg=MainServicesSerialCfg() + + from CaloRec.CaloTopoClusterConfig import CaloTopoClusterCfg + tccfg = CaloTopoClusterCfg(cfgFlags) + tcalg = tccfg.getPrimary() + tcalg.ClustersOutputName = "CaloCalTopoClustersNew" + cfg.merge(tccfg) + cfg.addEventAlgo(tcalg,sequenceName="AthAlgSeq") + + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + cfg.merge(PoolReadCfg(cfgFlags)) + + cfg.merge(PFCfg(cfgFlags)) + + cfg.printConfig(summariseProps=True) + + outputlist = [ + "xAOD::CaloClusterContainer#CaloCalTopoClusters*", + "xAOD::CaloClusterAuxContainer#*CaloCalTopoClusters*Aux.", + "xAOD::PFOContainer#*ParticleFlowObjects", + "xAOD::PFOAuxContainer#*ParticleFlowObjectsAux." + ] + from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + cfg.merge(OutputStreamCfg(cfgFlags,"xAOD",ItemList=outputlist)) + cfg.getEventAlgo("OutputStreamxAOD").ForceRead = True + from pprint import pprint + pprint( cfg.getEventAlgo("OutputStreamxAOD").ItemList ) + + + cfg.getService("StoreGateSvc").Dump = True + + cfg.run(10) diff --git a/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx b/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx index 5ebef3d1a3f..ac7e5ae7750 100644 --- a/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx +++ b/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "eflowRec/PFCellLevelSubtractionTool.h" @@ -315,9 +315,9 @@ void PFCellLevelSubtractionTool::performSubtraction() { for (unsigned int iEFCalOb = 0; iEFCalOb < nEFCaloObs; ++iEFCalOb) { eflowCaloObject* thisEflowCaloObject = m_eflowCaloObjectContainer->at(iEFCalOb); - ATH_MSG_DEBUG("Have got an eflowCaloObject"); - unsigned int nClusters = thisEflowCaloObject->nClusters(); + ATH_MSG_DEBUG("Have got an eflowCaloObject with " << nClusters << " clusters"); + if (nClusters < 1) { continue; } diff --git a/Reconstruction/eflowRec/src/PFClusterSelectorTool.cxx b/Reconstruction/eflowRec/src/PFClusterSelectorTool.cxx index 43ca5956000..e5311998bbc 100644 --- a/Reconstruction/eflowRec/src/PFClusterSelectorTool.cxx +++ b/Reconstruction/eflowRec/src/PFClusterSelectorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloIdentifier/CaloCell_ID.h" @@ -16,7 +16,9 @@ PFClusterSelectorTool::PFClusterSelectorTool(const std::string& type,const std:: StatusCode PFClusterSelectorTool::initialize(){ ATH_CHECK(m_caloClustersReadHandleKey.initialize()); - ATH_CHECK(m_caloCalClustersReadHandleKey.initialize()); + if(!m_caloCalClustersReadHandleKey.key().empty()) { + ATH_CHECK(m_caloCalClustersReadHandleKey.initialize()); + } return StatusCode::SUCCESS; } @@ -31,7 +33,11 @@ StatusCode PFClusterSelectorTool::execute(eflowRecClusterContainer& theEFlowRecC return StatusCode::SUCCESS; } - SG::ReadHandle<xAOD::CaloClusterContainer> caloCalClustersReadHandle(m_caloCalClustersReadHandleKey); + const xAOD::CaloClusterContainer* calclusters = nullptr; + if (!m_caloCalClustersReadHandleKey.key().empty()) { + SG::ReadHandle<xAOD::CaloClusterContainer> caloCalClustersReadHandle(m_caloCalClustersReadHandleKey); + calclusters = caloCalClustersReadHandle.get(); + } /* Fill the vector of eflowRecClusters */ unsigned int nClusters = caloClustersReadHandle->size(); @@ -39,9 +45,9 @@ StatusCode PFClusterSelectorTool::execute(eflowRecClusterContainer& theEFlowRecC /* Create the eflowRecCluster and put it in the container */ std::unique_ptr<eflowRecCluster> thisEFRecCluster = std::make_unique<eflowRecCluster>(ElementLink<xAOD::CaloClusterContainer>(*caloClustersReadHandle, iCluster), theCaloClusterContainer); - if (caloCalClustersReadHandle.isValid()){ + if (calclusters){ std::map<IdentifierHash,double> cellsWeightMap; - retrieveLCCalCellWeight(caloClustersReadHandle->at(iCluster)->e(), iCluster, cellsWeightMap, *caloCalClustersReadHandle); + retrieveLCCalCellWeight(caloClustersReadHandle->at(iCluster)->e(), iCluster, cellsWeightMap, *calclusters); if (msgLvl(MSG::DEBUG)) { //zhangr diff --git a/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx index 453c1103ed7..2893e4bb31d 100644 --- a/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx +++ b/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "eflowRec/PFONeutralCreatorAlgorithm.h" @@ -11,7 +11,7 @@ #include "xAODPFlow/PFOAuxContainer.h" PFONeutralCreatorAlgorithm::PFONeutralCreatorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) + AthAlgorithm(name, pSvcLocator) { } @@ -19,7 +19,9 @@ StatusCode PFONeutralCreatorAlgorithm::initialize(){ ATH_CHECK(m_eflowCaloObjectContainerReadHandleKey.initialize()); ATH_CHECK(m_neutralPFOContainerWriteHandleKey.initialize()); - ATH_CHECK(m_neutralPFOContainerWriteHandleKey_nonModified.initialize()); + if(!m_LCMode) { + ATH_CHECK(m_neutralPFOContainerWriteHandleKey_nonModified.initialize()); + } return StatusCode::SUCCESS; } @@ -30,22 +32,27 @@ StatusCode PFONeutralCreatorAlgorithm::execute(){ SG::WriteHandle<xAOD::PFOContainer> neutralPFOContainerWriteHandle(m_neutralPFOContainerWriteHandleKey); ATH_CHECK(neutralPFOContainerWriteHandle.record(std::make_unique<xAOD::PFOContainer>(),std::make_unique<xAOD::PFOAuxContainer>())); - SG::WriteHandle<xAOD::PFOContainer> neutralPFOContainerWriteHandle_nonModified(m_neutralPFOContainerWriteHandleKey_nonModified); - if (m_LCMode) ATH_CHECK(neutralPFOContainerWriteHandle_nonModified.record(std::make_unique<xAOD::PFOContainer>(),std::make_unique<xAOD::PFOAuxContainer>())); - + std::unique_ptr<SG::WriteHandle<xAOD::PFOContainer> > p_neutralPFOContainerWriteHandle_nonModified(nullptr); + if (m_LCMode) { + p_neutralPFOContainerWriteHandle_nonModified = std::make_unique<SG::WriteHandle<xAOD::PFOContainer> >(m_neutralPFOContainerWriteHandleKey_nonModified); + ATH_CHECK(p_neutralPFOContainerWriteHandle_nonModified->record(std::make_unique<xAOD::PFOContainer>(),std::make_unique<xAOD::PFOAuxContainer>())); + } + /* Create Neutral PFOs from all eflowCaloObjects */ SG::ReadHandle<eflowCaloObjectContainer> eflowCaloObjectContainerReadHandle(m_eflowCaloObjectContainerReadHandleKey); - for (auto thisEflowCaloObject : *eflowCaloObjectContainerReadHandle) createNeutralPFO(*thisEflowCaloObject, neutralPFOContainerWriteHandle, neutralPFOContainerWriteHandle_nonModified); + ATH_MSG_DEBUG("Looping over eflowCaloObjects"); + for (auto thisEflowCaloObject : *eflowCaloObjectContainerReadHandle) createNeutralPFO(*thisEflowCaloObject, neutralPFOContainerWriteHandle, p_neutralPFOContainerWriteHandle_nonModified.get()); return StatusCode::SUCCESS; } StatusCode PFONeutralCreatorAlgorithm::finalize(){ return StatusCode::SUCCESS; } -void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyFlowCaloObject,SG::WriteHandle<xAOD::PFOContainer>& neutralPFOContainerWriteHandle, SG::WriteHandle<xAOD::PFOContainer>& neutralPFOContainerWriteHandle_nonModified){ +void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyFlowCaloObject,SG::WriteHandle<xAOD::PFOContainer>& neutralPFOContainerWriteHandle, SG::WriteHandle<xAOD::PFOContainer>* neutralPFOContainerWriteHandle_nonModified){ unsigned int nClusters = energyFlowCaloObject.nClusters(); + ATH_MSG_VERBOSE(" eflowCaloObject with " << nClusters << " clusters"); for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster){ eflowRecCluster* thisEfRecCluster = energyFlowCaloObject.efRecCluster(iCluster); @@ -61,23 +68,29 @@ void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyF /* Create the efo, add the cluster and set the four-momentum, charge and type */ + ATH_MSG_VERBOSE(" Creating PFO"); xAOD::PFO* thisPFO = new xAOD::PFO(); if (m_LCMode) { if (thisEfRecCluster->isTouchable()) { neutralPFOContainerWriteHandle->push_back(thisPFO); } else { - neutralPFOContainerWriteHandle_nonModified->push_back(thisPFO); + (*neutralPFOContainerWriteHandle_nonModified)->push_back(thisPFO); } } else { neutralPFOContainerWriteHandle->push_back(thisPFO); } + ATH_MSG_VERBOSE(" Get original cluster link"); ElementLink<xAOD::CaloClusterContainer> theOriginalClusterLink = thisEfRecCluster->getOriginalClusElementLink(); + ATH_MSG_VERBOSE(" Get sister cluster link"); ElementLink<xAOD::CaloClusterContainer> theSisterClusterLink = (*theOriginalClusterLink)->getSisterClusterLink(); bool isSet = thisPFO->setClusterLink(theSisterClusterLink); if (!isSet) { msg(MSG::WARNING) << "Could not set Cluster in PFO " << endmsg; } + ATH_MSG_VERBOSE(" Sucessfully set cluster link"); + const xAOD::CaloCluster* cluster = thisEfRecCluster->getCluster(); + ATH_MSG_VERBOSE(" Got CaloCluster from EfRecCluster"); //be careful here - cluster p4 methods do not store sign. Thus -ve energy clusters have +ve pt and hence +ve energy if (!m_LCMode) { //in EM->EM/LC mode we use eta,phi at EM scale for both 4-vectors @@ -106,155 +119,157 @@ void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyF bool isRetrieved = cluster->retrieveMoment(xAOD::CaloCluster::CENTER_MAG, center_mag ); if (true == isRetrieved) thisPFO->setCenterMag(center_mag); else ATH_MSG_WARNING("Could not retreve CENTER_MAG from xAOD::CaloCluster"); + + if(m_doClusterMoments) { - //now set the moments for touchable clusters (i.e. ones we modify) in LC mode or all clusters in EM mode - if ( (m_LCMode && thisEfRecCluster->isTouchable()) || !m_LCMode) { - this->addMoment(xAOD::CaloCluster::SECOND_R,xAOD::PFODetails::PFOAttributes::eflowRec_SECOND_R,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::CENTER_LAMBDA,xAOD::PFODetails::PFOAttributes::eflowRec_CENTER_LAMBDA,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::ENG_BAD_CELLS,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_BAD_CELLS,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::N_BAD_CELLS,xAOD::PFODetails::PFOAttributes::eflowRec_N_BAD_CELLS,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::BADLARQ_FRAC,xAOD::PFODetails::PFOAttributes::eflowRec_BADLARQ_FRAC,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::ENG_POS,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_POS,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::AVG_LAR_Q,xAOD::PFODetails::PFOAttributes::eflowRec_AVG_LAR_Q,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::AVG_TILE_Q,xAOD::PFODetails::PFOAttributes::eflowRec_AVG_TILE_Q,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::ISOLATION,xAOD::PFODetails::PFOAttributes::eflowRec_ISOLATION,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::SECOND_LAMBDA,xAOD::PFODetails::PFOAttributes::eflowRec_SECOND_LAMBDA,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::EM_PROBABILITY,xAOD::PFODetails::PFOAttributes::eflowRec_EM_PROBABILITY,*cluster, *thisPFO); - if (m_useCalibHitTruth){ - this->addMoment(xAOD::CaloCluster::ENG_CALIB_TOT,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_TOT,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_EM,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_EM,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_HAD,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_HAD,*cluster, *thisPFO); - this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_REST,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_REST,*cluster, *thisPFO); + //now set the moments for touchable clusters (i.e. ones we modify) in LC mode or all clusters in EM mode + if ( (m_LCMode && thisEfRecCluster->isTouchable()) || !m_LCMode) { + this->addMoment(xAOD::CaloCluster::SECOND_R,xAOD::PFODetails::PFOAttributes::eflowRec_SECOND_R,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::CENTER_LAMBDA,xAOD::PFODetails::PFOAttributes::eflowRec_CENTER_LAMBDA,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ENG_BAD_CELLS,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_BAD_CELLS,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::N_BAD_CELLS,xAOD::PFODetails::PFOAttributes::eflowRec_N_BAD_CELLS,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::BADLARQ_FRAC,xAOD::PFODetails::PFOAttributes::eflowRec_BADLARQ_FRAC,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ENG_POS,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_POS,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::AVG_LAR_Q,xAOD::PFODetails::PFOAttributes::eflowRec_AVG_LAR_Q,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::AVG_TILE_Q,xAOD::PFODetails::PFOAttributes::eflowRec_AVG_TILE_Q,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ISOLATION,xAOD::PFODetails::PFOAttributes::eflowRec_ISOLATION,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::SECOND_LAMBDA,xAOD::PFODetails::PFOAttributes::eflowRec_SECOND_LAMBDA,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::EM_PROBABILITY,xAOD::PFODetails::PFOAttributes::eflowRec_EM_PROBABILITY,*cluster, *thisPFO); + if (m_useCalibHitTruth){ + this->addMoment(xAOD::CaloCluster::ENG_CALIB_TOT,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_TOT,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_EM,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_EM,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_HAD,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_HAD,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_REST,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_REST,*cluster, *thisPFO); + } } - } - //First set all the layer energies - float layerEnergy_preSamplerB = cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerB); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_PreSamplerB = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_PreSamplerB; - thisPFO->setAttribute( myAttribute_layerEnergy_PreSamplerB, layerEnergy_preSamplerB); + //First set all the layer energies + float layerEnergy_preSamplerB = cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerB); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_PreSamplerB = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_PreSamplerB; + thisPFO->setAttribute( myAttribute_layerEnergy_PreSamplerB, layerEnergy_preSamplerB); - float layerEnergy_EMB1 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB1); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB1; - thisPFO->setAttribute( myAttribute_layerEnergy_EMB1, layerEnergy_EMB1); + float layerEnergy_EMB1 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB1); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB1; + thisPFO->setAttribute( myAttribute_layerEnergy_EMB1, layerEnergy_EMB1); - float layerEnergy_EMB2 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB2); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB2; - thisPFO->setAttribute( myAttribute_layerEnergy_EMB2, layerEnergy_EMB2); + float layerEnergy_EMB2 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB2); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB2; + thisPFO->setAttribute( myAttribute_layerEnergy_EMB2, layerEnergy_EMB2); - float layerEnergy_EMB3 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB3); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB3; - thisPFO->setAttribute( myAttribute_layerEnergy_EMB3, layerEnergy_EMB3); + float layerEnergy_EMB3 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB3); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB3; + thisPFO->setAttribute( myAttribute_layerEnergy_EMB3, layerEnergy_EMB3); - float layerEnergy_preSamplerE = cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerE); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_PreSamplerE = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_PreSamplerE; - thisPFO->setAttribute( myAttribute_layerEnergy_PreSamplerE, layerEnergy_preSamplerE); + float layerEnergy_preSamplerE = cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerE); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_PreSamplerE = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_PreSamplerE; + thisPFO->setAttribute( myAttribute_layerEnergy_PreSamplerE, layerEnergy_preSamplerE); - float layerEnergy_EME1 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME1); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME1; - thisPFO->setAttribute( myAttribute_layerEnergy_EME1, layerEnergy_EME1); + float layerEnergy_EME1 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME1); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME1; + thisPFO->setAttribute( myAttribute_layerEnergy_EME1, layerEnergy_EME1); - float layerEnergy_EME2 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME2); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME2; - thisPFO->setAttribute( myAttribute_layerEnergy_EME2, layerEnergy_EME2); + float layerEnergy_EME2 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME2); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME2; + thisPFO->setAttribute( myAttribute_layerEnergy_EME2, layerEnergy_EME2); - float layerEnergy_EME3 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME3); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME3; - thisPFO->setAttribute( myAttribute_layerEnergy_EME3, layerEnergy_EME3); + float layerEnergy_EME3 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME3); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME3; + thisPFO->setAttribute( myAttribute_layerEnergy_EME3, layerEnergy_EME3); - float layerEnergy_HEC0 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC0); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC0; - thisPFO->setAttribute( myAttribute_layerEnergy_HEC0, layerEnergy_HEC0); + float layerEnergy_HEC0 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC0); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC0; + thisPFO->setAttribute( myAttribute_layerEnergy_HEC0, layerEnergy_HEC0); - float layerEnergy_HEC1 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC1); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC1; - thisPFO->setAttribute( myAttribute_layerEnergy_HEC1, layerEnergy_HEC1); + float layerEnergy_HEC1 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC1); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC1; + thisPFO->setAttribute( myAttribute_layerEnergy_HEC1, layerEnergy_HEC1); - float layerEnergy_HEC2 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC2); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC2; - thisPFO->setAttribute( myAttribute_layerEnergy_HEC2, layerEnergy_HEC2); + float layerEnergy_HEC2 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC2); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC2; + thisPFO->setAttribute( myAttribute_layerEnergy_HEC2, layerEnergy_HEC2); - float layerEnergy_HEC3 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC3); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC3; - thisPFO->setAttribute( myAttribute_layerEnergy_HEC3, layerEnergy_HEC3); + float layerEnergy_HEC3 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC3); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC3; + thisPFO->setAttribute( myAttribute_layerEnergy_HEC3, layerEnergy_HEC3); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar0; - thisPFO->setAttribute( myAttribute_layerEnergy_TileBar0, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar0)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar0; + thisPFO->setAttribute( myAttribute_layerEnergy_TileBar0, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar0)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar1; - thisPFO->setAttribute( myAttribute_layerEnergy_TileBar1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar1)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar1; + thisPFO->setAttribute( myAttribute_layerEnergy_TileBar1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar1)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar2; - thisPFO->setAttribute( myAttribute_layerEnergy_TileBar2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar2)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar2; + thisPFO->setAttribute( myAttribute_layerEnergy_TileBar2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar2)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap1; - thisPFO->setAttribute( myAttribute_layerEnergy_TileGap1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap1)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap1; + thisPFO->setAttribute( myAttribute_layerEnergy_TileGap1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap1)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap2; - thisPFO->setAttribute( myAttribute_layerEnergy_TileGap2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap2)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap2; + thisPFO->setAttribute( myAttribute_layerEnergy_TileGap2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap2)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap3; - thisPFO->setAttribute( myAttribute_layerEnergy_TileGap3, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap3)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap3; + thisPFO->setAttribute( myAttribute_layerEnergy_TileGap3, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap3)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt0; - thisPFO->setAttribute( myAttribute_layerEnergy_TileExt0, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt0)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt0; + thisPFO->setAttribute( myAttribute_layerEnergy_TileExt0, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt0)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt1; - thisPFO->setAttribute( myAttribute_layerEnergy_TileExt1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt1)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt1; + thisPFO->setAttribute( myAttribute_layerEnergy_TileExt1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt1)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt2; - thisPFO->setAttribute( myAttribute_layerEnergy_TileExt2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt2)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt2; + thisPFO->setAttribute( myAttribute_layerEnergy_TileExt2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt2)); - float layerEnergy_FCAL0 = cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL0); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL0; - thisPFO->setAttribute( myAttribute_layerEnergy_FCAL0, layerEnergy_FCAL0); + float layerEnergy_FCAL0 = cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL0); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL0; + thisPFO->setAttribute( myAttribute_layerEnergy_FCAL0, layerEnergy_FCAL0); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL1; - thisPFO->setAttribute( myAttribute_layerEnergy_FCAL1, cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL1)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL1; + thisPFO->setAttribute( myAttribute_layerEnergy_FCAL1, cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL1)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL2; - thisPFO->setAttribute( myAttribute_layerEnergy_FCAL2, cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL2)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL2; + thisPFO->setAttribute( myAttribute_layerEnergy_FCAL2, cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL2)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL0; - thisPFO->setAttribute( myAttribute_layerEnergy_MINIFCAL0, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL0)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL0; + thisPFO->setAttribute( myAttribute_layerEnergy_MINIFCAL0, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL0)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL1; - thisPFO->setAttribute( myAttribute_layerEnergy_MINIFCAL1, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL1)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL1; + thisPFO->setAttribute( myAttribute_layerEnergy_MINIFCAL1, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL1)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL2; - thisPFO->setAttribute( myAttribute_layerEnergy_MINIFCAL2, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL2)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL2; + thisPFO->setAttribute( myAttribute_layerEnergy_MINIFCAL2, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL2)); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL3; - thisPFO->setAttribute( myAttribute_layerEnergy_MINIFCAL3, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL3)); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL3; + thisPFO->setAttribute( myAttribute_layerEnergy_MINIFCAL3, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL3)); - //now set the layer energies for EMB3 and Tile0 - these are needed if we want to run a GSC style jet calibration, which is binned in EMB3 and Tile0 layer energies + //now set the layer energies for EMB3 and Tile0 - these are needed if we want to run a GSC style jet calibration, which is binned in EMB3 and Tile0 layer energies - float layerEnergy_EM3 = layerEnergy_EMB3 + layerEnergy_EME3; + float layerEnergy_EM3 = layerEnergy_EMB3 + layerEnergy_EME3; - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EM3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EM3; - thisPFO->setAttribute( myAttribute_layerEnergy_EM3, layerEnergy_EM3); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EM3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EM3; + thisPFO->setAttribute( myAttribute_layerEnergy_EM3, layerEnergy_EM3); - float layerEnergy_TileBar0 = cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar0); - float layerEnergy_TileExt0 = cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt0); - float layerEnergy_Tile0 = layerEnergy_TileBar0 + layerEnergy_TileExt0; + float layerEnergy_TileBar0 = cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar0); + float layerEnergy_TileExt0 = cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt0); + float layerEnergy_Tile0 = layerEnergy_TileBar0 + layerEnergy_TileExt0; - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_Tile0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_Tile0; - thisPFO->setAttribute(myAttribute_layerEnergy_Tile0, layerEnergy_Tile0); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_Tile0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_Tile0; + thisPFO->setAttribute(myAttribute_layerEnergy_Tile0, layerEnergy_Tile0); - //now set properties that are required for jet cleaning - float layerEnergy_HEC = layerEnergy_HEC0 + layerEnergy_HEC1 + layerEnergy_HEC2 + layerEnergy_HEC3; + //now set properties that are required for jet cleaning + float layerEnergy_HEC = layerEnergy_HEC0 + layerEnergy_HEC1 + layerEnergy_HEC2 + layerEnergy_HEC3; - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC; - thisPFO->setAttribute(myAttribute_layerEnergy_HEC, layerEnergy_HEC); + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC; + thisPFO->setAttribute(myAttribute_layerEnergy_HEC, layerEnergy_HEC); - float layerEnergy_EM = layerEnergy_preSamplerB + layerEnergy_preSamplerE + layerEnergy_EMB1 + layerEnergy_EMB2 + layerEnergy_EMB3 + layerEnergy_EME1 + layerEnergy_EME2 + layerEnergy_EME3 + layerEnergy_FCAL0; - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EM = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EM; - thisPFO->setAttribute(myAttribute_layerEnergy_EM, layerEnergy_EM); + float layerEnergy_EM = layerEnergy_preSamplerB + layerEnergy_preSamplerE + layerEnergy_EMB1 + layerEnergy_EMB2 + layerEnergy_EMB3 + layerEnergy_EME1 + layerEnergy_EME2 + layerEnergy_EME3 + layerEnergy_FCAL0; + xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EM = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EM; + thisPFO->setAttribute(myAttribute_layerEnergy_EM, layerEnergy_EM); - float clusterTiming = cluster->time(); - - xAOD::PFODetails::PFOAttributes myAttribute_TIMING = xAOD::PFODetails::PFOAttributes::eflowRec_TIMING; - thisPFO->setAttribute(myAttribute_TIMING, clusterTiming); + float clusterTiming = cluster->time(); + xAOD::PFODetails::PFOAttributes myAttribute_TIMING = xAOD::PFODetails::PFOAttributes::eflowRec_TIMING; + thisPFO->setAttribute(myAttribute_TIMING, clusterTiming); + } } } diff --git a/Reconstruction/eflowRec/src/PFTrackSelector.cxx b/Reconstruction/eflowRec/src/PFTrackSelector.cxx index 6b56d5e71c4..3be98df5c93 100644 --- a/Reconstruction/eflowRec/src/PFTrackSelector.cxx +++ b/Reconstruction/eflowRec/src/PFTrackSelector.cxx @@ -18,11 +18,17 @@ StatusCode PFTrackSelector::initialize(){ ATH_CHECK(m_trackSelectorTool.retrieve()); ATH_CHECK(m_tracksReadHandleKey.initialize()); - ATH_CHECK(m_electronsReadHandleKey.initialize()); - ATH_CHECK(m_muonsReadHandleKey.initialize()); ATH_CHECK(m_vertexKey.initialize()); ATH_CHECK(m_SCTDetEleCollKey.initialize()); + // Optional readhandlekeys for electrons and muons + if(!m_electronsReadHandleKey.key().empty()) { + ATH_CHECK(m_electronsReadHandleKey.initialize()); + } + if(!m_muonsReadHandleKey.key().empty()) { + ATH_CHECK(m_muonsReadHandleKey.initialize()); + } + ATH_CHECK(m_eflowRecTracksWriteHandleKey.initialize()); return StatusCode::SUCCESS; @@ -85,6 +91,8 @@ bool PFTrackSelector::selectTrack(const xAOD::TrackParticle& track) { bool PFTrackSelector::isElectron(const xAOD::TrackParticle* track){ + if(m_electronsReadHandleKey.key().empty()) return false; + SG::ReadHandle<xAOD::ElectronContainer> electronsReadHandle(m_electronsReadHandleKey); if (electronsReadHandle.isValid()){ @@ -115,6 +123,8 @@ bool PFTrackSelector::isElectron(const xAOD::TrackParticle* track){ bool PFTrackSelector::isMuon(const xAOD::TrackParticle* track){ + if(m_muonsReadHandleKey.key().empty()) return false; + SG::ReadHandle<xAOD::MuonContainer> muonsReadHandle(m_muonsReadHandleKey); if (muonsReadHandle.isValid()){ diff --git a/TileCalorimeter/TileConditions/python/TileConditionsConfig.py b/TileCalorimeter/TileConditions/python/TileConditionsConfig.py index 4bef89893d9..ea1c03d195c 100644 --- a/TileCalorimeter/TileConditions/python/TileConditionsConfig.py +++ b/TileCalorimeter/TileConditions/python/TileConditionsConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator def tileCondCfg( flags ): @@ -19,30 +19,29 @@ def tileCondCfg( flags ): emScale = 'TileEMScale' from TileConditions.TileConditionsConf import TileEMScaleCondAlg emScaleCondAlg = TileEMScaleCondAlg(name = emScale + 'CondAlg', TileEMScale = emScale) - emScaleCondAlg.OnlCacheUnit = 'OnlineMegaElectronVolts' - emScaleCondAlg.OflCesProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflCes', Source = '/TILE/OFL02/CALIB/CES') - emScaleCondAlg.OflCisLinProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflCisLin', Source = '/TILE/OFL02/CALIB/CIS/LIN') - emScaleCondAlg.OflCisNlnProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflCisNln', Source = '/TILE/OFL02/CALIB/CIS/NLN') - emScaleCondAlg.OflEmsProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflEms', Source = '/TILE/OFL02/CALIB/EMS') - emScaleCondAlg.OflLasFibProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflLasFib', Source = '/TILE/OFL02/CALIB/LAS/FIBER') - emScaleCondAlg.OflLasLinProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflLasLin', Source = '/TILE/OFL02/CALIB/LAS/LIN') - emScaleCondAlg.OflLasNlnProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflLasNln', Source = '/TILE/OFL02/CALIB/LAS/NLN') - emScaleCondAlg.OnlCesProxy = TileCondProxyCoolFlt('TileCondProxyCool_OnlCes', Source = '/TILE/ONL01/CALIB/CES') - emScaleCondAlg.OnlCisProxy = TileCondProxyCoolFlt('TileCondProxyCool_OnlCis', Source = '/TILE/ONL01/CALIB/CIS/LIN') - emScaleCondAlg.OnlEmsProxy = TileCondProxyCoolFlt('TileCondProxyCool_OnlEms', Source = '/TILE/ONL01/CALIB/EMS') - emScaleCondAlg.OnlLasProxy = TileCondProxyCoolFlt('TileCondProxyCool_OnlLas', Source = '/TILE/ONL01/CALIB/LAS/LIN') - - __addFolder( '/TILE/OFL02/CALIB/CES') - __addFolder( '/TILE/OFL02/CALIB/CIS/LIN') - __addFolder( '/TILE/OFL02/CALIB/CIS/NLN') - __addFolder( '/TILE/OFL02/CALIB/EMS') - __addFolder( '/TILE/OFL02/CALIB/LAS/FIBER') - __addFolder( '/TILE/OFL02/CALIB/LAS/LIN') - __addFolder( '/TILE/OFL02/CALIB/LAS/NLN') - __addFolder( '/TILE/ONL01/CALIB/CES') - __addFolder( '/TILE/ONL01/CALIB/CIS/LIN') - __addFolder( '/TILE/ONL01/CALIB/EMS') - __addFolder( '/TILE/ONL01/CALIB/LAS/LIN') + + # Defaults for offline data + folder_OFL_CALIB_CIS = "CALIB/CIS/" + emScaleCondAlg.OnlCacheUnit = 'OnlineMegaElectronVolts' + if flags.Input.isMC: + folder_OFL_CALIB_CIS = "CALIB/CIS/FIT/" + emScaleCondAlg.OnlCacheUnit = 'Invalid' + + def getTileCondProxyCoolFlt(name, folder): + __addFolder(folder) + return TileCondProxyCoolFlt(name, Source=folder) + + emScaleCondAlg.OflCesProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OflCes', '/TILE/OFL02/CALIB/CES') + emScaleCondAlg.OflCisLinProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OflCisLin', '/TILE/OFL02/'+folder_OFL_CALIB_CIS+'LIN') + emScaleCondAlg.OflCisNlnProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OflCisNln', '/TILE/OFL02/'+folder_OFL_CALIB_CIS+'NLN') + emScaleCondAlg.OflEmsProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OflEms', '/TILE/OFL02/CALIB/EMS') + emScaleCondAlg.OflLasFibProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OflLasFib', '/TILE/OFL02/CALIB/LAS/FIBER') + emScaleCondAlg.OflLasLinProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OflLasLin', '/TILE/OFL02/CALIB/LAS/LIN') + emScaleCondAlg.OflLasNlnProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OflLasNln', '/TILE/OFL02/CALIB/LAS/NLN') + emScaleCondAlg.OnlCesProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OnlCes', '/TILE/ONL01/CALIB/CES') + emScaleCondAlg.OnlCisProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OnlCis', '/TILE/ONL01/CALIB/CIS/LIN') + emScaleCondAlg.OnlEmsProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OnlEms', '/TILE/ONL01/CALIB/EMS') + emScaleCondAlg.OnlLasProxy = getTileCondProxyCoolFlt('TileCondProxyCool_OnlLas', '/TILE/ONL01/CALIB/LAS/LIN') acc.addCondAlgo( emScaleCondAlg ) @@ -59,44 +58,54 @@ def tileCondCfg( flags ): sampleNoise = 'TileSampleNoise' - sampleNoiseProxy = TileCondProxyCoolFlt( 'TileCondProxyCool_NoiseSample', Source = '/TILE/OFL02/NOISE/SAMPLE' ) - __addFolder( '/TILE/OFL02/NOISE/SAMPLE' ) + sampleNoiseProxy = getTileCondProxyCoolFlt( 'TileCondProxyCool_NoiseSample', '/TILE/OFL02/NOISE/SAMPLE' ) __addCondAlg(sampleNoise, sampleNoiseProxy) - onlineSampleNoise = 'TileOnlineSampleNoise' - onlineSampleNoiseProxy = TileCondProxyCoolFlt( 'TileCondProxyCool_OnlineNoiseSample', Source = '/TILE/ONL01/NOISE/SAMPLE' ) - __addFolder( '/TILE/ONL01/NOISE/SAMPLE' ) - __addCondAlg(onlineSampleNoise, onlineSampleNoiseProxy) - from TileConditions.TileConditionsConf import TileCondToolNoiseSample noiseSampleTool = TileCondToolNoiseSample(name = 'TileCondToolNoiseSample', - TileSampleNoise = sampleNoise, - TileOnlineSampleNoise = onlineSampleNoise) + TileSampleNoise = sampleNoise) + + if flags.Common.isOnline: + onlineSampleNoise = 'TileOnlineSampleNoise' + onlineSampleNoiseProxy = getTileCondProxyCoolFlt( 'TileCondProxyCool_OnlineNoiseSample', '/TILE/ONL01/NOISE/SAMPLE' ) + __addCondAlg(onlineSampleNoise, onlineSampleNoiseProxy) + noiseSampleTool.TileOnlineSampleNoise = onlineSampleNoise acc.addPublicTool( noiseSampleTool ) timing = 'TileTiming' - timingProxy = TileCondProxyCoolFlt('TileCondProxyCool_AdcOffset', Source = '/TILE/OFL02/TIME/CHANNELOFFSET/PHY' ) - __addFolder( '/TILE/OFL02/TIME/CHANNELOFFSET/PHY' ) + timingProxy = getTileCondProxyCoolFlt('TileCondProxyCool_AdcOffset', '/TILE/OFL02/TIME/CHANNELOFFSET/PHY' ) __addCondAlg(timing, timingProxy) from TileConditions.TileConditionsConf import TileCondToolTiming timingTool = TileCondToolTiming(name = 'TileCondToolTiming', TileTiming = timing) acc.addPublicTool( timingTool ) + def getTileCondProxyCoolBch(name, folder): + __addFolder(folder) + return TileCondProxyCoolBch(name, Source=folder) + badChannels = 'TileBadChannels' from TileConditions.TileConditionsConf import TileBadChannelsCondAlg badChannelsCondAlg = TileBadChannelsCondAlg( name = badChannels + 'CondAlg', TileBadChannels = badChannels) - badChannelsCondAlg.OflBchProxy = TileCondProxyCoolBch('TileCondProxyCool_OflBch', Source = '/TILE/OFL02/STATUS/ADC' ) - badChannelsCondAlg.OnlBchProxy = TileCondProxyCoolBch('TileCondProxyCool_OnlBch', Source = '/TILE/ONL01/STATUS/ADC' ) - __addFolder( '/TILE/OFL02/STATUS/ADC' ) - __addFolder( '/TILE/ONL01/STATUS/ADC' ) + badChannelsCondAlg.OflBchProxy = getTileCondProxyCoolBch('TileCondProxyCool_OflBch', '/TILE/OFL02/STATUS/ADC' ) + badChannelsCondAlg.OnlBchProxy = getTileCondProxyCoolBch('TileCondProxyCool_OnlBch', '/TILE/ONL01/STATUS/ADC' ) acc.addCondAlgo( badChannelsCondAlg ) from TileConditions.TileConditionsConf import TileBadChanTool badChanTool = TileBadChanTool(name = 'TileBadChanTool', TileBadChannels = badChannels) acc.addPublicTool( badChanTool ) + + # Defaults for offline data + dbname = "LAR_OFL" + badchannelsfolder = "BadChannelsOfl" + if flags.Common.isOnline: + dbname = "LAR" + if flags.Common.isOnline or flags.Input.isMC: + badchannelsfolder = "BadChannels" + acc.merge( addFolders(flags, ['/LAR/'+badchannelsfolder+'/BadChannels', + '/LAR/'+badchannelsfolder+'/MissingFEBs'], dbname)) from TileConditions.TileConditionsConf import TileInfoLoader, TileCablingSvc -- GitLab