ConfigurationSettings.cxx 65.7 KB
Newer Older
1
/*
2
   Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Tomas Dado's avatar
Tomas Dado committed
3
 */
4
5
6
7
8
9
10
11
12
13
14

#include "TopConfiguration/ConfigurationSettings.h"

#include <algorithm>
#include <cstdlib>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim_all.hpp>
15
16
17
18
19
#include <boost/algorithm/string/join.hpp>

#include "TopConfiguration/MsgCategory.h"

using namespace TopConfiguration;
20
21

namespace top {
Tomas Dado's avatar
Tomas Dado committed
22
  ConfigurationSettings* ConfigurationSettings::m_instance = 0;
23

Tomas Dado's avatar
Tomas Dado committed
24
  ConfigurationSettings::ConfigurationSettings() : m_configured(false) {
25
    registerParameter("ElectronCollectionName", "Name of the Electron container");
26
27
    registerParameter("FwdElectronCollectionName",
                      "Name of the Forward Electrons container, ForwardElectrons or None (default)", "None");
28
29
30
31
    registerParameter("MuonCollectionName", "Name of the Muon container");
    registerParameter("PhotonCollectionName", "Name of the Photon container");
    registerParameter("JetCollectionName", "Name of the Jet container");
    registerParameter("LargeJetCollectionName", "Name of the large-R Jet container");
32
    registerParameter("LargeJetSubstructure", "Setup to use when applying grooming on the large-R jet", "None");
Tomas Dado's avatar
Tomas Dado committed
33
    registerParameter("TrackJetCollectionName", "Name of the track Jet container", "None");
aknue's avatar
aknue committed
34
    registerParameter("TrackCollectionName", "Name of the track container", "None");
35
    registerParameter("TauCollectionName", "Name of the Tau container");
36
37
    registerParameter("JetGhostTrackDecoName", "Name of the jet decoration that holds the ghost-associated track.",
                      "None");
38
39

    registerParameter("TruthCollectionName", "Name of the Truth container");
Tomas Dado's avatar
Tomas Dado committed
40
    registerParameter("TruthElectronCollectionName", "Name of the Truth Electron container", "TruthElectrons");
41
42
43
44
45
    registerParameter("TruthMuonCollectionName", "Name of the Truth Muon container", "TruthMuons");
    registerParameter("TruthPhotonCollectionName", "Name of the Truth Photon container", "None");
    registerParameter("TruthMETCollectionName", "Name of the Truth MET container", "MET_Truth");
    registerParameter("TruthJetCollectionName", "Name of the Truth Jet container");
    registerParameter("TruthLargeRJetCollectionName", "Name of the Truth Large R Jet container", "None");
46
    registerParameter("TruthTauCollectionName", "Name of the Truth tau container", "None");
47
48

    registerParameter("applyTTVACut", "Decide if to apply lepton z0/d0 cuts", "True");
49

Tomas Dado's avatar
Tomas Dado committed
50
51
    registerParameter("GRLDir", "Location of GRL File", "TopAnalysis");
    registerParameter("GRLFile", "Name of GRL File", " ");
52

Tomas Dado's avatar
Tomas Dado committed
53
54
    registerParameter("TDPPath", "Path to TopDataPreparation file (accessible via PathResolver)",
                      "dev/AnalysisTop/TopDataPreparation/XSection-MC16-13TeV.data");
55

Tomas Dado's avatar
Tomas Dado committed
56
57
58
59
    registerParameter("DumpBtagSystsInSystTrees",
                      "Dump systematics-shifted b-tagging SFs in systematic TTrees, True or False (default: False)",
                      "False");
    registerParameter("StorePerJetBtagSFs", "Store per-jet btag SFs", "False");
60

Tomas Dado's avatar
Tomas Dado committed
61
62
63
    registerParameter("ElectronID", "Type of electron. Likelihood LooseAndBLayerLH, MediumLH, TightLH", "TightLH");
    registerParameter("ElectronIDLoose",
                      "Type of electron for background. Likelihood LooseAndBLayerLH, MediumLH, TightLH", "MediumLH");
64
    registerParameter("ElectronPt", "Electron pT cut for object selection (in MeV). Default 25 GeV.", "25000.");
65
66
    registerParameter("ElectronIDSFFilePath", "EXPERIMENTAL! Path to a root file containing custom electron ID SFs, e.g. dev/ElectronEfficiencyCorrection/2015_2018/rel21.2/Precision_Summer2020_v1/offline/efficiencySF.offline.TightLLH_d0z0_v13.root."
                      "This should only be used by experts for testing SFs! Default: Using the most recent recommended map.", "Default");
Tomas Dado's avatar
Tomas Dado committed
67
68
69
70
71
72
73
74
75
76
77
    registerParameter("EgammaSystematicModel", "Egamma Calibration Systematic model : FULL_v1 , 1NP_v1 (default)",
                      "1NP_v1");
    registerParameter("ElectronEfficiencySystematicModel",
                      "Electron Efficiency Systematic model : FULL, SIMPLIFIED, TOTAL (default)", "TOTAL");
    registerParameter("ElectronEfficiencySystematicModelEtaBinning",
                      "Electron Efficiency Systematic model eta binning (option for SIMPLIFIED model, do not specify to use default; format XXX:YYY:ZZZ, e.g. 0.0:1.37:4.9)",
                      "default");
    registerParameter("ElectronEfficiencySystematicModelEtBinning",
                      "Electron Efficiency Systematic model E_T binning (option for SIMPLIFIED model, do not specify to use default; format XXX:YYY:ZZZ. e.g. 4000:7000:10000:15000:13000000)",
                      "default");
    registerParameter("ElectronIsolation",
78
                      "Isolation to use : Gradient, FCLoose, FCTight, FCHighPtCaloOnly, PLVTight, PLVLoose, (EXPERIMENTAL: HighPtCaloOnly, Loose, Tight, TightTrackOnly, TightTrackOnly_FixedRad, PLImprovedTight, PLImprovedVeryTight), (DANGEROUS: PflowTight, PflowLoose), None",
79
                      "FCTight");
Tomas Dado's avatar
Tomas Dado committed
80
    registerParameter("ElectronIsolationLoose",
81
                      "Isolation to use : Gradient, FCLoose, FCTight, FCHighPtCaloOnly, PLVTight, PLVLoose, (EXPERIMENTAL: HighPtCaloOnly, Loose, Tight, TightTrackOnly, TightTrackOnly_FixedRad, PLImprovedTight, PLImprovedVeryTight), (DANGEROUS: PflowTight, PflowLoose), None",
Tomas Dado's avatar
Tomas Dado committed
82
                      "None");
83
84
    registerParameter("ElectronIsolationSF", "Force electron isolation SF (e.g. None). EXPERIMENTAL!", " ");
    registerParameter("ElectronIsolationSFLoose", "Force electron isolation SF (e.g. None). EXPERIMENTAL!", " ");
Tomas Dado's avatar
Tomas Dado committed
85
86
87
88
89
    registerParameter("ElectronVetoLArCrack", "True/False. Set to False to disable LAr crack veto (not recommended).",
                      "True");
    registerParameter("UseElectronChargeIDSelection",
                      "True/False. Switch on/off electron charge ID selection (Default False).", "False");
    registerParameter("UseEgammaLeakageCorrection",
90
91
92
                      "True/False. Switch on/off super cluster based core leakage correction -- REQUIRES ptag>p3947 (Default True).", "False");
    registerParameter("UseEgammaPileupCorrection",
                      "True/False. Switch on/off improved egamma pileup correction is correction", "True");
93
    registerParameter("EnablePromptLeptonImprovedVetoStudies",
94
95
                      "True/False. Adds the (many!) variables necessary to validate the PromptLeptonImprovedVeto electron+muon isolation -- TEMPORARY, for studies only (Default False).",
                      "False");
Tomas Dado's avatar
Tomas Dado committed
96
97
98

    registerParameter("FwdElectronID", "Type of fwd electron. Loose, Medium, Tight (default)", "Tight");
    registerParameter("FwdElectronIDLoose", "Type of fwd loose electrons. Loose, Medium, Tight (default)", "Tight");
99
100
101
    registerParameter("FwdElectronPt", "Fwd Electron pT cut for object selection (in MeV). Default 25 GeV.", "25000.");
    registerParameter("FwdElectronMinEta", "Fwd Electron lower |eta| cut for object selection. Default 2.5", "2.5");
    registerParameter("FwdElectronMaxEta", "Fwd Electron upper |eta| cut for object selection. Default 4.9", "4.9");
Tomas Dado's avatar
Tomas Dado committed
102
103
104
    registerParameter("FwdElectronBCIDCleaningRunRange",
                      "Specify run range for which the BCID cleaning must be applied for fwd el. in data: \"XXX:YYY\"; the cleaning will be applied for XXX<=runNumber<=YYY",
                      "266904:311481");
105

106
107
108

    registerParameter("PhotonPt", "Photon pT cut for object selection (in MeV). Default 25 GeV.", "25000.");
    registerParameter("PhotonEta", "Absolute Photon eta cut for object selection. Default 2.5.", "2.5");
Tomas Dado's avatar
Tomas Dado committed
109
110
111
112
113
114
115
116
117
    registerParameter("PhotonID", "Type of photon. Definition to use : Tight, Loose and None.", "Tight");
    registerParameter("PhotonIDLoose", "Type of photon for background. Definition to use : Tight, Loose, None.",
                      "Loose");
    registerParameter("PhotonIsolation",
                      "Isolation to use : FixedCutTightCaloOnly, FixedCutTight, FixedCutLoose, (EXPERIMENTAL: TightCaloOnly, Tight, Loose), None.",
                      "FixedCutTight");
    registerParameter("PhotonIsolationLoose",
                      "Isolation to use : FixedCutTightCaloOnly, FixedCutTight, FixedCutLoose, (EXPERIMENTAL: TightCaloOnly, Tight, Loose), None.",
                      "FixedCutLoose");
118
119

    registerParameter("MuonPt", "Muon pT cut for object selection (in MeV). Default 25 GeV.", "25000");
Tomas Dado's avatar
Tomas Dado committed
120
121
122
123
124
125
126
    registerParameter("MuonEta", "Absolute Muon eta cut for object selection. Default 2.5.", "2.5");
    registerParameter("MuonQuality",
                      "Muon quality cut for object selection. Options are VeryLoose, Loose, Medium (default) and Tight",
                      "Medium");
    registerParameter("MuonQualityLoose",
                      "Muon quality cut for object selection. Options are VeryLoose, Loose, Medium (default) and Tight",
                      "Medium");
127
    registerParameter("MuonUseMVALowPt",
128
129
                      "Turn on MVA for low-pT muons (only for LowPt WP). Optimized to improve efficiency and hadron rejection. - Default: False",
                      "False");
130
    registerParameter("MuonUse2stationHighPt",
131
132
                      "Allows muon reconstruction using 2-station muons with missing inner MS station for |eta|<1.3 - Default: True (only for HighPt)",
                      "True");
133
    registerParameter("MuonUseMVALowPtLoose",
134
135
                      "Turn on MVA for low-pT muons (only for LowPt WP) for Loose tree. Optimized to improve efficiency and hadron rejection. - Default: False",
                      "False");
136
    registerParameter("MuonUse2stationHighPtLoose",
137
138
                      "Allows muon reconstruction using 2-station muons with missing inner MS station for |eta|<1.3 for Loose tree - Default: True (only for HighPt)",
                      "True");
Tomas Dado's avatar
Tomas Dado committed
139
    registerParameter("MuonIsolation",
140
                      "Isolation to use : PflowTight_VarRad, PflowTight_FixedRad, PflowLoose_VarRad, PflowLoose_FixedRad, HighPtTrackOnly, TightTrackOnly_VarRad, TightTrackOnly_FixedRad, PLVTight, PLVLoose, Tight_VarRad, Tight_FixedRad, Loose_VarRad, Loose_FixedRad, FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, FCTight_FixedRad, AntiMuon_nominal, AntiMuon_shapeSyst1, AntiMuon_shapeSyst2, None",
141
                      "PflowTight_FixedRad, PLImprovedTight, PLImprovedVeryTight");
Tomas Dado's avatar
Tomas Dado committed
142
    registerParameter("MuonIsolationLoose",
143
                      "Isolation to use : PflowTight_VarRad, PflowTight_FixedRad, PflowLoose_VarRad, PflowLoose_FixedRad, HighPtTrackOnly, TightTrackOnly_VarRad, TightTrackOnly_FixedRad, PLVTight, PLVLoose, Tight_VarRad, Tight_FixedRad, Loose_VarRad, Loose_FixedRad, FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, FCTight_FixedRad, None",
144
                      "None");
145
146
    registerParameter("MuonIsolationSF", "Force muon isolation SF (e.g. None). EXPERIMENTAL!", " ");
    registerParameter("MuonIsolationSFLoose", "Force muon isolation SF (e.g. None). EXPERIMENTAL!", " ");
147
148
149
150
151
152
    registerParameter("MuonDoSmearing2stationHighPt",
                      "True/False, to turn on/off spacial corrections for 2-station muons reconstruction with missing inner MS station allowed for abs(eta)<1.3, only with MuonQuality HighPt. - Default: True",
                      "True");
    registerParameter("MuonDoExtraSmearingHighPt",
                      "True/False, To be used by analyses using willing to check their sensitivity to momentum resolution effects at large muon momenta and in case move to the HighPt WP - Default: false",
                      "false");
153
    registerParameter("UseAntiMuons", "Use AntiMuons for fake estimate. Default: false", "false");
Tomas Dado's avatar
Tomas Dado committed
154
    registerParameter("UseSoftMuons", "True to use soft muons, False (default) otherwise", "False");
155
    registerParameter("SoftMuonPt", "Soft Muon pT cut for object selection (in MeV). Default 4 GeV.", "4000");
Tomas Dado's avatar
Tomas Dado committed
156
157
158
159
    registerParameter("SoftMuonEta", "Absolute Soft Muon eta cut for object selection. Default 2.5.", "2.5");
    registerParameter("SoftMuonQuality",
                      "Soft Muon quality cut for object selection. Options are Loose, Medium, Tight (default), LowPt",
                      "Tight");
160
    registerParameter("SoftMuonUseMVALowPt",
161
162
                      "Turn on MVA for low-pT soft muons (only for LowPt WP). Optimized to improve efficiency and hadron rejection. - Default: False",
                      "False");
Tomas Dado's avatar
Tomas Dado committed
163
164
165
    registerParameter("SoftMuonDRJet",
                      "Soft Muon maximum dR wrt nearest selected jet. Can be set to 999. to keep all soft muons. Default 0.4",
                      "0.4");
166
167
168
    registerParameter("SoftMuonDRJetUseRapidity",
                      "How to calculate DR(soft muon,jet) for the SoftMuonDRJet cut: True -> use rapidity; False -> use pseudorapidity. Default False",
                      "False");
169
    registerParameter("SoftMuonAdditionalTruthInfo",
170
                      "Experimental: store additional truth information on soft muons particle-level origin: True or False (default)",
171
172
                      "False");
    registerParameter("SoftMuonAdditionalTruthInfoCheckPartonOrigin",
173
                      "Experimental: store additional truth information on soft muons parton-level origin; requires SoftMuonAdditionalTruthInfo to be true; automatically disabled if PS!=pythia8 and PS!=herwigpp : True or False (default)",
174
175
                      "False");
    registerParameter("SoftMuonAdditionalTruthInfoDoVerbose",
176
                      "Debug output for soft muon additional truth-level information: True or False (default)",
177
                      "False");
178
179

    registerParameter("JetPt", "Jet pT cut for object selection (in MeV). Default 25 GeV.", "25000.");
Tomas Dado's avatar
Tomas Dado committed
180
    registerParameter("JetEta", "Absolute Jet eta cut for object selection. Default 2.5.", "2.5");
181

182
183
184
185
    registerParameter("JVTinMETCalculation",
                      "Perfom a JVT cut on the jets in the MET recalculation? True (default) or False.", "True");
    registerParameter("SaveFailJVTJets", "Save the jets that failed the JVT cut? False (default) or True.", "False");
    registerParameter("JVTWP", "Set JVT WP, default is set to \'Default\' (Tight for PFlow and Medium for Topo).",
Tomas Dado's avatar
Tomas Dado committed
186
                      "Default");
187
    registerParameter("ForwardJVTWP", "Set fJVT Working Point for selecting forward jets (|eta|>2.5 & 20GeV<pT<60GeV)"
188
                                      "\'None\': No fJVT (doesn't run tool for selection) - use this if you don't have forward jets in your selection or if using using PFlow jets with a derivation older than p4173, \'Tight\' (fJVT<0.4, recommended), \'Medium\': (fJVT<0.5, if combined with ForwardJVTinMETCalculation this will set MET WP to Tenacious with stricter JVTinMET requirements",
189
                      "None");
190
    registerParameter("ForwardJVTinMETCalculation",
191
192
193
194
195
196
197
198
                      "Use fJVT cut on forward jets to improve resolution in the MET recalculation? \'False\' (default - must set false if using pflow jets with derivations older than P4173), or \'True\'",
                      "False");
    registerParameter("SaveFailForwardJVTJets",
                      "Save the jets that failed the fJVT cut? \'False\' (default), or \'True\'", "False");
    registerParameter("AdvancedUsage_METUncertaintiesConfigDir",
                      "Path to directory containing MET uncertainties configs (including trailing /) \'Latest\' (default), or previous \'METUtilities/data17_13TeV/prerec_Jan16/\'",
                      "Latest");

Tomas Dado's avatar
Tomas Dado committed
199
    registerParameter("JetPtGhostTracks",
200
201
                      "Jet pT threshold for ghost track systematic variations calculation (in MeV). Default 25 GeV.",
                      "25000.");
202
203
204
    registerParameter("JetEtaGhostTracks",
                      "Jet eta threshold for ghost track systematic variations calculation. Default 2.5",
                      "2.5");
205
206
207
208
    registerParameter("GhostTrackspT",
                      "PT of the ghost tracks associated small-R jets (in MeV). Default 500 MeV.",
                      "500.");
    registerParameter("GhostTracksVertexAssociation",
209
210
                      "WP of the ghost track vertex association. Option: none, nominal and tight. Default nominal.",
                      "nominal");
211
    registerParameter("GhostTracksQuality",
212
213
214
                      "WP of the ghost track quality. Option: TightPrimary, LoosePrimary. Loose, NoCut. Default TightPrimary.",
                      "TightPrimary");

215
216
217
218
219
220
    registerParameter("LargeRJetPtGhostTracks",
                      "Jet pT threshold for ghost track systematic variations calculation (in MeV). Default 150000 GeV.",
                      "150000.");
    registerParameter("LargeRJetEtaGhostTracks",
                      "Jet eta threshold for ghost track systematic variations calculation. Default 2.0",
                      "2.0");
221

Tomas Dado's avatar
Tomas Dado committed
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
    registerParameter("JetUncertainties_NPModel",
                      "AllNuisanceParameters, CategoryReduction (default), GlobalReduction, StrongReduction - for JetUncertainties",
                      "CategoryReduction");
    registerParameter("JetUncertainties_QGFracFile", "To specify a root file with quark/gluon fractions,"
                                                     " in order to reduce FlavourComposition and response uncertainties."
                                                     " Default: None (i.e. no file is used and default flat 50+/-50% fraction is used).",
                      "None");
    registerParameter("JetUncertainties_QGHistPatterns", "To specify a pattern for the name of the quark/gluon fractions histograms, or a list of DSIDs which will have their specific histogram."
                                                         " Two syntaxes are possible, either a single string or a list of DSIDs separated by commas:"
                                                         "   \"MyQGHisto\" (the histograms with \"MyQGHisto\" in their names will be used for all DSIDs),"
                                                         "   \"410470,410472,345873,345874,345875\" (for the listed DSIDs, histograms with the processed DSID will be used, while the flat 50+/-50% fraction will be used for the other DSIDs)."
                                                         " Default: None (i.e. no specific pattern is looked for in the name of the provided histograms).",
                      "None");
    registerParameter("JetJERSmearingModel",
                      "All (inc. data smearing), All_PseudoData (use MC as pseudo-data), Full (inc. data smearing), Full_PseudoData (use MC as pseudo-data) or Simple (MC only - default)",
                      "Simple");
238
239
240
241
242
    registerParameter("JetJMSOption",
		      "None (default),"
                      "JMS_frozen (The shape and magnitude of the uncertainties at m/pT = 0.25 are also used for m/pT > 0.25),"
                       "JMS_scaled (The magnitude of the uncertainties at m/pT = 0.25 was scaled linearly with increasing m/pT)",
                      "None");
243
244
245
    registerParameter("LargeRSysts_TreatMCasPseudodata",
                      "If set to True, treat MC as pseudo-data; only apply JER smearing, and only when FullJER/AllJER is specified with LargeRJetUncertainties_JESJERJMS_NPModel.",
                      "False",{"True", "False"});
246
247
    registerParameter("JetCalibSequence", "Jet calibaration sequence.", "GSC", {"GSC", "JMS"});
    registerParameter("AllowJMSforAFII", "Enable use of UNSUPPORTED small-R jet JMS calibration use on AFII samples.", "False", {"True", "False"});
Tomas Dado's avatar
Tomas Dado committed
248
249
250
    registerParameter("StoreJetTruthLabels", "Flag to store truth labels for jets - True (default) or False", "True");

    registerParameter("JSF", "Used for top mass analysis, default is 1.0", "1.0");
251
252
    registerParameter("bJSF", "Used for top mass analysis, default is 1.0", "1.0");

253
    registerParameter("LargeRJetPt", "LargeRJet pT cut for object selection (in MeV). Default 150 GeV.", "150000.");
254
    registerParameter("LargeRJetMass", "LargeRJet min. mass cut for object selection (in MeV).", "0");
Tomas Dado's avatar
Tomas Dado committed
255
    registerParameter("LargeRJetEta", "Absolute large-R jet eta cut for object selection. Default 2.0.", "2.0");
256
257
258
    registerParameter("LargeRJetSubstructureVariables",
                      "List of substructure variables stored in the output separated by commas. By default no variable is added to output.",
                      " ");
259
260
261
262
263
264
    registerParameter("LargeRJetUncertainties_JESJERJMS_NPModel",
                      "Input form: {A}JES_{B}JER_{C}JMS, see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21ConsolidatedLargeRScaleRes for configuration options, - for LCTopo large-R jet energy scale, energy resolution, and mass scale uncertainties",
                      "CategoryJES_FullJER_FullJMS");
    registerParameter("LargeRJetUncertainties_JMR_NPModel",
                      "Full (10 NP; aimed at the most precise jet-dependent measurements), Simple (1 NP; flat 20 percent uncertainty, as it was recommended in the past)  - for LCTopo large-R jet mass resolution uncertainties",
                      "FullJMR");
265
    registerParameter("AdvancedUsage_LargeRJetUncertaintiesConfigDir",
266
                      "Path to directory containing large-R jet uncertainties config",
267
                      "rel21/Winter2021");
268
    registerParameter("LargeRJESJMSConfig",
269
                      "Calibration for large-R JES/JMS. CombMass, CaloMass, TCCMass or UFOSDMass (default CombMass).",
270
                      "CombMass");
271
272
273
274
    registerParameter("BoostedJetTagging",
                      "Boosted jet taggers to use in the analysis, separated by commas or white spaces."
                      " By default, no tagger is used.",
                      " ");
275

276
    registerParameter("TrackJetPt", "Track Jet pT cut for object selection (in MeV). Default 10 GeV.", "10000.");
Tomas Dado's avatar
Tomas Dado committed
277
278
    registerParameter("TrackJetEta", "Absolute Track Jet eta cut for object selection. Default 2.5.", "2.5");

aknue's avatar
aknue committed
279
280
281
    registerParameter("TrackPt", "Track pT cut for object selection (in MeV). Default 0.5 GeV.", "0.5");
    registerParameter("TrackEta", "Absolute Track eta cut for object selection. Default 2.5.", "2.5");
    registerParameter("TrackQuality",
282
283
                      "Track quality cut for object selection. Options are TightPrimary,...",
                      "TightPrimary");
aknue's avatar
aknue committed
284
285


Tomas Dado's avatar
Tomas Dado committed
286
287
288
    registerParameter("RCJetPt", "Reclustered Jet pT cut for object selection (in MeV). Default 100000 MeV.",
                      "100000.");
    registerParameter("RCJetEta", "Reclustered Jet eta cut for object selection. Default 2.0.", "2.0");
289
290
291
292
293
294
    registerParameter("RCInputJetPtMin",
                      "Min Pt cut for RC jet inputs collection. Parameter is shared between RC and VarRC jets. Default 30000. [MeV]",
                      "30000.");
    registerParameter("RCInputJetEtaMax",
                      "Max |Eta| cut for RC jet inputs collection. Parameter is shared between RC and VarRC jets. Default 2.5",
                      "2.5");
Tomas Dado's avatar
Tomas Dado committed
295
296
297
298
    registerParameter("RCJetTrim", "Reclustered Jet trimming cut for object selection. Default 0.05.", "0.05");
    registerParameter("RCJetRadius", "Reclustered Jet radius for object selection. Default 1.0", "1.0");
    registerParameter("UseRCJetSubstructure", "Calculate Reclustered Jet Substructure Variables. Default False",
                      "False");
299
300
301
302
    registerParameter("RCJetSubstructureVariables",
                      R"("List of reclustered jet substructure variables stored in the output separated by commas.
                      Available variables: Tau32_clstr,Tau21_clstr,Tau3_clstr,Tau2_clstr,Tau1_clstr,d12_clstr,d23_clstr,Qw_clstr,nconstituent_clstr,D2_clstr,ECF1_clstr,ECF2_clstr,ECF3_clstr,gECF332_clstr,gECF461_clstr,gECF322_clstr,gECF331_clstr,gECF422_clstr,gECF441_clstr,gECF212_clstr,gECF321_clstr,gECF311_clstr,L1_clstr,L2_clstr,L3_clstr,L4_clstr,L5_clstr,rrcjet_pt,rrcjet_eta,rrcjet_phi,rrcjet_e)",
                      " ");
Tomas Dado's avatar
Tomas Dado committed
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320

