17def HIGG1D2KernelCfg(flags, name='HIGG1D2Kernel', **kwargs):
18 """Configure the derivation framework driving algorithm (kernel) for HIGG1D2"""
19 acc = ComponentAccumulator()
20
21
22 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
23 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
24
25
26 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
27 CaloDecoratorKernelCfg)
28 acc.merge(CaloDecoratorKernelCfg(flags))
29
30
31 from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg, MuonTrackParticleThinningCfg
32 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import GenericTruthThinningCfg
33
34
35
36 HIGG1D2_thinning_expression = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm && InDetTrackParticles.pt > 10*GeV"
37
38 HIGG1D2TrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
39 flags,
40 name = "HIGG1D2TrackParticleThinningTool",
41 StreamName = kwargs['StreamName'],
42 SelectionString = HIGG1D2_thinning_expression,
43 InDetTrackParticlesKey = "InDetTrackParticles"))
44
45
46 HIGG1D2MuonTPThinningTool = acc.getPrimaryAndMerge(
47 MuonTrackParticleThinningCfg(
48 flags,
49 name = "HIGG1D2MuonTPThinningTool",
50 StreamName = kwargs['StreamName'],
51 MuonKey = "Muons",
52 InDetTrackParticlesKey = "InDetTrackParticles"
53 )
54 )
55
56
57 HIGG1D2ElectronTPThinningTool = (
58 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
59 name = "HIGG1D2ElectronTPThinningTool",
60 StreamName = kwargs['StreamName'],
61 SGKey = "Electrons",
62 BestMatchOnly = False
63 )
64 )
65 acc.addPublicTool(HIGG1D2ElectronTPThinningTool)
66
67
68 HIGG1D2PhotonTPThinningTool = (
69 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
70 name = "HIGG1D2PhotonTPThinningTool",
71 StreamName = kwargs['StreamName'],
72 SGKey = "Photons",
73 GSFConversionVerticesKey = "GSFConversionVertices",
74 BestMatchOnly = False
75 )
76 )
77 acc.addPublicTool(HIGG1D2PhotonTPThinningTool)
78
79
80 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import CaloClusterThinningCfg
81
82 HIGG1D2CCTCThinningTool = acc.getPrimaryAndMerge(
83 CaloClusterThinningCfg(
84 flags,
85 name = "HIGG1D2CCTCThinningTool",
86 StreamName = kwargs['StreamName'],
87 SGKey = "Electrons",
88 SelectionString = "Electrons.pt>4*GeV",
89 TopoClCollectionSGKey = "CaloCalTopoClusters",
90 ConeSize = 0.5
91 )
92 )
93
94 thinningTools = [HIGG1D2TrackParticleThinningTool,
95 HIGG1D2MuonTPThinningTool,
96 HIGG1D2ElectronTPThinningTool,
97 HIGG1D2PhotonTPThinningTool,
98 HIGG1D2CCTCThinningTool]
99
100
101 from DerivationFrameworkEGamma.EGammaToolsConfig import PhotonVertexSelectionWrapperKernelCfg
102 acc.merge(PhotonVertexSelectionWrapperKernelCfg(flags))
103
104
105 if flags.Input.isMC :
106 truth_cond_1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"
107 truth_cond_2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))"
108 truth_cond_3 = "((abs(TruthParticles.pdgId) == 6))"
109 truth_cond_4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))"
110 truth_cond_finalState = '(TruthParticles.isGenStable)'
111 truth_expression = '('+truth_cond_1+' || '+truth_cond_2 +' || '+truth_cond_3 +' || '+truth_cond_4+') || ('+truth_cond_finalState+')'
112
113 HIGG1D2GenericTruthThinningTool = acc.getPrimaryAndMerge(GenericTruthThinningCfg(
114 flags,
115 name = "HIGG1D2GenericTruthThinningTool",
116 StreamName = kwargs['StreamName'],
117 ParticleSelectionString = truth_expression,
118 PreserveDescendants = False,
119 PreserveGeneratorDescendants = True,
120 PreserveAncestors = True))
121 acc.addPublicTool(HIGG1D2GenericTruthThinningTool)
122 thinningTools.append(HIGG1D2GenericTruthThinningTool)
123
124
125 from DerivationFrameworkHiggs.SkimmingToolHIGG1Config import SkimmingToolHIGG1Cfg
126 from DerivationFrameworkHiggs.HIGG1TriggerContent import expressionTriggers, mergedTriggers
127
128 SkipTriggerRequirement = flags.Input.isMC or not flags.Reco.EnableTrigger
129 TriggerExp = []
130 TriggerMerged = []
131
132 if not SkipTriggerRequirement:
133
134 MenuType = None
135 if float(flags.Beam.Energy) == 6500000.0:
136
137 MenuType = "Run2"
138 elif float(flags.Beam.Energy) == 6800000.0:
139
140 MenuType = "Run3"
141
142 TriggerExp = expressionTriggers[MenuType]
143 TriggerMerged = mergedTriggers[MenuType]
144
145
146 from ROOT import egammaPID
147
148 MergedElectronIsEM = CompFactory.AsgElectronIsEMSelector("MergedElectronIsEM")
149 MergedElectronIsEM.ConfigFile = "ElectronPhotonSelectorTools/trigger/rel21_20161021/ElectronIsEMMergedTightSelectorCutDefs.conf"
150 MergedElectronIsEM.isEMMask = egammaPID.ElectronTightHLT
151 acc.addPublicTool(MergedElectronIsEM)
152
153
154 skimmingTool = acc.popToolsAndMerge( SkimmingToolHIGG1Cfg(flags,
155 name = "HIGG1D2SkimmingTool",
156 RequireGRL = False,
157 ReqireLArError = True,
158 RequireTrigger = not SkipTriggerRequirement,
159 IncludeDoublePhotonPreselection = False,
160 RequirePreselection = False,
161 RequireKinematic = False,
162 RequireQuality = False,
163 RequireIsolation = False,
164 RequireInvariantMass = False,
165 Triggers = TriggerExp,
166 MergedElectronTriggers = TriggerMerged,
167 IncludeSingleElectronPreselection = False,
168 IncludeDoubleElectronPreselection = False,
169 IncludeSingleMuonPreselection = False,
170 IncludePhotonDoubleElectronPreselection = True,
171 IncludeDoubleMuonPreselection = True,
172 IncludePhotonMergedElectronPreselection = True,
173 IncludeHighPtPhotonElectronPreselection = True,
174 MinimumPhotonPt = 9.9*GeV,
175 MinimumElectronPt = 4.4*GeV,
176 MinimumMergedElectronPt = 18*GeV,
177 MinimumMuonPt = 2.9*GeV,
178 MaxMuonEta = 2.7,
179 RemoveCrack = False,
180 MaxEta = 2.5,
181 MergedElectronCutTool = MergedElectronIsEM))
182
183 acc.addPublicTool(skimmingTool)
184
185
186 from DerivationFrameworkHiggs.MergedElectronConfig import MergedElectronDetailsDecoratorCfg
187 HIGG1D2MergedElectronDetailsDecorator = acc.getPrimaryAndMerge(MergedElectronDetailsDecoratorCfg(flags,
188 name = "HIGG1D2MergedElectronDetailsDecorator"))
189 augmentationTools = [HIGG1D2MergedElectronDetailsDecorator]
190
191
193 from IsolationSelection.IsolationSelectionConfig import IsoCloseByAlgsCfg
194 contNames = ["Muons", "Electrons", "Photons"]
195 acc.merge(IsoCloseByAlgsCfg(flags, suff = "_HIGG1D2", isPhysLite = False, containerNames = contNames, stream_name = kwargs['StreamName']))
196
197
198 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
199 acc.addEventAlgo(DerivationKernel(name,
200 SkimmingTools = [skimmingTool],
201 ThinningTools = thinningTools,
202 AugmentationTools = augmentationTools))
203 return acc
204
205