ATLAS Offline Software
JvtUpdateAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 //
9 // includes
10 //
11 
13 
14 //
15 // method implementations
16 //
17 
18 namespace CP
19 {
20 
22  initialize ()
23  {
24  if (m_decorationName.empty())
25  {
26  ANA_MSG_ERROR ("decoration name set to empty string, not allowed");
27  return StatusCode::FAILURE;
28  }
31 
32  ANA_CHECK (m_jvtTool.retrieve());
36  return StatusCode::SUCCESS;
37  }
38 
39 
40 
42  execute ()
43  {
44  for (const auto& sys : m_systematicsList.systematicsVector())
45  {
46  xAOD::JetContainer *jets = nullptr;
47  ANA_CHECK (m_jetHandle.getCopy (jets, sys));
48  for (xAOD::Jet *jet : *jets)
49  {
50  // Set default value for jets that fail preselection
51  (*m_decorationAccessor) (*jet) = -1.;
52  if (m_preselection.getBool (*jet, sys))
53  {
54  // manually update jvt decoration using the tool
55  const float jvt = m_jvtTool->updateJvt (*jet);
56  (*m_decorationAccessor) (*jet) = jvt;
57  }
58  }
59  }
60  return StatusCode::SUCCESS;
61  }
62 }
CP::JvtUpdateAlg::m_jetHandle
SysCopyHandle< xAOD::JetContainer > m_jetHandle
the jet collection we run on
Definition: JvtUpdateAlg.h:43
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
CP::JvtUpdateAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition: JvtUpdateAlg.h:48
CP::JvtUpdateAlg::m_jvtTool
ToolHandle< IJetUpdateJvt > m_jvtTool
the update tool
Definition: JvtUpdateAlg.h:35
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
CP::SysReadSelectionHandle::getBool
bool getBool(const SG::AuxElement &element, const CP::SystematicSet &sys) const
get the selection as a bool
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JvtUpdateAlg.h
CP::JvtUpdateAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: JvtUpdateAlg.h:39
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CP::JvtUpdateAlg::execute
StatusCode execute() override
Definition: JvtUpdateAlg.cxx:42
CP::JvtUpdateAlg::initialize
StatusCode initialize() override
Definition: JvtUpdateAlg.cxx:22
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
CP::JvtUpdateAlg::m_decorationAccessor
std::unique_ptr< SG::AuxElement::Accessor< float > > m_decorationAccessor
the decoration accessor we use
Definition: JvtUpdateAlg.h:57
CP::JvtUpdateAlg::m_decorationName
Gaudi::Property< std::string > m_decorationName
the name of the decoration we create
Definition: JvtUpdateAlg.h:53