    registerParameter("UseRCJets", "Use Reclustered Jets. Default False.", "False");

    registerParameter("VarRCJetPt",
                      "Reclustered Jet (variable-R) pT cut for object selection (in MeV). Default 100000 MeV.",
                      "100000.");
    registerParameter("VarRCJetEta", "Reclustered Jet (variable-R) eta cut for object selection. Default 2.0.", "2.0");
    registerParameter("VarRCJetTrim", "Reclustered Jet (variable-R) trimming cut for object selection. Default 0.05.",
                      "0.05");
    registerParameter("VarRCJetMaxRadius",
                      "Reclustered Jet (variable-R) max. radius cut for object selection. Default 1.0", "1.0");
    registerParameter("VarRCJetRho", "Reclustered Jet (variable-R) list of rho values (). Default 2.", "2");
    registerParameter("VarRCJetMassScale",
                      "Reclustered Jet (variable-R) list of mass scale values (m_w,m_z,m_h,m_t). By default use all.",
                      "m_w,m_z,m_h,m_t");
    registerParameter("UseVarRCJets", "Use Reclustered Jets (Variable-R Jets). Default False.", "False");
    registerParameter("UseVarRCJetSubstructure",
                      "Calculate Variable-R Reclustered Jet Substructure Variables. Default False", "False");
321

Petr Jacka's avatar
Petr Jacka committed
322
    registerParameter("VarRCJetSubstructureVariables",
323
324
325
                      R"(List of variable-R reclustered jet substructure variables stored in the output separated by commas.
                      Available variables: Tau32_clstr,Tau21_clstr,Tau3_clstr,Tau2_clstr,Tau1_clstr,d12_clstr,d23_clstr,Qw_clstr,nconstituent_clstr,D2_clstr,ECF1_clstr,ECF2_clstr,ECF3_clstr,gECF332_clstr,gECF461_clstr,gECF322_clstr,gECF331_clstr,gECF422_clstr,gECF441_clstr,gECF212_clstr,gECF321_clstr,gECF311_clstr,L1_clstr,L2_clstr,L3_clstr,L4_clstr,L5_clstr,rrcjet_pt,rrcjet_eta,rrcjet_phi,rrcjet_e)",
                      " ");
