4 from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
    5 from AthenaConfiguration.ComponentFactory 
import CompFactory
 
    6 from AthenaConfiguration.Enums 
import MetadataCategory
 
    7 from AthenaCommon.CFElements 
import seqAND
 
   13     """Configure the physics augmentation for HION7""" 
   18         from DerivationFrameworkMCTruth.MCTruthCommonConfig 
import (
 
   19             AddStandardTruthContentsCfg,
 
   20             AddHFAndDownstreamParticlesCfg,
 
   21             AddMiniTruthCollectionLinksCfg,
 
   23         from DerivationFrameworkMCTruth.TruthDerivationToolsConfig 
import TruthCollectionMakerCfg
 
   26             name                    = 
"PhysCommonTruthCharmTool",
 
   27             NewCollectionName       = 
"TruthCharm",
 
   28             KeepNavigationInfo      = 
False,
 
   29             ParticleSelectionString = 
"(abs(TruthParticles.pdgId) == 4)",
 
   31         CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
 
   32         acc.addEventAlgo(CommonAugmentation(
"PhysCommonTruthCharmKernel",AugmentationTools=[PhysCommonTruthCharmTool]))
 
   36                   navInputCollections =[
"TruthElectrons",
 
   46                                         "TruthHFWithDecayParticles"]))
 
   51     from DerivationFrameworkInDet.InDetCommonConfig 
import InDetCommonCfg
 
   52     from DerivationFrameworkMuons.MuonsCommonConfig 
import MuonsCommonCfg
 
   53     from DerivationFrameworkEGamma.EGammaCommonConfig 
import EGammaCommonCfg
 
   55                              DoVertexFinding = flags.Tracking.doVertexFinding,
 
   56                              AddPseudoTracks = flags.Tracking.doPseudoTracking,
 
   58                              DoR3LargeD0 = flags.Tracking.doLargeD0,
 
   59                              StoreSeparateLargeD0Container = flags.Tracking.storeSeparateLargeD0Container,
 
   67     """ Create updated version of AntiKt*HIJets""" 
   70     JetColl = flags.HeavyIon.HIJetPrefix
 
   71     from HIJetRec.HIJetRecConfigCA 
import HIJetRecCfg
 
   73     if flags.HeavyIon.doHIBTagging:
 
   74         from BTagging.FlavorTaggingConfig 
import FlavorTaggingCfg
 
   76         from BTagging.TrackLeptonConfig 
import TrackLeptonDecorationCfg
 
   77         acc.merge(TrackLeptonDecorationCfg(flags))
 
   85     """Configure the example skimming tool""" 
   87     JetColl = flags.HeavyIon.HIJetPrefix
 
   89     ExtraData += [
'xAOD::JetContainer/'+JetColl+
'AntiKt2HIJets']
 
   90     ExtraData += [
'xAOD::JetContainer/'+JetColl+
'AntiKt4HIJets']
 
   92     acc.addSequence( 
seqAND(
"HION7Sequence") )
 
   93     acc.getSequence(
"HION7Sequence").ExtraDataForDynamicConsumers = ExtraData
 
   94     acc.getSequence(
"HION7Sequence").ProcessDynamicDataDependencies = 
True 
   98     from DerivationFrameworkHI 
import ListTriggers
 
   99     from CoolConvUtilities.ParticleTypeUtil 
import getTypeForRun
 
  101     isSmallSystem = 
False 
  102     if (info.getBeam1Type() < 11) 
or (info.getBeam2Type() < 11):
 
  104     if not flags.Input.isMC:
 
  105         print(
'project: ', flags.Input.ProjectName,
', isSmallSystem: ', isSmallSystem)
 
  106         TriggerDict = ListTriggers.GetTriggers(flags.Input.ProjectName, isSmallSystem)
 
  107         for i, key 
in enumerate(TriggerDict):
 
  108             expression = expression + 
