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