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
6from AnalysisAlgorithmsConfig.ConfigAccumulator import DataType
7
8class SSVWeightsAlgConfig(ConfigBlock):
9
10 def __init__ (self) :
11 super (SSVWeightsAlgConfig, self).__init__ ()
12 self.addDependency('EventSelection', required=False)
13 self.addDependency('EventSelectionMerger', required=False)
14 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")
15 self.addOption('electrons', None, type = str, info = "electron container that will be used to define the good SSVs (ΔR(SSV,electron)>0.2)")
16 self.addOption('muons', None, type = str, info = "muon container that will be used to define the good SSVs (ΔR(SSV,muon)>0.2)")
17 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'")
18 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")
19 self.addOption("BTaggingWP", "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")
20 self.addOption("EfficiencyMethod", "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'")
21 self.addOption("nFMethod", "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'")
22 self.addOption("OutputVariableSize", "standard", type = str, info ="number of variables that will be saved to the output, string can be 'standard','extended','additional' or 'all'")
23
24 def makeAlgs(self, config):
25 #Algorithm is Monte Carlo only -> skip algorithm if it is run on Data
26 if config.dataType() == DataType.Data:
27 return
28
29 alg = config.createAlgorithm('CP::SSVWeightsAlg', 'SSVWeightsAlg')
30
31 jetContainer, sep, jetSelectionName = self.jets.partition('.')
32 alg.jetSelection = config.getFullSelection(jetContainer, jetSelectionName)
33 alg.jets = config.readName(jetContainer)
34
35 electronContainer, sep, electronSelectionName = self.electrons.partition('.')
36 alg.electronSelection = config.getFullSelection(electronContainer, electronSelectionName)
37 alg.electrons = config.readName(electronContainer)
38
39 muonContainer, sep, muonSelectionName = self.muons.partition('.')
40 alg.muonSelection = config.getFullSelection(muonContainer, muonSelectionName)
41 alg.muons = config.readName(muonContainer)
42
43 print("Py:SSVWeightsAlg ","You run with the following jet selections: ", alg.jetSelection)
44 print("Py:SSVWeightsAlg ","You run with the following electron selections: ", alg.electronSelection)
45 print("Py:SSVWeightsAlg ","You run with the following muon selections: ", alg.muonSelection)
46
47 alg.NVSI_WP = self.NVSI_WP
48 alg.JsonConfigFile_SSVWeightsAlg = self.JsonConfigFile_SSVWeightsAlg
49 alg.BTaggingWP = self.BTaggingWP
50 alg.EfficiencyMethod = self.EfficiencyMethod
51 alg.nFMethod = self.nFMethod
52 alg.OutputVariableSize = self.OutputVariableSize
53
54 config.addOutputVar('EventInfo', 'SSV_weight_%SYS%', 'SSV_weight')
55
56 if alg.OutputVariableSize in ["extended", "additional", "all"] :
57 config.addOutputVar('EventInfo', 'P_eff_%SYS%', 'P_eff')
58 config.addOutputVar('EventInfo', 'P_ineff_%SYS%', 'P_ineff')
59 config.addOutputVar('EventInfo', 'P_fake_%SYS%', 'P_fake')
60
61 if alg.OutputVariableSize in ["additional", "all"] :
62 config.addOutputVar('EventInfo', 'N_matched_%SYS%', 'N_matched')
63 config.addOutputVar('EventInfo', 'N_missed_%SYS%', 'N_missed')
64 config.addOutputVar('EventInfo', 'N_fake_%SYS%', 'N_fake')
65 config.addOutputVar('EventInfo', 'number_of_bjets_%SYS%', 'number_of_bjets')
66 config.addOutputVar('EventInfo', 'number_of_accepted_Bhadrons_%SYS%', 'number_of_accepted_Bhadrons')
67 config.addOutputVar('EventInfo', 'number_of_good_SSVs_%SYS%', 'number_of_good_SSVs')
68
69 if alg.OutputVariableSize == "all":
70 config.addOutputVar('EventInfo', 'P_ineff_bjet_based_%SYS%', 'P_ineff_bjet_based')
71 config.addOutputVar('EventInfo', 'P_ineff_pt_eta_based_%SYS%', 'P_ineff_pt_eta_based')
72 config.addOutputVar('EventInfo', 'P_fake_pileup_bjet_based_%SYS%', 'P_fake_pileup_bjet_based')
73 config.addOutputVar('EventInfo', 'P_fake_pileup_based_linearfit_%SYS%', 'P_fake_pileup_based_linearfit')
74 config.addOutputVar('EventInfo', 'P_fake_pileup_based_binned_%SYS%', 'P_fake_pileup_based_binned')
void print(char *figname, TCanvas *c1)