'(' + key + 
' && count('+JetColl+
'AntiKt4HIJets.pt >' + 
str(TriggerDict[key]) + 
'*GeV) >=1 ) ' + 
'|| (' + key + 
' && count('+JetColl+
'AntiKt2HIJets.pt >' + 
str(TriggerDict[key]) + 
'*GeV) >=1 ) ' 
  109             if not i == len(TriggerDict) - 1:
 
  110                 expression = expression + 
' || ' 
  112         expression = expression + 
'count('+JetColl+
'AntiKt2HIJets.pt > 15000) > 1 || count('+JetColl+
'AntiKt4HIJets.pt > 15000) > 1' 
  114     from TrigDecisionTool.TrigDecisionToolConfig 
import TrigDecisionToolCfg    
 
  116     acc.addPublicTool(CompFactory.DerivationFramework.xAODStringSkimmingTool(name       = 
"HION7StringSkimmingTool",
 
  117                                                                              expression = expression,
 
  118                                                                              TrigDecisionTool=tdt), 
 
  124     """Configure the example augmentation tool""" 
  130     caloClusterKey = 
"CaloCalTopoClusters" 
  131     from AthenaConfiguration.Enums 
import HIMode
 
  132     if flags.Reco.HIMode == HIMode.HI:
 
  136     augmentation_tool = CompFactory.DerivationFramework.HIGlobalAugmentationTool(name=
"HION7AugmentationTool",
 
  138                                                                                  doTopoClusDec = doTopoClus,
 
  139                                                                                  CaloClusterKey = caloClusterKey
 
  142     acc.addPublicTool(augmentation_tool, primary=
True)
 
  148     """Configure the derivation framework driving algorithm (kernel)""" 
  154     from CoolConvUtilities.ParticleTypeUtil 
import getTypeForRun
 
  156     isSmallSystem = 
False 
  157     if (info.getBeam1Type() < 11) 
or (info.getBeam2Type() < 11):
 
  163     JetColl = flags.HeavyIon.HIJetPrefix
 
  165     from DerivationFrameworkInDet.InDetToolsConfig 
import TrackParticleThinningCfg,JetTrackParticleThinningCfg
 
  167     minTrackPt = flags.HeavyIon.MinTrackPt
 
  168     track_thinning_expression  = 
"InDetTrackParticles.pt > "+
str(minTrackPt)+
"*GeV" 
  171          name                    = 
"PHYSTrackParticleThinningTool",
 
  172          StreamName              = kwargs[
'StreamName'], 
 
  173          SelectionString         = track_thinning_expression,
 
  174          InDetTrackParticlesKey  = 
"InDetTrackParticles"))
 
  178          name                    = 
"AntiKt2HIJetsThinningTool",
 
  179          StreamName              = kwargs[
'StreamName'],
 
  180          JetKey                  = JetColl+
"AntiKt2HIJets",
 
  181          SelectionString         = JetColl+
"AntiKt2HIJets.pt > "+ 
str(pTCut) +
"*GeV",
 
  182          InDetTrackParticlesKey  = 
"InDetTrackParticles"))
 
  186          name                    = 
"AntiKt4HIJetsThinningTool",
 
  187          StreamName              = kwargs[
'StreamName'],
 
  188          JetKey                  = JetColl+
"AntiKt4HIJets",
 
  189          SelectionString         = JetColl+
"AntiKt4HIJets.pt > "+ 
str(pTCut) +
"*GeV",
 
  190          InDetTrackParticlesKey  = 
"InDetTrackParticles"))
 
  192     thinningTools = [TrackParticleThinningTool,
 
  193                     AntiKt2HIJetsThinningTool,
 
  194                     AntiKt4HIJetsThinningTool]
 
  196         from DerivationFrameworkMCTruth.TruthDerivationToolsConfig 
import GenericTruthThinningCfg
 
  197         truth_thinning_expression = 
"(TruthParticles.status==1) && (TruthParticles.pt > "+
str(minTrackPt-0.2)+
"*GeV) && (abs(TruthParticles.eta) < 2.7)" 
  199             name=
"TruthParticleThinningTool",
 
  200             StreamName=kwargs[
'StreamName'],
 
  201             ParticleSelectionString = truth_thinning_expression
 
  204         thinningTools += [TruthParticleThinningTool]
 
  209     augmentationTool=[globalAugmentationTool]
 
  211     acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(name,ThinningTools = thinningTools, SkimmingTools = [skimmingTool], AugmentationTools=augmentationTool),sequenceName=
"HION7Sequence")
 
  220     JetColl = flags.HeavyIon.HIJetPrefix
 
  223     acc.merge(
HION7KernelCfg(flags, name=
"HION7Kernel",StreamName = 
"StreamDAOD_HION7"))
 
  225     from OutputStreamAthenaPool.OutputStreamConfig 
import OutputStreamCfg
 
  226     from xAODMetaDataCnv.InfileMetaDataConfig 
import SetupMetaDataForStreamCfg
 
  227     from DerivationFrameworkCore.SlimmingHelper 
import SlimmingHelper
 
  228     from DerivationFrameworkHI 
import ListSlimming
 
  232     HION7SlimmingHelper = 
SlimmingHelper(
"HION7SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
 
  233     HION7SlimmingHelper.SmartCollections = ListSlimming.HION7SmartCollections()
 
  234     AllVars = ListSlimming.HION7AllVarContent()
 
  235     AllVars += ListSlimming.HION7ExtraContainersTrigger()
 
  236     ExtraVars = ListSlimming.HION7BasicJetVars(JetColl)
 
  237     from DerivationFrameworkFlavourTag 
import FtagBaseContent
 
  239         AllVars += ListSlimming.HION7AllVarTruthContent()
 
  240         if flags.HeavyIon.doHIBTagging:
 
  241             FtagBaseContent.add_truth_to_SlimmingHelper(HION7SlimmingHelper)
 
  242     if flags.HeavyIon.doHIBTagging:
 
  243         from DerivationFrameworkFlavourTag.FtagBaseContent 
import addCommonAugmentation
 
  245         AllVars += ListSlimming.HION7AllVarFromFTAG1()
 
  247         extra_AppendToDictionary = {}
 
  248         FtagBaseContent.update_AppendToDictionary_in_SlimmingHelper(HION7SlimmingHelper, flags, extra_AppendToDictionary)
 
  250         ExtraVars += ListSlimming.HION7ExtraVarForBtag(JetColl)
 
  251         FtagBaseContent.add_ExtraVariables_to_SlimmingHelper(HION7SlimmingHelper, flags)
 
  253     HION7SlimmingHelper.ExtraVariables = ExtraVars
 
  254     HION7SlimmingHelper.AllVariables = AllVars
 
  256     HION7ItemList  = HION7SlimmingHelper.GetItemList()
 
  257     HIJetRemovedBranches=ListSlimming.makeHIJetRemovedBranchList()
 
  258     jet_var_str = 
'.-'.join ([
''] + HIJetRemovedBranches)
 
  259     jetRlist = flags.HeavyIon.Jet.RValues 
 
  260     for jetR 
in jetRlist:
 
  261         output = [
"xAOD::JetContainer#"+JetColl+
"AntiKt"+
str(jetR)+
"HIJets",
 
  262                 "xAOD::JetAuxContainer#"+JetColl+
"AntiKt"+
str(jetR)+
"HIJetsAux.-PseudoJet"+jet_var_str]
 
  263         HION7ItemList += output
 
  265     acc.merge(
OutputStreamCfg(flags, 
"DAOD_HION7", ItemList=HION7ItemList, AcceptAlgs=[
"HION7Kernel"]))
 
  266     acc.merge(
SetupMetaDataForStreamCfg(flags, 
"DAOD_HION7", AcceptAlgs=[
"HION7Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))