14def BPHY21Cfg(flags):
15 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (
16 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
17 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
18 AugOriginalCountsCfg)
19 from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
20 acc = ComponentAccumulator()
21 isSimulation = flags.Input.isMC
22 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
23 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName))
24 acc.addPublicTool(vkalvrt)
25 acc.addPublicTool(V0Tools)
26 trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
27 acc.addPublicTool(trackselect)
28 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
29 acc.addPublicTool(vpest)
30 PVrefit = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags))
31 acc.addPublicTool(PVrefit)
32
33
34
35
36 BPHY21_triggerList = [
37 "HLT_2mu10",
38 "HLT_2mu10_nomucomb",
39 "HLT_2mu14",
40 "HLT_2mu14_nomucomb",
41 "HLT_mu18_mu8noL1",
42 "HLT_mu18_nomucomb_mu8noL1",
43 "HLT_mu20_mu8noL1",
44 "HLT_mu20_nomucomb_mu8noL1",
45 "HLT_mu22_mu8noL1",
46 "HLT_mu22_nomucomb_mu8noL1",
47 "HLT_mu20_mu8noL1",
48 "HLT_mu24_mu8noL1",
49 "HLT_mu10_mu6_bJpsimumu",
50 "HLT_mu22_mu8noL1_calotag_0eta010_L1MU1"
51 ]
52
53 BPHY21_JpsiFinder = CompFactory.Analysis.JpsiFinder(
54 name = "BPHY21_JpsiFinder",
55 muAndMu = True,
56 muAndTrack = False,
57 TrackAndTrack = False,
58 assumeDiMuons = True,
59 muonThresholdPt = 2700,
60 invMassUpper = 3400.0,
61 invMassLower = 2800.0,
62 Chi2Cut = 10.,
63 oppChargesOnly = True,
64 combOnly = True,
65 atLeastOneComb = False,
66 useCombinedMeasurement = False,
67 muonCollectionKey = "Muons",
68 TrackParticleCollection = "InDetTrackParticles",
69 TrkVertexFitterTool = vkalvrt,
70 TrackSelectorTool = trackselect,
71 VertexPointEstimator = vpest,
72 useMCPCuts = False)
73 acc.addPublicTool(BPHY21_JpsiFinder)
74 BPHY21_JpsiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
75 name = "BPHY21_JpsiSelectAndWrite",
76 VertexSearchTool = BPHY21_JpsiFinder,
77 OutputVtxContainerName = "BPHY21_JpsiCandidates",
78 V0Tools = V0Tools,
79 PVRefitter = PVrefit,
80 PVContainerName = "PrimaryVertices",
81 RefPVContainerName = "SHOULDNOTBEUSED",
82 DoVertexType = 1)
83 BPHY21_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
84 name = "BPHY21_Select_Jpsi2mumu",
85 HypothesisName = "Jpsi",
86 InputVtxContainerName = "BPHY21_JpsiCandidates",
87 V0Tools = V0Tools,
88 VtxMassHypo = 3096.900,
89 MassMin = 2600.0,
90 MassMax = 3600.0,
91 Chi2Max = 200,
92 LxyMin = 0.1,
93 DoVertexType = 1)
94
95 BPHY21_AugOriginalCounts = acc.popToolsAndMerge(
96 AugOriginalCountsCfg(flags, name = "BPHY21_AugOriginalCounts"))
97
98 if not isSimulation:
99 BPHY21_TriggerSkim = CompFactory.DerivationFramework.TriggerSkimmingTool(
100 name = "BPHY21_TriggerSkim",
101 TriggerListOR = BPHY21_triggerList)
102 acc.addPublicTool(BPHY21_TriggerSkim)
103
104 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
105 xAODStringSkimmingToolCfg)
106 BPHY21_SelectJpsiEvent = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
107 flags, name = "BPHY21_SelectJpsiEvent",
108 expression = "count(BPHY21_JpsiCandidates.passed_Jpsi) > 0"))
109
110 BPHY21_SkimmingOR = CompFactory.DerivationFramework.FilterCombinationOR(
111 "BPHY21_SkimmingOR",
112 FilterList = [ BPHY21_TriggerSkim, BPHY21_SelectJpsiEvent] )
113 acc.addPublicTool(BPHY21_SkimmingOR)
114
115 augTools = [BPHY21_JpsiSelectAndWrite, BPHY21_Select_Jpsi2mumu,
116 BPHY21_AugOriginalCounts]
117 for t in augTools : acc.addPublicTool(t)
118
119 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY21Kernel",
120 AugmentationTools = augTools,
121
122 SkimmingTools = [BPHY21_SkimmingOR] if not isSimulation else [],
123 ThinningTools = []))
124
125
126
127 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
128 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
129 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
130 BPHY21_SlimmingHelper =
SlimmingHelper(
"BPHY21_SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
131 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
132 BPHY21_AllVariables = getDefaultAllVariables()
133 BPHY21_StaticContent = []
134
135
136 BPHY21_SlimmingHelper.IncludeMuonTriggerContent = True
137 BPHY21_SlimmingHelper.IncludeBPhysTriggerContent = True
138
139
140 BPHY21_AllVariables += ["PrimaryVertices"]
141 BPHY21_StaticContent += ["xAOD::VertexContainer#BPHY21_RefittedPrimaryVertices"]
142 BPHY21_StaticContent += ["xAOD::VertexAuxContainer#BPHY21_RefittedPrimaryVerticesAux."]
143
144
145 BPHY21_AllVariables += ["InDetTrackParticles"]
146
147
150 BPHY21_AllVariables += ["CombinedMuonTrackParticles"]
151 BPHY21_AllVariables += ["ExtrapolatedMuonTrackParticles"]
152
153
154 BPHY21_AllVariables += ["Muons"]
155
156
157
158 BPHY21_StaticContent += ["xAOD::VertexContainer#%s" % BPHY21_JpsiSelectAndWrite.OutputVtxContainerName]
159
160 BPHY21_StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY21_JpsiSelectAndWrite.OutputVtxContainerName]
161
162
163
164
165
166
167
168 if isSimulation:
169 BPHY21_AllVariables += ["TruthEvents","TruthParticles","TruthVertices","MuonTruthParticles"]
170
171
172 BPHY21_AllVariables = list(
set(BPHY21_AllVariables))
173 BPHY21_SlimmingHelper.AllVariables = BPHY21_AllVariables
174 BPHY21_SlimmingHelper.StaticContent = BPHY21_StaticContent
175 acc.merge(OutputStreamCfg(flags, "DAOD_BPHY21", ItemList=BPHY21_SlimmingHelper.GetItemList(), AcceptAlgs=["BPHY21Kernel"]))
176 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY21", AcceptAlgs=["BPHY21Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
177 acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True)
178 return acc