6 from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
    7 from AthenaConfiguration.ComponentFactory 
import CompFactory
 
    8 from AthenaConfiguration.Enums 
import MetadataCategory
 
   10 BPHYDerivationName = 
"BPHY3" 
   11 streamName = 
"StreamDAOD_BPHY3" 
   14     from DerivationFrameworkBPhys.commonBPHYMethodsCfg 
import (BPHY_V0ToolCfg,  BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
 
   15     from JpsiUpsilonTools.JpsiUpsilonToolsConfig 
import PrimaryVertexRefittingToolCfg
 
   17     V0Tools = acc.popToolsAndMerge(
BPHY_V0ToolCfg(flags, BPHYDerivationName))
 
   19     acc.addPublicTool(vkalvrt)
 
   20     acc.addPublicTool(V0Tools)
 
   22     acc.addPublicTool(trackselect)
 
   24     acc.addPublicTool(vpest)
 
   25     BPHY3JpsiFinder = CompFactory.Analysis.JpsiFinder(
 
   26                     name                        = 
"BPHY3JpsiFinder",
 
   30                     assumeDiMuons               = 
False,    
 
   31                     invMassUpper                = 10000.0,
 
   34                     oppChargesOnly                = 
True,
 
   35                     atLeastOneComb              = 
False,
 
   36                     useCombinedMeasurement      = 
False, 
 
   37                     muonCollectionKey           = 
"Muons",
 
   38                     TrackParticleCollection     = 
"InDetTrackParticles",
 
   39                     V0VertexFitterTool          = 
None,             
 
   41                     TrkVertexFitterTool         = vkalvrt,        
 
   42                     TrackSelectorTool           = trackselect,
 
   43                     VertexPointEstimator        = vpest,
 
   48     BPHY3_Reco_diTrk = CompFactory.DerivationFramework.Reco_Vertex(
 
   49                     name                   = 
"BPHY3_Reco_diTrk",
 
   50                     VertexSearchTool             = BPHY3JpsiFinder,
 
   51                     OutputVtxContainerName = 
"BPHY3VertexCandidates",
 
   54                     PVContainerName        = 
"PrimaryVertices",
 
   55                     RefPVContainerName     = 
"BPHY3RefittedPrimaryVertices")
 
   56     BPHY3_Select_PiPi = CompFactory.DerivationFramework.Select_onia2mumu(
 
   57                     name                  = 
"BPHY3_Select_PiPi",
 
   58                     HypothesisName        = 
"PiPi",
 
   59                     InputVtxContainerName = 
"BPHY3VertexCandidates",
 
   61                     TrkMasses             = [139.57,139.57],
 
   62                     VtxMassHypo           = 497.614,
 
   66     BPHY3_Select_PiK = CompFactory.DerivationFramework.Select_onia2mumu(
 
   67                     name                  = 
"BPHY3_Select_PiK",
 
   68                     HypothesisName        = 
"PiK",
 
   69                     InputVtxContainerName = 
"BPHY3VertexCandidates",
 
   71                     TrkMasses             = [139.57,493.677],
 
   76     BPHY3_Select_KPi = CompFactory.DerivationFramework.Select_onia2mumu(
 
   77                     name                  = 
"BPHY3_Select_KPi",
 
   78                     HypothesisName        = 
"KPi",
 
   79                     InputVtxContainerName = 
"BPHY3VertexCandidates",
 
   81                     TrkMasses             = [493.677,139.57],
 
   86     BPHY3_Select_KK = CompFactory.DerivationFramework.Select_onia2mumu(
 
   87                     name                  = 
"BPHY3_Select_KK",
 
   88                     HypothesisName        = 
"KK",
 
   89                     InputVtxContainerName = 
"BPHY3VertexCandidates",
 
   91                     TrkMasses             = [493.677,493.677],
 
   92                     VtxMassHypo           = 1019.461,
 
   96     BPHY3_Select_PP = CompFactory.DerivationFramework.Select_onia2mumu(
 
   97                     name                  = 
"BPHY3_Select_PP",
 
   98                     HypothesisName        = 
"PP",
 
   99                     InputVtxContainerName = 
"BPHY3VertexCandidates",
 
  101                     TrkMasses             = [938.272,938.272],
 
  102                     VtxMassHypo           = 3096.916,
 
  107     expression = 
"count(BPHY3VertexCandidates.passed_PiPi) > 0 || count(BPHY3VertexCandidates.passed_KPi) > 0 || count(BPHY3VertexCandidates.passed_PiK) > 0 || count(BPHY3VertexCandidates.passed_KK) > 0 || count(BPHY3VertexCandidates.passed_PP) > 0" 
  108     BPHY3_SelectEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(name = 
"BPHY3_SelectEvent",  expression = expression)
 
  109     BPHY3Thin_vtxTrk = CompFactory.DerivationFramework.Thin_vtxTrk(
 
  110                     name                       = 
"BPHY3Thin_vtxTrk",
 
  111                     TrackParticleContainerName = 
"InDetTrackParticles",
 
  112                     VertexContainerNames       = [
"BPHY3VertexCandidates"],
 
  113                     StreamName = streamName,
 
  114                     PassFlags                  = [
"passed_PiPi",
"passed_KPi",
"passed_PiK",
"passed_KK",
"passed_PP"])
 
  115     augCollections=[BPHY3_Reco_diTrk,BPHY3_Select_PiPi,BPHY3_Select_KPi,BPHY3_Select_PiK,BPHY3_Select_KK,BPHY3_Select_PP]
 
  116     skimCollections = [BPHY3_SelectEvent]
 
  117     BPHY3ThinningTools = [BPHY3Thin_vtxTrk]
 
  118     acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
 
  120                      AugmentationTools = augCollections,
 
  121                      SkimmingTools     = skimCollections,
 
  122                      ThinningTools     = BPHY3ThinningTools))
 
  124     for t 
in augCollections +BPHY3ThinningTools +skimCollections : acc.addPublicTool(t)
 
  125     from DerivationFrameworkCore.SlimmingHelper 
import SlimmingHelper
 
  126     from OutputStreamAthenaPool.OutputStreamConfig 
import OutputStreamCfg
 
  127     from xAODMetaDataCnv.InfileMetaDataConfig 
import SetupMetaDataForStreamCfg
 
  128     BPHY3SlimmingHelper = 
SlimmingHelper(
"BPHY3SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
 
  129     from DerivationFrameworkBPhys.commonBPHYMethodsCfg 
import getDefaultAllVariables
 
  134     AllVariables += [
"PrimaryVertices"]
 
  137     AllVariables += [
"InDetTrackParticles"]
 
  140     StaticContent += [
"xAOD::VertexContainer#%s"        % BPHY3_Reco_diTrk.OutputVtxContainerName]
 
  142     StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY3_Reco_diTrk.OutputVtxContainerName]
 
  143     BPHY3SlimmingHelper.AllVariables = AllVariables
 
  144     BPHY3SlimmingHelper.StaticContent = StaticContent
 
  145     BPHY3ItemList = BPHY3SlimmingHelper.GetItemList()
 
  146     acc.merge(
OutputStreamCfg(flags, 
"DAOD_BPHY3", ItemList=BPHY3ItemList, AcceptAlgs=[
"BPHY3Kernel"]))
 
  147     acc.merge(
SetupMetaDataForStreamCfg(flags, 
"DAOD_BPHY3", AcceptAlgs=[
"BPHY3Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
 
  148     acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True)