326
327

    registerParameter("TauPt",
Tomas Dado's avatar
Tomas Dado committed
328
329
330
                      "Pt cut applied to both tight and loose taus (in MeV)."
                      "Default 25 GeV.",
                      "25000");
Tanja Holm's avatar
Tanja Holm committed
331
    registerParameter("TauEtaRegions",
332
333
334
                      "Eta regions used for both tight and loose taus."
                      "Default vetoing crack region [0., 1.37, 1.52, 2.5]",
                      "[0., 1.37, 1.52, 2.5]");
335
    registerParameter("TauJetIDWP",
336
337
                      "Tau jet IDWP (None, Loose, Medium, Tight, LooseNotMedium, LooseNotTight, MediumNotTight, NotLoose, RNNLoose, RNNMedium, RNNTight)."
                      "Default RNNMedium.",
338
                      "RNNMedium");
339
    registerParameter("TauJetIDWPLoose",
Tomas Dado's avatar
Tomas Dado committed
340
                      "Loose Tau jet IDWP (None, Loose, Medium, Tight, LooseNotMedium, LooseNotTight, MediumNotTight, NotLoose)."
341
342
                      "Default RNNLoose.",
                      "RNNLoose");
343
    registerParameter("TauEleBDTWP",
344
                      "Tau electron BDT WP (None, Loose, Medium, Tight, OldLoose, OldMedium)."
345
346
347
                      "Default Loose.",
                      "Loose");
    registerParameter("TauEleBDTWPLoose",
348
                      "Loose Tau electron BDT WP (None, Loose, Medium, Tight, OldLoose, OldMedium)."
349
350
351
                      "Default Loose.",
                      "Loose");
    registerParameter("TauEleOLR",
Tomas Dado's avatar
Tomas Dado committed
352
353
354
                      "Apply tau-electron overlap removal (True/False)."
                      "Default False",
                      "False");
