9def PhysCommonThinningCfg(flags, StreamName = "StreamDAOD_PHYS", **kwargs):
10 """Configure the common augmentation"""
11 acc = ComponentAccumulator()
12
13
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
20
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
31 if "MuonTPThinningToolName" in kwargs:
32 acc.merge(MuonTrackParticleThinningCfg(
33 flags,
34 name = kwargs['MuonTPThinningToolName'],
35 StreamName = StreamName,
36 MuonKey = "Muons",
37 InDetTrackParticlesKey = "InDetTrackParticles"))
38
39
40 if "TauJetThinningToolName" in kwargs:
41 tau_thinning_expression = f"TauJets.pt >= {flags.Tau.MinPtDAOD} && TauJets.nTracks <= {flags.Tau.MaxTracksDAOD}"
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
77 if "DiTauThinningToolName" in kwargs:
78 acc.merge(GenericObjectThinningCfg(
79 flags,
80 name = kwargs['DiTauThinningToolName'],
81 StreamName = StreamName,
82 ContainerName = "DiTauJets",
83 SelectionString = "DiTauJets.nSubjets > 1 && abs(DiTauJets.charge) < 3"))
84
85
86 if "DiTauTPThinningToolName" in kwargs:
87 acc.merge(DiTauTrackParticleThinningCfg(
88 flags,
89 name = kwargs['DiTauTPThinningToolName'],
90 StreamName = StreamName,
91 DiTauKey = "DiTauJets",
92 InDetTrackParticlesKey = "InDetTrackParticles",
93 SelectionString = "DiTauJets.nSubjets > 1 && abs(DiTauJets.charge) < 3"))
94
95
96 if "DiTauLowPtThinningToolName" in kwargs:
97 acc.merge(GenericObjectThinningCfg(
98 flags,
99 name = kwargs['DiTauLowPtThinningToolName'],
100 StreamName = StreamName,
101 ContainerName = "DiTauJetsLowPt",
102 SelectionString = "DiTauJetsLowPt.nSubjets > 1 && (DiTauJetsLowPt.charge == 0 || abs(DiTauJetsLowPt.charge) == 2)"))
103
104
105 if "DiTauLowPtTPThinningToolName" in kwargs:
106 acc.merge(DiTauTrackParticleThinningCfg(
107 flags,
108 name = kwargs['DiTauLowPtTPThinningToolName'],
109 StreamName = StreamName,
110 DiTauKey = "DiTauJetsLowPt",
111 InDetTrackParticlesKey = "InDetTrackParticles",
112 SelectionString = "DiTauJetsLowPt.nSubjets > 1 && (DiTauJetsLowPt.charge == 0 || abs(DiTauJetsLowPt.charge) == 2)"))
113
114
115 if "ElectronCaloClusterThinningToolName" in kwargs:
116 acc.merge(CaloClusterThinningCfg(
117 flags,
118 name = kwargs['ElectronCaloClusterThinningToolName'],
119 StreamName = StreamName,
120 SGKey = "AnalysisElectrons",
121 CaloClCollectionSGKey = "egammaClusters",
122 ConeSize = -1.0))
123
124
125 if "PhotonCaloClusterThinningToolName" in kwargs:
126 acc.merge(CaloClusterThinningCfg(
127 flags,
128 name = kwargs['PhotonCaloClusterThinningToolName'],
129 StreamName = StreamName,
130 SGKey = "AnalysisPhotons",
131 CaloClCollectionSGKey = "egammaClusters",
132 ConeSize=-1.0))
133
134
135 if "ElectronGSFTPThinningToolName" in kwargs:
136 ElectronGSFTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
137 name = kwargs['ElectronGSFTPThinningToolName'],
138 StreamName = StreamName,
139 SGKey = "AnalysisElectrons",
140 GSFTrackParticlesKey = "GSFTrackParticles",
141 InDetTrackParticlesKey = "",
142 BestMatchOnly = True)
143 acc.addPublicTool(ElectronGSFTPThinningTool)
144
145
146 if "PhotonGSFTPThinningToolName" in kwargs:
147 PhotonGSFTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
148 name = kwargs['PhotonGSFTPThinningToolName'],
149 StreamName = StreamName,
150 SGKey = "AnalysisPhotons",
151 GSFTrackParticlesKey = "GSFTrackParticles",
152 GSFConversionVerticesKey = "GSFConversionVertices",
153 InDetTrackParticlesKey = "",
154 BestMatchOnly = True,
155 BestVtxMatchOnly = True)
156 acc.addPublicTool(PhotonGSFTPThinningTool)
157
158 return acc
159