ATLAS Offline Software
PhysCommonThinningConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 # PhysCommonThinningConfig
4 # Contains the configuration for the thinning for PHYS(LITE)
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 
9 def PhysCommonThinningCfg(flags, StreamName = "StreamDAOD_PHYS", **kwargs):
10  """Configure the common augmentation"""
11  acc = ComponentAccumulator()
12 
13  # Thinning tools...
14  from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, DiTauTrackParticleThinningCfg
15  from DerivationFrameworkTools.DerivationFrameworkToolsConfig import GenericObjectThinningCfg
16  from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import CaloClusterThinningCfg
17  from DerivationFrameworkTau.TauCommonConfig import TauThinningCfg
18 
19  # Inner detector group recommendations for indet tracks in analysis
20  # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/DaodRecommendations
21  if "TrackParticleThinningToolName" in kwargs:
22  tp_thinning_expression = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm && InDetTrackParticles.pt > 10*GeV"
23  acc.merge(TrackParticleThinningCfg(
24  flags,
25  name = kwargs['TrackParticleThinningToolName'],
26  StreamName = StreamName,
27  SelectionString = tp_thinning_expression,
28  InDetTrackParticlesKey = "InDetTrackParticles"))
29 
30  # Include inner detector tracks associated with muons
31  if "MuonTPThinningToolName" in kwargs:
33  flags,
34  name = kwargs['MuonTPThinningToolName'],
35  StreamName = StreamName,
36  MuonKey = "Muons",
37  InDetTrackParticlesKey = "InDetTrackParticles"))
38 
39  # Tau-related containers: taus, tau tracks and associated ID tracks, neutral PFOs, secondary vertices
40  if "TauJetThinningToolName" in kwargs:
41  tau_thinning_expression = f"TauJets.pt >= {flags.Tau.MinPtDAOD}"
42  acc.merge(TauThinningCfg(flags,
43  name = kwargs['TauJetThinningToolName'],
44  StreamName = StreamName,
45  Taus = "TauJets",
46  TauTracks = "TauTracks",
47  TrackParticles = "InDetTrackParticles",
48  TauNeutralPFOs = "TauNeutralParticleFlowObjects",
49  TauSecondaryVertices = "TauSecondaryVertices",
50  SelectionString = tau_thinning_expression))
51 
52  if "TauJets_MuonRMThinningToolName" in kwargs:
53  tau_murm_thinning_expression = tau_thinning_expression.replace('TauJets', 'TauJets_MuonRM')
54  acc.merge(TauThinningCfg(flags,
55  name = kwargs['TauJets_MuonRMThinningToolName'],
56  StreamName = StreamName,
57  Taus = "TauJets_MuonRM",
58  TauTracks = "TauTracks_MuonRM",
59  TrackParticles = "InDetTrackParticles",
60  TauNeutralPFOs = "TauNeutralParticleFlowObjects_MuonRM",
61  TauSecondaryVertices = "TauSecondaryVertices_MuonRM",
62  SelectionString = tau_murm_thinning_expression))
63 
64  if "TauJets_EleRMThinningToolName" in kwargs:
65  tau_erm_thinning_expression = tau_thinning_expression.replace('TauJets', 'TauJets_EleRM')
66  acc.merge(TauThinningCfg(flags,
67  name = kwargs['TauJets_EleRMThinningToolName'],
68  StreamName = StreamName,
69  Taus = "TauJets_EleRM",
70  TauTracks = "TauTracks_EleRM",
71  TrackParticles = "InDetTrackParticles",
72  TauNeutralPFOs = "TauNeutralParticleFlowObjects_EleRM",
73  TauSecondaryVertices = "TauSecondaryVertices_EleRM",
74  SelectionString = tau_erm_thinning_expression))
75 
76  # ID tracks associated with high-pt di-tau
77  if "DiTauTPThinningToolName" in kwargs:
79  flags,
80  name = kwargs['DiTauTPThinningToolName'],
81  StreamName = StreamName,
82  DiTauKey = "DiTauJets",
83  InDetTrackParticlesKey = "InDetTrackParticles"))
84 
85 
86  if "DiTauLowPtThinningToolName" in kwargs:
87  acc.merge(GenericObjectThinningCfg(
88  flags,
89  name = kwargs['DiTauLowPtThinningToolName'],
90  StreamName = StreamName,
91  ContainerName = "DiTauJetsLowPt",
92  SelectionString = "DiTauJetsLowPt.nSubjets > 1"))
93 
94  # ID tracks associated with low-pt ditau
95  if "DiTauLowPtTPThinningToolName" in kwargs:
97  flags,
98  name = kwargs['DiTauLowPtTPThinningToolName'],
99  StreamName = StreamName,
100  DiTauKey = "DiTauJetsLowPt",
101  InDetTrackParticlesKey = "InDetTrackParticles",
102  SelectionString = "DiTauJetsLowPt.nSubjets > 1"))
103 
104  # keep calo clusters around electrons
105  if "ElectronCaloClusterThinningToolName" in kwargs:
106  acc.merge(CaloClusterThinningCfg(
107  flags,
108  name = kwargs['ElectronCaloClusterThinningToolName'],
109  StreamName = StreamName,
110  SGKey = "AnalysisElectrons",
111  CaloClCollectionSGKey = "egammaClusters",
112  ConeSize = -1.0))
113 
114  # keep calo clusters around photons
115  if "PhotonCaloClusterThinningToolName" in kwargs:
116  acc.merge(CaloClusterThinningCfg(
117  flags,
118  name = kwargs['PhotonCaloClusterThinningToolName'],
119  StreamName = StreamName,
120  SGKey = "AnalysisPhotons",
121  CaloClCollectionSGKey = "egammaClusters",
122  ConeSize=-1.0))
123 
124  # GSF tracks associated to electrons
125  if "ElectronGSFTPThinningToolName" in kwargs:
126  ElectronGSFTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
127  name = kwargs['ElectronGSFTPThinningToolName'],
128  StreamName = StreamName,
129  SGKey = "AnalysisElectrons",
130  GSFTrackParticlesKey = "GSFTrackParticles",
131  InDetTrackParticlesKey = "",
132  BestMatchOnly = True)
133  acc.addPublicTool(ElectronGSFTPThinningTool)
134 
135  # GSF tracks associated to photons
136  if "PhotonGSFTPThinningToolName" in kwargs:
137  PhotonGSFTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
138  name = kwargs['PhotonGSFTPThinningToolName'],
139  StreamName = StreamName,
140  SGKey = "AnalysisPhotons",
141  GSFTrackParticlesKey = "GSFTrackParticles",
142  GSFConversionVerticesKey = "GSFConversionVertices",
143  InDetTrackParticlesKey = "",
144  BestMatchOnly = True,
145  BestVtxMatchOnly = True)
146  acc.addPublicTool(PhotonGSFTPThinningTool)
147 
148  return acc
149 
DerivationFrameworkCaloConfig.CaloClusterThinningCfg
def CaloClusterThinningCfg(flags, **kwargs)
Definition: DerivationFrameworkCaloConfig.py:98
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.PhysCommonThinningConfig.PhysCommonThinningCfg
def PhysCommonThinningCfg(flags, StreamName="StreamDAOD_PHYS", **kwargs)
Definition: PhysCommonThinningConfig.py:9
python.InDetToolsConfig.TrackParticleThinningCfg
def TrackParticleThinningCfg(flags, name, **kwargs)
Definition: InDetToolsConfig.py:458
python.InDetToolsConfig.DiTauTrackParticleThinningCfg
def DiTauTrackParticleThinningCfg(flags, name, **kwargs)
Definition: InDetToolsConfig.py:549
python.DerivationFrameworkToolsConfig.GenericObjectThinningCfg
def GenericObjectThinningCfg(ConfigFlags, name, **kwargs)
Definition: DerivationFrameworkToolsConfig.py:20
python.InDetToolsConfig.MuonTrackParticleThinningCfg
def MuonTrackParticleThinningCfg(flags, name, **kwargs)
Definition: InDetToolsConfig.py:528
python.TauCommonConfig.TauThinningCfg
def TauThinningCfg(flags, name, **kwargs)
Definition: TauCommonConfig.py:197