355
    registerParameter("TauEleOLRLoose",
Tomas Dado's avatar
Tomas Dado committed
356
357
358
                      "Apply loose tau-electron overlap removal (True/False)."
                      "Default False",
                      "False");
359
    registerParameter("TauJetConfigFile",
Tomas Dado's avatar
Tomas Dado committed
360
361
362
363
364
                      "Config file to configure tau selection. "
                      "If anything other than 'Default'"
                      "then all cuts are taken from the "
                      "config file rather than other options.",
                      "Default");
365
    registerParameter("TauJetConfigFileLoose",
Tomas Dado's avatar
Tomas Dado committed
366
367
368
369
370
                      "Config file to configure loose tau selection. "
                      "If anything other than 'Default'"
                      "then all cuts are taken from the "
                      "config file rather than other options.",
                      "Default");
371
    registerParameter("ApplyTauMVATES",
372
373
                      "Apply new Tau energy calibration based on substructure information and regression. Must be True. Deprecated.",
                      "True");
374
375
376
377
378
379
    registerParameter("TauSFDoRNNID",
                      "Save SF for RNN tau ID True/False",
                      "True");
    registerParameter("TauSFDoBDTID",
                      "Save SF for BDT tau ID True/False",
                      "False");
380

Tomas Dado's avatar
Tomas Dado committed
381
    registerParameter("Systematics", "What to run? Nominal (just the nominal), All(do all systematics) ", "Nominal");
382
383

    registerParameter("LibraryNames", "Names of any libraries that need loading");
384
    registerParameter("UseAodMetaData", "Whether to read xAOD meta-data from input files (default: True)", "True");
Tomas Dado's avatar
Tomas Dado committed
385
386
    registerParameter("WriteTrackingData", "Whether to generate and store analysis-tracking data (default: True)",
                      "True");
387
388
    registerParameter("ObjectSelectionName", "Code used to define objects, e.g. ObjectLoaderStandardCuts");
    registerParameter("OutputFormat", "Format, can be user defined, e.g. top::EventSaverFlatNtuple");
Tomas Dado's avatar
Tomas Dado committed
389
390
    registerParameter("OutputEvents",
                      "AllEvents (saves all events + decison bits), SelectedEvents (saves only the events passing your cuts)");
391
    registerParameter("OutputFilename", "The file that will contain the output histograms and trees");
Tomas Dado's avatar
Tomas Dado committed
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
    registerParameter("OutputFileSetAutoFlushZero",
                      "setAutoFlush(0) on EventSaverFlatNtuple for ANALYSISTO-44 workaround. (default: False)",
                      "False");
    registerParameter("OutputFileNEventAutoFlush",
                      "Set the number of events after which the TTree cache is optimised, ie setAutoFlush(nEvents). (default: 1000)",
                      "1000");
    registerParameter("OutputFileBasketSizePrimitive",
                      "Set the TTree basket size for primitive objects (int, float, ...). (default: 4096)", "4096");
    registerParameter("OutputFileBasketSizeVector", "Set the TTree basket size for vector objects. (default: 40960)",
                      "40960");
    registerParameter("RecomputeCPVariables",
                      "Run the CP tools to force computation of variables that may already exist in derivations? (default: True)",
                      "True");
    registerParameter("EventVariableSaveList", "The list of event variables to save (EventSaverxAODNext only).",
                      "runNumber.eventNumber.eventTypeBitmask.averageInteractionsPerCrossing");
    registerParameter("PhotonVariableSaveList", "The list of photon variables to save (EventSaverxAODNext only).",
                      "pt.eta.phi.m.charge.ptvarcone20.topoetcone20.passPreORSelection");
    registerParameter("ElectronVariableSaveList", "The list of electron variables to save (EventSaverxAODNext only).",
                      "pt.eta.phi.m.charge.ptvarcone20.topoetcone20.passPreORSelection");
    registerParameter("MuonVariableSaveList", "The list of muon variables to save (EventSaverxAODNext only).",
                      "pt.eta.phi.m.author.charge.ptvarcone30.topoetcone20.muonType.passPreORSelection");
    registerParameter("TauVariableSaveList", "The list of tau variables to save (EventSaverxAODNext only).",
                      "pt.eta.phi.m.charge.passPreORSelection");
    registerParameter("JetVariableSaveList", "The list of jet variables to save (EventSaverxAODNext only).",
                      "pt.eta.phi.m.passPreORSelection.btaggingLink.HadronConeExclTruthLabelID");
    registerParameter("BTagVariableSaveList", "The list of b-tag variables to save (EventSaverxAODNext only).",
                      "MV2c20_discriminant");

    registerParameter("NEvents",
                      "The number of events that you want to run on (for testing). If 0 then all events are run.", "0");
    registerParameter("FirstEvent",
                      "The number of events that you want to skip (for testing). If 0 then no events are skipped.",
                      "0");
    registerParameter("PerfStats", " I/O Performance printouts. None, Summary or Full", "None");
