ATLAS Offline Software
ISkipEventIdxSvc.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 /*
3  * Copyright (C) 2023 CERN for the benefit of the ATLAS collaboration.
4  */
5 #ifndef PILEUPMT_ISKIPEVENTIDXSVC_H
6 #define PILEUPMT_ISKIPEVENTIDXSVC_H
7 
8 #include <GaudiKernel/IService.h>
9 #include <fmt/format.h>
10 
11 #include <cstdint>
12 
13 class ISkipEventIdxSvc : virtual public IService {
14  public:
16  struct EvtId {
21  };
22 
23  using EvtIter = std::vector<EvtId>::const_iterator;
24 
25  template <
26  typename Fn,
27  std::enable_if_t<std::is_invocable_r_v<StatusCode, Fn, EvtIter, EvtIter>>>
29  return this->registerCallback(
30  std::function<StatusCode(EvtIter, EvtIter)>(callback));
31  }
33  std::function<StatusCode(EvtIter, EvtIter)>&& callback) = 0;
34 };
35 
36 template <>
37 struct fmt::formatter<ISkipEventIdxSvc::EvtId> : formatter<string_view> {
38  template <typename FormatContext>
39  auto format(const ISkipEventIdxSvc::EvtId& evtId, FormatContext& ctx) {
40  auto out = memory_buffer();
41  fmt::format_to(std::back_inserter(out), "[Run: {}, LB: {}, Evt: {} ({})]",
42  evtId.runNum, evtId.lbNum, evtId.evtNum, evtId.evtIdx);
43  const string_view str(out.data(), out.size());
45  }
46 };
47 #endif // PILEUPMT_ISKIPEVENTIDXSVC_H
ISkipEventIdxSvc::EvtId
Definition: ISkipEventIdxSvc.h:16
vtune_athena.format
format
Definition: vtune_athena.py:14
ISkipEventIdxSvc
Definition: ISkipEventIdxSvc.h:13
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
runLayerRecalibration.callback
callback
Definition: runLayerRecalibration.py:64
ISkipEventIdxSvc::registerCallback
virtual StatusCode registerCallback(std::function< StatusCode(EvtIter, EvtIter)> &&callback)=0
fmt::formatter< ISkipEventIdxSvc::EvtId >::format
auto format(const ISkipEventIdxSvc::EvtId &evtId, FormatContext &ctx)
Definition: ISkipEventIdxSvc.h:39
ISkipEventIdxSvc::EvtId::evtNum
std::uint64_t evtNum
Definition: ISkipEventIdxSvc.h:19
ISkipEventIdxSvc::EvtIter
std::vector< EvtId >::const_iterator EvtIter
Definition: ISkipEventIdxSvc.h:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ISkipEventIdxSvc::EvtId::evtIdx
std::uint64_t evtIdx
Definition: ISkipEventIdxSvc.h:20
vtune_athena.formatter
formatter
Definition: vtune_athena.py:19
ISkipEventIdxSvc::DeclareInterfaceID
DeclareInterfaceID(ISkipEventIdxSvc, 1, 0)
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
ISkipEventIdxSvc::EvtId::lbNum
std::uint32_t lbNum
Definition: ISkipEventIdxSvc.h:18
ISkipEventIdxSvc::EvtId::runNum
std::uint32_t runNum
Definition: ISkipEventIdxSvc.h:17
ISkipEventIdxSvc::registerCallback
StatusCode registerCallback(Fn &&callback)
Definition: ISkipEventIdxSvc.h:28
str
Definition: BTagTrackIpAccessor.cxx:11