ATLAS Offline Software
Loading...
Searching...
No Matches
SSVWeightsAlgConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3# @author Hagen Möbius, hagen.mobius@cern.ch
4
5from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
6
7class SSVWeightsAlgConfig(ConfigBlock):
8
9 def __init__ (self) :
10 super (SSVWeightsAlgConfig, self).__init__ ()
11 self.addOption('jets', None, type = str, info = "jet container that will be used to define the good SSVs (ΔR(SSV,jet)>0.6) and the truth b-hadrons in acceptance (ΔR(truthBh,jet)>0.6) and that will be used to count the number of b-jets for b-jet based SSV weight calculation")
12 self.addOption('electrons', None, type = str, info = "electron container that will be used to define the good SSVs (ΔR(SSV,electron)>0.2)")
13 self.addOption('muons', None, type = str, info = "muon container that will be used to define the good SSVs (ΔR(SSV,muon)>0.2)")
14 self.addOption('NVSI_WP', "NVSI_SecVrt_Tight", type = str, info = "Working point of the NewVrtSecInclusiveTool (algorithm that constructs the soft secondary vertices); possible working points are 'NVSI_SecVrt_Tight','NVSI_SecVrt_Medium','NVSI_SecVrt_Loose'")
15 self.addOption("JsonConfigFile_SSVWeightsAlg", None, type = str, info ="Path to the JSON config file that contains the SSV calibration results which are needed to calculate the SSV weights")
16 self.addOption("BTagging_WP", "ftag_select_GN2v01_FixedCutBEff_85" , type = str, info = "b-tagging working point that is used to count the number of b-jets in the event for b-jet based SSV weight calculation")
17 self.addOption("OverlapRemoval", None, type = str, info = "string that will be used in the overlap removal accessor for jets, electrons and muons; empty string means no overlap removal will be applied")
18 self.addOption("Jvt", None, type = str, info = "string that will be used in the jvt accessor for jets; empty string means no jvt selection will be applied")
19 self.addOption("efficiency_Method", "Bhadron_pT_eta_based", type = str, info = "efficiency definition that will be used to calculate the SSV weights, string can be 'Bhadron_pT_eta_based' or 'bjet_based'")
20 self.addOption("nF_Method", "pileup_based_binned", type = str, info = "average number of fake SSV definition that will be used to calculate the SSV weights, string can be 'pileup_bjet_based','pileup_based_linearfit' or 'pileup_based_binned'")
21 self.addOption("OutputVariable_Size", "standard", type = str, info ="number of variables that will be saved to the output, string can be 'standard','extended','additional' or 'all'")
22
23 def makeAlgs(self, config):
24 alg = config.createAlgorithm('CP::SSVWeightsAlg', 'SSVWeightsAlg')
25
26 jets = config.readName(self.jets)
27 electrons = config.readName(self.electrons)
28 muons = config.readName(self.muons)
29
30 alg.jets = jets
31 alg.electrons = electrons
32 alg.muons = muons
33 alg.NVSI_WP = self.NVSI_WP
34 alg.JsonConfigFile_SSVWeightsAlg = self.JsonConfigFile_SSVWeightsAlg
35 alg.BTagging_WP = self.BTagging_WP
36 alg.OverlapRemoval = self.OverlapRemoval
37 alg.Jvt = self.Jvt
38 alg.efficiency_Method = self.efficiency_Method
39 alg.nF_Method = self.nF_Method
40 alg.OutputVariable_Size = self.OutputVariable_Size
41
42 config.addOutputVar('EventInfo', 'SSV_weight_%SYS%', 'SSV_weight')
43
44 if alg.OutputVariable_Size in ["extended", "additional", "all"] :
45 config.addOutputVar('EventInfo', 'P_eff_%SYS%', 'P_eff')
46 config.addOutputVar('EventInfo', 'P_ineff_%SYS%', 'P_ineff')
47 config.addOutputVar('EventInfo', 'P_fake_%SYS%', 'P_fake')
48
49 if alg.OutputVariable_Size in ["additional", "all"] :
50 config.addOutputVar('EventInfo', 'N_matched_%SYS%', 'N_matched')
51 config.addOutputVar('EventInfo', 'N_missed_%SYS%', 'N_missed')
52 config.addOutputVar('EventInfo', 'N_fake_%SYS%', 'N_fake')
53 config.addOutputVar('EventInfo', 'number_of_bjets_%SYS%', 'number_of_bjets','number of b-jets in an event')
54 config.addOutputVar('EventInfo', 'number_of_accepted_Bhadrons_%SYS%', 'number_of_accepted_Bhadrons')
55 config.addOutputVar('EventInfo', 'number_of_good_SSVs_%SYS%', 'number_of_good_SSVs')
56
57 if alg.OutputVariable_Size == "all":
58 config.addOutputVar('EventInfo', 'P_ineff_bjet_based_%SYS%', 'P_ineff_bjet_based')
59 config.addOutputVar('EventInfo', 'P_ineff_pt_eta_based_%SYS%', 'P_ineff_pt_eta_based')
60 config.addOutputVar('EventInfo', 'P_fake_pileup_bjet_based_%SYS%', 'P_fake_pileup_bjet_based')
61 config.addOutputVar('EventInfo', 'P_fake_pileup_based_linearfit_%SYS%', 'P_fake_pileup_based_linearfit')
62 config.addOutputVar('EventInfo', 'P_fake_pileup_based_binned_%SYS%', 'P_fake_pileup_based_binned')