16def BPHY1Kernel(flags):
17 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (
18 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
19 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
20 AugOriginalCountsCfg)
21 acc = ComponentAccumulator()
22
23 BPHY1_AugOriginalCounts = acc.popToolsAndMerge(
24 AugOriginalCountsCfg(flags, name = "BPHY1_AugOriginalCounts"))
25
26 doLRT = flags.Tracking.doLargeD0
27 mainMuonInput = "StdWithLRTMuons" if doLRT else "Muons"
28 mainIDInput = "InDetWithLRTTrackParticles" if doLRT else "InDetTrackParticles"
29 if doLRT:
30 from DerivationFrameworkLLP.LLPToolsConfig import LRTMuonMergerAlg
31 from AthenaConfiguration.Enums import LHCPeriod
32 acc.merge(LRTMuonMergerAlg( flags,
33 PromptMuonLocation = "Muons",
34 LRTMuonLocation = "MuonsLRT",
35 OutputMuonLocation = mainMuonInput,
36 CreateViewCollection = True,
37 UseRun3WP = flags.GeoModel.Run == LHCPeriod.Run3))
38 from DerivationFrameworkInDet.InDetToolsConfig import InDetLRTMergeCfg
39 acc.merge(InDetLRTMergeCfg(flags))
40
41 toRelink = ["InDetTrackParticles", "InDetLargeD0TrackParticles"] if doLRT else []
42 MuonReLink = [ "Muons", "MuonsLRT" ] if doLRT else []
43
44 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
45 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName))
46 acc.addPublicTool(vkalvrt)
47 acc.addPublicTool(V0Tools)
48 TrackSelector = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
49 acc.addPublicTool(TrackSelector)
50 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
51 acc.addPublicTool(vpest)
52 BPHY1JpsiFinder = CompFactory.Analysis.JpsiFinder(
53 name = "BPHY1JpsiFinder",
54 muAndMu = True,
55 muAndTrack = False,
56 TrackAndTrack = False,
57 assumeDiMuons = True,
58 invMassUpper = 100000.0,
59 invMassLower = 0.0,
60 Chi2Cut = 200.,
61 oppChargesOnly = True,
62 atLeastOneComb = True,
63 useCombinedMeasurement = False,
64 muonCollectionKey = mainMuonInput,
65 TrackParticleCollection = mainIDInput,
66 useV0Fitter = False,
67 TrkVertexFitterTool = vkalvrt,
68 V0VertexFitterTool = None,
69 TrackSelectorTool = TrackSelector,
70 VertexPointEstimator = vpest,
71 useMCPCuts = False )
72
73 from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
74 BPHY1_Reco_mumu = CompFactory.DerivationFramework.Reco_Vertex(
75 name = "BPHY1_Reco_mumu",
76 VertexSearchTool = BPHY1JpsiFinder,
77 OutputVtxContainerName = OniaContainerName,
78 PVContainerName = "PrimaryVertices",
79 RefPVContainerName = "BPHY1RefittedPrimaryVertices",
80 RefitPV = True,
81 MaxPVrefit = 100000,
82 V0Tools = V0Tools,
83 RelinkTracks = toRelink,
84 RelinkMuons = MuonReLink,
85 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
86 DoVertexType = 7)
87
88 BPHY1_Select_Jpsi2mumu =CompFactory.DerivationFramework.Select_onia2mumu(
89 name = "BPHY1_Select_Jpsi2mumu",
90 HypothesisName = "Jpsi",
91 InputVtxContainerName = "BPHY1OniaCandidates",
92 V0Tools = V0Tools,
93 VtxMassHypo = 3096.916,
94 MassMin = 2000.0,
95 MassMax = 3600.0,
96 Chi2Max = 200,
97 DoVertexType = 7)
98 BPHY1_Select_Psi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
99 name = "BPHY1_Select_Psi2mumu",
100 HypothesisName = "Psi",
101 InputVtxContainerName = "BPHY1OniaCandidates",
102 V0Tools = V0Tools,
103 VtxMassHypo = 3686.09,
104 MassMin = 3300.0,
105 MassMax = 4500.0,
106 Chi2Max = 200,
107 DoVertexType = 7)
108 BPHY1_Select_Upsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
109 name = "BPHY1_Select_Upsi2mumu",
110 HypothesisName = "Upsi",
111 InputVtxContainerName = "BPHY1OniaCandidates",
112 V0Tools = V0Tools,
113 VtxMassHypo = 9460.30,
114 MassMin = 7000.0,
115 MassMax = 12500.0,
116 Chi2Max = 200,
117 DoVertexType = 7)
118
119 augTools = [BPHY1_AugOriginalCounts, BPHY1_Reco_mumu,
120 BPHY1_Select_Jpsi2mumu, BPHY1_Select_Psi2mumu,
121 BPHY1_Select_Upsi2mumu]
122 for t in [BPHY1JpsiFinder] + augTools : acc.addPublicTool(t)
123
124 BPHY1Thin_vtxTrk = CompFactory.DerivationFramework.Thin_vtxTrk(
125 name = "BPHY1Thin_vtxTrk",
126 TrackParticleContainerName = "InDetTrackParticles",
127 StreamName = streamName,
128 VertexContainerNames = ["BPHY1OniaCandidates"],
129 PassFlags = ["passed_Jpsi", "passed_Psi", "passed_Upsi"] )
130 BPHY1MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(name = "BPHY1MuonTPThinningTool",
131 MuonKey = "Muons",
132 StreamName = streamName,
133 InDetTrackParticlesKey = "InDetTrackParticles")
134 BPHY1ThinningTools = [BPHY1Thin_vtxTrk, BPHY1MuonTPThinningTool]
135 if flags.Input.isMC :
136 TruthSelection ="TruthParticles.pdgId == 443 || TruthParticles.pdgId == 100443 || TruthParticles.pdgId == 553 || TruthParticles.pdgId == 100553 || TruthParticles.pdgId == 200553"
137 BPHY1TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name = "BPHY1TruthThinTool",
138 StreamName = streamName,
139 ParticleSelectionString = TruthSelection,
140 PreserveDescendants = True,
141 PreserveAncestors = True)
142 BPHY1ThinningTools.append(BPHY1TruthThinTool)
143
144
145 SelectExpression = "count(BPHY1OniaCandidates.passed_Jpsi) > 0 || count(BPHY1OniaCandidates.passed_Psi) > 0 || count(BPHY1OniaCandidates.passed_Upsi) > 0"
146 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
147 xAODStringSkimmingToolCfg)
148 BPHY1_SelectEvent = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
149 flags, name = "BPHY1_SelectEvent", expression = SelectExpression))
150
151 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY1Kernel",
152 SkimmingTools = [BPHY1_SelectEvent],
153 ThinningTools = BPHY1ThinningTools,
154 AugmentationTools = augTools))
155 for tool in BPHY1ThinningTools : acc.addPublicTool(tool)
156 return acc
157