426
    registerParameter("IsAFII", "Define if you are running over a fastsim sample: True or False", " ");
427
    registerParameter("IsDataOverlay", "Define if you are running over a data overlay MC sample: True or False", " ");
Tomas Dado's avatar
Tomas Dado committed
428
429
    registerParameter("FilterBranches",
                      "Comma separated list of names of the branches that will be removed from the output", " ");
430
    registerParameter("FilterPartonLevelBranches",
431
432
                      "Comma separated list of names of the parton-level branches that will be removed from the output",
                      " ");
433
    registerParameter("FilterParticleLevelBranches",
434
435
                      "Comma separated list of names of the particle-level branches that will be removed from the output",
                      " ");
436
    registerParameter("FilterNominalLooseBranches",
437
438
                      "Comma separated list of names of the nominal_Loose tree branches that will be removed from the output",
                      " ");
439
440
441
    registerParameter("FilterNominalBranches",
                      "Comma separated list of names of the nominal tree branches that will be removed from the output. If not provided, the branches from FilterBraches will be used",
                      " ");
442
443
    registerParameter("FilterTrees",
                      "Comma separated list of names of the trees that will be removed from the output", " ");
444

Tomas Dado's avatar
Tomas Dado committed
445
446
447
    registerParameter("FakesMMWeightsIFF",
                      "Calculate matrix-method weights for fake leptons estimate using FakeBkgTools from IFF: True (calculate weights), False (does nothing)",
                      "False");
448
    registerParameter("FakesMMConfigIFF",
Tomas Dado's avatar
Tomas Dado committed
449
450
451
452
453
                      "Configurations for fake leptons estimate using FakeBkgTools from IFF: - default is $ROOTCOREBIN/data/TopFakes/efficiencies.xml:1T:1F[T]. Use as \n <ROOT/XML FILE>:<DEFNINITION>:<PROCESS>;<ROOT/XML FILE 2>:<DEFNINITION 2>:<PROCESS 2>; ...",
                      "$ROOTCOREBIN/data/TopFakes/efficiencies.xml:1T:1F[T]");
    registerParameter("FakesMMIFFDebug",
                      "Enables debug mode for matrix-method weight calculation using FakeBkgTools from IFF: True, False (default)",
                      "False");
454

Tomas Dado's avatar
Tomas Dado committed
455
456
457
458
    registerParameter("DoTight", "Dumps the normal non-\"*_Loose\" trees : Data, MC, Both (default), False", "Both");
    registerParameter("DoLoose", "Run Loose selection and dumps the Loose trees : Data (default), MC, Both, False",
                      "Data");
    registerParameter("DoSysts", "Run systematics on given selection: Both (default), Tight, Loose", "Both");
459
460
461
462
463
464
465
466
467
468
469

    registerParameter("UseLooseObjectsInMETInLooseTree",
                      "Experimental: use loose objects when rebuilding the MET for the loose tree : True or False (default = False)",
                      "False");
    registerParameter("UseLooseObjectsInMETInNominalTree",
                      "Experimental: use loose objects when rebuilding the MET for the nominal tree : True or False (default = False)",
                      "False");

    registerParameter("WriteMETBuiltWithLooseObjects",
                      "Write a separate branch with the met built with loose objects in the output for tests: True or False (default = False)",
                      "False");
470

Tomas Dado's avatar
Tomas Dado committed
471
472
473
474
    registerParameter("OverlapRemovalLeptonDef",
                      "Special: run overlap removal on : Tight (top default) or Loose (not top default) lepton definitions",
                      "Tight");
    registerParameter("ApplyTightSFsInLooseTree",
475
                      "Special: in Loose trees, calculate electron/muon SFs with tight leptons only, and considering they are tight: True or False (default)",
Tomas Dado's avatar
Tomas Dado committed
476
                      "False");
477

Tomas Dado's avatar
Tomas Dado committed
478
479
    registerParameter("ApplyElectronInJetSubtraction",
                      "Subtract electrons close to jets for boosted analysis : True or False(top default)", "False");
480
    registerParameter("TopPartonHistory", "Topology to be assumed when reconstructing parton-level history.", "False",
481
                      {"ttbar", "ttbarlight", "tb", "Wtb", "tchannel", "ttz", "ttgamma", "tHq", "tZq", "tttt", "False"});
482
    registerParameter("TopPartonLevel", "Perform parton level analysis (stored in truth tree)? True or False", "True");
483
484
485

    registerParameter("TopParticleLevel",
                      "Perform particle level selection (stored in particleLevel tree)? True or False", "False");
486
487
488
489
    registerParameter("DoParticleLevelOverlapRemoval",
                      "Perform overlap removal at particle level? True (default), False, or any combination (comma separated) of MuonJet, ElectronJet, JetPhoton",
                      "True");

Tomas Dado's avatar
Tomas Dado committed
490
491
492
493
494
495
    registerParameter("PDFInfo",
                      "Do you want the PDF info? True (in truth tree), Nominal (save to the nominal tree if passes selection) or False (nothing, default)",
                      "False");
    registerParameter("MCGeneratorWeights",
                      "Do you want the OTF-computed MC generator weights (if available)? True (in truth tree), Nominal (save to the nominal tree if passes selection) or False (nothing, default)",
                      "False");
496
497
    registerParameter("NominalWeightNames",
                      "List of nominal weight names to attempt to retrieve. Attempts are made in the order as specified. If none of the names can be found, we will crash with error message. Use index instead in such case.",
498
                      "\" nominal \",\"nominal\",\"Default\",\"Weight\",\"1001\",\" muR=0.10000E+01 muF=0.10000E+01 \",\"\",\" \",\" dyn=   3 muR=0.10000E+01 muF=0.10000E+01 \",\" mur=1 muf=1 \"");
499
500
501
    registerParameter("NominalWeightFallbackIndex",
                      "Index of nominal weight in MC weights vector. This option is only used in case the MC sample has broken metadata. (Default: -1 means no fallback index specified, rely on metadata and crash if metadata cannot be read)",
                      "-1");
502
503
504
    registerParameter("ForceNominalWeightFallbackIndex",
                      "Force usage of NominalWeightFallbackIndex, even if MC sample metadata is correct. (Default: False)",
                      "False");
505

Tomas Dado's avatar
Tomas Dado committed
506
    registerParameter("TruthBlockInfo", "Do you want to dump the full Truth block info? True or False", "False");
507

Tomas Dado's avatar
Tomas Dado committed
508
509
510
511
512
    registerParameter("TruthElectronPt",
                      "Electron pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.",
                      "25000");
    registerParameter("TruthElectronEta",
                      "Absolute electron eta cut for [Particle Level / Truth] object selection. Default 2.5.", "2.5");
513

Tomas Dado's avatar
Tomas Dado committed
514
515
516
517
    registerParameter("TruthMuonPt",
                      "Muon pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.", "25000");
    registerParameter("TruthMuonEta",
                      "Absolute Muon eta cut for [Particle Level / Truth] object selection. Default 2.5.", "2.5");
518

519
    registerParameter("TruthSoftMuonPt",
520
521
                      "Soft Muon pT cut for [Particle Level / Truth] object selection (in MeV). Default 4 GeV.",
                      "4000");
522
523
    registerParameter("TruthSoftMuonEta",
                      "Absolute Soft Muon eta cut for [Particle Level / Truth] object selection. Default 2.5.", "2.5");
524

525
526
527
528
529
    registerParameter("TruthPhotonPt",
                      "Photon pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.",
                      "25000");
    registerParameter("TruthPhotonEta",
                      "Absolute Photon eta cut for [Particle Level / Truth] object selection. Default 2.5.",
Tomas Dado's avatar
Tomas Dado committed
530
                      "2.5");
531
532
    registerParameter("TruthPhotonOrigin",
                      "Potential origin of [Particle Level / Truth] photons. Comma separated list of particle origin values as given by MCTruthClassifier (string names).",
Tomas Dado's avatar
Tomas Dado committed
533
                      "WBoson,ZBoson,SinglePhot,Higgs,HiggsMSSM,WZMSSM,PromptPhot,SUSY,UndrPhot,FSRPhot");
534
535
536
537
538
    registerParameter("TruthPhotonIsolation",
                      "Configuration option for isolation applied to [Particle Level / Truth] photons. "
                      "This can be False / None (isolation requirement disabled), "
                      "True (use default isolation), "
                      "or a configuration in the format `VAR CUT`, where VAR is one of the isolation variables and CUT is the cut applied as `VAR / pt < CUT`.",
539
                      "ptcone20 0.1");
540
541


Tomas Dado's avatar
Tomas Dado committed
542
543
544
545
    registerParameter("TruthJetPt",
                      "Jet pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.", "25000");
    registerParameter("TruthJetEta", "Absolute Jet eta cut for [Particle Level / Truth] object selection. Default 2.5.",
                      "2.5");
546

Tomas Dado's avatar
Tomas Dado committed
547
548
549
550
551
552
    registerParameter("TruthLargeRJetPt",
                      "Large R Jet pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.",
                      "25000");
    registerParameter("TruthLargeRJetEta",
                      "Absolute Large R Jet eta cut for [Particle Level / Truth] object selection. Default 2.5.",
                      "2.5");
553

Tomas Dado's avatar
Tomas Dado committed
554
555
556
    registerParameter("TruthTauPt",
                      "Tau pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.", "25000");
    registerParameter("TruthTauEta", "Tau eta cut for [Particle Level / Truth] object selection. Default 2.5.", "2.5");
557

Tomas Dado's avatar
Tomas Dado committed
558
559
560
561
562
563
564
565
566
567
    registerParameter("LHAPDFSets",
                      "List of PDF sets to calculate weights for, seperated by spaces, use LHAPDF names e.g CT10nlo NNPDF30_nlo_as_0118 MMHT2014nlo68cl",
                      " ");
    registerParameter("LHAPDFEventWeights",
                      "Save per event weights for all PDF sets/members: True (lots of info in truth tree!), Nominal (save to the nominal tree if passes selection) or False (nothing, default).",
                      "False");
    registerParameter("LHAPDFBaseSet",
                      "Base PDF set used to recalculate XF1,XF2 values if they are zero. Will be added to LHAPDFSets.",
                      " ");
    registerParameter("BTagCDIPath", "Path to the b-tagging CDI file. Default: Using the hardcoded path.", "Default");
568
569

    registerParameter("BTaggingWP",
570
571
572
573
574
575
576
577
578
579
580
581
582
                      "DEPRECATED OPTION, use BTaggingCaloJetWP and BTaggingTrackJetWP for specifying b-tagging WPs for jet collections using calorimeter information and for track jets respectively.",
                      " ");

    registerParameter("BTaggingTrackJetWP",
                      "b-tagging WPs to use for track jet collection in the analysis, separated by commas."
                      " The format should follow the convention of the b-tagging CP group, e.g. FixedCutBEff_60, FlatBEff_77, Continuous, etc."
                      " For fixed-cut WPs, the simpler format 60%, instead of FixedCutBEff_60, is also tolerated."
                      " The specified WPs which are calibrated for all flavours will have scale-factors computed."
                      " By default, no WP is used.",
                      " ");

    registerParameter("BTaggingCaloJetWP",
                      "b-tagging WPs to use for calorimeter jet collection (e.g. EMTopo, EMPFlow) in the analysis, separated by commas."
583
584
585
586
587
                      " The format should follow the convention of the b-tagging CP group, e.g. FixedCutBEff_60, FlatBEff_77, Continuous, etc."
                      " For fixed-cut WPs, the simpler format 60%, instead of FixedCutBEff_60, is also tolerated."
                      " The specified WPs which are calibrated for all flavours will have scale-factors computed."
                      " By default, no WP is used.",
                      " ");
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607

    registerParameter("BTaggingSystExcludedFromEV",
                      "User-defined list of b-tagging systematics to be dextracted from eigenvector decomposition, separated by semi-colons (none by default)",
                      "none");

    registerParameter("BTaggingCalibrationB",
                      "The calibration to use for the b-tagging SFs (B-jets)."
                      " Default 'default'",
                      "default");

    registerParameter("BTaggingCalibrationC",
                      "The calibration to use for the b-tagging SFs (C- and T-jets)."
                      " Default 'default'",
                      "default");

    registerParameter("BTaggingCalibrationLight",
                      "The calibration to use for the b-tagging SFs (Light-jets)."
                      " Default 'default'",
                      "default");

608
609
    registerParameter("EGammaCalibrationModel", "To override default EGammaCalibration model, Default 'es2018_R21_v0'", "es2018_R21_v0");

Tomas Dado's avatar
Tomas Dado committed
610
611
612
613
614
615
616
617
618
619
620
621
622
623
    registerParameter("PRWConfigFiles",
                      "List of PU config files, seperated by spaces (nothing by default) - Not compatible with FS/AF options",
                      " ");
    registerParameter("PRWConfigFiles_FS",
                      "List of PU config files only for full sim samples, seperated by spaces (nothing by default)",
                      " ");
    registerParameter("PRWConfigFiles_AF",
                      "List of PU config files only for fast sim samples, seperated by spaces (nothing by default)",
                      " ");
    registerParameter("PRWActualMu_FS",
                      "List of actual mu files for full sim samples, seperated by spaces (nothing by default)", " ");
    registerParameter("PRWActualMu_AF",
                      "List of actual mu files only for fast sim samples, seperated by spaces (nothing by default)",
                      " ");
624
625
626
627
628
629
    registerParameter("PRWLumiCalcFiles", "List of PU lumicalc files, seperated by spaces (nothing by default)", " ");
    registerParameter("PRWUseGRLTool", "Pass the GRL tool to the PU reweighting tool (False by default)", "False");
    registerParameter("PRWMuDependent",
                      "Use mu dependent random run numbers for MC. "
                      "True or False (default True)",
                      "True");
630
631
632
633
634
    registerParameter("PRWCustomScaleFactor",
                      "Specify custom scale-factor and up/down variations, for specific studies."
                      "Format is \'nominal:up:down\'."
                      "If nothing is set, the default values will be used (recommended).",
                      " ");
Tomas Dado's avatar
Tomas Dado committed
635
636
637
638
639
640
    registerParameter("PRWUnrepresentedDataTolerance",
                      "Specify value between 0 and 1 to represent acceptable fraction of unrepresented data in PRW [default: 0.05]",
                      "0.05");
    registerParameter("PRWPeriodAssignments",
                      "Specify period number assignments to run numbers ranges in this form: \"XXX:XXX:XXX\", where XXX are runnumbers, first number is the associated run number, second number is the period block start, the third number is the period block end. You can pass any number of these sets (total number of provided RunNumbers needs to be divisible by 3). Default is used if not specified",
                      " ");
641
642

    registerParameter("MuonTriggerSF", "Muon trigger SFs to calculate", "HLT_mu20_iloose_L1MU15_OR_HLT_mu50");
643

Tomas Dado's avatar
Tomas Dado committed
644
645
646
647
648
649
650
    registerParameter("KLFitterTransferFunctionsPath", "Select the transfer functions to use", "mc12a/akt4_LCtopo_PP6");
    registerParameter("KLFitterOutput", "Select the KLFitter output (FULL, FITTEDTOPS_ONLY, JETPERM_ONLY)", "FULL");
    registerParameter("KLFitterJetSelectionMode",
                      "kLeadingThree , kLeadingFour , kLeadingFive , kLeadingSix , kLeadingSeven , kLeadingEight , kBtagPriorityThreeJets , kBtagPriorityFourJets , kBtagPriorityFiveJets, kBtagPrioritySixJets , kBtagPrioritySevenJets , kBtagPriorityEightJets",
                      "kBtagPriorityFourJets");
    registerParameter("KLFitterBTaggingMethod", "Recommend use kNotag or kVetoNoFit - see KLFitter TWiki", "kNotag");
    registerParameter("KLFitterLH",
651
                      "Select likelihood depending on signal, ttbar, ttbar_JetAngles, ttbar_Angular, ttH, ttZTrilepton, ttbar_AllHadronic, ttbar_BoostedLJets",
Tomas Dado's avatar
Tomas Dado committed
652
653
654
655
656
657
658
                      "ttbar");
    registerParameter("KLFitterTopMassFixed", "Fix the mass of the top quark? True or False", "True");
    registerParameter("KLFitterSaveAllPermutations",
                      "Save All permutations to the output file (False will save only the best)", "False");
    registerParameter("KLFitterFailOnLessThanXJets",
                      "Fail if kLeadingX or kBtagPriorityXJets is set and the number of jets in the event is less than X (Default is False)",
                      "False");
