ATLAS Offline Software
Loading...
Searching...
No Matches
SUSYToolsInit.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7// For making the systematics list and looping through it
10
11// For the data types to be used in configuring tools
13
14// For the tau tool initialization
16
17// For the struct needed for OR init
19
20// Abstract interface classes
23
30
41
47
53
55//disable #include "IsolationSelection/IIsolationLowPtPLVTool.h"
58
62
67// Can't use the abstract interface for this one (see header comment)
69
77
79
80#ifndef XAOD_STANDALONE
82#endif
83
84using namespace ST;
85
86
87
88#define CONFIG_EG_EFF_TOOL( TOOLHANDLE, TOOLNAME, CORRFILE ) \
89 if( !TOOLHANDLE.isUserConfigured() ) { \
90 TOOLHANDLE.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+TOOLNAME); \
91 std::vector< std::string > corrFileNameList = {CORRFILE}; \
92 ATH_CHECK( TOOLHANDLE.setProperty("CorrectionFileNameList", corrFileNameList) ); \
93 if(!isData()) \
94 ATH_CHECK (TOOLHANDLE.setProperty("ForceDataType", static_cast<int>(data_type))); \
95 ATH_CHECK( TOOLHANDLE.setProperty("CorrelationModel", m_EG_corrModel) ); \
96 ATH_CHECK( TOOLHANDLE.setProperty("OutputLevel", this->msg().level()) ); \
97 ATH_CHECK( TOOLHANDLE.initialize() ); \
98 } else ATH_CHECK(TOOLHANDLE.retrieve());
99
100#define CONFIG_EG_EFF_TOOL_KEY( TOOLHANDLE, TOOLNAME, KEYNAME, KEY, MAP ) \
101 if( !TOOLHANDLE.isUserConfigured() ) { \
102 TOOLHANDLE.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+TOOLNAME); \
103 ATH_MSG_INFO( "Will now set key \"" << KEYNAME << "\" to value \"" << KEY << "\" when configuring an AsgElectronEfficiencyCorrectionTool" ); \
104 ATH_CHECK( TOOLHANDLE.setProperty(KEYNAME, KEY) ); \
105 if(!isData()) \
106 ATH_CHECK (TOOLHANDLE.setProperty("ForceDataType", static_cast<int>(data_type))); \
107 ATH_CHECK( TOOLHANDLE.setProperty("CorrelationModel", m_EG_corrModel) ); \
108 ATH_CHECK( TOOLHANDLE.setProperty("OutputLevel", this->msg().level()) ); \
109 ATH_CHECK( TOOLHANDLE.setProperty("MapFilePath", MAP) ); \
110 ATH_CHECK( TOOLHANDLE.initialize() ); \
111 } else if (!isData()) ATH_CHECK(TOOLHANDLE.retrieve());
112
114{
115 if (m_dataSource < 0) {
116 ATH_MSG_FATAL("Data source incorrectly configured!!");
117 ATH_MSG_FATAL("You must set the DataSource property to Data, FullSim or AtlfastII !!");
118 ATH_MSG_FATAL("Expect segfaults if you're not checking status codes, which you should be !!");
119 return StatusCode::FAILURE;
120 }
121
122 if (m_subtool_init) {
123 ATH_MSG_INFO("SUSYTools subtools already created. Ignoring this call.");
124 ATH_MSG_INFO("Note: No longer necessary to explicitly call SUSYToolsInit. Will avoid creating tools again.");
125 return StatusCode::SUCCESS;
126 }
127
128 // /////////////////////////////////////////////////////////////////////////////////////////
129 // Initialise PileupReweighting Tool
130
131 if (!m_prwTool.isUserConfigured()) {
132 ATH_MSG_DEBUG("Will now init the PRW tool");
133 std::vector<std::string> file_conf;
134 for (UInt_t i = 0; i < m_prwConfFiles.size(); i++) {
135 ATH_MSG_INFO("Adding PRW file: " << m_prwConfFiles.at(i));
136 file_conf.push_back(m_prwConfFiles.at(i));
137 }
138
139 std::vector<std::string> file_ilumi;
140 for (UInt_t i = 0; i < m_prwLcalcFiles.size(); i++) {
141 ATH_MSG_INFO("Adding ilumicalc file: " << m_prwLcalcFiles.at(i));
142 file_ilumi.push_back(m_prwLcalcFiles.at(i));
143 }
144
145 m_prwTool.setTypeAndName("CP::PileupReweightingTool/PrwTool");
146 ATH_CHECK( m_prwTool.setProperty("ConfigFiles", file_conf) );
147 ATH_CHECK( m_prwTool.setProperty("LumiCalcFiles", file_ilumi) );
148 ATH_CHECK( m_prwTool.setProperty("DataScaleFactor", m_prwDataSF) ); // 1./1.03 -> default for mc16, see: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ExtendedPileupReweighting#Tool_Properties
149 ATH_CHECK( m_prwTool.setProperty("DataScaleFactorUP", m_prwDataSF_UP) ); // 1. -> old value (mc15), as the one for mc16 is still missing
150 ATH_CHECK( m_prwTool.setProperty("DataScaleFactorDOWN", m_prwDataSF_DW) ); // 1./1.18 -> old value (mc15), as the one for mc16 is still missing
151 ATH_CHECK( m_prwTool.setProperty("TrigDecisionTool", m_trigDecTool.getHandle()) );
152 ATH_CHECK( m_prwTool.setProperty("UseRunDependentPrescaleWeight", m_runDepPrescaleWeightPRW) );
153 ATH_CHECK( m_prwTool.setProperty("OutputLevel", MSG::WARNING) );
154 ATH_CHECK( m_prwTool.retrieve() );
155 } else {
156 ATH_MSG_INFO("Using user-configured PRW tool");
157 ATH_CHECK( m_prwTool.retrieve() );
158 }
159
161 // Initialize LRT systematics tool
162 if (!m_LRTuncTool.isUserConfigured() && !isData())
163 {
164 ATH_MSG_INFO("Initializing LRT uncertainty tool");
165 m_LRTuncTool.setTypeAndName("InDet::InclusiveTrackFilterTool/LRTUncTool");
166 ATH_CHECK( m_LRTuncTool.setProperty("Seed", 1) );
167 if (m_isRun3) {
168 if (m_mcCampaign == "mc23d" || m_mcCampaign == "mc23e")
169 ATH_MSG_WARNING("Please note that current ID recommendations only cover mc23a and not (yet) mc23d/e!");
170 ATH_CHECK( m_LRTuncTool.setProperty("calibFileLRTEff", "InDetTrackSystematicsTools/CalibData_25.2_2025-v00/LargeD0TrackingRecommendations_mc23a.root") );
171 }
172 else
173 ATH_CHECK( m_LRTuncTool.setProperty("calibFileLRTEff", "InDetTrackSystematicsTools/CalibData_24.0_2023-v00/LargeD0TrackingRecommendations_20230824.root") );
174 ATH_CHECK(m_LRTuncTool.retrieve());
175 } else {
176 ATH_MSG_INFO("Using user-configured LRT uncertainty tool");
177 ATH_CHECK(m_LRTuncTool.retrieve());
178 }
179
180 std::string toolName; // to be used for tool init below, keeping explicit string constants a minimum /CO
181
182 std::string jetname,jetcoll,fatjetcoll;
183 if (m_slices["jet"]) {
185 // Initialise jet calibration tool
186
187 // pick the right config file for the JES tool : https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ApplyJetCalibrationR22
189 jetcoll = jetname + "Jets";
190
191 if (!m_jetCalibTool.isUserConfigured()) {
192 toolName = "JetCalibTool_" + jetname;
193 m_jetCalibTool.setTypeAndName("JetCalibrationTool/"+toolName);
194 std::string JES_config_file, calibseq;
195
197 ATH_MSG_ERROR("Unknown (unsupported) jet collection is used, (m_jetInputType = " << m_jetInputType << ")");
198 return StatusCode::FAILURE;
199 }
200
201 std::string JESconfig = isAtlfast() ? m_jesConfigAFII : m_jesConfig;
202 if(isAtlfast() && m_isRun3) {
203 ATH_MSG_WARNING("Jet JES/JER recommendations currently not available for fast sim in Run 3, falling back to full sim version");
204 JESconfig = m_jesConfig;
205 }
206
207 calibseq = m_jesCalibSeq;
208 JES_config_file = JESconfig;
209
210 // remove Insitu if it's in the string if not data
211 if (!isData()) {
212 std::string insitu("_Insitu");
213 auto found = calibseq.find(insitu);
214 if(found != std::string::npos){
215 calibseq.erase(found, insitu.length());
216 }
217 }
218
219 // JMS calibration (if requested)
220 if (m_JMScalib){
221 ATH_MSG_ERROR("JMS calibration is not supported yet for R22. Please modify your settings.");
222 return StatusCode::FAILURE;
223 }
224
225 // now instantiate the tool
226 ATH_CHECK( m_jetCalibTool.setProperty("JetCollection", jetname) );
227 ATH_CHECK( m_jetCalibTool.setProperty("ConfigFile", JES_config_file) );
228 ATH_CHECK( m_jetCalibTool.setProperty("CalibSequence", calibseq) );
229 ATH_CHECK( m_jetCalibTool.setProperty("CalibArea", m_jesCalibArea) );
230 ATH_CHECK( m_jetCalibTool.setProperty("IsData", isData()) );
231 ATH_CHECK( m_jetCalibTool.setProperty("OutputLevel", this->msg().level()) );
232 ATH_CHECK( m_jetCalibTool.retrieve() );
233 } else ATH_CHECK(m_jetCalibTool.retrieve());
234 }
235
236 if (m_slices["fjet"]) {
237 //same for fat groomed jets
238 fatjetcoll = m_fatJets;
239
240 if(fatjetcoll == "AnalysisLargeRJets") {
241 ATH_MSG_DEBUG("Fall back to calibration for AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets, original name for AnalysisLargeRJets");
242 fatjetcoll = "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets";
243 }
244 if (fatjetcoll.size()>3)fatjetcoll.erase(fatjetcoll.size()-4,4);
245 if (!m_jetFatCalibTool.isUserConfigured() && !m_fatJets.empty()) {
246 toolName = "JetFatCalibTool_" + m_fatJets;
247 m_jetFatCalibTool.setTypeAndName("JetCalibrationTool/"+toolName);
248
249 std::string jesConfigFat = m_jesConfigFat;
250 std::string jesCalibSeqFat = m_jesCalibSeqFat;
251 // add Insitu if data
252 if(isData()) jesCalibSeqFat += "_Insitu";
253
254 // now instantiate the tool
255 ATH_CHECK( m_jetFatCalibTool.setProperty("JetCollection", fatjetcoll) );
256 ATH_CHECK( m_jetFatCalibTool.setProperty("ConfigFile", jesConfigFat) );
257 ATH_CHECK( m_jetFatCalibTool.setProperty("CalibSequence", jesCalibSeqFat) );
258 // always set to false : https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ApplyJetCalibrationR21
259 ATH_CHECK( m_jetFatCalibTool.setProperty("IsData", isData()) );
260 ATH_CHECK( m_jetFatCalibTool.setProperty("OutputLevel", this->msg().level()) );
261 ATH_CHECK( m_jetFatCalibTool.retrieve() );
262 } else if (m_jetFatCalibTool.isUserConfigured()) ATH_CHECK(m_jetFatCalibTool.retrieve());
263 }
264
265 if (m_slices["fjet"]) {
267 // Initialise Boson taggers: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BoostedJetTaggingRecommendationFullRun2#Higgs_taggers
268 if (!m_WTaggerTool.isUserConfigured() && !m_WtagConfig.empty()) {
269 m_WTaggerTool.setTypeAndName("SmoothedWZTagger/WTagger");
270 ATH_CHECK( m_WTaggerTool.setProperty("ContainerName", m_fatJets) );
271 ATH_CHECK( m_WTaggerTool.setProperty("ConfigFile", m_WtagConfig) );
272 ATH_CHECK( m_WTaggerTool.setProperty("CalibArea", m_WZTaggerCalibArea) );
273 ATH_CHECK( m_WTaggerTool.setProperty("IsMC",!isData()));
274#ifndef XAOD_STANDALONE
275 ATH_CHECK( m_WTaggerTool.setProperty("SuppressOutputDependence", true) );
276#endif
277 ATH_CHECK( m_WTaggerTool.setProperty("OutputLevel", this->msg().level()) );
278 ATH_CHECK( m_WTaggerTool.retrieve() );
279
280 // Retrieving DecorationName (needed to access tagging results downstream):
281 std::string WConfigPath = PathResolverFindCalibFile("BoostedJetTaggers/"+m_WZTaggerCalibArea+"/"+m_WtagConfig);
282 if ( m_WconfigReader.ReadFile( WConfigPath.c_str(), EEnvLevel(0) ) ) {
283 ATH_MSG_ERROR( "Error while reading large-R config file : " << WConfigPath );
284 return StatusCode::FAILURE;
285 }
286 else ATH_MSG_DEBUG( "Successfully read large-R config file : " << WConfigPath );
287
288 m_WDecorName = m_WconfigReader.GetValue("DecorationName" ,"");
289 ANA_MSG_DEBUG( "Found DecorationName in large-R config file : " << m_WDecorName );
290
291 } else if (m_WTaggerTool.isUserConfigured()) ATH_CHECK(m_WTaggerTool.retrieve());
292
293 if (!m_ZTaggerTool.isUserConfigured() && !m_ZtagConfig.empty()) {
294 m_ZTaggerTool.setTypeAndName("SmoothedWZTagger/ZTagger");
295 ATH_CHECK( m_ZTaggerTool.setProperty("ContainerName", m_fatJets) );
296 ATH_CHECK( m_ZTaggerTool.setProperty("ConfigFile", m_ZtagConfig) );
297 ATH_CHECK( m_ZTaggerTool.setProperty("CalibArea", m_WZTaggerCalibArea) );
298 ATH_CHECK( m_ZTaggerTool.setProperty("IsMC",!isData()));
299#ifndef XAOD_STANDALONE
300 ATH_CHECK( m_ZTaggerTool.setProperty("SuppressOutputDependence", true) );
301#endif
302 ATH_CHECK( m_ZTaggerTool.setProperty("OutputLevel", this->msg().level()) );
303 ATH_CHECK( m_ZTaggerTool.retrieve() );
304
305 // Retrieving DecorationName (needed to access tagging results downstream):
306 std::string ZConfigPath = PathResolverFindCalibFile("BoostedJetTaggers/"+m_WZTaggerCalibArea+"/"+m_ZtagConfig);
307 if ( m_ZconfigReader.ReadFile( ZConfigPath.c_str(), EEnvLevel(0) ) ) {
308 ATH_MSG_ERROR( "Error while reading large-R config file : " << ZConfigPath );
309 return StatusCode::FAILURE;
310 }
311 else ATH_MSG_DEBUG( "Successfully read large-R config file : " << ZConfigPath );
312
313 m_ZDecorName = m_ZconfigReader.GetValue("DecorationName" ,"");
314 ANA_MSG_DEBUG( "Found DecorationName in large-R config file : " << m_ZDecorName );
315
316 } else if (m_ZTaggerTool.isUserConfigured()) ATH_CHECK(m_ZTaggerTool.retrieve());
317
318 if (!m_TopTaggerTool.isUserConfigured() && !m_ToptagConfig.empty()) {
319 m_TopTaggerTool.setTypeAndName("JSSWTopTaggerDNN/TopTagger");
320 ATH_CHECK( m_TopTaggerTool.setProperty("ContainerName", m_fatJets) );
321 ATH_CHECK( m_TopTaggerTool.setProperty("ConfigFile", m_ToptagConfig) );
322 ATH_CHECK( m_TopTaggerTool.setProperty("CalibArea", m_TopTaggerCalibArea) );
323 ATH_CHECK( m_TopTaggerTool.setProperty("IsMC",!isData()));
324#ifndef XAOD_STANDALONE
325 ATH_CHECK( m_TopTaggerTool.setProperty("SuppressOutputDependence", true) );
326#endif
327 ATH_CHECK( m_TopTaggerTool.setProperty("OutputLevel", this->msg().level()) );
328 ATH_CHECK( m_TopTaggerTool.retrieve() );
329
330 // Retrieving DecorationName (needed to access tagging results downstream):
331 std::string TopConfigPath = PathResolverFindCalibFile("BoostedJetTaggers/"+m_TopTaggerCalibArea+"/"+m_ToptagConfig);
332 if ( m_TopconfigReader.ReadFile( TopConfigPath.c_str(), EEnvLevel(0) ) ) {
333 ATH_MSG_ERROR( "Error while reading large-R config file : " << TopConfigPath );
334 return StatusCode::FAILURE;
335 }
336 else ATH_MSG_DEBUG( "Successfully read large-R config file : " << TopConfigPath );
337
338 m_TopDecorName = m_TopconfigReader.GetValue("DecorationName" ,"");
339 ANA_MSG_DEBUG( "Found DecorationName in large-R config file : " << m_TopDecorName );
340
341 } else if (m_TopTaggerTool.isUserConfigured()) ATH_CHECK(m_TopTaggerTool.retrieve());
342
344 // Initialise JetTruthLabelingTool: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2019LargeR#AnalysisBase_21_2_114_and_newer
345 if(!isData()) {
346 m_label_truthKey = fatjetcoll+"."+m_JetTruthLabelName;
347 ATH_CHECK(m_label_truthKey.initialize());
348
349 if (!m_jetTruthLabelingTool.isUserConfigured()) {
350 m_jetTruthLabelingTool.setTypeAndName("JetTruthLabelingTool/ST_JetTruthLabelingTool");
351 ATH_CHECK( m_jetTruthLabelingTool.setProperty("RecoJetContainer", m_fatJets) );
352 ATH_CHECK( m_jetTruthLabelingTool.setProperty("TruthLabelName", m_JetTruthLabelName) );
353 ATH_CHECK( m_jetTruthLabelingTool.setProperty("OutputLevel", this->msg().level()) );
354 ATH_CHECK( m_jetTruthLabelingTool.retrieve() );
355 } else if (m_jetTruthLabelingTool.isUserConfigured()) ATH_CHECK(m_jetTruthLabelingTool.retrieve());
356 }
357 }
358
359 if (m_slices["jet"] || m_slices["fjet"]) {
360
361
363 // Initialise jet uncertainty tool
364 // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel22
365 ATH_MSG_INFO("Set up Jet Uncertainty tool...");
366
367 // if not set, derive the MCType from the simulation type and MC campaign
368 if (m_jetUncertaintiesMCType.empty()) m_jetUncertaintiesMCType = m_isRun3 ? (isAtlfast() ? "MC23AF3" : "MC23") : (isAtlfast() ? "AF3" : "MC20");
369
370 // large-R jets use MC20AF3 instead of AF3
372 if (m_fatJetUncertaintiesMCType == "AF3") {
373 m_fatJetUncertaintiesMCType = "MC20AF3";
374 }
375
376 if (!m_jetUncertaintiesTool.isUserConfigured()) {
377 std::string jetdef("AntiKt4" + xAOD::JetInput::typeName(xAOD::JetInput::Type(m_jetInputType)));
378
379 if(jetdef !="AntiKt4EMPFlow"){
380 ATH_MSG_WARNING("Jet Uncertaintes recommendations only exist for PFlow jets, falling back to AntiKt4EMPFlow");
381 jetdef = "AntiKt4EMPFlow";
382 }
383 toolName = "JetUncertaintiesTool_" + jetdef;
384
385 m_jetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName);
386
387 ATH_CHECK( m_jetUncertaintiesTool.setProperty("JetDefinition", jetdef) );
389 ATH_CHECK( m_jetUncertaintiesTool.setProperty("IsData", false) ); // Never use the PDSmearing for the nominal tool.
390 ATH_CHECK( m_jetUncertaintiesTool.setProperty("ConfigFile", m_jetUncertaintiesConfig) );
393 ATH_CHECK( m_jetUncertaintiesTool.setProperty("OutputLevel", this->msg().level()) );
394 ATH_CHECK( m_jetUncertaintiesTool.retrieve() );
395 } else ATH_CHECK( m_jetUncertaintiesTool.retrieve() );
396
397 ATH_MSG_INFO("Set up Jet PD Smear Uncertainty tool...");
398
399 if (!m_jetUncertaintiesPDSmearTool.isUserConfigured() && m_jetUncertaintiesPDsmearing == true) {
400 std::string jetdef("AntiKt4" + xAOD::JetInput::typeName(xAOD::JetInput::Type(m_jetInputType)));
401
402 if(jetdef !="AntiKt4EMPFlow"){
403 ATH_MSG_WARNING("Jet Uncertaintes recommendations only exist for PFlow jets, falling back to AntiKt4EMPFlow");
404 jetdef = "AntiKt4EMPFlow";
405 }
406 toolName = "JetUncertaintiesPDSmearTool_" + jetdef;
407
408 m_jetUncertaintiesPDSmearTool.setTypeAndName("JetUncertaintiesTool/"+toolName);
409
410 // If, for some reason, you're trying to use the PDSmear, with the reduced set return an error (you shouldn't do this, you're just going to duplicate the SimpleJER results.
411 bool JERUncPDsmearing = isData() ? isData() : m_jetUncertaintiesPDsmearing;
412 if (m_jetUncertaintiesConfig.find("SimpleJER") != std::string::npos && JERUncPDsmearing){
413 ATH_MSG_ERROR("You are trying to use the SimpleJER set, with PDsmearing. There is no functionality for this. Please fix your config file. Either run with PDSmear set to false, or run with the AllJER or FullJER sets.");
414 return StatusCode::FAILURE;
415 }
416 ATH_CHECK( m_jetUncertaintiesPDSmearTool.setProperty("JetDefinition", jetdef) );
418 ATH_CHECK( m_jetUncertaintiesPDSmearTool.setProperty("IsData", true) ); // Set to True by default for PDSmear-named tool.
419 ATH_CHECK( m_jetUncertaintiesPDSmearTool.setProperty("PseudoDataJERsmearingMode", true) );
422 ATH_CHECK( m_jetUncertaintiesPDSmearTool.setProperty("OutputLevel", this->msg().level()) );
424 } else{
425 ATH_MSG_DEBUG("Do not retrieve the jet PD Smearing tool if it is not configured");
426 //ATH_CHECK( m_jetUncertaintiesPDSmearTool.retrieve() );
427 }
428 }
429
430 if (m_slices["fjet"]) {
431
432 // JetUncertaintiesTool handles JES, JER and JMS uncertainties for large-R jets
433 if (!m_fatjetUncertaintiesTool.isUserConfigured() && !m_fatJets.empty() && !m_fatJetUncConfig.empty()) {
434
435 ATH_MSG_INFO("Set up Large-R Jet Uncertainty tool...");
436
437 // Print warning about missing large-R jets uncertainties for FastSim in mc23
438 if (m_isRun3 && isAtlfast())
439 ATH_MSG_WARNING("Uncertainties for large-R jets in mc23 and fast simulation not yet available; be aware uncertainties might be not complete!");
440
441 toolName = "JetUncertaintiesTool_" + m_fatJets;
442 m_fatjetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName);
443
444 ATH_CHECK( m_fatjetUncertaintiesTool.setProperty("JetDefinition", fatjetcoll) );
446 ATH_CHECK( m_fatjetUncertaintiesTool.setProperty("IsData", isData()) );
447 ATH_CHECK( m_fatjetUncertaintiesTool.setProperty("ConfigFile", m_fatJetUncConfig) );
449
450 //Restrict variables to be shifted if (required)
451 if( m_fatJetUncVars != "default" ){
452 std::vector<std::string> shift_vars = {};
453
454 std::string temp(m_fatJetUncVars);
455 do {
456 auto pos = temp.find(',');
457 shift_vars.push_back(temp.substr(0, pos));
458 if (pos == std::string::npos)
459 temp = "";
460 else
461 temp = temp.substr(pos + 1);
462
463 }
464 while (!temp.empty() );
465
466 ATH_CHECK( m_fatjetUncertaintiesTool.setProperty("VariablesToShift", shift_vars) );
467 }
468
469 ATH_CHECK( m_fatjetUncertaintiesTool.setProperty("OutputLevel", this->msg().level()) );
471 } else if (m_fatjetUncertaintiesTool.isUserConfigured()) ATH_CHECK(m_fatjetUncertaintiesTool.retrieve());
472
473
474 if (!m_fatjetUncertaintiesPDSmearTool.isUserConfigured() && !m_fatJets.empty() && !m_fatJetUncConfig.empty() && m_fatJetUncertaintiesPDsmearing == true) {
475
476 ATH_MSG_INFO("Set up Jet PD Smear Uncertainty tool...");
477
478 toolName = "JetUncertaintiesPDSmearTool_" + m_fatJets;
479 m_fatjetUncertaintiesPDSmearTool.setTypeAndName("JetUncertaintiesTool/"+toolName);
480
481 // If, for some reason, you're trying to use the PDSmear, with the reduced set return an error (you shouldn't do this, you're just going to duplicate the SimpleJER results.
482 bool JERUncPDsmearing = isData() ? isData() : m_fatJetUncertaintiesPDsmearing;
483 if (m_fatJetUncConfig.find("SimpleJER") != std::string::npos && JERUncPDsmearing){
484 ATH_MSG_ERROR("You are trying to use the SimpleJER set, with PDsmearing. There is no functionality for this. Please fix your config file. Either run with PDSmear set to false, or run with the AllJER or FullJER sets.");
485 return StatusCode::FAILURE;
486 }
487 ATH_CHECK( m_fatjetUncertaintiesPDSmearTool.setProperty("JetDefinition", fatjetcoll) );
489 ATH_CHECK( m_fatjetUncertaintiesPDSmearTool.setProperty("IsData", true) ); // Set to True by default for PDSmear-named tool.
490 ATH_CHECK( m_fatjetUncertaintiesPDSmearTool.setProperty("PseudoDataJERsmearingMode", true) );
493 ATH_CHECK( m_fatjetUncertaintiesPDSmearTool.setProperty("OutputLevel", this->msg().level()) );
495 } else{
496 ATH_MSG_DEBUG("Do not retrieve the jet PD Smearing tool if it is not configured");
497 }
498
499
500 // FFSmearingTool handles JMR uncertainties for large-R jets
501 if (!m_fatjetFFSmearingTool.isUserConfigured() && !m_fatJets.empty() && !m_fatJetUncConfig.empty()) {
502
503 ATH_MSG_INFO("Set up Large-R FFJetSmearingTool ...");
504
505 toolName = "FFJetSmearingTool_" + m_fatJets;
506 m_fatjetFFSmearingTool.setTypeAndName("CP::FFJetSmearingTool/"+toolName);
507
508 ATH_CHECK( m_fatjetFFSmearingTool.setProperty("MassDef", "UFO") );
510 ATH_CHECK( m_fatjetFFSmearingTool.setProperty("ConfigFile", "rel22/Spring2025_PreRec/R10_FullJMR.config") );
511 ATH_CHECK( m_fatjetFFSmearingTool.setProperty("OutputLevel", this->msg().level()) );
512 ATH_CHECK( m_fatjetFFSmearingTool.retrieve() );
513 } else if (m_fatjetFFSmearingTool.isUserConfigured()) ATH_CHECK(m_fatjetFFSmearingTool.retrieve());
514
515 // Need to keep track of systematics of FFJetSmearingTool
516 if (!m_fatJets.empty()) {
517 // m_fatjetFFSmearingSyst = CP::make_systematics_vector(m_fatjetFFSmearingTool->recommendedSystematics());
518 ATH_MSG_INFO("The following uncertainties have been defined for the m_fatjetFFSmearingTool");
519 for (auto & sysSet : m_fatjetFFSmearingTool->recommendedSystematics()){
520 m_fatjetFFSmearingSyst.push_back(CP::SystematicSet({sysSet}));
521 ATH_MSG_INFO(" - " << sysSet.name());
522 }
523 }
524
525 ATH_MSG_INFO(" Won't initialise Wtagger uncertainty tool for fat jets until we get rec for UFO");
526 // Won't initialise Wtagger uncertainty tool for fat jets until we get rec for UFO
527 /*
528 if (!m_WTagjetUncertaintiesTool.isUserConfigured() && !m_fatJets.empty() && !m_WtagConfig.empty() && !m_WTagUncConfig.empty()) {
529
530 toolName = "WTagJetUncertaintiesTool_" + m_fatJets;
531 m_WTagjetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName);
532 ATH_CHECK( m_WTagjetUncertaintiesTool.setProperty("JetDefinition", fatjetcoll) );
533 ATH_CHECK( m_WTagjetUncertaintiesTool.setProperty("MCType", "MC16") );
534 ATH_CHECK( m_WTagjetUncertaintiesTool.setProperty("IsData", isData()) );
535 ATH_CHECK( m_WTagjetUncertaintiesTool.setProperty("ConfigFile", "rel21/Fall2020/"+m_WTagUncConfig) );
536 ATH_CHECK( m_WTagjetUncertaintiesTool.setProperty("OutputLevel", this->msg().level()) );
537 ATH_CHECK( m_WTagjetUncertaintiesTool.retrieve() );
538 } else if (m_WTagjetUncertaintiesTool.isUserConfigured()) ATH_CHECK(m_WTagjetUncertaintiesTool.retrieve());
539 */
540 ATH_MSG_INFO(" Won't initialise Ztagger uncertainty tool for fat jets until we get rec for UFO");
541 // Won't initialise Ztagger uncertainty tool for fat jets until we get rec for UFO
542 /*
543 if (!m_ZTagjetUncertaintiesTool.isUserConfigured() && !m_fatJets.empty() && !m_ZtagConfig.empty() && !m_ZTagUncConfig.empty()) {
544
545 toolName = "ZTagJetUncertaintiesTool_" + m_fatJets;
546 m_ZTagjetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName);
547 ATH_CHECK( m_ZTagjetUncertaintiesTool.setProperty("JetDefinition", fatjetcoll) );
548 ATH_CHECK( m_ZTagjetUncertaintiesTool.setProperty("ConfigFile", "rel21/Fall2020/"+m_ZTagUncConfig) );
549 ATH_CHECK( m_ZTagjetUncertaintiesTool.setProperty("MCType", "MC16") );
550 ATH_CHECK( m_ZTagjetUncertaintiesTool.setProperty("IsData", isData()) );
551 ATH_CHECK( m_ZTagjetUncertaintiesTool.setProperty("OutputLevel", this->msg().level()) );
552 ATH_CHECK( m_ZTagjetUncertaintiesTool.retrieve() );
553 } else if (m_ZTagjetUncertaintiesTool.isUserConfigured()) ATH_CHECK(m_ZTagjetUncertaintiesTool.retrieve());
554 */
555 ATH_MSG_INFO(" Won't initialise top-tagger uncertainty tool for fat jets until we get rec for UFO");
556 // Won't initialise top-tagger uncertainty tool for fat jets until we get rec for UFO
557 /*
558 if (!m_TopTagjetUncertaintiesTool.isUserConfigured() && !m_fatJets.empty() && !m_ToptagConfig.empty() && !m_TopTagUncConfig.empty()) {
559
560 toolName = "TopTagJetUncertaintiesTool_" + m_fatJets;
561 m_TopTagjetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName);
562 ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("JetDefinition", fatjetcoll) );
563 ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("MCType", "MC16") );
564 ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("IsData", isData()) );
565 ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("ConfigFile", "rel21/Fall2020/"+m_TopTagUncConfig) );
566 ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("OutputLevel", this->msg().level()) );
567 ATH_CHECK( m_TopTagjetUncertaintiesTool.retrieve() );
568 } else if (m_TopTagjetUncertaintiesTool.isUserConfigured()) ATH_CHECK(m_TopTagjetUncertaintiesTool.retrieve());
569 */
570 }
571
572
573 // tagger SF and uncertainties
574 // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BoostedJetTaggingRecommendationFullRun2
575 // To be implemented here
576
577 if (m_slices["jet"]) {
579 // Initialise jet cleaning tools
580
581 // see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/HowToCleanJetsR22
582 if (m_badJetCut!="" && !m_jetCleaningTool.isUserConfigured()) {
583 toolName = "JetCleaningTool";
584 m_jetCleaningTool.setTypeAndName("JetCleaningTool/"+toolName);
585 ATH_CHECK( m_jetCleaningTool.setProperty("CutLevel", m_badJetCut) );
586 ATH_CHECK( m_jetCleaningTool.setProperty("DoUgly", false) );
587 ATH_CHECK( m_jetCleaningTool.setProperty("OutputLevel", this->msg().level()) );
588 ATH_CHECK( m_jetCleaningTool.retrieve() );
589 } else if (m_jetCleaningTool.isUserConfigured()) ATH_CHECK( m_jetCleaningTool.retrieve() );
590
592 // Initialise jet pileup labeling tool (required for labels used by JvtEfficiencyTools)
593
594 if(!m_jetPileupLabelingTool.isUserConfigured() && !isData()) {
595 toolName = "PileupLabelingTool";
596 m_jetPileupLabelingTool.setTypeAndName("JetPileupLabelingTool/"+toolName);
597 ATH_CHECK( m_jetPileupLabelingTool.setProperty("RecoJetContainer", m_defaultJets) );
598 ATH_CHECK( m_jetPileupLabelingTool.setProperty("TruthJetContainer", m_defaultTruthJets) );
599 #ifndef XAOD_STANDALONE
600 ATH_CHECK( m_jetPileupLabelingTool.setProperty("SuppressInputDependence", true) );
601 ATH_CHECK( m_jetPileupLabelingTool.setProperty("SuppressOutputDependence", true) );
602 #endif
603 ATH_CHECK( m_jetPileupLabelingTool.setProperty("OutputLevel", this->msg().level()) );
604 ATH_CHECK( m_jetPileupLabelingTool.retrieve() );
605 } else if (m_jetPileupLabelingTool.isUserConfigured()) ATH_CHECK( m_jetPileupLabelingTool.retrieve() );
606
608 // Initialise jet Jvt moment tool
609
610 if (!m_jetJvtMomentTool.isUserConfigured()) {
611 toolName = "JvtMomentTool";
612 m_jetJvtMomentTool.setTypeAndName("JetVertexTaggerTool/"+toolName);
613 ATH_CHECK( m_jetJvtMomentTool.setProperty("JetContainer", m_defaultJets) );
614 #ifndef XAOD_STANDALONE
615 ATH_CHECK( m_jetJvtMomentTool.setProperty("SuppressInputDependence", true) );
616 ATH_CHECK( m_jetJvtMomentTool.setProperty("SuppressOutputDependence", true) );
617 #endif
618 ATH_CHECK( m_jetJvtMomentTool.setProperty("OutputLevel", this->msg().level()) );
619 ATH_CHECK( m_jetJvtMomentTool.retrieve() );
620 } else if (m_jetJvtMomentTool.isUserConfigured()) ATH_CHECK( m_jetJvtMomentTool.retrieve() );
621
623 // Initialise jet NNJvt moment tool
624
625 m_applyJVTCut = !m_JvtWP.empty();
626 if (!m_jetNNJvtMomentTool.isUserConfigured() && m_applyJVTCut) {
627 toolName = "NNJvtMomentTool";
628 m_jetNNJvtMomentTool.setTypeAndName("JetPileupTag::JetVertexNNTagger/"+toolName);
629 ATH_CHECK( m_jetNNJvtMomentTool.setProperty("JetContainer", m_defaultJets) );
630 #ifndef XAOD_STANDALONE
631 ATH_CHECK( m_jetNNJvtMomentTool.setProperty("SuppressInputDependence", true) );
632 ATH_CHECK( m_jetNNJvtMomentTool.setProperty("SuppressOutputDependence", true) );
633 #endif
634 ATH_CHECK( m_jetNNJvtMomentTool.setProperty("OutputLevel", this->msg().level()) );
635 ATH_CHECK( m_jetNNJvtMomentTool.retrieve() );
636 } else if (m_jetNNJvtMomentTool.isUserConfigured()) ATH_CHECK( m_jetNNJvtMomentTool.retrieve() );
637
639 // Initialise jet NNJvt selection tool
640
641 if (!m_jetNNJvtSelectionTool.isUserConfigured() && m_applyJVTCut) {
642 toolName = "NNJvtSelectionTool";
643 m_jetNNJvtSelectionTool.setTypeAndName("CP::NNJvtSelectionTool/"+toolName);
644 ATH_CHECK( m_jetNNJvtSelectionTool.setProperty("JetContainer", m_defaultJets) );
645 ATH_CHECK( m_jetNNJvtSelectionTool.setProperty("WorkingPoint", m_JvtWP) );
646 ATH_CHECK( m_jetNNJvtSelectionTool.setProperty("MaxPtForJvt", m_JvtPtMax) );
647 ATH_CHECK( m_jetNNJvtSelectionTool.setProperty("JvtMomentName", "NNJvt") );
648 ATH_CHECK( m_jetNNJvtSelectionTool.setProperty("OutputLevel", this->msg().level()) );
650 } else if (m_jetNNJvtSelectionTool.isUserConfigured()) ATH_CHECK( m_jetNNJvtSelectionTool.retrieve() );
651
653 // Initialise jet NNJvt efficiency tool (scale factors)
654
655 if (!m_jetNNJvtEfficiencyTool.isUserConfigured() && m_applyJVTCut) {
656 toolName = "NNJvtEfficiencyTool";
657 m_jetNNJvtEfficiencyTool.setTypeAndName("CP::NNJvtEfficiencyTool/"+toolName);
658 ATH_CHECK( m_jetNNJvtEfficiencyTool.setProperty("JetContainer", m_defaultJets) );
659 ATH_CHECK( m_jetNNJvtEfficiencyTool.setProperty("WorkingPoint", m_JvtWP) );
660 ATH_CHECK( m_jetNNJvtEfficiencyTool.setProperty("MaxPtForJvt", m_JvtPtMax) );
662 ATH_CHECK( m_jetNNJvtEfficiencyTool.setProperty("OutputLevel", this->msg().level()) );
664 } else if (m_jetNNJvtEfficiencyTool.isUserConfigured()) ATH_CHECK( m_jetNNJvtEfficiencyTool.retrieve() );
665
667 // Initialise jet fJvt selection tool
668
669 if (!m_jetfJvtSelectionTool.isUserConfigured() && m_doFwdJVT) {
670 toolName = "fJvtSelectionTool";
671 m_jetfJvtSelectionTool.setTypeAndName("CP::FJvtSelectionTool/"+toolName);
672 ATH_CHECK( m_jetfJvtSelectionTool.setProperty("JetContainer", m_defaultJets) );
673 ATH_CHECK( m_jetfJvtSelectionTool.setProperty("WorkingPoint", m_fJvtWP) );
674 ATH_CHECK( m_jetfJvtSelectionTool.setProperty("MaxPtForJvt", m_fJvtPtMax) );
675 ATH_CHECK( m_jetfJvtSelectionTool.setProperty("JvtMomentName", "DFCommonJets_fJvt") );
676 ATH_CHECK( m_jetfJvtSelectionTool.setProperty("OutputLevel", this->msg().level()) );
677 ATH_CHECK( m_jetfJvtSelectionTool.retrieve() );
678 } else if (m_jetfJvtSelectionTool.isUserConfigured()) ATH_CHECK( m_jetfJvtSelectionTool.retrieve() );
679
681 // Initialise jet fJvt efficiency tool for scale factors (scale factors)
682
683 if (!m_jetfJvtEfficiencyTool.isUserConfigured() && m_doFwdJVT) {
684 toolName = "fJvtEfficiencyTool";
685 m_jetfJvtEfficiencyTool.setTypeAndName("CP::FJvtEfficiencyTool/"+toolName);
686 ATH_CHECK( m_jetfJvtEfficiencyTool.setProperty("JetContainer", m_defaultJets) );
687 ATH_CHECK( m_jetfJvtEfficiencyTool.setProperty("WorkingPoint", m_fJvtWP) );
688 ATH_CHECK( m_jetfJvtEfficiencyTool.setProperty("MaxPtForJvt", m_fJvtPtMax) );
690 ATH_CHECK( m_jetfJvtEfficiencyTool.setProperty("OutputLevel", this->msg().level()) );
692 } else ATH_CHECK( m_jetfJvtEfficiencyTool.retrieve() );
693 }
694
695
696 if (m_slices["mu"]) {
698 // Check muon baseline ID
699
700 std::string muQualBaseline = "";
701 switch (m_muIdBaseline) {
702 case xAOD::Muon::VeryLoose: muQualBaseline = "VeryLoose";
703 ATH_MSG_WARNING("No muon scale factors are available for VeryLoose working point.");
704 break;
705 case xAOD::Muon::Loose: muQualBaseline = "Loose"; break;
706 case xAOD::Muon::Medium: muQualBaseline = "Medium"; break;
707 case xAOD::Muon::Tight: muQualBaseline = "Tight"; break;
708 case 4: muQualBaseline = "HighPt"; break;
709 case 5: muQualBaseline = "LowPt"; break;
710 case 6: muQualBaseline = "LowPtMVA"; break;
711 case 7: muQualBaseline = "HighPt3Layers"; break;
712 default:
713 ATH_MSG_ERROR("Invalid muon working point provided: " << m_muIdBaseline << ". Cannot initialise!");
714 return StatusCode::FAILURE;
715 break;
716 }
717
719 // Initialise muon calibration tool
720 // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MuonMomentumCorrectionsSubgroup#CP_MuonCalibrationAndSmearingToo
721 // Please not that for AthAnalysis we need to configure the MuonCalibTool within METSignificance manually and just can't pass the handle
722 // Hence, any changes here should also be propagated to the METSignificance setup further below
723
724 if (!m_muonCalibTool.isUserConfigured()) {
725 m_muonCalibTool.setTypeAndName("CP::MuonCalibTool/ST_MuonCalibrationTool");
726 if (m_isRun3) ATH_CHECK( m_muonCalibTool.setProperty("IsRun3Geo", true ));
727 ATH_CHECK( m_muonCalibTool.setProperty("calibMode", m_muCalibrationMode) );
728 ATH_CHECK( m_muonCalibTool.setProperty("OutputLevel", this->msg().level()) );
729 ATH_CHECK( m_muonCalibTool.setProperty("release", "Recs2025_12_11_Run2Run3" ));
730 int IdBaselineInt = m_muIdBaseline;
731 if (IdBaselineInt == 4) {
732 ATH_CHECK( m_muonCalibTool.setProperty("do2StationsHighPt", true) );
733 }
734 ATH_CHECK( m_muonCalibTool.setProperty("doExtraSmearing", m_muHighPtExtraSmear) );
735 ATH_CHECK( m_muonCalibTool.retrieve() );
736 } else ATH_CHECK( m_muonCalibTool.retrieve() );
737
739 // Initialise muon selection tool
740
741 if (!m_muonSelectionToolBaseline.isUserConfigured()) {
742 toolName = "MuonSelectionTool_Baseline_" + muQualBaseline;
743 m_muonSelectionToolBaseline.setTypeAndName("CP::MuonSelectionTool/"+toolName);
744 if (m_isRun3) ATH_CHECK( m_muonSelectionToolBaseline.setProperty("IsRun3Geo", true ));
745
746 if (m_muBaselineEta<m_muEta){ // Test for inconsistent configuration
747 ATH_MSG_ERROR( "Requested a baseline eta cut for muons (" << m_muBaselineEta <<
748 ") that is tighter than the signal cut (" << m_muEta << "). Please check your config." );
749 return StatusCode::FAILURE;
750 }
751 int IdBaselineInt = m_muIdBaseline;
752 ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "MaxEta", m_muBaselineEta) );
753 if (IdBaselineInt == 6){
754 ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "MuQuality", 5 ) );
755 ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "UseMVALowPt", true));
756 } else if (IdBaselineInt == 7){
757 ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "MuQuality", 4 ) );
758 ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "Use2stationMuonsHighPt", false));
759 } else ATH_CHECK(m_muonSelectionToolBaseline.setProperty( "MuQuality", m_muIdBaseline ));
760 ATH_CHECK( m_muonSelectionToolBaseline.setProperty("OutputLevel", this->msg().level()) );
762 } else ATH_CHECK( m_muonSelectionToolBaseline.retrieve() );
763
764
765 std::string muQual = "";
766 switch (m_muId) {
767 case xAOD::Muon::VeryLoose: muQual = "VeryLoose";
768 ATH_MSG_WARNING("No muon scale factors are available for VeryLoose working point.");
769 break;
770 case xAOD::Muon::Loose: muQual = "Loose"; break;
771 case xAOD::Muon::Medium: muQual = "Medium"; break;
772 case xAOD::Muon::Tight: muQual = "Tight"; break;
773 case 4: muQual = "HighPt"; break;
774 case 5: muQual = "LowPt"; break;
775 case 6: muQual = "LowPtMVA"; break;
776 case 7: muQual = "HighPt3Layers"; break;
777 default:
778 ATH_MSG_ERROR("Invalid muon working point provided: " << m_muId << ". Cannot initialise!");
779 return StatusCode::FAILURE;
780 break;
781 }
782
783 if (!m_muonSelectionTool.isUserConfigured()) {
784 toolName = "MuonSelectionTool_" + muQual;
785 m_muonSelectionTool.setTypeAndName("CP::MuonSelectionTool/"+toolName);
786 if (m_isRun3) ATH_CHECK( m_muonSelectionTool.setProperty("IsRun3Geo", true ));
787 ATH_CHECK( m_muonSelectionTool.setProperty( "MaxEta", m_muEta) );
788 int IdInt = m_muId;
789 if (IdInt == 6){
790 ATH_CHECK( m_muonSelectionTool.setProperty( "MuQuality", 5 ) );
791 ATH_CHECK( m_muonSelectionTool.setProperty( "UseMVALowPt", true));
792 } else if (IdInt == 7){
793 ATH_CHECK( m_muonSelectionTool.setProperty( "MuQuality", 4 ) );
794 ATH_CHECK( m_muonSelectionTool.setProperty( "Use2stationMuonsHighPt", false));
795 } else ATH_CHECK(m_muonSelectionTool.setProperty( "MuQuality", m_muId ));
796 ATH_CHECK( m_muonSelectionTool.setProperty("OutputLevel", this->msg().level()) );
797 ATH_CHECK( m_muonSelectionTool.retrieve() );
798 } else ATH_CHECK( m_muonSelectionTool.retrieve() );
799
800
801 if (!m_muonSelectionHighPtTool.isUserConfigured()) { //Fixed to HighPt WP
802 toolName = "MuonSelectionHighPtTool_" + muQual;
803 m_muonSelectionHighPtTool.setTypeAndName("CP::MuonSelectionTool/"+toolName);
804 if (m_isRun3) ATH_CHECK( m_muonSelectionHighPtTool.setProperty("IsRun3Geo", true ));
805 ATH_CHECK( m_muonSelectionHighPtTool.setProperty( "MaxEta", m_muEta) );
806 ATH_CHECK( m_muonSelectionHighPtTool.setProperty( "MuQuality", 4 ) );
807 ATH_CHECK( m_muonSelectionHighPtTool.setProperty("OutputLevel", this->msg().level()) );
809 } else ATH_CHECK( m_muonSelectionHighPtTool.retrieve() );
810
811
813 // Initialise prompt/LRT muon OR tool
814 if (!m_muonLRTORTool.isUserConfigured()) {
815 toolName = "MuonLRTOverlapRemovalTool";
816 m_muonLRTORTool.setTypeAndName("CP::MuonLRTOverlapRemovalTool/"+toolName);
818 if (m_isRun3) ATH_CHECK( m_muonLRTORTool.setProperty("UseRun3WP", true ));
819 ATH_CHECK( m_muonLRTORTool.setProperty("OutputLevel", this->msg().level()) );
820 ATH_CHECK( m_muonLRTORTool.retrieve() );
821 } else ATH_CHECK( m_muonLRTORTool.retrieve() );
822
824 // Initialise muon efficiency tools
825
826 // Hotfix for the Run2 Muon Identification SFs for the Tight WP
827 std::string MuonCP_Run2_TightFix = "";
828 if(!m_isRun3) {
829 MuonCP_Run2_TightFix = (m_muId == xAOD::Muon::Tight) ? "220725_Preliminary_r22run2" : "230213_Preliminary_r22run2_loosefix";
830 }
831 if (!m_muonEfficiencySFTool.isUserConfigured() && m_muId != xAOD::Muon::VeryLoose && !isData()) {
832 toolName = "MuonEfficiencyScaleFactors_" + muQual;
833 m_muonEfficiencySFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName);
834 ATH_CHECK( m_muonEfficiencySFTool.setProperty("WorkingPoint", muQual) );
835 ATH_CHECK( m_muonEfficiencySFTool.setProperty("CalibrationRelease", m_isRun3 ? "251211_Preliminary_r24run3" : MuonCP_Run2_TightFix) );
836 ATH_CHECK( m_muonEfficiencySFTool.setProperty("OutputLevel", this->msg().level()) );
837 ATH_CHECK( m_muonEfficiencySFTool.retrieve() );
838 } else if (m_muonEfficiencySFTool.isUserConfigured()) ATH_CHECK( m_muonEfficiencySFTool.retrieve() );
839
840
841 if (!m_muonEfficiencyBMHighPtSFTool.isUserConfigured() && !isData()){
842 toolName = "MuonEfficiencyScaleFactorsBMHighPt_" + muQual;
843 m_muonEfficiencyBMHighPtSFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName);
844 ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("WorkingPoint", "BadMuonVeto_HighPt") );
845 ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("CalibrationRelease", m_isRun3? "220817_Preliminary_r22run3":"230213_Preliminary_r22run2_loosefix") ); //BadMuonVeto_HighPt currently not available for 240711_Preliminary_r24run3
846 ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("OutputLevel", this->msg().level()) );
848 } else if (m_muonEfficiencyBMHighPtSFTool.isUserConfigured()) ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.retrieve() );
849
850
851 if (m_doTTVAsf && m_mud0sig<0 && m_muz0<0){
852 ATH_MSG_WARNING("Requested TTVA SFs without d0sig and z0 cuts. Disabling scale factors as they will not make sense.");
853 m_doTTVAsf=false;
854 }
855
856 if (m_doTTVAsf && !m_muonTTVAEfficiencySFTool.isUserConfigured() && !isData()) {
857 toolName = "MuonTTVAEfficiencyScaleFactors";
858 m_muonTTVAEfficiencySFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName);
859 ATH_CHECK( m_muonTTVAEfficiencySFTool.setProperty("WorkingPoint", "TTVA") );
860 ATH_CHECK( m_muonTTVAEfficiencySFTool.setProperty("CalibrationRelease", m_isRun3? "251211_Preliminary_r24run3":"230213_Preliminary_r22run2_loosefix") );
861 ATH_CHECK( m_muonTTVAEfficiencySFTool.setProperty("OutputLevel", this->msg().level()) );
863 } else if (m_muonTTVAEfficiencySFTool.isUserConfigured()) ATH_CHECK( m_muonTTVAEfficiencySFTool.retrieve() );
864
865
866
868 // Initialise muon isolation tool
869 if (!m_muonIsolationSFTool.isUserConfigured() && !m_muIso_WP.empty() && !isData()) {
870 toolName = "MuonIsolationScaleFactors_" + m_muIso_WP;
871
872 std::string tmp_muIso_WP = m_muIso_WP;
873 if ( !check_isOption(m_muIso_WP, m_mu_iso_support) ) { //check if supported
874 ATH_MSG_WARNING("Your selected muon Iso WP ("
875 << m_muIso_WP
876 << ") does not have SFs defined. Will try to find an appropriate fall-back.");
877 if (m_mu_iso_fallback.count(m_muIso_WP) > 0){
878 tmp_muIso_WP = m_mu_iso_fallback[m_muIso_WP];
879 ATH_MSG_WARNING("Your selected muon Iso WP ("
880 << m_muIso_WP
881 << " is not supported, and does not have SFs available. Falling back to "
882 << tmp_muIso_WP
883 << " for SF determination.");
884 } else {
885 ATH_MSG_ERROR("*** The muon isolation WP you selected (" << m_muIso_WP << ") is not currentely supported, and no known fall-back option for SFs exists. Sorry! ***");
886 return StatusCode::FAILURE;
887 }
888 }
889
890 m_muonIsolationSFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName);
891 ATH_CHECK( m_muonIsolationSFTool.setProperty("WorkingPoint", tmp_muIso_WP + "Iso") );
892 ATH_CHECK( m_muonIsolationSFTool.setProperty("CalibrationRelease", m_isRun3? "251211_Preliminary_r24run3":"230213_Preliminary_r22run2_loosefix") );
893 ATH_CHECK( m_muonIsolationSFTool.setProperty("OutputLevel", this->msg().level()) );
894 ATH_CHECK( m_muonIsolationSFTool.retrieve() );
895
896 } else if (m_muonIsolationSFTool.isUserConfigured()) ATH_CHECK( m_muonIsolationSFTool.retrieve() );
897
898
899 if (!m_muonHighPtIsolationSFTool.isUserConfigured() && !m_muIsoHighPt_WP.empty() && !isData()) {
900 toolName = "MuonHighPtIsolationScaleFactors_" + m_muIsoHighPt_WP;
901
902 std::string tmp_muIsoHighPt_WP = m_muIsoHighPt_WP;
903 if ( !check_isOption(m_muIsoHighPt_WP, m_mu_iso_support) ) { //check if supported
904 ATH_MSG_WARNING("Your selected muon high-pt Iso WP ("
906 << ") does not have SFs defined. Will try to find an appropriate fall-back.");
907 if (m_mu_iso_fallback.count(m_muIsoHighPt_WP) > 0){
908 tmp_muIsoHighPt_WP = m_mu_iso_fallback[m_muIsoHighPt_WP];
909 ATH_MSG_WARNING("Your selected muon high-pt Iso WP ("
911 << " is not supported, and does not have SFs available. Falling back to "
912 << tmp_muIsoHighPt_WP
913 << " for SF determination.");
914 } else {
915 ATH_MSG_ERROR("*** The muon isolation WP you selected (" << m_muIsoHighPt_WP << ") is not currentely supported, and no known fall-back option for SFs exists. Sorry! ***");
916 return StatusCode::FAILURE;
917 }
918 }
919
920 m_muonHighPtIsolationSFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName);
921 // Use for the low-pt WP a dedicated set of isolation scale-factors having an extra uncertainty in place
922 ATH_CHECK( m_muonHighPtIsolationSFTool.setProperty("WorkingPoint", tmp_muIsoHighPt_WP + "Iso") );
923 ATH_CHECK( m_muonHighPtIsolationSFTool.setProperty("CalibrationRelease", m_isRun3? "251211_Preliminary_r24run3":"230213_Preliminary_r22run2_loosefix") );
924 ATH_CHECK( m_muonHighPtIsolationSFTool.setProperty("OutputLevel", this->msg().level()) );
926
927 } else if (m_muonHighPtIsolationSFTool.isUserConfigured()) ATH_CHECK( m_muonHighPtIsolationSFTool.retrieve() );
928
929
931 // Initialise muon trigger scale factor tools
932
933 if (!m_muonTriggerSFTool.isUserConfigured() && !isData()) {
934 toolName = "MuonTriggerScaleFactors_" + muQual;
935 m_muonTriggerSFTool.setTypeAndName("CP::MuonTriggerScaleFactors/"+toolName);
936 if ( muQual=="LowPt" ) {
937 ATH_MSG_WARNING("You're using the LowPt muon selection, which is not supported yet in terms of muon trigger scale facorts. TEMPORAIRLY configuring the muonTriggerSFTool for Medium muons. Beware!");
938 ATH_CHECK( m_muonTriggerSFTool.setProperty("MuonQuality", "Medium" ) );
939 }
940 else ATH_CHECK( m_muonTriggerSFTool.setProperty("MuonQuality", muQual) );
941 //ATH_CHECK( m_muonTriggerSFTool.setProperty("Isolation", m_muIso_WP)); This property has been depreacted long time ago
942 ATH_CHECK( m_muonTriggerSFTool.setProperty("AllowZeroSF", true) );
943 ATH_CHECK( m_muonTriggerSFTool.setProperty("OutputLevel", this->msg().level()) );
944 if(!m_muTriggerSFCalibRelease.empty() ) ATH_CHECK( m_muonTriggerSFTool.setProperty("CalibrationRelease",m_muTriggerSFCalibRelease) );
946 if(!m_mcCampaign.empty()) ATH_CHECK( m_muonTriggerSFTool.setProperty("Campaign", m_mcCampaign) ); // if not set, loads all !86245
947 ATH_CHECK( m_muonTriggerSFTool.retrieve() );
948 m_muonTrigSFTools.push_back(m_muonTriggerSFTool.getHandle());
949 } else if (m_muonTriggerSFTool.isUserConfigured()) {
950 ATH_CHECK( m_muonTriggerSFTool.retrieve() );
951 m_muonTrigSFTools.push_back(m_muonTriggerSFTool.getHandle());
952 }
953 }
954
955 if (m_slices["ele"]) {
956 // /////////////////////////////////////////////////////////////////////////////////////////
957 // Initialise electron selector tools
958
959 // Signal Electrons
960 if (!m_elecSelLikelihood.isUserConfigured()) {
961 toolName = "EleSelLikelihood_" + m_eleId;
962
963 if (m_eleId.find("DNN") != std::string::npos) {
964 m_elecSelLikelihood.setTypeAndName("AsgElectronSelectorTool/"+toolName);
965 }
966 else {
967 m_elecSelLikelihood.setTypeAndName("AsgElectronLikelihoodTool/"+toolName);
968 }
969
970 if (! m_eleConfig.empty() ){
971 ATH_MSG_INFO("Overriding specified Ele.Id working point in favour of configuration file");
972 ATH_CHECK( m_elecSelLikelihood.setProperty("ConfigFile", m_eleConfig) );
973 } else if ( !check_isOption(m_eleId, m_el_id_support) ) { //check if supported
974 ATH_MSG_ERROR("Invalid electron ID selected: " << m_eleId);
975 return StatusCode::FAILURE;
976 }
977 else if (m_eleId == "VeryLooseLLH" || m_eleId == "LooseLLH") {
978 ATH_MSG_WARNING(" ****************************************************************************");
979 ATH_MSG_WARNING(" CAUTION: Setting " << m_eleId << " as signal electron ID");
980 ATH_MSG_WARNING(" These may be used for loose electron CRs but no scale factors are provided.");
981 ATH_MSG_WARNING(" ****************************************************************************");
982 ATH_CHECK( m_elecSelLikelihood.setProperty("WorkingPoint", EG_WP(m_eleId) ));
983 } else {
984 ATH_CHECK( m_elecSelLikelihood.setProperty("WorkingPoint", EG_WP(m_eleId) ));
985 }
986
987 ATH_CHECK( m_elecSelLikelihood.setProperty("OutputLevel", this->msg().level()) );
988 ATH_CHECK( m_elecSelLikelihood.retrieve() );
989 } else ATH_CHECK( m_elecSelLikelihood.retrieve() );
990
991 // Baseline Electrons
992 if (!m_elecSelLikelihoodBaseline.isUserConfigured()) {
993 toolName = "EleSelLikelihoodBaseline_" + m_eleIdBaseline;
994
995 if (m_eleIdBaseline.find("DNN") != std::string::npos) {
996 m_elecSelLikelihoodBaseline.setTypeAndName("AsgElectronSelectorTool/"+toolName);
997 }
998 else {
999 m_elecSelLikelihoodBaseline.setTypeAndName("AsgElectronLikelihoodTool/"+toolName);
1000 }
1001
1002 if (! m_eleConfigBaseline.empty() ){
1003 ATH_MSG_INFO("Overriding specified EleBaseline.Id working point in favour of configuration file");
1004 ATH_CHECK( m_elecSelLikelihoodBaseline.setProperty("ConfigFile", m_eleConfigBaseline ));
1005 } else if ( !check_isOption(m_eleIdBaseline, m_el_id_support) ) { //check if supported
1006 ATH_MSG_ERROR("Invalid electron ID selected: " << m_eleIdBaseline);
1007 return StatusCode::FAILURE;
1008 } else {
1009 ATH_CHECK( m_elecSelLikelihoodBaseline.setProperty("WorkingPoint", EG_WP(m_eleIdBaseline)) );
1010 }
1011
1012 ATH_CHECK( m_elecSelLikelihoodBaseline.setProperty("OutputLevel", this->msg().level()) );
1014 } else ATH_CHECK( m_elecSelLikelihoodBaseline.retrieve() );
1015 }
1016
1018 // Initialise prompt/LRT electron OR tool
1019 if (!m_elecLRTORTool.isUserConfigured()) {
1020 toolName = "ElectronLRTOverlapRemovalTool";
1021 m_elecLRTORTool.setTypeAndName("CP::ElectronLRTOverlapRemovalTool/"+toolName);
1022 ATH_MSG_DEBUG("Setting ElectronLRTOverlapRemovalTool strategy to "<<m_eleLRT_strat);
1023 ATH_CHECK( m_elecLRTORTool.setProperty("overlapStrategy", m_eleLRT_strat) );
1024 ATH_CHECK( m_elecLRTORTool.retrieve() );
1025 } else ATH_CHECK( m_elecLRTORTool.retrieve() );
1026
1027 if (m_slices["pho"]) {
1028 // /////////////////////////////////////////////////////////////////////////////////////////
1029 // Initialise photon selector tools
1030
1031 if (!m_photonSelIsEM.isUserConfigured()) {
1032 toolName = "PhotonSelIsEM_" + m_photonId;
1033 m_photonSelIsEM.setTypeAndName("AsgPhotonIsEMSelector/"+toolName);
1034
1035 if (!check_isOption(m_photonId, m_ph_id_support)){ //check if supported
1036 ATH_MSG_ERROR("Invalid photon ID selected: " << m_photonId);
1037 return StatusCode::FAILURE;
1038 }
1039
1040 ATH_CHECK( m_photonSelIsEM.setProperty("WorkingPoint", m_photonId+"Photon") );
1041 ATH_CHECK( m_photonSelIsEM.setProperty("OutputLevel", this->msg().level()) );
1042 ATH_CHECK( m_photonSelIsEM.retrieve() );
1043 } else ATH_CHECK( m_photonSelIsEM.retrieve() );
1044
1045 if (!m_photonSelIsEMBaseline.isUserConfigured()) {
1046 toolName = "PhotonSelIsEMBaseline_" + m_photonIdBaseline;
1047 m_photonSelIsEMBaseline.setTypeAndName("AsgPhotonIsEMSelector/"+toolName);
1048
1049 if(!check_isOption(m_photonIdBaseline, m_ph_id_support)){ //check if supported
1050 ATH_MSG_ERROR("Invalid photon ID selected: " << m_photonIdBaseline);
1051 return StatusCode::FAILURE;
1052 }
1053
1054 ATH_CHECK( m_photonSelIsEMBaseline.setProperty("WorkingPoint", m_photonIdBaseline+"Photon") );
1055 ATH_CHECK( m_photonSelIsEMBaseline.setProperty("OutputLevel", this->msg().level()) );
1056 ATH_CHECK( m_photonSelIsEMBaseline.retrieve() );
1057 } else ATH_CHECK( m_photonSelIsEMBaseline.retrieve() );
1058 }
1059
1060 if (m_slices["ele"]||m_slices["pho"]) {
1062 // Initialise DeadHVCellRemovalTool
1063 // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/EGammaIdentificationRun2#Removal_of_Electron_Photon_clust
1064
1065 ATH_MSG_DEBUG("Setup AsgDeadHVCellRemovalTool/deadHVTool");
1066 m_deadHVTool.setTypeAndName("AsgDeadHVCellRemovalTool/deadHVTool");
1067 ATH_CHECK(m_deadHVTool.retrieve());
1068 }
1069
1070 if (m_slices["ele"]) {
1072 // Initialise electron efficiency tool
1073
1075 if (!isData()) {
1076 if (isAtlfast()) data_type = PATCore::ParticleDataType::Fast;
1077 else data_type = PATCore::ParticleDataType::Full;
1078 ATH_MSG_DEBUG( "Setting data type to " << data_type);
1079 }
1080
1081 m_eleEffMapFilePathRun2 = "ElectronEfficiencyCorrection/2015_2018/rel21.2/Precision_Summer2020_v1/map4.txt";
1082
1083 if(!m_isRun3) {
1084 ATH_MSG_INFO( "Running on Run2 samples; Using egamma SF tools from R21 map ");
1086 }
1087
1088 toolName = "AsgElectronEfficiencyCorrectionTool_reco";
1090
1091 //-- get KEYS supported by egamma SF tools
1092 std::vector<std::string> eSF_keys = getElSFkeys( m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2);
1093
1094 if (m_eleId.find("NoPix") != std::string::npos || m_eleId == "VeryLooseLLH" || m_eleId == "LooseLLH" || m_eleId == "Medium") {
1095 ATH_MSG_WARNING("Not configuring electron ID and trigger scale factors for " << m_eleId);
1096 }
1097 else {
1098 // This needs to be formatted for the scale factors: no _Rel20, no LH label, etc.
1099 std::string eleId = TString(m_eleId).ReplaceAll("AndBLayer", "BLayer").ReplaceAll("LLH", "").Data();
1100
1101 if (m_eleId.find("DNN") != std::string::npos) {
1102 eleId = TString(eleId).ReplaceAll("DNNnoCF", "").ReplaceAll("DNN", "").ReplaceAll("Loose", "LooseBLayer").Data();
1103 ATH_MSG_WARNING("Electron DNN ID working point " << m_eleId << " doesn't have SFs yet, fall back to " << eleId);
1104 }
1105
1106 // electron id
1107 toolName = "AsgElectronEfficiencyCorrectionTool_id_" + m_eleId;
1109
1110 // override map file use if correction file list is set for WP
1111 std::map<std::string,std::string> corrFNList;
1112 if ( !m_EG_corrFNList.empty() ) {
1113 for ( const auto& WP_fname : split( m_EG_corrFNList, "," ) ) {
1114 std::string WP = WP_fname.substr(0,WP_fname.find(":"));
1115 std::string fname = WP_fname.substr(WP_fname.find(":")+1);
1116 corrFNList[WP] = fname;
1117 ATH_MSG_WARNING( "Correction file list defined for WP " << WP << ": " << fname << "." );
1118 ATH_MSG_WARNING( "Will use correction file rather than central map file." );
1119 }
1120 }
1121
1122 // electron iso
1123 std::string EleIso("");
1124 if (std::find(eSF_keys.begin(), eSF_keys.end(), eleId+"_"+m_eleIso_WP) != eSF_keys.end()){
1125 EleIso = m_eleIso_WP;
1126 } else if (std::find(eSF_keys.begin(), eSF_keys.end(), eleId+"_"+m_el_iso_fallback[m_eleIso_WP]) != eSF_keys.end()){
1127 //--- Check to see if the only issue is an unknown isolation working point
1129 ATH_MSG_WARNING("(AsgElectronEfficiencyCorrectionTool_iso_*) Your selected electron Iso WP ("
1130 << m_eleIso_WP
1131 << ") does not have iso SFs defined. Falling back to "
1133 << " for SF calculations");
1134 }
1135 else{
1136 ATH_MSG_ERROR("*** THE ELECTRON ISOLATION SF YOU SELECTED (" << m_eleIso_WP << ") GOT NO SUPPORT ***");
1137 return StatusCode::FAILURE;
1138 }
1139
1140 toolName = "AsgElectronEfficiencyCorrectionTool_iso_" + m_eleId + EleIso;
1141
1142 // if running with correction file list
1143 if ( (!m_EG_corrFNList.empty()) && corrFNList.find(EleIso)!=corrFNList.end() ) { // overriding central map file
1144 CONFIG_EG_EFF_TOOL( m_elecEfficiencySFTool_iso, toolName, corrFNList[EleIso] );
1145 }
1146 // can't do the iso tool via the macro, it needs two properties set
1147 else { // default: use map file
1148 if ( !m_elecEfficiencySFTool_iso.isUserConfigured() ) {
1149 if ( !check_isOption(EleIso, m_el_iso_support) ) { //check if supported
1150 ATH_MSG_WARNING( "(" << toolName << ") Your electron Iso WP: " << EleIso<< " is no longer supported. This will almost certainly cause a crash now.");
1151 }
1152
1153 m_elecEfficiencySFTool_iso.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+toolName);
1154
1155 if ( m_EG_corrFNList.empty() ) {
1157 } else {
1158 ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("CorrectionFileNameList", corrFNList) );
1159 }
1160 ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("IdKey", eleId) );
1161 ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("IsoKey", EleIso) );
1162 if (!isData() && ((EleIso.find("TightTrackOnly_VarRad")!=std::string::npos)||
1163 (EleIso.find("TightTrackOnly_FixedRad")!=std::string::npos)||
1164 (EleIso.find("Tight_VarRad")!=std::string::npos)||
1165 (EleIso.find("Loose_VarRad")!=std::string::npos))) {
1166 if (isAtlfast()) ATH_MSG_WARNING("(AsgElectronEfficiencyCorrectionTool/"+toolName+"). Your selected electron Iso WP (" + EleIso + ") don't have AFII SF. Falling back to FullSim");
1167 ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("ForceDataType", static_cast<int>(PATCore::ParticleDataType::Full)));
1168 }
1169 else if (!isData()){
1170 ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("ForceDataType", static_cast<int>(data_type)));
1171 }
1172 ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("CorrelationModel", m_EG_corrModel) );
1173 ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("OutputLevel", this->msg().level()) );
1174 ATH_CHECK( m_elecEfficiencySFTool_iso.initialize() );
1175 } else ATH_CHECK( m_elecEfficiencySFTool_iso.initialize() );
1176 }
1177
1178 // electron iso high-pt
1179 std::string EleIsohighPt("");
1180 if (std::find(eSF_keys.begin(), eSF_keys.end(), eleId+"_"+m_eleIsoHighPt_WP) != eSF_keys.end()){
1181 EleIsohighPt = m_eleIsoHighPt_WP;
1182 } else if (std::find(eSF_keys.begin(), eSF_keys.end(), eleId+"_"+m_el_iso_fallback[m_eleIsoHighPt_WP]) != eSF_keys.end()){
1183 //--- Check to see if the only issue is an unknown isolation working point
1184 EleIsohighPt = m_el_iso_fallback[m_eleIsoHighPt_WP];
1185 ATH_MSG_WARNING("(AsgElectronEfficiencyCorrectionTool_iso_*) Your selected high-pT electron Iso WP ("
1187 << ") does not have iso SFs defined. Falling back to "
1189 << " for SF calculations");
1190 }
1191 else{
1192 ATH_MSG_ERROR("*** THE HIGH PT ELECTRON ISOLATION SF YOU SELECTED (" << m_eleIsoHighPt_WP << ") GOT NO SUPPORT");
1193 return StatusCode::FAILURE;
1194 }
1195
1196 toolName = "AsgElectronEfficiencyCorrectionTool_isoHigPt_" + m_eleId + EleIsohighPt;
1197
1198 // if running with correction file list
1199 if ( (!m_EG_corrFNList.empty()) && corrFNList.find(EleIsohighPt)!=corrFNList.end() ) { // overriding central map file
1200 CONFIG_EG_EFF_TOOL( m_elecEfficiencySFTool_isoHighPt, toolName, corrFNList[EleIsohighPt] );
1201 }
1202 // can't do the iso tool via the macro, it needs two properties set
1203 else { // default: use map file
1204 if ( !m_elecEfficiencySFTool_isoHighPt.isUserConfigured() ) {
1205
1206 if ( !check_isOption(EleIsohighPt, m_el_iso_support) ) { //check if supported
1207 ATH_MSG_WARNING( "(" << toolName << ") Your electron high-pt Iso WP: " << EleIsohighPt << " is no longer supported. This will almost certainly cause a crash now.");
1208 }
1209
1210 m_elecEfficiencySFTool_isoHighPt.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+toolName);
1211
1213 ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.setProperty("IdKey", eleId) );
1214 ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.setProperty("IsoKey", EleIsohighPt) );
1215 if (!isData()) {
1216 ATH_CHECK (m_elecEfficiencySFTool_isoHighPt.setProperty("ForceDataType", (int) data_type) );
1217 }
1218 ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.setProperty("CorrelationModel", m_EG_corrModel) );
1219 ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.setProperty("OutputLevel", this->msg().level()) );
1221 } else ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.initialize() );
1222 }
1223
1224 // electron triggers - first SFs (but we need to massage the id string since all combinations are not supported)
1225
1226 //single lepton
1227
1228 if(m_isRun3 && eleId.find("LooseBLayer") != std::string::npos) ATH_MSG_WARNING("Replacing 'LooseBLayer' with 'Loose' for Electron ID while configuring single-ele trigger SF using: " << m_eleEffMapFilePath);
1229 std::string triggerEleID = m_isRun3? TString(eleId).ReplaceAll("LooseBLayer", "Loose").Data() : eleId;
1230 std::string triggerEleIso= m_eleIso_WP;
1231
1232 // This is an hack to work with ElectronEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map4.txt to allow
1233
1235 bool pass_isRun3TrigSFFallback = true;
1236 if (triggerEleID.find("Medium") != std::string::npos && triggerEleIso.find("Loose") != std::string::npos) {triggerEleID = "LooseBLayer";}
1237 else if (triggerEleID.find("Medium") != std::string::npos && triggerEleIso.find("Tight") != std::string::npos) {triggerEleID = "Tight"; triggerEleIso = "Tight_VarRad";}
1238 else if (triggerEleID.find("Medium") != std::string::npos && triggerEleIso.find("HighPtCaloOnly") != std::string::npos) {triggerEleID = "Tight"; triggerEleIso = "Tight_VarRad";}
1239 else if (triggerEleID.find("Tight") != std::string::npos && triggerEleIso.find("Loose") != std::string::npos) {triggerEleID = "LooseBLayer";}
1240 else if (triggerEleID.find("Tight") != std::string::npos && triggerEleIso.find("Tight") != std::string::npos) {triggerEleIso= "Tight_VarRad";}
1241 else if (triggerEleID.find("Tight") != std::string::npos && triggerEleIso.find("HighPtCaloOnly") != std::string::npos) {triggerEleID = "Tight"; triggerEleIso = "Tight_VarRad";}
1242 else if (triggerEleID.find("Loose") != std::string::npos && triggerEleIso.find("Tight") != std::string::npos) {triggerEleID = "LooseBLayer"; triggerEleIso = "Loose_VarRad";}
1243 else if (triggerEleID.find("Loose") != std::string::npos && triggerEleIso.find("HighPtCaloOnly") != std::string::npos) {triggerEleID = "LooseBLayer"; triggerEleIso = "Loose_VarRad";}
1244 else {pass_isRun3TrigSFFallback=false;}
1245 if(pass_isRun3TrigSFFallback){
1246 ATH_MSG_INFO(" ************** This is only for testing/studying purpose! ************** ");
1247 ATH_MSG_INFO(" ************** For official recommendation, please get in contact with the SUSY Bkg Forum ************** ");
1248 ATH_MSG_INFO("In the current map ("<<m_eleEffMapFilePath<<"), the only supported Electron ID working-points supported for Electron Trigger Scale Factor are 'Loose_Loose_VarRad' and 'Tight_Tight_VarRad' ");
1249 ATH_MSG_INFO("Only for single-lepton trigger scale factor, fall back to Electron ID: -> "<< triggerEleID << " with Isolation: " << triggerEleIso);
1250 }
1251 }
1252
1253 // The L1 seed changed from 2023 and beyond, so we need to adjust the trigger key accordingly, the SF are now derived by year so we need to change the year in the key as well.
1254
1255 if(m_isRun3){
1256 // Find year positions (or npos if not present)
1257 size_t p22 = m_electronTriggerSFStringSingle.find("2022");
1258 size_t p23 = m_electronTriggerSFStringSingle.find("2023");
1259 size_t p24 = m_electronTriggerSFStringSingle.find("2024");
1260
1261 auto next_pos = [&](size_t self) {
1262 size_t next = std::string::npos;
1263
1264 if (self == p22) {
1265 if (p23 > self && p23 < next) next = p23;
1266 if (p24 > self && p24 < next) next = p24;
1267 }
1268 else if (self == p23) {
1269 if (p22 > self && p22 < next) next = p22;
1270 if (p24 > self && p24 < next) next = p24;
1271 }
1272 else if (self == p24) {
1273 if (p22 > self && p22 < next) next = p22;
1274 if (p23 > self && p23 < next) next = p23;
1275 }
1276
1277 return next;
1278 };
1279 std::string SFStringSingle22="";
1280 std::string SFStringSingle23="";
1281 std::string SFStringSingle24="";
1282
1283 // Extract 2022,2023,2025 block
1284 if (p22 != std::string::npos) {size_t end = next_pos(p22); SFStringSingle22 = m_electronTriggerSFStringSingle.substr(p22, end - p22);}
1285 if (p23 != std::string::npos) {size_t end = next_pos(p23); SFStringSingle23 = m_electronTriggerSFStringSingle.substr(p23, end - p23);}
1286 if (p24 != std::string::npos) {size_t end = next_pos(p24); SFStringSingle24 = m_electronTriggerSFStringSingle.substr(p24, end - p24);}
1287
1288 // Remove trailing underscores from tokens if present
1289 std::string* toks[] = { &SFStringSingle22, &SFStringSingle23, &SFStringSingle24 };
1290 for (auto t : toks) {
1291 while (!t->empty() && t->back() == '_') t->pop_back();
1292 }
1293
1294 if(m_mcCampaign == "mc23a") m_electronTriggerSFStringSingle = SFStringSingle22;
1295 else if(m_mcCampaign == "mc23d") m_electronTriggerSFStringSingle = SFStringSingle23;
1296 else if(m_mcCampaign == "mc23e") m_electronTriggerSFStringSingle = SFStringSingle24;
1297 else {
1298 ATH_MSG_WARNING("Unknown or unsupported mcCampaign for Run 3: " << m_mcCampaign << ". Please contact the SUSY Bkg Forum for assistance.");
1299 ATH_MSG_WARNING("Falling back to 2024 trigger SFs for single-electron triggers.");
1300 m_electronTriggerSFStringSingle = SFStringSingle24;
1301 }
1302 }
1303
1304
1305 ATH_MSG_INFO("eSF_keys: " << m_electronTriggerSFStringSingle<< "_"<<triggerEleID<<"_"<<triggerEleIso);
1306
1307 if (std::find(eSF_keys.begin(), eSF_keys.end(), m_electronTriggerSFStringSingle+"_"+triggerEleID+"_"+triggerEleIso) != eSF_keys.end()){
1308 triggerEleIso = m_eleIso_WP;
1309 } else if (std::find(eSF_keys.begin(), eSF_keys.end(), m_electronTriggerSFStringSingle+"_"+triggerEleID+"_"+m_el_iso_fallback[triggerEleIso]) != eSF_keys.end()){
1310 //--- Check to see if the only issue is an unknown isolation working point
1311 triggerEleIso = m_el_iso_fallback[triggerEleIso];
1312 ATH_MSG_WARNING("(AsgElectronEfficiencyCorrectionTool_trig_singleLep_*) Your selected electron Iso WP ("
1313 << m_eleIso_WP
1314 << ") does not have trigger SFs defined. Falling back to "
1315 << triggerEleIso
1316 << " for SF calculations");
1317 }
1318 else{
1319 ATH_MSG_ERROR("*** THE SINGLE ELECTRON TRIGGER SF YOU SELECTED (" << m_electronTriggerSFStringSingle << ") GOT NO SUPPORT FOR YOUR ID+ISO WPs (" << m_eleId << "+" << m_eleIso_WP << ") ***");
1320 return StatusCode::FAILURE;
1321 }
1322
1323 toolName = "AsgElectronEfficiencyCorrectionTool_trig_singleLep_" + triggerEleID;
1324 if ( !m_elecEfficiencySFTool_trig_singleLep.isUserConfigured() ) {
1325 m_elecEfficiencySFTool_trig_singleLep.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+toolName);
1328 ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("IdKey", triggerEleID) );
1329 ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("IsoKey", triggerEleIso) );
1330 ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("CorrelationModel", m_EG_corrModel) );
1331 if (!isData()) {
1332 ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("ForceDataType", (int) (data_type==PATCore::ParticleDataType::Fast)? PATCore::ParticleDataType::Full : data_type) );
1333 }
1334 ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("OutputLevel", this->msg().level()) );
1337
1338
1339 toolName = "AsgElectronEfficiencyCorrectionTool_trigEff_singleLep_" + triggerEleID;
1340 if ( !m_elecEfficiencySFTool_trigEff_singleLep.isUserConfigured() ) {
1341 m_elecEfficiencySFTool_trigEff_singleLep.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+toolName);
1344 ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("IdKey", triggerEleID) );
1345 ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("IsoKey", triggerEleIso) );
1346 ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("CorrelationModel", m_EG_corrModel) );
1347 if (!isData()) {
1348 ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("ForceDataType", (int) (data_type==PATCore::ParticleDataType::Fast)? PATCore::ParticleDataType::Full : data_type) );
1349 }
1350 ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("OutputLevel", this->msg().level()) );
1353
1354 if (!m_isRun3){
1355 //mixed-leptons
1356 std::map<std::string,std::string> electronTriggerSFMapMixedLepton {
1357 // legs, Trigger keys,
1358 {"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose,e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", m_electronTriggerSFStringSingle},
1359 {"e24_lhvloose_nod0_L1EM20VH,e17_lhvloose_nod0,e12_lhloose_L1EM10VH","DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH"},
1360 {"e26_lhmedium_nod0_L1EM22VHI,e26_lhmedium_nod0","MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_2018_e26_lhmedium_nod0"},
1361 {"e17_lhloose,e17_lhloose_nod0","MULTI_L_2015_e17_lhloose_2016_2018_e17_lhloose_nod0"},
1362 {"e12_lhloose,e12_lhloose_nod0","MULTI_L_2015_e12_lhloose_2016_2018_e12_lhloose_nod0"},
1363 {"e7_lhmedium,e7_lhmedium_nod0","MULTI_L_2015_e7_lhmedium_2016_2018_e7_lhmedium_nod0"},
1364 {"e9_lhloose,e9_lhloose_nod0,e12_lhvloose_nod0_L1EM10VH","TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_2018_e12_lhvloose_nod0_L1EM10VH"}
1365
1366 };
1367
1368 // 2e17 trigger is used in 2017 or 2018?
1370 if (triglist_2017to2018.find("2e17_lhvloose_nod0_L12EM15VHI") != std::string::npos) {
1371 electronTriggerSFMapMixedLepton["e17_lhvloose_nod0_L1EM15VHI"] = "DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e17_lhvloose_nod0_L1EM15VHI";
1372 }
1373
1374 std::string triggerMixedEleIso("");
1375
1376 for(auto const& item : electronTriggerSFMapMixedLepton){
1377
1378 if (std::find(eSF_keys.begin(), eSF_keys.end(), item.second+"_"+eleId+"_"+m_eleIso_WP) != eSF_keys.end()){
1379 triggerMixedEleIso = m_eleIso_WP;
1380 } else if (std::find(eSF_keys.begin(), eSF_keys.end(), item.second+"_"+eleId+"_"+m_el_iso_fallback[m_eleIso_WP]) != eSF_keys.end()){
1381 //--- Check to see if the only issue is an unknown isolation working point
1382 triggerMixedEleIso = m_el_iso_fallback[m_eleIso_WP];
1383 ATH_MSG_WARNING("(AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP ("
1384 << m_eleIso_WP
1385 << ") does not have trigger SFs defined. Falling back to "
1386 << triggerMixedEleIso
1387 << " for SF calculations");
1388 } else {
1389 ATH_MSG_ERROR("*** THE MIXED ELECTRON TRIGGER SF YOU SELECTED (" << item.second << ") GOT NO SUPPORT FOR YOUR ID+ISO WPs (" << m_eleId << "+" << m_eleIso_WP << "). The fallback options failed as well sorry! ***");
1390 return StatusCode::FAILURE;
1391 }
1392
1393 ATH_MSG_VERBOSE ("Selected WP: " << item.second << "_" << eleId << "_" << triggerMixedEleIso);
1394
1395 toolName = "AsgElectronEfficiencyCorrectionTool_trig_mixLep_" + (item.first).substr(0,8) + m_eleId;
1396 auto t_sf = m_elecEfficiencySFTool_trig_mixLep.emplace(m_elecEfficiencySFTool_trig_mixLep.end(), "AsgElectronEfficiencyCorrectionTool/"+toolName);
1397 ATH_CHECK( t_sf->setProperty("MapFilePath", m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2) );
1398 ATH_CHECK( t_sf->setProperty("TriggerKey", item.second) );
1399 ATH_CHECK( t_sf->setProperty("IdKey", eleId) );
1400 ATH_CHECK( t_sf->setProperty("IsoKey", triggerMixedEleIso) );
1401 ATH_CHECK( t_sf->setProperty("CorrelationModel", m_EG_corrModel) );
1402 if (!isData()) {
1403 ATH_CHECK( t_sf->setProperty("ForceDataType", (int) (data_type==PATCore::ParticleDataType::Fast)? PATCore::ParticleDataType::Full : data_type) );
1404 }
1405 ATH_CHECK( t_sf->setProperty("OutputLevel", this->msg().level()) );
1406 ATH_CHECK( t_sf->initialize() );
1407 m_elecTrigSFTools.push_back(t_sf->getHandle());
1408 #ifndef XAOD_STANDALONE
1409 m_legsPerTool[toolName] = item.first;
1410 #else
1411 m_legsPerTool["ToolSvc."+toolName] = item.first;
1412 #endif
1413
1414 toolName = "AsgElectronEfficiencyCorrectionTool_trigEff_mixLep_" + (item.first).substr(0,8) + m_eleId;
1415 auto t_eff = m_elecEfficiencySFTool_trigEff_mixLep.emplace(m_elecEfficiencySFTool_trigEff_mixLep.end(), "AsgElectronEfficiencyCorrectionTool/"+toolName);
1416 ATH_CHECK( t_eff->setProperty("MapFilePath", m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2) );
1417 ATH_CHECK( t_eff->setProperty("TriggerKey", "Eff_"+item.second) );
1418 ATH_CHECK( t_eff->setProperty("IdKey", eleId) );
1419 ATH_CHECK( t_eff->setProperty("IsoKey", triggerMixedEleIso) );
1420 ATH_CHECK( t_eff->setProperty("CorrelationModel", m_EG_corrModel) );
1421 if (!isData()) {
1422 ATH_CHECK( t_eff->setProperty("ForceDataType", (int) (data_type==PATCore::ParticleDataType::Fast)? PATCore::ParticleDataType::Full : data_type) );
1423 }
1424 ATH_CHECK( t_eff->setProperty("OutputLevel", this->msg().level()) );
1425 ATH_CHECK( t_eff->initialize() );
1426 m_elecTrigEffTools.push_back(t_eff->getHandle());
1427 #ifndef XAOD_STANDALONE
1428 m_legsPerTool[toolName] = item.first;
1429 #else
1430 m_legsPerTool["ToolSvc."+toolName] = item.first;
1431 #endif
1432
1433 }
1434 }
1435 else ATH_MSG_WARNING("*** THE ELECTRON TRIGGER SF MIXED AND SF DILEP ARE CURRENTY NOT SUPPORTED IN RUN3 ***");
1436
1437 ATH_MSG_WARNING("*** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED ***");
1438 // all the iinitialisation of the related tools have been cleaned up
1439
1440 }
1441
1442 if (m_slices["pho"]) {
1443 // /////////////////////////////////////////////////////////////////////////////////////////
1444 // Initialise photon efficiency tool
1445
1446 if (!m_photonEfficiencySFTool.isUserConfigured() && !isData()) {
1447 m_photonEfficiencySFTool.setTypeAndName("AsgPhotonEfficiencyCorrectionTool/AsgPhotonEfficiencyCorrectionTool_" + m_photonId);
1448
1449 if (m_photonId != "Tight" ) {
1450 ATH_MSG_WARNING( "No Photon efficiency available for " << m_photonId << ", using Tight instead..." );
1451 }
1452
1453 ATH_CHECK( m_photonEfficiencySFTool.setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2025/rel22.2/2024_FinalRun2_Recommendation_v1/map1.txt") );
1454 ATH_CHECK( m_photonEfficiencySFTool.setProperty("ForceDataType", isAtlfast()? (m_isRun3? 1: 3) : 1) ); // Set data type: 1 for FULLSIM, 3 for AtlFast. For Run3 pre-rec only FullSim SFs are available
1455 ATH_CHECK( m_photonEfficiencySFTool.setProperty("OutputLevel", this->msg().level()) );
1456 ATH_CHECK( m_photonEfficiencySFTool.retrieve() );
1457 } else if (m_photonEfficiencySFTool.isUserConfigured()) ATH_CHECK( m_photonEfficiencySFTool.retrieve() );
1458
1459 if (!m_photonIsolationSFTool.isUserConfigured() && !isData()) {
1460 m_photonIsolationSFTool.setTypeAndName("AsgPhotonEfficiencyCorrectionTool/AsgPhotonEfficiencyCorrectionTool_isol" + m_photonIso_WP);
1461
1462 if (m_photonIso_WP != "FixedCutTight" && m_photonIso_WP != "FixedCutLoose" && m_photonIso_WP != "TightCaloOnly") {
1463 ATH_MSG_WARNING( "No Photon efficiency available for " << m_photonIso_WP);
1464 }
1465
1466 ATH_CHECK( m_photonIsolationSFTool.setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map1.txt") );
1467 ATH_CHECK( m_photonIsolationSFTool.setProperty("IsoKey", m_photonIso_WP != "TightCaloOnly" ? m_photonIso_WP.substr(8) : m_photonIso_WP )); // Set isolation WP: Loose,Tight,TightCaloOnly
1468 ATH_CHECK( m_photonIsolationSFTool.setProperty("ForceDataType", 1) ); // Set data type: 1 for FULLSIM, 3 for AF2
1469 ATH_CHECK( m_photonIsolationSFTool.setProperty("OutputLevel", this->msg().level()) );
1470 ATH_CHECK( m_photonIsolationSFTool.retrieve() );
1471 } else if (m_photonEfficiencySFTool.isUserConfigured()) ATH_CHECK( m_photonIsolationSFTool.retrieve() );
1472
1473 // trigger scale factors
1474 if (!m_photonTriggerSFTool.isUserConfigured() && !isData()) {
1475 m_photonTriggerSFTool.setTypeAndName("AsgPhotonEfficiencyCorrectionTool/AsgPhotonEfficiencyCorrectionTool_trig" + m_photonTriggerName);
1476
1477 // Fallback to TightCaloOnly if Tight is selected
1478 std::string photonIso_forTrigSF = m_photonIso_WP;
1479 if (m_photonIso_WP == "FixedCutTight") {
1480 ATH_MSG_WARNING( "No Photon trigger SF available for " << m_photonIso_WP << ", using TightCaloOnly instead... Use at your own risk" );
1481 photonIso_forTrigSF = "TightCaloOnly";
1482 } else { // isolation WP supported: Loose or TightCaloOnly, removing "FixedCut" suffix..
1483 photonIso_forTrigSF = TString(m_photonIso_WP).ReplaceAll("FixedCut","").Data();
1484 }
1485
1486 // "symmetric" diphoton triggers (year dependent)
1487 ATH_CHECK( m_photonTriggerSFTool.setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map3.txt") );
1488 ATH_CHECK( m_photonTriggerSFTool.setProperty("IsoKey", photonIso_forTrigSF )); // Set isolation WP: Loose,TightCaloOnly
1489 ATH_CHECK( m_photonTriggerSFTool.setProperty("TriggerKey", m_photonTriggerName ));
1490 ATH_CHECK( m_photonTriggerSFTool.setProperty("ForceDataType", 1) ); // Set data type: 1 for FULLSIM, 3 for AF2
1491 ATH_CHECK( m_photonTriggerSFTool.setProperty("OutputLevel", this->msg().level()) );
1492 ATH_CHECK( m_photonTriggerSFTool.retrieve() );
1493
1494 // "asymmetric" diphoton triggers
1495 std::map<std::string,std::string> diphotonTriggerSFMapAsymmetric {
1496 // legs, Trigger keys,
1497 {"g25_loose,g25_medium_L1EM20VH", "DI_PH_2015_g25_loose_2016_g25_loose_2017_g25_medium_L1EM20VH_2018_g25_medium_L1EM20VH"},
1498 {"g35_loose,g35_medium_L1EM20VH", "DI_PH_2015_g35_loose_2016_g35_loose_2017_g35_medium_L1EM20VH_2018_g35_medium_L1EM20VH"},
1499 };
1500
1501 for(auto const& item : diphotonTriggerSFMapAsymmetric){
1502
1503 toolName = "AsgPhotonEfficiencyCorrectionTool_trigSF_asymm_diphoton_" + (item.first).substr(0,9) + photonIso_forTrigSF;
1504 auto ph_trigSF = m_photonEfficiencySFTool_trigSF_AsymDiphoton.emplace(m_photonEfficiencySFTool_trigSF_AsymDiphoton.end(), "AsgPhotonEfficiencyCorrectionTool/"+toolName);
1505 ATH_CHECK( ph_trigSF->setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map3.txt") );
1506 ATH_CHECK( ph_trigSF->setProperty("IsoKey", photonIso_forTrigSF) );
1507 ATH_CHECK( ph_trigSF->setProperty("TriggerKey", item.second) );
1508 ATH_CHECK( ph_trigSF->setProperty("ForceDataType", 1) ); // Set DataType: 1 for FullSim and 3 for AFII
1509 ATH_CHECK( ph_trigSF->setProperty("OutputLevel", this->msg().level()) );
1510 ATH_CHECK( ph_trigSF->initialize() );
1511 m_photonTrigSFTools.push_back(ph_trigSF->getHandle());
1512 #ifndef XAOD_STANDALONE
1513 m_legsPerTool_ph[toolName] = item.first;
1514 #else
1515 m_legsPerTool_ph["ToolSvc."+toolName] = item.first;
1516 #endif
1517
1518 toolName = "AsgPhotonEfficiencyCorrectionTool_trigEff_asymm_diphoton_" + (item.first).substr(0,9) + photonIso_forTrigSF;
1519 auto ph_trigEff = m_photonEfficiencySFTool_trigEff_AsymDiphoton.emplace(m_photonEfficiencySFTool_trigEff_AsymDiphoton.end(), "AsgPhotonEfficiencyCorrectionTool/"+toolName);
1520 ATH_CHECK( ph_trigEff->setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map3.txt") );
1521 ATH_CHECK( ph_trigEff->setProperty("IsoKey", photonIso_forTrigSF) );
1522 ATH_CHECK( ph_trigEff->setProperty("TriggerKey", "Eff_"+item.second) );
1523 ATH_CHECK( ph_trigEff->setProperty("ForceDataType", 1) ); // Set DataType: 1 for FullSim and 3 for AFII
1524 ATH_CHECK( ph_trigEff->setProperty("OutputLevel", this->msg().level()) );
1525 ATH_CHECK( ph_trigEff->initialize() );
1526 m_photonTrigEffTools.push_back(ph_trigEff->getHandle());
1527 #ifndef XAOD_STANDALONE
1528 m_legsPerTool_ph[toolName] = item.first;
1529 #else
1530 m_legsPerTool_ph["ToolSvc."+toolName] = item.first;
1531 #endif
1532
1533 }
1534 }
1535 }
1536
1537 }
1538 if (m_slices["ele"] || m_slices["pho"]) {
1540 // Initialize the EgammaAmbiguityTool
1541
1542 if (!m_egammaAmbiguityTool.isUserConfigured()) {
1543 m_egammaAmbiguityTool.setTypeAndName("EGammaAmbiguityTool/EGammaAmbiguityTool");
1544 ATH_CHECK( m_egammaAmbiguityTool.setProperty("OutputLevel", this->msg().level()) );
1545 ATH_CHECK( m_egammaAmbiguityTool.retrieve() );
1546 } else ATH_CHECK( m_egammaAmbiguityTool.retrieve() );
1547 }
1548
1549
1550 if (m_slices["ele"]) {
1551 //disable ///////////////////////////////////////////////////////////////////////////////////////////
1552 //disable // Initialize the AsgElectronChargeIDSelector
1553
1554 //disable if (!m_elecChargeIDSelectorTool.isUserConfigured()) {
1555
1556 //disable // For the selector, can use the nice function
1557 //disable std::string eleId = EG_WP(m_eleId);
1558 //disable m_elecChargeIDSelectorTool.setTypeAndName("AsgElectronChargeIDSelectorTool/ElectronChargeIDSelectorTool_"+eleId);
1559 //disable //default cut value for https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ElectronChargeFlipTaggerTool
1560 //disable float BDTcut = -0.337671; // Loose 97%
1561 //disable if (m_eleChID_WP != "Loose" && !m_eleChID_WP.empty()) {
1562 //disable ATH_MSG_ERROR("Only Loose WP is supported in R21. Invalid ChargeIDSelector WP selected : " << m_eleChID_WP);
1563 //disable return StatusCode::FAILURE;
1564 //disable }
1565
1566 //disable ATH_CHECK( m_elecChargeIDSelectorTool.setProperty("TrainingFile", "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root"));
1567 //disable ATH_CHECK( m_elecChargeIDSelectorTool.setProperty("CutOnBDT", BDTcut));
1568 //disable ATH_CHECK( m_elecChargeIDSelectorTool.setProperty("OutputLevel", this->msg().level()) );
1569 //disable ATH_CHECK( m_elecChargeIDSelectorTool.retrieve() );
1570 //disable } else ATH_CHECK( m_elecChargeIDSelectorTool.retrieve() );
1571
1572
1574 // Initialise egamma calibration tool
1575
1576 if (!m_egammaCalibTool.isUserConfigured()) {
1577 m_egammaCalibTool.setTypeAndName("CP::EgammaCalibrationAndSmearingTool/EgammaCalibrationAndSmearingTool");
1578 ATH_MSG_DEBUG( "Initialising EgcalibTool " );
1579 ATH_CHECK( m_egammaCalibTool.setProperty("ESModel", m_isRun3 ? "es2024_Run3_v0" : "es2023_R22_Run2_v1") );
1580 ATH_CHECK( m_egammaCalibTool.setProperty("decorrelationModel", "1NP_v1") );
1581 // allows to bypass (intended) abort from of egamma calibration tool when configured for fastSim
1583 ATH_MSG_WARNING( "Forcing EgcalibTool to use calibrations for full simulation" );
1584 ATH_CHECK( m_egammaCalibTool.setProperty("useFastSim", false) );
1585 }
1586 else {
1587 ATH_MSG_INFO("is Fast Sim:" << isAtlfast());
1588 ATH_CHECK( m_egammaCalibTool.setProperty("useFastSim", isAtlfast() ? 1 : 0) );
1589 }
1590 ATH_CHECK( m_egammaCalibTool.setProperty("OutputLevel", this->msg().level()) );
1591 ATH_CHECK( m_egammaCalibTool.retrieve() );
1592 } else ATH_CHECK( m_egammaCalibTool.retrieve() );
1593 }
1594
1595
1596 if (m_slices["tau"]) {
1598
1600 // Initialise path to tau config file and config reader
1601
1602 // Read in the config file so we can retrieve the fields later when configuring the efficiency tools
1603 if ( m_tauConfigReader.ReadFile( PathResolverFindCalibFile(m_tauInputFile).c_str(), EEnvLevel(0) ) ) {
1604 ATH_MSG_ERROR( "Error while reading tau config file : " << m_tauInputFile );
1605 return StatusCode::FAILURE;
1606 }
1607 else ATH_MSG_DEBUG( "Successfully read tau config file : " << m_tauInputFile );
1608
1609
1611 // Initialise tau selection tools
1612
1613 if (!m_tauSelTool.isUserConfigured()) {
1614 toolName = "TauSelectionTool_" + m_tauId;
1615 m_tauSelTool.setTypeAndName("TauAnalysisTools::TauSelectionTool/"+toolName);
1616 ATH_CHECK( m_tauSelTool.setProperty("ConfigPath", m_tauInputFile) );
1617 ATH_CHECK( m_tauSelTool.setProperty("OutputLevel", this->msg().level()) );
1618 ATH_CHECK( m_tauSelTool.retrieve() );
1619 } else ATH_CHECK( m_tauSelTool.retrieve() );
1620
1621
1622 if (!m_tauSelToolBaseline.isUserConfigured()) {
1623 toolName = "TauSelectionToolBaseline_" + m_tauIdBaseline;
1624 m_tauSelToolBaseline.setTypeAndName("TauAnalysisTools::TauSelectionTool/"+toolName);
1625 ATH_CHECK( m_tauSelToolBaseline.setProperty("ConfigPath", m_tauInputFileBaseline) );
1626 ATH_CHECK( m_tauSelToolBaseline.setProperty("OutputLevel", this->msg().level()) );
1627 ATH_CHECK( m_tauSelToolBaseline.retrieve() );
1628 } else ATH_CHECK( m_tauSelToolBaseline.retrieve() );
1629
1630
1632 // jetIDWP/elIDWP for efficiency tool + trigger tool
1633 std::string jetIDWP = m_tauConfigReader.GetValue("JetIDWP" ,"");
1634 ANA_MSG_DEBUG( "Found JetIDWP in tau config file : " << jetIDWP );
1635 int jet_id_lvl;
1636 // Read out the tau ID from the config file and map into the enum from tau CP
1637 if (jetIDWP == "JETIDNONE") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDNONE;
1638 else if (jetIDWP == "JETIDRNNVERYLOOSE") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDRNNVERYLOOSE;
1639 else if (jetIDWP == "JETIDRNNLOOSE") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDRNNLOOSE;
1640 else if (jetIDWP == "JETIDRNNMEDIUM") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDRNNMEDIUM;
1641 else if (jetIDWP == "JETIDRNNTIGHT") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDRNNTIGHT;
1642 else if (jetIDWP == "JETIDGNTAUVERYLOOSE") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDGNTAUVERYLOOSE;
1643 else if (jetIDWP == "JETIDGNTAULOOSE") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDGNTAULOOSE;
1644 else if (jetIDWP == "JETIDGNTAUMEDIUM") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDGNTAUMEDIUM;
1645 else if (jetIDWP == "JETIDGNTAUTIGHT") jet_id_lvl = (int)TauAnalysisTools::JetID::JETIDGNTAUTIGHT;
1646 else {
1647 ATH_MSG_ERROR("Invalid Tau ID in tau config file " << jetIDWP);
1648 return StatusCode::FAILURE;
1649 }
1650 // Read out the (optional) Ele OR from the config file and map into the enum from tau CP
1651 std::string eleIDWP = m_tauConfigReader.GetValue("EleIDWP" ,"");
1652 ANA_MSG_DEBUG( "Found EleIDWP in tau config file : " << eleIDWP );
1653 int ele_id_lvl = -1;
1654 if (eleIDWP == "ELEIDRNNLOOSE") ele_id_lvl = (int)TauAnalysisTools::EleID::ELEIDRNNLOOSE;
1655 else if (eleIDWP == "ELEIDRNNMEDIUM") ele_id_lvl = (int)TauAnalysisTools::EleID::ELEIDRNNMEDIUM;
1656 else if (eleIDWP == "ELEIDRNNTIGHT") ele_id_lvl = (int)TauAnalysisTools::EleID::ELEIDRNNTIGHT;
1657 else {
1658 ATH_MSG_INFO("No or invalid Ele OR in tau config file " << eleIDWP << " will not apply SFs for electro veto" );
1659 }
1660 if (jet_id_lvl == (int)TauAnalysisTools::JetID::JETIDRNNTIGHT || jet_id_lvl == (int)TauAnalysisTools::JetID::JETIDGNTAUTIGHT) {
1661 ATH_MSG_WARNING("EleOR with Tight TauID is currently not supported, please discuss with TauCP!");
1662 }
1663
1664 int jet_id_lvl_fb = jet_id_lvl;
1665 if (m_tau_id_fallback.count(jet_id_lvl) > 0) {
1666 jet_id_lvl_fb = m_tau_id_fallback[jet_id_lvl];
1667 ATH_MSG_WARNING("Configuring fallback RNN ID SF for GNTau config, do not use in production!");
1668 }
1669
1670
1672 // Initialise tau efficiency tool
1673
1674 // TEMPORARY: no recommendations yet for 2024+
1675 if (!m_tauEffTool.isUserConfigured() && !isData() && !(m_mcCampaign=="mc23e" || m_mcCampaign=="mc23g")) {
1676 toolName = "TauEffTool_" + m_tauId;
1677 m_tauEffTool.setTypeAndName("TauAnalysisTools::TauEfficiencyCorrectionsTool/"+toolName);
1678
1679 std::vector<int> correction_types;
1680 // Add retrieval of reco and ID SFs
1681 correction_types.insert(correction_types.end(), {TauAnalysisTools::EfficiencyCorrectionType::SFRecoHadTau,
1682 TauAnalysisTools::EfficiencyCorrectionType::SFJetIDHadTau});
1683
1684 // Add retrieval of electron veto SFs if its applied
1685 if (ele_id_lvl != -1 )
1686 correction_types.insert(correction_types.end(), {TauAnalysisTools::EfficiencyCorrectionType::SFEleIDHadTau,
1687 TauAnalysisTools::EfficiencyCorrectionType::SFEleIDElectron});
1688
1689 ATH_CHECK( m_tauEffTool.setProperty("JetIDLevel", jet_id_lvl_fb) );
1690 ATH_CHECK( m_tauEffTool.setProperty("EleIDLevel", ele_id_lvl) );
1691 ATH_CHECK( m_tauEffTool.setProperty("EfficiencyCorrectionTypes", correction_types) );
1692 ATH_CHECK( m_tauEffTool.setProperty("OutputLevel", this->msg().level()) );
1693 ATH_CHECK( m_tauEffTool.setProperty("useFastSim", isAtlfast()) );
1694 ATH_CHECK( m_tauEffTool.setProperty("RecommendationTag", m_tauEffToolRecommendationTag) );
1695 if (m_isRun3){ ATH_CHECK( m_tauEffTool.setProperty("Campaign", "mc23") );}
1696 else { ATH_CHECK( m_tauEffTool.setProperty("Campaign", "mc20") );}
1697 ATH_CHECK( m_tauEffTool.retrieve() );
1698 } else if (m_tauEffTool.isUserConfigured()) ATH_CHECK( m_tauEffTool.retrieve() );
1699
1700
1702 // Initialise tau trigger efficiency tool(s)
1703
1704 // TEMPORARY: no recommendations yet for 2024+
1705 if (!isData() && !(m_mcCampaign=="mc23e" || m_mcCampaign=="mc23g")) {
1706 // map format: SF file name, corresponding single-tau leg (comma-separated in case of OR)
1708 {"HLT_tau25_medium1_tracktwo", "HLT_tau25_medium1_tracktwo"},
1709 {"HLT_tau35_medium1_tracktwo", "HLT_tau35_medium1_tracktwo"},
1710 {"HLT_tau50L1TAU12_medium1_tracktwo", "HLT_tau50_medium1_tracktwo_L1TAU12"},
1711 {"HLT_tau60_medium1_tracktwo", "HLT_tau60_medium1_tracktwo"},
1712 {"HLT_tau80L1TAU60_medium1_tracktwo", "HLT_tau80_medium1_tracktwo_L1TAU60"},
1713 {"HLT_tau125_medium1_tracktwo", "HLT_tau125_medium1_tracktwo"},
1714 {"HLT_tau160_medium1_tracktwo", "HLT_tau160_medium1_tracktwo"},
1715 {"HLT_tau160L1TAU100_medium1_tracktwo", "HLT_tau160_medium1_tracktwo_L1TAU100"},
1716 // whole 2018 data taking period
1717 {"HLT_tau25_medium1_tracktwoEF", "HLT_tau25_medium1_tracktwoEF"},
1718 {"HLT_tau35_medium1_tracktwoEF", "HLT_tau35_medium1_tracktwoEF"},
1719 {"HLT_tau60_medium1_tracktwoEF", "HLT_tau60_medium1_tracktwoEF"},
1720 {"HLT_tau80L1TAU60_medium1_tracktwoEF", "HLT_tau80_medium1_tracktwoEF_L1TAU60"},
1721 {"HLT_tau160L1TAU100_medium1_tracktwoEF", "HLT_tau160_medium1_tracktwoEF_L1TAU100"},
1722 };
1723
1724 if (m_isRun3){
1726 // 2024,2025,2026
1727 // TBA
1728 // 2022, 2023
1729 {"HLT_tau25_mediumRNN_tracktwoMVA", "HLT_tau25_mediumRNN_tracktwoMVA"},
1730 {"HLT_tau35_mediumRNN_tracktwoMVA", "HLT_tau35_mediumRNN_tracktwoMVA"},
1731 // 2022, 2023 75-1800 bunches
1732 {"HLT_tau160_mediumRNN_tracktwoMVA", "HLT_tau160_mediumRNN_tracktwoMVA_L1TAU100"},
1733 // 2023 from 400 bunches
1734 {"HLT_tau160_mediumRNN_tracktwoMVA", "HLT_tau160_mediumRNN_tracktwoMVA_L1eTAU140"}
1735 };
1736 }
1737
1738 for(auto const& trigger : m_tau_trig_support) {
1739 toolName = "TauTrigEffTool_" + m_tauId + "_" + trigger.first;
1740 auto tau_trigSF = m_tauTrigEffTool.emplace(m_tauTrigEffTool.end(), "TauAnalysisTools::TauEfficiencyCorrectionsTool/"+toolName);
1741 ATH_CHECK( tau_trigSF->setProperty("EfficiencyCorrectionTypes", std::vector<int>({TauAnalysisTools::SFTriggerHadTau})) );
1742 ATH_CHECK( tau_trigSF->setProperty("TriggerName", trigger.first) );
1743 ATH_CHECK( tau_trigSF->setProperty("JetIDLevel", jet_id_lvl_fb) );
1744 ATH_CHECK( tau_trigSF->setProperty("EleIDLevel", ele_id_lvl) );
1745 ATH_CHECK( tau_trigSF->setProperty("OutputLevel", this->msg().level()) );
1746 ATH_CHECK( tau_trigSF->setProperty("useFastSim", isAtlfast()) );
1747 ATH_CHECK( tau_trigSF->setProperty("RecommendationTag", m_tauEffToolRecommendationTag) );
1748 if (m_isRun3){ ATH_CHECK( tau_trigSF->setProperty("Campaign", m_mcCampaign) );}
1749 else { ATH_CHECK( tau_trigSF->setProperty("Campaign", "mc20") );}
1750 ATH_CHECK( tau_trigSF->initialize() );
1751 }
1752 }
1753
1754
1756 // Initialise tau smearing tool
1757
1758 if (!m_tauSmearingTool.isUserConfigured()) {
1759 m_tauSmearingTool.setTypeAndName("TauAnalysisTools::TauSmearingTool/TauSmearingTool");
1760 ATH_CHECK( m_tauSmearingTool.setProperty("RecommendationTag", m_tauSmearingToolRecommendationTag) );
1761 if (m_isRun3){ ATH_CHECK( m_tauSmearingTool.setProperty("Campaign", "mc23") );}
1762 else { ATH_CHECK( m_tauSmearingTool.setProperty("Campaign", "mc20") );}
1763 ATH_CHECK( m_tauSmearingTool.setProperty("MVATESQualityCheck", m_ApplyMVATESQualityCheck) );
1764 ATH_CHECK( m_tauSmearingTool.setProperty("useFastSim", isAtlfast()) );
1765 ATH_CHECK( m_tauSmearingTool.setProperty("OutputLevel", this->msg().level()) );
1766 ATH_CHECK( m_tauSmearingTool.retrieve() );
1767 } else ATH_CHECK( m_tauSmearingTool.retrieve() );
1768
1769
1771 // Initialise tau truth matching tool
1772
1773 if (!m_tauTruthMatch.isUserConfigured() && m_tauDoTTM && !isData()) {
1774 m_tauTruthMatch.setTypeAndName("TauAnalysisTools::TauTruthMatchingTool/TauTruthMatch");
1775 ATH_CHECK( m_tauTruthMatch.setProperty("TruthJetContainerName", m_defaultTruthJets ) );
1776 ATH_CHECK( m_tauTruthMatch.setProperty("OutputLevel", this->msg().level()) );
1777 ATH_CHECK( m_tauTruthMatch.retrieve() );
1778 } else if (m_tauTruthMatch.isUserConfigured()) ATH_CHECK( m_tauTruthMatch.retrieve() );
1779
1780
1781 }
1782
1783
1784 if (m_slices["bjet"]) {
1786 // Initialise B-tagging tools
1787
1788 // btagSelectionTool
1789 std::string jetcollBTag = jetcoll;
1790 if (jetcoll == "AntiKt4LCTopoJets") {
1791 ATH_MSG_WARNING(" *** HACK *** Treating LCTopoJets jets as EMTopo -- use at your own risk!");
1792 jetcollBTag = "AntiKt4EMTopoJets";
1793 }
1794
1795 // print a warning if there is indication that the user supplied a CDI file not matching to the sample being processed
1796 // see --> https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTagRel22HighLevelSummary
1797 if( (m_bTaggingCalibrationFilePath.find(!m_isRun3 ? "MC20" : "MC23") == std::string::npos) && (m_bTaggingCalibrationFilePath.find(!m_isRun3 ? "MC20" : "MC21") == std::string::npos) ) {
1798 ATH_MSG_WARNING( "You are using a "<<(!m_isRun3 ? "Run3":"Run2")<<" CDI file while running on "<<(!m_isRun3 ? "Run2":"Run3")<<" sample; Please updates your CDI file to the correct version for "<<(!m_isRun3 ? "Run2":"Run3"));
1799 }
1800
1801 if (m_useBtagging && !m_btagSelTool.isUserConfigured() && !m_BtagWP.empty()) {
1802 if (jetcollBTag.find("AntiKt4EMTopoJets") == std::string::npos && jetcollBTag.find("AntiKt4EMPFlowJets")==std::string::npos) {
1803 ATH_MSG_WARNING("** Only AntiKt4EMTopoJets and AntiKt4EMPFlowJets are supported with FTAG scale factors!");
1804 return StatusCode::FAILURE;
1805 }
1806
1807 toolName = "BTagSel_" + jetcollBTag + m_BtagTagger + m_BtagWP;
1808
1809 m_btagSelTool.setTypeAndName("BTaggingSelectionTool/"+toolName);
1810 ATH_CHECK( m_btagSelTool.setProperty("TaggerName", m_BtagTagger ) );
1811 ATH_CHECK( m_btagSelTool.setProperty("OperatingPoint", m_BtagWP ) );
1812 ATH_CHECK( m_btagSelTool.setProperty("JetAuthor", jetcollBTag ) );
1813 ATH_CHECK( m_btagSelTool.setProperty("MinPt", m_BtagMinPt ) );
1814 ATH_CHECK( m_btagSelTool.setProperty("FlvTagCutDefinitionsFileName", m_bTaggingCalibrationFilePath) );
1815 // Read from BTagging object. This will be needed until the input file is produced from
1816 // a derivation release that includes !80336.
1817 ATH_CHECK( m_btagSelTool.setProperty("readFromBTaggingObject", m_BtagReadFromObject ) );
1818 ATH_CHECK( m_btagSelTool.setProperty("OutputLevel", this->msg().level()) );
1819 ATH_CHECK( m_btagSelTool.retrieve() );
1820 } else if (m_btagSelTool.isUserConfigured()) ATH_CHECK( m_btagSelTool.retrieve() );
1821
1822
1823 if (m_useBtagging && !m_btagSelTool_OR.isUserConfigured() && !m_orBtagWP.empty()) {
1824 if (jetcoll != "AntiKt4EMTopoJets" && jetcoll != "AntiKt4EMPFlowJets") {
1825 ATH_MSG_WARNING("** Only AntiKt4EMTopoJets and AntiKt4EMPFlowJets are supported with FTAG scale factors!");
1826 return StatusCode::FAILURE;
1827 }
1828
1829 toolName = "BTagSelOR_" + jetcollBTag + m_orBtagWP;
1830 m_btagSelTool_OR.setTypeAndName("BTaggingSelectionTool/"+toolName);
1831 ATH_CHECK( m_btagSelTool_OR.setProperty("TaggerName", m_BtagTagger ) );
1832 ATH_CHECK( m_btagSelTool_OR.setProperty("OperatingPoint", m_orBtagWP ) );
1833 ATH_CHECK( m_btagSelTool_OR.setProperty("JetAuthor", jetcollBTag ) );
1834 ATH_CHECK( m_btagSelTool_OR.setProperty("MinPt", m_BtagMinPt ) );
1835 ATH_CHECK( m_btagSelTool_OR.setProperty("FlvTagCutDefinitionsFileName", m_bTaggingCalibrationFilePath) );
1836 // Read from BTagging object. This will be needed until the input file is produced from
1837 // a derivation release that includes !80336.
1838 ATH_CHECK( m_btagSelTool_OR.setProperty("readFromBTaggingObject", m_BtagReadFromObject ) );
1839 ATH_CHECK( m_btagSelTool_OR.setProperty("OutputLevel", this->msg().level()) );
1840 ATH_CHECK( m_btagSelTool_OR.retrieve() );
1841 } else if (m_btagSelTool_OR.isUserConfigured()) ATH_CHECK( m_btagSelTool_OR.retrieve() );
1842
1843
1844 std::string trkjetcoll = m_defaultTrackJets;
1845 const std::string& BTagColl_TrkJet = trkjetcoll;
1846 if (m_slices["tjet"]) {
1847 if ( m_useBtagging_trkJet && m_defaultTrackJets.empty()) {
1848 m_useBtagging_trkJet = false;
1849 ATH_MSG_INFO("TrackJet collection set to None: disabling btagging for TrackJets.");
1850 }
1851
1852 if (m_useBtagging_trkJet && !m_btagSelTool_trkJet.isUserConfigured() && !m_BtagWP_trkJet.empty()) {
1853 if (trkjetcoll.find("AntiKt2PV0TrackJets")==std::string::npos && trkjetcoll.find("AntiKtVR30Rmax4Rmin02TrackJets")==std::string::npos) {
1854 ATH_MSG_WARNING("** Only AntiKt2PV0TrackJets and AntiKtVR30Rmax4Rmin02TrackJets are supported with FTAG scale factors!");
1855 return StatusCode::FAILURE;
1856 }
1857
1858 toolName = "BTagSel_" + trkjetcoll + m_BtagTagger_trkJet + m_BtagWP_trkJet;
1859
1860 m_btagSelTool_trkJet.setTypeAndName("BTaggingSelectionTool/"+toolName);
1861 ATH_CHECK( m_btagSelTool_trkJet.setProperty("TaggerName", m_BtagTagger_trkJet ) );
1862 ATH_CHECK( m_btagSelTool_trkJet.setProperty("OperatingPoint", m_BtagWP_trkJet ) );
1863 ATH_CHECK( m_btagSelTool_trkJet.setProperty("MinPt", m_BtagMinPt_trkJet ) );
1864 ATH_CHECK( m_btagSelTool_trkJet.setProperty("JetAuthor", BTagColl_TrkJet ) );
1865 ATH_CHECK( m_btagSelTool_trkJet.setProperty("MinPt", m_BtagMinPt_trkJet ) );
1866 ATH_CHECK( m_btagSelTool_trkJet.setProperty("FlvTagCutDefinitionsFileName", m_bTaggingCalibrationFilePath) );
1867 // Read from BTagging object. This will be needed until the input file is produced from
1868 // a derivation release that includes !80336.
1869 ATH_CHECK( m_btagSelTool_trkJet.setProperty("readFromBTaggingObject", m_BtagReadFromObject_trkJet ) );
1870 ATH_CHECK( m_btagSelTool_trkJet.setProperty("OutputLevel", this->msg().level()) );
1871 ATH_CHECK( m_btagSelTool_trkJet.retrieve() );
1872 } else if (m_btagSelTool_trkJet.isUserConfigured()) ATH_CHECK( m_btagSelTool_trkJet.retrieve() );
1873 }
1874
1875 // Set MCshowerType for FTAG MC/MC SFs
1876 // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTagCalibrationRecommendationsRelease21#MC_MC_Scale_Factors_for_Analysis
1877 std::string MCshowerID;
1878 if(m_showerType==-1){
1879 ATH_MSG_ERROR( "Error! m_showerType=-1, which is an error case for FTAG MC/MC SFs." );
1880 return StatusCode::FAILURE;
1881 }
1882 if(m_BtagTagger=="DL1dv01"){
1883 if(!m_isRun3){
1884 MCshowerID= "default"; // Powheg+Pythia8 (410470) - PhPy8EG_A14
1885 if (m_showerType == 1) MCshowerID = "411233"; // PowhegHerwig7
1886 else if (m_showerType == 2) MCshowerID = "600666"; // PhH7EG_H7UE - 601414
1887 else if (m_showerType == 3) MCshowerID = "410250"; // Sherpa_221
1888 else if (m_showerType == 4) MCshowerID = "700122"; // Sh_2210
1889 else if (m_showerType == 5) MCshowerID = "700122"; // Sh_2211
1890 else if (m_showerType == 6) MCshowerID = "700660"; // Sh_2212 - 700660
1891 else if (m_showerType == 7) MCshowerID = "410464"; // aMcAtNloPy8
1892 else if (m_showerType == 8) MCshowerID = "412116"; // aMcAtNloHerwig7
1893 else if (m_showerType != 0){
1894 ATH_MSG_WARNING("Unknown ShowerID detected! Using default FTAG MC-MC SFs (Powheg+Pythia8). Please check if these are applicable for this sample!");
1895 }
1896 }
1897 else{
1898 MCshowerID= "default"; // Powheg+Pythia8 (601229) - PhPy8EG_A14
1899 if (m_showerType == 2) MCshowerID = "601414"; // POWHEG+Herwig721 - PhH7EG_A14
1900 else if (m_showerType == 6) MCshowerID = "700660"; // Sherpa 2.2.12 - Sh_2212
1901 else if (m_showerType != 0){
1902 ATH_MSG_WARNING("Unknown ShowerID detected! Using default FTAG MC-MC SFs (Powheg+Pythia8). Please check if these are applicable for this sample!");
1903 }
1904 }
1905 } else if (m_BtagTagger=="GN2v01"){
1906 if(!m_isRun3){
1907 MCshowerID= "default"; // PowhegPythia8EvtGen (410470)
1908 if (m_showerType == 2) MCshowerID = "411233"; // POWHEGHERWIG7 - 411233
1909 else if (m_showerType == 3) MCshowerID = "600666"; // PhH7EG_H7UE - 600666
1910 else if (m_showerType == 4) MCshowerID = "700660"; // Sh_2210 FTAGAnalysisConfig uses this, but docs say only 11-16 can be used
1911 else if (m_showerType == 5) MCshowerID = "700660"; // Sh_2211
1912 else if (m_showerType == 6) MCshowerID = "700660"; // Sh_2212
1913 else if (m_showerType == 7) MCshowerID = "700660"; // Sh_2214
1914 else if (m_showerType == 8) {
1915 ATH_MSG_WARNING("Unknown Sherpa version detected! Using FTAG MC-MC SFs for Sherpa 2.2.11-2.2.16. Please check if these are applicable for this sample!");
1916 MCshowerID = "700660"; // Unknown Sherpa Version. This is to handle Sh_blank (e.g. DSID 701050). The examples I've found are all 2.2.16, but that's not guaranteed.
1917 }
1918 else if (m_showerType != 0){
1919 ATH_MSG_WARNING("Unknown ShowerID detected! Using default FTAG MC-MC SFs (Powheg+Pythia8). Please check if these are applicable for this sample!");
1920 }
1921 }
1922 else {
1923 MCshowerID= "default"; // PowhegPythia8EvtGen (601229)
1924 if (m_showerType == 3) MCshowerID = "601414"; // PhH7EG_H7UE - 601414
1925 else if (m_showerType == 5) MCshowerID = "700808"; // Sh_2211
1926 else if (m_showerType == 6) MCshowerID = "700808"; // Sh_2212
1927 else if (m_showerType == 7) MCshowerID = "700808"; // Sh_2214
1928 else if (m_showerType == 8) {
1929 ATH_MSG_WARNING("Unknown Sherpa version detected! Using FTAG MC-MC SFs for Sherpa 2.2.11-2.2.16. Please check if these are applicable for this sample!");
1930 MCshowerID = "700660"; // Unknown Sherpa Version
1931 }
1932 else if (m_showerType != 0){
1933 ATH_MSG_WARNING("Unknown ShowerID detected! Using default FTAG MC-MC SFs (Powheg+Pythia8). Please check if these are applicable for this sample!");
1934 }
1935 }
1936 } else {
1937 ATH_MSG_WARNING("Unknown b-tagger detected! Only DL1dv01 and GN2v01 are supported. Falling back to default FTAG MC-MC SFs (Powheg+Pythia8). Please check if these are applicable for this sample!");
1938 MCshowerID= "default";
1939 }
1940
1941 // btagEfficiencyTool
1942 if (m_useBtagging && !m_btagEffTool.isUserConfigured() && !m_BtagWP.empty()) {
1943 if (jetcoll != "AntiKt4EMTopoJets" && jetcoll != "AntiKt4EMPFlowJets") {
1944 ATH_MSG_WARNING("** Only AntiKt4EMTopoJets and AntiKt4EMPFlowJets are supported with FTAG scale factors!");
1945 return StatusCode::FAILURE;
1946 }
1947
1948 toolName = "BTagSF_" + jetcollBTag + m_BtagTagger + m_BtagWP;
1949 m_btagEffTool.setTypeAndName("BTaggingEfficiencyTool/"+toolName);
1950 ATH_CHECK( m_btagEffTool.setProperty("TaggerName", m_BtagTagger ) );
1951 ATH_CHECK( m_btagEffTool.setProperty("ScaleFactorFileName", m_bTaggingCalibrationFilePath) );
1952 ATH_CHECK( m_btagEffTool.setProperty("OperatingPoint", m_BtagWP ) );
1953 ATH_CHECK( m_btagEffTool.setProperty("JetAuthor", jetcollBTag ) );
1954 // Read from BTagging object. This will be needed until the input file is produced from
1955 // a derivation release that includes !80336.
1956 ATH_CHECK( m_btagEffTool.setProperty("readFromBTaggingObject", m_BtagReadFromObject ) );
1957 ATH_CHECK( m_btagEffTool.setProperty("MinPt", m_BtagMinPt ) );
1958 ATH_CHECK( m_btagEffTool.setProperty("SystematicsStrategy", m_BtagSystStrategy ) );
1959 ATH_CHECK( m_btagEffTool.setProperty("EfficiencyBCalibrations", MCshowerID ));
1960 ATH_CHECK( m_btagEffTool.setProperty("EfficiencyCCalibrations", MCshowerID ));
1961 ATH_CHECK( m_btagEffTool.setProperty("EfficiencyTCalibrations", MCshowerID ));
1962 ATH_CHECK( m_btagEffTool.setProperty("EfficiencyLightCalibrations", MCshowerID ));
1963 ATH_CHECK( m_btagEffTool.setProperty("EigenvectorReductionB", m_EigenvectorReductionB ));
1964 ATH_CHECK( m_btagEffTool.setProperty("EigenvectorReductionC", m_EigenvectorReductionC ));
1965 ATH_CHECK( m_btagEffTool.setProperty("EigenvectorReductionLight", m_EigenvectorReductionLight ));
1966 ATH_CHECK( m_btagEffTool.setProperty("OutputLevel", this->msg().level()) );
1967 ATH_CHECK( m_btagEffTool.retrieve() );
1968 } else ATH_CHECK( m_btagEffTool.retrieve() );
1969
1970
1971 if (m_slices["tjet"]) {
1972 if (m_useBtagging_trkJet && !m_btagEffTool_trkJet.isUserConfigured() && !m_BtagWP_trkJet.empty()) {
1973 if (trkjetcoll.find("AntiKt2PV0TrackJets")==std::string::npos && trkjetcoll.find("AntiKtVR30Rmax4Rmin02TrackJets")==std::string::npos) {
1974 ATH_MSG_WARNING("** Only AntiKt2PV0TrackJets and AntiKtVR30Rmax4Rmin02TrackJets are supported with FTAG scale factors!");
1975 return StatusCode::FAILURE;
1976 }
1977
1978 toolName = "BTagSF_" + trkjetcoll;
1979 m_btagEffTool_trkJet.setTypeAndName("BTaggingEfficiencyTool/"+toolName);
1980 ATH_CHECK( m_btagEffTool_trkJet.setProperty("TaggerName", m_BtagTagger_trkJet ) );
1981 ATH_CHECK( m_btagEffTool_trkJet.setProperty("ScaleFactorFileName", m_bTaggingCalibrationFilePath) );
1982 ATH_CHECK( m_btagEffTool_trkJet.setProperty("OperatingPoint", m_BtagWP_trkJet ) );
1983 ATH_CHECK( m_btagEffTool_trkJet.setProperty("JetAuthor", BTagColl_TrkJet ) );
1984 // Read from BTagging object. This will be needed until the input file is produced from
1985 // a derivation release that includes !80336.
1986 ATH_CHECK( m_btagEffTool_trkJet.setProperty("readFromBTaggingObject", m_BtagReadFromObject_trkJet ) );
1987 ATH_CHECK( m_btagEffTool_trkJet.setProperty("MinPt", m_BtagMinPt_trkJet ) );
1988 ATH_CHECK( m_btagEffTool_trkJet.setProperty("SystematicsStrategy", m_BtagSystStrategy ) );
1989 ATH_CHECK( m_btagEffTool_trkJet.setProperty("EfficiencyBCalibrations", MCshowerID ));
1990 ATH_CHECK( m_btagEffTool_trkJet.setProperty("EfficiencyCCalibrations", MCshowerID ));
1991 ATH_CHECK( m_btagEffTool_trkJet.setProperty("EfficiencyTCalibrations", MCshowerID ));
1992 ATH_CHECK( m_btagEffTool_trkJet.setProperty("EfficiencyLightCalibrations", MCshowerID ));
1993 ATH_CHECK( m_btagEffTool_trkJet.setProperty("EigenvectorReductionB", m_EigenvectorReductionB ));
1994 ATH_CHECK( m_btagEffTool_trkJet.setProperty("EigenvectorReductionC", m_EigenvectorReductionC ));
1995 ATH_CHECK( m_btagEffTool_trkJet.setProperty("EigenvectorReductionLight", m_EigenvectorReductionLight ));
1996 ATH_CHECK( m_btagEffTool_trkJet.setProperty("OutputLevel", this->msg().level()) );
1997 ATH_CHECK( m_btagEffTool_trkJet.retrieve() );
1998 } else if (m_btagEffTool_trkJet.isUserConfigured()) ATH_CHECK( m_btagEffTool_trkJet.retrieve() );
1999 }
2000 }
2001
2002
2003 if (m_slices["met"]) {
2005 // Initialise MET tools
2006
2007 if (!m_metMaker.isUserConfigured()) {
2008 toolName = m_doFwdJVT ? m_metJetSelection+"_fJVT" : m_metJetSelection+"_NOfJVT";
2009 m_metMaker.setTypeAndName("met::METMaker/METMaker_ST_"+toolName);
2010
2011 ATH_CHECK( m_metMaker.setProperty("JetContainer", jetcoll) );
2012 ATH_CHECK( m_metMaker.setProperty("ORCaloTaggedMuons", m_metRemoveOverlappingCaloTaggedMuons) );
2013 ATH_CHECK( m_metMaker.setProperty("DoSetMuonJetEMScale", m_metDoSetMuonJetEMScale) );
2014 ATH_CHECK( m_metMaker.setProperty("DoRemoveMuonJets", m_metDoRemoveMuonJets) );
2015 ATH_CHECK( m_metMaker.setProperty("UseGhostMuons", m_metUseGhostMuons) );
2016 ATH_CHECK( m_metMaker.setProperty("DoMuonEloss", m_metDoMuonEloss) );
2017 ATH_CHECK( m_metMaker.setProperty("GreedyPhotons", m_metGreedyPhotons) );
2018 ATH_CHECK( m_metMaker.setProperty("VeryGreedyPhotons", m_metVeryGreedyPhotons) );
2019
2020 // set the jet selection if default empty string is overridden through config file
2021 if (m_metJetSelection.size()) {
2022 ATH_CHECK( m_metMaker.setProperty("JetSelection", m_metJetSelection) );
2023 }
2025 ATH_CHECK( m_metMaker.setProperty("DoPFlow", true) );
2026 }
2027
2028 ATH_CHECK( m_metMaker.setProperty("OutputLevel", this->msg().level()) );
2029 ATH_CHECK( m_metMaker.retrieve() );
2030 } else ATH_CHECK( m_metMaker.retrieve() );
2031
2032
2033 if (!m_metSystTool.isUserConfigured()) {
2034 m_metSystTool.setTypeAndName("met::METSystematicsTool/METSystTool");
2035 ATH_CHECK( m_metSystTool.setProperty("ConfigPrefix", m_metsysConfigPrefix) );
2036
2038 ATH_MSG_ERROR( "Can only have CST *or* TST configured for MET maker. Please unset either METDoCaloSyst or METDoTrkSyst in your config file" );
2039 return StatusCode::FAILURE;
2040 }
2041
2042 if (m_trkMETsyst) {
2043 ATH_CHECK( m_metSystTool.setProperty("ConfigSoftCaloFile", "") );
2044 ATH_CHECK( m_metSystTool.setProperty("ConfigSoftTrkFile", "TrackSoftTerms-pflow_Dec24.config") );
2045 }
2046
2047 if (m_caloMETsyst) {
2048 ATH_MSG_WARNING( "CST is no longer recommended by Jet/MET group");
2049 ATH_CHECK( m_metSystTool.setProperty("ConfigSoftTrkFile", "") );
2050 }
2051
2052 if (m_trkJetsyst) {
2053 ATH_CHECK( m_metSystTool.setProperty("ConfigJetTrkFile", "JetTrackSyst.config") );
2054 }
2055
2056 ATH_CHECK( m_metSystTool.setProperty("OutputLevel", this->msg().level()) );
2057 ATH_CHECK( m_metSystTool.retrieve());
2058 } else ATH_CHECK( m_metSystTool.retrieve());
2059
2060
2061 if (!m_metSignif.isUserConfigured()) {
2062 // See https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MetSignificance
2063 m_metSignif.setTypeAndName("met::METSignificance/metSignificance_"+jetname);
2064#ifndef XAOD_STANDALONE // Athena and AthAnalysis; need to take into account that MuonCalibTool is private tool
2065 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "SoftTermParam", m_softTermParam));
2066 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "TreatPUJets", m_treatPUJets));
2067 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "DoPhiReso", m_doPhiReso));
2068 if(jetname != "AntiKt4EMPFlow")
2069 ATH_MSG_WARNING("METSignificance recommendations only exist for AntiKt4EMPFlow jets, falling back to this.");
2070 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "JetCollection", "AntiKt4EMPFlow"));
2071 // This is the only recommended set of jet resolutions for use with R22+ MET Significance until "Consolidated" recommendations are available
2072 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "JetCalibConfig", "JES_data2017_2016_2015_Recommendation_PFlow_Aug2018_rel21.config") );
2073 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "JetCalibSequence", "JetArea_Residual_EtaJES_GSC_Smear") );
2074 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "JetCalibArea", "00-04-81") );
2075 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "EgammaESModel", m_isRun3 ? "es2024_Run3_v0" : "es2023_R22_Run2_v1") );
2076 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "EgammaDecorrelationModel", "1NP_v1") );
2077 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "EgammaUseFastsim", isAtlfast()) );
2078 // setup a dedicated new muon calib tool for passing down to METSignificance
2079 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "MuonCalibTool", "CP::MuonCalibTool/calibTool"));
2080 if (m_isRun3)
2081 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "calibTool.IsRun3Geo", true));
2082 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "calibTool.calibMode", m_muCalibrationMode));
2083 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "calibTool.OutputLevel",this->msg().level()));
2084 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "calibTool.release", "Recs2025_12_11_Run2Run3"));
2085 int IdBaselineInt = m_muIdBaseline;
2086 if (IdBaselineInt == 4)
2087 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "calibTool.do2StationsHighPt", true));
2088 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "calibTool.doExtraSmearing", m_muHighPtExtraSmear));
2089 ATH_CHECK( AAH::setProperty(m_metSignif.getHandle(), "OutputLevel", this->msg().level()));
2090#else // AnalysisBase; can just pass the jet/egamma/muon calib tools configured above
2091 ATH_CHECK( m_metSignif.setProperty("SoftTermParam", m_softTermParam) );
2092 ATH_CHECK( m_metSignif.setProperty("TreatPUJets", m_treatPUJets) );
2093 ATH_CHECK( m_metSignif.setProperty("DoPhiReso", m_doPhiReso) );
2094 if(jetname != "AntiKt4EMPFlow")
2095 ATH_MSG_WARNING("METSignificance recommendations only exist for AntiKt4EMPFlow jets, falling back to this.");
2096 ATH_CHECK( m_metSignif.setProperty( "JetCollection", "AntiKt4EMPFlow"));
2097 // This is the only recommended set of jet resolutions for use with R22+ MET Significance until "Consolidated" recommendations are available
2098 ATH_CHECK( m_metSignif.setProperty( "JetCalibConfig", "JES_data2017_2016_2015_Recommendation_PFlow_Aug2018_rel21.config") );
2099 ATH_CHECK( m_metSignif.setProperty( "JetCalibSequence", "JetArea_Residual_EtaJES_GSC_Smear") );
2100 ATH_CHECK( m_metSignif.setProperty( "JetCalibArea", "00-04-81") );
2101 ATH_CHECK( m_metSignif.setProperty("egammaCalibTool", m_egammaCalibTool.getHandle()) );
2102 // just pass the muon calib tool
2103 ATH_CHECK( m_metSignif.setProperty("MuonCalibTool",m_muonCalibTool.getHandle()));
2104 ATH_CHECK( m_metSignif.setProperty("OutputLevel", this->msg().level()) );
2105#endif
2106 ATH_CHECK( m_metSignif.retrieve() );
2107 } else ATH_CHECK( m_metSignif.retrieve() );
2108 }
2109
2110
2112// Initialise trigger tools
2113
2114 if (!m_trigDecTool.isUserConfigured()) {
2115
2116 // The decision tool
2117 m_trigDecTool.setTypeAndName("Trig::TrigDecisionTool/TrigDecisionTool");
2118 ATH_CHECK( m_trigDecTool.setProperty("TrigDecisionKey", "xTrigDecision") );
2119 if (m_isRun3) {
2120 ATH_CHECK( m_trigDecTool.setProperty("NavigationFormat", "TrigComposite") );
2121 ATH_CHECK( m_trigDecTool.setProperty("HLTSummary", "HLTNav_Summary_DAODSlimmed") );
2122 }
2123 ATH_CHECK( m_trigDecTool.setProperty("OutputLevel", this->msg().level()) );
2124
2125#ifndef XAOD_STANDALONE // Athena and AthAnalysis
2126 // Clear the default tool handle to cause a fallback on the config service
2127 ATH_CHECK( m_trigDecTool.setProperty("ConfigTool", ""));
2128#else // AnalysisBase
2129 m_trigConfTool.setTypeAndName("TrigConf::xAODConfigTool/xAODConfigTool");
2130 ATH_CHECK(m_trigConfTool.retrieve() );
2131 ATH_CHECK( m_trigDecTool.setProperty("ConfigTool", m_trigConfTool.getHandle()) );
2132#endif
2133
2134 ATH_CHECK( m_trigDecTool.retrieve() );
2135
2136 } else ATH_CHECK( m_trigDecTool.retrieve() );
2137
2138 if (m_isRun3) {
2139 if (!m_trigDRScoringTool.isUserConfigured()) {
2140 m_trigDRScoringTool.setTypeAndName("Trig::DRScoringTool/TrigDRScoringTool");
2141 ATH_CHECK( m_trigDRScoringTool.setProperty("OutputLevel", this->msg().level()) );
2142 ATH_CHECK( m_trigDRScoringTool.retrieve() );
2143 } else ATH_CHECK( m_trigDRScoringTool.retrieve() );
2144 }
2145
2146 if (!m_trigMatchingTool.isUserConfigured()) {
2148 m_trigMatchingTool.setTypeAndName("Trig::MatchFromCompositeTool/TrigMatchFromCompositeTool");
2149 ATH_CHECK( m_trigMatchingTool.setProperty("InputPrefix", m_trigMatchingPrefix) );
2150 ATH_CHECK( m_trigMatchingTool.setProperty("RemapBrokenLinks", true) );
2151 }
2152 else {
2153 if (m_isRun3){
2154 m_trigMatchingTool.setTypeAndName("Trig::R3MatchingTool/TrigR3MatchingTool");
2155 ATH_CHECK( m_trigMatchingTool.setProperty("ScoringTool", m_trigDRScoringTool.getHandle()) );
2156 ATH_CHECK( m_trigMatchingTool.setProperty("TrigDecisionTool", m_trigDecTool.getHandle()) );
2157 }
2158 else {
2159 m_trigMatchingTool.setTypeAndName("Trig::MatchingTool/TrigMatchingTool");
2160 ATH_CHECK( m_trigMatchingTool.setProperty("TrigDecisionTool", m_trigDecTool.getHandle()) );
2161 }
2162 }
2163 ATH_CHECK( m_trigMatchingTool.setProperty("OutputLevel", this->msg().level()) );
2164 ATH_CHECK( m_trigMatchingTool.retrieve() );
2165 } else ATH_CHECK( m_trigMatchingTool.retrieve() );
2166
2168// Initialise trigGlobalEfficiencyCorrection tool
2169
2170 if (!m_trigGlobalEffCorrTool_diLep.isUserConfigured() && !isData()) {
2171
2172 std::string no2e17("");
2173 if (m_trig2017combination_diLep.find("||2e17_lhvloose_nod0_L12EM15VHI") != std::string::npos) {
2174 auto pos_2e17 = m_trig2017combination_diLep.find("||2e17_lhvloose_nod0_L12EM15VHI");
2175 no2e17 = m_trig2017combination_diLep.substr(0, pos_2e17) + m_trig2017combination_diLep.substr(pos_2e17+31, m_trig2017combination_diLep.size());
2176 } else if (m_trig2017combination_diLep.find("2e17_lhvloose_nod0_L12EM15VHI||") != std::string::npos) {
2177 auto pos_2e17 = m_trig2017combination_diLep.find("2e17_lhvloose_nod0_L12EM15VHI||");
2178 no2e17 = m_trig2017combination_diLep.substr(0, pos_2e17) + m_trig2017combination_diLep.substr(pos_2e17+31, m_trig2017combination_diLep.size());
2179 } else {
2181 }
2182 ATH_MSG_DEBUG( "TrigGlobalEfficiencyCorrectionTool/TrigGlobal_diLep: no2e17 trigger string: " << no2e17 );
2183
2184 std::map<std::string,std::string> triggers_diLep;
2185 triggers_diLep["2015"] = m_trig2015combination_diLep;
2186 triggers_diLep["2016"] = m_trig2016combination_diLep;
2187 triggers_diLep["324320-326695"] = m_trig2017combination_diLep; // 2017 before accidental prescale of L12EM15VHI
2188 triggers_diLep["326834-328393"] = no2e17; // 2017 during accidental prescale
2189 triggers_diLep["329385-340453"] = m_trig2017combination_diLep; // 2017 after accidental prescale
2190 triggers_diLep["2018"] = m_trig2018combination_diLep;
2191
2192 m_trigGlobalEffCorrTool_diLep.setTypeAndName("TrigGlobalEfficiencyCorrectionTool/TrigGlobal_diLep");
2193 ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("ElectronEfficiencyTools", m_elecTrigEffTools) );
2194 ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("ElectronScaleFactorTools", m_elecTrigSFTools) );
2195 ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("MuonTools", m_muonTrigSFTools) );
2196 ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("TriggerCombination", triggers_diLep) );
2197 ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("TriggerMatchingTool", m_trigMatchingTool.getHandle()) );
2198 ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("ListOfLegsPerTool", m_legsPerTool) );
2199 ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("NumberOfToys", m_trigNToys_diLep) );
2200 ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("OutputLevel", this->msg().level()) );
2202 } else if (m_trigGlobalEffCorrTool_diLep.isUserConfigured()) ATH_CHECK( m_trigGlobalEffCorrTool_diLep.retrieve() );
2203
2204
2205 if (!m_trigGlobalEffCorrTool_multiLep.isUserConfigured() && !isData()) {
2206
2207 std::string no2e17("");
2208 if (m_trig2017combination_multiLep.find("||2e17_lhvloose_nod0_L12EM15VHI") != std::string::npos) {
2209 auto pos_2e17 = m_trig2017combination_multiLep.find("||2e17_lhvloose_nod0_L12EM15VHI");
2210 no2e17 = m_trig2017combination_multiLep.substr(0, pos_2e17) + m_trig2017combination_multiLep.substr(pos_2e17+31, m_trig2017combination_multiLep.size());
2211 } else if (m_trig2017combination_multiLep.find("2e17_lhvloose_nod0_L12EM15VHI||") != std::string::npos) {
2212 auto pos_2e17 = m_trig2017combination_multiLep.find("2e17_lhvloose_nod0_L12EM15VHI||");
2213 no2e17 = m_trig2017combination_multiLep.substr(0, pos_2e17) + m_trig2017combination_multiLep.substr(pos_2e17+31, m_trig2017combination_multiLep.size());
2214 } else {
2216 }
2217 ATH_MSG_DEBUG( "TrigGlobalEfficiencyCorrectionTool/TrigGlobal_multiLep: no2e17 trigger string: " << no2e17 );
2218
2219 std::map<std::string,std::string> triggers_multiLep;
2220 triggers_multiLep["2015"] = m_trig2015combination_multiLep;
2221 triggers_multiLep["2016"] = m_trig2016combination_multiLep;
2222 triggers_multiLep["324320-326695"] = m_trig2017combination_multiLep; // 2017 before accidental prescale of L12EM15VHI
2223 triggers_multiLep["326834-328393"] = no2e17; // 2017 during accidental prescale
2224 triggers_multiLep["329385-340453"] = m_trig2017combination_multiLep; // 2017 after accidental prescale
2225 triggers_multiLep["2018"] = m_trig2018combination_multiLep;
2226
2227 m_trigGlobalEffCorrTool_multiLep.setTypeAndName("TrigGlobalEfficiencyCorrectionTool/TrigGlobal_multiLep");
2228 ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("ElectronEfficiencyTools", m_elecTrigEffTools) );
2229 ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("ElectronScaleFactorTools", m_elecTrigSFTools) );
2231 ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("TriggerCombination", triggers_multiLep) );
2232 ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("TriggerMatchingTool", m_trigMatchingTool.getHandle()) );
2233 ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("ListOfLegsPerTool", m_legsPerTool) );
2234 ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("NumberOfToys", m_trigNToys_multiLep) );
2235 ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("OutputLevel", this->msg().level()) );
2237 } else if (m_trigGlobalEffCorrTool_multiLep.isUserConfigured()) ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.retrieve() );
2238
2239
2240 if (!m_trigGlobalEffCorrTool_diPhoton.isUserConfigured() && !isData()) {
2241 m_trigGlobalEffCorrTool_diPhoton.setTypeAndName("TrigGlobalEfficiencyCorrectionTool/TrigGlobal_diPhoton");
2242 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("PhotonEfficiencyTools", m_photonTrigEffTools) );
2243 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("PhotonScaleFactorTools", m_photonTrigSFTools) );
2244 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("TriggerCombination2015", m_trig2015combination_diPhoton) );
2245 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("TriggerCombination2016", m_trig2016combination_diPhoton) );
2246 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("TriggerCombination2017", m_trig2017combination_diPhoton) );
2247 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("TriggerCombination2018", m_trig2018combination_diPhoton) );
2248 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("ListOfLegsPerTool", m_legsPerTool_ph) );
2249 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("NumberOfToys", m_trigNToys_diPhoton) );
2250 ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("OutputLevel", this->msg().level()) );
2252 } else if (m_trigGlobalEffCorrTool_diPhoton.isUserConfigured()) ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.retrieve() );
2253
2254
2255 if (m_slices["ele"] || m_slices["pho"] || m_slices["mu"]) {
2256 // /////////////////////////////////////////////////////////////////////////////////////////
2257 // Initialise Isolation Correction Tool
2258
2259 if ( !m_isoCorrTool.isUserConfigured() ) {
2260 m_isoCorrTool.setTypeAndName("CP::IsolationCorrectionTool/IsoCorrTool");
2261 ATH_CHECK( m_isoCorrTool.setProperty( "ToolVer", "REL22") );
2262 ATH_CHECK( m_isoCorrTool.setProperty( "IsMC", !isData()) );
2263 ATH_CHECK( m_isoCorrTool.setProperty( "AFII_corr", isAtlfast()) );
2264 ATH_CHECK( m_isoCorrTool.setProperty( "Apply_SC_leakcorr", false) );
2265 ATH_CHECK( m_isoCorrTool.setProperty( "FixTimingIssueInCore", true) ); // Similar to https://gitlab.cern.ch/atlas/athena/-/merge_requests/83939
2266 ATH_CHECK( m_isoCorrTool.setProperty( "CorrFile", "IsolationCorrections/v6/isolation_ptcorrections_rel22_mc20.root") );
2267 ATH_CHECK( m_isoCorrTool.setProperty( "OutputLevel", this->msg().level()) );
2268 ATH_CHECK( m_isoCorrTool.retrieve() );
2269 } else ATH_CHECK( m_isoCorrTool.retrieve() );
2270
2271
2272 // /////////////////////////////////////////////////////////////////////////////////////////
2273 // Initialise Isolation Tool
2274 if (!m_isoTool.isUserConfigured()) {
2275 m_isoTool.setTypeAndName("CP::IsolationSelectionTool/IsoTool");
2276 ATH_CHECK( m_isoTool.setProperty("ElectronWP", m_eleIso_WP.empty() ? "Loose_VarRad" : m_eleIso_WP) );
2277 ATH_CHECK( m_isoTool.setProperty("MuonWP", m_muIso_WP.empty() ? "Loose_VarRad" : m_muIso_WP) );
2278 ATH_CHECK( m_isoTool.setProperty("PhotonWP", m_photonIso_WP.empty() ? "FixedCutTight" : m_photonIso_WP ) );
2279 ATH_CHECK( m_isoTool.setProperty("OutputLevel", this->msg().level()) );
2280 ATH_CHECK( m_isoTool.retrieve() );
2281 } else ATH_CHECK( m_isoTool.retrieve() );
2282
2283 //disable if (!m_isoToolLowPtPLV.isUserConfigured()) {
2284 //disable m_isoToolLowPtPLV.setTypeAndName("CP::IsolationLowPtPLVTool/IsoToolLowPtPLV");
2285 //disable ATH_CHECK( m_isoToolLowPtPLV.setProperty("OutputLevel", this->msg().level()) );
2286 //disable ATH_CHECK( m_isoToolLowPtPLV.retrieve() );
2287 //disable } else ATH_CHECK( m_isoToolLowPtPLV.retrieve() );
2288
2289
2290 if (!m_isoBaselineTool.isUserConfigured()) {
2291 m_isoBaselineTool.setTypeAndName("CP::IsolationSelectionTool/IsoBaselineTool");
2292 ATH_CHECK( m_isoBaselineTool.setProperty("ElectronWP", m_eleBaselineIso_WP.empty() ? "Loose_VarRad" : m_eleBaselineIso_WP ) );
2293 ATH_CHECK( m_isoBaselineTool.setProperty("MuonWP", m_muBaselineIso_WP.empty() ? "Loose_VarRad" : m_muBaselineIso_WP ) );
2294 ATH_CHECK( m_isoBaselineTool.setProperty("PhotonWP", m_photonBaselineIso_WP.empty() ? "FixedCutTight" : m_photonBaselineIso_WP ) );
2295 ATH_CHECK( m_isoBaselineTool.setProperty("OutputLevel", this->msg().level()) );
2296 ATH_CHECK( m_isoBaselineTool.retrieve() );
2297 } else ATH_CHECK( m_isoBaselineTool.retrieve() );
2298
2299
2300 if (!m_isoHighPtTool.isUserConfigured()) {
2301 m_isoHighPtTool.setTypeAndName("CP::IsolationSelectionTool/IsoHighPtTool");
2302 ATH_CHECK( m_isoHighPtTool.setProperty("ElectronWP", m_eleIsoHighPt_WP.empty() ? "Loose_VarRad" : m_eleIsoHighPt_WP) );
2303 ATH_CHECK( m_isoHighPtTool.setProperty("MuonWP", m_muIsoHighPt_WP.empty() ? "Loose_VarRad" : m_muIsoHighPt_WP ) );
2304 ATH_CHECK( m_isoHighPtTool.setProperty("PhotonWP", m_photonIso_WP.empty() ? "FixedCutTight" : m_photonIso_WP ) );
2305 ATH_CHECK( m_isoHighPtTool.setProperty("OutputLevel", this->msg().level()) );
2306 ATH_CHECK( m_isoHighPtTool.retrieve() );
2307 } else ATH_CHECK( m_isoHighPtTool.retrieve() );
2308
2309
2310 // /////////////////////////////////////////////////////////////////////////////////////////
2311 // Initialise IsolationCloseByCorrectionTool Tool
2312 if (!m_isoCloseByTool.isUserConfigured()) {
2313 m_isoCloseByTool.setTypeAndName("CP::IsolationCloseByCorrectionTool/IsoCloseByTool");
2314 // Actually we could debate about what is the proper tool to choose if the users have different baseline & signal islation WP's
2315 ATH_CHECK( m_isoCloseByTool.setProperty("IsolationSelectionTool", m_useSigLepForIsoCloseByOR ? m_isoTool : m_isoBaselineTool));
2316 ATH_CHECK( m_isoCloseByTool.setProperty("PassoverlapDecorator", m_IsoCloseByORpassLabel) );
2317 ATH_CHECK( m_isoCloseByTool.setProperty("SelectionDecorator", m_useSigLepForIsoCloseByOR ? "signal" : "baseline") );
2318 // Make this propery configurable as well?
2319 ATH_CHECK( m_isoCloseByTool.setProperty("BackupPrefix", "ORIG") );
2320 // The isolation selection decorator is updated as well by the tool
2321 ATH_CHECK( m_isoCloseByTool.setProperty("IsolationSelectionDecorator", "isol") );
2322
2323 ATH_CHECK( m_isoCloseByTool.setProperty("OutputLevel", this->msg().level()) );
2324#ifndef XAOD_ANALYSIS
2325 ATH_CHECK( m_isoCloseByTool.setProperty("ParticleCaloExtensionTool", "") );
2326#endif
2327 ATH_CHECK( m_isoCloseByTool.retrieve() );
2328 } else ATH_CHECK( m_isoCloseByTool.retrieve() );
2329 }
2330
2331
2332// /////////////////////////////////////////////////////////////////////////////////////////
2333// Initialise Overlap Removal Tool
2334 if ( m_orToolbox.masterTool.empty() ){
2335
2336 // set up the master tool
2337 std::string suffix = "";
2338 if (m_orDoTau) suffix += "Tau";
2339 if (m_orDoPhoton) suffix += "Gamma";
2340 if (m_orDoBjet) suffix += "Bjet";
2341 std::string toolName = "ORTool" + suffix;
2342 ATH_MSG_INFO("SUSYTools: Autoconfiguring " << toolName);
2343
2344 std::string bJetLabel = "";
2345 //overwrite lepton flags if the global is false (yes?)
2346 if (!m_orDoBjet || !m_useBtagging) {
2347 m_orDoElBjet = false;
2348 m_orDoMuBjet = false;
2349 m_orDoTauBjet = false;
2350 }
2352 bJetLabel = "bjet_loose";
2353 }
2354
2355 // Set the generic flags
2356 ORUtils::ORFlags orFlags(toolName, m_orInputLabel, "passOR");
2357 orFlags.bJetLabel = bJetLabel;
2359 orFlags.outputPassValue = true;
2361 if (m_orDoElEl) {
2362 orFlags.doEleEleOR = true;
2363 } else orFlags.doEleEleOR = false;
2364 orFlags.doElectrons = true;
2365 orFlags.doMuons = true;
2366 orFlags.doJets = true;
2367 orFlags.doTaus = m_orDoTau;
2368 orFlags.doPhotons = m_orDoPhoton;
2369 orFlags.doFatJets = m_orDoFatjets;
2370
2371 //set up all recommended tools
2373
2374 // We don't currently have a good way to determine here which object
2375 // definitions are disabled, so we currently just configure all overlap
2376 // tools and disable the pointer safety checks
2377 ATH_CHECK( m_orToolbox.setGlobalProperty("OutputLevel", this->msg().level()) );
2378 ATH_CHECK( m_orToolbox.masterTool.setProperty("RequireExpectedPointers", false) );
2379
2380 // Override boosted OR sliding cone options
2381 ATH_CHECK( m_orToolbox.eleJetORT.setProperty("UseSlidingDR", m_orDoBoostedElectron) );
2382 ATH_CHECK( m_orToolbox.muJetORT.setProperty("UseSlidingDR", m_orDoBoostedMuon) );
2383
2384 //add custom tau-jet OR tool
2385 if(m_orDoTau){
2386 m_orToolbox.tauJetORT.setTypeAndName("ORUtils::TauJetOverlapTool/" + orFlags.masterName + ".TauJetORT");
2387 ATH_CHECK( m_orToolbox.tauJetORT.setProperty("BJetLabel", m_orDoTauBjet?bJetLabel:"") );
2388 }
2389
2390 // override sliding cone params if sliding dR is on and the user-provided parameter values are non-negative
2392 if (m_orBoostedElectronC1 > 0) ATH_CHECK( m_orToolbox.eleJetORT.setProperty("SlidingDRC1", m_orBoostedElectronC1) );
2393 if (m_orBoostedElectronC2 > 0) ATH_CHECK( m_orToolbox.eleJetORT.setProperty("SlidingDRC2", m_orBoostedElectronC2) );
2394 if (m_orBoostedElectronMaxConeSize > 0) ATH_CHECK( m_orToolbox.eleJetORT.setProperty("SlidingDRMaxCone", m_orBoostedElectronMaxConeSize) );
2395 }
2396 if (m_orDoBoostedMuon) {
2397 if (m_orBoostedMuonC1 > 0) ATH_CHECK( m_orToolbox.muJetORT.setProperty("SlidingDRC1", m_orBoostedMuonC1) );
2398 if (m_orBoostedMuonC2 > 0) ATH_CHECK( m_orToolbox.muJetORT.setProperty("SlidingDRC2", m_orBoostedMuonC2) );
2399 if (m_orBoostedMuonMaxConeSize > 0) ATH_CHECK( m_orToolbox.muJetORT.setProperty("SlidingDRMaxCone", m_orBoostedMuonMaxConeSize) );
2400 }
2401
2402 // and switch off lep-bjet check if not requested
2403 if (!m_orDoElBjet) {
2404 ATH_CHECK(m_orToolbox.eleJetORT.setProperty("BJetLabel", ""));
2405 }
2406 if (!m_orDoMuBjet) {
2407 ATH_CHECK(m_orToolbox.muJetORT.setProperty("BJetLabel", ""));
2408 }
2409
2410 // propagate the mu-jet ghost-association option which might be set by the user (default is true)
2411 ATH_CHECK(m_orToolbox.muJetORT.setProperty("UseGhostAssociation", m_orDoMuonJetGhostAssociation));
2412
2413 // propagate mu-jet OR settings if requested
2414 ATH_CHECK(m_orToolbox.muJetORT.setProperty("ApplyRelPt", m_orApplyRelPt) );
2415 if(m_orApplyRelPt){
2416 if (m_orMuJetPtRatio > 0) ATH_CHECK(m_orToolbox.muJetORT.setProperty("MuJetPtRatio", m_orMuJetPtRatio) );
2417 if (m_orMuJetTrkPtRatio > 0) ATH_CHECK(m_orToolbox.muJetORT.setProperty("MuJetTrkPtRatio", m_orMuJetTrkPtRatio) );
2418 }
2419 if (m_orMuJetInnerDR > 0) ATH_CHECK(m_orToolbox.muJetORT.setProperty("InnerDR", m_orMuJetInnerDR) );
2420
2421 // propagate the calo muon setting for EleMuORT
2422 ATH_CHECK(m_orToolbox.eleMuORT.setProperty("RemoveCaloMuons", m_orRemoveCaloMuons) );
2423
2424 // Use electron-muon DR matching to remove electrons within DR < 0.01 of Muons.
2425 if (m_orDoElMu){
2426 ATH_CHECK(m_orToolbox.eleMuORT.setProperty("UseDRMatching", m_orDoElMu) );
2427 }
2428
2429 // propagate the fatjets OR settings
2430 if(m_orDoFatjets){
2431 if(m_EleFatJetDR>0) ATH_CHECK(m_orToolbox.eleFatJetORT.setProperty("DR", m_EleFatJetDR));
2432 if(m_JetFatJetDR>0) ATH_CHECK(m_orToolbox.jetFatJetORT.setProperty("DR", m_JetFatJetDR));
2433 }
2434
2435 // Make sure that we deal with prorities correctly
2436 ATH_CHECK(m_orToolbox.eleJetORT.setProperty("EnableUserPriority", true));
2437 ATH_CHECK(m_orToolbox.muJetORT.setProperty("EnableUserPriority", true));
2438 if (m_orDoTau) ATH_CHECK(m_orToolbox.tauJetORT.setProperty("EnableUserPriority", true));
2439 if (m_orDoPhoton) ATH_CHECK(m_orToolbox.phoJetORT.setProperty("EnableUserPriority", true));
2440
2441 if ( m_orPhotonFavoured ) {
2442 ATH_CHECK(m_orToolbox.phoEleORT.setProperty("SwapContainerPrecedence", true));
2443 ATH_CHECK(m_orToolbox.phoMuORT.setProperty("SwapContainerPrecedence", true));
2444 }
2445
2446 if (!m_orDoEleJet){
2447 // Disable the electron removal part of e-j overlap removal
2448 ATH_CHECK( m_orToolbox.eleJetORT.setProperty("OuterDR",-1.) );
2449 ATH_CHECK( m_orToolbox.eleJetORT.setProperty("SlidingDRMaxCone",-1.) );
2450 }
2451 if (!m_orDoMuonJet){
2452 // Disable the muon removal part of m-j overlap removal
2453 ATH_CHECK( m_orToolbox.muJetORT.setProperty("OuterDR",-1.) );
2454 ATH_CHECK( m_orToolbox.muJetORT.setProperty("SlidingDRMaxCone",-1.) );
2455 }
2456
2457 ATH_CHECK( m_orToolbox.initialize() );
2458
2459 }
2460 // Done with the OR toolbox setup!
2461
2462// /////////////////////////////////////////////////////////////////////////////////////////
2463// Initialise PMG Tools
2464 if (!m_pmgSHnjetWeighter.isUserConfigured() && !isData()) {
2465 m_pmgSHnjetWeighter.setTypeAndName("PMGTools::PMGSherpa22VJetsWeightTool/PMGSHVjetReweighter");
2466 ATH_CHECK( m_pmgSHnjetWeighter.setProperty( "TruthJetContainer", "AntiKt4TruthJets"));
2467 ATH_CHECK( m_pmgSHnjetWeighter.setProperty("OutputLevel", this->msg().level()) );
2468 ATH_CHECK( m_pmgSHnjetWeighter.retrieve());
2469 } else if (m_pmgSHnjetWeighter.isUserConfigured()) ATH_CHECK( m_pmgSHnjetWeighter.retrieve());
2470
2471
2472 if (!m_pmgSHnjetWeighterWZ.isUserConfigured() && !isData()) {
2473 m_pmgSHnjetWeighterWZ.setTypeAndName("PMGTools::PMGSherpa22VJetsWeightTool/PMGSHVjetReweighterWZ");
2474 ATH_CHECK( m_pmgSHnjetWeighterWZ.setProperty( "TruthJetContainer", "AntiKt4TruthWZJets"));
2475 ATH_CHECK( m_pmgSHnjetWeighterWZ.setProperty("OutputLevel", this->msg().level()) );
2476 ATH_CHECK( m_pmgSHnjetWeighterWZ.retrieve() );
2477 } else if (m_pmgSHnjetWeighterWZ.isUserConfigured()) ATH_CHECK( m_pmgSHnjetWeighterWZ.retrieve() );
2478
2479
2480 // prevent these initialiation snippets from being run again
2481 m_subtool_init = true;
2482
2483 ATH_MSG_INFO("Done initialising SUSYTools");
2484
2485 return StatusCode::SUCCESS;
2486}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Defines helper functions for initializing the OR tools in C++.
const std::string bJetLabel
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
#define CONFIG_EG_EFF_TOOL(TOOLHANDLE, TOOLNAME, CORRFILE)
#define CONFIG_EG_EFF_TOOL_KEY(TOOLHANDLE, TOOLNAME, KEYNAME, KEY, MAP)
static StatusCode setProperty(const GaudiHandleBase &toolHandle, const std::string &property, const int &value, bool override=true)
Class to wrap a set of SystematicVariations.
asg::AnaToolHandle< TauAnalysisTools::ITauSelectionTool > m_tauSelToolBaseline
std::string m_defaultTrackJets
std::vector< std::string > m_ph_id_support
bool m_metRemoveOverlappingCaloTaggedMuons
std::string m_BtagWP_trkJet
std::string m_fatJetUncertaintiesMCType
bool isAtlfast() const override final
asg::AnaToolHandle< IWeightTool > m_pmgSHnjetWeighter
std::string m_JetTruthLabelName
asg::AnaToolHandle< CP::IElectronLRTOverlapRemovalTool > m_elecLRTORTool
std::vector< std::string > m_mu_iso_support
std::vector< std::string > m_el_id_support
asg::AnaToolHandle< Trig::TrigDecisionTool > m_trigDecTool
asg::AnaToolHandle< CP::IMuonSelectionTool > m_muonSelectionTool
asg::AnaToolHandle< IWeightTool > m_pmgSHnjetWeighterWZ
std::string m_trig2017combination_diPhoton
std::vector< asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > > m_elecEfficiencySFTool_trig_mixLep
std::string m_trig2016combination_multiLep
std::string m_photonIdBaseline
asg::AnaToolHandle< IJetCalibrationTool > m_jetFatCalibTool
std::string m_trig2016combination_diPhoton
asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > m_trigGlobalEffCorrTool_multiLep
asg::AnaToolHandle< CP::IIsolationSelectionTool > m_isoBaselineTool
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_isoHighPt
asg::AnaToolHandle< CP::IMuonEfficiencyScaleFactors > m_muonEfficiencySFTool
std::string m_eleEffMapFilePathRun2
asg::AnaToolHandle< CP::IPileupReweightingTool > m_prwTool
std::string m_EG_corrFNList
asg::AnaToolHandle< TauAnalysisTools::ITauSelectionTool > m_tauSelTool
asg::AnaToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesPDSmearTool
asg::AnaToolHandle< IAsgElectronLikelihoodTool > m_elecSelLikelihood
std::vector< asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > > m_elecEfficiencySFTool_trigEff_mixLep
double m_orBoostedElectronMaxConeSize
ToolHandleArray< CP::IMuonTriggerScaleFactors > m_muonTrigSFTools
std::vector< std::string > m_prwLcalcFiles
std::string m_metsysConfigPrefix
asg::AnaToolHandle< TauAnalysisTools::ITauEfficiencyCorrectionsTool > m_tauEffTool
std::string m_trigMatchingPrefix
Use composite trigger matching tool if matching was done upstream.
asg::AnaToolHandle< CP::IIsolationSelectionTool > m_isoHighPtTool
std::map< std::string, bool > m_slices
asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > m_trigGlobalEffCorrTool_diPhoton
asg::AnaToolHandle< IAsgElectronLikelihoodTool > m_elecSelLikelihoodBaseline
asg::AnaToolHandle< IAsgPhotonIsEMSelector > m_photonSelIsEM
bool isData() const override final
std::map< std::string, std::string > m_legsPerTool_ph
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_id
asg::AnaToolHandle< CP::IMuonEfficiencyScaleFactors > m_muonTTVAEfficiencySFTool
asg::AnaToolHandle< ICPJetCorrectionTool > m_fatjetFFSmearingTool
std::string m_eleEffMapFilePath
std::string m_WZTaggerCalibArea
std::string m_EigenvectorReductionB
asg::AnaToolHandle< IMETSignificance > m_metSignif
asg::AnaToolHandle< CP::IIsolationSelectionTool > m_isoTool
asg::AnaToolHandle< CP::IJvtEfficiencyTool > m_jetfJvtEfficiencyTool
std::string m_metJetSelection
std::vector< std::string > m_el_iso_support
std::string m_trig2017combination_multiLep
std::string m_jetUncertaintiesConfig
Prefix for trigger matchiing container name.
asg::AnaToolHandle< Trig::IMatchingTool > m_trigMatchingTool
std::string m_photonBaselineIso_WP
std::string m_BtagSystStrategy
ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > m_elecTrigEffTools
std::map< std::string, std::string > m_tau_trig_support
std::vector< asg::AnaToolHandle< IAsgPhotonEfficiencyCorrectionTool > > m_photonEfficiencySFTool_trigSF_AsymDiphoton
ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > m_elecTrigSFTools
std::string EG_WP(const std::string &wp) const
std::string m_defaultTruthJets
asg::AnaToolHandle< JetPileupLabelingTool > m_jetPileupLabelingTool
asg::AnaToolHandle< CP::IMuonLRTOverlapRemovalTool > m_muonLRTORTool
asg::AnaToolHandle< JSSWTopTaggerDNN > m_TopTaggerTool
asg::AnaToolHandle< CP::IMuonTriggerScaleFactors > m_muonTriggerSFTool
std::string m_jetUncertaintiesCalibArea
std::string m_tauEffToolRecommendationTag
std::string m_muBaselineIso_WP
asg::AnaToolHandle< IAsgDeadHVCellRemovalTool > m_deadHVTool
std::string m_TopTaggerCalibArea
std::string m_trig2015combination_diLep
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_trigEff_singleLep
std::string m_photonTriggerName
asg::AnaToolHandle< IAsgSelectionTool > m_jetNNJvtSelectionTool
asg::AnaToolHandle< SmoothedWZTagger > m_ZTaggerTool
asg::AnaToolHandle< JetPileupTag::JetVertexNNTagger > m_jetNNJvtMomentTool
std::string m_fJvtConfigRun3
std::string m_eleIdBaseline
std::map< std::string, std::string > m_el_iso_fallback
asg::AnaToolHandle< CP::IMuonEfficiencyScaleFactors > m_muonEfficiencyBMHighPtSFTool
std::string m_muIsoHighPt_WP
asg::AnaToolHandle< CP::IMuonCalibrationAndSmearingTool > m_muonCalibTool
std::string m_fJvtConfigRun2
asg::AnaToolHandle< JetVertexTaggerTool > m_jetJvtMomentTool
asg::AnaToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesTool
std::string m_tauSmearingToolRecommendationTag
asg::AnaToolHandle< IEGammaAmbiguityTool > m_egammaAmbiguityTool
asg::AnaToolHandle< TrigConf::ITrigConfigTool > m_trigConfTool
asg::AnaToolHandle< CP::IIsolationCloseByCorrectionTool > m_isoCloseByTool
std::map< int, int > m_tau_id_fallback
std::string m_tauIdBaseline
std::string m_eleIsoHighPt_WP
bool check_isOption(const std::string &wp, const std::vector< std::string > &list) const
asg::AnaToolHandle< IMETMaker > m_metMaker
asg::AnaToolHandle< Trig::IMatchScoringTool > m_trigDRScoringTool
asg::AnaToolHandle< IAsgPhotonEfficiencyCorrectionTool > m_photonIsolationSFTool
bool m_orDoTau
Overlap removal options.
std::string m_trig2016combination_diLep
std::string m_JvtConfigRun2
asg::AnaToolHandle< ICPJetUncertaintiesTool > m_fatjetUncertaintiesTool
asg::AnaToolHandle< CP::IIsolationCorrectionTool > m_isoCorrTool
ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > m_photonTrigSFTools
std::string m_eleConfigBaseline
asg::AnaToolHandle< IMETSystematicsTool > m_metSystTool
asg::AnaToolHandle< CP::IMuonSelectionTool > m_muonSelectionHighPtTool
std::string m_EigenvectorReductionLight
asg::AnaToolHandle< IAsgSelectionTool > m_jetfJvtSelectionTool
std::string m_trig2018combination_diPhoton
asg::AnaToolHandle< IJetSelector > m_jetCleaningTool
asg::AnaToolHandle< IBTaggingSelectionTool > m_btagSelTool_trkJet
asg::AnaToolHandle< InDet::IInclusiveTrackFilterTool > m_LRTuncTool
std::vector< std::string > getElSFkeys(const std::string &mapFile) const
asg::AnaToolHandle< CP::IJvtEfficiencyTool > m_jetNNJvtEfficiencyTool
asg::AnaToolHandle< CP::IMuonEfficiencyScaleFactors > m_muonHighPtIsolationSFTool
asg::AnaToolHandle< TauAnalysisTools::ITauSmearingTool > m_tauSmearingTool
std::string m_trig2018combination_diLep
std::string m_trig2017combination_diLep
asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > m_trigGlobalEffCorrTool_diLep
const std::vector< std::string > split(const std::string &s, const std::string &delim) const
asg::AnaToolHandle< IBTaggingEfficiencyTool > m_btagEffTool_trkJet
std::vector< std::string > m_prwConfFiles
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_reco
Combined muon collection.
std::string m_jesConfigAFII
std::vector< CP::SystematicSet > m_fatjetFFSmearingSyst
asg::AnaToolHandle< IBTaggingEfficiencyTool > m_btagEffTool
StatusCode SUSYToolsInit()
SG::ReadDecorHandleKey< xAOD::JetContainer > m_label_truthKey
asg::AnaToolHandle< TauAnalysisTools::ITauTruthMatchingTool > m_tauTruthMatch
std::map< std::string, std::string > m_legsPerTool
asg::AnaToolHandle< IBTaggingSelectionTool > m_btagSelTool_OR
std::string m_muTriggerSFCalibRelease
std::vector< asg::AnaToolHandle< IAsgPhotonEfficiencyCorrectionTool > > m_photonEfficiencySFTool_trigEff_AsymDiphoton
std::map< std::string, std::string > m_mu_iso_fallback
std::string m_jetUncertaintiesAnalysisFile
asg::AnaToolHandle< IAsgPhotonIsEMSelector > m_photonSelIsEMBaseline
std::string m_jetUncertaintiesMCType
std::vector< asg::AnaToolHandle< TauAnalysisTools::ITauEfficiencyCorrectionsTool > > m_tauTrigEffTool
asg::AnaToolHandle< IBTaggingSelectionTool > m_btagSelTool
ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > m_photonTrigEffTools
asg::AnaToolHandle< IAsgPhotonEfficiencyCorrectionTool > m_photonTriggerSFTool
std::string m_EigenvectorReductionC
std::string m_fatJetUncConfig
ORUtils::ToolBox m_orToolbox
std::string m_tauInputFileBaseline
asg::AnaToolHandle< CP::IMuonSelectionTool > m_muonSelectionToolBaseline
std::string m_muTriggerSFCalibFilename
asg::AnaToolHandle< CP::IEgammaCalibrationAndSmearingTool > m_egammaCalibTool
Combined electron collection.
std::string m_IsoCloseByORpassLabel
std::string m_trig2015combination_multiLep
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_trig_singleLep
asg::AnaToolHandle< JetTruthLabelingTool > m_jetTruthLabelingTool
asg::AnaToolHandle< ICPJetUncertaintiesTool > m_fatjetUncertaintiesPDSmearTool
std::string m_bTaggingCalibrationFilePath
asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > m_elecEfficiencySFTool_iso
asg::AnaToolHandle< SmoothedWZTagger > m_WTaggerTool
asg::AnaToolHandle< IJetCalibrationTool > m_jetCalibTool
std::string m_eleBaselineIso_WP
std::string m_fatJetUncVars
std::string m_electronTriggerSFStringSingle
std::string m_trig2015combination_diPhoton
asg::AnaToolHandle< CP::IMuonEfficiencyScaleFactors > m_muonIsolationSFTool
std::string m_BtagTagger_trkJet
std::string m_trig2018combination_multiLep
asg::AnaToolHandle< IAsgPhotonEfficiencyCorrectionTool > m_photonEfficiencySFTool
std::string m_JvtConfigRun3
std::string m_jesCalibSeqFat
StatusCode recommendedTools(const ORFlags &flags, ToolBox &toolBox)
Pre-configured standard recommended OR tools.
const std::string & typeName(Type id)
setRawEt setRawPhi int
A struct of global config options used to simplify the config helper interface.
bool outputPassValue
Output value to assign passing objects.
bool doEleEleOR
Do electron-electron overlap.
std::string bJetLabel
B-jet decoration.
bool linkOverlapObjects
Enable overlap object ElementLinks.
bool boostedLeptons
Activate boosted-lepton recommendations (sliding dR cones).
std::string masterName
Master tool name.