ATLAS Offline Software
Loading...
Searching...
No Matches
SystematicsHandles/Root/CopyHelpers.cxx
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// includes
10//
11
13
21
22//
23// method implementations
24//
25
26namespace CP
27{
28 namespace detail
29 {
31 getCopy (MsgStream& msgStream, StoreType& store,
33 const xAOD::IParticleContainer *inputObject,
34 const std::string& outputName, const std::string& auxName)
35 {
36 // this is probably not the best way to do this, but doing this
37 // the proper way will require an xAOD expert to do it.
38
39 // Set up a lambda for providing a msg(...) function.
40 // Suppress thread-checker warning because this provides just a wrapper to MsgStream.
41 const auto msg = [&] ATLAS_NOT_THREAD_SAFE (MSG::Level lvl) -> MsgStream& {
42 msgStream << lvl;
43 return msgStream;
44 };
45
46 // using a macro is a bit awkward, but doing this as a template
47 // is not practical either
48#define COPY(TYPE) \
49 do { \
50 const TYPE *in = dynamic_cast< const TYPE* >( inputObject ); \
51 if( in ) { \
52 TYPE *out = nullptr; \
53 ANA_CHECK( ShallowCopy<TYPE>::getCopy( msgStream, store, out, in, \
54 outputName, auxName ) ); \
55 object = out; \
56 return StatusCode::SUCCESS; \
57 } \
58 } while( false )
59
67
68#undef COPY
69
70 ANA_MSG_ERROR ("could not determine type to create shallow copy " << outputName);
71 ANA_MSG_ERROR ("please extend CopyHelpers.cxx with the appropriate type");
72 return StatusCode::FAILURE;
73 }
74 }
75}
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define COPY(TYPE)
Select isolated Photons, Electrons and Muons.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
void ClearTransientTrees ATLAS_NOT_THREAD_SAFE()
Function cleaning up the managed memory.
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >().evtStore()))>::type StoreType
the type of the event store we use
a helper class to create shallow copies and register them in the event store
MsgStream & msg
Definition testRead.cxx:32