16{
17
18TauSmearingTool::TauSmearingTool( const std::string& sName )
19 :
asg::AsgMetadataTool( sName )
20{}
21
22TauSmearingTool::~TauSmearingTool()
23{}
24
26{
28
29 if (m_bSkipTruthMatchCheck)
30 ATH_MSG_WARNING(
"Truth match check will be skipped. This is ONLY FOR TESTING PURPOSE!");
31
32 if (m_sInputFilePath.empty()) {
33 std::string sDirectory =
"TauAnalysisTools/" + std::string(
sSharedFilesVersion) +
"/Smearing/";
34
35 if(m_sRecommendationTag == "2025-prerec") {
36
37 if (m_sCampaign!="mc23" && m_sCampaign!="mc20"){
38 ATH_MSG_ERROR(
"unknown campaign (mc20|mc23):" << m_sCampaign);
39 return StatusCode::FAILURE;
40 }
41
42 if(m_useGNTau){
43 if (m_sCampaign=="mc23") {
44 m_sInputFilePath = m_useFastSim ? sDirectory+"TES_TrueHadTau_GNTau_mc23_v0_incl_AF3.root" : sDirectory+"TES_TrueHadTau_GNTau_mc23_v0.root";
45 } else {
46 m_sInputFilePath = m_useFastSim ? sDirectory+"TES_TrueHadTau_GNTau_mc20_v0_incl_AF3.root" : sDirectory+"TES_TrueHadTau_GNTau_mc20_v0.root";
47 }
48 } else {
49 if (m_sCampaign=="mc23") {
50 m_sInputFilePath = m_useFastSim ? sDirectory+"TES_TrueHadTau_RNN_mc23_v3_incl_AF3.root" : sDirectory+"TES_TrueHadTau_RNN_mc23_v3.root";
51 } else {
52 m_sInputFilePath = m_useFastSim ? sDirectory+"TES_TrueHadTau_RNN_mc20_v2_incl_AF3.root" : sDirectory+"TES_TrueHadTau_RNN_mc20_v2.root";
53 }
54 }
55
56 } else {
57 ATH_MSG_ERROR(
"unknown recommendation tag " << m_sRecommendationTag);
58 return StatusCode::FAILURE;
59 }
60 }
61
62 if (m_tCommonSmearingTool.empty()){
65 ATH_CHECK(
config.setProperty(
"SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
67 ATH_CHECK(
config.setProperty(
"MVATESQualityCheck", m_bMVATESQualityCheck));
68 ATH_CHECK(
config.setProperty(
"ApplyInsituCorrection", m_bApplyInsituCorrection));
71 }
72 ATH_CHECK(m_tCommonSmearingTool.retrieve());
73
74
75
77 if (!
registry.registerSystematics(*
this)) {
79 return StatusCode::FAILURE;
80 }
81
82 return StatusCode::SUCCESS;
83}
84
85
86
88{
91 ATH_CHECK( inputMetaStore()->retrieve( fmd,
"FileMetaData" ) );
92 std::string simType("");
94
95 if(result) std::transform(simType.begin(), simType.end(), simType.begin(), ::toupper);
96
97 if( simType.find("ATLFAST3") != std::string::npos && !m_useFastSim){
98 ATH_MSG_WARNING(
"Input file is AF3 sample but you are _not_ using AF3 corrections and uncertainties, you should set \"useFastSim\" to \"true\"");
99 } else if (simType.find("FULLG4")!=std::string::npos && m_useFastSim){
100 ATH_MSG_WARNING(
"Input file is full simulation but you are using AF3 corrections and uncertainties, you should set \"useFastSim\" to \"false\"");
101 }
102 }
103
104 return StatusCode::SUCCESS;
105}
106
108{
109 return m_tCommonSmearingTool->applyCorrection(xTau);
110}
111
113{
114 return m_tCommonSmearingTool->correctedCopy(input, output);
115}
116
119{
120 return m_tCommonSmearingTool->isAffectedBySystematic( systematic );
121}
122
125{
126 return m_tCommonSmearingTool->affectingSystematics();
127}
128
131{
132 return m_tCommonSmearingTool->recommendedSystematics();
133}
134
136{
137 return m_tCommonSmearingTool->applySystematicVariation( sSystematicSet );
138}
139
140
141}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
static const char *const sSharedFilesVersion
Version of the calibration files.
Return value from object correction CP tools.
This module implements the central registry for handling systematic uncertainties with CP tools.
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
Class to wrap a set of SystematicVariations.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
::StatusCode StatusCode
StatusCode definition for legacy code.
TauJet_v3 TauJet
Definition of the current "tau version".
FileMetaData_v1 FileMetaData
Declare the latest version of the class.