7 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory
import CompFactory
9 from AthenaConfiguration.Enums
import MetadataCategory
12 BPHYDerivationName =
"BPHY15"
13 streamName =
"StreamDAOD_BPHY15"
16 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import (BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
17 from JpsiUpsilonTools.JpsiUpsilonToolsConfig
import PrimaryVertexRefittingToolCfg
19 V0Tools = acc.popToolsAndMerge(
BPHY_V0ToolCfg(flags, BPHYDerivationName))
21 acc.addPublicTool(vkalvrt)
22 acc.addPublicTool(V0Tools)
24 acc.addPublicTool(trackselect)
26 acc.addPublicTool(vpest)
28 acc.addPublicTool(PVrefit)
29 isSimulation = flags.Input.isMC
30 BPHY15_AugOriginalCounts = CompFactory.DerivationFramework.AugOriginalCounts(
31 name =
"BPHY15_AugOriginalCounts",
32 VertexContainer =
"PrimaryVertices",
33 TrackContainer =
"InDetTrackParticles" )
34 BPHY15JpsiFinder = CompFactory.Analysis.JpsiFinder(
35 name =
"BPHY15JpsiFinder",
38 TrackAndTrack =
False,
40 muonThresholdPt = 2700,
41 invMassUpper = 3400.0,
42 invMassLower = 2800.0,
44 oppChargesOnly =
True,
47 atLeastOneComb =
False,
48 useCombinedMeasurement =
False,
49 muonCollectionKey =
"Muons",
50 TrackParticleCollection =
"InDetTrackParticles",
51 V0VertexFitterTool =
None,
53 TrkVertexFitterTool = vkalvrt,
54 TrackSelectorTool = trackselect,
55 VertexPointEstimator = vpest,
57 acc.addPublicTool(BPHY15JpsiFinder)
58 BPHY15JpsiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
59 name =
"BPHY15JpsiSelectAndWrite",
60 VertexSearchTool = BPHY15JpsiFinder,
61 OutputVtxContainerName =
"BPHY15JpsiCandidates",
64 PVContainerName =
"PrimaryVertices",
65 RefPVContainerName =
"SHOULDNOTBEUSED",
68 BPHY15_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
69 name =
"BPHY15_Select_Jpsi2mumu",
70 HypothesisName =
"Jpsi",
71 InputVtxContainerName =
"BPHY15JpsiCandidates",
73 VtxMassHypo = 3096.900,
80 BPHY15BcJpsipi = CompFactory.Analysis.JpsiPlus1Track(
81 name =
"BPHY15BcJpsipi",
82 pionHypothesis =
True,
83 kaonHypothesis =
False,
84 trkThresholdPt = 2700,
89 JpsiContainerKey =
"BPHY15JpsiCandidates",
90 TrackParticleCollection =
"InDetTrackParticles",
91 MuonsUsedInJpsi =
"Muons",
92 TrkVertexFitterTool = vkalvrt,
93 TrackSelectorTool = trackselect,
94 UseMassConstraint =
True,
96 TrkTrippletMassUpper = 6900,
97 TrkTrippletMassLower = 5600)
98 acc.addPublicTool(BPHY15BcJpsipi)
99 BPHY15BcJpsipiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
100 name =
"BPHY15BcJpsipiSelectAndWrite",
101 VertexSearchTool = BPHY15BcJpsipi,
103 PVRefitter = PVrefit,
104 OutputVtxContainerName =
"BPHY15BcJpsipiCandidates",
105 PVContainerName =
"PrimaryVertices",
106 RefPVContainerName =
"BPHY15RefittedPrimaryVertices1",
109 BPHY15_Select_Bc2Jpsipi = CompFactory.DerivationFramework.Select_onia2mumu(
110 name =
"BPHY15_Select_Bc2Jpsipi",
111 HypothesisName =
"Bc",
112 InputVtxContainerName =
"BPHY15BcJpsipiCandidates",
114 TrkMasses = [105.658, 105.658, 139.571],
115 VtxMassHypo = 6274.9,
119 BPHY15JpsipiFinder = CompFactory.Analysis.JpsiPlus1Track(
120 name =
"BPHY15JpsipiFinder",
121 pionHypothesis =
True,
122 kaonHypothesis =
False,
123 trkThresholdPt = 350.0,
125 BThresholdPt = 5000.0,
129 TrkQuadrupletPt = 5000,
130 JpsiContainerKey =
"BPHY15JpsiCandidates",
131 TrackParticleCollection =
"InDetTrackParticles",
132 MuonsUsedInJpsi =
"Muons",
133 TrkVertexFitterTool = vkalvrt,
134 TrackSelectorTool = trackselect,
135 UseMassConstraint =
True,
137 TrkTrippletMassUpper = 3600,
138 TrkTrippletMassLower = 3200)
139 acc.addPublicTool(BPHY15JpsipiFinder)
141 BPHY15JpsipiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
142 name =
"BPHY15JpsipiSelectAndWrite",
143 VertexSearchTool = BPHY15JpsipiFinder,
144 PVRefitter = PVrefit,
146 OutputVtxContainerName =
"BPHY15JpsipiCandidates",
147 PVContainerName =
"PrimaryVertices",
148 RefPVContainerName =
"SHOULDNOTBEUSED",
151 BPHY15_Select_Jpsipi = CompFactory.DerivationFramework.Select_onia2mumu(
152 name =
"BPHY15_Select_Jpsipi",
153 HypothesisName =
"Jpsipi",
155 TrkMasses = [105.658, 105.658, 139.571],
156 InputVtxContainerName =
"BPHY15JpsipiCandidates",
157 VtxMassHypo = 3396.900,
164 BPHY15DiTrkFinder = CompFactory.Analysis.JpsiFinder(
165 name =
"BPHY15DiTrkFinder",
168 TrackAndTrack =
True,
169 assumeDiMuons =
False,
170 trackThresholdPt = 900,
171 invMassUpper = 1900.0,
172 invMassLower = 280.0,
174 oppChargesOnly =
True,
175 atLeastOneComb =
False,
176 useCombinedMeasurement =
False,
177 muonCollectionKey =
"Muons",
178 TrackParticleCollection =
"InDetTrackParticles",
179 V0VertexFitterTool =
None,
181 TrkVertexFitterTool = vkalvrt,
182 TrackSelectorTool = trackselect,
183 VertexPointEstimator = vpest,
185 track1Mass = 139.571,
186 track2Mass = 139.571)
187 acc.addPublicTool(BPHY15DiTrkFinder)
188 BPHY15DiTrkSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
189 name =
"BPHY15DiTrkSelectAndWrite",
190 VertexSearchTool = BPHY15DiTrkFinder,
191 OutputVtxContainerName =
"BPHY15DiTrkCandidates",
192 PVContainerName =
"PrimaryVertices",
194 PVRefitter = PVrefit,
195 RefPVContainerName =
"SHOULDNOTBEUSED",
196 CheckCollections =
True,
197 CheckVertexContainers = [
'BPHY15JpsiCandidates'],
200 BPHY15_Select_D0 = CompFactory.DerivationFramework.Select_onia2mumu(
201 name =
"BPHY15_Select_D0",
202 HypothesisName =
"D0",
203 InputVtxContainerName =
"BPHY15DiTrkCandidates",
205 TrkMasses = [139.571, 493.677],
206 VtxMassHypo = 1864.83,
207 MassMin = 1864.83-170,
208 MassMax = 1864.83+170,
212 BPHY15_Select_D0b = CompFactory.DerivationFramework.Select_onia2mumu(
213 name =
"BPHY15_Select_D0b",
214 HypothesisName =
"D0b",
215 InputVtxContainerName =
"BPHY15DiTrkCandidates",
217 TrkMasses = [493.677, 139.571],
218 VtxMassHypo = 1864.83,
219 MassMin = 1864.83-170,
220 MassMax = 1864.83+170,
224 BPHY15Dh3Finder = CompFactory.Analysis.JpsiPlus1Track(
225 name =
"BPHY15Dh3Finder",
226 pionHypothesis =
True,
227 kaonHypothesis =
False,
228 trkThresholdPt = 900.0,
230 BThresholdPt = 2000.0,
234 TrkTrippletMassUpper = 1800,
235 TrkTrippletMassLower = 500,
236 TrkQuadrupletPt = 2000,
237 JpsiContainerKey =
"BPHY15DiTrkCandidates",
238 TrackParticleCollection =
"InDetTrackParticles",
239 MuonsUsedInJpsi =
"NONE",
240 ExcludeCrossJpsiTracks =
False,
241 TrkVertexFitterTool = vkalvrt,
242 TrackSelectorTool = trackselect,
243 UseMassConstraint =
False,
245 acc.addPublicTool(BPHY15Dh3Finder)
246 BPHY15Dh3SelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
247 name =
"BPHY15Dh3SelectAndWrite",
248 VertexSearchTool = BPHY15Dh3Finder,
250 PVRefitter = PVrefit,
251 OutputVtxContainerName =
"BPHY15Dh3Candidates",
252 PVContainerName =
"PrimaryVertices",
253 RefPVContainerName =
"SHOULDNOTBEUSED",
256 BPHY15_Select_Ds = CompFactory.DerivationFramework.Select_onia2mumu(
257 name =
"BPHY15_Select_Ds",
258 HypothesisName =
"Ds",
260 TrkMasses = [493.677, 493.677, 139.571],
261 InputVtxContainerName =
"BPHY15Dh3Candidates",
262 VtxMassHypo = 1968.28,
263 MassMin = 1968.28-200,
264 MassMax = 1968.28+200,
269 BPHY15_Select_Dp = CompFactory.DerivationFramework.Select_onia2mumu(
270 name =
"BPHY15_Select_Dp",
271 HypothesisName =
"Dp",
273 TrkMasses = [139.571, 493.677, 139.571],
274 InputVtxContainerName =
"BPHY15Dh3Candidates",
275 VtxMassHypo = 1869.59,
276 MassMin = 1869.59-200,
277 MassMax = 1869.59+200,
282 BPHY15_Select_Dm = CompFactory.DerivationFramework.Select_onia2mumu(
283 name =
"BPHY15_Select_Dm",
284 HypothesisName =
"Dm",
286 TrkMasses = [493.677, 139.571, 139.571],
287 InputVtxContainerName =
"BPHY15Dh3Candidates",
288 VtxMassHypo = 1869.59,
289 MassMin = 1869.59-200,
290 MassMax = 1869.59+200,
295 BcJpsiDxVertexFit = acc.popToolsAndMerge(
BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName +
"BcJpsiDx", CascadeCnstPrecision = 1e-6))
296 acc.addPublicTool(BcJpsiDxVertexFit)
297 BPHY15JpsiDs = CompFactory.DerivationFramework.JpsiPlusDsCascade(
298 name =
"BPHY15JpsiDs",
299 HypothesisName =
"Bc",
301 TrkVertexFitterTool = BcJpsiDxVertexFit,
302 PVRefitter = PVrefit,
304 ApplyDxMassConstraint =
True,
305 ApplyJpsiMassConstraint =
True,
306 JpsiMassLowerCut = 2600.,
307 JpsiMassUpperCut = 3600.,
308 DxMassLowerCut = 1968.28 - 200.,
309 DxMassUpperCut = 1968.28 + 200.,
310 MassLowerCut = 6274.90 - 600.,
311 MassUpperCut = 6274.90 + 600.,
314 RefPVContainerName =
"BPHY15RefittedPrimaryVertices2",
315 JpsiVertices =
"BPHY15JpsiCandidates",
316 CascadeVertexCollections = [
"BcJpsiDsCascadeSV2",
"BcJpsiDsCascadeSV1"],
317 DxVertices =
"BPHY15Dh3Candidates")
319 BPHY15JpsiDp = CompFactory.DerivationFramework.JpsiPlusDsCascade(
320 name =
"BPHY15JpsiDp",
321 HypothesisName =
"Bc",
323 TrkVertexFitterTool = BcJpsiDxVertexFit,
324 PVRefitter = PVrefit,
326 ApplyDxMassConstraint =
True,
327 ApplyJpsiMassConstraint =
True,
328 JpsiMassLowerCut = 2600.,
329 JpsiMassUpperCut = 3600.,
330 DxMassLowerCut = 1869.59 - 180.,
331 DxMassUpperCut = 1869.59 + 180.,
332 MassLowerCut = 6274.90 - 600.,
333 MassUpperCut = 6274.90 + 600.,
336 RefPVContainerName =
"BPHY15RefittedPrimaryVertices3",
337 JpsiVertices =
"BPHY15JpsiCandidates",
338 CascadeVertexCollections = [
"BcJpsiDpCascadeSV2",
"BcJpsiDpCascadeSV1"],
339 DxVertices =
"BPHY15Dh3Candidates")
341 BcJpsiDstVertexFit = acc.popToolsAndMerge(
BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName +
"BcJpsiDst", CascadeCnstPrecision = 1e-6))
342 acc.addPublicTool(BcJpsiDstVertexFit)
344 BPHY15JpsiDpst = CompFactory.DerivationFramework.JpsiPlusDpstCascade(
345 name =
"BPHY15JpsiDpst",
346 HypothesisName =
"Bc",
348 TrkVertexFitterTool = BcJpsiDstVertexFit,
349 PVRefitter = PVrefit,
351 ApplyD0MassConstraint =
True,
352 ApplyJpsiMassConstraint =
True,
353 JpsiMassLowerCut = 2600.,
354 JpsiMassUpperCut = 3600.,
355 JpsipiMassLowerCut = 2600.,
356 JpsipiMassUpperCut = 6800.,
357 D0MassLowerCut = 1864.83 - 200.,
358 D0MassUpperCut = 1864.83 + 200.,
359 DstMassLowerCut = 2010.26 - 300.,
360 DstMassUpperCut = 2010.26 + 300.,
362 MassUpperCut = 6274.90 + 600.,
365 RefPVContainerName =
"BPHY15RefittedPrimaryVertices4",
366 JpsipiVertices =
"BPHY15JpsipiCandidates",
367 CascadeVertexCollections = [
"BcJpsiDpstCascadeSV2",
"BcJpsiDpstCascadeSV1"],
368 D0Vertices =
"BPHY15DiTrkCandidates")
370 from TrkConfig.TrkV0FitterConfig
import TrkV0VertexFitter_InDetExtrCfg
372 acc.addPublicTool(v0Vertexfit)
373 BPHY15K0Finder = CompFactory.Analysis.JpsiFinder(
374 name =
"BPHY15K0Finder",
377 TrackAndTrack =
True,
378 assumeDiMuons =
False,
379 trackThresholdPt = 400,
380 invMassUpper = 600.0,
381 invMassLower = 400.0,
383 oppChargesOnly =
True,
384 atLeastOneComb =
False,
385 useCombinedMeasurement =
False,
386 muonCollectionKey =
"Muons",
387 TrackParticleCollection =
"InDetTrackParticles",
388 V0VertexFitterTool = v0Vertexfit,
390 TrkVertexFitterTool = vkalvrt,
391 TrackSelectorTool = trackselect,
392 VertexPointEstimator = vpest,
394 track1Mass = 139.571,
395 track2Mass = 139.571)
396 acc.addPublicTool(BPHY15K0Finder)
397 BPHY15K0SelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
398 name =
"BPHY15K0SelectAndWrite",
399 VertexSearchTool = BPHY15K0Finder,
400 OutputVtxContainerName =
"BPHY15K0Candidates",
401 PVContainerName =
"PrimaryVertices",
402 RefPVContainerName =
"SHOULDNOTBEUSED",
404 PVRefitter = PVrefit,
405 CheckCollections =
True,
406 CheckVertexContainers = [
'BPHY15JpsipiCandidates',
'BPHY15DiTrkCandidates',
'BcJpsiDpstCascadeSV1'],
409 BPHY15_Select_K0 = CompFactory.DerivationFramework.Select_onia2mumu(
410 name =
"BPHY15_Select_K0",
411 HypothesisName =
"K0",
412 InputVtxContainerName =
"BPHY15K0Candidates",
414 TrkMasses = [139.571, 139.571],
415 VtxMassHypo = 497.672,
421 BcJpsiDs1VertexFit = acc.popToolsAndMerge(
BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName +
"BcJpsiDs1", CascadeCnstPrecision = 1e-6))
422 acc.addPublicTool(BcJpsiDs1VertexFit)
424 BPHY15JpsiDps1 = CompFactory.DerivationFramework.JpsiPlusDs1Cascade(
425 name =
"BPHY15JpsiDps1",
426 HypothesisName =
"Bc",
427 TrkVertexFitterTool = BcJpsiDs1VertexFit,
428 PVRefitter = PVrefit,
431 ApplyD0MassConstraint =
True,
432 ApplyK0MassConstraint =
True,
433 ApplyJpsiMassConstraint =
True,
434 JpsiMassLowerCut = 2600.,
435 JpsiMassUpperCut = 3600.,
436 JpsipiMassLowerCut = 2600.,
437 JpsipiMassUpperCut = 6800.,
438 D0MassLowerCut = 1864.83 - 180.,
439 D0MassUpperCut = 1864.83 + 180.,
440 K0MassLowerCut = 400.,
441 K0MassUpperCut = 600.,
442 DstMassLowerCut = 2010.26 - 300.,
443 DstMassUpperCut = 2010.26 + 300.,
444 MassLowerCut = 6274.90 - 600,
445 MassUpperCut = 6274.90 + 600.,
448 RefPVContainerName =
"BPHY15RefittedPrimaryVertices5",
449 JpsipiVertices =
"BPHY15JpsipiCandidates",
450 CascadeVertexCollections = [
"BcJpsiDps1CascadeSV3",
"BcJpsiDps1CascadeSV2",
"BcJpsiDps1CascadeSV1"],
451 K0Vertices =
"BPHY15K0Candidates",
452 D0Vertices =
"BPHY15DiTrkCandidates")
456 CascadeCollections = []
458 CascadeCollections += BPHY15JpsiDs.CascadeVertexCollections
459 CascadeCollections += BPHY15JpsiDp.CascadeVertexCollections
461 CascadeCollections += BPHY15JpsiDpst.CascadeVertexCollections
462 CascadeCollections += BPHY15JpsiDps1.CascadeVertexCollections
466 BPHY15_SelectBcJpsipiEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(
467 name =
"BPHY15_SelectBcJpsipiEvent",
468 expression =
"( count(BPHY15BcJpsipiCandidates.passed_Bc) > 0)")
469 acc.addPublicTool(BPHY15_SelectBcJpsipiEvent)
470 BPHY15_AnyVertexSkimmingTool = CompFactory.DerivationFramework.AnyVertexSkimmingTool(
"BPHY15_AnyVertexSkimmingTool", UseHandles =
True,
471 VertexContainerNames =CascadeCollections )
472 acc.addPublicTool(BPHY15_AnyVertexSkimmingTool)
477 BPHY15SkimmingOR = CompFactory.DerivationFramework.FilterCombinationOR(
479 FilterList = [BPHY15_SelectBcJpsipiEvent, BPHY15_AnyVertexSkimmingTool] )
480 acc.addPublicTool(BPHY15SkimmingOR)
482 augTools = [BPHY15JpsiSelectAndWrite, BPHY15_Select_Jpsi2mumu,
483 BPHY15BcJpsipiSelectAndWrite, BPHY15_Select_Bc2Jpsipi,
484 BPHY15JpsipiSelectAndWrite, BPHY15_Select_Jpsipi,
485 BPHY15DiTrkSelectAndWrite, BPHY15_Select_D0, BPHY15_Select_D0b,
486 BPHY15Dh3SelectAndWrite, BPHY15_Select_Ds, BPHY15_Select_Dp, BPHY15_Select_Dm,
490 BPHY15K0SelectAndWrite, BPHY15_Select_K0,
492 BPHY15_AugOriginalCounts]
493 for t
in augTools : acc.addPublicTool(t)
494 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY15Kernel",
495 AugmentationTools = augTools,
497 SkimmingTools = [BPHY15SkimmingOR]
if not isSimulation
else [],
500 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
501 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
502 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
503 BPHY15SlimmingHelper =
SlimmingHelper(
"BPHY15SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
504 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
509 BPHY15SlimmingHelper.IncludeMuonTriggerContent =
True
510 BPHY15SlimmingHelper.IncludeBPhysTriggerContent =
True
513 AllVariables += [
"PrimaryVertices"]
515 StaticContent += [
"xAOD::VertexContainer#BPHY15RefittedPrimaryVertices%s" %
str(x)]
516 StaticContent += [
"xAOD::VertexAuxContainer#BPHY15RefittedPrimaryVertices%sAux." %
str(x)]
519 AllVariables += [
"InDetTrackParticles"]
524 AllVariables += [
"CombinedMuonTrackParticles"]
525 AllVariables += [
"ExtrapolatedMuonTrackParticles"]
528 AllVariables += [
"Muons"]
532 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY15JpsiSelectAndWrite.OutputVtxContainerName]
534 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY15JpsiSelectAndWrite.OutputVtxContainerName]
537 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY15BcJpsipiSelectAndWrite.OutputVtxContainerName]
538 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY15BcJpsipiSelectAndWrite.OutputVtxContainerName]
542 for cascades
in CascadeCollections:
543 StaticContent += [
"xAOD::VertexContainer#%s" % cascades]
544 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % cascades]
547 AllVariables += [
"GSFTrackParticles",
"MuonSpectrometerTrackParticles" ]
551 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"MuonTruthParticles"]
553 AllVariables =
list(
set(AllVariables))
555 BPHY15SlimmingHelper.AllVariables = AllVariables
556 BPHY15SlimmingHelper.StaticContent = StaticContent
558 BPHY15ItemList = BPHY15SlimmingHelper.GetItemList()
559 acc.merge(
OutputStreamCfg(flags,
"DAOD_BPHY15", ItemList=BPHY15ItemList, AcceptAlgs=[
"BPHY15Kernel"]))
560 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY15", AcceptAlgs=[
"BPHY15Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
561 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True, printComponentsOnly=
False)