|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef XAOD_STANDALONE
20 const T* HandlePtr = asg_tool->
getProperty < T > (prop_name);
21 if (!HandlePtr) Error(
"getProperty()",
"Failed to retrieve property %s ", prop_name.c_str());
22 else prop = (*HandlePtr);
30 const ToolHandle<CP::IMuonTriggerScaleFactors>& Handle,
32 const std::string& Trigger):
33 MuonVal::MuonTesterBranch{
tree,
"MuTriggerSF_" +Trigger},
50 if (!readHandle.isPresent()) {
76 if (
m_handle->applySystematicVariation(syst_set) != StatusCode::SUCCESS) {
91 const ToolHandle<CP::IMuonEfficiencyScaleFactors> &handle,
92 const std::string& relName) :
93 MuonVal::MuonTesterBranch{
tree, relName + (relName.empty() ?
"" :
"_") +
94 getProperty<std::string>(handle.get(),
"WorkingPoint")},
100 ATH_MSG_ERROR(
"Given tool not MuonCP::MuonEfficiencyScaleFactors");
106 m_SFs.emplace_back(std::make_unique<SFSet>(
set, *
this));
107 if (!
m_SFs.back()->init())
return false;
114 if (!
sys->fill(ctx))
return false;
124 for (
auto& Syst_SF :
m_SFs) {
137 for (
auto& Syst_SF:
m_SFs){
139 bool process = Syst_SF->cpSet.name().empty() ||
140 std::find_if(Syst_SF->cpSet.begin(), Syst_SF->cpSet.end(),
142 return t.isToyVariation() && t.getToyVariation().first ==
143 static_cast<unsigned>(bin);
144 }) != Syst_SF->cpSet.end();
156 if (
m_handle->applySystematicVariation(Syst_SF.
cpSet) != StatusCode::SUCCESS) {
169 if (std::abs(
muon.eta()) > 2.5) {
194 const ToolHandle<CP::IMuonEfficiencyScaleFactors> &handle,
195 const std::string& relName) :
196 MuonVal::MuonTesterBranch{
tree, relName + (relName.empty() ?
"" :
"_") +
197 getProperty<std::string>(handle.get(),
"WorkingPoint") +
"SFReplica"},
204 if(!
br->init())
return false;
210 if (!
br->fill(ctx)) {
219 for (
auto& [cpSys,
br] :
m_SFs) {
220 if (
m_handle->applySystematicVariation(cpSys) != StatusCode::SUCCESS) {
223 std::vector<float> replica{};
228 for (
auto repl : replica) {
xAOD::MuonContainer * muonContainer
MuonVal::ScalarBranch< double > m_sys_up_SF
MuonVal::ScalarBranch< float > mcEff
TriggerSFBranches(MuonVal::MuonTesterTree &tree, const ToolHandle< CP::IMuonTriggerScaleFactors > &Handle, const std::string &muonContainer, const std::string &Trigger)
std::vector< CP::SystematicSet > make_systematics_vector(const SystematicSet &systematics)
utility functions for working with systematics
bool fill(const EventContext &ctx) override
The fill method checks if enough information is provided such that the branch is cleared from the inf...
ToolHandle< CP::IMuonEfficiencyScaleFactors > m_handle
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
void setMuon(const xAOD::Muon &muon) override final
Class to wrap a set of SystematicVariations.
Helper struct to store scale factor, data efficiency + mc efficiency for each systematic variation.
std::string name() const
returns: the systematics joined into a single string.
const CP::SystematicSet cpSet
Systematic set.
bool init() override
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
TTree * tree() override final
Returns the underlying TTree object.
ToolHandle< CP::IMuonTriggerScaleFactors > m_handle
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
ToolHandle< CP::IMuonEfficiencyScaleFactors > m_handle
@ Error
Some error happened during the object correction.
MuonVal::ScalarBranch< double > m_nominal_SF
MuonVal::ScalarBranch< double > m_sys_down_SF
T getProperty(const asg::IAsgTool *interface_tool, const std::string &prop_name)
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
MuonVal::ScalarBranch< double > m_stat_up_SF
std::string name() const override final
Returns the name of the branch.
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
CP::CorrectionCode fillSystematic(const xAOD::Muon &muon, SFSet &set)
bool init() override
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
Class to store array like branches into the n-tuples.
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
MuonVal::ScalarBranch< float > scaleFactor
Actual branches storing scaleFactor & mcEff & dataEff.
MuonVal::ScalarBranch< float > dataEff
void setMuon(const xAOD::Muon &muon) override final
@ Ok
The correction was done successfully.
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
MuonSFBranches(MuonVal::MuonTesterTree &tree, const ToolHandle< CP::IMuonEfficiencyScaleFactors > &handle, const std::string &rel_name="")
#define ATH_MSG_WARNING(x)
std::vector< std::unique_ptr< SFSet > > m_SFs
Return value from object correction CP tools.
MuonVal::ScalarBranch< double > m_stat_down_SF
CP::CorrectionCode getSF(const xAOD::MuonContainer *muons, MuonVal::ScalarBranch< double > &Var, const CP::SystematicVariation &syst)
SG::ReadHandleKey< xAOD::MuonContainer > m_key
std::map< CP::SystematicSet, std::shared_ptr< MuonVal::VectorBranch< float > > > m_SFs
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
bool empty() const noexcept
Returns true if the collection is empty.
MuonReplicaBranches(MuonVal::MuonTesterTree &tree, const ToolHandle< CP::IMuonEfficiencyScaleFactors > &handle, const std::string &rel_name="")
static std::string systName(const CP::SystematicSet &set)
Dummy helper function that encodes the systname set.