ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
TrackingID
InDetTrackSystematicsTools
InDetTrackSystematicsTools
InDetTrackSystematicsTool.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
/*
3
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4
*/
5
6
#ifndef INDETTRACKSYSTEMATICSTOOLS_INDETTRACKSYSTEMATICSTOOL_H
7
#define INDETTRACKSYSTEMATICSTOOLS_INDETTRACKSYSTEMATICSTOOL_H
8
9
#include <string>
10
#include <map>
11
#include <memory>
12
13
#include "
InDetTrackSystematicsTools/InDetTrackSystematics.h
"
14
#include "
AsgTools/AsgTool.h
"
15
#include "
PATInterfaces/ISystematicsTool.h
"
16
#include "
PATInterfaces/SystematicSet.h
"
17
18
#include <TFile.h>
19
#include <TH2.h>
20
21
namespace
InDet
{
22
23
class
InDetTrackSystematicsTool
:
public
virtual
CP::ISystematicsTool
,
public
asg::AsgTool
{
24
25
ASG_TOOL_CLASS2
(
InDetTrackSystematicsTool
,
26
CP::ISystematicsTool
,
CP::IReentrantSystematicsTool
)
27
public
:
28
InDetTrackSystematicsTool
(
const
std::string& );
29
virtual
~InDetTrackSystematicsTool
() =
default
;
30
31
virtual
StatusCode
initialize
()
override
;
32
34
virtual
bool
isAffectedBySystematic
(
const
CP::SystematicVariation
& )
const override
;
36
virtual
CP::SystematicSet
affectingSystematics
()
const override
= 0;
38
virtual
CP::SystematicSet
recommendedSystematics
()
const override
;
40
virtual
StatusCode
applySystematicVariation
(
const
CP::SystematicSet
& )
override
;
41
42
43
protected
:
45
std::unique_ptr<TFile>
getFile
(
const
std::string& )
const
;
46
48
template
<
class
T> StatusCode
initObject
(std::unique_ptr<T>& obj,
const
std::string& rootFileName,
const
std::string& objName)
const
;
49
50
// a map from a general set to a set that is filtered for the ones we use
51
// note that SystematicSet caches its hashes so this is probably not as slow as it might seem
52
std::unordered_map< CP::SystematicSet, CP::SystematicSet >
m_sysFilterMap
;
53
54
const
CP::SystematicSet
*
m_activeSysts
=
nullptr
;
55
56
bool
isActive
( TrackSystematic )
const
;
57
63
const
CP::SystematicSet
*
getFilteredSysts
(
64
const
CP::SystematicSet
& syst)
const
;
65
68
bool
isActive
(TrackSystematic syst,
69
const
CP::SystematicSet
& filtered)
const
;
70
71
};
72
73
}
74
75
// must define template function in header
76
template
<
class
T>
77
StatusCode
InDet::InDetTrackSystematicsTool::initObject
(std::unique_ptr<T>& obj,
const
std::string& rootFileName,
const
std::string& objName)
const
78
{
79
if
(obj !=
nullptr
)
ATH_MSG_WARNING
( obj->GetName() <<
" is not null, yet we are now attempting to initialize from "
<< rootFileName );
80
std::unique_ptr<TFile>
F
=
getFile
(rootFileName);
81
if
(!
F
||
F
->IsZombie()) {
82
ATH_MSG_ERROR
(
"Could not open file "
<< rootFileName );
83
return
StatusCode::FAILURE;
84
}
85
T* tempObj =
nullptr
;
86
F
->GetObject(objName.data(), tempObj);
87
if
(tempObj==
nullptr
) {
88
ATH_MSG_ERROR
(
"Could not retrieve "
<< objName <<
" from file "
<< rootFileName );
89
return
StatusCode::FAILURE;
90
}
91
obj = std::unique_ptr<T>(
static_cast<
T*
>
(tempObj->Clone()));
92
obj->SetDirectory(0);
93
F
->Clear();
94
F
->Close();
95
return
StatusCode::SUCCESS;
96
}
97
98
#endif
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition
AsgToolMacros.h:77
AsgTool.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ISystematicsTool.h
InDetTrackSystematics.h
F
#define F(x, y, z)
Definition
MD5.cxx:112
SystematicSet.h
CP::IReentrantSystematicsTool
interface for all CP tools supporting systematic variations within a reentrant algorithm
Definition
IReentrantSystematicsTool.h:58
CP::ISystematicsTool
Interface for all CP tools supporting systematic variations.
Definition
ISystematicsTool.h:32
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition
SystematicSet.h:31
CP::SystematicVariation
Definition
SystematicVariation.h:47
InDet::InDetTrackSystematicsTool
Definition
InDetTrackSystematicsTool.h:23
InDet::InDetTrackSystematicsTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const CP::SystematicVariation &) const override
returns: whether the tool is affected by the systematic
Definition
InDetTrackSystematicsTool.cxx:30
InDet::InDetTrackSystematicsTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override
returns: list of recommended systematics to use with this tool
Definition
InDetTrackSystematicsTool.cxx:36
InDet::InDetTrackSystematicsTool::getFile
std::unique_ptr< TFile > getFile(const std::string &) const
open and return a file with the given name.
Definition
InDetTrackSystematicsTool.cxx:122
InDet::InDetTrackSystematicsTool::m_activeSysts
const CP::SystematicSet * m_activeSysts
Definition
InDetTrackSystematicsTool.h:54
InDet::InDetTrackSystematicsTool::initObject
StatusCode initObject(std::unique_ptr< T > &obj, const std::string &rootFileName, const std::string &objName) const
a function to initialize an object from a root file
Definition
InDetTrackSystematicsTool.h:77
InDet::InDetTrackSystematicsTool::getFilteredSysts
const CP::SystematicSet * getFilteredSysts(const CP::SystematicSet &syst) const
Look up the pre-filtered systematic set for syst.
Definition
InDetTrackSystematicsTool.cxx:100
InDet::InDetTrackSystematicsTool::isActive
bool isActive(TrackSystematic) const
Definition
InDetTrackSystematicsTool.cxx:89
InDet::InDetTrackSystematicsTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override=0
returns: list of systematics this tool can be affected by
InDet::InDetTrackSystematicsTool::~InDetTrackSystematicsTool
virtual ASG_TOOL_CLASS2(InDetTrackSystematicsTool, CP::ISystematicsTool, CP::IReentrantSystematicsTool) public ~InDetTrackSystematicsTool()=default
InDet::InDetTrackSystematicsTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
InDetTrackSystematicsTool.cxx:17
InDet::InDetTrackSystematicsTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &) override
configure the tool to apply a given list of systematic variations
Definition
InDetTrackSystematicsTool.cxx:42
InDet::InDetTrackSystematicsTool::m_sysFilterMap
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_sysFilterMap
Definition
InDetTrackSystematicsTool.h:52
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition
AsgTool.h:47
InDet
Primary Vertex Finder.
Definition
VP1ErrorUtils.h:36
Generated on
for ATLAS Offline Software by
1.17.0