659
660
661
662

    registerParameter("DynamicKeys", "Additional dynamic key list seperated by ,", "");

    registerParameter("OverlapRemovalProcedure", "Overlap removal procedure to be used. Options include:"
Tomas Dado's avatar
Tomas Dado committed
663
                                                 " recommended [default], jetmuApplyRelPt, harmonized,"
664
665
                                                 " Boosted, BoostedSlidingDREl, BoostedSlidingDRMu, BoostedSlidingDRElMu, noTauJetOLR, "
                                                 " noPhotonMuOR, noPhotonMuOrJetOR",
666
                      "recommended"
Tomas Dado's avatar
Tomas Dado committed
667
                      );
668

Tomas Dado's avatar
Tomas Dado committed
669
670
671
672
    registerParameter("OverlapRemovalSlidingInnerDRel",
                      "Overlap removal inner radius to be used for electron SlidingDR ,", "0.2");
    registerParameter("OverlapRemovalSlidingInnerDRmu", "Overlap removal inner radius to be used for muon SlidingDR ,",
                      "0.2");
673
674
    registerParameter("OverlapRemovalParticleLevelUseRapidity", "Use rapidity instead of pseudo-rapidity for DeltaR"
                                                                " calculation for overlap removal in particle level ","False", {"True", "False"});
675

Tomas Dado's avatar
Tomas Dado committed
676
677
    registerParameter("LargeJetOverlapRemoval",
                      "Perform overlap removal including large-R jets. True or False (default: False).", "False");
678
679

    registerParameter("HLLHC",
Tomas Dado's avatar
Tomas Dado committed
680
681
682
                      "Set to run HL-LHC studies,"
                      "True or False (default False)",
                      "False");
683

684
685
686
687
688
    registerParameter("HLLHCFakes",
                      "Set to enable Fakes HL-LHC studies,"
                      "True or False (default False)",
                      "False");

689
    registerParameter("SaveBootstrapWeights", "Set to true in order to save Poisson bootstrap weights,"
Tomas Dado's avatar
Tomas Dado committed
690
                                              "True or False (default False)", "False");
691

692
    registerParameter("NumberOfBootstrapReplicas", "Define integer number of replicas to be stored with bootstrapping, "
Tomas Dado's avatar
Tomas Dado committed
693
                                                   "Default 100", "100");
694

695
    registerParameter("UseBadBatmanCleaning", "Switch to turn on BadBatman cleanig.", "False");
Tomas Dado's avatar
Tomas Dado committed
696
697
698
699
700
701
    registerParameter("BadBatmanCleaningRange",
                      "Set a range of RunNumbers where the cleaning is applied in the form of XXXXX:YYYYY",
                      "276262:311481");
    registerParameter("UseEventLevelJetCleaningTool",
                      "Switch to turn on event-level jet cleaning tool (for testing), True or False (default False)",
                      "False");
702

Tomas Dado's avatar
Tomas Dado committed
703
704
705
706
707
708
709
710
711
712
713
714
715
    registerParameter("UseGlobalLeptonTriggerSF",
                      "Switch to activate event-level trigger scale factors allowing multiple OR of single-, di-, tri- lepton triggers, True or False (default False)",
                      "False");
    registerParameter("GlobalTriggers",
                      "Trigger list for GlobalLeptonTriggerSF - Format as 2015@trig1,trig2 2016@trig3,trig4 : Separate periods defined with @ using whitespace, triggers with comma (default: None)",
                      "None");
    registerParameter("GlobalTriggersLoose",
                      "Trigger list for GlobalLeptonTriggerSF - Format as 2015@trig1,trig2 2016@trig3,trig4 : Separate periods defined with @ using whitespace, triggers with comma (default: None)",
                      "None");
    registerParameter("ElectronTriggers", "Deprecated, use GlobalTriggers instead.", "None");
    registerParameter("ElectronTriggersLoose", "Deprecated, use GlobalTriggersLoose instead.", "None");
    registerParameter("MuonTriggers", "Deprecated, use GlobalTriggers instead.", "None");
    registerParameter("MuonTriggersLoose", "Deprecated, use GlobalTriggersLoose instead.", "None");
716

717
718
719
    registerParameter("DemandPrimaryVertex",
                      "Wether at least one primary vertex in event is required. Default True. For debugging purposes only!",
                      "True");
720

721
    registerParameter("KillExperimental", "Disable some specific experimental feature.", " ");
722
723
724
    registerParameter("RedefineMCMCMap",
                      "Dictionary for translating the shower names from TopDataPreparation. Format: \"shower1:shower2,shower3:shower4\".",
                      " ");
Tomas Dado's avatar
Tomas Dado committed
725
  }
726

Tomas Dado's avatar
Tomas Dado committed
727
728
  ConfigurationSettings* ConfigurationSettings::get() {
    if (!m_instance) m_instance = new ConfigurationSettings();
729
730

    return m_instance;
Tomas Dado's avatar
Tomas Dado committed
731
  }
732

Tomas Dado's avatar
Tomas Dado committed
733
  void ConfigurationSettings::loadFromFile(const std::string& filename) {
734
735
736
    std::ifstream input(filename.c_str());

    if (!input) {
737
      throw std::runtime_error("Configuration file does not exist: " + filename);
738
739
740
    }

    struct SelectionData {
Tomas Dado's avatar
Tomas Dado committed
741
742
743
      std::string name;
      bool isSub;
      std::vector<std::string> cuts;
744
745
746
747
748
    };
    std::string line;
    std::vector<SelectionData> selections;

    //for the key-value pairs
Tomas Dado's avatar
Tomas Dado committed
749
750
751
    while (std::getline(input, line)) {
      std::string newstring(line);

752
753
754
755
756
757
      // search for '#' character to discard commented-out part of line
      // however ignore '\#' -- used to be able to type # in our config
      // and not be recognized as commenting character
      size_t commentpos = size_t(-1);
      while (true) {
        // find next occurence of '#' -- after the already scanned chars
758
759
        commentpos = newstring.find("#", commentpos + 1);
        if (commentpos == std::string::npos) break;
760
761
762
763
764
        if (commentpos == 0) { // the whole line is a comment, to be ignored
          newstring = "";
          break;
        }
        // if it's '\#', then do not erase this part, but remove the '\'
765
766
767
768
        if (newstring.compare(commentpos - 1, 1, "\\") == 0) {
          newstring.erase(commentpos - 1, 1);
          --commentpos; // the position of the '#' shifted after removing '\'
          continue;
769
770
771
772
773
        } else {
          newstring = newstring.substr(0, commentpos);
          break;
        }
      }
Tomas Dado's avatar
Tomas Dado committed
774
775

      // remove (multiple) spaces hanging around relevant information
yili's avatar
yili committed
776
      // if a pair of "" appears, the spaces in "" won't be touched
777
      bool hasquote = (newstring.find("\"", 0) != std::string::npos);
yili's avatar
yili committed
778
      if (!hasquote) boost::algorithm::trim_all(newstring);
779
      else {
yili's avatar
yili committed
780
781
782
783
784
        //split the string into segments, separated by pairs of quotes
        //e.g. the string "abc \"def\" ghi"
        //     becomes a vector of 3 strings: "abc", "\"def\"", "ghi"
        std::vector<std::string> segments;
        std::vector<bool> segments_isquote;
yili's avatar
yili committed
785
786
        std::size_t strsize = newstring.size();
        std::size_t tmppos = 0;
yili's avatar
yili committed
787
        bool leftquote = true;
788
        while (tmppos <= strsize - 1) {
yili's avatar
yili committed
789
          // find the position of the 1st quote after newstring[tmppos]
790
791
792
793
794
795
796
          std::size_t tmppos2 = newstring.find_first_of("\"", tmppos);

          // when the quote found has \ ahead of it, jump over and update tmppos2
          std::size_t tmppos3 = newstring.find_first_of("\\\"", tmppos);
          while (tmppos2 == tmppos3 + 1) {
            tmppos3 = newstring.find_first_of("\\\"", tmppos2 + 1);
            tmppos2 = newstring.find_first_of("\"", tmppos2 + 1);
yili's avatar
yili committed
797
798
799
800
          }

          // when no more quote found, save the segment from the last rightquote to the end, then quit the loop
          if (tmppos2 == std::string::npos) {
801
            segments.push_back(newstring.substr(tmppos, strsize - tmppos));
yili's avatar
yili committed
802
803
804
805
806
807
            segments_isquote.push_back(false);
            break;
          }

          // check it's a left quote or right quote
          if (leftquote) {
808
            segments.push_back(newstring.substr(tmppos, tmppos2 - tmppos));
yili's avatar
yili committed
809
810
811
            segments_isquote.push_back(false);

            // update the position indicator and leftquote flag
812
            tmppos = tmppos2 + 1;
yili's avatar
yili committed
813
814
            leftquote = false;
          } else {
815
816
817
            segments.push_back(newstring.substr(tmppos - 1, tmppos2 - (tmppos - 1) + 1)); // have to include the two
                                                                                          // quotes, which is why +/-1
                                                                                          // adjustment is introduced
yili's avatar
yili committed
818
819
820
            segments_isquote.push_back(true);

            // update the position indicator and leftquote flag
821
            tmppos = tmppos2 + 1;
yili's avatar
yili committed
822
823
824
825
            leftquote = true;
          }
        }

826
827
        // sanity check: if leftquote = false after the loop, it means a left quote is found but not its associated
        // rightquote
yili's avatar
yili committed
828
829
        // in this case, crash the code
        if (!leftquote) {
yili's avatar
yili committed
830
831
832
          std::string message = "Problematic configuration line\n";
          message.append(newstring.c_str());
          throw std::invalid_argument(message);
yili's avatar
yili committed
833
        }
yili's avatar
yili committed
834

yili's avatar
yili committed
835
        //run the original trim_all for each segment that is NOT a quote
yili's avatar
yili committed
836
        for (uint i = 0; i < segments.size(); i++) {
yili's avatar
yili committed
837
838
839
840
841
842
          std::string seg = segments.at(i);
          if (seg.size() == 0) continue;
          if (segments_isquote.at(i)) continue;
          boost::algorithm::trim_all(seg);

          // if the segment has a space in the end and it's not the last segment, add the space back
843
844
          if (i + 1 != segments.size()) {
            if (segments.at(i).at(segments.at(i).size() - 1) == ' ') {
yili's avatar
yili committed
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
              seg += " ";
            }
          }
          // if the segment has a space in the head and it's not the first segment, add the space back
          if (i != 0) {
            if (segments.at(i).at(0) == ' ') {
              seg = " " + seg;
            }
          }

          // update the segment
          segments.at(i) = seg;
        }

        // combine the segments back to newstring
        newstring = "";
yili's avatar
yili committed
861
        for (uint i = 0; i < segments.size(); i++) {
yili's avatar
yili committed
862
863
          newstring += segments.at(i);
        }
yili's avatar
yili committed
864
865
      }

Tomas Dado's avatar
Tomas Dado committed
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
      if (newstring.empty()) continue;

      // handle start of a (sub)selection (implies end of key-value section)
      if (boost::algorithm::starts_with(newstring, "SELECTION ")) {
        selections.push_back({newstring.substr(10), false, {}});
        continue;
      }
      if (boost::algorithm::starts_with(newstring, "SUB ")) {
        selections.push_back({newstring.substr(4), true, {}});
        continue;
      }

      if (!selections.empty()) {
        // read body of (sub)selection
        auto& sel = selections.back();
        if (boost::algorithm::starts_with(newstring, ". ")) {
          // source another (sub)selection here
          auto subselName = newstring.substr(2);
          auto subselIt = std::find_if(selections.rbegin(), selections.rend(),
                                       [subselName](SelectionData const& sel) {
            return(subselName == sel.name);
          });
          if (subselIt == selections.rend()) throw std::invalid_argument(
                    "ConfigurationSettings: unknown selection: " + subselName);
          sel.cuts.insert(sel.cuts.end(), subselIt->cuts.begin(), subselIt->cuts.end());
        } else {
          sel.cuts.push_back(newstring);
893
        }
Tomas Dado's avatar
Tomas Dado committed
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
        continue;
      }

      // parse key-value pair
      std::istringstream liness(newstring);
      std::string key;
      std::string value;

      std::getline(liness, key, ' '); //to the space
      std::getline(liness, value); //to the end of the line

      auto its = strings_.find(key);
      if (its != strings_.end()) {
        its->second.m_data = value;
        its->second.m_set = true;
909
910
911
912
      } else {
        ATH_MSG_ERROR("\n\nConfig file includes non-existant option: " << key
            << "\nThis option either does not exist anymore, or you have a typo.");
        throw std::runtime_error("Unsupported config option.");
Tomas Dado's avatar
Tomas Dado committed
913
914
915
916
917
918
919
920
921
922
923
      }

      //// add dynamic keys
      if ("DynamicKeys" == key) {
        std::vector<std::string> listofkeys;
        std::string separator = ",";
        std::string::size_type start = 0, end = 0;
        while ((end = value.find(separator, start)) != std::string::npos) {
          std::string token = value.substr(start, end - start);
          if (token.size()) listofkeys.push_back(token);
          start = end + 1;
924
925
        }

Tomas Dado's avatar
Tomas Dado committed
926
927
        std::string lasttoken = value.substr(start);
        if (lasttoken.size()) listofkeys.push_back(lasttoken);
928

Tomas Dado's avatar
Tomas Dado committed
929
930
        for (auto par : listofkeys) {
          registerParameter(par, "Dynamic parameter", "");
931
        }
Tomas Dado's avatar
Tomas Dado committed
932
      }
933
934
    }

Tomas Dado's avatar
Tomas Dado committed
935
936
937
    for (auto& sel : selections) {
      if (sel.isSub) continue;
      m_selections.push_back({sel.name, sel.cuts});
938
939
    }

940
    {
Tomas Dado's avatar
Tomas Dado committed
941
942
943
944
945
946
947
      auto const& it = strings_.find("KillExperimental");
      m_killedFeatures.clear();
      if (it != strings_.end() && it->second.m_set) {
        std::string strValue(it->second.m_data);
        boost::trim(strValue);
        boost::split(m_killedFeatures, strValue, boost::is_any_of(" "));
      }
948
949
    }

950
951
    input.close();
    m_configured = true;
Tomas Dado's avatar
Tomas Dado committed
952
  }
953

954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
  void ConfigurationSettings::checkSettings() {
    for (const std::pair<std::string, StringData>& entry : strings_) {
      const StringData& data = entry.second;
      // if the config option restricts allowed values to some limited set,
      // check that the configured value is valid
      if (!data.m_allowed_values.empty()) {
        if (std::find(data.m_allowed_values.begin(), data.m_allowed_values.end(),data.m_data) == data.m_allowed_values.end()) {
          ATH_MSG_ERROR("Unsupported value specified for config option " << entry.first << ": " << data.m_data
              << "\nAllowed values: " << boost::algorithm::join(data.m_allowed_values, ", "));
          throw std::runtime_error("Unsupported value for config option");
        }
      }
    }
  }

Tomas Dado's avatar
Tomas Dado committed
969
  void ConfigurationSettings::registerParameter(const std::string& name, const std::string& message,
970
971
                                                const std::string& default_val,
                                                const std::vector<std::string> allowed_values) {
972
    StringData data;
Tomas Dado's avatar
Tomas Dado committed
973

974
975
    data.m_data = default_val;
    data.m_human_explanation = message;
976
977
    data.m_default_val = default_val;
    data.m_allowed_values = allowed_values;
978
979
    data.m_set = (default_val.empty() ? false : true);
    strings_[name] = data;
Tomas Dado's avatar
Tomas Dado committed
980
  }
981

Tomas Dado's avatar
Tomas Dado committed
982
  const std::string& ConfigurationSettings::value(const std::string& key) const {
983
984
    //This class never has loadFromFile called
    if (!m_configured) {
Tomas Dado's avatar
Tomas Dado committed
985
986
987
988
      std::string message = "ConfigurationSettings: Not correctly configured\n";
      message.append("You need to call top::ConfigurationSettings::get()->loadFromFile(filename)\n");
      message.append("Early in your program\n");
      throw std::invalid_argument(message);
989
990
991
992
993
    }

    std::map<std::string, StringData>::const_iterator its = strings_.find(key);
    //The string is not in the map
    if (its == strings_.end()) {
Tomas Dado's avatar
Tomas Dado committed
994
      throw std::invalid_argument("ConfigurationSettings: The variable doesn't exist in the code " + key);
995
996
997
998
    }

    //In the map, but never set to anything
    if (!its->second.m_set) {
Tomas Dado's avatar
Tomas Dado committed
999
      throw std::invalid_argument("ConfigurationSettings: You never set a value for " + key);
1000
    }