ATLAS Offline Software
EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/CopyHelpers.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 #ifndef EGAMMA_ANALYSIS_ALGORITHMS__COPY_HELPERS_H
10 #define EGAMMA_ANALYSIS_ALGORITHMS__COPY_HELPERS_H
11 
13 
16 
17 namespace CP
18 {
19  namespace detail
20  {
21  template<>
23  {
25  public:
26  typedef std::decay<decltype(
27  *(std::declval<EL::AnaAlgorithm>().evtStore()))>::type StoreType;
28 
29  static StatusCode
30  getCopy (MsgStream& msgStream, StoreType& store,
31  xAOD::EgammaContainer*& object,
32  const xAOD::EgammaContainer *inputObject,
33  const std::string& outputName, const std::string& auxName)
34  {
35  // Set up a lambda for providing a msg(...) function.
36  // Suppress thread-checker warning because this provides just a wrapper to MsgStream.
37  const auto msg = [&] ATLAS_NOT_THREAD_SAFE (MSG::Level lvl) -> MsgStream& {
38  msgStream << lvl;
39  return msgStream;
40  };
41 
42  xAOD::IParticleContainer *subobject = nullptr;
43  if (!ShallowCopy<xAOD::IParticleContainer>::getCopy (msgStream, store, subobject, inputObject, outputName, auxName).isSuccess())
44  return StatusCode::FAILURE;
45  if (!(object = dynamic_cast<xAOD::EgammaContainer*>(subobject)))
46  {
47  ANA_MSG_ERROR ("copy of EgammaContainer is not an EgammaContainer");
48  ANA_MSG_ERROR ("check logic in CopyHelpers");
49  return StatusCode::FAILURE;
50  }
51  return StatusCode::SUCCESS;
52  }
53  };
54  }
55 }
56 
57 #endif
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
detail
Definition: extract_histogram_tag.cxx:14
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::detail::ShallowCopy
a helper class to create shallow copies and register them in the event store
Definition: SystematicsHandles/SystematicsHandles/CopyHelpers.h:61
EgammaContainer.h
CP::detail::ShallowCopy< xAOD::EgammaContainer >::StoreType
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
Definition: EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/CopyHelpers.h:27
CP::detail::ShallowCopy< xAOD::EgammaContainer >::getCopy
static StatusCode getCopy(MsgStream &msgStream, StoreType &store, xAOD::EgammaContainer *&object, const xAOD::EgammaContainer *inputObject, const std::string &outputName, const std::string &auxName)
Definition: EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/CopyHelpers.h:30
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
lumiFormat.outputName
string outputName
Definition: lumiFormat.py:71
CopyHelpers.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
checker_macros.h
Define macros for attributes used to control the static checker.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7