ATLAS Offline Software
BPHY21.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 #====================================================================
3 # BPHY21.py
4 #====================================================================
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from AthenaConfiguration.Enums import MetadataCategory
9 
10 
11 BPHYDerivationName = "BPHY21"
12 streamName = "StreamDAOD_BPHY21"
13 
14 def BPHY21Cfg(flags):
15  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
16  from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
17  acc = ComponentAccumulator()
18  isSimulation = flags.Input.isMC
19  V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
20  vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName)) # VKalVrt vertex fitter
21  acc.addPublicTool(vkalvrt)
22  acc.addPublicTool(V0Tools)
23  trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
24  acc.addPublicTool(trackselect)
25  vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
26  acc.addPublicTool(vpest)
27 
28  BPHY21_AugOriginalCounts = CompFactory.DerivationFramework.AugOriginalCounts(
29  name = "BPHY21_AugOriginalCounts",
30  VertexContainer = "PrimaryVertices",
31  TrackContainer = "InDetTrackParticles")
32  #====================================================================
33  # TriggerCounting for Kernel1
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, # Only takes effect if combOnly=True
67  muonCollectionKey = "Muons",
68  TrackParticleCollection = "InDetTrackParticles",
69  V0VertexFitterTool = None, # V0 vertex fitter
70  useV0Fitter = False, # if False a TrkVertexFitterTool will be used
71  TrkVertexFitterTool = vkalvrt, # VKalVrt vertex fitter
72  TrackSelectorTool = trackselect,
73  VertexPointEstimator = vpest,
74  useMCPCuts = False)
75  acc.addPublicTool(BPHY21_JpsiFinder)
76  BPHY21_JpsiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
77  name = "BPHY21_JpsiSelectAndWrite",
78  VertexSearchTool = BPHY21_JpsiFinder,
79  OutputVtxContainerName = "BPHY21_JpsiCandidates",
80  V0Tools = V0Tools,
81  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
82  PVContainerName = "PrimaryVertices",
83  RefPVContainerName = "SHOULDNOTBEUSED",
84  DoVertexType = 1)
85  BPHY21_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
86  name = "BPHY21_Select_Jpsi2mumu",
87  HypothesisName = "Jpsi",
88  InputVtxContainerName = "BPHY21_JpsiCandidates",
89  V0Tools = V0Tools,
90  VtxMassHypo = 3096.900,
91  MassMin = 2600.0,
92  MassMax = 3600.0,
93  Chi2Max = 200,
94  LxyMin = 0.1,
95  DoVertexType = 1)
96 
97  if not isSimulation: #Only Skim Data
98  BPHY21_TriggerSkim = CompFactory.DerivationFramework.TriggerSkimmingTool(name = "BPHY21_TriggerSkim",
99  TriggerListOR = BPHY21_triggerList)
100  BPHY21_SelectJpsiEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(
101  name = "BPHY21_SelectJpsiEvent",
102  expression = "count(BPHY21_JpsiCandidates.passed_Jpsi) > 0")
103 
104  BPHY21_SkimmingOR = CompFactory.DerivationFramework.FilterCombinationOR("BPHY21_SkimmingOR",
105  FilterList = [ BPHY21_TriggerSkim, BPHY21_SelectJpsiEvent] )
106  acc.addPublicTool(BPHY21_SelectJpsiEvent)
107  acc.addPublicTool(BPHY21_TriggerSkim)
108  acc.addPublicTool(BPHY21_SkimmingOR)
109 
110  augTools = [BPHY21_JpsiSelectAndWrite, BPHY21_Select_Jpsi2mumu, BPHY21_AugOriginalCounts]
111  for t in augTools : acc.addPublicTool(t)
112  acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY21Kernel",
113  AugmentationTools = augTools,
114  #Only skim if not MC
115  SkimmingTools = [BPHY21_SkimmingOR] if not isSimulation else [],
116  ThinningTools = []))
117  #====================================================================
118  # Slimming
119  #====================================================================
120  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
121  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
122  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
123  BPHY21_SlimmingHelper = SlimmingHelper("BPHY21_SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
124  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
125  BPHY21_AllVariables = getDefaultAllVariables()
126  BPHY21_StaticContent = []
127 
128  # Needed for trigger objects
129  BPHY21_SlimmingHelper.IncludeMuonTriggerContent = True
130  BPHY21_SlimmingHelper.IncludeBPhysTriggerContent = True
131 
132 
133  BPHY21_AllVariables += ["PrimaryVertices"]
134  BPHY21_StaticContent += ["xAOD::VertexContainer#BPHY21_RefittedPrimaryVertices"]
135  BPHY21_StaticContent += ["xAOD::VertexAuxContainer#BPHY21_RefittedPrimaryVerticesAux."]
136 
137 
138  BPHY21_AllVariables += ["InDetTrackParticles"]
139 
140 
143  BPHY21_AllVariables += ["CombinedMuonTrackParticles"]
144  BPHY21_AllVariables += ["ExtrapolatedMuonTrackParticles"]
145 
146 
147  BPHY21_AllVariables += ["Muons"]
148 
149 
150 
151  BPHY21_StaticContent += ["xAOD::VertexContainer#%s" % BPHY21_JpsiSelectAndWrite.OutputVtxContainerName]
152 
153  BPHY21_StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY21_JpsiSelectAndWrite.OutputVtxContainerName]
154 
155 
156  # Tagging information (in addition to that already requested by usual algorithms)
157  #AllVariables += ["GSFTrackParticles", "MuonSpectrometerTrackParticles" ]
158 
159  # Added by ASC
160  # Truth information for MC only
161  if isSimulation:
162  BPHY21_AllVariables += ["TruthEvents","TruthParticles","TruthVertices","MuonTruthParticles"]
163 
164 
165  BPHY21_AllVariables = list(set(BPHY21_AllVariables)) # remove duplicates
166  BPHY21_SlimmingHelper.AllVariables = BPHY21_AllVariables
167  BPHY21_SlimmingHelper.StaticContent = BPHY21_StaticContent
168  acc.merge(OutputStreamCfg(flags, "DAOD_BPHY21", ItemList=BPHY21_SlimmingHelper.GetItemList(), AcceptAlgs=["BPHY21Kernel"]))
169  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY21", AcceptAlgs=["BPHY21Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
170  acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True, printComponentsOnly=False)
171  return acc
python.HIGG1D1CustomVertexConfig.PrimaryVertexRefittingToolCfg
def PrimaryVertexRefittingToolCfg(flags, **kwargs)
Definition: HIGG1D1CustomVertexConfig.py:7
BPHY21.BPHY21Cfg
def BPHY21Cfg(flags)
Definition: BPHY21.py:14
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
commonBPHYMethodsCfg.BPHY_TrkVKalVrtFitterCfg
def BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName, **kwargs)
Definition: commonBPHYMethodsCfg.py:6
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
commonBPHYMethodsCfg.BPHY_V0ToolCfg
def BPHY_V0ToolCfg(flags, BPHYDerivationName)
Definition: commonBPHYMethodsCfg.py:11
python.InDetConversionFinderToolsConfig.BPHY_VertexPointEstimatorCfg
def BPHY_VertexPointEstimatorCfg(flags, name="BPHY_VertexPointEstimator", **kwargs)
Definition: InDetConversionFinderToolsConfig.py:69
commonBPHYMethodsCfg.getDefaultAllVariables
def getDefaultAllVariables()
Definition: commonBPHYMethodsCfg.py:32
python.InDetTrackSelectorToolConfig.BPHY_InDetDetailedTrackSelectorToolCfg
def BPHY_InDetDetailedTrackSelectorToolCfg(flags, name='BPHY_InDetDetailedTrackSelectorTool', **kwargs)
Definition: InDetTrackSelectorToolConfig.py:215
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:216
SlimmingHelper
Definition: SlimmingHelper.py:1