|
ATLAS Offline Software
|
Go to the documentation of this file.
8 #ifndef SYSTEMATICS_HANDLES__COPY_HELPERS_H
9 #define SYSTEMATICS_HANDLES__COPY_HELPERS_H
47 static const int value = ( std::is_same< std::true_type, decltype( test_iparticle< T >(
nullptr ) ) >::
value ?
48 1 : ( std::is_same< std::true_type, decltype( test_container< T >(
nullptr ) ) >
::value ?
63 "Type can not be shallow copied");
71 typedef std::decay<decltype(
76 T*&
object,
const T *inputObject,
77 const std::string&
outputName,
const std::string& auxName)
87 assert (inputObject !=
nullptr);
90 if( ! inputObject->getConstStore() ) {
93 if( inputObject->size() ) {
96 const T* originContainer =
97 dynamic_cast< const T*
>( ( *inputObject )[ 0 ]->container() );
100 for(
size_t i = 1;
i < inputObject->size(); ++
i ) {
101 if( ( *inputObject )[
i ]->container() != originContainer ) {
103 "container come from the same container!" );
104 return StatusCode::FAILURE;
108 static const char*
const ORIGIN_POSTFIX =
"_ShallowCopyOrigin";
111 if( ( ! originCopy.first ) || ( ! originCopy.second ) ) {
112 ANA_MSG_ERROR(
"Failed to shallow copy the origin of a view "
114 return StatusCode::FAILURE;
123 auto viewCopyPtr = viewCopy.get();
124 for(
const auto* element : *inputObject ) {
125 viewCopy->push_back( originCopy.first->at( element->index() ) );
131 for(
size_t i = 0;
i < inputObject->size(); ++
i ) {
133 *( ( *viewCopy )[
i ] ) ) ) {
134 return StatusCode::FAILURE;
140 object = viewCopyPtr;
141 return StatusCode::SUCCESS;
146 auto viewCopyPtr = viewCopy.get();
149 object = viewCopyPtr;
150 return StatusCode::SUCCESS;
161 return StatusCode::FAILURE;
165 return StatusCode::FAILURE;
171 return StatusCode::SUCCESS;
181 typedef std::decay<decltype(
186 T*&
object,
const T *inputObject,
187 const std::string&
outputName,
const std::string& auxName)
197 assert (inputObject !=
nullptr);
200 if( ! inputObject->getConstStore() ) {
203 if( inputObject->size() ) {
206 const T* originContainer =
207 dynamic_cast< const T*
>( ( *inputObject )[ 0 ]->container() );
210 for(
size_t i = 1;
i < inputObject->size(); ++
i ) {
211 if( ( *inputObject )[
i ]->container() != originContainer ) {
213 "container come from the same container!" );
214 return StatusCode::FAILURE;
218 static const char*
const ORIGIN_POSTFIX =
"_ShallowCopyOrigin";
221 if( ( ! originCopy.first ) || ( ! originCopy.second ) ) {
222 ANA_MSG_ERROR(
"Failed to shallow copy the origin of a view "
224 return StatusCode::FAILURE;
234 auto viewCopyPtr = viewCopy.get();
235 for(
const auto* element : *inputObject ) {
236 viewCopy->push_back( originCopy.first->at( element->index() ) );
241 object = viewCopyPtr;
242 return StatusCode::SUCCESS;
247 auto viewCopyPtr = viewCopy.get();
250 object = viewCopyPtr;
251 return StatusCode::SUCCESS;
262 return StatusCode::FAILURE;
268 return StatusCode::SUCCESS;
278 typedef std::decay<decltype(
283 T*&
object,
const T *inputObject,
284 const std::string&
outputName,
const std::string& auxName)
299 return StatusCode::FAILURE;
305 return StatusCode::SUCCESS;
314 typedef std::decay<decltype(
320 const std::string&
outputName,
const std::string& auxName);
static std::true_type test_iparticle(checker< C, decltype((*(const xAOD::IParticle **) nullptr)=((C *) nullptr) ->at(0))> *)
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Class providing the definition of the 4-vector interface.
static std::false_type test_iparticle(...)
Select isolated Photons, Electrons and Muons.
Manage index tracking and synchronization of auxiliary data.
a helper class to create shallow copies and register them in the event store
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
static StatusCode getCopy(MsgStream &msgStream, StoreType &store, T *&object, const T *inputObject, const std::string &outputName, const std::string &auxName)
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
std::pair< T *, ShallowAuxInfo * > shallowCopyObject(const T &obj)
Function making a shallow copy of a constant standalone object.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::decay< decltype(*(std::declval< EL::AnaAlgorithm >).evtStore()))>::type StoreType
the type of the event store we use
static std::false_type test_container(...)
static std::true_type test_container(checker< C, decltype((*(const SG::AuxVectorBase **) nullptr)=((C *) nullptr))> *)
static StatusCode getCopy(MsgStream &msgStream, StoreType &store, T *&object, const T *inputObject, const std::string &outputName, const std::string &auxName)
static StatusCode getCopy(MsgStream &msgStream, StoreType &store, T *&object, const T *inputObject, const std::string &outputName, const std::string &auxName)
void record(const T *p, const std::string &key)
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
bool setOriginalObjectLink(const IParticle &original, IParticle ©)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...
check what kind of object/container the argument is
Define macros for attributes used to control the static checker.
static const int value
Value evaluating to: